]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/nonownedwnd.cpp
b07cdd1afb7887d88c1b5a647aee49f88797b3e3
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/nonownedwnd.cpp
3 // Purpose: wxGTK implementation of wxNonOwnedWindow.
4 // Author: Vadim Zeitlin
6 // RCS-ID: $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
27 #include "wx/frame.h" // Just for wxFRAME_SHAPED.
28 #include "wx/nonownedwnd.h"
29 #include "wx/region.h"
32 #include "wx/gtk/private.h"
40 bool do_shape_combine_region(GdkWindow
* window
, const wxRegion
& region
)
46 gdk_window_shape_combine_mask(window
, NULL
, 0, 0);
50 gdk_window_shape_combine_region(window
, region
.GetRegion(), 0, 0);
57 } // anonymous namespace
60 // ============================================================================
61 // wxNonOwnedWindow implementation
62 // ============================================================================
64 void wxNonOwnedWindow::GTKHandleRealized()
66 wxNonOwnedWindowBase::GTKHandleRealized();
68 if (HasFlag(wxFRAME_SHAPED
))
72 bool wxNonOwnedWindow::SetShape(const wxRegion
& region
)
74 wxCHECK_MSG( HasFlag(wxFRAME_SHAPED
), false,
75 wxT("Shaped windows must be created with the wxFRAME_SHAPED style."));
77 if ( gtk_widget_get_realized(m_widget
) )
80 do_shape_combine_region(gtk_widget_get_window(m_wxwindow
), region
);
82 return do_shape_combine_region(gtk_widget_get_window(m_widget
), region
);
84 else // not realized yet
86 // store the shape to set, it will be really set once we're realized
89 // we don't know if we're going to succeed or fail, be optimistic by