]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/frame.h
bugfixes
[wxWidgets.git] / include / wx / msw / frame.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: frame.h
3// Purpose: wxFrame class
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
19#include "wx/window.h"
81d66cf3 20#include "wx/toolbar.h"
57a7b7c1 21#include "wx/msw/accel.h"
cc2b7472 22#include "wx/icon.h"
2bda0e17 23
39ca6d79
OK
24WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
25WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
26WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
2bda0e17
KB
27
28class WXDLLEXPORT wxMenuBar;
29class WXDLLEXPORT wxStatusBar;
30
3a19e16d
VZ
31class WXDLLEXPORT wxFrame : public wxWindow
32{
42e69d6b 33 DECLARE_DYNAMIC_CLASS(wxFrame)
2bda0e17
KB
34
35public:
3a19e16d
VZ
36 wxFrame();
37 wxFrame(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)
44 {
45 Create(parent, id, title, pos, size, style, name);
46 }
16f6dfd8 47
3a19e16d 48 ~wxFrame();
16f6dfd8 49
3a19e16d
VZ
50 bool Create(wxWindow *parent,
51 wxWindowID id,
52 const wxString& title,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = wxDEFAULT_FRAME_STYLE,
56 const wxString& name = wxFrameNameStr);
16f6dfd8 57
3a19e16d 58 virtual bool Destroy();
16f6dfd8 59
721b32e0 60 virtual void ClientToScreen(int *x, int *y) const;
3a19e16d 61 virtual void ScreenToClient(int *x, int *y) const;
16f6dfd8 62
3a19e16d
VZ
63 void OnSize(wxSizeEvent& event);
64 void OnMenuHighlight(wxMenuEvent& event);
65 void OnActivate(wxActivateEvent& event);
66 void OnIdle(wxIdleEvent& event);
67 void OnCloseWindow(wxCloseEvent& event);
16f6dfd8 68
3a19e16d 69 bool Show(bool show);
16f6dfd8 70
ea9a4296 71 void DetachMenuBar();
3a19e16d
VZ
72 // Set menu bar
73 void SetMenuBar(wxMenuBar *menu_bar);
42e69d6b 74 virtual wxMenuBar *GetMenuBar() const;
16f6dfd8 75
3a19e16d 76 // Call this to simulate a menu command
46499442 77 bool Command(int id) { return ProcessCommand(id); }
42e69d6b
VZ
78
79 // process menu command: returns TRUE if processed
80 bool ProcessCommand(int id);
16f6dfd8 81
b5423899
RD
82 // make the window modal (all other windows unresponsive)
83 virtual void MakeModal(bool modal = TRUE);
84
3a19e16d
VZ
85 // Set icon
86 virtual void SetIcon(const wxIcon& icon);
16f6dfd8 87
3a19e16d 88 // Toolbar
d427503c 89#if wxUSE_TOOLBAR
3a19e16d
VZ
90 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
91 wxWindowID id = -1,
92 const wxString& name = wxToolBarNameStr);
93
94 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
95
96 virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
97 virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
98
99 virtual void PositionToolBar();
d427503c 100#endif // wxUSE_TOOLBAR
16f6dfd8 101
d427503c 102#if wxUSE_STATUSBAR
3a19e16d
VZ
103 // Status bar
104 virtual wxStatusBar* CreateStatusBar(int number = 1,
105 long style = wxST_SIZEGRIP,
106 wxWindowID id = 0,
107 const wxString& name = wxStatusLineNameStr);
108
109 wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
110 void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
111
112 virtual void PositionStatusBar();
113 virtual wxStatusBar *OnCreateStatusBar(int number,
114 long style,
115 wxWindowID id,
116 const wxString& name);
16f6dfd8 117
3a19e16d
VZ
118 // Set status line text
119 virtual void SetStatusText(const wxString& text, int number = 0);
16f6dfd8 120
3a19e16d
VZ
121 // Set status line widths
122 virtual void SetStatusWidths(int n, const int widths_field[]);
16f6dfd8 123
3a19e16d
VZ
124 // Hint to tell framework which status bar to use
125 // TODO: should this go into a wxFrameworkSettings class perhaps?
126 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
127 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
d427503c 128#endif // wxUSE_STATUSBAR
16f6dfd8 129
3a19e16d
VZ
130 // Iconize
131 virtual void Iconize(bool iconize);
16f6dfd8 132
42e69d6b 133 virtual bool IsIconized() const;
16f6dfd8 134
3a19e16d 135 // Is it maximized?
42e69d6b 136 virtual bool IsMaximized() const;
16f6dfd8 137
3a19e16d
VZ
138 // Compatibility
139 bool Iconized() const { return IsIconized(); }
16f6dfd8 140
3a19e16d
VZ
141 virtual void Maximize(bool maximize);
142 // virtual bool LoadAccelerators(const wxString& table);
16f6dfd8 143
3a19e16d
VZ
144 // Responds to colour changes
145 void OnSysColourChanged(wxSysColourChangedEvent& event);
16f6dfd8 146
3a19e16d
VZ
147 // Query app for menu item updates (called from OnIdle)
148 void DoMenuUpdates();
e702ff0f 149 void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
16f6dfd8 150
42e69d6b 151 WXHMENU GetWinMenu() const { return m_hMenu; }
16f6dfd8 152
3a19e16d
VZ
153 // Returns the origin of client area (may be different from (0,0) if the
154 // frame has a toolbar)
155 virtual wxPoint GetClientAreaOrigin() const;
16f6dfd8 156
3a19e16d
VZ
157 // Implementation only from here
158 // event handlers
42e69d6b
VZ
159 bool HandlePaint();
160 bool HandleSize(int x, int y, WXUINT flag);
161 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
162 bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
163
9df8c2df
OK
164 bool MSWCreate(int id, wxWindow *parent, const wxChar *wclass,
165 wxWindow *wx_win, const wxChar *title,
debe6624 166 int x, int y, int width, int height, long style);
2bda0e17 167
16f6dfd8 168 // tooltip management
3a19e16d 169#if wxUSE_TOOLTIPS
a23fd0e1
VZ
170 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
171 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
3a19e16d
VZ
172#endif // tooltips
173
2bda0e17 174protected:
a23fd0e1
VZ
175 // override base class virtuals
176 virtual void DoGetClientSize(int *width, int *height) const;
42e69d6b
VZ
177 virtual void DoGetSize(int *width, int *height) const;
178 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1 179
a23fd0e1 180 virtual void DoSetClientSize(int width, int height);
cc2b7472 181
42e69d6b
VZ
182 // a plug in for MDI frame classes which need to do something special when
183 // the menubar is set
184 virtual void InternalSetMenuBar();
185
3a19e16d
VZ
186 // propagate our state change to all child frames
187 void IconizeChildFrames(bool bIconize);
16f6dfd8 188
42e69d6b
VZ
189 // we add menu bar accel processing
190 bool MSWTranslateMessage(WXMSG* pMsg);
191
a23fd0e1
VZ
192 // window proc for the frames
193 long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
194
3a19e16d 195 wxMenuBar * m_frameMenuBar;
3a19e16d
VZ
196 wxIcon m_icon;
197 bool m_iconized;
198 WXHICON m_defaultIcon;
d427503c
VZ
199
200#if wxUSE_STATUSBAR
201 wxStatusBar * m_frameStatusBar;
3a19e16d
VZ
202
203 static bool m_useNativeStatusBar;
d427503c
VZ
204#endif // wxUSE_STATUSBAR
205
206#if wxUSE_TOOLBAR
207 wxToolBar * m_frameToolBar;
208#endif // wxUSE_TOOLBAR
3a19e16d 209
a23fd0e1 210private:
3a19e16d
VZ
211#if wxUSE_TOOLTIPS
212 WXHWND m_hwndToolTip;
213#endif // tooltips
214
3a19e16d 215 DECLARE_EVENT_TABLE()
2bda0e17
KB
216};
217
218#endif
bbcdf8bc 219 // _WX_FRAME_H_