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 class WXDLLIMPEXP_FWD_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
70 virtual void DoClear();
71 virtual void DoDeleteOneItem(unsigned int n
);
73 virtual unsigned int GetCount() const;
74 virtual wxString
GetString(unsigned int n
) const;
75 virtual void SetString(unsigned 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 void DoSetSelection(int n
, bool select
);
80 virtual int GetSelection() const;
81 virtual int GetSelections(wxArrayInt
& aSelections
) const;
83 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
85 void **clientData
, wxClientDataType type
);
87 virtual void DoSetFirstItem(int n
);
89 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
90 virtual void* DoGetItemClientData(unsigned int n
) const;
92 static wxVisualAttributes
93 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
95 // implementation from now on
97 void GtkAddItem( const wxString
&item
, int pos
=-1 );
98 int GtkGetIndex( GtkWidget
*item
) const;
99 GtkWidget
*GetConnectWidget();
100 bool IsOwnGtkWindow( GdkWindow
*window
);
101 void DoApplyWidgetStyle(GtkRcStyle
*style
);
102 void OnInternalIdle();
105 void ApplyToolTip( GtkTooltips
*tips
, const wxChar
*tip
);
106 #endif // wxUSE_TOOLTIPS
111 #if wxUSE_CHECKLISTBOX
112 bool m_hasCheckBoxes
;
113 #endif // wxUSE_CHECKLISTBOX
118 virtual void FixUpMouseEvent(GtkWidget
*widget
, wxCoord
& x
, wxCoord
& y
);
121 virtual wxSize
DoGetBestSize() const;
123 // return the string label for the given item
124 wxString
GetRealLabel(struct _GList
*item
) const;
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; }
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
;
135 DECLARE_DYNAMIC_CLASS(wxListBox
)
138 #endif // __GTKLISTBOXH__