]>
Commit | Line | Data |
---|---|---|
82c9f85c VZ |
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) | |
65571936 | 9 | // Licence: wxWindows licence |
82c9f85c VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_MSW_TOPLEVEL_H_ | |
13 | #define _WX_MSW_TOPLEVEL_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
82c9f85c VZ |
16 | #pragma interface "toplevel.h" |
17 | #endif | |
18 | ||
19 | // ---------------------------------------------------------------------------- | |
20 | // wxTopLevelWindowMSW | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
361128cb | 23 | class WXDLLEXPORT wxTopLevelWindowMSW : public wxTopLevelWindowBase |
82c9f85c VZ |
24 | { |
25 | public: | |
26 | // constructors and such | |
6463b9f5 | 27 | wxTopLevelWindowMSW() { Init(); } |
82c9f85c VZ |
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, | |
6463b9f5 JS |
35 | const wxString& name = wxFrameNameStr) |
36 | { | |
37 | Init(); | |
38 | ||
39 | (void)Create(parent, id, title, pos, size, style, name); | |
40 | } | |
82c9f85c VZ |
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 | |
bfbb0b4c | 53 | virtual void Maximize(bool maximize = true); |
82c9f85c | 54 | virtual bool IsMaximized() const; |
bfbb0b4c | 55 | virtual void Iconize(bool iconize = true); |
82c9f85c VZ |
56 | virtual bool IsIconized() const; |
57 | virtual void SetIcon(const wxIcon& icon); | |
f618020a | 58 | virtual void SetIcons(const wxIconBundle& icons ); |
82c9f85c VZ |
59 | virtual void Restore(); |
60 | ||
2a47cb1b | 61 | #ifndef __WXWINCE__ |
1542ea39 | 62 | virtual bool SetShape(const wxRegion& region); |
2a47cb1b | 63 | #endif // __WXWINCE__ |
1542ea39 | 64 | |
bfbb0b4c | 65 | virtual bool Show(bool show = true); |
82c9f85c | 66 | |
41e929e5 VS |
67 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); |
68 | virtual bool IsFullScreen() const { return m_fsIsShowing; } | |
9b9cab37 | 69 | |
bfbb0b4c | 70 | // wxMSW only: EnableCloseButton(false) may be used to remove the "Close" |
a91cf80c | 71 | // button from the title bar |
bfbb0b4c | 72 | bool EnableCloseButton(bool enable = true); |
a91cf80c | 73 | |
82c9f85c VZ |
74 | // implementation from now on |
75 | // -------------------------- | |
76 | ||
085ad686 VZ |
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 | ||
fb8a56b7 WS |
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 | ||
82c9f85c VZ |
90 | protected: |
91 | // common part of all ctors | |
92 | void Init(); | |
93 | ||
bfbb0b4c | 94 | // create a new frame, return false if it couldn't be created |
b225f659 VZ |
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, | |
bfbb0b4c | 100 | // return false if it couldn't be created |
6e8515a3 | 101 | bool CreateDialog(const void *dlgTemplate, |
b225f659 VZ |
102 | const wxString& title, |
103 | const wxPoint& pos, | |
104 | const wxSize& size); | |
105 | ||
82c9f85c VZ |
106 | // common part of Iconize(), Maximize() and Restore() |
107 | void DoShowWindow(int nShowCmd); | |
108 | ||
77ffb593 | 109 | // translate wxWidgets flags to Windows ones |
b2d5a7ee | 110 | virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; |
b225f659 | 111 | |
9dfef5ac VZ |
112 | // choose the right parent to use with CreateWindow() |
113 | virtual WXHWND MSWGetParent() const; | |
114 | ||
7e25f59e | 115 | // is the window currently iconized? |
82c9f85c VZ |
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; | |
41e929e5 VS |
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; | |
9dfef5ac | 128 | |
085ad686 VZ |
129 | // the last focused child: we restore focus to it on activation |
130 | wxWindow *m_winLastFocused; | |
131 | ||
fb8a56b7 WS |
132 | #ifdef __SMARTPHONE__ |
133 | class ButtonMenu | |
134 | { | |
135 | public: | |
136 | ButtonMenu(); | |
137 | ~ButtonMenu(); | |
138 | ||
bfbb0b4c WS |
139 | void SetButton(int id = wxID_ANY, |
140 | const wxString& label = wxEmptyString, | |
fb8a56b7 WS |
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 | ||
085ad686 | 167 | DECLARE_EVENT_TABLE() |
22f3361e | 168 | DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW) |
82c9f85c VZ |
169 | }; |
170 | ||
82c9f85c VZ |
171 | #endif // _WX_MSW_TOPLEVEL_H_ |
172 |