]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/bmpcbox.h
declare future-deprecated SetStyle(int) in wxPen/Brush and not wxPen/BrushBase as...
[wxWidgets.git] / include / wx / gtk / bmpcbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/bmpcbox.h
3 // Purpose: wxBitmapComboBox
4 // Author: Jaakko Salli
5 // Created: 2008-05-19
6 // RCS-ID: $Id:
7 // Copyright: (c) 2008 Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GTK_BMPCBOX_H_
12 #define _WX_GTK_BMPCBOX_H_
13
14
15 #include "wx/combobox.h"
16
17 // ----------------------------------------------------------------------------
18 // wxBitmapComboBox: a wxComboBox that allows images to be shown
19 // in front of string items.
20 // ----------------------------------------------------------------------------
21
22 class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxComboBox,
23 public wxBitmapComboBoxBase
24 {
25 public:
26 // ctors and such
27 wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase()
28 {
29 Init();
30 }
31
32 wxBitmapComboBox(wxWindow *parent,
33 wxWindowID id = wxID_ANY,
34 const wxString& value = wxEmptyString,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 int n = 0,
38 const wxString choices[] = NULL,
39 long style = 0,
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxBitmapComboBoxNameStr)
42 : wxComboBox(),
43 wxBitmapComboBoxBase()
44 {
45 Init();
46
47 (void)Create(parent, id, value, pos, size, n,
48 choices, style, validator, name);
49 }
50
51 wxBitmapComboBox(wxWindow *parent,
52 wxWindowID id,
53 const wxString& value,
54 const wxPoint& pos,
55 const wxSize& size,
56 const wxArrayString& choices,
57 long style,
58 const wxValidator& validator = wxDefaultValidator,
59 const wxString& name = wxBitmapComboBoxNameStr);
60
61 bool Create(wxWindow *parent,
62 wxWindowID id,
63 const wxString& value,
64 const wxPoint& pos,
65 const wxSize& size,
66 int n,
67 const wxString choices[],
68 long style = 0,
69 const wxValidator& validator = wxDefaultValidator,
70 const wxString& name = wxBitmapComboBoxNameStr);
71
72 bool Create(wxWindow *parent,
73 wxWindowID id,
74 const wxString& value,
75 const wxPoint& pos,
76 const wxSize& size,
77 const wxArrayString& choices,
78 long style = 0,
79 const wxValidator& validator = wxDefaultValidator,
80 const wxString& name = wxBitmapComboBoxNameStr);
81
82 virtual ~wxBitmapComboBox();
83
84 // Sets the image for the given item.
85 virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
86
87 // Returns the image of the item with the given index.
88 virtual wxBitmap GetItemBitmap(unsigned int n) const;
89
90 // Returns size of the image used in list
91 virtual wxSize GetBitmapSize() const
92 {
93 return m_bitmapSize;
94 }
95
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);
100
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);
108
109 // Override some wxTextEntry interface.
110 virtual void WriteText(const wxString& value);
111
112 virtual wxString GetValue() const;
113 virtual void Remove(long from, long to);
114
115 virtual void SetInsertionPoint(long pos);
116 virtual long GetInsertionPoint() const;
117 virtual long GetLastPosition() const;
118
119 virtual void SetSelection(long from, long to);
120 virtual void GetSelection(long *from, long *to) const;
121
122 virtual void SetSelection(int n) { wxComboBox::SetSelection(n); }
123 virtual int GetSelection() const { return wxComboBox::GetSelection(); }
124
125 virtual bool IsEditable() const;
126 virtual void SetEditable(bool editable);
127
128 protected:
129
130 virtual GtkWidget* GetConnectWidget();
131 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
132
133 virtual void GTKCreateComboBoxWidget();
134 virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text );
135
136 wxSize m_bitmapSize;
137 int m_bitmapCellIndex;
138
139 private:
140 void Init();
141
142 DECLARE_DYNAMIC_CLASS(wxBitmapComboBox)
143 };
144
145 #endif // _WX_GTK_BMPCBOX_H_