1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxListBox class declaration
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __GTKLISTBOXH__
12 #define __GTKLISTBOXH__
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15 #pragma interface "listbox.h"
20 class WXDLLIMPEXP_BASE wxSortedArrayString
;
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 class wxListBox
: public wxListBoxBase
31 wxListBox( wxWindow
*parent
, wxWindowID id
,
32 const wxPoint
& pos
= wxDefaultPosition
,
33 const wxSize
& size
= wxDefaultSize
,
34 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
36 const wxValidator
& validator
= wxDefaultValidator
,
37 const wxString
& name
= wxListBoxNameStr
)
39 #if wxUSE_CHECKLISTBOX
40 m_hasCheckBoxes
= FALSE
;
41 #endif // wxUSE_CHECKLISTBOX
42 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
44 wxListBox( wxWindow
*parent
, wxWindowID id
,
47 const wxArrayString
& choices
,
49 const wxValidator
& validator
= wxDefaultValidator
,
50 const wxString
& name
= wxListBoxNameStr
)
52 #if wxUSE_CHECKLISTBOX
53 m_hasCheckBoxes
= FALSE
;
54 #endif // wxUSE_CHECKLISTBOX
55 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
59 bool Create(wxWindow
*parent
, wxWindowID id
,
60 const wxPoint
& pos
= wxDefaultPosition
,
61 const wxSize
& size
= wxDefaultSize
,
62 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
64 const wxValidator
& validator
= wxDefaultValidator
,
65 const wxString
& name
= wxListBoxNameStr
);
66 bool Create(wxWindow
*parent
, wxWindowID id
,
69 const wxArrayString
& choices
,
71 const wxValidator
& validator
= wxDefaultValidator
,
72 const wxString
& name
= wxListBoxNameStr
);
74 // implement base class pure virtuals
76 virtual void Delete(int n
);
78 virtual int GetCount() const;
79 virtual wxString
GetString(int n
) const;
80 virtual void SetString(int n
, const wxString
& s
);
81 virtual int FindString(const wxString
& s
) const;
83 virtual bool IsSelected(int n
) const;
84 virtual void SetSelection(int n
, bool select
= TRUE
);
85 virtual int GetSelection() const;
86 virtual int GetSelections(wxArrayInt
& aSelections
) const;
88 virtual int DoAppend(const wxString
& item
);
89 virtual void DoInsertItems(const wxArrayString
& items
, int pos
);
90 virtual void DoSetItems(const wxArrayString
& items
, void **clientData
);
92 virtual void DoSetFirstItem(int n
);
94 virtual void DoSetItemClientData(int n
, void* clientData
);
95 virtual void* DoGetItemClientData(int n
) const;
96 virtual void DoSetItemClientObject(int n
, wxClientData
* clientData
);
97 virtual wxClientData
* DoGetItemClientObject(int n
) const;
99 static wxVisualAttributes
100 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
102 // implementation from now on
104 void GtkAddItem( const wxString
&item
, int pos
=-1 );
105 int GtkGetIndex( GtkWidget
*item
) const;
106 GtkWidget
*GetConnectWidget();
107 bool IsOwnGtkWindow( GdkWindow
*window
);
108 void ApplyWidgetStyle();
109 void OnInternalIdle();
112 void ApplyToolTip( GtkTooltips
*tips
, const wxChar
*tip
);
113 #endif // wxUSE_TOOLTIPS
118 #if wxUSE_CHECKLISTBOX
119 bool m_hasCheckBoxes
;
120 #endif // wxUSE_CHECKLISTBOX
125 virtual void FixUpMouseEvent(GtkWidget
*widget
, wxCoord
& x
, wxCoord
& y
);
128 virtual wxSize
DoGetBestSize() const;
130 // return the string label for the given item
131 wxString
GetRealLabel(struct _GList
*item
) const;
133 // Widgets that use the style->base colour for the BG colour should
134 // override this and return true.
135 virtual bool UseGTKStyleBase() const { return true; }
138 // this array is only used for controls with wxCB_SORT style, so only
139 // allocate it if it's needed (hence using pointer)
140 wxSortedArrayString
*m_strings
;
142 DECLARE_DYNAMIC_CLASS(wxListBox
)
145 #endif // __GTKLISTBOXH__