]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/window.h
had to modify it (added one pixel...) to be able to commit: the file in the
[wxWidgets.git] / include / wx / gtk1 / 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;
43
44class wxWindow;
45class wxCanvas;
46
47//-----------------------------------------------------------------------------
48// global data
49//-----------------------------------------------------------------------------
50
51extern const char *wxPanelNameStr;
52extern const wxSize wxDefaultSize;
53extern const wxPoint wxDefaultPosition;
54
55//-----------------------------------------------------------------------------
56// wxWindow
57//-----------------------------------------------------------------------------
58
59class wxWindow: public wxEvtHandler
60{
aed8df38
VZ
61public:
62 wxWindow();
63 wxWindow( wxWindow *parent, wxWindowID id,
64 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
65 long style = 0, const wxString &name = wxPanelNameStr );
66 bool Create( wxWindow *parent, wxWindowID id,
67 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
68 long style = 0, const wxString &name = wxPanelNameStr );
69 virtual ~wxWindow();
70 bool Close( bool force = FALSE );
71 virtual bool Destroy();
72 virtual bool DestroyChildren();
73
74 virtual void PrepareDC( wxDC &dc );
75
76 virtual void SetSize( int x, int y, int width, int height,
77 int sizeFlags = wxSIZE_AUTO );
78 virtual void SetSize( int width, int height );
79 virtual void Move( int x, int y );
80 virtual void GetSize( int *width, int *height ) const;
81 virtual void SetClientSize( int const width, int const height );
82 virtual void GetClientSize( int *width, int *height ) const;
83 virtual void GetPosition( int *x, int *y ) const;
84 virtual void Centre( int direction = wxHORIZONTAL );
85 virtual void Fit();
86
87 void OnSize( wxSizeEvent &event );
88 void OnIdle( wxIdleEvent& event );
89
90 virtual bool Show( bool show );
91 virtual void Enable( bool enable );
92 virtual void MakeModal( bool modal );
93 virtual bool IsEnabled() const { return m_isEnabled; };
94 virtual void SetFocus();
95 virtual bool OnClose();
96
97 virtual void AddChild( wxWindow *child );
98 wxList *GetChildren();
99 virtual void RemoveChild( wxWindow *child );
100 void SetReturnCode( int retCode );
101 int GetReturnCode();
102 wxWindow *GetParent();
103
104 wxEvtHandler *GetEventHandler();
105 void SetEventhandler( wxEvtHandler *handler );
106
107 virtual wxValidator *GetValidator();
108 virtual void SetValidator( wxValidator *validator );
109
110 bool IsBeingDeleted();
111
112 void SetId( wxWindowID id );
113 wxWindowID GetId();
114
115 void SetCursor( const wxCursor &cursor );
116
117 virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = NULL );
118 virtual void Clear();
119 virtual bool IsExposed( long x, long y );
120 virtual bool IsExposed( long x, long y, long width, long height );
121
122 virtual wxColour GetBackgroundColour() const;
123 virtual void SetBackgroundColour( const wxColour &colour );
124
125 virtual void SetDefaultBackgroundColour( const wxColour& col )
126 { m_defaultBackgroundColour = col; };
127 virtual wxColour GetDefaultBackgroundColour() const
128 { return m_defaultBackgroundColour; };
129 virtual void SetDefaultForegroundColour( const wxColour& col )
130 { m_defaultForegroundColour = col; };
131 virtual wxColour GetDefaultForegroundColour() const
132 { return m_defaultForegroundColour; };
133
134 virtual void SetFont( const wxFont &font );
135 virtual wxFont *GetFont();
136 // For backward compatibility
137 inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
138 inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
139 inline virtual wxFont *GetLabelFont() { return GetFont(); };
140 inline virtual wxFont *GetButtonFont() { return GetFont(); };
141 virtual void SetWindowStyleFlag( long flag );
142 virtual long GetWindowStyleFlag() const;
143 virtual void CaptureMouse();
144 virtual void ReleaseMouse();
145 virtual void SetTitle( const wxString &title );
146 virtual wxString GetTitle() const;
147 virtual void SetName( const wxString &name );
148 virtual wxString GetName() const;
149 virtual wxString GetLabel() const;
c801d85f 150
aed8df38
VZ
151 void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) {};
152
153 virtual bool IsShown() const;
e149aaeb 154
362c6693
RR
155 virtual void Raise(void);
156 virtual void Lower(void);
e149aaeb 157
aed8df38
VZ
158 virtual bool IsRetained();
159 virtual wxWindow *FindWindow( long id );
160 virtual wxWindow *FindWindow( const wxString& name );
161 void AllowDoubleClick( bool WXUNUSED(allow) ) {};
162 void SetDoubleClick( bool WXUNUSED(allow) ) {};
163 virtual void ClientToScreen( int *x, int *y );
164 virtual void ScreenToClient( int *x, int *y );
165
166 virtual bool Validate();
167 virtual bool TransferDataToWindow();
168 virtual bool TransferDataFromWindow();
169 void OnInitDialog( wxInitDialogEvent &event );
170 virtual void InitDialog();
30dea054
RR
171
172 virtual bool PopupMenu( wxMenu *menu, int x, int y );
aed8df38
VZ
173
174 virtual void SetDropTarget( wxDropTarget *dropTarget );
175 virtual wxDropTarget *GetDropTarget() const;
30dea054 176
e3e65dac 177private:
30dea054 178 virtual GtkWidget* GetConnectWidget(void);
e3e65dac
RR
179
180public:
aed8df38
VZ
181 virtual void SetScrollbar( int orient, int pos, int thumbVisible,
182 int range, bool refresh = TRUE );
183 virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
184 virtual int GetScrollPos( int orient ) const;
185 virtual int GetScrollThumb( int orient ) const;
186 virtual int GetScrollRange( int orient ) const;
187 virtual void ScrollWindow( int dx, int dy, const wxRect* rect = NULL );
188
189 // return FALSE from here if the window doesn't want the focus
190 virtual bool AcceptsFocus() const;
191
192 // update the UI state (called from OnIdle)
193 void UpdateWindowUI();
194
e3e65dac 195
aed8df38
VZ
196public: // cannot get private going yet
197
198 void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
199 const wxSize &size, long style, const wxString &name );
200 void PostCreation();
201 bool HasVMT();
202 virtual void ImplementSetSize();
203 virtual void ImplementSetPosition();
204 void GetDrawingOffset( long *x, long *y );
205
206 wxWindow *m_parent;
207 wxList m_children;
208 int m_x,m_y;
209 int m_width,m_height;
210 int m_retCode;
211 wxEvtHandler *m_eventHandler;
212 wxValidator *m_windowValidator;
213 wxDropTarget *m_pDropTarget;
214 wxWindowID m_windowId;
215 wxCursor *m_cursor;
216 wxFont m_font;
217 wxColour m_backgroundColour;
218 wxColour m_defaultBackgroundColour;
219 wxColour m_foregroundColour ;
220 wxColour m_defaultForegroundColour;
221 wxRegion m_updateRegion;
222 long m_windowStyle;
223 bool m_isShown;
224 bool m_isEnabled;
225 wxString m_windowName;
226 long m_drawingOffsetX,m_drawingOffsetY;
227
228 GtkWidget *m_widget;
229 GtkWidget *m_wxwindow;
230 GtkAdjustment *m_hAdjust,*m_vAdjust;
231 float m_oldHorizontalPos;
232 float m_oldVerticalPos;
233 bool m_needParent;
234 bool m_hasScrolling;
235 bool m_hasVMT;
236 bool m_sizeSet;
237 bool m_resizing;
238
239public: // Layout section
240
241 wxLayoutConstraints * m_constraints;
242 wxList * m_constraintsInvolvedIn;
243 wxSizer * m_windowSizer;
244 wxWindow * m_sizerParent;
245 bool m_autoLayout;
246
247 wxLayoutConstraints *GetConstraints() const;
248 void SetConstraints( wxLayoutConstraints *constraints );
249 void SetAutoLayout( bool autoLayout );
250 bool GetAutoLayout() const;
251 bool Layout();
252 void SetSizer( wxSizer *sizer );
253 wxSizer *GetSizer() const;
254 void SetSizerParent( wxWindow *win );
255 wxWindow *GetSizerParent() const;
256 void UnsetConstraints(wxLayoutConstraints *c);
257 inline wxList *GetConstraintsInvolvedIn() const ;
258 void AddConstraintReference(wxWindow *otherWin);
259 void RemoveConstraintReference(wxWindow *otherWin);
260 void DeleteRelatedConstraints();
261 virtual void ResetConstraints();
262 virtual void SetConstraintSizes(bool recurse = TRUE);
263 virtual bool LayoutPhase1(int *noChanges);
264 virtual bool LayoutPhase2(int *noChanges);
265 virtual bool DoPhase(int);
266 virtual void TransformSizerToActual(int *x, int *y) const ;
267 virtual void SizerSetSize(int x, int y, int w, int h);
268 virtual void SizerMove(int x, int y);
269 virtual void SetSizeConstraint(int x, int y, int w, int h);
270 virtual void MoveConstraint(int x, int y);
271 virtual void GetSizeConstraint(int *w, int *h) const ;
272 virtual void GetClientSizeConstraint(int *w, int *h) const ;
273 virtual void GetPositionConstraint(int *x, int *y) const ;
274
275 DECLARE_DYNAMIC_CLASS(wxWindow)
c801d85f
KB
276 DECLARE_EVENT_TABLE()
277};
278
279#endif // __GTKWINDOWH__