]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/nonownedwnd.h
Allow returning NULL windows from GetCompositeWindowParts().
[wxWidgets.git] / include / wx / osx / nonownedwnd.h
CommitLineData
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
a9a4f229 7// RCS-ID: $Id$
6762286d
SC
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
9a83f860 18 #define wxMAC_WINDOW_PLAIN_TRANSITION wxT("mac.window-plain-transition")
6762286d
SC
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
31class wxNonOwnedWindowImpl;
32
33class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow
34{
35public:
36 // constructors and such
37 wxNonOwnedWindow() { Init(); }
38
39 wxNonOwnedWindow(wxWindow *parent,
40 wxWindowID id,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = 0,
44 const wxString& name = wxPanelNameStr)
45 {
46 Init();
47
48 (void)Create(parent, id, pos, size, style, name);
49 }
50
51 bool Create(wxWindow *parent,
52 wxWindowID id,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = 0,
56 const wxString& name = wxPanelNameStr);
57
17e2694c 58 bool Create(wxWindow *parent, WXWindow nativeWindow);
ce00f59b 59
6762286d 60 virtual ~wxNonOwnedWindow();
ce00f59b 61
d623e8b1
SC
62 virtual void SubclassWin(WXWindow nativeWindow);
63 virtual void UnsubclassWin();
6762286d
SC
64
65 virtual wxPoint GetClientAreaOrigin() const;
66
67 // implement base class pure virtuals
68
6762286d
SC
69 virtual bool SetTransparent(wxByte alpha);
70 virtual bool CanSetTransparent();
71
72 virtual bool SetBackgroundStyle(wxBackgroundStyle style);
03647350 73
6762286d
SC
74 virtual void Update();
75
76 WXWindow GetWXWindow() const ;
77 static wxNonOwnedWindow* GetFromWXWindow( WXWindow win );
78
79 // implementation from now on
80 // --------------------------
81
8e88e984 82 virtual bool DoSetShape(const wxRegion& region);
b61b8371 83 const wxRegion& GetShape() const { return m_shape; }
8e88e984 84
6762286d
SC
85 // activation hooks only necessary for MDI Implementation
86 static void MacDelayedDeactivation(long timestamp);
87 virtual void MacActivate( long timestamp , bool inIsActivating ) ;
88
b6dc21e7 89 virtual void SetWindowStyleFlag(long flags);
6762286d
SC
90
91 virtual void Raise();
92 virtual void Lower();
93 virtual bool Show( bool show = true );
94
6762286d
SC
95 virtual void SetExtraStyle(long exStyle) ;
96
97 virtual bool SetBackgroundColour( const wxColour &colour );
03647350 98
6762286d 99 wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; }
03647350 100
ff6893d2
VZ
101#if wxOSX_USE_COCOA_OR_IPHONE
102 // override the base class method to return an NSWindow instead of NSView
103 virtual void *OSXGetViewOrWindow() const { return GetWXWindow(); }
104#endif // Cocoa
105
6762286d 106 // osx specific event handling common for all osx-ports
03647350 107
6762286d
SC
108 virtual void HandleActivated( double timestampsec, bool didActivate );
109 virtual void HandleResized( double timestampsec );
110 virtual void HandleMoved( double timestampsec );
111 virtual void HandleResizing( double timestampsec, wxRect* rect );
ce00f59b 112
e2758e21 113 virtual bool Destroy();
ce00f59b 114
6762286d
SC
115protected:
116 // common part of all ctors
117 void Init();
118
119 virtual void DoGetPosition( int *x, int *y ) const;
120 virtual void DoGetSize( int *width, int *height ) const;
121 virtual void DoMoveWindow(int x, int y, int width, int height);
122 virtual void DoGetClientSize(int *width, int *height) const;
123
ab9a0b84
VZ
124 virtual bool OSXShowWithEffect(bool show,
125 wxShowEffect effect,
126 unsigned timeout);
ce00f59b 127
e2758e21 128 virtual void WillBeDestroyed();
ab9a0b84 129
6762286d
SC
130 wxNonOwnedWindowImpl* m_nowpeer ;
131
132// wxWindowMac* m_macFocus ;
133
134 static wxNonOwnedWindow *s_macDeactivateWindow;
ce00f59b 135
6762286d 136private :
b61b8371 137 wxRegion m_shape;
6762286d
SC
138};
139
140// list of all frames and modeless dialogs
141extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows;
142
143
144#endif // _WX_MAC_NONOWNEDWND_H_