]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/window.h
Initial revision
[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
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
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{
61 DECLARE_DYNAMIC_CLASS(wxWindow)
62
63 public:
64
65 wxWindow(void);
66 wxWindow( wxWindow *parent, const wxWindowID id,
67 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
68 const long style = 0, const wxString &name = wxPanelNameStr );
69 bool Create( wxWindow *parent, const wxWindowID id,
70 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
71 const long style = 0, const wxString &name = wxPanelNameStr );
72 virtual ~wxWindow(void);
73 bool Close( const 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( const int x, const int y, const int width, const int height,
80 const int sizeFlags = wxSIZE_AUTO );
81 virtual void SetSize( const int width, const int height );
82 virtual void Move( const int x, const 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( const int direction = wxHORIZONTAL );
88 virtual void Fit(void);
89
90 void OnSize( wxSizeEvent &event );
91
92 virtual bool Show( const bool show );
93 virtual void Enable( const bool enable );
94 virtual void MakeModal( const 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( const bool eraseBackground = TRUE, const wxRect *rect = NULL );
120 virtual void Clear(void);
121 virtual bool IsExposed( const long x, const long y );
122 virtual bool IsExposed( const long x, const long y, const long width, const 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);
156 virtual bool IsRetained(void);
157 virtual wxWindow *FindWindow( const 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 public: // cannot get private going yet
182
183 void PreCreation( wxWindow *parent, const wxWindowID id, const wxPoint &pos,
184 const wxSize &size, const long style, const wxString &name );
185 void PostCreation(void);
186 bool HasVMT(void);
187 virtual void ImplementSetSize(void);
188 virtual void ImplementSetPosition(void);
189 void GetDrawingOffset( long *x, long *y );
190
191 wxWindow *m_parent;
192 wxList m_children;
193 int m_x,m_y;
194 int m_width,m_height;
195 int m_retCode;
196 wxEvtHandler *m_eventHandler;
197 wxValidator *m_windowValidator;
198 wxDropTarget *m_pDropTarget;
199 wxWindowID m_windowId;
200 wxCursor *m_cursor;
201 wxFont m_font;
202 wxColour m_backgroundColour;
203 wxColour m_defaultBackgroundColour;
204 wxColour m_foregroundColour ;
205 wxColour m_defaultForegroundColour;
206 wxRegion m_updateRegion;
207 long m_windowStyle;
208 bool m_isShown;
209 bool m_isEnabled;
210 wxString m_windowName;
211 long m_drawingOffsetX,m_drawingOffsetY;
212
213 GtkWidget *m_widget;
214 GtkWidget *m_wxwindow;
215 GtkAdjustment *m_hAdjust,*m_vAdjust;
216 float m_oldHorizontalPos;
217 float m_oldVerticalPos;
218 bool m_needParent;
219 bool m_hasScrolling;
220 bool m_hasVMT;
221 bool m_sizeSet;
222
223 public: // Layout section
224
225 wxLayoutConstraints * m_constraints;
226 wxList * m_constraintsInvolvedIn;
227 wxSizer * m_windowSizer;
228 wxWindow * m_sizerParent;
229 bool m_autoLayout;
230
231 wxLayoutConstraints *GetConstraints(void) const;
232 void SetConstraints( wxLayoutConstraints *constraints );
233 void SetAutoLayout( const bool autoLayout );
234 bool GetAutoLayout(void) const;
235 bool Layout(void);
236 void SetSizer( wxSizer *sizer );
237 wxSizer *GetSizer(void) const;
238 void SetSizerParent( wxWindow *win );
239 wxWindow *GetSizerParent(void) const;
240 void UnsetConstraints(wxLayoutConstraints *c);
241 inline wxList *GetConstraintsInvolvedIn(void) const ;
242 void AddConstraintReference(wxWindow *otherWin);
243 void RemoveConstraintReference(wxWindow *otherWin);
244 void DeleteRelatedConstraints(void);
245 virtual void ResetConstraints(void);
246 virtual void SetConstraintSizes(const bool recurse = TRUE);
247 virtual bool LayoutPhase1(int *noChanges);
248 virtual bool LayoutPhase2(int *noChanges);
249 virtual bool DoPhase(const int);
250 virtual void TransformSizerToActual(int *x, int *y) const ;
251 virtual void SizerSetSize(const int x, const int y, const int w, const int h);
252 virtual void SizerMove(const int x, const int y);
253 virtual void SetSizeConstraint(const int x, const int y, const int w, const int h);
254 virtual void MoveConstraint(const int x, const int y);
255 virtual void GetSizeConstraint(int *w, int *h) const ;
256 virtual void GetClientSizeConstraint(int *w, int *h) const ;
257 virtual void GetPositionConstraint(int *x, int *y) const ;
258
259 DECLARE_EVENT_TABLE()
260};
261
262#endif // __GTKWINDOWH__