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