1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/bmpcbox.h
3 // Purpose: wxBitmapComboBox
4 // Author: Jaakko Salli
7 // Copyright: (c) 2008 Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_BMPCBOX_H_
12 #define _WX_MSW_BMPCBOX_H_
15 #include "wx/combobox.h"
18 // ----------------------------------------------------------------------------
19 // wxBitmapComboBox: a wxComboBox that allows images to be shown
20 // in front of string items.
21 // ----------------------------------------------------------------------------
23 class WXDLLIMPEXP_ADV wxBitmapComboBox
: public wxComboBox
,
24 public wxBitmapComboBoxBase
28 wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase()
33 wxBitmapComboBox(wxWindow
*parent
,
34 wxWindowID id
= wxID_ANY
,
35 const wxString
& value
= wxEmptyString
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
,
39 const wxString choices
[] = NULL
,
41 const wxValidator
& validator
= wxDefaultValidator
,
42 const wxString
& name
= wxBitmapComboBoxNameStr
)
44 wxBitmapComboBoxBase()
48 (void)Create(parent
, id
, value
, pos
, size
, n
,
49 choices
, style
, validator
, name
);
52 wxBitmapComboBox(wxWindow
*parent
,
54 const wxString
& value
,
57 const wxArrayString
& choices
,
59 const wxValidator
& validator
= wxDefaultValidator
,
60 const wxString
& name
= wxBitmapComboBoxNameStr
);
62 bool Create(wxWindow
*parent
,
64 const wxString
& value
,
68 const wxString choices
[],
70 const wxValidator
& validator
= wxDefaultValidator
,
71 const wxString
& name
= wxBitmapComboBoxNameStr
);
73 bool Create(wxWindow
*parent
,
75 const wxString
& value
,
78 const wxArrayString
& choices
,
80 const wxValidator
& validator
= wxDefaultValidator
,
81 const wxString
& name
= wxBitmapComboBoxNameStr
);
83 virtual ~wxBitmapComboBox();
85 // Sets the image for the given item.
86 virtual void SetItemBitmap(unsigned int n
, const wxBitmap
& bitmap
);
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
);
103 WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
104 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*item
);
105 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT
*item
);
108 void OnSize(wxSizeEvent
& event
);
110 virtual bool SetFont(const wxFont
& font
);
112 virtual wxItemContainer
* GetItemContainer() { return this; }
113 virtual wxWindow
* GetControl() { return this; }
115 // wxItemContainer implementation
116 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
118 void **clientData
, wxClientDataType type
);
119 virtual void DoClear();
120 virtual void DoDeleteOneItem(unsigned int n
);
122 virtual bool OnAddBitmap(const wxBitmap
& bitmap
);
123 virtual wxSize
DoGetBestSize() const;
124 void RecreateControl();
131 DECLARE_EVENT_TABLE()
133 DECLARE_DYNAMIC_CLASS(wxBitmapComboBox
)
136 #endif // _WX_MSW_BMPCBOX_H_