]>
Commit | Line | Data |
---|---|---|
a6947664 SC |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/mac/nonownedwnd.h | |
3 | // Purpose: declares wxNonOwnedWindow class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 2008-03-24 | |
7 | // RCS-ID: $Id: nonownedwnd.h 46993 2007-06-28 08:46:04Z VS $ | |
8 | // Copyright: (c) 2008 Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_MAC_NONOWNEDWND_H_ | |
13 | #define _WX_MAC_NONOWNEDWND_H_ | |
14 | ||
15 | #include "wx/window.h" | |
16 | ||
17 | #if wxUSE_SYSTEM_OPTIONS | |
18 | #define wxMAC_WINDOW_PLAIN_TRANSITION _T("mac.window-plain-transition") | |
19 | #endif | |
20 | ||
21 | //----------------------------------------------------------------------------- | |
22 | // wxNonOwnedWindow | |
23 | //----------------------------------------------------------------------------- | |
24 | ||
25 | // This class represents "non-owned" window. A window is owned by another | |
26 | // window if it has a parent and is positioned within the parent. For example, | |
27 | // wxFrame is non-owned, because even though it can have a parent, it's | |
28 | // location is independent of it. This class is for internal use only, it's | |
29 | // the base class for wxTopLevelWindow and wxPopupWindow. | |
30 | ||
31 | class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow | |
32 | { | |
33 | public: | |
34 | // constructors and such | |
35 | wxNonOwnedWindow() { Init(); } | |
36 | ||
37 | wxNonOwnedWindow(wxWindow *parent, | |
38 | wxWindowID id, | |
39 | const wxPoint& pos = wxDefaultPosition, | |
40 | const wxSize& size = wxDefaultSize, | |
41 | long style = 0, | |
42 | const wxString& name = wxPanelNameStr) | |
43 | { | |
44 | Init(); | |
45 | ||
46 | (void)Create(parent, id, pos, size, style, name); | |
47 | } | |
48 | ||
49 | bool Create(wxWindow *parent, | |
50 | wxWindowID id, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | long style = 0, | |
54 | const wxString& name = wxPanelNameStr); | |
55 | ||
56 | virtual ~wxNonOwnedWindow(); | |
57 | ||
58 | virtual wxPoint GetClientAreaOrigin() const; | |
59 | ||
60 | // implement base class pure virtuals | |
61 | ||
62 | virtual bool SetShape(const wxRegion& region); | |
63 | ||
64 | virtual bool SetTransparent(wxByte alpha); | |
65 | virtual bool CanSetTransparent(); | |
66 | ||
67 | virtual bool SetBackgroundStyle(wxBackgroundStyle style); | |
68 | ||
69 | // implementation from now on | |
70 | // -------------------------- | |
71 | ||
72 | static void MacDelayedDeactivation(long timestamp); | |
73 | virtual void MacCreateRealWindow( const wxPoint& pos, | |
74 | const wxSize& size, | |
75 | long style, | |
76 | const wxString& name ) ; | |
77 | ||
78 | WXWindow MacGetWindowRef() { return m_macWindow ; } | |
79 | virtual void MacActivate( long timestamp , bool inIsActivating ) ; | |
80 | virtual void MacPerformUpdates() ; | |
81 | ||
82 | virtual void Raise(); | |
83 | virtual void Lower(); | |
84 | virtual bool Show( bool show = true ); | |
85 | ||
86 | virtual bool ShowWithEffect(wxShowEffect effect, | |
87 | unsigned timeout = 0, | |
88 | wxDirection dir = wxBOTTOM); | |
89 | ||
90 | virtual bool HideWithEffect(wxShowEffect effect, | |
91 | unsigned timeout = 0, | |
92 | wxDirection dir = wxBOTTOM); | |
93 | ||
94 | virtual void SetExtraStyle(long exStyle) ; | |
95 | ||
96 | virtual bool SetBackgroundColour( const wxColour &colour ); | |
97 | ||
98 | virtual void MacInstallTopLevelWindowEventHandler() ; | |
99 | ||
100 | bool MacGetMetalAppearance() const ; | |
101 | bool MacGetUnifiedAppearance() const ; | |
102 | ||
103 | void MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) ; | |
104 | wxUint32 MacGetWindowAttributes() const ; | |
105 | ||
106 | WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } | |
107 | ||
108 | virtual void MacGetContentAreaInset( int &left , int &top , int &right , int &bottom ) ; | |
109 | ||
110 | protected: | |
111 | // common part of all ctors | |
112 | void Init(); | |
113 | ||
114 | virtual void DoGetPosition( int *x, int *y ) const; | |
115 | virtual void DoGetSize( int *width, int *height ) const; | |
116 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
117 | virtual void DoGetClientSize(int *width, int *height) const; | |
118 | ||
119 | WXWindow m_macWindow ; | |
120 | ||
121 | wxWindowMac* m_macFocus ; | |
122 | ||
123 | static wxNonOwnedWindow *s_macDeactivateWindow; | |
124 | private : | |
125 | // KH: We cannot let this be called directly since the metal appearance is now managed by an | |
126 | // extra style. Calling this function directly can result in blank white window backgrounds. | |
127 | // This is because the ExtraStyle flags get out of sync with the metal appearance and the metal | |
128 | // logic & checks cease to work as expected. To set the metal appearance, use SetExtraStyle. | |
129 | void MacSetMetalAppearance( bool on ) ; | |
130 | void MacSetUnifiedAppearance( bool on ) ; | |
131 | // binary compatible workaround TODO REPLACE | |
132 | void DoMacCreateRealWindow( wxWindow *parent, | |
133 | const wxPoint& pos, | |
134 | const wxSize& size, | |
135 | long style, | |
136 | const wxString& name ); | |
137 | ||
138 | WXEVENTHANDLERREF m_macEventHandler ; | |
139 | }; | |
140 | ||
141 | // list of all frames and modeless dialogs | |
142 | extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows; | |
143 | ||
144 | ||
145 | #endif // _WX_MAC_NONOWNEDWND_H_ |