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