]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/toplevel.h
added GetApplicationScript for non Carbon builds
[wxWidgets.git] / include / wx / univ / toplevel.h
CommitLineData
0f1bf77d
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/toplevel.h
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)
0f1bf77d
VS
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10
11#ifndef __WX_UNIV_TOPLEVEL_H__
12#define __WX_UNIV_TOPLEVEL_H__
13
14#ifdef __GNUG__
15 #pragma interface "univtoplevel.h"
16#endif
17
24a23c35 18#include "wx/univ/inpcons.h"
ea1b0d6c 19#include "wx/univ/inphand.h"
edfb58b7 20#include "wx/icon.h"
24a23c35
VS
21
22// ----------------------------------------------------------------------------
23// constants
24// ----------------------------------------------------------------------------
25
26// frame decorations type flags used in wxRenderer and wxColourScheme
27enum
28{
ea1b0d6c 29 wxTOPLEVEL_ACTIVE = 0x00000001,
24a23c35
VS
30 wxTOPLEVEL_MAXIMIZED = 0x00000002,
31 wxTOPLEVEL_TITLEBAR = 0x00000004,
bff995bf 32 wxTOPLEVEL_ICON = 0x00000008,
813edf09
VS
33 wxTOPLEVEL_RESIZEABLE = 0x00000010,
34 wxTOPLEVEL_BORDER = 0x00000020,
35 wxTOPLEVEL_BUTTON_CLOSE = 0x01000000,
36 wxTOPLEVEL_BUTTON_MAXIMIZE = 0x02000000,
37 wxTOPLEVEL_BUTTON_ICONIZE = 0x04000000,
38 wxTOPLEVEL_BUTTON_RESTORE = 0x08000000,
71e03035 39 wxTOPLEVEL_BUTTON_HELP = 0x10000000,
24a23c35 40};
0f1bf77d 41
ea1b0d6c
VS
42// frame hit test return values:
43enum
44{
813edf09
VS
45 wxHT_TOPLEVEL_NOWHERE = 0x00000000,
46 wxHT_TOPLEVEL_CLIENT_AREA = 0x00000001,
47 wxHT_TOPLEVEL_ICON = 0x00000002,
48 wxHT_TOPLEVEL_TITLEBAR = 0x00000004,
49
50 wxHT_TOPLEVEL_BORDER_N = 0x00000010,
51 wxHT_TOPLEVEL_BORDER_S = 0x00000020,
52 wxHT_TOPLEVEL_BORDER_E = 0x00000040,
53 wxHT_TOPLEVEL_BORDER_W = 0x00000080,
813edf09
VS
54 wxHT_TOPLEVEL_BORDER_NE = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_E,
55 wxHT_TOPLEVEL_BORDER_SE = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_E,
56 wxHT_TOPLEVEL_BORDER_NW = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_W,
57 wxHT_TOPLEVEL_BORDER_SW = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_W,
bff995bf 58 wxHT_TOPLEVEL_ANY_BORDER = 0x000000F0,
813edf09
VS
59
60 wxHT_TOPLEVEL_BUTTON_CLOSE = /*0x01000000*/ wxTOPLEVEL_BUTTON_CLOSE,
61 wxHT_TOPLEVEL_BUTTON_MAXIMIZE = /*0x02000000*/ wxTOPLEVEL_BUTTON_MAXIMIZE,
62 wxHT_TOPLEVEL_BUTTON_ICONIZE = /*0x04000000*/ wxTOPLEVEL_BUTTON_ICONIZE,
63 wxHT_TOPLEVEL_BUTTON_RESTORE = /*0x08000000*/ wxTOPLEVEL_BUTTON_RESTORE,
64 wxHT_TOPLEVEL_BUTTON_HELP = /*0x10000000*/ wxTOPLEVEL_BUTTON_HELP,
65 wxHT_TOPLEVEL_ANY_BUTTON = 0x1F000000
ea1b0d6c
VS
66};
67
ed72fbf7
VS
68// Flags for interactive frame manipulation functions (only in wxUniversal):
69enum
70{
71 wxINTERACTIVE_MOVE = 0x00000001,
72 wxINTERACTIVE_RESIZE = 0x00000002,
73 wxINTERACTIVE_RESIZE_S = 0x00000010,
74 wxINTERACTIVE_RESIZE_N = 0x00000020,
75 wxINTERACTIVE_RESIZE_W = 0x00000040,
76 wxINTERACTIVE_RESIZE_E = 0x00000080,
77 wxINTERACTIVE_WAIT_FOR_INPUT = 0x10000000
78};
79
ea1b0d6c
VS
80// ----------------------------------------------------------------------------
81// the actions supported by this control
82// ----------------------------------------------------------------------------
83
813edf09
VS
84#define wxACTION_TOPLEVEL_ACTIVATE _T("activate") // (de)activate the frame
85#define wxACTION_TOPLEVEL_BUTTON_PRESS _T("pressbtn") // press titlebar btn
86#define wxACTION_TOPLEVEL_BUTTON_RELEASE _T("releasebtn") // press titlebar btn
87#define wxACTION_TOPLEVEL_BUTTON_CLICK _T("clickbtn") // press titlebar btn
88#define wxACTION_TOPLEVEL_MOVE _T("move") // move the frame
89#define wxACTION_TOPLEVEL_RESIZE _T("resize") // resize the frame
ea1b0d6c 90
0f1bf77d
VS
91//-----------------------------------------------------------------------------
92// wxTopLevelWindow
93//-----------------------------------------------------------------------------
94
ea1b0d6c
VS
95class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative,
96 public wxInputConsumer
0f1bf77d
VS
97{
98public:
99 // construction
100 wxTopLevelWindow() { Init(); }
101 wxTopLevelWindow(wxWindow *parent,
102 wxWindowID id,
103 const wxString& title,
104 const wxPoint& pos = wxDefaultPosition,
105 const wxSize& size = wxDefaultSize,
106 long style = wxDEFAULT_FRAME_STYLE,
107 const wxString& name = wxFrameNameStr)
108 {
109 Init();
110
111 Create(parent, id, title, pos, size, style, name);
112 }
113
114 bool Create(wxWindow *parent,
115 wxWindowID id,
116 const wxString& title,
117 const wxPoint& pos = wxDefaultPosition,
118 const wxSize& size = wxDefaultSize,
119 long style = wxDEFAULT_FRAME_STYLE,
120 const wxString& name = wxFrameNameStr);
121
122 // implement base class pure virtuals
123 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
24a23c35
VS
124 virtual wxPoint GetClientAreaOrigin() const;
125 virtual void DoGetClientSize(int *width, int *height) const;
126 virtual void DoSetClientSize(int width, int height);
f618020a
MB
127 virtual void SetIcon(const wxIcon& icon) { SetIcons( wxIconBundle( icon ) ); }
128 virtual void SetIcons(const wxIconBundle& icons);
0f1bf77d
VS
129
130 // implementation from now on
131 // --------------------------
71e03035 132
813edf09
VS
133 // tests for frame's part at given point
134 long HitTest(const wxPoint& pt) const;
0f1bf77d 135
ea1b0d6c
VS
136 virtual bool PerformAction(const wxControlAction& action,
137 long numArg = -1,
138 const wxString& strArg = wxEmptyString);
71e03035 139
ed72fbf7
VS
140 // move/resize the frame interactively, i.e. let the user do it
141 virtual void InteractiveMove(int flags = wxINTERACTIVE_MOVE);
142
e7dda1ff
VS
143 virtual int GetMinWidth() const;
144 virtual int GetMinHeight() const;
145
193e19cf
RR
146 virtual bool ProvidesBackground() { return TRUE; }
147
71e03035 148protected:
813edf09
VS
149 // handle titlebar button click event
150 virtual void ClickTitleBarButton(long button);
ea1b0d6c 151
813edf09 152 virtual wxWindow *GetInputWindow() const { return (wxWindow*)this; }
24a23c35
VS
153
154 // return wxTOPLEVEL_xxx combination based on current state of the frame
155 long GetDecorationsStyle() const;
813edf09
VS
156
157 // common part of all ctors
158 void Init();
71e03035 159
813edf09 160 void RefreshTitleBar();
24a23c35 161 void OnNcPaint(wxPaintEvent& event);
71cb2ca1 162 void OnSystemMenu(wxCommandEvent& event);
24a23c35
VS
163
164 // TRUE if wxTLW should render decorations (aka titlebar) itself
165 static int ms_drawDecorations;
90da9c3f
VS
166 // TRUE if wxTLW can be iconized
167 static int ms_canIconize;
24a23c35
VS
168 // true for currently active frame
169 bool m_isActive:1;
170 // version of icon for titlebar (16x16)
171 wxIcon m_titlebarIcon;
ea1b0d6c
VS
172 // saved window style in fullscreen mdoe
173 long m_fsSavedStyle;
813edf09
VS
174 // currently pressed titlebar button
175 long m_pressedButton;
ea1b0d6c
VS
176
177 DECLARE_DYNAMIC_CLASS(wxTopLevelWindow)
178 DECLARE_EVENT_TABLE()
179 WX_DECLARE_INPUT_CONSUMER()
180};
181
182// ----------------------------------------------------------------------------
183// wxStdFrameInputHandler: handles focus, resizing and titlebar buttons clicks
184// ----------------------------------------------------------------------------
185
186class WXDLLEXPORT wxStdFrameInputHandler : public wxStdInputHandler
187{
188public:
189 wxStdFrameInputHandler(wxInputHandler *inphand);
190
191 virtual bool HandleMouse(wxInputConsumer *consumer,
192 const wxMouseEvent& event);
193 virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
194 virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
813edf09
VS
195
196private:
197 // the window (button) which has capture or NULL and the last hittest result
198 wxTopLevelWindow *m_winCapture;
199 long m_winHitTest;
200 long m_winPressed;
bff995bf
VS
201 bool m_borderCursorOn;
202 wxCursor m_origCursor;
0f1bf77d
VS
203};
204
205#endif // __WX_UNIV_TOPLEVEL_H__