]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/window.h
Added missing declaration of wxIcon::operator =(const wxIcon &)
[wxWidgets.git] / include / wx / gtk / window.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: window.h
3// Purpose:
4// Author: Robert Roebling
5// Created: 01/02/97
6// Id:
7// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
aed8df38 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
11
12#ifndef __GTKWINDOWH__
13#define __GTKWINDOWH__
14
15#ifdef __GNUG__
16#pragma interface
17#endif
18
19#include "wx/defs.h"
20#include "wx/object.h"
21#include "wx/list.h"
22#include "wx/event.h"
23#include "wx/validate.h"
24#include "wx/cursor.h"
25#include "wx/font.h"
26#include "wx/dc.h"
27#include "wx/region.h"
28#include "wx/dnd.h"
29
30//-----------------------------------------------------------------------------
31// global data
32//-----------------------------------------------------------------------------
33
34extern const char *wxFrameNameStr;
35extern wxList wxTopLevelWindows;
36
37//-----------------------------------------------------------------------------
38// classes
39//-----------------------------------------------------------------------------
40
41class wxLayoutConstraints;
42class wxSizer;
6de97a3b
RR
43class wxResourceTable;
44class wxItemResource;
c801d85f
KB
45
46class wxWindow;
47class wxCanvas;
48
49//-----------------------------------------------------------------------------
50// global data
51//-----------------------------------------------------------------------------
52
53extern const char *wxPanelNameStr;
54extern const wxSize wxDefaultSize;
55extern const wxPoint wxDefaultPosition;
56
57//-----------------------------------------------------------------------------
58// wxWindow
59//-----------------------------------------------------------------------------
60
61class wxWindow: public wxEvtHandler
62{
aed8df38
VZ
63public:
64 wxWindow();
6de97a3b
RR
65 inline wxWindow(wxWindow *parent, wxWindowID id,
66 const wxPoint& pos = wxDefaultPosition,
67 const wxSize& size = wxDefaultSize,
68 long style = 0,
69 const wxString& name = wxPanelNameStr)
70 {
71 Create(parent, id, pos, size, style, name);
72 }
73 bool Create(wxWindow *parent, wxWindowID id,
74 const wxPoint& pos = wxDefaultPosition,
75 const wxSize& size = wxDefaultSize,
76 long style = 0,
77 const wxString& name = wxPanelNameStr);
aed8df38 78 virtual ~wxWindow();
cd0183ca 79
6de97a3b
RR
80 virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL);
81 virtual wxControl *CreateItem(const wxItemResource *childResource, const wxResourceTable *table = NULL);
cd0183ca 82
aed8df38
VZ
83 bool Close( bool force = FALSE );
84 virtual bool Destroy();
85 virtual bool DestroyChildren();
86
87 virtual void PrepareDC( wxDC &dc );
88
89 virtual void SetSize( int x, int y, int width, int height,
90 int sizeFlags = wxSIZE_AUTO );
91 virtual void SetSize( int width, int height );
92 virtual void Move( int x, int y );
93 virtual void GetSize( int *width, int *height ) const;
94 virtual void SetClientSize( int const width, int const height );
95 virtual void GetClientSize( int *width, int *height ) const;
96 virtual void GetPosition( int *x, int *y ) const;
97 virtual void Centre( int direction = wxHORIZONTAL );
cd0183ca 98 inline void Center(int direction = wxHORIZONTAL) { Centre(direction); }
aed8df38 99 virtual void Fit();
c33c4050 100 // set minimal/maxmimal size for the frame
cd0183ca
RD
101 virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW),
102 int WXUNUSED(maxH), int WXUNUSED(incW), int WXUNUSED(incH) ) { }
aed8df38
VZ
103
104 void OnSize( wxSizeEvent &event );
105 void OnIdle( wxIdleEvent& event );
106
107 virtual bool Show( bool show );
108 virtual void Enable( bool enable );
109 virtual void MakeModal( bool modal );
903f689b
RR
110 virtual bool IsEnabled() const { return m_isEnabled; }
111 inline bool Enabled(void) const { return IsEnabled(); }
aed8df38
VZ
112 virtual void SetFocus();
113 virtual bool OnClose();
114
115 virtual void AddChild( wxWindow *child );
116 wxList *GetChildren();
117 virtual void RemoveChild( wxWindow *child );
118 void SetReturnCode( int retCode );
119 int GetReturnCode();
cd0183ca 120 wxWindow *GetParent() const
c33c4050
RR
121 { return m_parent; }
122 wxWindow *GetGrandParent(void) const
123 { return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); }
cd0183ca 124 void SetParent( wxWindow *p )
c33c4050 125 { m_parent = p; }
aed8df38
VZ
126
127 wxEvtHandler *GetEventHandler();
86b29a61
RR
128 void SetEventHandler( wxEvtHandler *handler );
129 void PushEventHandler( wxEvtHandler *handler );
130 wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
aed8df38
VZ
131
132 virtual wxValidator *GetValidator();
6de97a3b 133 virtual void SetValidator( const wxValidator &validator );
aed8df38
VZ
134
135 bool IsBeingDeleted();
136
137 void SetId( wxWindowID id );
138 wxWindowID GetId();
139
140 void SetCursor( const wxCursor &cursor );
141
142 virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = NULL );
143 virtual void Clear();
144 virtual bool IsExposed( long x, long y );
145 virtual bool IsExposed( long x, long y, long width, long height );
146
147 virtual wxColour GetBackgroundColour() const;
148 virtual void SetBackgroundColour( const wxColour &colour );
6de97a3b
RR
149 virtual wxColour GetForegroundColour() const;
150 virtual void SetForegroundColour( const wxColour &colour );
cd0183ca 151
c33c4050
RR
152 virtual int GetCharHeight(void) const;
153 virtual int GetCharWidth(void) const;
154 virtual void GetTextExtent( const wxString& string, int *x, int *y,
155 int *descent = NULL,
156 int *externalLeading = NULL,
157 const wxFont *theFont = NULL, bool use16 = FALSE) const;
aed8df38
VZ
158
159 virtual void SetDefaultBackgroundColour( const wxColour& col )
c33c4050 160 { m_defaultBackgroundColour = col; }
aed8df38 161 virtual wxColour GetDefaultBackgroundColour() const
c33c4050 162 { return m_defaultBackgroundColour; }
aed8df38 163 virtual void SetDefaultForegroundColour( const wxColour& col )
c33c4050 164 { m_defaultForegroundColour = col; }
aed8df38 165 virtual wxColour GetDefaultForegroundColour() const
c33c4050 166 { return m_defaultForegroundColour; }
aed8df38
VZ
167
168 virtual void SetFont( const wxFont &font );
169 virtual wxFont *GetFont();
170 // For backward compatibility
171 inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
172 inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
173 inline virtual wxFont *GetLabelFont() { return GetFont(); };
174 inline virtual wxFont *GetButtonFont() { return GetFont(); };
175 virtual void SetWindowStyleFlag( long flag );
176 virtual long GetWindowStyleFlag() const;
177 virtual void CaptureMouse();
178 virtual void ReleaseMouse();
179 virtual void SetTitle( const wxString &title );
180 virtual wxString GetTitle() const;
181 virtual void SetName( const wxString &name );
182 virtual wxString GetName() const;
183 virtual wxString GetLabel() const;
c801d85f 184
aed8df38
VZ
185 void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) {};
186
187 virtual bool IsShown() const;
e149aaeb 188
362c6693
RR
189 virtual void Raise(void);
190 virtual void Lower(void);
e149aaeb 191
aed8df38
VZ
192 virtual bool IsRetained();
193 virtual wxWindow *FindWindow( long id );
194 virtual wxWindow *FindWindow( const wxString& name );
195 void AllowDoubleClick( bool WXUNUSED(allow) ) {};
196 void SetDoubleClick( bool WXUNUSED(allow) ) {};
197 virtual void ClientToScreen( int *x, int *y );
198 virtual void ScreenToClient( int *x, int *y );
199
200 virtual bool Validate();
201 virtual bool TransferDataToWindow();
202 virtual bool TransferDataFromWindow();
203 void OnInitDialog( wxInitDialogEvent &event );
204 virtual void InitDialog();
cd0183ca 205
30dea054 206 virtual bool PopupMenu( wxMenu *menu, int x, int y );
aed8df38
VZ
207
208 virtual void SetDropTarget( wxDropTarget *dropTarget );
209 virtual wxDropTarget *GetDropTarget() const;
cd0183ca 210
903f689b 211//private:
30dea054 212 virtual GtkWidget* GetConnectWidget(void);
903f689b 213 virtual bool IsOwnGtkWindow( GdkWindow *window );
cd0183ca 214
e3e65dac 215public:
aed8df38
VZ
216 virtual void SetScrollbar( int orient, int pos, int thumbVisible,
217 int range, bool refresh = TRUE );
218 virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
219 virtual int GetScrollPos( int orient ) const;
220 virtual int GetScrollThumb( int orient ) const;
221 virtual int GetScrollRange( int orient ) const;
222 virtual void ScrollWindow( int dx, int dy, const wxRect* rect = NULL );
223
224 // return FALSE from here if the window doesn't want the focus
225 virtual bool AcceptsFocus() const;
226
227 // update the UI state (called from OnIdle)
228 void UpdateWindowUI();
229
cd0183ca 230
aed8df38
VZ
231public: // cannot get private going yet
232
233 void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
234 const wxSize &size, long style, const wxString &name );
235 void PostCreation();
236 bool HasVMT();
237 virtual void ImplementSetSize();
238 virtual void ImplementSetPosition();
aed8df38
VZ
239
240 wxWindow *m_parent;
241 wxList m_children;
242 int m_x,m_y;
243 int m_width,m_height;
244 int m_retCode;
245 wxEvtHandler *m_eventHandler;
246 wxValidator *m_windowValidator;
247 wxDropTarget *m_pDropTarget;
248 wxWindowID m_windowId;
249 wxCursor *m_cursor;
250 wxFont m_font;
251 wxColour m_backgroundColour;
252 wxColour m_defaultBackgroundColour;
253 wxColour m_foregroundColour ;
254 wxColour m_defaultForegroundColour;
255 wxRegion m_updateRegion;
256 long m_windowStyle;
257 bool m_isShown;
258 bool m_isEnabled;
259 wxString m_windowName;
aed8df38
VZ
260
261 GtkWidget *m_widget;
262 GtkWidget *m_wxwindow;
263 GtkAdjustment *m_hAdjust,*m_vAdjust;
264 float m_oldHorizontalPos;
265 float m_oldVerticalPos;
266 bool m_needParent;
267 bool m_hasScrolling;
268 bool m_hasVMT;
269 bool m_sizeSet;
270 bool m_resizing;
271
272public: // Layout section
273
274 wxLayoutConstraints * m_constraints;
275 wxList * m_constraintsInvolvedIn;
276 wxSizer * m_windowSizer;
277 wxWindow * m_sizerParent;
278 bool m_autoLayout;
279
280 wxLayoutConstraints *GetConstraints() const;
281 void SetConstraints( wxLayoutConstraints *constraints );
282 void SetAutoLayout( bool autoLayout );
283 bool GetAutoLayout() const;
284 bool Layout();
285 void SetSizer( wxSizer *sizer );
286 wxSizer *GetSizer() const;
287 void SetSizerParent( wxWindow *win );
288 wxWindow *GetSizerParent() const;
289 void UnsetConstraints(wxLayoutConstraints *c);
290 inline wxList *GetConstraintsInvolvedIn() const ;
291 void AddConstraintReference(wxWindow *otherWin);
292 void RemoveConstraintReference(wxWindow *otherWin);
293 void DeleteRelatedConstraints();
294 virtual void ResetConstraints();
295 virtual void SetConstraintSizes(bool recurse = TRUE);
296 virtual bool LayoutPhase1(int *noChanges);
297 virtual bool LayoutPhase2(int *noChanges);
298 virtual bool DoPhase(int);
299 virtual void TransformSizerToActual(int *x, int *y) const ;
300 virtual void SizerSetSize(int x, int y, int w, int h);
301 virtual void SizerMove(int x, int y);
302 virtual void SetSizeConstraint(int x, int y, int w, int h);
303 virtual void MoveConstraint(int x, int y);
304 virtual void GetSizeConstraint(int *w, int *h) const ;
305 virtual void GetClientSizeConstraint(int *w, int *h) const ;
306 virtual void GetPositionConstraint(int *x, int *y) const ;
307
308 DECLARE_DYNAMIC_CLASS(wxWindow)
c801d85f
KB
309 DECLARE_EVENT_TABLE()
310};
311
312#endif // __GTKWINDOWH__