]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/frame.h
wxOS2 updates for 10/5/99
[wxWidgets.git] / include / wx / os2 / frame.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: frame.h
3 // Purpose: wxFrame class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FRAME_H_
13 #define _WX_FRAME_H_
14
15 #ifdef __GNUG__
16 #pragma interface "frame.h"
17 #endif
18
19 #include "wx/window.h"
20 #include "wx/toolbar.h"
21 #include "wx/accel.h"
22 #include "wx/icon.h"
23
24 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
25 WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
26
27 class WXDLLEXPORT wxMenuBar;
28 class WXDLLEXPORT wxStatusBar;
29
30 class WXDLLEXPORT wxFrame: public wxWindow {
31
32 DECLARE_DYNAMIC_CLASS(wxFrame)
33
34 public:
35 wxFrame();
36 inline wxFrame(wxWindow *parent,
37 wxWindowID id,
38 const wxString& title,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = wxDEFAULT_FRAME_STYLE,
42 const wxString& name = wxFrameNameStr)
43 {
44 Create(parent, id, title, pos, size, style, name);
45 }
46
47 ~wxFrame();
48
49 bool Create(wxWindow *parent,
50 wxWindowID id,
51 const wxString& title,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 long style = wxDEFAULT_FRAME_STYLE,
55 const wxString& name = wxFrameNameStr);
56
57 virtual bool Destroy();
58 void SetClientSize(int width, int height);
59 void GetClientSize(int *width, int *height) const;
60
61 void GetSize(int *width, int *height) const ;
62 void GetPosition(int *x, int *y) const ;
63 void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
64 void ClientToScreen(int *x, int *y) const;
65 void ScreenToClient(int *x, int *y) const;
66
67 void OnSize(wxSizeEvent& event);
68 void OnMenuHighlight(wxMenuEvent& event);
69 void OnActivate(wxActivateEvent& event);
70 void OnIdle(wxIdleEvent& event);
71 void OnCloseWindow(wxCloseEvent& event);
72
73 bool Show(bool show);
74
75 // Set menu bar
76 void SetMenuBar(wxMenuBar *menu_bar);
77 virtual wxMenuBar *GetMenuBar() const ;
78
79 // Set title
80 void SetTitle(const wxString& title);
81 wxString GetTitle() const ;
82
83 void Centre(int direction = wxBOTH);
84
85 // Call this to simulate a menu command
86 virtual void Command(int id);
87 virtual void ProcessCommand(int id);
88
89 // Set icon
90 virtual void SetIcon(const wxIcon& icon);
91
92 // Create status line
93 virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
94 const wxString& name = "statusBar");
95 inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
96 virtual void PositionStatusBar();
97 virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
98 const wxString& name);
99
100 // Create toolbar
101 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
102 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
103 // If made known to the frame, the frame will manage it automatically.
104 virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
105 virtual inline wxToolBar *GetToolBar() const { return m_frameToolBar; }
106 virtual void PositionToolBar();
107
108 // Set status line text
109 virtual void SetStatusText(const wxString& text, int number = 0);
110
111 // Set status line widths
112 virtual void SetStatusWidths(int n, const int widths_field[]);
113
114 // Hint to tell framework which status bar to use
115 // TODO: should this go into a wxFrameworkSettings class perhaps?
116 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
117 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
118
119 // Fit frame around subwindows
120 virtual void Fit();
121
122 // Iconize
123 virtual void Iconize(bool iconize);
124
125 virtual bool IsIconized() const ;
126
127 // Compatibility
128 inline bool Iconized() const { return IsIconized(); }
129
130 // Is the frame maximized?
131 virtual bool IsMaximized(void) const ;
132
133 virtual void Maximize(bool maximize);
134
135 // Responds to colour changes
136 void OnSysColourChanged(wxSysColourChangedEvent& event);
137
138 // Query app for menu item updates (called from OnIdle)
139 void DoMenuUpdates();
140 void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
141
142 // Checks if there is a toolbar, and returns the first free client position
143 virtual wxPoint GetClientAreaOrigin() const;
144
145 protected:
146 wxMenuBar * m_frameMenuBar;
147 wxStatusBar * m_frameStatusBar;
148 wxIcon m_icon;
149 bool m_iconized;
150 static bool m_useNativeStatusBar;
151 wxToolBar * m_frameToolBar ;
152
153 DECLARE_EVENT_TABLE()
154 };
155
156 #endif
157 // _WX_FRAME_H_