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