]>
Commit | Line | Data |
---|---|---|
6762286d | 1 | /////////////////////////////////////////////////////////////////////////////// |
233f5738 | 2 | // Name: wx/osx/nonownedwnd.h |
6762286d SC |
3 | // Purpose: declares wxNonOwnedWindow class |
4 | // Author: Stefan Csomor | |
03647350 | 5 | // Modified by: |
6762286d | 6 | // Created: 2008-03-24 |
6762286d SC |
7 | // Copyright: (c) 2008 Stefan Csomor |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_MAC_NONOWNEDWND_H_ | |
12 | #define _WX_MAC_NONOWNEDWND_H_ | |
13 | ||
14 | #include "wx/window.h" | |
15 | ||
46ea442c VZ |
16 | #include "wx/graphics.h" |
17 | ||
6762286d | 18 | #if wxUSE_SYSTEM_OPTIONS |
9a83f860 | 19 | #define wxMAC_WINDOW_PLAIN_TRANSITION wxT("mac.window-plain-transition") |
6762286d SC |
20 | #endif |
21 | ||
22 | //----------------------------------------------------------------------------- | |
23 | // wxNonOwnedWindow | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | // This class represents "non-owned" window. A window is owned by another | |
27 | // window if it has a parent and is positioned within the parent. For example, | |
28 | // wxFrame is non-owned, because even though it can have a parent, it's | |
29 | // location is independent of it. This class is for internal use only, it's | |
30 | // the base class for wxTopLevelWindow and wxPopupWindow. | |
31 | ||
32 | class wxNonOwnedWindowImpl; | |
33 | ||
5bd0ee99 | 34 | class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase |
6762286d SC |
35 | { |
36 | public: | |
37 | // constructors and such | |
38 | wxNonOwnedWindow() { Init(); } | |
39 | ||
40 | wxNonOwnedWindow(wxWindow *parent, | |
41 | wxWindowID id, | |
42 | const wxPoint& pos = wxDefaultPosition, | |
43 | const wxSize& size = wxDefaultSize, | |
44 | long style = 0, | |
45 | const wxString& name = wxPanelNameStr) | |
46 | { | |
47 | Init(); | |
48 | ||
49 | (void)Create(parent, id, pos, size, style, name); | |
50 | } | |
51 | ||
52 | bool Create(wxWindow *parent, | |
53 | wxWindowID id, | |
54 | const wxPoint& pos = wxDefaultPosition, | |
55 | const wxSize& size = wxDefaultSize, | |
56 | long style = 0, | |
57 | const wxString& name = wxPanelNameStr); | |
58 | ||
17e2694c | 59 | bool Create(wxWindow *parent, WXWindow nativeWindow); |
ce00f59b | 60 | |
6762286d | 61 | virtual ~wxNonOwnedWindow(); |
ce00f59b | 62 | |
d623e8b1 SC |
63 | virtual void SubclassWin(WXWindow nativeWindow); |
64 | virtual void UnsubclassWin(); | |
6762286d SC |
65 | |
66 | virtual wxPoint GetClientAreaOrigin() const; | |
f8619070 | 67 | |
6762286d SC |
68 | // implement base class pure virtuals |
69 | ||
6762286d SC |
70 | virtual bool SetTransparent(wxByte alpha); |
71 | virtual bool CanSetTransparent(); | |
72 | ||
73 | virtual bool SetBackgroundStyle(wxBackgroundStyle style); | |
03647350 | 74 | |
6762286d SC |
75 | virtual void Update(); |
76 | ||
77 | WXWindow GetWXWindow() const ; | |
78 | static wxNonOwnedWindow* GetFromWXWindow( WXWindow win ); | |
79 | ||
80 | // implementation from now on | |
81 | // -------------------------- | |
82 | ||
e520c3f7 | 83 | // These accessors are Mac-specific and don't exist in other ports. |
b61b8371 | 84 | const wxRegion& GetShape() const { return m_shape; } |
46ea442c VZ |
85 | #if wxUSE_GRAPHICS_CONTEXT |
86 | const wxGraphicsPath& GetShapePath() { return m_shapePath; } | |
87 | #endif // wxUSE_GRAPHICS_CONTEXT | |
88 | ||
6762286d SC |
89 | // activation hooks only necessary for MDI Implementation |
90 | static void MacDelayedDeactivation(long timestamp); | |
91 | virtual void MacActivate( long timestamp , bool inIsActivating ) ; | |
92 | ||
b6dc21e7 | 93 | virtual void SetWindowStyleFlag(long flags); |
6762286d SC |
94 | |
95 | virtual void Raise(); | |
96 | virtual void Lower(); | |
97 | virtual bool Show( bool show = true ); | |
98 | ||
6762286d SC |
99 | virtual void SetExtraStyle(long exStyle) ; |
100 | ||
101 | virtual bool SetBackgroundColour( const wxColour &colour ); | |
03647350 | 102 | |
6762286d | 103 | wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; } |
03647350 | 104 | |
ff6893d2 VZ |
105 | #if wxOSX_USE_COCOA_OR_IPHONE |
106 | // override the base class method to return an NSWindow instead of NSView | |
107 | virtual void *OSXGetViewOrWindow() const { return GetWXWindow(); } | |
108 | #endif // Cocoa | |
109 | ||
6762286d | 110 | // osx specific event handling common for all osx-ports |
03647350 | 111 | |
6762286d SC |
112 | virtual void HandleActivated( double timestampsec, bool didActivate ); |
113 | virtual void HandleResized( double timestampsec ); | |
114 | virtual void HandleMoved( double timestampsec ); | |
115 | virtual void HandleResizing( double timestampsec, wxRect* rect ); | |
7dc941e3 SC |
116 | |
117 | void WindowWasPainted(); | |
ce00f59b | 118 | |
e2758e21 | 119 | virtual bool Destroy(); |
ce00f59b | 120 | |
6762286d SC |
121 | protected: |
122 | // common part of all ctors | |
123 | void Init(); | |
124 | ||
125 | virtual void DoGetPosition( int *x, int *y ) const; | |
126 | virtual void DoGetSize( int *width, int *height ) const; | |
127 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
128 | virtual void DoGetClientSize(int *width, int *height) const; | |
129 | ||
ab9a0b84 VZ |
130 | virtual bool OSXShowWithEffect(bool show, |
131 | wxShowEffect effect, | |
132 | unsigned timeout); | |
ce00f59b | 133 | |
46ea442c VZ |
134 | virtual bool DoClearShape(); |
135 | virtual bool DoSetRegionShape(const wxRegion& region); | |
136 | #if wxUSE_GRAPHICS_CONTEXT | |
137 | virtual bool DoSetPathShape(const wxGraphicsPath& path); | |
138 | #endif // wxUSE_GRAPHICS_CONTEXT | |
139 | ||
e2758e21 | 140 | virtual void WillBeDestroyed(); |
ab9a0b84 | 141 | |
6762286d SC |
142 | wxNonOwnedWindowImpl* m_nowpeer ; |
143 | ||
144 | // wxWindowMac* m_macFocus ; | |
145 | ||
146 | static wxNonOwnedWindow *s_macDeactivateWindow; | |
ce00f59b | 147 | |
6762286d | 148 | private : |
7dc941e3 SC |
149 | static clock_t s_lastFlush; |
150 | ||
b61b8371 | 151 | wxRegion m_shape; |
46ea442c VZ |
152 | #if wxUSE_GRAPHICS_CONTEXT |
153 | wxGraphicsPath m_shapePath; | |
154 | #endif // wxUSE_GRAPHICS_CONTEXT | |
6762286d SC |
155 | }; |
156 | ||
157 | // list of all frames and modeless dialogs | |
158 | extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows; | |
159 | ||
160 | ||
161 | #endif // _WX_MAC_NONOWNEDWND_H_ |