]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/bmpcbox.h
fixing a few typos, wxAny copy constructor implementation, making wxAnyList available...
[wxWidgets.git] / include / wx / msw / bmpcbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/bmpcbox.h
3 // Purpose: wxBitmapComboBox
4 // Author: Jaakko Salli
5 // Created: 2008-04-06
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MSW_BMPCBOX_H_
12 #define _WX_MSW_BMPCBOX_H_
13
14
15 #include "wx/combobox.h"
16
17
18 // ----------------------------------------------------------------------------
19 // wxBitmapComboBox: a wxComboBox that allows images to be shown
20 // in front of string items.
21 // ----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxComboBox,
24 public wxBitmapComboBoxBase
25 {
26 public:
27 // ctors and such
28 wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase()
29 {
30 Init();
31 }
32
33 wxBitmapComboBox(wxWindow *parent,
34 wxWindowID id = wxID_ANY,
35 const wxString& value = wxEmptyString,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
38 int n = 0,
39 const wxString choices[] = NULL,
40 long style = 0,
41 const wxValidator& validator = wxDefaultValidator,
42 const wxString& name = wxBitmapComboBoxNameStr)
43 : wxComboBox(),
44 wxBitmapComboBoxBase()
45 {
46 Init();
47
48 (void)Create(parent, id, value, pos, size, n,
49 choices, style, validator, name);
50 }
51
52 wxBitmapComboBox(wxWindow *parent,
53 wxWindowID id,
54 const wxString& value,
55 const wxPoint& pos,
56 const wxSize& size,
57 const wxArrayString& choices,
58 long style,
59 const wxValidator& validator = wxDefaultValidator,
60 const wxString& name = wxBitmapComboBoxNameStr);
61
62 bool Create(wxWindow *parent,
63 wxWindowID id,
64 const wxString& value,
65 const wxPoint& pos,
66 const wxSize& size,
67 int n,
68 const wxString choices[],
69 long style = 0,
70 const wxValidator& validator = wxDefaultValidator,
71 const wxString& name = wxBitmapComboBoxNameStr);
72
73 bool Create(wxWindow *parent,
74 wxWindowID id,
75 const wxString& value,
76 const wxPoint& pos,
77 const wxSize& size,
78 const wxArrayString& choices,
79 long style = 0,
80 const wxValidator& validator = wxDefaultValidator,
81 const wxString& name = wxBitmapComboBoxNameStr);
82
83 virtual ~wxBitmapComboBox();
84
85 // Sets the image for the given item.
86 virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
87
88 virtual bool SetFont(const wxFont& font);
89
90 // Adds item with image to the end of the combo box.
91 int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap);
92 int Append(const wxString& item, const wxBitmap& bitmap, void *clientData);
93 int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData);
94
95 // Inserts item with image into the list before pos. Not valid for wxCB_SORT
96 // styles, use Append instead.
97 int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos);
98 int Insert(const wxString& item, const wxBitmap& bitmap,
99 unsigned int pos, void *clientData);
100 int Insert(const wxString& item, const wxBitmap& bitmap,
101 unsigned int pos, wxClientData *clientData);
102
103 protected:
104
105 WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
106 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
107 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item);
108
109 // Event handlers
110 void OnSize(wxSizeEvent& event);
111
112 virtual wxItemContainer* GetItemContainer() { return this; }
113 virtual wxWindow* GetControl() { return this; }
114
115 // wxItemContainer implementation
116 virtual int DoInsertItems(const wxArrayStringsAdapter & items,
117 unsigned int pos,
118 void **clientData, wxClientDataType type);
119 virtual void DoClear();
120 virtual void DoDeleteOneItem(unsigned int n);
121
122 virtual bool OnAddBitmap(const wxBitmap& bitmap);
123 virtual wxSize DoGetBestSize() const;
124 void RecreateControl();
125
126 private:
127 void Init();
128
129 bool m_inResize;
130
131 DECLARE_EVENT_TABLE()
132
133 DECLARE_DYNAMIC_CLASS(wxBitmapComboBox)
134 };
135
136 #endif // _WX_MSW_BMPCBOX_H_