]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dfb/window.h
update button style to include BS_MULTILINE when a multiline label is set
[wxWidgets.git] / include / wx / dfb / window.h
CommitLineData
b3c86150
VS
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
52c8d32a 18#include "wx/dfb/dfbptr.h"
b3c86150
VS
19
20wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
21struct wxDFBWindowEvent;
22
b5dbe15d
VS
23class WXDLLIMPEXP_FWD_CORE wxFont;
24class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow;
b3c86150 25
30c841c8
VS
26class wxOverlayImpl;
27class wxDfbOverlaysList;
28
b3c86150
VS
29// ---------------------------------------------------------------------------
30// wxWindow
31// ---------------------------------------------------------------------------
32
33class WXDLLIMPEXP_CORE wxWindowDFB : public wxWindowBase
34{
35public:
36 wxWindowDFB() { Init(); }
37
38 wxWindowDFB(wxWindow *parent,
39 wxWindowID id,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = 0,
43 const wxString& name = wxPanelNameStr)
44 {
45 Init();
46 Create(parent, id, pos, size, style, name);
47 }
48
49 virtual ~wxWindowDFB();
50
51 bool Create(wxWindow *parent,
52 wxWindowID id,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = 0,
56 const wxString& name = wxPanelNameStr);
57
58 // implement base class (pure) virtual methods
59 // -------------------------------------------
60
61 virtual void SetLabel( const wxString &WXUNUSED(label) ) {}
62 virtual wxString GetLabel() const { return wxEmptyString; }
63
64 virtual void Raise();
65 virtual void Lower();
66
67 virtual bool Show(bool show = true);
68
69 virtual void SetFocus();
70
71 virtual bool Reparent(wxWindowBase *newParent);
72
73 virtual void WarpPointer(int x, int y);
74
75 virtual void Refresh(bool eraseBackground = true,
76 const wxRect *rect = (const wxRect *) NULL);
77 virtual void Update();
78 virtual void Clear();
79 virtual void Freeze();
80 virtual void Thaw();
d4a1433f 81 virtual bool IsFrozen() const { return m_frozenness > 0; }
b3c86150
VS
82
83 virtual bool SetCursor(const wxCursor &cursor);
84 virtual bool SetFont(const wxFont &font) { m_font = font; return true; }
85
86 virtual int GetCharHeight() const;
87 virtual int GetCharWidth() const;
88 virtual void GetTextExtent(const wxString& string,
89 int *x, int *y,
90 int *descent = (int *) NULL,
91 int *externalLeading = (int *) NULL,
92 const wxFont *theFont = (const wxFont *) NULL)
93 const;
94
95#if wxUSE_DRAG_AND_DROP
96 virtual void SetDropTarget(wxDropTarget *dropTarget);
97
98 // Accept files for dragging
99 virtual void DragAcceptFiles(bool accept);
100#endif // wxUSE_DRAG_AND_DROP
101
102 virtual WXWidget GetHandle() const { return this; }
103
104 // implementation from now on
105 // --------------------------
106
107 // Returns DirectFB surface used for rendering of this window
52c8d32a 108 wxIDirectFBSurfacePtr GetDfbSurface();
b3c86150
VS
109
110 // returns toplevel window the window belongs to
42b0d8b9 111 wxNonOwnedWindow *GetTLW() const { return m_tlw; }
b3c86150
VS
112
113 void OnInternalIdle();
114
2e992e06
VZ
115 virtual bool IsDoubleBuffered() const { return true; }
116
b3c86150
VS
117protected:
118 // implement the base class pure virtuals
119 virtual void DoClientToScreen(int *x, int *y) const;
120 virtual void DoScreenToClient(int *x, int *y) const;
121 virtual void DoGetPosition(int *x, int *y) const;
122 virtual void DoGetSize(int *width, int *height) const;
123 virtual void DoGetClientSize(int *width, int *height) const;
124 virtual void DoSetSize(int x, int y,
125 int width, int height,
126 int sizeFlags = wxSIZE_AUTO);
127 virtual void DoSetClientSize(int width, int height);
128
129 virtual void DoCaptureMouse();
130 virtual void DoReleaseMouse();
131
132 // move the window to the specified location and resize it: this is called
133 // from both DoSetSize() and DoSetClientSize() and would usually just call
134 // ::MoveWindow() except for composite controls which will want to arrange
135 // themselves inside the given rectangle
136 virtual void DoMoveWindow(int x, int y, int width, int height);
137
138 // return DFB surface used to render this window (will be assigned to
139 // m_surface if the window is visible)
52c8d32a 140 virtual wxIDirectFBSurfacePtr ObtainDfbSurface() const;
b3c86150
VS
141
142 // this method must be called when window's position, size or visibility
143 // changes; it resets m_surface so that ObtainDfbSurface has to be called
144 // next time GetDfbSurface is called
145 void InvalidateDfbSurface();
146
147 // called by parent to render (part of) the window
20671963 148 void PaintWindow(const wxRect& rect);
b3c86150 149
30c841c8
VS
150 // paint window's overlays (if any) on top of window's surface
151 void PaintOverlays(const wxRect& rect);
152
20671963
VS
153 // refreshes the entire window (including non-client areas)
154 void DoRefreshWindow();
155 // refreshes given rectangle of the window (in window, _not_ client coords)
156 virtual void DoRefreshRect(const wxRect& rect);
30c841c8
VS
157 // refreshes given rectangle; unlike RefreshRect(), the argument is in
158 // window, not client, coords and unlike DoRefreshRect() and like Refresh(),
159 // does nothing if the window is hidden or frozen
160 void RefreshWindowRect(const wxRect& rect);
161
162 // add/remove overlay for this window
163 void AddOverlay(wxOverlayImpl *overlay);
164 void RemoveOverlay(wxOverlayImpl *overlay);
b3c86150
VS
165
166 // DirectFB events handling
167 void HandleKeyEvent(const wxDFBWindowEvent& event_);
168
169private:
170 // common part of all ctors
171 void Init();
172 // counterpart to SetFocus
4ff28c37 173 void DFBKillFocus();
b3c86150
VS
174
175protected:
176 // toplevel window (i.e. DirectFB window) this window belongs to
42b0d8b9 177 wxNonOwnedWindow *m_tlw;
b3c86150
VS
178
179private:
180 // subsurface of TLW's surface covered by this window
52c8d32a 181 wxIDirectFBSurfacePtr m_surface;
b3c86150
VS
182
183 // position of the window (relative to the parent, not used by wxTLW, so
184 // don't access it directly)
185 wxRect m_rect;
186
187 // number of calls to Freeze() minus number of calls to Thaw()
188 unsigned m_frozenness;
189
30c841c8
VS
190 // overlays for this window (or NULL if it doesn't have any)
191 wxDfbOverlaysList *m_overlays;
192
42b0d8b9 193 friend class wxNonOwnedWindow; // for HandleXXXEvent
30c841c8
VS
194 friend class wxOverlayImpl; // for Add/RemoveOverlay
195 friend class wxWindowDC; // for PaintOverlays
b3c86150
VS
196
197 DECLARE_DYNAMIC_CLASS(wxWindowDFB)
198 DECLARE_NO_COPY_CLASS(wxWindowDFB)
199 DECLARE_EVENT_TABLE()
200};
201
b3c86150 202#endif // _WX_DFB_WINDOW_H_