]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/toplevel.h
b4e77b09da5289bb6c62a2e1e3c083fde4de2abc
[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 #ifdef __GNUG__
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 virtual bool Show(bool show = TRUE);
62
63 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
64 virtual bool IsFullScreen() const { return m_fsIsShowing; }
65
66 // wxMSW only: EnableCloseButton(FALSE) may be used to remove the "Close"
67 // button from the title bar
68 bool EnableCloseButton(bool enable = TRUE);
69
70 // implementation from now on
71 // --------------------------
72
73 // event handlers
74 void OnActivate(wxActivateEvent& event);
75
76 // called by wxWindow whenever it gets focus
77 void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
78 wxWindow *GetLastFocus() const { return m_winLastFocused; }
79
80 protected:
81 // common part of all ctors
82 void Init();
83
84 // create a new frame, return FALSE if it couldn't be created
85 bool CreateFrame(const wxString& title,
86 const wxPoint& pos,
87 const wxSize& size);
88
89 // create a new dialog using the given dialog template from resources,
90 // return FALSE if it couldn't be created
91 bool CreateDialog(const void *dlgTemplate,
92 const wxString& title,
93 const wxPoint& pos,
94 const wxSize& size);
95
96 // common part of Iconize(), Maximize() and Restore()
97 void DoShowWindow(int nShowCmd);
98
99 // translate wxWindows flags to Windows ones
100 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const;
101
102 // choose the right parent to use with CreateWindow()
103 virtual WXHWND MSWGetParent() const;
104
105 // is the window currently iconized?
106 bool m_iconized;
107
108 // should the frame be maximized when it will be shown? set by Maximize()
109 // when it is called while the frame is hidden
110 bool m_maximizeOnShow;
111
112 // Data to save/restore when calling ShowFullScreen
113 long m_fsStyle; // Passed to ShowFullScreen
114 wxRect m_fsOldSize;
115 long m_fsOldWindowStyle;
116 bool m_fsIsMaximized;
117 bool m_fsIsShowing;
118
119 // the last focused child: we restore focus to it on activation
120 wxWindow *m_winLastFocused;
121
122 DECLARE_EVENT_TABLE()
123 DECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW)
124 };
125
126 // list of all frames and modeless dialogs
127 extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows;
128
129 #endif // _WX_MSW_TOPLEVEL_H_
130