1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/toplevel.h
3 // Purpose: wxTopLevelWindowMSW is the MSW implementation of wxTLW
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MSW_TOPLEVEL_H_
13 #define _WX_MSW_TOPLEVEL_H_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "toplevel.h"
19 // ----------------------------------------------------------------------------
20 // wxTopLevelWindowMSW
21 // ----------------------------------------------------------------------------
23 class WXDLLEXPORT wxTopLevelWindowMSW
: public wxTopLevelWindowBase
26 // constructors and such
27 wxTopLevelWindowMSW() { Init(); }
29 wxTopLevelWindowMSW(wxWindow
*parent
,
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
)
39 (void)Create(parent
, id
, title
, pos
, size
, style
, name
);
42 bool Create(wxWindow
*parent
,
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
);
50 virtual ~wxTopLevelWindowMSW();
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();
62 virtual bool SetShape(const wxRegion
& region
);
64 virtual void RequestUserAttention(int flags
= wxUSER_ATTENTION_INFO
);
66 virtual bool Show(bool show
= true);
68 virtual bool ShowFullScreen(bool show
, long style
= wxFULLSCREEN_ALL
);
69 virtual bool IsFullScreen() const { return m_fsIsShowing
; }
71 // wxMSW only: EnableCloseButton(false) may be used to remove the "Close"
72 // button from the title bar
73 bool EnableCloseButton(bool enable
= true);
75 // implementation from now on
76 // --------------------------
79 void OnActivate(wxActivateEvent
& event
);
81 // called by wxWindow whenever it gets focus
82 void SetLastFocus(wxWindow
*win
) { m_winLastFocused
= win
; }
83 wxWindow
*GetLastFocus() const { return m_winLastFocused
; }
86 void SetLeftMenu(int id
= wxID_ANY
, const wxString
& label
= wxEmptyString
, wxMenu
*subMenu
= NULL
);
87 void SetRightMenu(int id
= wxID_ANY
, const wxString
& label
= wxEmptyString
, wxMenu
*subMenu
= NULL
);
88 bool HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
89 #endif // __SMARTPHONE__
92 // common part of all ctors
95 // create a new frame, return false if it couldn't be created
96 bool CreateFrame(const wxString
& title
,
100 // create a new dialog using the given dialog template from resources,
101 // return false if it couldn't be created
102 bool CreateDialog(const void *dlgTemplate
,
103 const wxString
& title
,
107 // common part of Iconize(), Maximize() and Restore()
108 void DoShowWindow(int nShowCmd
);
110 // translate wxWidgets flags to Windows ones
111 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
) const;
113 // choose the right parent to use with CreateWindow()
114 virtual WXHWND
MSWGetParent() const;
116 // is the window currently iconized?
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
;
123 // Data to save/restore when calling ShowFullScreen
124 long m_fsStyle
; // Passed to ShowFullScreen
126 long m_fsOldWindowStyle
;
127 bool m_fsIsMaximized
;
130 // the last focused child: we restore focus to it on activation
131 wxWindow
*m_winLastFocused
;
133 #ifdef __SMARTPHONE__
140 void SetButton(int id
= wxID_ANY
,
141 const wxString
& label
= wxEmptyString
,
142 wxMenu
*subMenu
= NULL
);
144 bool IsAssigned() const {return m_assigned
;}
145 bool IsMenu() const {return m_menu
!=NULL
;}
147 int GetId() const {return m_id
;}
148 wxMenu
* GetMenu() const {return m_menu
;}
149 wxString
GetLabel() {return m_label
;}
151 static wxMenu
*DuplicateMenu(wxMenu
*menu
);
160 ButtonMenu m_LeftButton
;
161 ButtonMenu m_RightButton
;
164 void ReloadButton(ButtonMenu
& button
, UINT menuID
);
165 void ReloadAllButtons();
166 #endif // __SMARTPHONE__
168 DECLARE_EVENT_TABLE()
169 DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW
)
172 #endif // _WX_MSW_TOPLEVEL_H_