]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/gtk/listbox.h | |
3 | // Purpose: wxListBox class declaration | |
4 | // Author: Robert Roebling | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_GTK_LISTBOX_H_ | |
11 | #define _WX_GTK_LISTBOX_H_ | |
12 | ||
13 | struct _GtkTreeEntry; | |
14 | struct _GtkTreeIter; | |
15 | ||
16 | //----------------------------------------------------------------------------- | |
17 | // wxListBox | |
18 | //----------------------------------------------------------------------------- | |
19 | ||
20 | class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase | |
21 | { | |
22 | public: | |
23 | // ctors and such | |
24 | wxListBox() | |
25 | { | |
26 | Init(); | |
27 | } | |
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 | { | |
36 | Init(); | |
37 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
38 | } | |
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 | { | |
47 | Init(); | |
48 | Create(parent, id, pos, size, choices, style, validator, name); | |
49 | } | |
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); | |
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); | |
66 | ||
67 | virtual unsigned int GetCount() const; | |
68 | virtual wxString GetString(unsigned int n) const; | |
69 | virtual void SetString(unsigned int n, const wxString& s); | |
70 | virtual int FindString(const wxString& s, bool bCase = false) const; | |
71 | ||
72 | virtual bool IsSelected(int n) const; | |
73 | virtual int GetSelection() const; | |
74 | virtual int GetSelections(wxArrayInt& aSelections) const; | |
75 | ||
76 | virtual void EnsureVisible(int n); | |
77 | ||
78 | static wxVisualAttributes | |
79 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
80 | ||
81 | // implementation from now on | |
82 | ||
83 | GtkWidget *GetConnectWidget(); | |
84 | ||
85 | #if wxUSE_TOOLTIPS | |
86 | void ApplyToolTip( GtkTooltips *tips, const gchar *tip ); | |
87 | #endif // wxUSE_TOOLTIPS | |
88 | ||
89 | struct _GtkTreeView *m_treeview; | |
90 | struct _GtkListStore *m_liststore; | |
91 | ||
92 | #if wxUSE_CHECKLISTBOX | |
93 | bool m_hasCheckBoxes; | |
94 | #endif // wxUSE_CHECKLISTBOX | |
95 | ||
96 | struct _GtkTreeEntry* GtkGetEntry(unsigned pos) const; | |
97 | ||
98 | void GtkDisableEvents(); | |
99 | void GtkEnableEvents(); | |
100 | ||
101 | protected: | |
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; | |
107 | ||
108 | virtual void DoSetSelection(int n, bool select); | |
109 | ||
110 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, | |
111 | unsigned int pos, | |
112 | void **clientData, wxClientDataType type); | |
113 | ||
114 | virtual void DoSetFirstItem(int n); | |
115 | virtual void DoSetItemClientData(unsigned int n, void* clientData); | |
116 | virtual void* DoGetItemClientData(unsigned int n) const; | |
117 | virtual int DoListHitTest(const wxPoint& point) const; | |
118 | ||
119 | // get the iterator for the given index, returns false if invalid | |
120 | bool GtkGetIteratorFor(unsigned pos, _GtkTreeIter *iter) const; | |
121 | ||
122 | // get the index for the given iterator, return wxNOT_FOUND on failure | |
123 | int GtkGetIndexFor(_GtkTreeIter& iter) const; | |
124 | ||
125 | // set the specified item | |
126 | void GtkSetItem(_GtkTreeIter& iter, const _GtkTreeEntry *entry); | |
127 | ||
128 | // common part of DoSetFirstItem() and EnsureVisible() | |
129 | void DoScrollToCell(int n, float alignY, float alignX); | |
130 | ||
131 | private: | |
132 | void Init(); //common construction | |
133 | ||
134 | DECLARE_DYNAMIC_CLASS(wxListBox) | |
135 | }; | |
136 | ||
137 | #endif // _WX_GTK_LISTBOX_H_ |