]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/frame.h
4686bce84a22b89902d80421149a030752d6b233
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFrame class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/window.h"
16 #include "wx/toolbar.h"
17 #include "wx/os2/accel.h"
20 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
21 WXDLLEXPORT_DATA(extern const wxChar
*) wxToolBarNameStr
;
22 WXDLLEXPORT_DATA(extern const wxChar
*) wxStatusLineNameStr
;
24 class WXDLLEXPORT wxMenuBar
;
25 class WXDLLEXPORT wxStatusBar
;
27 class WXDLLEXPORT wxFrame
: public wxWindow
29 DECLARE_DYNAMIC_CLASS(wxFrame
)
33 inline 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
42 Create(parent
, id
, title
, pos
, size
, style
, name
);
47 bool Create( wxWindow
* parent
49 ,const wxString
& title
50 ,const wxPoint
& pos
= wxDefaultPosition
51 ,const wxSize
& size
= wxDefaultSize
52 ,long style
= wxDEFAULT_FRAME_STYLE
53 ,const wxString
& name
= wxFrameNameStr
56 virtual bool Destroy();
58 void OnSize(wxSizeEvent
& event
);
59 void OnMenuHighlight(wxMenuEvent
& event
);
60 void OnActivate(wxActivateEvent
& event
);
61 void OnIdle(wxIdleEvent
& event
);
62 void OnCloseWindow(wxCloseEvent
& event
);
68 void SetMenuBar(wxMenuBar
*menu_bar
);
69 virtual wxMenuBar
*GetMenuBar() const ;
71 // Call this to simulate a menu command
72 inline bool Command(int id
) { return ProcessCommand(id
); }
74 // process menu command: returns TRUE if processed
75 bool ProcessCommand(int id
);
77 // make the window modal (all other windows unresponsive)
78 virtual void MakeModal(bool modal
= TRUE
);
81 virtual void SetIcon(const wxIcon
& icon
);
85 virtual wxToolBar
* CreateToolBar(long style
= wxNO_BORDER
| wxTB_HORIZONTAL
| wxTB_FLAT
,
87 const wxString
& name
= wxToolBarNameStr
);
89 virtual wxToolBar
*OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
);
91 virtual void SetToolBar(wxToolBar
*toolbar
) { m_frameToolBar
= toolbar
; }
92 virtual wxToolBar
*GetToolBar() const { return m_frameToolBar
; }
94 virtual void PositionToolBar();
95 #endif // wxUSE_TOOLBAR
99 virtual wxStatusBar
* CreateStatusBar(int number
= 1,
100 long style
= wxST_SIZEGRIP
,
102 const wxString
& name
= wxStatusLineNameStr
);
104 wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
105 void SetStatusBar(wxStatusBar
*statusBar
) { m_frameStatusBar
= statusBar
; }
107 virtual void PositionStatusBar();
108 virtual wxStatusBar
*OnCreateStatusBar(int number
,
111 const wxString
& name
);
113 // Set status line text
114 virtual void SetStatusText(const wxString
& text
, int number
= 0);
116 // Set status line widths
117 virtual void SetStatusWidths(int n
, const int widths_field
[]);
119 // Hint to tell framework which status bar to use
120 // TODO: should this go into a wxFrameworkSettings class perhaps?
121 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
122 static bool UsesNativeStatusBar() { return m_useNativeStatusBar
; };
123 #endif // wxUSE_STATUSBAR
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 OS2Create(int id
, wxWindow
*parent
, const wxChar
*wclass
,
160 wxWindow
*wx_win
, const wxChar
*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 DoSetClientSize(int width
, int height
);
177 virtual void DoClientToScreen(int *x
, int *y
) const;
178 virtual void DoScreenToClient(int *x
, int *y
) const;
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 OS2TranslateMessage(WXMSG
* pMsg
);
190 // window proc for the frames
191 MRESULT
OS2WindowProc(HWND hwnd
, WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
193 wxMenuBar
* m_frameMenuBar
;
196 WXHICON m_defaultIcon
;
199 wxStatusBar
* m_frameStatusBar
;
201 static bool m_useNativeStatusBar
;
202 #endif // wxUSE_STATUSBAR
205 wxToolBar
* m_frameToolBar
;
206 #endif // wxUSE_TOOLBAR
210 WXHWND m_hwndToolTip
;
213 DECLARE_EVENT_TABLE()