]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/toplevel.h
Missed defs.h inclusion.
[wxWidgets.git] / include / wx / msw / toplevel.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/toplevel.h
3 // Purpose: wxTopLevelWindowMSW is the MSW implementation of wxTLW
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 20.09.01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MSW_TOPLEVEL_H_
13 #define _WX_MSW_TOPLEVEL_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "toplevel.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // wxTopLevelWindowMSW
21 // ----------------------------------------------------------------------------
22
23 class WXDLLEXPORT wxTopLevelWindowMSW : public wxTopLevelWindowBase
24 {
25 public:
26 // constructors and such
27 wxTopLevelWindowMSW() { Init(); }
28
29 wxTopLevelWindowMSW(wxWindow *parent,
30 wxWindowID id,
31 const wxString& title,
32 const wxPoint& pos = wxDefaultPosition,
33 const wxSize& size = wxDefaultSize,
34 long style = wxDEFAULT_FRAME_STYLE,
35 const wxString& name = wxFrameNameStr)
36 {
37 Init();
38
39 (void)Create(parent, id, title, pos, size, style, name);
40 }
41
42 bool Create(wxWindow *parent,
43 wxWindowID id,
44 const wxString& title,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = wxDEFAULT_FRAME_STYLE,
48 const wxString& name = wxFrameNameStr);
49
50 virtual ~wxTopLevelWindowMSW();
51
52 // implement base class pure virtuals
53 virtual void Maximize(bool maximize = TRUE);
54 virtual bool IsMaximized() const;
55 virtual void Iconize(bool iconize = TRUE);
56 virtual bool IsIconized() const;
57 virtual void SetIcon(const wxIcon& icon);
58 virtual void SetIcons(const wxIconBundle& icons );
59 virtual void Restore();
60
61 #ifndef __WXWINCE__
62 virtual bool SetShape(const wxRegion& region);
63 #endif // __WXWINCE__
64
65 virtual bool Show(bool show = TRUE);
66
67 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
68 virtual bool IsFullScreen() const { return m_fsIsShowing; }
69
70 // wxMSW only: EnableCloseButton(FALSE) may be used to remove the "Close"
71 // button from the title bar
72 bool EnableCloseButton(bool enable = TRUE);
73
74 // implementation from now on
75 // --------------------------
76
77 // event handlers
78 void OnActivate(wxActivateEvent& event);
79
80 // called by wxWindow whenever it gets focus
81 void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
82 wxWindow *GetLastFocus() const { return m_winLastFocused; }
83
84 #ifdef __SMARTPHONE__
85 void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL);
86 void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL);
87 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
88 #endif // __SMARTPHONE__
89
90 protected:
91 // common part of all ctors
92 void Init();
93
94 // create a new frame, return FALSE if it couldn't be created
95 bool CreateFrame(const wxString& title,
96 const wxPoint& pos,
97 const wxSize& size);
98
99 // create a new dialog using the given dialog template from resources,
100 // return FALSE if it couldn't be created
101 bool CreateDialog(const void *dlgTemplate,
102 const wxString& title,
103 const wxPoint& pos,
104 const wxSize& size);
105
106 // common part of Iconize(), Maximize() and Restore()
107 void DoShowWindow(int nShowCmd);
108
109 // translate wxWidgets flags to Windows ones
110 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const;
111
112 // choose the right parent to use with CreateWindow()
113 virtual WXHWND MSWGetParent() const;
114
115 // is the window currently iconized?
116 bool m_iconized;
117
118 // should the frame be maximized when it will be shown? set by Maximize()
119 // when it is called while the frame is hidden
120 bool m_maximizeOnShow;
121
122 // Data to save/restore when calling ShowFullScreen
123 long m_fsStyle; // Passed to ShowFullScreen
124 wxRect m_fsOldSize;
125 long m_fsOldWindowStyle;
126 bool m_fsIsMaximized;
127 bool m_fsIsShowing;
128
129 // the last focused child: we restore focus to it on activation
130 wxWindow *m_winLastFocused;
131
132 #ifdef __SMARTPHONE__
133 class ButtonMenu
134 {
135 public:
136 ButtonMenu();
137 ~ButtonMenu();
138
139 void SetButton(int id = wxID_ANY,
140 const wxString& label = wxEmptyString,
141 wxMenu *subMenu = NULL);
142
143 bool IsAssigned() const {return m_assigned;}
144 bool IsMenu() const {return m_menu!=NULL;}
145
146 int GetId() const {return m_id;}
147 wxMenu* GetMenu() const {return m_menu;}
148 wxString GetLabel() {return m_label;}
149
150 static wxMenu *DuplicateMenu(wxMenu *menu);
151
152 protected:
153 int m_id;
154 wxString m_label;
155 wxMenu *m_menu;
156 bool m_assigned;
157 };
158
159 ButtonMenu m_LeftButton;
160 ButtonMenu m_RightButton;
161 HWND m_MenuBarHWND;
162
163 void ReloadButton(ButtonMenu& button, UINT menuID);
164 void ReloadAllButtons();
165 #endif // __SMARTPHONE__
166
167 DECLARE_EVENT_TABLE()
168 DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW)
169 };
170
171 #endif // _WX_MSW_TOPLEVEL_H_
172