]>
Commit | Line | Data |
---|---|---|
42b0d8b9 VS |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/dfb/nonownedwnd.h | |
4e21a649 | 3 | // Purpose: declares wxNonOwnedWindow class |
42b0d8b9 VS |
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_DFB_NONOWNEDWND_H_ | |
12 | #define _WX_DFB_NONOWNEDWND_H_ | |
13 | ||
14 | #include "wx/window.h" | |
15 | #include "wx/dfb/dfbptr.h" | |
16 | ||
17 | wxDFB_DECLARE_INTERFACE(IDirectFBWindow); | |
18 | class wxDfbQueuedPaintRequests; | |
19 | struct wxDFBWindowEvent; | |
86e9b8f2 | 20 | class wxDFBEventsHandler; |
42b0d8b9 VS |
21 | |
22 | //----------------------------------------------------------------------------- | |
23 | // wxNonOwnedWindow | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | // This class represents "non-owned" window. A window is owned by another | |
27 | // window if it has a parent and is positioned within the parent. For example, | |
28 | // wxFrame is non-owned, because even though it can have a parent, it's | |
29 | // location is independent of it. This class is for internal use only, it's | |
30 | // the base class for wxTopLevelWindow and wxPopupWindow. | |
5bd0ee99 | 31 | class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase |
42b0d8b9 VS |
32 | { |
33 | public: | |
34 | // construction | |
35 | wxNonOwnedWindow() { Init(); } | |
36 | wxNonOwnedWindow(wxWindow *parent, | |
37 | wxWindowID id, | |
38 | const wxPoint& pos = wxDefaultPosition, | |
39 | const wxSize& size = wxDefaultSize, | |
40 | long style = 0, | |
41 | const wxString& name = wxPanelNameStr) | |
42 | { | |
43 | Init(); | |
44 | ||
45 | Create(parent, id, pos, size, style, name); | |
46 | } | |
47 | ||
48 | bool Create(wxWindow *parent, | |
49 | wxWindowID id, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, | |
52 | long style = 0, | |
53 | const wxString& name = wxPanelNameStr); | |
54 | ||
55 | virtual ~wxNonOwnedWindow(); | |
56 | ||
57 | // implement base class pure virtuals | |
58 | virtual bool Show(bool show = true); | |
59 | ||
60 | virtual void Update(); | |
61 | ||
84e45580 VS |
62 | virtual void Raise(); |
63 | virtual void Lower(); | |
64 | ||
42b0d8b9 VS |
65 | // implementation from now on |
66 | // -------------------------- | |
67 | ||
68 | void OnInternalIdle(); | |
69 | ||
70 | wxIDirectFBWindowPtr GetDirectFBWindow() const { return m_dfbwin; } | |
71 | ||
72 | // Returns true if some invalidated area of the TLW is currently being | |
73 | // painted | |
74 | bool IsPainting() const { return m_isPainting; } | |
75 | ||
76 | protected: | |
77 | // common part of all ctors | |
78 | void Init(); | |
79 | ||
80 | virtual wxIDirectFBSurfacePtr ObtainDfbSurface() const; | |
81 | ||
4c51a665 | 82 | // overridden wxWindow methods |
42b0d8b9 VS |
83 | virtual void DoGetPosition(int *x, int *y) const; |
84 | virtual void DoGetSize(int *width, int *height) const; | |
85 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
86 | ||
87 | virtual void DoRefreshRect(const wxRect& rect); | |
88 | ||
89 | // sets DirectFB keyboard focus to this toplevel window (note that DFB | |
90 | // focus is different from wx: only shown TLWs can have it and not any | |
91 | // wxWindows as in wx | |
92 | void SetDfbFocus(); | |
93 | ||
4c51a665 | 94 | // overridden in wxTopLevelWindowDFB, there's no common handling for wxTLW |
6954a1e2 VS |
95 | // and wxPopupWindow to be done here |
96 | virtual void HandleFocusEvent(const wxDFBWindowEvent& WXUNUSED(event_)) {} | |
97 | ||
42b0d8b9 VS |
98 | private: |
99 | // do queued painting in idle time | |
100 | void HandleQueuedPaintRequests(); | |
101 | ||
102 | // DirectFB events handling | |
103 | static void HandleDFBWindowEvent(const wxDFBWindowEvent& event_); | |
104 | ||
105 | protected: | |
106 | // did we sent wxSizeEvent at least once? | |
107 | bool m_sizeSet:1; | |
108 | ||
109 | // window's opacity (0: transparent, 255: opaque) | |
110 | wxByte m_opacity; | |
111 | ||
112 | // interface to the underlying DirectFB window | |
113 | wxIDirectFBWindowPtr m_dfbwin; | |
114 | ||
115 | private: | |
116 | // invalidated areas of the TLW that need repainting | |
117 | wxDfbQueuedPaintRequests *m_toPaint; | |
118 | // are we currently painting some area of this TLW? | |
119 | bool m_isPainting; | |
120 | ||
86e9b8f2 VS |
121 | friend class wxDFBEventsHandler; // for HandleDFBWindowEvent |
122 | friend class wxWindowDFB; // for SetDfbFocus | |
42b0d8b9 VS |
123 | }; |
124 | ||
125 | #endif // _WX_DFB_NONOWNEDWND_H_ |