1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/bmpcbox.h
3 // Purpose: wxBitmapComboBox
4 // Author: Jaakko Salli
6 // Created: Aug-30-2006
7 // Copyright: (c) Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GENERIC_BMPCBOX_H_
12 #define _WX_GENERIC_BMPCBOX_H_
15 #define wxGENERIC_BITMAPCOMBOBOX 1
17 #include "wx/odcombo.h"
19 // ----------------------------------------------------------------------------
20 // wxBitmapComboBox: a wxComboBox that allows images to be shown
21 // in front of string items.
22 // ----------------------------------------------------------------------------
24 class WXDLLIMPEXP_ADV wxBitmapComboBox
: public wxOwnerDrawnComboBox
,
25 public wxBitmapComboBoxBase
30 wxBitmapComboBox() : wxOwnerDrawnComboBox(), wxBitmapComboBoxBase()
35 wxBitmapComboBox(wxWindow
*parent
,
36 wxWindowID id
= wxID_ANY
,
37 const wxString
& value
= wxEmptyString
,
38 const wxPoint
& pos
= wxDefaultPosition
,
39 const wxSize
& size
= wxDefaultSize
,
41 const wxString choices
[] = NULL
,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxBitmapComboBoxNameStr
)
45 : wxOwnerDrawnComboBox(),
46 wxBitmapComboBoxBase()
50 (void)Create(parent
, id
, value
, pos
, size
, n
,
51 choices
, style
, validator
, name
);
54 wxBitmapComboBox(wxWindow
*parent
,
56 const wxString
& value
,
59 const wxArrayString
& choices
,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxBitmapComboBoxNameStr
);
64 bool Create(wxWindow
*parent
,
66 const wxString
& value
,
70 const wxString choices
[],
72 const wxValidator
& validator
= wxDefaultValidator
,
73 const wxString
& name
= wxBitmapComboBoxNameStr
);
75 bool Create(wxWindow
*parent
,
77 const wxString
& value
,
80 const wxArrayString
& choices
,
82 const wxValidator
& validator
= wxDefaultValidator
,
83 const wxString
& name
= wxBitmapComboBoxNameStr
);
85 virtual ~wxBitmapComboBox();
87 // Adds item with image to the end of the combo box.
88 int Append(const wxString
& item
, const wxBitmap
& bitmap
= wxNullBitmap
);
89 int Append(const wxString
& item
, const wxBitmap
& bitmap
, void *clientData
);
90 int Append(const wxString
& item
, const wxBitmap
& bitmap
, wxClientData
*clientData
);
92 // Inserts item with image into the list before pos. Not valid for wxCB_SORT
93 // styles, use Append instead.
94 int Insert(const wxString
& item
, const wxBitmap
& bitmap
, unsigned int pos
);
95 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
96 unsigned int pos
, void *clientData
);
97 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
98 unsigned int pos
, wxClientData
*clientData
);
100 // Sets the image for the given item.
101 virtual void SetItemBitmap(unsigned int n
, const wxBitmap
& bitmap
);
102 virtual bool SetFont(const wxFont
& font
);
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;
116 virtual wxItemContainer
* GetItemContainer() { return this; }
117 virtual wxWindow
* GetControl() { return this; }
119 // wxItemContainer implementation
120 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
122 void **clientData
, wxClientDataType type
);
123 virtual void DoClear();
124 virtual void DoDeleteOneItem(unsigned int n
);
131 DECLARE_EVENT_TABLE()
133 DECLARE_DYNAMIC_CLASS(wxBitmapComboBox
)
136 #endif // _WX_GENERIC_BMPCBOX_H_