]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/frame.h
Unicode fix.
[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
3a19e16d
VZ
71 // Set menu bar
72 void SetMenuBar(wxMenuBar *menu_bar);
42e69d6b 73 virtual wxMenuBar *GetMenuBar() const;
16f6dfd8 74
3a19e16d 75 // Call this to simulate a menu command
46499442 76 bool Command(int id) { return ProcessCommand(id); }
42e69d6b
VZ
77
78 // process menu command: returns TRUE if processed
79 bool ProcessCommand(int id);
16f6dfd8 80
b5423899
RD
81 // make the window modal (all other windows unresponsive)
82 virtual void MakeModal(bool modal = TRUE);
83
3a19e16d
VZ
84 // Set icon
85 virtual void SetIcon(const wxIcon& icon);
16f6dfd8 86
3a19e16d
VZ
87 // Toolbar
88 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
89 wxWindowID id = -1,
90 const wxString& name = wxToolBarNameStr);
91
92 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
93
94 virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
95 virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
96
97 virtual void PositionToolBar();
16f6dfd8 98
3a19e16d
VZ
99 // Status bar
100 virtual wxStatusBar* CreateStatusBar(int number = 1,
101 long style = wxST_SIZEGRIP,
102 wxWindowID id = 0,
103 const wxString& name = wxStatusLineNameStr);
104
105 wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
106 void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
107
108 virtual void PositionStatusBar();
109 virtual wxStatusBar *OnCreateStatusBar(int number,
110 long style,
111 wxWindowID id,
112 const wxString& name);
16f6dfd8 113
3a19e16d
VZ
114 // Set status line text
115 virtual void SetStatusText(const wxString& text, int number = 0);
16f6dfd8 116
3a19e16d
VZ
117 // Set status line widths
118 virtual void SetStatusWidths(int n, const int widths_field[]);
16f6dfd8 119
3a19e16d
VZ
120 // Hint to tell framework which status bar to use
121 // TODO: should this go into a wxFrameworkSettings class perhaps?
122 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
123 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
16f6dfd8 124
3a19e16d
VZ
125 // Iconize
126 virtual void Iconize(bool iconize);
16f6dfd8 127
42e69d6b 128 virtual bool IsIconized() const;
16f6dfd8 129
3a19e16d 130 // Is it maximized?
42e69d6b 131 virtual bool IsMaximized() const;
16f6dfd8 132
3a19e16d
VZ
133 // Compatibility
134 bool Iconized() const { return IsIconized(); }
16f6dfd8 135
3a19e16d
VZ
136 virtual void Maximize(bool maximize);
137 // virtual bool LoadAccelerators(const wxString& table);
16f6dfd8 138
3a19e16d
VZ
139 // Responds to colour changes
140 void OnSysColourChanged(wxSysColourChangedEvent& event);
16f6dfd8 141
3a19e16d
VZ
142 // Query app for menu item updates (called from OnIdle)
143 void DoMenuUpdates();
e702ff0f 144 void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
16f6dfd8 145
42e69d6b 146 WXHMENU GetWinMenu() const { return m_hMenu; }
16f6dfd8 147
3a19e16d
VZ
148 // Returns the origin of client area (may be different from (0,0) if the
149 // frame has a toolbar)
150 virtual wxPoint GetClientAreaOrigin() const;
16f6dfd8 151
3a19e16d
VZ
152 // Implementation only from here
153 // event handlers
42e69d6b
VZ
154 bool HandlePaint();
155 bool HandleSize(int x, int y, WXUINT flag);
156 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
157 bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
158
a23fd0e1 159 bool MSWCreate(int id, wxWindow *parent, const char *wclass,
3a19e16d 160 wxWindow *wx_win, const char *title,
debe6624 161 int x, int y, int width, int height, long style);
2bda0e17 162
16f6dfd8 163 // tooltip management
3a19e16d 164#if wxUSE_TOOLTIPS
a23fd0e1
VZ
165 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
166 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
3a19e16d
VZ
167#endif // tooltips
168
2bda0e17 169protected:
a23fd0e1
VZ
170 // override base class virtuals
171 virtual void DoGetClientSize(int *width, int *height) const;
42e69d6b
VZ
172 virtual void DoGetSize(int *width, int *height) const;
173 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1
VZ
174
175 virtual void DoSetSize(int x, int y,
176 int width, int height,
177 int sizeFlags = wxSIZE_AUTO);
178 virtual void DoSetClientSize(int width, int height);
cc2b7472 179
42e69d6b
VZ
180 // a plug in for MDI frame classes which need to do something special when
181 // the menubar is set
182 virtual void InternalSetMenuBar();
183
3a19e16d
VZ
184 // propagate our state change to all child frames
185 void IconizeChildFrames(bool bIconize);
16f6dfd8 186
42e69d6b
VZ
187 // we add menu bar accel processing
188 bool MSWTranslateMessage(WXMSG* pMsg);
189
a23fd0e1
VZ
190 // window proc for the frames
191 long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
192
3a19e16d
VZ
193 wxMenuBar * m_frameMenuBar;
194 wxStatusBar * m_frameStatusBar;
195 wxIcon m_icon;
196 bool m_iconized;
197 WXHICON m_defaultIcon;
42e69d6b 198 wxToolBar * m_frameToolBar;
3a19e16d
VZ
199
200 static bool m_useNativeStatusBar;
201
a23fd0e1 202private:
3a19e16d
VZ
203#if wxUSE_TOOLTIPS
204 WXHWND m_hwndToolTip;
205#endif // tooltips
206
3a19e16d 207 DECLARE_EVENT_TABLE()
2bda0e17
KB
208};
209
210#endif
bbcdf8bc 211 // _WX_FRAME_H_