]>
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 licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "frame.h"
19 #include "wx/window.h"
20 #include "wx/toolbar.h"
21 #include "wx/os2/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 inline 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
46 Create(parent
, id
, title
, pos
, size
, style
, name
);
51 bool Create( wxWindow
* parent
53 ,const wxString
& title
54 ,const wxPoint
& pos
= wxDefaultPosition
55 ,const wxSize
& size
= wxDefaultSize
56 ,long style
= wxDEFAULT_FRAME_STYLE
57 ,const wxString
& name
= wxFrameNameStr
60 virtual bool Destroy();
62 virtual void ClientToScreen(int *x
, int *y
) const;
63 virtual void ScreenToClient(int *x
, int *y
) const;
65 void SetClientSize(int width
, int height
);
66 void GetClientSize(int *width
, int *height
) const;
68 void OnSize(wxSizeEvent
& event
);
69 void OnMenuHighlight(wxMenuEvent
& event
);
70 void OnActivate(wxActivateEvent
& event
);
71 void OnIdle(wxIdleEvent
& event
);
72 void OnCloseWindow(wxCloseEvent
& event
);
79 void SetMenuBar(wxMenuBar
*menu_bar
);
80 virtual wxMenuBar
*GetMenuBar() const ;
82 // Call this to simulate a menu command
83 inline bool Command(int id
) { return ProcessCommand(id
); }
85 // process menu command: returns TRUE if processed
86 bool ProcessCommand(int id
);
88 // make the window modal (all other windows unresponsive)
89 virtual void MakeModal(bool modal
= TRUE
);
92 virtual void SetIcon(const wxIcon
& icon
);
96 virtual wxToolBar
* CreateToolBar(long style
= wxNO_BORDER
| wxTB_HORIZONTAL
| wxTB_FLAT
,
98 const wxString
& name
= wxToolBarNameStr
);
100 virtual wxToolBar
*OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
);
102 virtual void SetToolBar(wxToolBar
*toolbar
) { m_frameToolBar
= toolbar
; }
103 virtual wxToolBar
*GetToolBar() const { return m_frameToolBar
; }
105 virtual void PositionToolBar();
106 #endif // wxUSE_TOOLBAR
110 virtual wxStatusBar
* CreateStatusBar(int number
= 1,
111 long style
= wxST_SIZEGRIP
,
113 const wxString
& name
= wxStatusLineNameStr
);
115 wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
116 void SetStatusBar(wxStatusBar
*statusBar
) { m_frameStatusBar
= statusBar
; }
118 virtual void PositionStatusBar();
119 virtual wxStatusBar
*OnCreateStatusBar(int number
,
122 const wxString
& name
);
124 // Set status line text
125 virtual void SetStatusText(const wxString
& text
, int number
= 0);
127 // Set status line widths
128 virtual void SetStatusWidths(int n
, const int widths_field
[]);
130 // Hint to tell framework which status bar to use
131 // TODO: should this go into a wxFrameworkSettings class perhaps?
132 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
133 static bool UsesNativeStatusBar() { return m_useNativeStatusBar
; };
134 #endif // wxUSE_STATUSBAR
137 virtual void Iconize(bool iconize
);
139 virtual bool IsIconized() const;
142 virtual bool IsMaximized() const;
145 bool Iconized() const { return IsIconized(); }
147 virtual void Maximize(bool maximize
);
148 // virtual bool LoadAccelerators(const wxString& table);
150 // Responds to colour changes
151 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
153 // Query app for menu item updates (called from OnIdle)
154 void DoMenuUpdates();
155 void DoMenuUpdates(wxMenu
* menu
, wxWindow
* focusWin
);
157 WXHMENU
GetWinMenu() const { return m_hMenu
; }
159 // Returns the origin of client area (may be different from (0,0) if the
160 // frame has a toolbar)
161 virtual wxPoint
GetClientAreaOrigin() const;
163 // Implementation only from here
166 bool HandleSize(int x
, int y
, WXUINT flag
);
167 bool HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
168 bool HandleMenuSelect(WXWORD nItem
, WXWORD nFlags
, WXHMENU hMenu
);
170 bool OS2Create(int id
, wxWindow
*parent
, const wxChar
*wclass
,
171 wxWindow
*wx_win
, const wxChar
*title
,
172 int x
, int y
, int width
, int height
, long style
);
174 // tooltip management
176 WXHWND
GetToolTipCtrl() const { return m_hwndToolTip
; }
177 void SetToolTipCtrl(WXHWND hwndTT
) { m_hwndToolTip
= hwndTT
; }
181 // override base class virtuals
182 virtual void DoGetClientSize(int *width
, int *height
) const;
183 virtual void DoGetSize(int *width
, int *height
) const;
184 virtual void DoGetPosition(int *x
, int *y
) const;
186 virtual void DoSetClientSize(int width
, int height
);
188 // a plug in for MDI frame classes which need to do something special when
189 // the menubar is set
190 virtual void InternalSetMenuBar();
192 // propagate our state change to all child frames
193 void IconizeChildFrames(bool bIconize
);
195 // we add menu bar accel processing
196 bool OS2TranslateMessage(WXMSG
* pMsg
);
198 // window proc for the frames
199 MRESULT
OS2WindowProc(HWND hwnd
, WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
201 wxMenuBar
* m_frameMenuBar
;
204 WXHICON m_defaultIcon
;
207 wxStatusBar
* m_frameStatusBar
;
209 static bool m_useNativeStatusBar
;
210 #endif // wxUSE_STATUSBAR
213 wxToolBar
* m_frameToolBar
;
214 #endif // wxUSE_TOOLBAR
218 WXHWND m_hwndToolTip
;
221 DECLARE_EVENT_TABLE()