]>
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 /////////////////////////////////////////////////////////////////////////////
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 virtual void ClientToScreen(int *x
, int *y
) const;
59 virtual void ScreenToClient(int *x
, int *y
) const;
61 void OnSize(wxSizeEvent
& event
);
62 void OnMenuHighlight(wxMenuEvent
& event
);
63 void OnActivate(wxActivateEvent
& event
);
64 void OnIdle(wxIdleEvent
& event
);
65 void OnCloseWindow(wxCloseEvent
& event
);
71 void SetMenuBar(wxMenuBar
*menu_bar
);
72 virtual wxMenuBar
*GetMenuBar() const ;
74 // Call this to simulate a menu command
75 inline bool Command(int id
) { return ProcessCommand(id
); }
77 // process menu command: returns TRUE if processed
78 bool ProcessCommand(int id
);
80 // make the window modal (all other windows unresponsive)
81 virtual void MakeModal(bool modal
= TRUE
);
84 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();
98 #endif // wxUSE_TOOLBAR
102 virtual wxStatusBar
* CreateStatusBar(int number
= 1,
103 long style
= wxST_SIZEGRIP
,
105 const wxString
& name
= wxStatusLineNameStr
);
107 wxStatusBar
*GetStatusBar() const { return m_frameStatusBar
; }
108 void SetStatusBar(wxStatusBar
*statusBar
) { m_frameStatusBar
= statusBar
; }
110 virtual void PositionStatusBar();
111 virtual wxStatusBar
*OnCreateStatusBar(int number
,
114 const wxString
& name
);
116 // Set status line text
117 virtual void SetStatusText(const wxString
& text
, int number
= 0);
119 // Set status line widths
120 virtual void SetStatusWidths(int n
, const int widths_field
[]);
122 // Hint to tell framework which status bar to use
123 // TODO: should this go into a wxFrameworkSettings class perhaps?
124 static void UseNativeStatusBar(bool useNative
) { m_useNativeStatusBar
= useNative
; };
125 static bool UsesNativeStatusBar() { return m_useNativeStatusBar
; };
126 #endif // wxUSE_STATUSBAR
129 virtual void Iconize(bool iconize
);
131 virtual bool IsIconized() const;
134 virtual bool IsMaximized() const;
137 bool Iconized() const { return IsIconized(); }
139 virtual void Maximize(bool maximize
);
140 // virtual bool LoadAccelerators(const wxString& table);
142 // Responds to colour changes
143 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
145 // Query app for menu item updates (called from OnIdle)
146 void DoMenuUpdates();
147 void DoMenuUpdates(wxMenu
* menu
, wxWindow
* focusWin
);
149 WXHMENU
GetWinMenu() const { return m_hMenu
; }
151 // Returns the origin of client area (may be different from (0,0) if the
152 // frame has a toolbar)
153 virtual wxPoint
GetClientAreaOrigin() const;
155 // Implementation only from here
158 bool HandleSize(int x
, int y
, WXUINT flag
);
159 bool HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
160 bool HandleMenuSelect(WXWORD nItem
, WXWORD nFlags
, WXHMENU hMenu
);
162 bool OS2Create(int id
, wxWindow
*parent
, const wxChar
*wclass
,
163 wxWindow
*wx_win
, const wxChar
*title
,
164 int x
, int y
, int width
, int height
, long style
);
166 // tooltip management
168 WXHWND
GetToolTipCtrl() const { return m_hwndToolTip
; }
169 void SetToolTipCtrl(WXHWND hwndTT
) { m_hwndToolTip
= hwndTT
; }
173 // override base class virtuals
174 virtual void DoGetClientSize(int *width
, int *height
) const;
175 virtual void DoGetSize(int *width
, int *height
) const;
176 virtual void DoGetPosition(int *x
, int *y
) const;
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 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()