1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/nonownedwnd.h
3 // Purpose: declares wxNonTopLevelWindow class
4 // Author: Vaclav Slavik
8 // Copyright: (c) 2006 TT-Solutions
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_NONOWNEDWND_H_
13 #define _WX_NONOWNEDWND_H_
15 #include "wx/window.h"
17 // Styles that can be used with any wxNonOwnedWindow:
18 #define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped
20 class WXDLLIMPEXP_FWD_CORE wxGraphicsPath
;
22 // ----------------------------------------------------------------------------
23 // wxNonOwnedWindow: a window that is not a child window of another one.
24 // ----------------------------------------------------------------------------
26 class WXDLLIMPEXP_CORE wxNonOwnedWindowBase
: public wxWindow
29 // Set the shape of the window to the given region.
30 // Returns true if the platform supports this feature (and the
31 // operation is successful.)
32 bool SetShape(const wxRegion
& region
)
34 // This style is in fact only needed by wxOSX/Carbon so once we don't
35 // use this port any more, we could get rid of this requirement, but
36 // for now you must specify wxFRAME_SHAPED for SetShape() to work on
40 HasFlag(wxFRAME_SHAPED
), false,
41 wxS("Shaped windows must be created with the wxFRAME_SHAPED style.")
44 return region
.IsEmpty() ? DoClearShape() : DoSetRegionShape(region
);
47 #if wxUSE_GRAPHICS_CONTEXT
48 // Set the shape using the specified path.
49 bool SetShape(const wxGraphicsPath
& path
)
53 HasFlag(wxFRAME_SHAPED
), false,
54 wxS("Shaped windows must be created with the wxFRAME_SHAPED style.")
57 return DoSetPathShape(path
);
59 #endif // wxUSE_GRAPHICS_CONTEXT
62 virtual bool DoClearShape()
67 virtual bool DoSetRegionShape(const wxRegion
& WXUNUSED(region
))
72 #if wxUSE_GRAPHICS_CONTEXT
73 virtual bool DoSetPathShape(const wxGraphicsPath
& WXUNUSED(path
))
77 #endif // wxUSE_GRAPHICS_CONTEXT
80 #if defined(__WXDFB__)
81 #include "wx/dfb/nonownedwnd.h"
82 #elif defined(__WXGTK20__)
83 #include "wx/gtk/nonownedwnd.h"
84 #elif defined(__WXMAC__)
85 #include "wx/osx/nonownedwnd.h"
86 #elif defined(__WXMSW__) && !defined(__WXWINCE__)
87 #include "wx/msw/nonownedwnd.h"
89 // No special class needed in other ports, they can derive both wxTLW and
90 // wxPopupWindow directly from wxWindow and don't implement SetShape().
91 class wxNonOwnedWindow
: public wxNonOwnedWindowBase
96 #endif // _WX_NONOWNEDWND_H_