]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/frame.h
checks for time functions added
[wxWidgets.git] / include / wx / os2 / frame.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: frame.h
3// Purpose: wxFrame class
21802234 4// Author: David Webster
0e320a79 5// Modified by:
21802234 6// Created: 10/06/99
0e320a79 7// RCS-ID: $Id$
21802234
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_FRAME_H_
13#define _WX_FRAME_H_
14
0e320a79
DW
15#include "wx/window.h"
16#include "wx/toolbar.h"
21802234 17#include "wx/os2/accel.h"
0e320a79
DW
18#include "wx/icon.h"
19
21802234
DW
20WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
21WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
22WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
0e320a79
DW
23
24class WXDLLEXPORT wxMenuBar;
25class WXDLLEXPORT wxStatusBar;
26
004fd0c8
DW
27class WXDLLEXPORT wxFrame: public wxWindow
28{
54da4255 29 DECLARE_DYNAMIC_CLASS(wxFrame)
0e320a79 30
54da4255 31public:
21802234
DW
32 wxFrame();
33 inline wxFrame( wxWindow* parent
34 ,wxWindowID id
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
40 )
41 {
42 Create(parent, id, title, pos, size, style, name);
43 }
0e320a79 44
21802234
DW
45 ~wxFrame();
46
47 bool Create( wxWindow* parent
48 ,wxWindowID id
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
54 );
55
56 virtual bool Destroy();
57
21802234
DW
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);
63
64 bool Show(bool show);
65
66 void DetachMenuBar();
21802234
DW
67 // Set menu bar
68 void SetMenuBar(wxMenuBar *menu_bar);
69 virtual wxMenuBar *GetMenuBar() const ;
70
71 // Call this to simulate a menu command
72 inline bool Command(int id) { return ProcessCommand(id); }
73
74 // process menu command: returns TRUE if processed
75 bool ProcessCommand(int id);
76
77 // make the window modal (all other windows unresponsive)
78 virtual void MakeModal(bool modal = TRUE);
79
80 // Set icon
81 virtual void SetIcon(const wxIcon& icon);
82
83 // Toolbar
84#if wxUSE_TOOLBAR
85 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
86 wxWindowID id = -1,
87 const wxString& name = wxToolBarNameStr);
88
89 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
90
91 virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
92 virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
93
94 virtual void PositionToolBar();
95#endif // wxUSE_TOOLBAR
96
97#if wxUSE_STATUSBAR
98 // Status bar
99 virtual wxStatusBar* CreateStatusBar(int number = 1,
100 long style = wxST_SIZEGRIP,
101 wxWindowID id = 0,
102 const wxString& name = wxStatusLineNameStr);
103
104 wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
105 void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
106
107 virtual void PositionStatusBar();
108 virtual wxStatusBar *OnCreateStatusBar(int number,
109 long style,
110 wxWindowID id,
111 const wxString& name);
112
113 // Set status line text
114 virtual void SetStatusText(const wxString& text, int number = 0);
115
116 // Set status line widths
117 virtual void SetStatusWidths(int n, const int widths_field[]);
118
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
124
125 // Iconize
126 virtual void Iconize(bool iconize);
127
128 virtual bool IsIconized() const;
129
130 // Is it maximized?
131 virtual bool IsMaximized() const;
132
133 // Compatibility
134 bool Iconized() const { return IsIconized(); }
135
136 virtual void Maximize(bool maximize);
137 // virtual bool LoadAccelerators(const wxString& table);
138
139 // Responds to colour changes
140 void OnSysColourChanged(wxSysColourChangedEvent& event);
141
142 // Query app for menu item updates (called from OnIdle)
143 void DoMenuUpdates();
144 void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
145
146 WXHMENU GetWinMenu() const { return m_hMenu; }
147
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;
151
152 // Implementation only from here
153 // event handlers
154 bool HandlePaint();
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);
158
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);
162
163 // tooltip management
164#if wxUSE_TOOLTIPS
165 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
166 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
167#endif // tooltips
0e320a79
DW
168
169protected:
21802234
DW
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;
174
175 virtual void DoSetClientSize(int width, int height);
176
e6ebb514
DW
177 virtual void DoClientToScreen(int *x, int *y) const;
178 virtual void DoScreenToClient(int *x, int *y) const;
179
21802234
DW
180 // a plug in for MDI frame classes which need to do something special when
181 // the menubar is set
182 virtual void InternalSetMenuBar();
183
184 // propagate our state change to all child frames
185 void IconizeChildFrames(bool bIconize);
186
187 // we add menu bar accel processing
188 bool OS2TranslateMessage(WXMSG* pMsg);
189
190 // window proc for the frames
191 MRESULT OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
192
193 wxMenuBar * m_frameMenuBar;
194 wxIcon m_icon;
195 bool m_iconized;
196 WXHICON m_defaultIcon;
197
198#if wxUSE_STATUSBAR
199 wxStatusBar * m_frameStatusBar;
200
201 static bool m_useNativeStatusBar;
202#endif // wxUSE_STATUSBAR
203
204#if wxUSE_TOOLBAR
205 wxToolBar * m_frameToolBar;
206#endif // wxUSE_TOOLBAR
207
208private:
209#if wxUSE_TOOLTIPS
210 WXHWND m_hwndToolTip;
211#endif // tooltips
212
213 DECLARE_EVENT_TABLE()
0e320a79
DW
214};
215
216#endif
217 // _WX_FRAME_H_
21802234 218