]> git.saurik.com Git - wxWidgets.git/blame - include/wx/nonownedwnd.h
Add lambda-friendly wxDialog::ShowWindowModalThenDo().
[wxWidgets.git] / include / wx / nonownedwnd.h
CommitLineData
42b0d8b9
VS
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/nonownedwnd.h
3// Purpose: declares wxNonTopLevelWindow class
4// Author: Vaclav Slavik
5// Modified by:
6// Created: 2006-12-24
42b0d8b9
VS
7// Copyright: (c) 2006 TT-Solutions
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_NONOWNEDWND_H_
12#define _WX_NONOWNEDWND_H_
13
5bd0ee99
VZ
14#include "wx/window.h"
15
46ea442c
VZ
16// Styles that can be used with any wxNonOwnedWindow:
17#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped
18
19class WXDLLIMPEXP_FWD_CORE wxGraphicsPath;
20
5bd0ee99
VZ
21// ----------------------------------------------------------------------------
22// wxNonOwnedWindow: a window that is not a child window of another one.
23// ----------------------------------------------------------------------------
24
a3789770 25class WXDLLIMPEXP_CORE wxNonOwnedWindowBase : public wxWindow
5bd0ee99
VZ
26{
27public:
28 // Set the shape of the window to the given region.
29 // Returns true if the platform supports this feature (and the
30 // operation is successful.)
46ea442c
VZ
31 bool SetShape(const wxRegion& region)
32 {
33 // This style is in fact only needed by wxOSX/Carbon so once we don't
34 // use this port any more, we could get rid of this requirement, but
35 // for now you must specify wxFRAME_SHAPED for SetShape() to work on
36 // all platforms.
37 wxCHECK_MSG
38 (
39 HasFlag(wxFRAME_SHAPED), false,
40 wxS("Shaped windows must be created with the wxFRAME_SHAPED style.")
41 );
42
43 return region.IsEmpty() ? DoClearShape() : DoSetRegionShape(region);
44 }
45
46#if wxUSE_GRAPHICS_CONTEXT
47 // Set the shape using the specified path.
48 bool SetShape(const wxGraphicsPath& path)
49 {
50 wxCHECK_MSG
51 (
52 HasFlag(wxFRAME_SHAPED), false,
53 wxS("Shaped windows must be created with the wxFRAME_SHAPED style.")
54 );
5bd0ee99 55
46ea442c
VZ
56 return DoSetPathShape(path);
57 }
58#endif // wxUSE_GRAPHICS_CONTEXT
59
bddea8d1
VZ
60
61 // Overridden base class methods.
62 // ------------------------------
63
64 virtual void AdjustForParentClientOrigin(int& WXUNUSED(x), int& WXUNUSED(y),
65 int WXUNUSED(sizeFlags) = 0) const
66 {
67 // Non owned windows positions don't need to be adjusted for parent
68 // client area origin so simply do nothing here.
69 }
70
483bf4a6
VZ
71 virtual void InheritAttributes()
72 {
73 // Non owned windows don't inherit attributes from their parent window
74 // (if the parent frame is red, it doesn't mean that all dialogs shown
75 // by it should be red as well), so don't do anything here neither.
76 }
77
46ea442c
VZ
78protected:
79 virtual bool DoClearShape()
80 {
81 return false;
82 }
83
84 virtual bool DoSetRegionShape(const wxRegion& WXUNUSED(region))
85 {
86 return false;
87 }
88
89#if wxUSE_GRAPHICS_CONTEXT
90 virtual bool DoSetPathShape(const wxGraphicsPath& WXUNUSED(path))
91 {
92 return false;
93 }
94#endif // wxUSE_GRAPHICS_CONTEXT
5bd0ee99
VZ
95};
96
42b0d8b9
VS
97#if defined(__WXDFB__)
98 #include "wx/dfb/nonownedwnd.h"
a81a1955 99#elif defined(__WXGTK20__)
a82afab3 100 #include "wx/gtk/nonownedwnd.h"
53b9afde 101#elif defined(__WXMAC__)
ef0e9220 102 #include "wx/osx/nonownedwnd.h"
164db177 103#elif defined(__WXMSW__) && !defined(__WXWINCE__)
5bd0ee99 104 #include "wx/msw/nonownedwnd.h"
42b0d8b9 105#else
5bd0ee99 106 // No special class needed in other ports, they can derive both wxTLW and
a82afab3 107 // wxPopupWindow directly from wxWindow and don't implement SetShape().
5bd0ee99
VZ
108 class wxNonOwnedWindow : public wxNonOwnedWindowBase
109 {
110 };
42b0d8b9
VS
111#endif
112
113#endif // _WX_NONOWNEDWND_H_