]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/toplevel.h
implemented wxActivateEvent properly
[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$
6// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
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"
24a23c35
VS
20
21// ----------------------------------------------------------------------------
22// constants
23// ----------------------------------------------------------------------------
24
25// frame decorations type flags used in wxRenderer and wxColourScheme
ea1b0d6c 26// (also used for hit tests)
24a23c35
VS
27enum
28{
ea1b0d6c 29 wxTOPLEVEL_ACTIVE = 0x00000001,
24a23c35
VS
30 wxTOPLEVEL_MAXIMIZED = 0x00000002,
31 wxTOPLEVEL_TITLEBAR = 0x00000004,
32 wxTOPLEVEL_RESIZEABLE = 0x00000008,
33 wxTOPLEVEL_ICON = 0x00000010,
ea1b0d6c
VS
34 wxTOPLEVEL_BUTTON_CLOSE = 0x00000020,
35 wxTOPLEVEL_BUTTON_MAXIMIZE = 0x00000040,
36 wxTOPLEVEL_BUTTON_MINIMIZE = 0x00000080,
37 wxTOPLEVEL_BUTTON_RESTORE = 0x00000100,
38 wxTOPLEVEL_BUTTON_HELP = 0x00000200,
39 wxTOPLEVEL_BORDER = 0x00000400,
24a23c35 40};
0f1bf77d 41
ea1b0d6c
VS
42// frame hit test return values:
43enum
44{
45 wxHT_TOPLEVEL_NOWHERE = 0,
46 wxHT_TOPLEVEL_CLIENT_AREA,
47 wxHT_TOPLEVEL_ICON,
48 wxHT_TOPLEVEL_TITLEBAR,
49 wxHT_TOPLEVEL_BUTTON_CLOSE = wxTOPLEVEL_BUTTON_CLOSE,
50 wxHT_TOPLEVEL_BUTTON_MAXIMIZE = wxTOPLEVEL_BUTTON_MAXIMIZE,
51 wxHT_TOPLEVEL_BUTTON_MINIMIZE = wxTOPLEVEL_BUTTON_MINIMIZE,
52 wxHT_TOPLEVEL_BUTTON_RESTORE = wxTOPLEVEL_BUTTON_RESTORE,
53 wxHT_TOPLEVEL_BUTTON_HELP = wxTOPLEVEL_BUTTON_HELP,
54 wxHT_TOPLEVEL_BORDER_N,
55 wxHT_TOPLEVEL_BORDER_S,
56 wxHT_TOPLEVEL_BORDER_E,
57 wxHT_TOPLEVEL_BORDER_W,
58 wxHT_TOPLEVEL_BORDER_NE = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_E,
59 wxHT_TOPLEVEL_BORDER_SE = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_E,
60 wxHT_TOPLEVEL_BORDER_NW = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_W,
61 wxHT_TOPLEVEL_BORDER_SW = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_W,
62};
63
64// ----------------------------------------------------------------------------
65// the actions supported by this control
66// ----------------------------------------------------------------------------
67
68#define wxACTION_TOPLEVEL_ACTIVATE _T("activate") // (de)activate the frame
69#define wxACTION_TOPLEVEL_CLOSE _T("close") // close the frame
70#define wxACTION_TOPLEVEL_MAXIMIZE _T("maximize") // maximize the frame
71#define wxACTION_TOPLEVEL_MINIMIZE _T("minimize") // minimize the frame
72#define wxACTION_TOPLEVEL_RESTORE _T("restore") // undo maximization
73#define wxACTION_TOPLEVEL_CONTEXT_HELP _T("contexthelp")// context help mode
74
0f1bf77d
VS
75//-----------------------------------------------------------------------------
76// wxTopLevelWindow
77//-----------------------------------------------------------------------------
78
ea1b0d6c
VS
79class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative,
80 public wxInputConsumer
0f1bf77d
VS
81{
82public:
83 // construction
84 wxTopLevelWindow() { Init(); }
85 wxTopLevelWindow(wxWindow *parent,
86 wxWindowID id,
87 const wxString& title,
88 const wxPoint& pos = wxDefaultPosition,
89 const wxSize& size = wxDefaultSize,
90 long style = wxDEFAULT_FRAME_STYLE,
91 const wxString& name = wxFrameNameStr)
92 {
93 Init();
94
95 Create(parent, id, title, pos, size, style, name);
96 }
97
98 bool Create(wxWindow *parent,
99 wxWindowID id,
100 const wxString& title,
101 const wxPoint& pos = wxDefaultPosition,
102 const wxSize& size = wxDefaultSize,
103 long style = wxDEFAULT_FRAME_STYLE,
104 const wxString& name = wxFrameNameStr);
105
106 // implement base class pure virtuals
107 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
24a23c35
VS
108 virtual wxPoint GetClientAreaOrigin() const;
109 virtual void DoGetClientSize(int *width, int *height) const;
110 virtual void DoSetClientSize(int width, int height);
111 virtual void SetIcon(const wxIcon& icon);
0f1bf77d
VS
112
113 // implementation from now on
114 // --------------------------
115
0f1bf77d 116protected:
ea1b0d6c
VS
117 virtual bool PerformAction(const wxControlAction& action,
118 long numArg = -1,
119 const wxString& strArg = wxEmptyString);
120 virtual wxWindow *GetInputWindow() const { return (wxWindow*)this; }
121
0f1bf77d
VS
122 // common part of all ctors
123 void Init();
24a23c35
VS
124
125 // return wxTOPLEVEL_xxx combination based on current state of the frame
126 long GetDecorationsStyle() const;
127
24a23c35
VS
128 void OnNcPaint(wxPaintEvent& event);
129
130 // TRUE if wxTLW should render decorations (aka titlebar) itself
131 static int ms_drawDecorations;
132 // true for currently active frame
133 bool m_isActive:1;
134 // version of icon for titlebar (16x16)
135 wxIcon m_titlebarIcon;
ea1b0d6c
VS
136 // saved window style in fullscreen mdoe
137 long m_fsSavedStyle;
138
139 DECLARE_DYNAMIC_CLASS(wxTopLevelWindow)
140 DECLARE_EVENT_TABLE()
141 WX_DECLARE_INPUT_CONSUMER()
142};
143
144// ----------------------------------------------------------------------------
145// wxStdFrameInputHandler: handles focus, resizing and titlebar buttons clicks
146// ----------------------------------------------------------------------------
147
148class WXDLLEXPORT wxStdFrameInputHandler : public wxStdInputHandler
149{
150public:
151 wxStdFrameInputHandler(wxInputHandler *inphand);
152
153 virtual bool HandleMouse(wxInputConsumer *consumer,
154 const wxMouseEvent& event);
155 virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
156 virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
0f1bf77d
VS
157};
158
159#endif // __WX_UNIV_TOPLEVEL_H__