]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dfb/nonownedwnd.h
Added wxVariantData::Clone and wxVariant::Unshare
[wxWidgets.git] / include / wx / dfb / nonownedwnd.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/nonownedwnd.h
3 // Purpose: declares wxNonOwnedWindow class
4 // Author: Vaclav Slavik
5 // Modified by:
6 // Created: 2006-12-24
7 // RCS-ID: $Id$
8 // Copyright: (c) 2006 TT-Solutions
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DFB_NONOWNEDWND_H_
13 #define _WX_DFB_NONOWNEDWND_H_
14
15 #include "wx/window.h"
16 #include "wx/dfb/dfbptr.h"
17
18 wxDFB_DECLARE_INTERFACE(IDirectFBWindow);
19 class wxDfbQueuedPaintRequests;
20 struct wxDFBWindowEvent;
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.
31 class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow
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
62 // implementation from now on
63 // --------------------------
64
65 void OnInternalIdle();
66
67 wxIDirectFBWindowPtr GetDirectFBWindow() const { return m_dfbwin; }
68
69 // Returns true if some invalidated area of the TLW is currently being
70 // painted
71 bool IsPainting() const { return m_isPainting; }
72
73 protected:
74 // common part of all ctors
75 void Init();
76
77 virtual wxIDirectFBSurfacePtr ObtainDfbSurface() const;
78
79 // overriden wxWindow methods
80 virtual void DoGetPosition(int *x, int *y) const;
81 virtual void DoGetSize(int *width, int *height) const;
82 virtual void DoMoveWindow(int x, int y, int width, int height);
83
84 virtual void DoRefreshRect(const wxRect& rect);
85
86 // sets DirectFB keyboard focus to this toplevel window (note that DFB
87 // focus is different from wx: only shown TLWs can have it and not any
88 // wxWindows as in wx
89 void SetDfbFocus();
90
91 // overriden in wxTopLevelWindowDFB, there's no common handling for wxTLW
92 // and wxPopupWindow to be done here
93 virtual void HandleFocusEvent(const wxDFBWindowEvent& WXUNUSED(event_)) {}
94
95 private:
96 // do queued painting in idle time
97 void HandleQueuedPaintRequests();
98
99 // DirectFB events handling
100 static void HandleDFBWindowEvent(const wxDFBWindowEvent& event_);
101
102 protected:
103 // did we sent wxSizeEvent at least once?
104 bool m_sizeSet:1;
105
106 // window's opacity (0: transparent, 255: opaque)
107 wxByte m_opacity;
108
109 // interface to the underlying DirectFB window
110 wxIDirectFBWindowPtr m_dfbwin;
111
112 private:
113 // invalidated areas of the TLW that need repainting
114 wxDfbQueuedPaintRequests *m_toPaint;
115 // are we currently painting some area of this TLW?
116 bool m_isPainting;
117
118 friend class wxGUIEventLoop; // for HandleDFBWindowEvent
119 friend class wxWindowDFB; // for SetDfbFocus
120 };
121
122 #endif // _WX_DFB_NONOWNEDWND_H_