1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/bmpcbox.h
3 // Purpose: wxBitmapComboBox
4 // Author: Jaakko Salli
6 // Copyright: (c) 2008 Jaakko Salli
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_GTK_BMPCBOX_H_
11 #define _WX_GTK_BMPCBOX_H_
14 #include "wx/combobox.h"
16 // ----------------------------------------------------------------------------
17 // wxBitmapComboBox: a wxComboBox that allows images to be shown
18 // in front of string items.
19 // ----------------------------------------------------------------------------
21 class WXDLLIMPEXP_ADV wxBitmapComboBox
: public wxComboBox
,
22 public wxBitmapComboBoxBase
26 wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase()
31 wxBitmapComboBox(wxWindow
*parent
,
32 wxWindowID id
= wxID_ANY
,
33 const wxString
& value
= wxEmptyString
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
,
37 const wxString choices
[] = NULL
,
39 const wxValidator
& validator
= wxDefaultValidator
,
40 const wxString
& name
= wxBitmapComboBoxNameStr
)
42 wxBitmapComboBoxBase()
46 (void)Create(parent
, id
, value
, pos
, size
, n
,
47 choices
, style
, validator
, name
);
50 wxBitmapComboBox(wxWindow
*parent
,
52 const wxString
& value
,
55 const wxArrayString
& choices
,
57 const wxValidator
& validator
= wxDefaultValidator
,
58 const wxString
& name
= wxBitmapComboBoxNameStr
);
60 bool Create(wxWindow
*parent
,
62 const wxString
& value
,
66 const wxString choices
[],
68 const wxValidator
& validator
= wxDefaultValidator
,
69 const wxString
& name
= wxBitmapComboBoxNameStr
);
71 bool Create(wxWindow
*parent
,
73 const wxString
& value
,
76 const wxArrayString
& choices
,
78 const wxValidator
& validator
= wxDefaultValidator
,
79 const wxString
& name
= wxBitmapComboBoxNameStr
);
81 virtual ~wxBitmapComboBox();
83 // Sets the image for the given item.
84 virtual void SetItemBitmap(unsigned int n
, const wxBitmap
& bitmap
);
86 // Returns the image of the item with the given index.
87 virtual wxBitmap
GetItemBitmap(unsigned int n
) const;
89 // Returns size of the image used in list
90 virtual wxSize
GetBitmapSize() const
95 // Adds item with image to the end of the combo box.
96 int Append(const wxString
& item
, const wxBitmap
& bitmap
= wxNullBitmap
);
97 int Append(const wxString
& item
, const wxBitmap
& bitmap
, void *clientData
);
98 int Append(const wxString
& item
, const wxBitmap
& bitmap
, wxClientData
*clientData
);
100 // Inserts item with image into the list before pos. Not valid for wxCB_SORT
101 // styles, use Append instead.
102 int Insert(const wxString
& item
, const wxBitmap
& bitmap
, unsigned int pos
);
103 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
104 unsigned int pos
, void *clientData
);
105 int Insert(const wxString
& item
, const wxBitmap
& bitmap
,
106 unsigned int pos
, wxClientData
*clientData
);
108 // Override some wxTextEntry interface.
109 virtual void WriteText(const wxString
& value
);
111 virtual wxString
GetValue() const;
112 virtual void Remove(long from
, long to
);
114 virtual void SetInsertionPoint(long pos
);
115 virtual long GetInsertionPoint() const;
116 virtual long GetLastPosition() const;
118 virtual void SetSelection(long from
, long to
);
119 virtual void GetSelection(long *from
, long *to
) const;
121 virtual void SetSelection(int n
) { wxComboBox::SetSelection(n
); }
122 virtual int GetSelection() const { return wxComboBox::GetSelection(); }
124 virtual bool IsEditable() const;
125 virtual void SetEditable(bool editable
);
127 virtual GtkWidget
* GetConnectWidget();
130 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
132 virtual void GTKCreateComboBoxWidget();
133 virtual void GTKInsertComboBoxTextItem( unsigned int n
, const wxString
& text
);
135 virtual wxSize
DoGetBestSize() const;
138 int m_bitmapCellIndex
;
143 DECLARE_DYNAMIC_CLASS(wxBitmapComboBox
)
146 #endif // _WX_GTK_BMPCBOX_H_