1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/listbox.h
3 // Purpose: wxListBox class declaration
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef _WX_GTK_LISTBOX_H_
10 #define _WX_GTK_LISTBOX_H_
15 //-----------------------------------------------------------------------------
17 //-----------------------------------------------------------------------------
19 class WXDLLIMPEXP_CORE wxListBox
: public wxListBoxBase
27 wxListBox( wxWindow
*parent
, wxWindowID id
,
28 const wxPoint
& pos
= wxDefaultPosition
,
29 const wxSize
& size
= wxDefaultSize
,
30 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
32 const wxValidator
& validator
= wxDefaultValidator
,
33 const wxString
& name
= wxListBoxNameStr
)
36 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
38 wxListBox( wxWindow
*parent
, wxWindowID id
,
41 const wxArrayString
& choices
,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxListBoxNameStr
)
47 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
51 bool Create(wxWindow
*parent
, wxWindowID id
,
52 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxSize
& size
= wxDefaultSize
,
54 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
56 const wxValidator
& validator
= wxDefaultValidator
,
57 const wxString
& name
= wxListBoxNameStr
);
58 bool Create(wxWindow
*parent
, wxWindowID id
,
61 const wxArrayString
& choices
,
63 const wxValidator
& validator
= wxDefaultValidator
,
64 const wxString
& name
= wxListBoxNameStr
);
66 virtual unsigned int GetCount() const;
67 virtual wxString
GetString(unsigned int n
) const;
68 virtual void SetString(unsigned int n
, const wxString
& s
);
69 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
71 virtual bool IsSelected(int n
) const;
72 virtual int GetSelection() const;
73 virtual int GetSelections(wxArrayInt
& aSelections
) const;
75 virtual void EnsureVisible(int n
);
77 virtual void Update();
79 static wxVisualAttributes
80 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
82 // implementation from now on
84 virtual GtkWidget
*GetConnectWidget();
86 struct _GtkTreeView
*m_treeview
;
87 struct _GtkListStore
*m_liststore
;
89 #if wxUSE_CHECKLISTBOX
91 #endif // wxUSE_CHECKLISTBOX
93 struct _wxTreeEntry
* GTKGetEntry(unsigned pos
) const;
95 void GTKDisableEvents();
96 void GTKEnableEvents();
98 void GTKOnSelectionChanged();
99 void GTKOnActivated(int item
);
102 virtual void DoClear();
103 virtual void DoDeleteOneItem(unsigned int n
);
104 virtual wxSize
DoGetBestSize() const;
105 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
106 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
108 virtual void DoSetSelection(int n
, bool select
);
110 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
112 void **clientData
, wxClientDataType type
);
113 virtual int DoInsertOneItem(const wxString
& item
, unsigned int pos
);
115 virtual void DoSetFirstItem(int n
);
116 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
117 virtual void* DoGetItemClientData(unsigned int n
) const;
118 virtual int DoListHitTest(const wxPoint
& point
) const;
120 // get the iterator for the given index, returns false if invalid
121 bool GTKGetIteratorFor(unsigned pos
, _GtkTreeIter
*iter
) const;
123 // get the index for the given iterator, return wxNOT_FOUND on failure
124 int GTKGetIndexFor(_GtkTreeIter
& iter
) const;
126 // common part of DoSetFirstItem() and EnsureVisible()
127 void DoScrollToCell(int n
, float alignY
, float alignX
);
130 void Init(); //common construction
132 DECLARE_DYNAMIC_CLASS(wxListBox
)
135 #endif // _WX_GTK_LISTBOX_H_