]> git.saurik.com Git - wxWidgets.git/blame - include/wx/toplevel.h
added wxEncodingToCodepage() and implemented it properly (using in32 API instead...
[wxWidgets.git] / include / wx / toplevel.h
CommitLineData
ec4f95c4
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/toplevel.h
3// Purpose: declares wxTopLevelWindow class, the base class for all
4// top level windows (such as frames and dialogs)
7d9f12f3 5// Author: Vadim Zeitlin, Vaclav Slavik
ec4f95c4
VZ
6// Modified by:
7// Created: 06.08.01
8// RCS-ID: $Id$
9// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
7d9f12f3 10// Vaclav Slavik <vaclav@wxwindows.org>
ec4f95c4
VZ
11// Licence: wxWindows licence
12///////////////////////////////////////////////////////////////////////////////
13
7d9f12f3
VS
14#ifndef _WX_TOPLEVEL_BASE_H_
15#define _WX_TOPLEVEL_BASE_H_
16
17// ----------------------------------------------------------------------------
18// headers
19// ----------------------------------------------------------------------------
20
21#ifdef __GNUG__
22 #pragma interface "toplevelbase.h"
23#endif
ec4f95c4
VZ
24
25#include "wx/window.h"
7d9f12f3
VS
26#include "wx/icon.h"
27
28// the default names for various classs
29WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
30
31class WXDLLEXPORT wxTopLevelWindowBase;
32
b22d16ad
VS
33// ----------------------------------------------------------------------------
34// constants
35// ----------------------------------------------------------------------------
36
7d9f12f3 37// Dialogs are created in a special way
21f4383a 38#define wxTOPLEVEL_EX_DIALOG 0x00000008
7d9f12f3
VS
39
40// Styles for ShowFullScreen
41// (note that wxTopLevelWindow only handles wxFULLSCREEN_NOBORDER and
42// wxFULLSCREEN_NOCAPTION; the rest is handled by wxTopLevelWindow)
b22d16ad
VS
43enum
44{
45 wxFULLSCREEN_NOMENUBAR = 0x0001,
46 wxFULLSCREEN_NOTOOLBAR = 0x0002,
47 wxFULLSCREEN_NOSTATUSBAR = 0x0004,
48 wxFULLSCREEN_NOBORDER = 0x0008,
49 wxFULLSCREEN_NOCAPTION = 0x0010,
d4597e13
VZ
50
51 wxFULLSCREEN_ALL = wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR |
52 wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER |
b22d16ad
VS
53 wxFULLSCREEN_NOCAPTION
54};
55
56// Flags for interactive frame manipulation functions (only in wxUniversal):
57enum
58{
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
66};
ec4f95c4
VZ
67
68// ----------------------------------------------------------------------------
69// wxTopLevelWindow: a top level (as opposed to child) window
70// ----------------------------------------------------------------------------
71
7d9f12f3 72class WXDLLEXPORT wxTopLevelWindowBase : public wxWindow
ec4f95c4
VZ
73{
74public:
7d9f12f3
VS
75 // construction
76 wxTopLevelWindowBase();
82c9f85c 77
b22d16ad
VS
78#ifdef __DARWIN__
79 virtual ~wxTopLevelWindowBase() {}
80#endif
81
7d9f12f3
VS
82 // top level wnd state
83 // --------------------
84
85 // maximize = TRUE => maximize, otherwise - restore
86 virtual void Maximize(bool maximize = TRUE) = 0;
87
88 // undo Maximize() or Iconize()
89 virtual void Restore() = 0;
90
91 // iconize = TRUE => iconize, otherwise - restore
92 virtual void Iconize(bool iconize = TRUE) = 0;
93
94 // return TRUE if the frame is maximized
95 virtual bool IsMaximized() const = 0;
96
97 // return TRUE if the frame is iconized
98 virtual bool IsIconized() const = 0;
99
100 // get the frame icon
101 const wxIcon& GetIcon() const { return m_icon; }
102
103 // set the frame icon
104 virtual void SetIcon(const wxIcon& icon) { m_icon = icon; }
105
c8e8ae85
VS
106 // maximize the window to cover entire screen
107 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0;
d4597e13 108
c8e8ae85
VS
109 // return TRUE if the frame is in fullscreen mode
110 virtual bool IsFullScreen() const = 0;
111
ec4f95c4
VZ
112 /*
113 for now we already have them in wxWindow, but this is wrong: these
114 methods really only make sense for wxTopLevelWindow!
115
7d9f12f3 116 virtual void SetTitle(const wxString& title) = 0;
ec4f95c4
VZ
117 virtual wxString GetTitle() const = 0;
118 */
7d9f12f3
VS
119
120 // old functions, use the new ones instead!
121#if WXWIN_COMPATIBILITY_2
122 bool Iconized() const { return IsIconized(); }
123#endif // WXWIN_COMPATIBILITY_2
124
d4597e13 125
b22d16ad
VS
126#ifdef __WXUNIVERSAL__
127 // move/resize the frame interactively, i.e. let the user do it
128 virtual void InteractiveMove(int flags = wxINTERACTIVE_MOVE);
129#endif
130
7d9f12f3
VS
131 // implementation only from now on
132 // -------------------------------
133
134 // override some base class virtuals
135 virtual bool Destroy();
136 virtual bool IsTopLevel() const { return TRUE; }
137
138 // event handlers
139 void OnCloseWindow(wxCloseEvent& event);
140 void OnSize(wxSizeEvent& event);
141
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)) { }
145
146protected:
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;
151
152 // send the iconize event, return TRUE if processed
153 bool SendIconizeEvent(bool iconized = TRUE);
154
155 // the frame icon
156 wxIcon m_icon;
157
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; }
161
162 DECLARE_EVENT_TABLE()
ec4f95c4
VZ
163};
164
7d9f12f3
VS
165
166// include the real class declaration
82c9f85c
VZ
167#if defined(__WXMSW__)
168 #include "wx/msw/toplevel.h"
169 #define wxTopLevelWindowNative wxTopLevelWindowMSW
170#elif defined(__WXGTK__)
7d9f12f3
VS
171 #include "wx/gtk/toplevel.h"
172 #define wxTopLevelWindowNative wxTopLevelWindowGTK
173#elif defined(__WXMGL__)
174 #include "wx/mgl/toplevel.h"
175 #define wxTopLevelWindowNative wxTopLevelWindowMGL
93b4dc4b
SC
176#elif defined(__WXMAC__)
177 #include "wx/mac/toplevel.h"
178 #define wxTopLevelWindowNative wxTopLevelWindowMac
7d9f12f3
VS
179#endif
180
181#ifdef __WXUNIVERSAL__
182 #include "wx/univ/toplevel.h"
183#else // !__WXUNIVERSAL__
184 #ifdef wxTopLevelWindowNative
185 class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative
186 {
187 public:
188 // construction
189 wxTopLevelWindow() { Init(); }
190 wxTopLevelWindow(wxWindow *parent,
191 wxWindowID id,
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)
197 {
198 Init();
199 Create(parent, id, title, pos, size, style, name);
200 }
201
202 DECLARE_DYNAMIC_CLASS(wxTopLevelWindow)
203 };
204 #endif // wxTopLevelWindowNative
205#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__
206
207
208#endif // _WX_TOPLEVEL_BASE_H_