1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Top level window, abstraction of wxFrame and wxDialog
4 // Author: Vaclav Slavik
6 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __WX_UNIV_TOPLEVEL_H__
12 #define __WX_UNIV_TOPLEVEL_H__
15 #pragma interface "univtoplevel.h"
18 #include "wx/univ/inpcons.h"
19 #include "wx/univ/inphand.h"
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 // frame decorations type flags used in wxRenderer and wxColourScheme
26 // (also used for hit tests)
29 wxTOPLEVEL_ACTIVE
= 0x00000001,
30 wxTOPLEVEL_MAXIMIZED
= 0x00000002,
31 wxTOPLEVEL_TITLEBAR
= 0x00000004,
32 wxTOPLEVEL_RESIZEABLE
= 0x00000008,
33 wxTOPLEVEL_ICON
= 0x00000010,
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,
42 // frame hit test return values:
45 wxHT_TOPLEVEL_NOWHERE
= 0,
46 wxHT_TOPLEVEL_CLIENT_AREA
,
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
,
64 // ----------------------------------------------------------------------------
65 // the actions supported by this control
66 // ----------------------------------------------------------------------------
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
75 //-----------------------------------------------------------------------------
77 //-----------------------------------------------------------------------------
79 class WXDLLEXPORT wxTopLevelWindow
: public wxTopLevelWindowNative
,
80 public wxInputConsumer
84 wxTopLevelWindow() { Init(); }
85 wxTopLevelWindow(wxWindow
*parent
,
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
)
95 Create(parent
, id
, title
, pos
, size
, style
, name
);
98 bool Create(wxWindow
*parent
,
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
);
106 // implement base class pure virtuals
107 virtual bool ShowFullScreen(bool show
, long style
= wxFULLSCREEN_ALL
);
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
);
113 // implementation from now on
114 // --------------------------
117 virtual bool PerformAction(const wxControlAction
& action
,
119 const wxString
& strArg
= wxEmptyString
);
120 virtual wxWindow
*GetInputWindow() const { return (wxWindow
*)this; }
122 // common part of all ctors
125 // return wxTOPLEVEL_xxx combination based on current state of the frame
126 long GetDecorationsStyle() const;
128 void OnNcPaint(wxPaintEvent
& event
);
130 // TRUE if wxTLW should render decorations (aka titlebar) itself
131 static int ms_drawDecorations
;
132 // true for currently active frame
134 // version of icon for titlebar (16x16)
135 wxIcon m_titlebarIcon
;
136 // saved window style in fullscreen mdoe
139 DECLARE_DYNAMIC_CLASS(wxTopLevelWindow
)
140 DECLARE_EVENT_TABLE()
141 WX_DECLARE_INPUT_CONSUMER()
144 // ----------------------------------------------------------------------------
145 // wxStdFrameInputHandler: handles focus, resizing and titlebar buttons clicks
146 // ----------------------------------------------------------------------------
148 class WXDLLEXPORT wxStdFrameInputHandler
: public wxStdInputHandler
151 wxStdFrameInputHandler(wxInputHandler
*inphand
);
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
);
159 #endif // __WX_UNIV_TOPLEVEL_H__