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