]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/frame.h
* Fixed Async -> sync in wxExecute
[wxWidgets.git] / include / wx / msw / frame.h
CommitLineData
2bda0e17
KB
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
21WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
22
23class WXDLLEXPORT wxMenuBar;
24class WXDLLEXPORT wxStatusBar;
25
26class WXDLLEXPORT wxFrame: public wxWindow {
27
28 DECLARE_DYNAMIC_CLASS(wxFrame)
29
30public:
31 wxFrame(void);
32 inline wxFrame(wxWindow *parent,
33 const wxWindowID id,
34 const wxString& title,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 const long style = wxDEFAULT_FRAME_STYLE,
38 const wxString& name = wxFrameNameStr)
39 {
40 Create(parent, id, title, pos, size, style, name);
41 }
42
43 ~wxFrame(void);
44
45 bool Create(wxWindow *parent,
46 const wxWindowID id,
47 const wxString& title,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 const long style = wxDEFAULT_FRAME_STYLE,
51 const wxString& name = wxFrameNameStr);
52
53#if WXWIN_COMPATIBILITY
54 // The default thing is to set the focus for the first child window.
55 // Override for your own behaviour.
56 virtual void OldOnActivate(bool flag);
57
58 // Default behaviour is to display a help string for the menu item.
59 virtual void OldOnMenuSelect(int id);
60
61 inline virtual void OldOnMenuCommand(int WXUNUSED(id)) {}; // Called on frame menu command
62 void OldOnSize(int x, int y);
63#endif
64
65 virtual bool Destroy(void);
66 void SetClientSize(const int width, const int height);
67 void GetClientSize(int *width, int *height) const;
68
69 void GetSize(int *width, int *height) const ;
70 void GetPosition(int *x, int *y) const ;
71 void SetSize(const int x, const int y, const int width, const int height, const int sizeFlags = wxSIZE_AUTO);
72
73 void OnSize(wxSizeEvent& event);
74 void OnMenuHighlight(wxMenuEvent& event);
75 void OnActivate(wxActivateEvent& event);
76 void OnIdle(wxIdleEvent& event);
77 void OnCloseWindow(wxCloseEvent& event);
78
79 bool Show(const bool show);
80
81 // Set menu bar
82 void SetMenuBar(wxMenuBar *menu_bar);
83 virtual wxMenuBar *GetMenuBar(void) const ;
84
85 // Set title
86 void SetTitle(const wxString& title);
87 wxString GetTitle(void) const ;
88
89 void Centre(const int direction = wxBOTH);
90
91 // Call this to simulate a menu command
92 virtual void Command(int id);
93 virtual void ProcessCommand(int id);
94
95 // Set icon
96 virtual void SetIcon(const wxIcon& icon);
97
98 // Create status line
99 virtual bool CreateStatusBar(const int number=1);
100 inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
101
102 // Set status line text
103 virtual void SetStatusText(const wxString& text, const int number = 0);
104
105 // Set status line widths
106 virtual void SetStatusWidths(const int n, const int *widths_field);
107
108 // Hint to tell framework which status bar to use
109 // TODO: should this go into a wxFrameworkSettings class perhaps?
110 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
111 static bool UsesNativeStatusBar(void) { return m_useNativeStatusBar; };
112
113 // Fit frame around subwindows
114 virtual void Fit(void);
115
116 // Iconize
117 virtual void Iconize(const bool iconize);
118
119 virtual bool IsIconized(void) const ;
120
121 // Compatibility
122 inline bool Iconized(void) const { return IsIconized(); }
123
124 virtual void Maximize(const bool maximize);
125 virtual bool LoadAccelerators(const wxString& table);
126
127 virtual void PositionStatusBar(void);
128 virtual wxStatusBar *OnCreateStatusBar(const int number);
129
130 // Query app for menu item updates (called from OnIdle)
131 void DoMenuUpdates(void);
132 void DoMenuUpdates(wxMenu* menu);
133
134 WXHMENU GetWinMenu(void) const ;
135
136 // Responds to colour changes
137 void OnSysColourChanged(wxSysColourChangedEvent& event);
138
139 // Handlers
140 bool MSWOnPaint(void);
141 WXHICON MSWOnQueryDragIcon(void);
142 void MSWOnSize(const int x, const int y, const WXUINT flag);
143 bool MSWOnCommand(const WXWORD id, const WXWORD cmd, const WXHWND control);
144 bool MSWOnClose(void);
145 void MSWOnMenuHighlight(const WXWORD item, const WXWORD flags, const WXHMENU sysmenu);
146 bool MSWProcessMessage(WXMSG *msg);
147 void MSWCreate(const int id, wxWindow *parent, const char *WXUNUSED(wclass), wxWindow *wx_win, const char *title,
148 const int x, const int y, const int width, const int height, const long style);
149
150protected:
151 wxMenuBar * m_frameMenuBar;
152 wxStatusBar * m_frameStatusBar;
153 wxIcon m_icon;
154 bool m_iconized;
155 WXHICON m_defaultIcon;
156 static bool m_useNativeStatusBar;
157
158 DECLARE_EVENT_TABLE()
159};
160
161#endif
162 // __FRAMEH__