1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/bmpcbox.h
3 // Purpose: wxBitmapComboBox
4 // Author: Jaakko Salli
7 // Copyright: (c) 2008 Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GTK_BMPCBOX_H_
12 #define _WX_GTK_BMPCBOX_H_
15 #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 // Returns the image of the item with the given index.
88 virtual wxBitmap
GetItemBitmap(unsigned int n
) const;
90 // Returns size of the image used in list
91 virtual wxSize
GetBitmapSize() const
96 // Adds item with image to the end of the combo box.
97 int Append(const wxString
& item
, const wxBitmap
& bitmap
= wxNullBitmap
);
98 int Append(const wxString
& item
, const wxBitmap
& bitmap
, void *clientData
);
99 int Append(const wxString
& item
, const wxBitmap
& bitmap
, wxClientData
*clientData
);
101 // Inserts item with image into the list before pos. Not valid for wxCB_SORT
102 // styles, use Append instead.
103 int Insert(const wxString
& item
, const wxBitmap
& bitmap
, unsigned int pos
);
104 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
105 unsigned int pos
, void *clientData
);
106 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
107 unsigned int pos
, wxClientData
*clientData
);
109 // Override some wxTextEntry interface.
110 virtual void WriteText(const wxString
& value
);
112 virtual wxString
GetValue() const;
113 virtual void Remove(long from
, long to
);
115 virtual void SetInsertionPoint(long pos
);
116 virtual long GetInsertionPoint() const;
117 virtual long GetLastPosition() const;
119 virtual void SetSelection(long from
, long to
);
120 virtual void GetSelection(long *from
, long *to
) const;
122 virtual void SetSelection(int n
) { wxComboBox::SetSelection(n
); }
123 virtual int GetSelection() const { return wxComboBox::GetSelection(); }
125 virtual bool IsEditable() const;
126 virtual void SetEditable(bool editable
);
128 virtual GtkWidget
* GetConnectWidget();
131 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
133 virtual void GTKCreateComboBoxWidget();
134 virtual void GTKInsertComboBoxTextItem( unsigned int n
, const wxString
& text
);
136 virtual wxSize
DoGetBestSize() const;
139 int m_bitmapCellIndex
;
144 DECLARE_DYNAMIC_CLASS(wxBitmapComboBox
)
147 #endif // _WX_GTK_BMPCBOX_H_