]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/listbox.h
No real changes, just make wxWindow::CanScroll() virtual.
[wxWidgets.git] / include / wx / gtk / listbox.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
853dcc57 2// Name: wx/gtk/listbox.h
ff8bfdbb 3// Purpose: wxListBox class declaration
c801d85f 4// Author: Robert Roebling
58614078 5// Copyright: (c) 1998 Robert Roebling
65571936 6// Licence: wxWindows licence
c801d85f
KB
7/////////////////////////////////////////////////////////////////////////////
8
0d5f4ba3
VZ
9#ifndef _WX_GTK_LISTBOX_H_
10#define _WX_GTK_LISTBOX_H_
11
633e1930 12struct _wxTreeEntry;
0d5f4ba3 13struct _GtkTreeIter;
c801d85f 14
c801d85f
KB
15//-----------------------------------------------------------------------------
16// wxListBox
17//-----------------------------------------------------------------------------
18
20123d49 19class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
c801d85f 20{
fd0eed64 21public:
2ee3ee1b 22 // ctors and such
b6e5dfef
JS
23 wxListBox()
24 {
25 Init();
26 }
ff8bfdbb
VZ
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,
31 long style = 0,
32 const wxValidator& validator = wxDefaultValidator,
33 const wxString& name = wxListBoxNameStr )
34 {
b6e5dfef 35 Init();
ff8bfdbb
VZ
36 Create(parent, id, pos, size, n, choices, style, validator, name);
37 }
584ad2a3
MB
38 wxListBox( wxWindow *parent, wxWindowID id,
39 const wxPoint& pos,
40 const wxSize& size,
41 const wxArrayString& choices,
42 long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxListBoxNameStr )
45 {
b6e5dfef 46 Init();
584ad2a3
MB
47 Create(parent, id, pos, size, choices, style, validator, name);
48 }
ff8bfdbb
VZ
49 virtual ~wxListBox();
50
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,
55 long style = 0,
56 const wxValidator& validator = wxDefaultValidator,
57 const wxString& name = wxListBoxNameStr);
584ad2a3
MB
58 bool Create(wxWindow *parent, wxWindowID id,
59 const wxPoint& pos,
60 const wxSize& size,
61 const wxArrayString& choices,
62 long style = 0,
63 const wxValidator& validator = wxDefaultValidator,
64 const wxString& name = wxListBoxNameStr);
ff8bfdbb 65
aa61d352
VZ
66 virtual unsigned int GetCount() const;
67 virtual wxString GetString(unsigned int n) const;
68 virtual void SetString(unsigned int n, const wxString& s);
853dcc57 69 virtual int FindString(const wxString& s, bool bCase = false) const;
2ee3ee1b
VZ
70
71 virtual bool IsSelected(int n) const;
2ee3ee1b
VZ
72 virtual int GetSelection() const;
73 virtual int GetSelections(wxArrayInt& aSelections) const;
74
0d29a482
VZ
75 virtual void EnsureVisible(int n);
76
937fc7db
RR
77 virtual void Update();
78
9d522606
RD
79 static wxVisualAttributes
80 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
853dcc57 81
2ee3ee1b 82 // implementation from now on
c801d85f 83
558a94bd 84 virtual GtkWidget *GetConnectWidget();
ff8bfdbb 85
4a46cbe8
RR
86 struct _GtkTreeView *m_treeview;
87 struct _GtkListStore *m_liststore;
88ac883a
VZ
88
89#if wxUSE_CHECKLISTBOX
ff8bfdbb 90 bool m_hasCheckBoxes;
88ac883a 91#endif // wxUSE_CHECKLISTBOX
c801d85f 92
633e1930 93 struct _wxTreeEntry* GTKGetEntry(unsigned pos) const;
1e6ffd66 94
dec7b5a8
RR
95 void GTKDisableEvents();
96 void GTKEnableEvents();
3ae4c570 97
24ee1bef 98 void GTKOnSelectionChanged();
09e744f5 99 void GTKOnActivated(int item);
24ee1bef 100
f68586e5 101protected:
3c75d8ba
PC
102 virtual void DoClear();
103 virtual void DoDeleteOneItem(unsigned int n);
f68586e5 104 virtual wxSize DoGetBestSize() const;
ef5c70f9
VZ
105 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
106 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
107
6f02a879 108 virtual void DoSetSelection(int n, bool select);
a236aa20
VZ
109
110 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
111 unsigned int pos,
112 void **clientData, wxClientDataType type);
8e125ff1 113 virtual int DoInsertOneItem(const wxString& item, unsigned int pos);
a236aa20 114
6f02a879 115 virtual void DoSetFirstItem(int n);
aa61d352
VZ
116 virtual void DoSetItemClientData(unsigned int n, void* clientData);
117 virtual void* DoGetItemClientData(unsigned int n) const;
c00fed0e
VZ
118 virtual int DoListHitTest(const wxPoint& point) const;
119
0d5f4ba3 120 // get the iterator for the given index, returns false if invalid
dec7b5a8 121 bool GTKGetIteratorFor(unsigned pos, _GtkTreeIter *iter) const;
0d5f4ba3
VZ
122
123 // get the index for the given iterator, return wxNOT_FOUND on failure
dec7b5a8 124 int GTKGetIndexFor(_GtkTreeIter& iter) const;
0d5f4ba3 125
0d29a482
VZ
126 // common part of DoSetFirstItem() and EnsureVisible()
127 void DoScrollToCell(int n, float alignY, float alignX);
128
2ee3ee1b 129private:
b7e37e55
WS
130 void Init(); //common construction
131
2ee3ee1b
VZ
132 DECLARE_DYNAMIC_CLASS(wxListBox)
133};
dcf924a3 134
0d5f4ba3 135#endif // _WX_GTK_LISTBOX_H_