1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/bmpcbox.h
3 // Purpose: wxBitmapComboBox
4 // Author: Jaakko Salli
6 // Copyright: (c) 2008 Jaakko Salli
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_MSW_BMPCBOX_H_
11 #define _WX_MSW_BMPCBOX_H_
14 #include "wx/combobox.h"
17 // ----------------------------------------------------------------------------
18 // wxBitmapComboBox: a wxComboBox that allows images to be shown
19 // in front of string items.
20 // ----------------------------------------------------------------------------
22 class WXDLLIMPEXP_ADV wxBitmapComboBox
: public wxComboBox
,
23 public wxBitmapComboBoxBase
27 wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase()
32 wxBitmapComboBox(wxWindow
*parent
,
33 wxWindowID id
= wxID_ANY
,
34 const wxString
& value
= wxEmptyString
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
,
38 const wxString choices
[] = NULL
,
40 const wxValidator
& validator
= wxDefaultValidator
,
41 const wxString
& name
= wxBitmapComboBoxNameStr
)
43 wxBitmapComboBoxBase()
47 (void)Create(parent
, id
, value
, pos
, size
, n
,
48 choices
, style
, validator
, name
);
51 wxBitmapComboBox(wxWindow
*parent
,
53 const wxString
& value
,
56 const wxArrayString
& choices
,
58 const wxValidator
& validator
= wxDefaultValidator
,
59 const wxString
& name
= wxBitmapComboBoxNameStr
);
61 bool Create(wxWindow
*parent
,
63 const wxString
& value
,
67 const wxString choices
[],
69 const wxValidator
& validator
= wxDefaultValidator
,
70 const wxString
& name
= wxBitmapComboBoxNameStr
);
72 bool Create(wxWindow
*parent
,
74 const wxString
& value
,
77 const wxArrayString
& choices
,
79 const wxValidator
& validator
= wxDefaultValidator
,
80 const wxString
& name
= wxBitmapComboBoxNameStr
);
82 virtual ~wxBitmapComboBox();
84 // Sets the image for the given item.
85 virtual void SetItemBitmap(unsigned int n
, const wxBitmap
& bitmap
);
87 virtual bool SetFont(const wxFont
& font
);
89 // Adds item with image to the end of the combo box.
90 int Append(const wxString
& item
, const wxBitmap
& bitmap
= wxNullBitmap
);
91 int Append(const wxString
& item
, const wxBitmap
& bitmap
, void *clientData
);
92 int Append(const wxString
& item
, const wxBitmap
& bitmap
, wxClientData
*clientData
);
94 // Inserts item with image into the list before pos. Not valid for wxCB_SORT
95 // styles, use Append instead.
96 int Insert(const wxString
& item
, const wxBitmap
& bitmap
, unsigned int pos
);
97 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
98 unsigned int pos
, void *clientData
);
99 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
100 unsigned int pos
, wxClientData
*clientData
);
104 WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
105 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*item
);
106 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT
*item
);
109 void OnSize(wxSizeEvent
& event
);
111 virtual wxItemContainer
* GetItemContainer() { return this; }
112 virtual wxWindow
* GetControl() { return this; }
114 // wxItemContainer implementation
115 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
117 void **clientData
, wxClientDataType type
);
118 virtual void DoClear();
119 virtual void DoDeleteOneItem(unsigned int n
);
121 virtual bool OnAddBitmap(const wxBitmap
& bitmap
);
122 virtual wxSize
DoGetBestSize() const;
123 void RecreateControl();
130 DECLARE_EVENT_TABLE()
132 DECLARE_DYNAMIC_CLASS(wxBitmapComboBox
)
135 #endif // _WX_MSW_BMPCBOX_H_