]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dfb/window.h
add more virtual border drawing functions used by frame decorations code
[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 protected:
113 // implement the base class pure virtuals
114 virtual void DoClientToScreen(int *x, int *y) const;
115 virtual void DoScreenToClient(int *x, int *y) const;
116 virtual void DoGetPosition(int *x, int *y) const;
117 virtual void DoGetSize(int *width, int *height) const;
118 virtual void DoGetClientSize(int *width, int *height) const;
119 virtual void DoSetSize(int x, int y,
120 int width, int height,
121 int sizeFlags = wxSIZE_AUTO);
122 virtual void DoSetClientSize(int width, int height);
123
124 virtual void DoCaptureMouse();
125 virtual void DoReleaseMouse();
126
127 // move the window to the specified location and resize it: this is called
128 // from both DoSetSize() and DoSetClientSize() and would usually just call
129 // ::MoveWindow() except for composite controls which will want to arrange
130 // themselves inside the given rectangle
131 virtual void DoMoveWindow(int x, int y, int width, int height);
132
133 // return DFB surface used to render this window (will be assigned to
134 // m_surface if the window is visible)
135 virtual wxIDirectFBSurfacePtr ObtainDfbSurface() const;
136
137 // this method must be called when window's position, size or visibility
138 // changes; it resets m_surface so that ObtainDfbSurface has to be called
139 // next time GetDfbSurface is called
140 void InvalidateDfbSurface();
141
142 // called by parent to render (part of) the window
143 void PaintWindow(const wxRect& rect);
144
145 // refreshes the entire window (including non-client areas)
146 void DoRefreshWindow();
147 // refreshes given rectangle of the window (in window, _not_ client coords)
148 virtual void DoRefreshRect(const wxRect& rect);
149
150 // DirectFB events handling
151 void HandleKeyEvent(const wxDFBWindowEvent& event_);
152
153 private:
154 // common part of all ctors
155 void Init();
156 // counterpart to SetFocus
157 void KillFocus();
158
159 protected:
160 // toplevel window (i.e. DirectFB window) this window belongs to
161 wxTopLevelWindowDFB *m_tlw;
162
163 private:
164 // subsurface of TLW's surface covered by this window
165 wxIDirectFBSurfacePtr m_surface;
166
167 // position of the window (relative to the parent, not used by wxTLW, so
168 // don't access it directly)
169 wxRect m_rect;
170
171 // number of calls to Freeze() minus number of calls to Thaw()
172 unsigned m_frozenness;
173
174 friend class wxTopLevelWindowDFB; // for HandleXXXEvent
175
176 DECLARE_DYNAMIC_CLASS(wxWindowDFB)
177 DECLARE_NO_COPY_CLASS(wxWindowDFB)
178 DECLARE_EVENT_TABLE()
179 };
180
181 #endif // _WX_DFB_WINDOW_H_