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