]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/nonownedwnd.h
adding bestsize for osx_cocoa combobox
[wxWidgets.git] / include / wx / osx / nonownedwnd.h
CommitLineData
6762286d
SC
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/mac/nonownedwnd.h
3// Purpose: declares wxNonOwnedWindow class
4// Author: Stefan Csomor
03647350 5// Modified by:
6762286d
SC
6// Created: 2008-03-24
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///////////////////////////////////////////////////////////////////////////////
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
SC
58 bool Create(wxWindow *parent, WXWindow nativeWindow);
59
6762286d
SC
60 virtual ~wxNonOwnedWindow();
61
62 virtual wxPoint GetClientAreaOrigin() const;
63
64 // implement base class pure virtuals
65
6762286d
SC
66 virtual bool SetTransparent(wxByte alpha);
67 virtual bool CanSetTransparent();
68
69 virtual bool SetBackgroundStyle(wxBackgroundStyle style);
03647350 70
6762286d
SC
71 virtual void Update();
72
73 WXWindow GetWXWindow() const ;
74 static wxNonOwnedWindow* GetFromWXWindow( WXWindow win );
75
76 // implementation from now on
77 // --------------------------
78
8e88e984 79 virtual bool DoSetShape(const wxRegion& region);
b61b8371 80 const wxRegion& GetShape() const { return m_shape; }
8e88e984 81
6762286d
SC
82 // activation hooks only necessary for MDI Implementation
83 static void MacDelayedDeactivation(long timestamp);
84 virtual void MacActivate( long timestamp , bool inIsActivating ) ;
85
b6dc21e7 86 virtual void SetWindowStyleFlag(long flags);
6762286d
SC
87
88 virtual void Raise();
89 virtual void Lower();
90 virtual bool Show( bool show = true );
91
6762286d
SC
92 virtual void SetExtraStyle(long exStyle) ;
93
94 virtual bool SetBackgroundColour( const wxColour &colour );
03647350 95
6762286d 96 wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; }
03647350 97
ff6893d2
VZ
98#if wxOSX_USE_COCOA_OR_IPHONE
99 // override the base class method to return an NSWindow instead of NSView
100 virtual void *OSXGetViewOrWindow() const { return GetWXWindow(); }
101#endif // Cocoa
102
6762286d 103 // osx specific event handling common for all osx-ports
03647350 104
6762286d
SC
105 virtual void HandleActivated( double timestampsec, bool didActivate );
106 virtual void HandleResized( double timestampsec );
107 virtual void HandleMoved( double timestampsec );
108 virtual void HandleResizing( double timestampsec, wxRect* rect );
e2758e21
KO
109
110 virtual bool Destroy();
17e2694c 111
6762286d
SC
112protected:
113 // common part of all ctors
114 void Init();
115
116 virtual void DoGetPosition( int *x, int *y ) const;
117 virtual void DoGetSize( int *width, int *height ) const;
118 virtual void DoMoveWindow(int x, int y, int width, int height);
119 virtual void DoGetClientSize(int *width, int *height) const;
120
ab9a0b84
VZ
121 virtual bool OSXShowWithEffect(bool show,
122 wxShowEffect effect,
123 unsigned timeout);
0aaa6ace 124
e2758e21 125 virtual void WillBeDestroyed();
ab9a0b84 126
6762286d
SC
127 wxNonOwnedWindowImpl* m_nowpeer ;
128
129// wxWindowMac* m_macFocus ;
130
131 static wxNonOwnedWindow *s_macDeactivateWindow;
b61b8371 132
6762286d 133private :
b61b8371 134 wxRegion m_shape;
6762286d
SC
135};
136
137// list of all frames and modeless dialogs
138extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows;
139
140
141#endif // _WX_MAC_NONOWNEDWND_H_