]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/frame.h
Corrected WM_KEYDOWN bug (missing 'break')
[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__
16#pragma interface "frame.h"
17#endif
18
19#include "wx/window.h"
81d66cf3 20#include "wx/toolbar.h"
57a7b7c1 21#include "wx/msw/accel.h"
2bda0e17
KB
22
23WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
81d66cf3 24WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
62448488 25WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr;
2bda0e17
KB
26
27class WXDLLEXPORT wxMenuBar;
28class WXDLLEXPORT wxStatusBar;
29
3a19e16d
VZ
30class WXDLLEXPORT wxFrame : public wxWindow
31{
32DECLARE_DYNAMIC_CLASS(wxFrame)
2bda0e17
KB
33
34public:
3a19e16d
VZ
35 wxFrame();
36 wxFrame(wxWindow *parent,
37 wxWindowID id,
38 const wxString& title,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = wxDEFAULT_FRAME_STYLE,
42 const wxString& name = wxFrameNameStr)
43 {
44 Create(parent, id, title, pos, size, style, name);
45 }
16f6dfd8 46
3a19e16d 47 ~wxFrame();
16f6dfd8 48
3a19e16d
VZ
49 bool Create(wxWindow *parent,
50 wxWindowID id,
51 const wxString& title,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 long style = wxDEFAULT_FRAME_STYLE,
55 const wxString& name = wxFrameNameStr);
16f6dfd8 56
3a19e16d 57 virtual bool Destroy();
16f6dfd8 58
3a19e16d
VZ
59 void SetClientSize(int width, int height);
60 void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); }
16f6dfd8 61
3a19e16d
VZ
62 void GetClientSize(int *width, int *height) const;
63 wxSize GetClientSize() const { return wxWindow::GetClientSize(); }
16f6dfd8 64
3a19e16d
VZ
65 void GetSize(int *width, int *height) const ;
66 wxSize GetSize() const { return wxWindow::GetSize(); }
16f6dfd8 67
3a19e16d
VZ
68 void GetPosition(int *x, int *y) const ;
69 wxPoint GetPosition() const { return wxWindow::GetPosition(); }
16f6dfd8 70
3a19e16d 71 virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
dbdb39b2
JS
72 virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
73 { wxWindow::SetSize(rect, sizeFlags); }
74 virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); }
75 virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); }
16f6dfd8 76
3a19e16d 77 virtual void ClientToScreen(int *x, int *y) const;
16f6dfd8 78
3a19e16d 79 virtual void ScreenToClient(int *x, int *y) const;
16f6dfd8 80
3a19e16d
VZ
81 void OnSize(wxSizeEvent& event);
82 void OnMenuHighlight(wxMenuEvent& event);
83 void OnActivate(wxActivateEvent& event);
84 void OnIdle(wxIdleEvent& event);
85 void OnCloseWindow(wxCloseEvent& event);
16f6dfd8 86
3a19e16d 87 bool Show(bool show);
16f6dfd8 88
3a19e16d
VZ
89 // Set menu bar
90 void SetMenuBar(wxMenuBar *menu_bar);
91 virtual wxMenuBar *GetMenuBar() const ;
16f6dfd8 92
3a19e16d
VZ
93 // Set title
94 void SetTitle(const wxString& title);
95 wxString GetTitle() const ;
16f6dfd8 96
3a19e16d 97 void Centre(int direction = wxBOTH);
16f6dfd8 98
3a19e16d
VZ
99 // Call this to simulate a menu command
100 virtual void Command(int id);
101 virtual void ProcessCommand(int id);
16f6dfd8 102
3a19e16d
VZ
103 // Set icon
104 virtual void SetIcon(const wxIcon& icon);
16f6dfd8 105
3a19e16d
VZ
106 // Toolbar
107 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
108 wxWindowID id = -1,
109 const wxString& name = wxToolBarNameStr);
110
111 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
112
113 virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
114 virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
115
116 virtual void PositionToolBar();
16f6dfd8 117
3a19e16d
VZ
118 // Status bar
119 virtual wxStatusBar* CreateStatusBar(int number = 1,
120 long style = wxST_SIZEGRIP,
121 wxWindowID id = 0,
122 const wxString& name = wxStatusLineNameStr);
123
124 wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
125 void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
126
127 virtual void PositionStatusBar();
128 virtual wxStatusBar *OnCreateStatusBar(int number,
129 long style,
130 wxWindowID id,
131 const wxString& name);
16f6dfd8 132
3a19e16d
VZ
133 // Set status line text
134 virtual void SetStatusText(const wxString& text, int number = 0);
16f6dfd8 135
3a19e16d
VZ
136 // Set status line widths
137 virtual void SetStatusWidths(int n, const int widths_field[]);
16f6dfd8 138
3a19e16d
VZ
139 // Hint to tell framework which status bar to use
140 // TODO: should this go into a wxFrameworkSettings class perhaps?
141 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
142 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
16f6dfd8 143
3a19e16d
VZ
144 // Fit frame around subwindows
145 virtual void Fit();
16f6dfd8 146
3a19e16d
VZ
147 // Iconize
148 virtual void Iconize(bool iconize);
16f6dfd8 149
3a19e16d 150 virtual bool IsIconized() const ;
16f6dfd8 151
3a19e16d
VZ
152 // Is it maximized?
153 virtual bool IsMaximized() const ;
16f6dfd8 154
3a19e16d
VZ
155 // Compatibility
156 bool Iconized() const { return IsIconized(); }
16f6dfd8 157
3a19e16d
VZ
158 virtual void Maximize(bool maximize);
159 // virtual bool LoadAccelerators(const wxString& table);
16f6dfd8 160
3a19e16d
VZ
161 // Responds to colour changes
162 void OnSysColourChanged(wxSysColourChangedEvent& event);
16f6dfd8 163
3a19e16d
VZ
164 // Query app for menu item updates (called from OnIdle)
165 void DoMenuUpdates();
166 void DoMenuUpdates(wxMenu* menu);
16f6dfd8 167
3a19e16d 168 WXHMENU GetWinMenu() const ;
16f6dfd8 169
3a19e16d
VZ
170 // Returns the origin of client area (may be different from (0,0) if the
171 // frame has a toolbar)
172 virtual wxPoint GetClientAreaOrigin() const;
16f6dfd8 173
3a19e16d
VZ
174 // Implementation only from here
175 // event handlers
176 bool MSWOnPaint();
177 WXHICON MSWOnQueryDragIcon();
178 void MSWOnSize(int x, int y, WXUINT flag);
179 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
180 bool MSWOnClose();
181 void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
182 bool MSWProcessMessage(WXMSG *msg);
183 bool MSWTranslateMessage(WXMSG *msg);
184 void MSWCreate(int id, wxWindow *parent, const char *wclass,
185 wxWindow *wx_win, const char *title,
debe6624 186 int x, int y, int width, int height, long style);
2bda0e17 187
16f6dfd8 188 // tooltip management
3a19e16d 189#if wxUSE_TOOLTIPS
16f6dfd8
VZ
190 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
191 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
3a19e16d
VZ
192#endif // tooltips
193
2bda0e17 194protected:
3a19e16d
VZ
195 // propagate our state change to all child frames
196 void IconizeChildFrames(bool bIconize);
16f6dfd8 197
3a19e16d
VZ
198 wxMenuBar * m_frameMenuBar;
199 wxStatusBar * m_frameStatusBar;
200 wxIcon m_icon;
201 bool m_iconized;
202 WXHICON m_defaultIcon;
203 wxToolBar * m_frameToolBar ;
204
205 static bool m_useNativeStatusBar;
206
207#if wxUSE_TOOLTIPS
208 WXHWND m_hwndToolTip;
209#endif // tooltips
210
211private:
212 DECLARE_EVENT_TABLE()
2bda0e17
KB
213};
214
215#endif
bbcdf8bc 216 // _WX_FRAME_H_