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