1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/nonownedwnd.h
3 // Purpose: declares wxNonOwnedWindow class
4 // Author: Stefan Csomor
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 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MAC_NONOWNEDWND_H_
13 #define _WX_MAC_NONOWNEDWND_H_
15 #include "wx/window.h"
17 #if wxUSE_SYSTEM_OPTIONS
18 #define wxMAC_WINDOW_PLAIN_TRANSITION wxT("mac.window-plain-transition")
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
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.
31 class wxNonOwnedWindowImpl
;
33 class WXDLLIMPEXP_CORE wxNonOwnedWindow
: public wxWindow
36 // constructors and such
37 wxNonOwnedWindow() { Init(); }
39 wxNonOwnedWindow(wxWindow
*parent
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
,
44 const wxString
& name
= wxPanelNameStr
)
48 (void)Create(parent
, id
, pos
, size
, style
, name
);
51 bool Create(wxWindow
*parent
,
53 const wxPoint
& pos
= wxDefaultPosition
,
54 const wxSize
& size
= wxDefaultSize
,
56 const wxString
& name
= wxPanelNameStr
);
58 virtual ~wxNonOwnedWindow();
60 virtual wxPoint
GetClientAreaOrigin() const;
62 // implement base class pure virtuals
64 virtual bool SetTransparent(wxByte alpha
);
65 virtual bool CanSetTransparent();
67 virtual bool SetBackgroundStyle(wxBackgroundStyle style
);
69 virtual void Update();
71 WXWindow
GetWXWindow() const ;
72 static wxNonOwnedWindow
* GetFromWXWindow( WXWindow win
);
74 // implementation from now on
75 // --------------------------
77 virtual bool DoSetShape(const wxRegion
& region
);
79 // activation hooks only necessary for MDI Implementation
80 static void MacDelayedDeactivation(long timestamp
);
81 virtual void MacActivate( long timestamp
, bool inIsActivating
) ;
83 virtual void SetWindowStyleFlag(long flags
);
87 virtual bool Show( bool show
= true );
89 virtual void SetExtraStyle(long exStyle
) ;
91 virtual bool SetBackgroundColour( const wxColour
&colour
);
93 wxNonOwnedWindowImpl
* GetNonOwnedPeer() const { return m_nowpeer
; }
95 #if wxOSX_USE_COCOA_OR_IPHONE
96 // override the base class method to return an NSWindow instead of NSView
97 virtual void *OSXGetViewOrWindow() const { return GetWXWindow(); }
100 // osx specific event handling common for all osx-ports
102 virtual void HandleActivated( double timestampsec
, bool didActivate
);
103 virtual void HandleResized( double timestampsec
);
104 virtual void HandleMoved( double timestampsec
);
105 virtual void HandleResizing( double timestampsec
, wxRect
* rect
);
107 virtual bool Destroy();
110 // common part of all ctors
113 virtual void DoGetPosition( int *x
, int *y
) const;
114 virtual void DoGetSize( int *width
, int *height
) const;
115 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
116 virtual void DoGetClientSize(int *width
, int *height
) const;
118 virtual bool OSXShowWithEffect(bool show
,
122 virtual void WillBeDestroyed();
124 wxNonOwnedWindowImpl
* m_nowpeer
;
126 // wxWindowMac* m_macFocus ;
128 static wxNonOwnedWindow
*s_macDeactivateWindow
;
132 // list of all frames and modeless dialogs
133 extern WXDLLIMPEXP_DATA_CORE(wxWindowList
) wxModelessWindows
;
136 #endif // _WX_MAC_NONOWNEDWND_H_