]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/toplevel.h
changed Remove/InsertDir() parameter type to size_t from int; added RemoveLastDir()
[wxWidgets.git] / include / wx / msw / toplevel.h
CommitLineData
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 23class WXDLLEXPORT wxTopLevelWindowMSW : public wxTopLevelWindowBase
82c9f85c
VZ
24{
25public:
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__
dc92adaf 64 virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
1542ea39 65
bfbb0b4c 66 virtual bool Show(bool show = true);
82c9f85c 67
41e929e5
VS
68 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
69 virtual bool IsFullScreen() const { return m_fsIsShowing; }
9b9cab37 70
bfbb0b4c 71 // wxMSW only: EnableCloseButton(false) may be used to remove the "Close"
a91cf80c 72 // button from the title bar
bfbb0b4c 73 bool EnableCloseButton(bool enable = true);
a91cf80c 74
82c9f85c
VZ
75 // implementation from now on
76 // --------------------------
77
085ad686
VZ
78 // event handlers
79 void OnActivate(wxActivateEvent& event);
80
81 // called by wxWindow whenever it gets focus
82 void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
83 wxWindow *GetLastFocus() const { return m_winLastFocused; }
84
9b141468
WS
85#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
86 virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL);
87 virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL);
fb8a56b7 88 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
9b141468 89#endif // __SMARTPHONE__ && __WXWINCE__
fb8a56b7 90
82c9f85c
VZ
91protected:
92 // common part of all ctors
93 void Init();
94
bfbb0b4c 95 // create a new frame, return false if it couldn't be created
b225f659
VZ
96 bool CreateFrame(const wxString& title,
97 const wxPoint& pos,
98 const wxSize& size);
99
100 // create a new dialog using the given dialog template from resources,
bfbb0b4c 101 // return false if it couldn't be created
6e8515a3 102 bool CreateDialog(const void *dlgTemplate,
b225f659
VZ
103 const wxString& title,
104 const wxPoint& pos,
105 const wxSize& size);
106
82c9f85c
VZ
107 // common part of Iconize(), Maximize() and Restore()
108 void DoShowWindow(int nShowCmd);
109
77ffb593 110 // translate wxWidgets flags to Windows ones
b2d5a7ee 111 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const;
b225f659 112
9dfef5ac
VZ
113 // choose the right parent to use with CreateWindow()
114 virtual WXHWND MSWGetParent() const;
115
7e25f59e 116 // is the window currently iconized?
82c9f85c
VZ
117 bool m_iconized;
118
119 // should the frame be maximized when it will be shown? set by Maximize()
120 // when it is called while the frame is hidden
121 bool m_maximizeOnShow;
41e929e5
VS
122
123 // Data to save/restore when calling ShowFullScreen
124 long m_fsStyle; // Passed to ShowFullScreen
125 wxRect m_fsOldSize;
126 long m_fsOldWindowStyle;
127 bool m_fsIsMaximized;
128 bool m_fsIsShowing;
9dfef5ac 129
085ad686
VZ
130 // the last focused child: we restore focus to it on activation
131 wxWindow *m_winLastFocused;
132
9b141468 133#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
fb8a56b7
WS
134 class ButtonMenu
135 {
136 public:
137 ButtonMenu();
138 ~ButtonMenu();
139
bfbb0b4c
WS
140 void SetButton(int id = wxID_ANY,
141 const wxString& label = wxEmptyString,
fb8a56b7
WS
142 wxMenu *subMenu = NULL);
143
144 bool IsAssigned() const {return m_assigned;}
145 bool IsMenu() const {return m_menu!=NULL;}
146
147 int GetId() const {return m_id;}
148 wxMenu* GetMenu() const {return m_menu;}
149 wxString GetLabel() {return m_label;}
150
151 static wxMenu *DuplicateMenu(wxMenu *menu);
152
153 protected:
154 int m_id;
155 wxString m_label;
156 wxMenu *m_menu;
157 bool m_assigned;
158 };
159
160 ButtonMenu m_LeftButton;
161 ButtonMenu m_RightButton;
162 HWND m_MenuBarHWND;
163
164 void ReloadButton(ButtonMenu& button, UINT menuID);
165 void ReloadAllButtons();
9b141468 166#endif // __SMARTPHONE__ && __WXWINCE__
fb8a56b7 167
085ad686 168 DECLARE_EVENT_TABLE()
22f3361e 169 DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW)
82c9f85c
VZ
170};
171
82c9f85c
VZ
172#endif // _WX_MSW_TOPLEVEL_H_
173