]> git.saurik.com Git - wxWidgets.git/blob - include/wx/custombgwin.h
Add wxControl::GetSizeFromTextSize() to size the control to its text.
[wxWidgets.git] / include / wx / custombgwin.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/custombgwin.h
3 // Purpose: Class adding support for custom window backgrounds.
4 // Author: Vadim Zeitlin
5 // Created: 2011-10-10
6 // RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_CUSTOMBGWIN_H_
12 #define _WX_CUSTOMBGWIN_H_
13
14 // ----------------------------------------------------------------------------
15 // wxCustomBackgroundWindow: Adds support for custom backgrounds to any
16 // wxWindow-derived class.
17 // ----------------------------------------------------------------------------
18
19 class wxCustomBackgroundWindowBase
20 {
21 public:
22 // Trivial default ctor.
23 wxCustomBackgroundWindowBase() { }
24
25 // Also a trivial but virtual -- to suppress g++ warnings -- dtor.
26 virtual ~wxCustomBackgroundWindowBase() { }
27
28 // Use the given bitmap to tile the background of this window. This bitmap
29 // will show through any transparent children.
30 //
31 // Notice that you must not prevent the base class EVT_ERASE_BACKGROUND
32 // handler from running (i.e. not to handle this event yourself) for this
33 // to work.
34 void SetBackgroundBitmap(const wxBitmap& bmp)
35 {
36 DoSetBackgroundBitmap(bmp);
37 }
38
39 protected:
40 virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) = 0;
41
42 wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowBase);
43 };
44
45 #if defined(__WXUNIVERSAL__)
46 #include "wx/univ/custombgwin.h"
47 #elif defined(__WXMSW__)
48 #include "wx/msw/custombgwin.h"
49 #else
50 #include "wx/generic/custombgwin.h"
51 #endif
52
53 #endif // _WX_CUSTOMBGWIN_H_