nonownedwnd.h 2.3 KB

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