]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/bmpcbox.h
Use wxGetTranslation() instead of _() in the public headers.
[wxWidgets.git] / include / wx / generic / bmpcbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/bmpcbox.h
3 // Purpose: wxBitmapComboBox
4 // Author: Jaakko Salli
5 // Modified by:
6 // Created: Aug-30-2006
7 // Copyright: (c) Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GENERIC_BMPCBOX_H_
12 #define _WX_GENERIC_BMPCBOX_H_
13
14
15 #define wxGENERIC_BITMAPCOMBOBOX 1
16
17 #include "wx/odcombo.h"
18
19 // ----------------------------------------------------------------------------
20 // wxBitmapComboBox: a wxComboBox that allows images to be shown
21 // in front of string items.
22 // ----------------------------------------------------------------------------
23
24 class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxOwnerDrawnComboBox,
25 public wxBitmapComboBoxBase
26 {
27 public:
28
29 // ctors and such
30 wxBitmapComboBox() : wxOwnerDrawnComboBox(), wxBitmapComboBoxBase()
31 {
32 Init();
33 }
34
35 wxBitmapComboBox(wxWindow *parent,
36 wxWindowID id = wxID_ANY,
37 const wxString& value = wxEmptyString,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 int n = 0,
41 const wxString choices[] = NULL,
42 long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxBitmapComboBoxNameStr)
45 : wxOwnerDrawnComboBox(),
46 wxBitmapComboBoxBase()
47 {
48 Init();
49
50 (void)Create(parent, id, value, pos, size, n,
51 choices, style, validator, name);
52 }
53
54 wxBitmapComboBox(wxWindow *parent,
55 wxWindowID id,
56 const wxString& value,
57 const wxPoint& pos,
58 const wxSize& size,
59 const wxArrayString& choices,
60 long style,
61 const wxValidator& validator = wxDefaultValidator,
62 const wxString& name = wxBitmapComboBoxNameStr);
63
64 bool Create(wxWindow *parent,
65 wxWindowID id,
66 const wxString& value,
67 const wxPoint& pos,
68 const wxSize& size,
69 int n,
70 const wxString choices[],
71 long style = 0,
72 const wxValidator& validator = wxDefaultValidator,
73 const wxString& name = wxBitmapComboBoxNameStr);
74
75 bool Create(wxWindow *parent,
76 wxWindowID id,
77 const wxString& value,
78 const wxPoint& pos,
79 const wxSize& size,
80 const wxArrayString& choices,
81 long style = 0,
82 const wxValidator& validator = wxDefaultValidator,
83 const wxString& name = wxBitmapComboBoxNameStr);
84
85 virtual ~wxBitmapComboBox();
86
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);
91
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);
99
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);
103
104 protected:
105
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;
110
111 // Event handlers
112 void OnSize(wxSizeEvent& event);
113
114 virtual wxSize DoGetBestSize() const;
115
116 virtual wxItemContainer* GetItemContainer() { return this; }
117 virtual wxWindow* GetControl() { return this; }
118
119 // wxItemContainer implementation
120 virtual int DoInsertItems(const wxArrayStringsAdapter & items,
121 unsigned int pos,
122 void **clientData, wxClientDataType type);
123 virtual void DoClear();
124 virtual void DoDeleteOneItem(unsigned int n);
125
126 private:
127 bool m_inResize;
128
129 void Init();
130
131 DECLARE_EVENT_TABLE()
132
133 DECLARE_DYNAMIC_CLASS(wxBitmapComboBox)
134 };
135
136 #endif // _WX_GENERIC_BMPCBOX_H_