]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/custombgwin.h
Define __VISUALC__ for ICC under Windows again.
[wxWidgets.git] / interface / wx / custombgwin.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/custombgwin.h
3 // Purpose: Documentation of wxCustomBackgroundWindow.
4 // Author: Vadim Zeitlin
5 // Created: 2011-10-10
6 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 /**
11 A helper class making it possible to use custom background for any window.
12
13 wxWindow itself only provides SetBackgroundColour() method taking a (solid)
14 wxColour. This class extends it by allowing to use custom bitmap
15 backgrounds with any window, provided that you inherit from it. Notice that
16 the usual rule of not interfering with event handling or painting of native
17 controls still applies, so you shouldn't try to use custom backgrounds with
18 classes such as wxButton (even if this might work on some platforms, it's
19 not guaranteed to work in general). But you can use this class in
20 conjunction with wxWindow, wxPanel, wxFrame and other similar classes, e.g.
21 the erase sample shows how to use it with wxScrolledWindow:
22
23 @code
24 #include "wx/custombgwin.h"
25
26 class MyCanvas : public wxCustomBackgroundWindow<wxScrolledWindow>
27 {
28 public:
29 MyCanvas(wxWindow* parent)
30 {
31 // Notice that we must explicitly call base class Create()
32 // instead of using its ctor as wxCustomBackgroundWindow
33 // doesn't define any non-default ctors.
34 Create(parent, wxID_ANY);
35
36 ...
37
38 SetBackgroundBitmap(bitmap);
39 }
40 };
41 @endcode
42
43 @category{miscwnd}
44
45 @since 2.9.3
46 */
47 template <class W>
48 class wxCustomBackgroundWindow : public W
49 {
50 public:
51 /// Trivial default constructor.
52 wxCustomBackgroundWindow();
53
54 /**
55 Set the background bitmap for this window.
56
57 If @a bmp is a valid bitmap, this bitmap will be tiled over the panel
58 background and show through any of its transparent children. Passing an
59 invalid bitmap reverts to the default background appearance.
60
61 Notice that you must not prevent the base class EVT_ERASE_BACKGROUND
62 handler from running (i.e. not to handle this event yourself) for this
63 to work.
64 */
65 void SetBackgroundBitmap(const wxBitmap& bmp);
66 };