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