]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/toplevel.h
Set missing Language: headers in PO files.
[wxWidgets.git] / include / wx / univ / toplevel.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/toplevel.h
3 // Purpose: Top level window, abstraction of wxFrame and wxDialog
4 // Author: Vaclav Slavik
5 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 #ifndef __WX_UNIV_TOPLEVEL_H__
11 #define __WX_UNIV_TOPLEVEL_H__
12
13 #include "wx/univ/inpcons.h"
14 #include "wx/univ/inphand.h"
15 #include "wx/icon.h"
16
17 // ----------------------------------------------------------------------------
18 // constants
19 // ----------------------------------------------------------------------------
20
21 // frame decorations type flags used in wxRenderer and wxColourScheme
22 enum
23 {
24 wxTOPLEVEL_ACTIVE = 0x00000001,
25 wxTOPLEVEL_MAXIMIZED = 0x00000002,
26 wxTOPLEVEL_TITLEBAR = 0x00000004,
27 wxTOPLEVEL_ICON = 0x00000008,
28 wxTOPLEVEL_RESIZEABLE = 0x00000010,
29 wxTOPLEVEL_BORDER = 0x00000020,
30 wxTOPLEVEL_BUTTON_CLOSE = 0x01000000,
31 wxTOPLEVEL_BUTTON_MAXIMIZE = 0x02000000,
32 wxTOPLEVEL_BUTTON_ICONIZE = 0x04000000,
33 wxTOPLEVEL_BUTTON_RESTORE = 0x08000000,
34 wxTOPLEVEL_BUTTON_HELP = 0x10000000
35 };
36
37 // frame hit test return values:
38 enum
39 {
40 wxHT_TOPLEVEL_NOWHERE = 0x00000000,
41 wxHT_TOPLEVEL_CLIENT_AREA = 0x00000001,
42 wxHT_TOPLEVEL_ICON = 0x00000002,
43 wxHT_TOPLEVEL_TITLEBAR = 0x00000004,
44
45 wxHT_TOPLEVEL_BORDER_N = 0x00000010,
46 wxHT_TOPLEVEL_BORDER_S = 0x00000020,
47 wxHT_TOPLEVEL_BORDER_E = 0x00000040,
48 wxHT_TOPLEVEL_BORDER_W = 0x00000080,
49 wxHT_TOPLEVEL_BORDER_NE = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_E,
50 wxHT_TOPLEVEL_BORDER_SE = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_E,
51 wxHT_TOPLEVEL_BORDER_NW = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_W,
52 wxHT_TOPLEVEL_BORDER_SW = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_W,
53 wxHT_TOPLEVEL_ANY_BORDER = 0x000000F0,
54
55 wxHT_TOPLEVEL_BUTTON_CLOSE = /*0x01000000*/ wxTOPLEVEL_BUTTON_CLOSE,
56 wxHT_TOPLEVEL_BUTTON_MAXIMIZE = /*0x02000000*/ wxTOPLEVEL_BUTTON_MAXIMIZE,
57 wxHT_TOPLEVEL_BUTTON_ICONIZE = /*0x04000000*/ wxTOPLEVEL_BUTTON_ICONIZE,
58 wxHT_TOPLEVEL_BUTTON_RESTORE = /*0x08000000*/ wxTOPLEVEL_BUTTON_RESTORE,
59 wxHT_TOPLEVEL_BUTTON_HELP = /*0x10000000*/ wxTOPLEVEL_BUTTON_HELP,
60 wxHT_TOPLEVEL_ANY_BUTTON = 0x1F000000
61 };
62
63 // Flags for interactive frame manipulation functions (only in wxUniversal):
64 enum
65 {
66 wxINTERACTIVE_MOVE = 0x00000001,
67 wxINTERACTIVE_RESIZE = 0x00000002,
68 wxINTERACTIVE_RESIZE_S = 0x00000010,
69 wxINTERACTIVE_RESIZE_N = 0x00000020,
70 wxINTERACTIVE_RESIZE_W = 0x00000040,
71 wxINTERACTIVE_RESIZE_E = 0x00000080,
72 wxINTERACTIVE_WAIT_FOR_INPUT = 0x10000000
73 };
74
75 // ----------------------------------------------------------------------------
76 // the actions supported by this control
77 // ----------------------------------------------------------------------------
78
79 #define wxACTION_TOPLEVEL_ACTIVATE wxT("activate") // (de)activate the frame
80 #define wxACTION_TOPLEVEL_BUTTON_PRESS wxT("pressbtn") // press titlebar btn
81 #define wxACTION_TOPLEVEL_BUTTON_RELEASE wxT("releasebtn") // press titlebar btn
82 #define wxACTION_TOPLEVEL_BUTTON_CLICK wxT("clickbtn") // press titlebar btn
83 #define wxACTION_TOPLEVEL_MOVE wxT("move") // move the frame
84 #define wxACTION_TOPLEVEL_RESIZE wxT("resize") // resize the frame
85
86 //-----------------------------------------------------------------------------
87 // wxTopLevelWindow
88 //-----------------------------------------------------------------------------
89
90 class WXDLLIMPEXP_CORE wxTopLevelWindow : public wxTopLevelWindowNative,
91 public wxInputConsumer
92 {
93 public:
94 // construction
95 wxTopLevelWindow() { Init(); }
96 wxTopLevelWindow(wxWindow *parent,
97 wxWindowID id,
98 const wxString& title,
99 const wxPoint& pos = wxDefaultPosition,
100 const wxSize& size = wxDefaultSize,
101 long style = wxDEFAULT_FRAME_STYLE,
102 const wxString& name = wxFrameNameStr)
103 {
104 Init();
105
106 Create(parent, id, title, pos, size, style, name);
107 }
108
109 bool Create(wxWindow *parent,
110 wxWindowID id,
111 const wxString& title,
112 const wxPoint& pos = wxDefaultPosition,
113 const wxSize& size = wxDefaultSize,
114 long style = wxDEFAULT_FRAME_STYLE,
115 const wxString& name = wxFrameNameStr);
116
117 // wxUniv-specific methods: do [not] use native decorations for this (or
118 // all) window(s)
119 //
120 // notice that this has no effect if the system doesn't support any native
121 // decorations anyhow and that by default native decorations are used
122 //
123 // if UseNativeDecorations() is used, it must be called before Create()
124 static void UseNativeDecorationsByDefault(bool native = true);
125 void UseNativeDecorations(bool native = true);
126 bool IsUsingNativeDecorations() const;
127
128
129 // implement base class pure virtuals
130 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
131 virtual wxPoint GetClientAreaOrigin() const;
132 virtual void SetIcons(const wxIconBundle& icons);
133
134 // implementation from now on
135 // --------------------------
136
137 // tests for frame's part at given point
138 long HitTest(const wxPoint& pt) const;
139
140 virtual bool PerformAction(const wxControlAction& action,
141 long numArg = -1,
142 const wxString& strArg = wxEmptyString);
143
144 static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
145 virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
146 {
147 return GetStdInputHandler(handlerDef);
148 }
149
150 // move/resize the frame interactively, i.e. let the user do it
151 virtual void InteractiveMove(int flags = wxINTERACTIVE_MOVE);
152
153 virtual wxSize GetMinSize() const;
154
155 virtual wxWindow *GetInputWindow() const { return const_cast<wxTopLevelWindow*>(this); }
156
157 protected:
158 virtual void DoGetClientSize(int *width, int *height) const;
159 virtual void DoSetClientSize(int width, int height);
160
161 // handle titlebar button click event
162 virtual void ClickTitleBarButton(long button);
163
164 // return wxTOPLEVEL_xxx combination based on current state of the frame
165 long GetDecorationsStyle() const;
166
167 // common part of all ctors
168 void Init();
169
170 void RefreshTitleBar();
171 void OnNcPaint(wxNcPaintEvent& event);
172 void OnSystemMenu(wxCommandEvent& event);
173
174 // true if wxTLW should render decorations (aka titlebar) itself
175 static int ms_drawDecorations;
176 // true if wxTLW can be iconized
177 static int ms_canIconize;
178
179 // true if we're using native decorations
180 bool m_usingNativeDecorations;
181 // true for currently active frame
182 bool m_isActive;
183 // version of icon for titlebar (16x16)
184 wxIcon m_titlebarIcon;
185 // saved window style in fullscreen mdoe
186 long m_fsSavedStyle;
187 // currently pressed titlebar button
188 long m_pressedButton;
189
190 DECLARE_DYNAMIC_CLASS(wxTopLevelWindow)
191 DECLARE_EVENT_TABLE()
192 WX_DECLARE_INPUT_CONSUMER()
193 };
194
195 #endif // __WX_UNIV_TOPLEVEL_H__