]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/nativewin.cpp
compilation fix after last commit
[wxWidgets.git] / src / gtk / nativewin.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/nativewin.cpp
3 // Purpose: wxNativeWindow implementation
4 // Author: Vadim Zeitlin
5 // Created: 2008-03-05
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #ifndef WX_PRECOMP
27 #endif // WX_PRECOMP
28
29 #include "wx/nativewin.h"
30
31 #include <gtk/gtk.h>
32
33 // ============================================================================
34 // implementation
35 // ============================================================================
36
37 bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle win)
38 {
39 if ( !wxTopLevelWindow::Create(NULL, wxID_ANY, "") )
40 return false;
41
42 // we need to realize the window first before reparenting it
43 gtk_widget_realize(m_widget);
44 gdk_window_reparent(m_widget->window, win, 0, 0);
45
46 // we should be initially visible as we suppose that the native window we
47 // wrap is (we could use gdk_window_is_visible() to test for this but this
48 // doesn't make much sense unless we also react to visibility changes, so
49 // just suppose it's always shown for now)
50 Show();
51
52 return true;
53 }
54
55 bool wxNativeContainerWindow::Create(wxNativeContainerWindowId anid)
56 {
57 bool rc;
58 GdkWindow * const win = gdk_window_foreign_new(anid);
59 if ( win )
60 {
61 rc = Create(win);
62 g_object_unref(win);
63 }
64 else // invalid native window id
65 {
66 rc = false;
67 }
68
69 return rc;
70 }
71
72 wxNativeContainerWindow::~wxNativeContainerWindow()
73 {
74 // there doesn't seem to be anything to do here, GTK+ seems to handle
75 // everything correctly due to its use of reference counting
76 }