]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/frame.h
finished wxWindow for MGL
[wxWidgets.git] / include / wx / msw / frame.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
7c0ea335 2// Name: wx/msw/frame.h
1e6feb95 3// Purpose: wxFrameMSW class
2bda0e17
KB
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
16f6dfd8 9// Licence: wxWindows license
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_FRAME_H_
13#define _WX_FRAME_H_
2bda0e17
KB
14
15#ifdef __GNUG__
42e69d6b 16 #pragma interface "frame.h"
2bda0e17
KB
17#endif
18
1e6feb95 19class WXDLLEXPORT wxFrameMSW : public wxFrameBase
3a19e16d 20{
2bda0e17 21public:
7c0ea335 22 // construction
1e6feb95
VZ
23 wxFrameMSW() { Init(); }
24 wxFrameMSW(wxWindow *parent,
25 wxWindowID id,
26 const wxString& title,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 long style = wxDEFAULT_FRAME_STYLE,
30 const wxString& name = wxFrameNameStr)
3a19e16d 31 {
7c0ea335
VZ
32 Init();
33
3a19e16d
VZ
34 Create(parent, id, title, pos, size, style, name);
35 }
16f6dfd8 36
3a19e16d
VZ
37 bool Create(wxWindow *parent,
38 wxWindowID id,
39 const wxString& title,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = wxDEFAULT_FRAME_STYLE,
43 const wxString& name = wxFrameNameStr);
16f6dfd8 44
1e6feb95 45 virtual ~wxFrameMSW();
16f6dfd8 46
7c0ea335
VZ
47 // implement base class pure virtuals
48 virtual void Maximize(bool maximize = TRUE);
49 virtual bool IsMaximized() const;
50 virtual void Iconize(bool iconize = TRUE);
51 virtual bool IsIconized() const;
52 virtual void Restore();
7c0ea335 53 virtual void SetIcon(const wxIcon& icon);
a2327a9f
JS
54 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
55 virtual bool IsFullScreen() const { return m_fsIsShowing; };
42e69d6b 56
7c0ea335
VZ
57 // implementation only from now on
58 // -------------------------------
16f6dfd8 59
7c0ea335
VZ
60 // override some more virtuals
61 virtual bool Show(bool show = TRUE);
b5423899 62
7c0ea335
VZ
63 // event handlers
64 void OnActivate(wxActivateEvent& event);
65 void OnSysColourChanged(wxSysColourChangedEvent& event);
16f6dfd8 66
3a19e16d 67 // Toolbar
d427503c 68#if wxUSE_TOOLBAR
3a19e16d
VZ
69 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
70 wxWindowID id = -1,
71 const wxString& name = wxToolBarNameStr);
72
3a19e16d 73 virtual void PositionToolBar();
d427503c 74#endif // wxUSE_TOOLBAR
16f6dfd8 75
3a19e16d 76 // Status bar
7c0ea335
VZ
77#if wxUSE_STATUSBAR
78 virtual wxStatusBar* OnCreateStatusBar(int number = 1,
79 long style = wxST_SIZEGRIP,
80 wxWindowID id = 0,
81 const wxString& name = wxStatusLineNameStr);
3a19e16d
VZ
82
83 virtual void PositionStatusBar();
16f6dfd8 84
7c0ea335
VZ
85 // Hint to tell framework which status bar to use: the default is to use
86 // native one for the platforms which support it (Win32), the generic one
87 // otherwise
16f6dfd8 88
3a19e16d 89 // TODO: should this go into a wxFrameworkSettings class perhaps?
7c0ea335
VZ
90 static void UseNativeStatusBar(bool useNative)
91 { m_useNativeStatusBar = useNative; };
92 static bool UsesNativeStatusBar()
93 { return m_useNativeStatusBar; };
d427503c 94#endif // wxUSE_STATUSBAR
16f6dfd8 95
42e69d6b 96 WXHMENU GetWinMenu() const { return m_hMenu; }
16f6dfd8 97
7c0ea335 98 // event handlers
42e69d6b
VZ
99 bool HandlePaint();
100 bool HandleSize(int x, int y, WXUINT flag);
101 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
102 bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
103
9df8c2df
OK
104 bool MSWCreate(int id, wxWindow *parent, const wxChar *wclass,
105 wxWindow *wx_win, const wxChar *title,
debe6624 106 int x, int y, int width, int height, long style);
2bda0e17 107
7c0ea335 108 // tooltip management
3a19e16d 109#if wxUSE_TOOLTIPS
a23fd0e1
VZ
110 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
111 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
3a19e16d
VZ
112#endif // tooltips
113
3cfcd50b
GT
114 // a MSW only function which sends a size event to the window using its
115 // current size - this has an effect of refreshing the window layout
116 void SendSizeEvent();
117
4a41c655
VS
118 // called by wxWindow whenever it gets focus
119 void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
120 wxWindow *GetLastFocus() const { return m_winLastFocused; }
121
2bda0e17 122protected:
7c0ea335
VZ
123 // common part of all ctors
124 void Init();
125
126 // common part of Iconize(), Maximize() and Restore()
127 void DoShowWindow(int nShowCmd);
128
a23fd0e1
VZ
129 // override base class virtuals
130 virtual void DoGetClientSize(int *width, int *height) const;
42e69d6b
VZ
131 virtual void DoGetSize(int *width, int *height) const;
132 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1 133
a23fd0e1 134 virtual void DoSetClientSize(int width, int height);
cc2b7472 135
1e6feb95 136#if wxUSE_MENUS_NATIVE
6522713c
VZ
137 // perform MSW-specific action when menubar is changed
138 virtual void AttachMenuBar(wxMenuBar *menubar);
139
42e69d6b
VZ
140 // a plug in for MDI frame classes which need to do something special when
141 // the menubar is set
142 virtual void InternalSetMenuBar();
1e6feb95 143#endif // wxUSE_MENUS_NATIVE
42e69d6b 144
3a19e16d
VZ
145 // propagate our state change to all child frames
146 void IconizeChildFrames(bool bIconize);
16f6dfd8 147
42e69d6b
VZ
148 // we add menu bar accel processing
149 bool MSWTranslateMessage(WXMSG* pMsg);
150
a23fd0e1
VZ
151 // window proc for the frames
152 long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
bf505d28 153
91dd52fe 154 virtual bool IsMDIChild() const { return FALSE; }
a23fd0e1 155
bf505d28
VZ
156 // is the frame currently iconized?
157 bool m_iconized;
158
159 // should the frame be maximized when it will be shown? set by Maximize()
160 // when it is called while the frame is hidden
161 bool m_maximizeOnShow;
162
3a19e16d 163 WXHICON m_defaultIcon;
d427503c
VZ
164
165#if wxUSE_STATUSBAR
3a19e16d 166 static bool m_useNativeStatusBar;
d427503c
VZ
167#endif // wxUSE_STATUSBAR
168
f6bcfd97
BP
169 // the last focused child: we restore focus to it on activation
170 wxWindow *m_winLastFocused;
171
a2327a9f
JS
172 // Data to save/restore when calling ShowFullScreen
173 long m_fsStyle; // Passed to ShowFullScreen
174 wxRect m_fsOldSize;
175 long m_fsOldWindowStyle;
176 int m_fsStatusBarFields; // 0 for no status bar
177 int m_fsStatusBarHeight;
178 int m_fsToolBarHeight;
179// WXHMENU m_fsMenu;
180 bool m_fsIsMaximized;
181 bool m_fsIsShowing;
182
a23fd0e1 183private:
3a19e16d
VZ
184#if wxUSE_TOOLTIPS
185 WXHWND m_hwndToolTip;
186#endif // tooltips
187
3a19e16d 188 DECLARE_EVENT_TABLE()
2bda0e17
KB
189};
190
191#endif
bbcdf8bc 192 // _WX_FRAME_H_