1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/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 typedef struct _GtkList GtkList
;
17 class WXDLLIMPEXP_FWD_BASE wxSortedArrayString
;
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 class WXDLLIMPEXP_CORE wxListBox
: public wxListBoxBase
28 wxListBox( wxWindow
*parent
, wxWindowID id
,
29 const wxPoint
& pos
= wxDefaultPosition
,
30 const wxSize
& size
= wxDefaultSize
,
31 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
33 const wxValidator
& validator
= wxDefaultValidator
,
34 const wxString
& name
= wxListBoxNameStr
)
36 #if wxUSE_CHECKLISTBOX
37 m_hasCheckBoxes
= false;
38 #endif // wxUSE_CHECKLISTBOX
39 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
41 wxListBox( wxWindow
*parent
, wxWindowID id
,
44 const wxArrayString
& choices
,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxListBoxNameStr
)
49 #if wxUSE_CHECKLISTBOX
50 m_hasCheckBoxes
= false;
51 #endif // wxUSE_CHECKLISTBOX
52 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
56 bool Create(wxWindow
*parent
, wxWindowID id
,
57 const wxPoint
& pos
= wxDefaultPosition
,
58 const wxSize
& size
= wxDefaultSize
,
59 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxListBoxNameStr
);
63 bool Create(wxWindow
*parent
, wxWindowID id
,
66 const wxArrayString
& choices
,
68 const wxValidator
& validator
= wxDefaultValidator
,
69 const wxString
& name
= wxListBoxNameStr
);
71 // implement base class pure virtuals
72 virtual void DoClear();
73 virtual void DoDeleteOneItem(unsigned int n
);
75 virtual unsigned int GetCount() const;
76 virtual wxString
GetString(unsigned int n
) const;
77 virtual void SetString(unsigned int n
, const wxString
& s
);
78 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
80 virtual bool IsSelected(int n
) const;
81 virtual void DoSetSelection(int n
, bool select
);
82 virtual int GetSelection() const;
83 virtual int GetSelections(wxArrayInt
& aSelections
) const;
85 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
87 void **clientData
, wxClientDataType type
);
89 virtual void DoSetFirstItem(int n
);
91 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
92 virtual void* DoGetItemClientData(unsigned int n
) const;
94 static wxVisualAttributes
95 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
97 // implementation from now on
99 void GtkAddItem( const wxString
&item
, int pos
=-1 );
100 int GtkGetIndex( GtkWidget
*item
) const;
101 GtkWidget
*GetConnectWidget();
102 bool IsOwnGtkWindow( GdkWindow
*window
);
103 void DoApplyWidgetStyle(GtkRcStyle
*style
);
104 void OnInternalIdle();
107 void ApplyToolTip( GtkTooltips
*tips
, const wxChar
*tip
);
108 #endif // wxUSE_TOOLTIPS
113 #if wxUSE_CHECKLISTBOX
114 bool m_hasCheckBoxes
;
115 #endif // wxUSE_CHECKLISTBOX
120 virtual void FixUpMouseEvent(GtkWidget
*widget
, wxCoord
& x
, wxCoord
& y
);
123 virtual wxSize
DoGetBestSize() const;
125 // return the string label for the given item
126 wxString
GetRealLabel(struct _GList
*item
) const;
128 // Widgets that use the style->base colour for the BG colour should
129 // override this and return true.
130 virtual bool UseGTKStyleBase() const { return true; }
133 // this array is only used for controls with wxCB_SORT style, so only
134 // allocate it if it's needed (hence using pointer)
135 wxSortedArrayString
*m_strings
;
137 DECLARE_DYNAMIC_CLASS(wxListBox
)
140 #endif // __GTKLISTBOXH__