]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/frame.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFrame class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/window.h"
16 #include "wx/os2/accel.h"
19 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
20 WXDLLEXPORT_DATA(extern const wxChar
*) wxToolBarNameStr
;
21 WXDLLEXPORT_DATA(extern const wxChar
*) wxStatusLineNameStr
;
23 class WXDLLEXPORT wxMenuBar
;
24 class WXDLLEXPORT wxStatusBar
;
25 class WXDLLEXPORT wxToolBar
;
27 class WXDLLEXPORT wxFrame
: public wxWindow
29 DECLARE_DYNAMIC_CLASS(wxFrame
)
33 wxFrame(wxWindow
*parent
,
35 const wxString
& title
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
,
38 long style
= wxDEFAULT_FRAME_STYLE
,
39 const wxString
& name
= wxFrameNameStr
)
41 Create(parent
, id
, title
, pos
, size
, style
, name
);
46 bool Create(wxWindow
*parent
,
48 const wxString
& title
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
,
51 long style
= wxDEFAULT_FRAME_STYLE
,
52 const wxString
& name
= wxFrameNameStr
);
54 virtual bool Destroy();
56 void OnSize(wxSizeEvent
& event
);
57 void OnMenuHighlight(wxMenuEvent
& event
);
58 void OnActivate(wxActivateEvent
& event
);
59 void OnIdle(wxIdleEvent
& event
);
60 void OnCloseWindow(wxCloseEvent
& event
);
66 void SetMenuBar(wxMenuBar
*menu_bar
);
67 virtual wxMenuBar
*GetMenuBar() const;
69 // Call this to simulate a menu command
70 bool Command(int id
) { return ProcessCommand(id
); }
72 // process menu command: returns TRUE if processed
73 bool ProcessCommand(int id
);
75 // make the window modal (all other windows unresponsive)
76 virtual void MakeModal(bool modal
= TRUE
);
79 virtual void SetIcon(const wxIcon
& icon
);
83 virtual wxToolBar
* CreateToolBar(long style
= wxNO_BORDER
| wxTB_HORIZONTAL
| wxTB_FLAT
,
85 const wxString
& name
= wxToolBarNameStr
);
87 virtual wxToolBar
*OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
);
89 virtual void SetToolBar(wxToolBar
*toolbar
) { m_frameToolBar
= toolbar
; }
90 virtual wxToolBar
*GetToolBar() const { return m_frameToolBar
; }
92 virtual void PositionToolBar();
93 #endif // wxUSE_TOOLBAR
97 virtual wxStatusBar
* CreateStatusBar(int number
= 1,
98 long style
= wxST_SIZEGRIP
,
100 const wxString
& name
= wxStatusLineNameStr
);
102 wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
103 void SetStatusBar(wxStatusBar
*statusBar
) { m_frameStatusBar
= statusBar
; }
105 virtual void PositionStatusBar();
106 virtual wxStatusBar
*OnCreateStatusBar(int number
,
109 const wxString
& name
);
111 // Set status line text
112 virtual void SetStatusText(const wxString
& text
, int number
= 0);
114 // Set status line widths
115 virtual void SetStatusWidths(int n
, const int widths_field
[]);
117 // Hint to tell framework which status bar to use
118 // TODO: should this go into a wxFrameworkSettings class perhaps?
119 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
120 static bool UsesNativeStatusBar() { return m_useNativeStatusBar
; };
121 #endif // wxUSE_STATUSBAR
124 virtual void Iconize(bool iconize
);
126 virtual bool IsIconized() const;
129 virtual bool IsMaximized() const;
132 bool Iconized() const { return IsIconized(); }
134 virtual void Maximize(bool maximize
);
135 // virtual bool LoadAccelerators(const wxString& table);
137 // Responds to colour changes
138 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
140 // Query app for menu item updates (called from OnIdle)
141 void DoMenuUpdates();
142 void DoMenuUpdates(wxMenu
* menu
, wxWindow
* focusWin
);
144 WXHMENU
GetWinMenu() const { return m_hMenu
; }
146 // Returns the origin of client area (may be different from (0,0) if the
147 // frame has a toolbar)
148 virtual wxPoint
GetClientAreaOrigin() const;
150 // Implementation only from here
153 bool HandleSize(int x
, int y
, WXUINT flag
);
154 bool HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
155 bool HandleMenuSelect(WXWORD nItem
, WXWORD nFlags
, WXHMENU hMenu
);
157 bool OS2Create(int id
, wxWindow
*parent
, const wxChar
*wclass
,
158 wxWindow
*wx_win
, const wxChar
*title
,
159 int x
, int y
, int width
, int height
, long style
);
161 // tooltip management
163 WXHWND
GetToolTipCtrl() const { return m_hwndToolTip
; }
164 void SetToolTipCtrl(WXHWND hwndTT
) { m_hwndToolTip
= hwndTT
; }
168 // override base class virtuals
169 virtual void DoGetClientSize(int *width
, int *height
) const;
170 virtual void DoGetSize(int *width
, int *height
) const;
171 virtual void DoGetPosition(int *x
, int *y
) const;
173 virtual void DoSetClientSize(int width
, int height
);
175 virtual void DoClientToScreen(int *x
, int *y
) const;
176 virtual void DoScreenToClient(int *x
, int *y
) const;
178 // a plug in for MDI frame classes which need to do something special when
179 // the menubar is set
180 virtual void InternalSetMenuBar();
182 // propagate our state change to all child frames
183 void IconizeChildFrames(bool bIconize
);
185 // we add menu bar accel processing
186 bool OS2TranslateMessage(WXMSG
* pMsg
);
188 // window proc for the frames
189 MRESULT
OS2WindowProc(HWND hwnd
, WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
191 wxMenuBar
* m_frameMenuBar
;
194 WXHICON m_defaultIcon
;
197 wxStatusBar
* m_frameStatusBar
;
199 static bool m_useNativeStatusBar
;
200 #endif // wxUSE_STATUSBAR
203 wxToolBar
* m_frameToolBar
;
204 #endif // wxUSE_TOOLBAR
208 WXHWND m_hwndToolTip
;
211 DECLARE_EVENT_TABLE()