(blind) fixes for PCH-less build after r53626
[wxWidgets.git] / include / wx / bmpcbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/bmpcbox.h
3 // Purpose: wxBitmapComboBox base header
4 // Author: Jaakko Salli
5 // Modified by:
6 // Created: Aug-31-2006
7 // Copyright: (c) Jaakko Salli
8 // RCS-ID: $Id$
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_BMPCBOX_H_BASE_
13 #define _WX_BMPCBOX_H_BASE_
14
15
16 #include "wx/defs.h"
17
18 #if wxUSE_BITMAPCOMBOBOX
19
20 #include "wx/bitmap.h"
21
22 class WXDLLIMPEXP_FWD_CORE wxItemContainer;
23
24 // Define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED for platforms which
25 // wxBitmapComboBox implementation utilizes ownerdrawn combobox
26 // (either native or generic).
27 #if 1
28 #define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
29 #endif
30
31 extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxBitmapComboBoxNameStr[];
32
33
34 class WXDLLIMPEXP_ADV wxBitmapComboBoxBase
35 {
36 public:
37 // ctors and such
38 wxBitmapComboBoxBase() { Init(); }
39
40 virtual ~wxBitmapComboBoxBase() { }
41
42 // Sets the image for the given item.
43 virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0;
44
45 #if !defined(wxBITMAPCOMBOBOX_OWNERDRAWN_BASED)
46
47 // Returns the image of the item with the given index.
48 virtual wxBitmap GetItemBitmap(unsigned int n) const = 0;
49
50 // Returns size of the image used in list
51 virtual wxSize GetBitmapSize() const = 0;
52
53 private:
54 void Init() {}
55
56 #else // wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
57
58 // Returns the image of the item with the given index.
59 virtual wxBitmap GetItemBitmap(unsigned int n) const;
60
61 // Returns size of the image used in list
62 virtual wxSize GetBitmapSize() const
63 {
64 return m_usedImgSize;
65 }
66
67 protected:
68
69 // Returns pointer to the combobox item container
70 virtual wxItemContainer* GetItemContainer() = 0;
71
72 // Return pointer to the owner-drawn combobox control
73 virtual wxWindow* GetControl() = 0;
74
75 // wxItemContainer functions
76 void BCBDoClear();
77 void BCBDoDeleteOneItem(unsigned int n);
78
79 void DoSetItemBitmap(unsigned int n, const wxBitmap& bitmap);
80
81 void DrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const;
82 void DrawItem(wxDC& dc, const wxRect& rect, int item, const wxString& text,
83 int flags) const;
84 wxCoord MeasureItem(size_t item) const;
85
86 // Returns true if image size was affected
87 virtual bool OnAddBitmap(const wxBitmap& bitmap);
88
89 // Recalculates amount of empty space needed in front of text
90 // in control itself. Returns number that can be passed to
91 // wxOwnerDrawnComboBox::SetCustomPaintWidth() and similar
92 // functions.
93 virtual int DetermineIndent();
94
95 void UpdateInternals();
96
97 wxArrayPtrVoid m_bitmaps; // Images associated with items
98 wxSize m_usedImgSize; // Size of bitmaps
99
100 int m_imgAreaWidth; // Width and height of area next to text field
101 int m_fontHeight;
102 int m_indent;
103
104 private:
105 void Init();
106 #endif // !wxBITMAPCOMBOBOX_OWNERDRAWN_BASED/wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
107 };
108
109
110 #if defined(__WXUNIVERSAL__)
111 #include "wx/generic/bmpcbox.h"
112 #elif defined(__WXMSW__)
113 #include "wx/msw/bmpcbox.h"
114 #else
115 #include "wx/generic/bmpcbox.h"
116 #endif
117
118 #endif // wxUSE_BITMAPCOMBOBOX
119
120 #endif // _WX_BMPCBOX_H_BASE_