]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/nonownedwnd.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / osx / nonownedwnd.h
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 // 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
16 #include "wx/graphics.h"
17
18 #if wxUSE_SYSTEM_OPTIONS
19 #define wxMAC_WINDOW_PLAIN_TRANSITION wxT("mac.window-plain-transition")
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
34 class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase
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
59 bool Create(wxWindow *parent, WXWindow nativeWindow);
60
61 virtual ~wxNonOwnedWindow();
62
63 virtual void SubclassWin(WXWindow nativeWindow);
64 virtual void UnsubclassWin();
65
66 virtual wxPoint GetClientAreaOrigin() const;
67
68 // implement base class pure virtuals
69
70 virtual bool SetTransparent(wxByte alpha);
71 virtual bool CanSetTransparent();
72
73 virtual bool SetBackgroundStyle(wxBackgroundStyle style);
74
75 virtual void Update();
76
77 WXWindow GetWXWindow() const ;
78 static wxNonOwnedWindow* GetFromWXWindow( WXWindow win );
79
80 // implementation from now on
81 // --------------------------
82
83 // These accessors are Mac-specific and don't exist in other ports.
84 const wxRegion& GetShape() const { return m_shape; }
85 #if wxUSE_GRAPHICS_CONTEXT
86 const wxGraphicsPath& GetShapePath() { return m_shapePath; }
87 #endif // wxUSE_GRAPHICS_CONTEXT
88
89 // activation hooks only necessary for MDI Implementation
90 static void MacDelayedDeactivation(long timestamp);
91 virtual void MacActivate( long timestamp , bool inIsActivating ) ;
92
93 virtual void SetWindowStyleFlag(long flags);
94
95 virtual void Raise();
96 virtual void Lower();
97 virtual bool Show( bool show = true );
98
99 virtual void SetExtraStyle(long exStyle) ;
100
101 virtual bool SetBackgroundColour( const wxColour &colour );
102
103 wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; }
104
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;
108 #endif // Cocoa
109
110 // osx specific event handling common for all osx-ports
111
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 );
116
117 void WindowWasPainted();
118
119 virtual bool Destroy();
120
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
130 virtual bool OSXShowWithEffect(bool show,
131 wxShowEffect effect,
132 unsigned timeout);
133
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
140 virtual void WillBeDestroyed();
141
142 wxNonOwnedWindowImpl* m_nowpeer ;
143
144 // wxWindowMac* m_macFocus ;
145
146 static wxNonOwnedWindow *s_macDeactivateWindow;
147
148 private :
149 static clock_t s_lastFlush;
150
151 wxRegion m_shape;
152 #if wxUSE_GRAPHICS_CONTEXT
153 wxGraphicsPath m_shapePath;
154 #endif // wxUSE_GRAPHICS_CONTEXT
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_