| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: interface/wx/nonownedwnd.h |
| 3 | // Purpose: wxNonOwnedWindow class documentation |
| 4 | // Author: Vadim Zeitlin |
| 5 | // Created: 2011-10-09 |
| 6 | // RCS-ID: $Id$ |
| 7 | // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> |
| 8 | // Licence: wxWindows licence |
| 9 | /////////////////////////////////////////////////////////////////////////////// |
| 10 | |
| 11 | |
| 12 | /** |
| 13 | Styles that can be used with any wxNonOwnedWindow: |
| 14 | */ |
| 15 | #define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped |
| 16 | |
| 17 | |
| 18 | /** |
| 19 | Common base class for all non-child windows. |
| 20 | |
| 21 | This is the common base class of wxTopLevelWindow and wxPopupWindow and is |
| 22 | not used directly. |
| 23 | |
| 24 | Currently the only additional functionality it provides, compared to base |
| 25 | wxWindow class, is the ability to set the window shape. |
| 26 | |
| 27 | @since 2.9.3 |
| 28 | */ |
| 29 | class wxNonOwnedWindow : public wxWindow |
| 30 | { |
| 31 | public: |
| 32 | /** |
| 33 | If the platform supports it, sets the shape of the window to that |
| 34 | depicted by @a region. The system will not display or respond to any |
| 35 | mouse event for the pixels that lie outside of the region. To reset the |
| 36 | window to the normal rectangular shape simply call SetShape() again with |
| 37 | an empty wxRegion. Returns @true if the operation is successful. |
| 38 | |
| 39 | This method is available in this class only since wxWidgets 2.9.3, |
| 40 | previous versions only provided it in wxTopLevelWindow. |
| 41 | */ |
| 42 | bool SetShape(const wxRegion& region); |
| 43 | |
| 44 | /** |
| 45 | Set the window shape to the given path. |
| 46 | |
| 47 | Set the window shape to the interior of the given path and also draw |
| 48 | the window border along the specified path. |
| 49 | |
| 50 | For example, to make a clock-like circular window you could use |
| 51 | @code |
| 52 | wxSize size = GetSize(); |
| 53 | wxGraphicsPath |
| 54 | path = wxGraphicsRenderer::GetDefaultRenderer()->CreatePath(); |
| 55 | path.AddCircle(size.x/2, size.y/2, 30); |
| 56 | SetShape(path); |
| 57 | @endcode |
| 58 | |
| 59 | As the overload above, this method is not guaranteed to work on all |
| 60 | platforms but currently does work in wxMSW, wxOSX/Cocoa and wxGTK (with |
| 61 | the appropriate but almost always present X11 extensions) ports. |
| 62 | |
| 63 | @since 2.9.3 |
| 64 | */ |
| 65 | bool SetShape(const wxGraphicsPath& path); |
| 66 | }; |