]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/nonownedwnd.h
update project files
[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
46ea442c
VZ
17#include "wx/graphics.h"
18
6762286d 19#if wxUSE_SYSTEM_OPTIONS
9a83f860 20 #define wxMAC_WINDOW_PLAIN_TRANSITION wxT("mac.window-plain-transition")
6762286d
SC
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
33class wxNonOwnedWindowImpl;
34
5bd0ee99 35class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase
6762286d
SC
36{
37public:
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
17e2694c 60 bool Create(wxWindow *parent, WXWindow nativeWindow);
ce00f59b 61
6762286d 62 virtual ~wxNonOwnedWindow();
ce00f59b 63
d623e8b1
SC
64 virtual void SubclassWin(WXWindow nativeWindow);
65 virtual void UnsubclassWin();
6762286d
SC
66
67 virtual wxPoint GetClientAreaOrigin() const;
f8619070
SC
68
69 virtual double GetMagnificationFactor() const;
6762286d
SC
70
71 // implement base class pure virtuals
72
6762286d
SC
73 virtual bool SetTransparent(wxByte alpha);
74 virtual bool CanSetTransparent();
75
76 virtual bool SetBackgroundStyle(wxBackgroundStyle style);
03647350 77
6762286d
SC
78 virtual void Update();
79
80 WXWindow GetWXWindow() const ;
81 static wxNonOwnedWindow* GetFromWXWindow( WXWindow win );
82
83 // implementation from now on
84 // --------------------------
85
e520c3f7 86 // These accessors are Mac-specific and don't exist in other ports.
b61b8371 87 const wxRegion& GetShape() const { return m_shape; }
46ea442c
VZ
88#if wxUSE_GRAPHICS_CONTEXT
89 const wxGraphicsPath& GetShapePath() { return m_shapePath; }
90#endif // wxUSE_GRAPHICS_CONTEXT
91
6762286d
SC
92 // activation hooks only necessary for MDI Implementation
93 static void MacDelayedDeactivation(long timestamp);
94 virtual void MacActivate( long timestamp , bool inIsActivating ) ;
95
b6dc21e7 96 virtual void SetWindowStyleFlag(long flags);
6762286d
SC
97
98 virtual void Raise();
99 virtual void Lower();
100 virtual bool Show( bool show = true );
101
6762286d
SC
102 virtual void SetExtraStyle(long exStyle) ;
103
104 virtual bool SetBackgroundColour( const wxColour &colour );
03647350 105
6762286d 106 wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; }
03647350 107
ff6893d2
VZ
108#if wxOSX_USE_COCOA_OR_IPHONE
109 // override the base class method to return an NSWindow instead of NSView
110 virtual void *OSXGetViewOrWindow() const { return GetWXWindow(); }
111#endif // Cocoa
112
6762286d 113 // osx specific event handling common for all osx-ports
03647350 114
6762286d
SC
115 virtual void HandleActivated( double timestampsec, bool didActivate );
116 virtual void HandleResized( double timestampsec );
117 virtual void HandleMoved( double timestampsec );
118 virtual void HandleResizing( double timestampsec, wxRect* rect );
7dc941e3
SC
119
120 void WindowWasPainted();
ce00f59b 121
e2758e21 122 virtual bool Destroy();
ce00f59b 123
6762286d
SC
124protected:
125 // common part of all ctors
126 void Init();
127
128 virtual void DoGetPosition( int *x, int *y ) const;
129 virtual void DoGetSize( int *width, int *height ) const;
130 virtual void DoMoveWindow(int x, int y, int width, int height);
131 virtual void DoGetClientSize(int *width, int *height) const;
132
ab9a0b84
VZ
133 virtual bool OSXShowWithEffect(bool show,
134 wxShowEffect effect,
135 unsigned timeout);
ce00f59b 136
46ea442c
VZ
137 virtual bool DoClearShape();
138 virtual bool DoSetRegionShape(const wxRegion& region);
139#if wxUSE_GRAPHICS_CONTEXT
140 virtual bool DoSetPathShape(const wxGraphicsPath& path);
141#endif // wxUSE_GRAPHICS_CONTEXT
142
e2758e21 143 virtual void WillBeDestroyed();
ab9a0b84 144
6762286d
SC
145 wxNonOwnedWindowImpl* m_nowpeer ;
146
147// wxWindowMac* m_macFocus ;
148
149 static wxNonOwnedWindow *s_macDeactivateWindow;
ce00f59b 150
6762286d 151private :
7dc941e3
SC
152 static clock_t s_lastFlush;
153
b61b8371 154 wxRegion m_shape;
46ea442c
VZ
155#if wxUSE_GRAPHICS_CONTEXT
156 wxGraphicsPath m_shapePath;
157#endif // wxUSE_GRAPHICS_CONTEXT
6762286d
SC
158};
159
160// list of all frames and modeless dialogs
161extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows;
162
163
164#endif // _WX_MAC_NONOWNEDWND_H_