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