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