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