]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
8ef94bfc | 2 | // Name: wx/gtk1/listbox.h |
ff8bfdbb | 3 | // Purpose: wxListBox class declaration |
c801d85f | 4 | // Author: Robert Roebling |
58614078 RR |
5 | // Id: $Id$ |
6 | // Copyright: (c) 1998 Robert Roebling | |
65571936 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
c801d85f KB |
10 | #ifndef __GTKLISTBOXH__ |
11 | #define __GTKLISTBOXH__ | |
12 | ||
c801d85f | 13 | #include "wx/list.h" |
c801d85f | 14 | |
b5dbe15d | 15 | class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; |
b5f6b52a | 16 | |
c801d85f KB |
17 | //----------------------------------------------------------------------------- |
18 | // wxListBox | |
19 | //----------------------------------------------------------------------------- | |
20 | ||
20123d49 | 21 | class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase |
c801d85f | 22 | { |
fd0eed64 | 23 | public: |
2ee3ee1b | 24 | // ctors and such |
ff8bfdbb VZ |
25 | wxListBox(); |
26 | wxListBox( wxWindow *parent, wxWindowID id, | |
27 | const wxPoint& pos = wxDefaultPosition, | |
28 | const wxSize& size = wxDefaultSize, | |
29 | int n = 0, const wxString choices[] = (const wxString *) NULL, | |
30 | long style = 0, | |
31 | const wxValidator& validator = wxDefaultValidator, | |
32 | const wxString& name = wxListBoxNameStr ) | |
33 | { | |
88ac883a | 34 | #if wxUSE_CHECKLISTBOX |
caf6e6de | 35 | m_hasCheckBoxes = false; |
88ac883a | 36 | #endif // wxUSE_CHECKLISTBOX |
ff8bfdbb VZ |
37 | Create(parent, id, pos, size, n, choices, style, validator, name); |
38 | } | |
584ad2a3 MB |
39 | wxListBox( wxWindow *parent, wxWindowID id, |
40 | const wxPoint& pos, | |
41 | const wxSize& size, | |
42 | const wxArrayString& choices, | |
43 | long style = 0, | |
44 | const wxValidator& validator = wxDefaultValidator, | |
45 | const wxString& name = wxListBoxNameStr ) | |
46 | { | |
47 | #if wxUSE_CHECKLISTBOX | |
caf6e6de | 48 | m_hasCheckBoxes = false; |
584ad2a3 MB |
49 | #endif // wxUSE_CHECKLISTBOX |
50 | Create(parent, id, pos, size, choices, style, validator, name); | |
51 | } | |
ff8bfdbb VZ |
52 | virtual ~wxListBox(); |
53 | ||
54 | bool Create(wxWindow *parent, wxWindowID id, | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | int n = 0, const wxString choices[] = (const wxString *) NULL, | |
58 | long style = 0, | |
59 | const wxValidator& validator = wxDefaultValidator, | |
60 | const wxString& name = wxListBoxNameStr); | |
584ad2a3 MB |
61 | bool Create(wxWindow *parent, wxWindowID id, |
62 | const wxPoint& pos, | |
63 | const wxSize& size, | |
64 | const wxArrayString& choices, | |
65 | long style = 0, | |
66 | const wxValidator& validator = wxDefaultValidator, | |
67 | const wxString& name = wxListBoxNameStr); | |
ff8bfdbb | 68 | |
2ee3ee1b | 69 | // implement base class pure virtuals |
a236aa20 VZ |
70 | virtual void DoClear(); |
71 | virtual void DoDeleteOneItem(unsigned int n); | |
2ee3ee1b | 72 | |
aa61d352 VZ |
73 | virtual unsigned int GetCount() const; |
74 | virtual wxString GetString(unsigned int n) const; | |
75 | virtual void SetString(unsigned int n, const wxString& s); | |
853dcc57 | 76 | virtual int FindString(const wxString& s, bool bCase = false) const; |
2ee3ee1b VZ |
77 | |
78 | virtual bool IsSelected(int n) const; | |
c6179a84 | 79 | virtual void DoSetSelection(int n, bool select); |
2ee3ee1b VZ |
80 | virtual int GetSelection() const; |
81 | virtual int GetSelections(wxArrayInt& aSelections) const; | |
82 | ||
a236aa20 VZ |
83 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, |
84 | unsigned int pos, | |
85 | void **clientData, wxClientDataType type); | |
2ee3ee1b VZ |
86 | |
87 | virtual void DoSetFirstItem(int n); | |
88 | ||
aa61d352 VZ |
89 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
90 | virtual void* DoGetItemClientData(unsigned int n) const; | |
2ee3ee1b | 91 | |
9d522606 RD |
92 | static wxVisualAttributes |
93 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
853dcc57 | 94 | |
2ee3ee1b | 95 | // implementation from now on |
c801d85f | 96 | |
11e1c70d RR |
97 | void GtkAddItem( const wxString &item, int pos=-1 ); |
98 | int GtkGetIndex( GtkWidget *item ) const; | |
ff8bfdbb VZ |
99 | GtkWidget *GetConnectWidget(); |
100 | bool IsOwnGtkWindow( GdkWindow *window ); | |
f40fdaa3 | 101 | void DoApplyWidgetStyle(GtkRcStyle *style); |
5e014a0c | 102 | void OnInternalIdle(); |
ff8bfdbb VZ |
103 | |
104 | #if wxUSE_TOOLTIPS | |
4de6207a | 105 | void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); |
ff8bfdbb VZ |
106 | #endif // wxUSE_TOOLTIPS |
107 | ||
108 | GtkList *m_list; | |
11e1c70d | 109 | wxList m_clientList; |
88ac883a VZ |
110 | |
111 | #if wxUSE_CHECKLISTBOX | |
ff8bfdbb | 112 | bool m_hasCheckBoxes; |
88ac883a | 113 | #endif // wxUSE_CHECKLISTBOX |
c801d85f | 114 | |
bac95742 RR |
115 | int m_prevSelection; |
116 | bool m_blockEvent; | |
8161b5b9 | 117 | |
3ae4c570 VZ |
118 | virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y); |
119 | ||
f68586e5 VZ |
120 | protected: |
121 | virtual wxSize DoGetBestSize() const; | |
122 | ||
8161b5b9 VZ |
123 | // return the string label for the given item |
124 | wxString GetRealLabel(struct _GList *item) const; | |
125 | ||
9d522606 RD |
126 | // Widgets that use the style->base colour for the BG colour should |
127 | // override this and return true. | |
128 | virtual bool UseGTKStyleBase() const { return true; } | |
129 | ||
2ee3ee1b VZ |
130 | private: |
131 | // this array is only used for controls with wxCB_SORT style, so only | |
132 | // allocate it if it's needed (hence using pointer) | |
133 | wxSortedArrayString *m_strings; | |
134 | ||
135 | DECLARE_DYNAMIC_CLASS(wxListBox) | |
136 | }; | |
dcf924a3 | 137 | |
c801d85f | 138 | #endif // __GTKLISTBOXH__ |