]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
1e6feb95 | 2 | // Name: wx/gtk/window.h |
c801d85f KB |
3 | // Purpose: |
4 | // Author: Robert Roebling | |
58614078 RR |
5 | // Id: $Id$ |
6 | // Copyright: (c) 1998 Robert Roebling | |
65571936 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
ef5c70f9 VZ |
10 | #ifndef _WX_GTK_WINDOW_H_ |
11 | #define _WX_GTK_WINDOW_H_ | |
12 | ||
13 | #include "wx/dynarray.h" | |
c801d85f | 14 | |
9dc44eff PC |
15 | #ifdef __WXGTK3__ |
16 | typedef struct _cairo cairo_t; | |
80a77e3c | 17 | typedef struct _GtkStyleProvider GtkStyleProvider; |
9dc44eff PC |
18 | #define WXUNUSED_IN_GTK3(x) |
19 | #else | |
20 | #define WXUNUSED_IN_GTK3(x) x | |
21 | #endif | |
22 | ||
afa98731 VZ |
23 | typedef struct _GdkEventKey GdkEventKey; |
24 | typedef struct _GtkIMContext GtkIMContext; | |
25 | ||
ef5c70f9 VZ |
26 | WX_DEFINE_EXPORTED_ARRAY_PTR(GdkWindow *, wxArrayGdkWindows); |
27 | ||
1da8e6e4 VZ |
28 | extern "C" |
29 | { | |
30 | ||
31 | typedef void (*wxGTKCallback)(); | |
32 | ||
33 | } | |
34 | ||
c801d85f | 35 | //----------------------------------------------------------------------------- |
1e6feb95 | 36 | // wxWindowGTK |
c801d85f KB |
37 | //----------------------------------------------------------------------------- |
38 | ||
20123d49 | 39 | class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase |
c801d85f | 40 | { |
aed8df38 | 41 | public: |
bfc6fde4 VZ |
42 | // creating the window |
43 | // ------------------- | |
1e6feb95 VZ |
44 | wxWindowGTK(); |
45 | wxWindowGTK(wxWindow *parent, | |
46 | wxWindowID id, | |
47 | const wxPoint& pos = wxDefaultPosition, | |
48 | const wxSize& size = wxDefaultSize, | |
49 | long style = 0, | |
50 | const wxString& name = wxPanelNameStr); | |
f03fc89f VZ |
51 | bool Create(wxWindow *parent, |
52 | wxWindowID id, | |
53 | const wxPoint& pos = wxDefaultPosition, | |
54 | const wxSize& size = wxDefaultSize, | |
55 | long style = 0, | |
56 | const wxString& name = wxPanelNameStr); | |
1e6feb95 | 57 | virtual ~wxWindowGTK(); |
cd0183ca | 58 | |
f03fc89f VZ |
59 | // implement base class (pure) virtual methods |
60 | // ------------------------------------------- | |
a264ece2 | 61 | |
f03fc89f VZ |
62 | virtual void Raise(); |
63 | virtual void Lower(); | |
ff8bfdbb | 64 | |
5bc3865f | 65 | virtual bool Show( bool show = true ); |
ff8bfdbb | 66 | |
f03fc89f | 67 | virtual bool IsRetained() const; |
2f2aa628 | 68 | |
bfc6fde4 | 69 | virtual void SetFocus(); |
cca410b3 | 70 | |
00ff24c8 | 71 | // hint from wx to native GTK+ tab traversal code |
80332672 | 72 | virtual void SetCanFocus(bool canFocus); |
ff8bfdbb | 73 | |
fdb7dadb | 74 | virtual bool Reparent( wxWindowBase *newParent ); |
ff8bfdbb | 75 | |
f03fc89f | 76 | virtual void WarpPointer(int x, int y); |
b1170810 | 77 | |
5bc3865f | 78 | virtual void Refresh( bool eraseBackground = true, |
f03fc89f | 79 | const wxRect *rect = (const wxRect *) NULL ); |
beab25bd | 80 | virtual void Update(); |
596f1d11 | 81 | virtual void ClearBackground(); |
bfc6fde4 | 82 | |
f03fc89f VZ |
83 | virtual bool SetBackgroundColour( const wxColour &colour ); |
84 | virtual bool SetForegroundColour( const wxColour &colour ); | |
85 | virtual bool SetCursor( const wxCursor &cursor ); | |
86 | virtual bool SetFont( const wxFont &font ); | |
cd0183ca | 87 | |
c7382f91 | 88 | virtual bool SetBackgroundStyle(wxBackgroundStyle style) ; |
14421681 | 89 | virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const; |
f26623c8 | 90 | |
bfc6fde4 VZ |
91 | virtual int GetCharHeight() const; |
92 | virtual int GetCharWidth() const; | |
aed8df38 | 93 | |
f03fc89f | 94 | virtual void SetScrollbar( int orient, int pos, int thumbVisible, |
5bc3865f WS |
95 | int range, bool refresh = true ); |
96 | virtual void SetScrollPos( int orient, int pos, bool refresh = true ); | |
f03fc89f VZ |
97 | virtual int GetScrollPos( int orient ) const; |
98 | virtual int GetScrollThumb( int orient ) const; | |
99 | virtual int GetScrollRange( int orient ) const; | |
100 | virtual void ScrollWindow( int dx, int dy, | |
d3b9f782 | 101 | const wxRect* rect = NULL ); |
0c131a5a VZ |
102 | virtual bool ScrollLines(int lines); |
103 | virtual bool ScrollPages(int pages); | |
8bbe427f | 104 | |
f03fc89f VZ |
105 | #if wxUSE_DRAG_AND_DROP |
106 | virtual void SetDropTarget( wxDropTarget *dropTarget ); | |
107 | #endif // wxUSE_DRAG_AND_DROP | |
f26623c8 | 108 | |
a589495e VS |
109 | virtual void AddChild( wxWindowBase *child ); |
110 | virtual void RemoveChild( wxWindowBase *child ); | |
8bbe427f | 111 | |
978af864 VZ |
112 | virtual void SetLayoutDirection(wxLayoutDirection dir); |
113 | virtual wxLayoutDirection GetLayoutDirection() const; | |
fe92a9d6 RR |
114 | virtual wxCoord AdjustForLayoutDirection(wxCoord x, |
115 | wxCoord width, | |
116 | wxCoord widthTotal) const; | |
978af864 | 117 | |
657b4fd4 RD |
118 | virtual bool DoIsExposed( int x, int y ) const; |
119 | virtual bool DoIsExposed( int x, int y, int w, int h ) const; | |
847dfdb4 | 120 | |
8e1a5bf9 VZ |
121 | // currently wxGTK2-only |
122 | void SetDoubleBuffered(bool on); | |
2e992e06 | 123 | virtual bool IsDoubleBuffered() const; |
8e1a5bf9 | 124 | |
c9248ddb RR |
125 | // SetLabel(), which does nothing in wxWindow |
126 | virtual void SetLabel(const wxString& label) { m_gtkLabel = label; } | |
127 | virtual wxString GetLabel() const { return m_gtkLabel; } | |
128 | ||
f03fc89f VZ |
129 | // implementation |
130 | // -------------- | |
c801d85f | 131 | |
d7c24517 VZ |
132 | virtual WXWidget GetHandle() const { return m_widget; } |
133 | ||
ef5c70f9 VZ |
134 | // many important things are done here, this function must be called |
135 | // regularly | |
bfc6fde4 | 136 | virtual void OnInternalIdle(); |
ff8bfdbb | 137 | |
beab25bd RR |
138 | // For compatibility across platforms (not in event table) |
139 | void OnIdle(wxIdleEvent& WXUNUSED(event)) {} | |
20e85460 | 140 | |
beab25bd | 141 | // Used by all window classes in the widget creation process. |
1e6feb95 | 142 | bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ); |
bfc6fde4 | 143 | void PostCreation(); |
ff8bfdbb | 144 | |
48200154 | 145 | // Internal addition of child windows |
1e6feb95 | 146 | void DoAddChild(wxWindowGTK *child); |
f26623c8 | 147 | |
9dc44eff PC |
148 | // This method sends wxPaintEvents to the window. |
149 | // It is also responsible for background erase events. | |
150 | #ifdef __WXGTK3__ | |
151 | void GTKSendPaintEvents(cairo_t* cr); | |
152 | #else | |
153 | void GTKSendPaintEvents(const GdkRegion* region); | |
154 | #endif | |
beab25bd RR |
155 | |
156 | // The methods below are required because many native widgets | |
157 | // are composed of several subwidgets and setting a style for | |
158 | // the widget means setting it for all subwidgets as well. | |
90e572f1 | 159 | // also, it is not clear which native widget is the top |
beab25bd RR |
160 | // widget where (most of) the input goes. even tooltips have |
161 | // to be applied to all subwidgets. | |
bfc6fde4 | 162 | virtual GtkWidget* GetConnectWidget(); |
bfc6fde4 | 163 | void ConnectWidget( GtkWidget *widget ); |
8bbe427f | 164 | |
5478f221 VZ |
165 | // Called from several event handlers, if it returns true or false, the |
166 | // same value should be immediately returned by the handler without doing | |
167 | // anything else. If it returns -1, the handler should continue as usual | |
168 | int GTKCallbackCommonPrologue(struct _GdkEventAny *event) const; | |
ef5c70f9 | 169 | |
02bad830 VZ |
170 | // Simplified form of GTKCallbackCommonPrologue() which can be used from |
171 | // GTK callbacks without return value to check if the event should be | |
172 | // ignored: if this returns true, the event shouldn't be handled | |
173 | bool GTKShouldIgnoreEvent() const; | |
174 | ||
175 | ||
97687291 VZ |
176 | // override this if some events should never be consumed by wxWidgets but |
177 | // but have to be left for the native control | |
178 | // | |
004867db | 179 | // base version just calls HandleWindowEvent() |
97687291 VZ |
180 | virtual bool GTKProcessEvent(wxEvent& event) const; |
181 | ||
978af864 VZ |
182 | // Map GTK widget direction of the given widget to/from wxLayoutDirection |
183 | static wxLayoutDirection GTKGetLayout(GtkWidget *widget); | |
184 | static void GTKSetLayout(GtkWidget *widget, wxLayoutDirection dir); | |
185 | ||
004867db | 186 | // This is called when capture is taken from the window. It will |
7738af59 VZ |
187 | // fire off capture lost events. |
188 | void GTKReleaseMouseAndNotify(); | |
189 | ||
08f53168 PC |
190 | GdkWindow* GTKGetDrawingWindow() const; |
191 | ||
bd2e08d0 VS |
192 | bool GTKHandleFocusIn(); |
193 | bool GTKHandleFocusOut(); | |
194 | void GTKHandleFocusOutNoDeferring(); | |
195 | static void GTKHandleDeferredFocusOut(); | |
196 | ||
612515af VZ |
197 | // Called when m_widget becomes realized. Derived classes must call the |
198 | // base class method if they override it. | |
199 | virtual void GTKHandleRealized(); | |
603e7f6d | 200 | void GTKHandleUnrealize(); |
612515af | 201 | |
cb3db090 | 202 | protected: |
bd2e08d0 VS |
203 | // for controls composed of multiple GTK widgets, return true to eliminate |
204 | // spurious focus events if the focus changes between GTK+ children within | |
205 | // the same wxWindow | |
206 | virtual bool GTKNeedsToFilterSameWindowFocus() const { return false; } | |
207 | ||
2e1f5012 | 208 | // Override GTKWidgetNeedsMnemonic and return true if your |
28e88942 | 209 | // needs to set its mnemonic widget, such as for a |
2e1f5012 VZ |
210 | // GtkLabel for wxStaticText, then do the actual |
211 | // setting of the widget inside GTKWidgetDoSetMnemonic | |
212 | virtual bool GTKWidgetNeedsMnemonic() const; | |
213 | virtual void GTKWidgetDoSetMnemonic(GtkWidget* w); | |
214 | ||
ef5c70f9 VZ |
215 | // Get the GdkWindows making part of this window: usually there will be |
216 | // only one of them in which case it should be returned directly by this | |
217 | // function. If there is more than one GdkWindow (can be the case for | |
218 | // composite widgets), return NULL and fill in the provided array | |
219 | // | |
220 | // This is not pure virtual for backwards compatibility but almost | |
221 | // certainly must be overridden in any wxControl-derived class! | |
222 | virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; | |
223 | ||
224 | // Check if the given window makes part of this widget | |
225 | bool GTKIsOwnWindow(GdkWindow *window) const; | |
226 | ||
cb3db090 | 227 | public: |
2b5f62a0 | 228 | // Returns the default context which usually is anti-aliased |
496e7ec6 | 229 | PangoContext *GTKGetPangoDefaultContext(); |
2b5f62a0 | 230 | |
ff8bfdbb | 231 | #if wxUSE_TOOLTIPS |
6e5f6c7c | 232 | // applies tooltip to the widget (tip must be UTF-8 encoded) |
558a94bd | 233 | virtual void GTKApplyToolTip(const char* tip); |
ff8bfdbb | 234 | #endif // wxUSE_TOOLTIPS |
301cd871 | 235 | |
f46ad98f | 236 | // Called when a window should delay showing itself |
71ead4bf RR |
237 | // until idle time used in Reparent(). |
238 | void GTKShowOnIdle() { m_showOnIdle = true; } | |
28e88942 | 239 | |
7317857d | 240 | // This is called from the various OnInternalIdle methods |
71ead4bf | 241 | bool GTKShowFromOnIdle(); |
3ae4c570 | 242 | |
d1f2ac45 | 243 | // is this window transparent for the mouse events (as wxStaticBox is)? |
71ead4bf | 244 | virtual bool GTKIsTransparentForMouse() const { return false; } |
d1f2ac45 | 245 | |
add7cadd | 246 | // Common scroll event handling code for wxWindow and wxScrollBar |
71ead4bf | 247 | wxEventType GTKGetScrollEventType(GtkRange* range); |
add7cadd | 248 | |
f03fc89f VZ |
249 | // position and size of the window |
250 | int m_x, m_y; | |
251 | int m_width, m_height; | |
b0d053c1 PC |
252 | int m_clientWidth, m_clientHeight; |
253 | // Whether the client size variables above are known to be correct | |
254 | // (because they have been validated by a size-allocate) and should | |
255 | // be used to report client size | |
256 | bool m_useCachedClientSize; | |
bcf1fa6b | 257 | |
76fcf0f2 RR |
258 | // see the docs in src/gtk/window.cpp |
259 | GtkWidget *m_widget; // mostly the widget seen by the rest of GTK | |
77ffb593 | 260 | GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets |
ce00f59b | 261 | |
c9248ddb RR |
262 | // label for use with GetLabelSetLabel |
263 | wxString m_gtkLabel; | |
ce00f59b | 264 | |
da1bd25f RR |
265 | // return true if the window is of a standard (i.e. not wxWidgets') class |
266 | bool IsOfStandardClass() const { return m_wxwindow == NULL; } | |
cca410b3 | 267 | |
76fcf0f2 RR |
268 | // this widget will be queried for GTK's focus events |
269 | GtkWidget *m_focusWidget; | |
004867db | 270 | |
36a845fe RR |
271 | void GTKDisableFocusOutEvent(); |
272 | void GTKEnableFocusOutEvent(); | |
f03fc89f | 273 | |
afa98731 VZ |
274 | |
275 | // Input method support | |
276 | ||
277 | // The IM context used for generic, i.e. non-native, windows. | |
278 | // | |
279 | // It might be a good idea to avoid allocating it unless key events from | |
280 | // this window are really needed but currently we do it unconditionally. | |
281 | // | |
282 | // For native widgets (i.e. those for which IsOfStandardClass() returns | |
283 | // true) it is NULL. | |
284 | GtkIMContext* m_imContext; | |
285 | ||
286 | // Pointer to the event being currently processed by the IME or NULL if not | |
287 | // inside key handling. | |
288 | GdkEventKey* m_imKeyEvent; | |
289 | ||
290 | // This method generalizes gtk_im_context_filter_keypress(): for the | |
291 | // generic windows it does just that but it's overridden by the classes | |
292 | // wrapping native widgets that use IM themselves and so provide specific | |
293 | // methods for accessing it such gtk_entry_im_context_filter_keypress(). | |
294 | virtual int GTKIMFilterKeypress(GdkEventKey* event) const; | |
295 | ||
b2c35774 VZ |
296 | // This method must be called from the derived classes "insert-text" signal |
297 | // handlers to check if the text is not being inserted by the IM and, if | |
298 | // this is the case, generate appropriate wxEVT_CHAR events for it. | |
299 | // | |
300 | // Returns true if we did generate and process events corresponding to this | |
301 | // text or false if we didn't handle it. | |
302 | bool GTKOnInsertText(const char* text); | |
303 | ||
304 | // This is just a helper of GTKOnInsertText() which is also used by GTK+ | |
305 | // "commit" signal handler. | |
306 | bool GTKDoInsertTextFromIM(const char* text); | |
307 | ||
3bcc8d15 | 308 | |
22c9b211 VZ |
309 | // indices for the arrays below |
310 | enum ScrollDir { ScrollDir_Horz, ScrollDir_Vert, ScrollDir_Max }; | |
311 | ||
add7cadd | 312 | // horizontal/vertical scroll bar |
22c9b211 VZ |
313 | GtkRange* m_scrollBar[ScrollDir_Max]; |
314 | ||
add7cadd | 315 | // horizontal/vertical scroll position |
22c9b211 VZ |
316 | double m_scrollPos[ScrollDir_Max]; |
317 | ||
22c9b211 VZ |
318 | // return the scroll direction index corresponding to the given orientation |
319 | // (which is wxVERTICAL or wxHORIZONTAL) | |
320 | static ScrollDir ScrollDirFromOrient(int orient) | |
321 | { | |
322 | return orient == wxVERTICAL ? ScrollDir_Vert : ScrollDir_Horz; | |
323 | } | |
324 | ||
325 | // return the orientation for the given scrolling direction | |
326 | static int OrientFromScrollDir(ScrollDir dir) | |
327 | { | |
328 | return dir == ScrollDir_Horz ? wxHORIZONTAL : wxVERTICAL; | |
329 | } | |
330 | ||
331 | // find the direction of the given scrollbar (must be one of ours) | |
332 | ScrollDir ScrollDirFromRange(GtkRange *range) const; | |
333 | ||
c2246a38 RR |
334 | // set the current cursor for all GdkWindows making part of this widget |
335 | // (see GTKGetWindow) | |
336 | void GTKUpdateCursor(bool update_self = true, bool recurse = true); | |
337 | ||
f03fc89f | 338 | // extra (wxGTK-specific) flags |
76fcf0f2 RR |
339 | bool m_noExpose:1; // wxGLCanvas has its own redrawing |
340 | bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size" | |
6cad4f1b | 341 | bool m_isScrolling:1; // dragging scrollbar thumb? |
5bc3865f | 342 | bool m_clipPaintRegion:1; // true after ScrollWindow() |
bcb614b3 | 343 | wxRegion m_nativeUpdateRegion; // not transformed for RTL |
a589495e VS |
344 | bool m_dirtyTabOrder:1; // tab order changed, GTK focus |
345 | // chain needs update | |
add7cadd | 346 | bool m_mouseButtonDown:1; |
28e88942 | 347 | |
f46ad98f | 348 | bool m_showOnIdle:1; // postpone showing the window until idle |
7af6f327 | 349 | |
c821db16 | 350 | protected: |
f03fc89f | 351 | // implement the base class pure virtuals |
6de70470 VZ |
352 | virtual void DoGetTextExtent(const wxString& string, |
353 | int *x, int *y, | |
354 | int *descent = NULL, | |
355 | int *externalLeading = NULL, | |
356 | const wxFont *font = NULL) const; | |
dabc0cd5 VZ |
357 | virtual void DoClientToScreen( int *x, int *y ) const; |
358 | virtual void DoScreenToClient( int *x, int *y ) const; | |
f03fc89f VZ |
359 | virtual void DoGetPosition( int *x, int *y ) const; |
360 | virtual void DoGetSize( int *width, int *height ) const; | |
361 | virtual void DoGetClientSize( int *width, int *height ) const; | |
bfc6fde4 VZ |
362 | virtual void DoSetSize(int x, int y, |
363 | int width, int height, | |
364 | int sizeFlags = wxSIZE_AUTO); | |
bfc6fde4 | 365 | virtual void DoSetClientSize(int width, int height); |
b3554952 | 366 | virtual wxSize DoGetBorderSize() const; |
9d9b7755 | 367 | virtual void DoMoveWindow(int x, int y, int width, int height); |
c821db16 | 368 | virtual void DoEnable(bool enable); |
aed8df38 | 369 | |
6f02a879 VZ |
370 | #if wxUSE_MENUS_NATIVE |
371 | virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); | |
372 | #endif // wxUSE_MENUS_NATIVE | |
373 | ||
94633ad9 VZ |
374 | virtual void DoCaptureMouse(); |
375 | virtual void DoReleaseMouse(); | |
f26623c8 | 376 | |
5f346ddc VS |
377 | virtual void DoFreeze(); |
378 | virtual void DoThaw(); | |
379 | ||
f089940f PC |
380 | void GTKFreezeWidget(GtkWidget *w); |
381 | void GTKThawWidget(GtkWidget *w); | |
8ab75332 | 382 | void GTKDisconnect(void* instance); |
5f346ddc | 383 | |
f03fc89f VZ |
384 | #if wxUSE_TOOLTIPS |
385 | virtual void DoSetToolTip( wxToolTip *tip ); | |
386 | #endif // wxUSE_TOOLTIPS | |
387 | ||
992ea406 VZ |
388 | // Create a GtkScrolledWindow containing the given widget (usually |
389 | // m_wxwindow but not necessarily) and assigns it to m_widget. Also shows | |
390 | // the widget passed to it. | |
391 | // | |
392 | // Can be only called if we have either wxHSCROLL or wxVSCROLL in our | |
393 | // style. | |
394 | void GTKCreateScrolledWindowWith(GtkWidget* view); | |
395 | ||
915bd4e4 | 396 | virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move); |
5644933f VZ |
397 | virtual bool DoNavigateIn(int flags); |
398 | ||
a589495e VS |
399 | |
400 | // Copies m_children tab order to GTK focus chain: | |
401 | void RealizeTabOrder(); | |
f26623c8 | 402 | |
9dc44eff | 403 | #ifndef __WXGTK3__ |
f40fdaa3 VS |
404 | // Called by ApplyWidgetStyle (which is called by SetFont() and |
405 | // SetXXXColour etc to apply style changed to native widgets) to create | |
80a77e3c PC |
406 | // modified GTK style with non-standard attributes. |
407 | GtkRcStyle* GTKCreateWidgetStyle(); | |
9dc44eff | 408 | #endif |
f40fdaa3 | 409 | |
9dc44eff | 410 | void GTKApplyWidgetStyle(bool forceStyle = false); |
f26623c8 | 411 | |
5bc3865f | 412 | // helper function to ease native widgets wrapping, called by |
7074ce35 VS |
413 | // ApplyWidgetStyle -- override this, not ApplyWidgetStyle |
414 | virtual void DoApplyWidgetStyle(GtkRcStyle *style); | |
f03fc89f | 415 | |
9dc44eff PC |
416 | void GTKApplyStyle(GtkWidget* widget, GtkRcStyle* style); |
417 | ||
6493aaca | 418 | // sets the border of a given GtkScrolledWindow from a wx style |
496e7ec6 | 419 | static void GTKScrolledWindowSetBorder(GtkWidget* w, int style); |
6493aaca | 420 | |
a0c8bb73 VZ |
421 | // Connect the given function to the specified signal on m_widget. |
422 | // | |
423 | // This is just a wrapper for g_signal_connect() and returns the handler id | |
424 | // just as it does. | |
1da8e6e4 | 425 | unsigned long GTKConnectWidget(const char *signal, wxGTKCallback callback); |
a0c8bb73 | 426 | |
82008f15 PC |
427 | void ConstrainSize(); |
428 | ||
68dda785 | 429 | private: |
ec373f2a PC |
430 | void Init(); |
431 | ||
bf487502 PC |
432 | // return true if this window must have a non-NULL parent, false if it can |
433 | // be created without parent (normally only top level windows but in wxGTK | |
434 | // there is also the exception of wxMenuBar) | |
435 | virtual bool GTKNeedsParent() const { return !IsTopLevel(); } | |
436 | ||
22c9b211 VZ |
437 | enum ScrollUnit { ScrollUnit_Line, ScrollUnit_Page, ScrollUnit_Max }; |
438 | ||
439 | // common part of ScrollLines() and ScrollPages() and could be used, in the | |
440 | // future, for horizontal scrolling as well | |
441 | // | |
442 | // return true if we scrolled, false otherwise (on error or simply if we | |
443 | // are already at the end) | |
444 | bool DoScrollByUnits(ScrollDir dir, ScrollUnit unit, int units); | |
48200154 | 445 | virtual void AddChildGTK(wxWindowGTK* child); |
22c9b211 | 446 | |
9dc44eff PC |
447 | #ifdef __WXGTK3__ |
448 | // paint context is stashed here so wxPaintDC can use it | |
449 | cairo_t* m_paintContext; | |
80a77e3c PC |
450 | // style provider for "background-image" |
451 | GtkStyleProvider* m_styleProvider; | |
9dc44eff PC |
452 | |
453 | public: | |
454 | cairo_t* GTKPaintContext() const | |
455 | { | |
456 | return m_paintContext; | |
457 | } | |
458 | #endif | |
459 | ||
1e6feb95 | 460 | DECLARE_DYNAMIC_CLASS(wxWindowGTK) |
c0c133e1 | 461 | wxDECLARE_NO_COPY_CLASS(wxWindowGTK); |
c801d85f KB |
462 | }; |
463 | ||
ef5c70f9 | 464 | #endif // _WX_GTK_WINDOW_H_ |