X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/164db177a227c71a91fc998ab38f6eefd4f2606a..8e77fd8bca165aab9709649d79a7cbc6a172d4e1:/include/wx/nonownedwnd.h?ds=inline diff --git a/include/wx/nonownedwnd.h b/include/wx/nonownedwnd.h index 58f288065f..696edb5e9b 100644 --- a/include/wx/nonownedwnd.h +++ b/include/wx/nonownedwnd.h @@ -14,6 +14,11 @@ #include "wx/window.h" +// Styles that can be used with any wxNonOwnedWindow: +#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped + +class WXDLLIMPEXP_FWD_CORE wxGraphicsPath; + // ---------------------------------------------------------------------------- // wxNonOwnedWindow: a window that is not a child window of another one. // ---------------------------------------------------------------------------- @@ -24,13 +29,75 @@ public: // Set the shape of the window to the given region. // Returns true if the platform supports this feature (and the // operation is successful.) - virtual bool SetShape(const wxRegion& WXUNUSED(region)) { return false; } + bool SetShape(const wxRegion& region) + { + // This style is in fact only needed by wxOSX/Carbon so once we don't + // use this port any more, we could get rid of this requirement, but + // for now you must specify wxFRAME_SHAPED for SetShape() to work on + // all platforms. + wxCHECK_MSG + ( + HasFlag(wxFRAME_SHAPED), false, + wxS("Shaped windows must be created with the wxFRAME_SHAPED style.") + ); + + return region.IsEmpty() ? DoClearShape() : DoSetRegionShape(region); + } + +#if wxUSE_GRAPHICS_CONTEXT + // Set the shape using the specified path. + bool SetShape(const wxGraphicsPath& path) + { + wxCHECK_MSG + ( + HasFlag(wxFRAME_SHAPED), false, + wxS("Shaped windows must be created with the wxFRAME_SHAPED style.") + ); + + return DoSetPathShape(path); + } +#endif // wxUSE_GRAPHICS_CONTEXT + + + // Overridden base class methods. + // ------------------------------ + virtual void AdjustForParentClientOrigin(int& WXUNUSED(x), int& WXUNUSED(y), + int WXUNUSED(sizeFlags) = 0) const + { + // Non owned windows positions don't need to be adjusted for parent + // client area origin so simply do nothing here. + } + + virtual void InheritAttributes() + { + // Non owned windows don't inherit attributes from their parent window + // (if the parent frame is red, it doesn't mean that all dialogs shown + // by it should be red as well), so don't do anything here neither. + } + +protected: + virtual bool DoClearShape() + { + return false; + } + + virtual bool DoSetRegionShape(const wxRegion& WXUNUSED(region)) + { + return false; + } + +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& WXUNUSED(path)) + { + return false; + } +#endif // wxUSE_GRAPHICS_CONTEXT }; #if defined(__WXDFB__) #include "wx/dfb/nonownedwnd.h" -#elif defined(__WXGTK__) +#elif defined(__WXGTK20__) #include "wx/gtk/nonownedwnd.h" #elif defined(__WXMAC__) #include "wx/osx/nonownedwnd.h"