]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/frame.h
c54d5f66f8941df2eec76000797457ec0181430d
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFrame class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "frame.h"
19 #include "wx/window.h"
20 #include "wx/toolbar.h"
21 #include "wx/msw/accel.h"
24 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
25 WXDLLEXPORT_DATA(extern const wxChar
*) wxToolBarNameStr
;
26 WXDLLEXPORT_DATA(extern const wxChar
*) wxStatusLineNameStr
;
28 class WXDLLEXPORT wxMenuBar
;
29 class WXDLLEXPORT wxStatusBar
;
31 class WXDLLEXPORT wxFrame
: public wxWindow
33 DECLARE_DYNAMIC_CLASS(wxFrame
)
37 wxFrame(wxWindow
*parent
,
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
)
45 Create(parent
, id
, title
, pos
, size
, style
, name
);
50 bool Create(wxWindow
*parent
,
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
);
58 virtual bool Destroy();
60 virtual void ClientToScreen(int *x
, int *y
) const;
61 virtual void ScreenToClient(int *x
, int *y
) const;
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
);
72 void SetMenuBar(wxMenuBar
*menu_bar
);
73 virtual wxMenuBar
*GetMenuBar() const;
75 // Call this to simulate a menu command
76 bool Command(int id
) { return ProcessCommand(id
); }
78 // process menu command: returns TRUE if processed
79 bool ProcessCommand(int id
);
81 // make the window modal (all other windows unresponsive)
82 virtual void MakeModal(bool modal
= TRUE
);
85 virtual void SetIcon(const wxIcon
& icon
);
88 virtual wxToolBar
* CreateToolBar(long style
= wxNO_BORDER
| wxTB_HORIZONTAL
| wxTB_FLAT
,
90 const wxString
& name
= wxToolBarNameStr
);
92 virtual wxToolBar
*OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
);
94 virtual void SetToolBar(wxToolBar
*toolbar
) { m_frameToolBar
= toolbar
; }
95 virtual wxToolBar
*GetToolBar() const { return m_frameToolBar
; }
97 virtual void PositionToolBar();
100 virtual wxStatusBar
* CreateStatusBar(int number
= 1,
101 long style
= wxST_SIZEGRIP
,
103 const wxString
& name
= wxStatusLineNameStr
);
105 wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
106 void SetStatusBar(wxStatusBar
*statusBar
) { m_frameStatusBar
= statusBar
; }
108 virtual void PositionStatusBar();
109 virtual wxStatusBar
*OnCreateStatusBar(int number
,
112 const wxString
& name
);
114 // Set status line text
115 virtual void SetStatusText(const wxString
& text
, int number
= 0);
117 // Set status line widths
118 virtual void SetStatusWidths(int n
, const int widths_field
[]);
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
; };
126 virtual void Iconize(bool iconize
);
128 virtual bool IsIconized() const;
131 virtual bool IsMaximized() const;
134 bool Iconized() const { return IsIconized(); }
136 virtual void Maximize(bool maximize
);
137 // virtual bool LoadAccelerators(const wxString& table);
139 // Responds to colour changes
140 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
142 // Query app for menu item updates (called from OnIdle)
143 void DoMenuUpdates();
144 void DoMenuUpdates(wxMenu
* menu
, wxWindow
* focusWin
);
146 WXHMENU
GetWinMenu() const { return m_hMenu
; }
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;
152 // Implementation only from here
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
);
159 bool MSWCreate(int id
, wxWindow
*parent
, const char *wclass
,
160 wxWindow
*wx_win
, const char *title
,
161 int x
, int y
, int width
, int height
, long style
);
163 // tooltip management
165 WXHWND
GetToolTipCtrl() const { return m_hwndToolTip
; }
166 void SetToolTipCtrl(WXHWND hwndTT
) { m_hwndToolTip
= hwndTT
; }
170 // override base class virtuals
171 virtual void DoGetClientSize(int *width
, int *height
) const;
172 virtual void DoGetSize(int *width
, int *height
) const;
173 virtual void DoGetPosition(int *x
, int *y
) const;
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
);
180 // a plug in for MDI frame classes which need to do something special when
181 // the menubar is set
182 virtual void InternalSetMenuBar();
184 // propagate our state change to all child frames
185 void IconizeChildFrames(bool bIconize
);
187 // we add menu bar accel processing
188 bool MSWTranslateMessage(WXMSG
* pMsg
);
190 // window proc for the frames
191 long MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
193 wxMenuBar
* m_frameMenuBar
;
194 wxStatusBar
* m_frameStatusBar
;
197 WXHICON m_defaultIcon
;
198 wxToolBar
* m_frameToolBar
;
200 static bool m_useNativeStatusBar
;
204 WXHWND m_hwndToolTip
;
207 DECLARE_EVENT_TABLE()