1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/listbox.h
3 // Purpose: wxListBox class declaration
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef __GTKLISTBOXH__
11 #define __GTKLISTBOXH__
15 class WXDLLIMPEXP_BASE wxSortedArrayString
;
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 class WXDLLIMPEXP_CORE wxListBox
: public wxListBoxBase
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
,
31 const wxValidator
& validator
= wxDefaultValidator
,
32 const wxString
& name
= wxListBoxNameStr
)
34 #if wxUSE_CHECKLISTBOX
35 m_hasCheckBoxes
= FALSE
;
36 #endif // wxUSE_CHECKLISTBOX
37 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
39 wxListBox( wxWindow
*parent
, wxWindowID id
,
42 const wxArrayString
& choices
,
44 const wxValidator
& validator
= wxDefaultValidator
,
45 const wxString
& name
= wxListBoxNameStr
)
47 #if wxUSE_CHECKLISTBOX
48 m_hasCheckBoxes
= FALSE
;
49 #endif // wxUSE_CHECKLISTBOX
50 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
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
,
59 const wxValidator
& validator
= wxDefaultValidator
,
60 const wxString
& name
= wxListBoxNameStr
);
61 bool Create(wxWindow
*parent
, wxWindowID id
,
64 const wxArrayString
& choices
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxListBoxNameStr
);
69 // implement base class pure virtuals
71 virtual void Delete(int n
);
73 virtual int GetCount() const;
74 virtual wxString
GetString(int n
) const;
75 virtual void SetString(int n
, const wxString
& s
);
76 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
78 virtual bool IsSelected(int n
) const;
79 virtual int GetSelection() const;
80 virtual int GetSelections(wxArrayInt
& aSelections
) const;
82 static wxVisualAttributes
83 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
85 // implementation from now on
87 void GtkAddItem( const wxString
&item
, int pos
=-1 );
88 int GtkGetIndex( GtkWidget
*item
) const;
89 GtkWidget
*GetConnectWidget();
90 bool IsOwnGtkWindow( GdkWindow
*window
);
91 void OnInternalIdle();
94 void ApplyToolTip( GtkTooltips
*tips
, const wxChar
*tip
);
95 #endif // wxUSE_TOOLTIPS
100 #if wxUSE_CHECKLISTBOX
101 bool m_hasCheckBoxes
;
102 #endif // wxUSE_CHECKLISTBOX
107 virtual void FixUpMouseEvent(GtkWidget
*widget
, wxCoord
& x
, wxCoord
& y
);
110 virtual wxSize
DoGetBestSize() const;
111 virtual void DoSetSelection(int n
, bool select
);
112 virtual int DoAppend(const wxString
& item
);
113 virtual void DoInsertItems(const wxArrayString
& items
, int pos
);
114 virtual void DoSetItems(const wxArrayString
& items
, void **clientData
);
115 virtual void DoSetFirstItem(int n
);
116 virtual void DoSetItemClientData(int n
, void* clientData
);
117 virtual void* DoGetItemClientData(int n
) const;
118 virtual void DoSetItemClientObject(int n
, wxClientData
* clientData
);
119 virtual wxClientData
* DoGetItemClientObject(int n
) const;
120 void DoApplyWidgetStyle(GtkRcStyle
*style
);
122 // return the string label for the given item
123 wxString
GetRealLabel(struct _GList
*item
) const;
125 // Widgets that use the style->base colour for the BG colour should
126 // override this and return true.
127 virtual bool UseGTKStyleBase() const { return true; }
130 // this array is only used for controls with wxCB_SORT style, so only
131 // allocate it if it's needed (hence using pointer)
132 wxSortedArrayString
*m_strings
;
134 DECLARE_DYNAMIC_CLASS(wxListBox
)
137 #endif // __GTKLISTBOXH__