]> git.saurik.com Git - wxWidgets.git/blob - include/wx/qt/frame.h
fixed #if !NOPCH to be #if !defined(NOPCH)
[wxWidgets.git] / include / wx / qt / 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
23 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
24 WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
25
26 class WXDLLEXPORT wxMenuBar;
27 class WXDLLEXPORT wxStatusBar;
28
29 class WXDLLEXPORT wxFrame: public wxWindow {
30
31 DECLARE_DYNAMIC_CLASS(wxFrame)
32
33 public:
34 wxFrame();
35 inline wxFrame(wxWindow *parent,
36 wxWindowID id,
37 const wxString& title,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = wxDEFAULT_FRAME_STYLE,
41 const wxString& name = wxFrameNameStr)
42 {
43 Create(parent, id, title, pos, size, style, name);
44 }
45
46 ~wxFrame();
47
48 bool Create(wxWindow *parent,
49 wxWindowID id,
50 const wxString& title,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxDEFAULT_FRAME_STYLE,
54 const wxString& name = wxFrameNameStr);
55
56 virtual bool Destroy();
57 void SetClientSize(int width, int height);
58 void GetClientSize(int *width, int *height) const;
59
60 void GetSize(int *width, int *height) const ;
61 void GetPosition(int *x, int *y) const ;
62 void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
63
64 void OnSize(wxSizeEvent& event);
65 void OnMenuHighlight(wxMenuEvent& event);
66 void OnActivate(wxActivateEvent& event);
67 void OnIdle(wxIdleEvent& event);
68 void OnCloseWindow(wxCloseEvent& event);
69
70 bool Show(bool show);
71
72 // Set menu bar
73 void SetMenuBar(wxMenuBar *menu_bar);
74 virtual wxMenuBar *GetMenuBar() const ;
75
76 // Set title
77 void SetTitle(const wxString& title);
78 wxString GetTitle() const ;
79
80 void Centre(int direction = wxBOTH);
81
82 // Call this to simulate a menu command
83 virtual void Command(int id);
84 virtual void ProcessCommand(int id);
85
86 // Set icon
87 virtual void SetIcon(const wxIcon& icon);
88
89 // Create status line
90 virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
91 const wxString& name = "statusBar");
92 inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
93 virtual void PositionStatusBar();
94 virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
95 const wxString& name);
96
97 // Create toolbar
98 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
99 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
100 // If made known to the frame, the frame will manage it automatically.
101 virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
102 virtual inline wxToolBar *GetToolBar() const { return m_frameToolBar; }
103 virtual void PositionToolBar();
104
105 // Set status line text
106 virtual void SetStatusText(const wxString& text, int number = 0);
107
108 // Set status line widths
109 virtual void SetStatusWidths(int n, const int widths_field[]);
110
111 // Hint to tell framework which status bar to use
112 // TODO: should this go into a wxFrameworkSettings class perhaps?
113 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
114 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
115
116 // Fit frame around subwindows
117 virtual void Fit();
118
119 // Iconize
120 virtual void Iconize(bool iconize);
121
122 virtual bool IsIconized() const ;
123
124 // Compatibility
125 inline bool Iconized() const { return IsIconized(); }
126
127 virtual void Maximize(bool maximize);
128
129 virtual void SetAcceleratorTable(const wxAcceleratorTable& accel);
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();
136 void DoMenuUpdates(wxMenu* menu);
137
138 // Checks if there is a toolbar, and returns the first free client position
139 virtual wxPoint GetClientAreaOrigin() const;
140
141 protected:
142 wxMenuBar * m_frameMenuBar;
143 wxStatusBar * m_frameStatusBar;
144 wxIcon m_icon;
145 bool m_iconized;
146 static bool m_useNativeStatusBar;
147 wxToolBar * m_frameToolBar ;
148 wxAcceleratorTable m_acceleratorTable;
149
150 DECLARE_EVENT_TABLE()
151 };
152
153 #endif
154 // _WX_FRAME_H_