]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dfb/window.h
Whitespaces and headers cleaning.
[wxWidgets.git] / include / wx / dfb / window.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/window.h
3 // Purpose: wxWindow class
4 // Author: Vaclav Slavik
5 // Created: 2006-08-10
6 // RCS-ID: $Id$
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DFB_WINDOW_H_
12 #define _WX_DFB_WINDOW_H_
13
14 // ---------------------------------------------------------------------------
15 // headers
16 // ---------------------------------------------------------------------------
17
18 #include "wx/dfb/dfbptr.h"
19
20 wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
21 struct wxDFBWindowEvent;
22
23 class WXDLLIMPEXP_CORE wxFont;
24 class WXDLLIMPEXP_CORE wxTopLevelWindowDFB;
25
26 // ---------------------------------------------------------------------------
27 // wxWindow
28 // ---------------------------------------------------------------------------
29
30 class WXDLLIMPEXP_CORE wxWindowDFB : public wxWindowBase
31 {
32 public:
33 wxWindowDFB() { Init(); }
34
35 wxWindowDFB(wxWindow *parent,
36 wxWindowID id,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 long style = 0,
40 const wxString& name = wxPanelNameStr)
41 {
42 Init();
43 Create(parent, id, pos, size, style, name);
44 }
45
46 virtual ~wxWindowDFB();
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 // implement base class (pure) virtual methods
56 // -------------------------------------------
57
58 virtual void SetLabel( const wxString &WXUNUSED(label) ) {}
59 virtual wxString GetLabel() const { return wxEmptyString; }
60
61 virtual void Raise();
62 virtual void Lower();
63
64 virtual bool Show(bool show = true);
65
66 virtual void SetFocus();
67
68 virtual bool Reparent(wxWindowBase *newParent);
69
70 virtual void WarpPointer(int x, int y);
71
72 virtual void Refresh(bool eraseBackground = true,
73 const wxRect *rect = (const wxRect *) NULL);
74 virtual void Update();
75 virtual void Clear();
76 virtual void Freeze();
77 virtual void Thaw();
78 virtual bool IsFrozen() const { return m_frozenness > 0; }
79
80 virtual bool SetCursor(const wxCursor &cursor);
81 virtual bool SetFont(const wxFont &font) { m_font = font; return true; }
82
83 virtual int GetCharHeight() const;
84 virtual int GetCharWidth() const;
85 virtual void GetTextExtent(const wxString& string,
86 int *x, int *y,
87 int *descent = (int *) NULL,
88 int *externalLeading = (int *) NULL,
89 const wxFont *theFont = (const wxFont *) NULL)
90 const;
91
92 #if wxUSE_DRAG_AND_DROP
93 virtual void SetDropTarget(wxDropTarget *dropTarget);
94
95 // Accept files for dragging
96 virtual void DragAcceptFiles(bool accept);
97 #endif // wxUSE_DRAG_AND_DROP
98
99 virtual WXWidget GetHandle() const { return this; }
100
101 // implementation from now on
102 // --------------------------
103
104 // Returns DirectFB surface used for rendering of this window
105 wxIDirectFBSurfacePtr GetDfbSurface();
106
107 // returns toplevel window the window belongs to
108 wxTopLevelWindowDFB *GetTLW() const { return m_tlw; }
109
110 void OnInternalIdle();
111
112 virtual bool IsDoubleBuffered() const { return true; }
113
114 protected:
115 // implement the base class pure virtuals
116 virtual void DoClientToScreen(int *x, int *y) const;
117 virtual void DoScreenToClient(int *x, int *y) const;
118 virtual void DoGetPosition(int *x, int *y) const;
119 virtual void DoGetSize(int *width, int *height) const;
120 virtual void DoGetClientSize(int *width, int *height) const;
121 virtual void DoSetSize(int x, int y,
122 int width, int height,
123 int sizeFlags = wxSIZE_AUTO);
124 virtual void DoSetClientSize(int width, int height);
125
126 virtual void DoCaptureMouse();
127 virtual void DoReleaseMouse();
128
129 // move the window to the specified location and resize it: this is called
130 // from both DoSetSize() and DoSetClientSize() and would usually just call
131 // ::MoveWindow() except for composite controls which will want to arrange
132 // themselves inside the given rectangle
133 virtual void DoMoveWindow(int x, int y, int width, int height);
134
135 // return DFB surface used to render this window (will be assigned to
136 // m_surface if the window is visible)
137 virtual wxIDirectFBSurfacePtr ObtainDfbSurface() const;
138
139 // this method must be called when window's position, size or visibility
140 // changes; it resets m_surface so that ObtainDfbSurface has to be called
141 // next time GetDfbSurface is called
142 void InvalidateDfbSurface();
143
144 // called by parent to render (part of) the window
145 void PaintWindow(const wxRect& rect);
146
147 // refreshes the entire window (including non-client areas)
148 void DoRefreshWindow();
149 // refreshes given rectangle of the window (in window, _not_ client coords)
150 virtual void DoRefreshRect(const wxRect& rect);
151
152 // DirectFB events handling
153 void HandleKeyEvent(const wxDFBWindowEvent& event_);
154
155 private:
156 // common part of all ctors
157 void Init();
158 // counterpart to SetFocus
159 void DFBKillFocus();
160
161 protected:
162 // toplevel window (i.e. DirectFB window) this window belongs to
163 wxTopLevelWindowDFB *m_tlw;
164
165 private:
166 // subsurface of TLW's surface covered by this window
167 wxIDirectFBSurfacePtr m_surface;
168
169 // position of the window (relative to the parent, not used by wxTLW, so
170 // don't access it directly)
171 wxRect m_rect;
172
173 // number of calls to Freeze() minus number of calls to Thaw()
174 unsigned m_frozenness;
175
176 friend class wxTopLevelWindowDFB; // for HandleXXXEvent
177
178 DECLARE_DYNAMIC_CLASS(wxWindowDFB)
179 DECLARE_NO_COPY_CLASS(wxWindowDFB)
180 DECLARE_EVENT_TABLE()
181 };
182
183 #endif // _WX_DFB_WINDOW_H_