1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declares wxTopLevelWindow class, the base class for all
4 // top level windows (such as frames and dialogs)
5 // Author: Vadim Zeitlin, Vaclav Slavik
9 // Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
10 // Vaclav Slavik <vaclav@wxwindows.org>
11 // Licence: wxWindows licence
12 ///////////////////////////////////////////////////////////////////////////////
14 #ifndef _WX_TOPLEVEL_BASE_H_
15 #define _WX_TOPLEVEL_BASE_H_
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
22 #pragma interface "toplevelbase.h"
25 #include "wx/window.h"
28 // the default names for various classs
29 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
31 class WXDLLEXPORT wxTopLevelWindowBase
;
33 // ----------------------------------------------------------------------------
35 // ----------------------------------------------------------------------------
37 // Dialogs are created in a special way
38 #define wxTOPLEVEL_EX_DIALOG 0x00000008
40 // Styles for ShowFullScreen
41 // (note that wxTopLevelWindow only handles wxFULLSCREEN_NOBORDER and
42 // wxFULLSCREEN_NOCAPTION; the rest is handled by wxTopLevelWindow)
45 wxFULLSCREEN_NOMENUBAR
= 0x0001,
46 wxFULLSCREEN_NOTOOLBAR
= 0x0002,
47 wxFULLSCREEN_NOSTATUSBAR
= 0x0004,
48 wxFULLSCREEN_NOBORDER
= 0x0008,
49 wxFULLSCREEN_NOCAPTION
= 0x0010,
51 wxFULLSCREEN_ALL
= wxFULLSCREEN_NOMENUBAR
| wxFULLSCREEN_NOTOOLBAR
|
52 wxFULLSCREEN_NOSTATUSBAR
| wxFULLSCREEN_NOBORDER
|
53 wxFULLSCREEN_NOCAPTION
56 // Flags for interactive frame manipulation functions (only in wxUniversal):
59 wxINTERACTIVE_MOVE
= 0x00000001,
60 wxINTERACTIVE_RESIZE
= 0x00000002,
61 wxINTERACTIVE_RESIZE_S
= 0x00000010,
62 wxINTERACTIVE_RESIZE_N
= 0x00000020,
63 wxINTERACTIVE_RESIZE_W
= 0x00000040,
64 wxINTERACTIVE_RESIZE_E
= 0x00000080,
65 wxINTERACTIVE_WAIT_FOR_INPUT
= 0x10000000
68 // ----------------------------------------------------------------------------
69 // wxTopLevelWindow: a top level (as opposed to child) window
70 // ----------------------------------------------------------------------------
72 class WXDLLEXPORT wxTopLevelWindowBase
: public wxWindow
76 wxTopLevelWindowBase();
79 virtual ~wxTopLevelWindowBase() {}
82 // top level wnd state
83 // --------------------
85 // maximize = TRUE => maximize, otherwise - restore
86 virtual void Maximize(bool maximize
= TRUE
) = 0;
88 // undo Maximize() or Iconize()
89 virtual void Restore() = 0;
91 // iconize = TRUE => iconize, otherwise - restore
92 virtual void Iconize(bool iconize
= TRUE
) = 0;
94 // return TRUE if the frame is maximized
95 virtual bool IsMaximized() const = 0;
97 // return TRUE if the frame is iconized
98 virtual bool IsIconized() const = 0;
100 // get the frame icon
101 const wxIcon
& GetIcon() const { return m_icon
; }
103 // set the frame icon
104 virtual void SetIcon(const wxIcon
& icon
) { m_icon
= icon
; }
106 // maximize the window to cover entire screen
107 virtual bool ShowFullScreen(bool show
, long style
= wxFULLSCREEN_ALL
) = 0;
109 // return TRUE if the frame is in fullscreen mode
110 virtual bool IsFullScreen() const = 0;
113 for now we already have them in wxWindow, but this is wrong: these
114 methods really only make sense for wxTopLevelWindow!
116 virtual void SetTitle(const wxString& title) = 0;
117 virtual wxString GetTitle() const = 0;
120 // old functions, use the new ones instead!
121 #if WXWIN_COMPATIBILITY_2
122 bool Iconized() const { return IsIconized(); }
123 #endif // WXWIN_COMPATIBILITY_2
126 #ifdef __WXUNIVERSAL__
127 // move/resize the frame interactively, i.e. let the user do it
128 virtual void InteractiveMove(int flags
= wxINTERACTIVE_MOVE
);
131 // implementation only from now on
132 // -------------------------------
134 // override some base class virtuals
135 virtual bool Destroy();
136 virtual bool IsTopLevel() const { return TRUE
; }
139 void OnCloseWindow(wxCloseEvent
& event
);
140 void OnSize(wxSizeEvent
& event
);
142 // this should go away, but for now it's called from docview.cpp,
143 // so should be there for all platforms
144 void OnActivate(wxActivateEvent
&WXUNUSED(event
)) { }
147 // the frame client to screen translation should take account of the
148 // toolbar which may shift the origin of the client area
149 virtual void DoClientToScreen(int *x
, int *y
) const;
150 virtual void DoScreenToClient(int *x
, int *y
) const;
152 // send the iconize event, return TRUE if processed
153 bool SendIconizeEvent(bool iconized
= TRUE
);
158 // test whether this window makes part of the frame
159 // (menubar, toolbar and statusbar are excluded from automatic layout)
160 virtual bool IsOneOfBars(const wxWindow
*WXUNUSED(win
)) const { return FALSE
; }
162 DECLARE_EVENT_TABLE()
166 // include the real class declaration
167 #if defined(__WXMSW__)
168 #include "wx/msw/toplevel.h"
169 #define wxTopLevelWindowNative wxTopLevelWindowMSW
170 #elif defined(__WXGTK__)
171 #include "wx/gtk/toplevel.h"
172 #define wxTopLevelWindowNative wxTopLevelWindowGTK
173 #elif defined(__WXMGL__)
174 #include "wx/mgl/toplevel.h"
175 #define wxTopLevelWindowNative wxTopLevelWindowMGL
176 #elif defined(__WXMAC__)
177 #include "wx/mac/toplevel.h"
178 #define wxTopLevelWindowNative wxTopLevelWindowMac
181 #ifdef __WXUNIVERSAL__
182 #include "wx/univ/toplevel.h"
183 #else // !__WXUNIVERSAL__
184 #ifdef wxTopLevelWindowNative
185 class WXDLLEXPORT wxTopLevelWindow
: public wxTopLevelWindowNative
189 wxTopLevelWindow() { Init(); }
190 wxTopLevelWindow(wxWindow
*parent
,
192 const wxString
& title
,
193 const wxPoint
& pos
= wxDefaultPosition
,
194 const wxSize
& size
= wxDefaultSize
,
195 long style
= wxDEFAULT_FRAME_STYLE
,
196 const wxString
& name
= wxFrameNameStr
)
199 Create(parent
, id
, title
, pos
, size
, style
, name
);
202 DECLARE_DYNAMIC_CLASS(wxTopLevelWindow
)
204 #endif // wxTopLevelWindowNative
205 #endif // __WXUNIVERSAL__/!__WXUNIVERSAL__
208 #endif // _WX_TOPLEVEL_BASE_H_