1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/bmpcbox.h
3 // Purpose: wxBitmapComboBox
4 // Author: Jaakko Salli
6 // Created: Aug-30-2006
8 // Copyright: (c) Jaakko Salli
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GENERIC_BMPCBOX_H_
13 #define _WX_GENERIC_BMPCBOX_H_
16 #define wxGENERIC_BITMAPCOMBOBOX 1
18 #include "wx/odcombo.h"
20 // ----------------------------------------------------------------------------
21 // wxBitmapComboBox: a wxComboBox that allows images to be shown
22 // in front of string items.
23 // ----------------------------------------------------------------------------
25 class WXDLLIMPEXP_ADV wxBitmapComboBox
: public wxOwnerDrawnComboBox
,
26 public wxBitmapComboBoxBase
31 wxBitmapComboBox() : wxOwnerDrawnComboBox(), wxBitmapComboBoxBase()
36 wxBitmapComboBox(wxWindow
*parent
,
37 wxWindowID id
= wxID_ANY
,
38 const wxString
& value
= wxEmptyString
,
39 const wxPoint
& pos
= wxDefaultPosition
,
40 const wxSize
& size
= wxDefaultSize
,
42 const wxString choices
[] = NULL
,
44 const wxValidator
& validator
= wxDefaultValidator
,
45 const wxString
& name
= wxBitmapComboBoxNameStr
)
46 : wxOwnerDrawnComboBox(),
47 wxBitmapComboBoxBase()
51 (void)Create(parent
, id
, value
, pos
, size
, n
,
52 choices
, style
, validator
, name
);
55 wxBitmapComboBox(wxWindow
*parent
,
57 const wxString
& value
,
60 const wxArrayString
& choices
,
62 const wxValidator
& validator
= wxDefaultValidator
,
63 const wxString
& name
= wxBitmapComboBoxNameStr
);
65 bool Create(wxWindow
*parent
,
67 const wxString
& value
,
71 const wxString choices
[],
73 const wxValidator
& validator
= wxDefaultValidator
,
74 const wxString
& name
= wxBitmapComboBoxNameStr
);
76 bool Create(wxWindow
*parent
,
78 const wxString
& value
,
81 const wxArrayString
& choices
,
83 const wxValidator
& validator
= wxDefaultValidator
,
84 const wxString
& name
= wxBitmapComboBoxNameStr
);
86 virtual ~wxBitmapComboBox();
88 // Adds item with image to the end of the combo box.
89 int Append(const wxString
& item
, const wxBitmap
& bitmap
= wxNullBitmap
);
90 int Append(const wxString
& item
, const wxBitmap
& bitmap
, void *clientData
);
91 int Append(const wxString
& item
, const wxBitmap
& bitmap
, wxClientData
*clientData
);
93 // Inserts item with image into the list before pos. Not valid for wxCB_SORT
94 // styles, use Append instead.
95 int Insert(const wxString
& item
, const wxBitmap
& bitmap
, unsigned int pos
);
96 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
97 unsigned int pos
, void *clientData
);
98 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
99 unsigned int pos
, wxClientData
*clientData
);
101 // Sets the image for the given item.
102 virtual void SetItemBitmap(unsigned int n
, const wxBitmap
& bitmap
);
106 virtual void OnDrawBackground(wxDC
& dc
, const wxRect
& rect
, int item
, int flags
) const;
107 virtual void OnDrawItem(wxDC
& dc
, const wxRect
& rect
, int item
, int flags
) const;
108 virtual wxCoord
OnMeasureItem(size_t item
) const;
109 virtual wxCoord
OnMeasureItemWidth(size_t item
) const;
112 void OnSize(wxSizeEvent
& event
);
114 virtual wxSize
DoGetBestSize() const;
115 virtual bool SetFont(const wxFont
& font
);
117 virtual wxItemContainer
* GetItemContainer() { return this; }
118 virtual wxWindow
* GetControl() { return this; }
120 // wxItemContainer implementation
121 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
123 void **clientData
, wxClientDataType type
);
124 virtual void DoClear();
125 virtual void DoDeleteOneItem(unsigned int n
);
132 DECLARE_EVENT_TABLE()
134 DECLARE_DYNAMIC_CLASS(wxBitmapComboBox
)
137 #endif // _WX_GENERIC_BMPCBOX_H_