]>
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 | ||
c801d85f KB |
10 | #ifndef __GTKLISTBOXH__ |
11 | #define __GTKLISTBOXH__ | |
12 | ||
c801d85f KB |
13 | //----------------------------------------------------------------------------- |
14 | // wxListBox | |
15 | //----------------------------------------------------------------------------- | |
16 | ||
20123d49 | 17 | class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase |
c801d85f | 18 | { |
fd0eed64 | 19 | public: |
2ee3ee1b | 20 | // ctors and such |
b6e5dfef JS |
21 | wxListBox() |
22 | { | |
23 | Init(); | |
24 | } | |
ff8bfdbb VZ |
25 | wxListBox( wxWindow *parent, wxWindowID id, |
26 | const wxPoint& pos = wxDefaultPosition, | |
27 | const wxSize& size = wxDefaultSize, | |
28 | int n = 0, const wxString choices[] = (const wxString *) NULL, | |
29 | long style = 0, | |
30 | const wxValidator& validator = wxDefaultValidator, | |
31 | const wxString& name = wxListBoxNameStr ) | |
32 | { | |
b6e5dfef | 33 | Init(); |
ff8bfdbb VZ |
34 | Create(parent, id, pos, size, n, choices, style, validator, name); |
35 | } | |
584ad2a3 MB |
36 | wxListBox( wxWindow *parent, wxWindowID id, |
37 | const wxPoint& pos, | |
38 | const wxSize& size, | |
39 | const wxArrayString& choices, | |
40 | long style = 0, | |
41 | const wxValidator& validator = wxDefaultValidator, | |
42 | const wxString& name = wxListBoxNameStr ) | |
43 | { | |
b6e5dfef | 44 | Init(); |
584ad2a3 MB |
45 | Create(parent, id, pos, size, choices, style, validator, name); |
46 | } | |
ff8bfdbb VZ |
47 | virtual ~wxListBox(); |
48 | ||
49 | bool Create(wxWindow *parent, wxWindowID id, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, | |
52 | int n = 0, const wxString choices[] = (const wxString *) NULL, | |
53 | long style = 0, | |
54 | const wxValidator& validator = wxDefaultValidator, | |
55 | const wxString& name = wxListBoxNameStr); | |
584ad2a3 MB |
56 | bool Create(wxWindow *parent, wxWindowID id, |
57 | const wxPoint& pos, | |
58 | const wxSize& size, | |
59 | const wxArrayString& choices, | |
60 | long style = 0, | |
61 | const wxValidator& validator = wxDefaultValidator, | |
62 | const wxString& name = wxListBoxNameStr); | |
ff8bfdbb | 63 | |
2ee3ee1b VZ |
64 | // implement base class pure virtuals |
65 | virtual void Clear(); | |
aa61d352 | 66 | virtual void Delete(unsigned int n); |
2ee3ee1b | 67 | |
aa61d352 VZ |
68 | virtual unsigned int GetCount() const; |
69 | virtual wxString GetString(unsigned int n) const; | |
70 | virtual void SetString(unsigned int n, const wxString& s); | |
853dcc57 | 71 | virtual int FindString(const wxString& s, bool bCase = false) const; |
2ee3ee1b VZ |
72 | |
73 | virtual bool IsSelected(int n) const; | |
2ee3ee1b VZ |
74 | virtual int GetSelection() const; |
75 | virtual int GetSelections(wxArrayInt& aSelections) const; | |
76 | ||
9d522606 RD |
77 | static wxVisualAttributes |
78 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
853dcc57 | 79 | |
2ee3ee1b | 80 | // implementation from now on |
c801d85f | 81 | |
ff8bfdbb VZ |
82 | GtkWidget *GetConnectWidget(); |
83 | bool IsOwnGtkWindow( GdkWindow *window ); | |
5e014a0c | 84 | void OnInternalIdle(); |
ff8bfdbb VZ |
85 | |
86 | #if wxUSE_TOOLTIPS | |
4de6207a | 87 | void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); |
ff8bfdbb VZ |
88 | #endif // wxUSE_TOOLTIPS |
89 | ||
4a46cbe8 RR |
90 | struct _GtkTreeView *m_treeview; |
91 | struct _GtkListStore *m_liststore; | |
88ac883a VZ |
92 | |
93 | #if wxUSE_CHECKLISTBOX | |
ff8bfdbb | 94 | bool m_hasCheckBoxes; |
88ac883a | 95 | #endif // wxUSE_CHECKLISTBOX |
c801d85f | 96 | |
bac95742 | 97 | bool m_blockEvent; |
4a46cbe8 | 98 | bool m_spacePressed; |
8161b5b9 | 99 | |
4a46cbe8 | 100 | struct _GtkTreeEntry* GtkGetEntry(int pos) const; |
8228b893 | 101 | void GtkInsertItems(const wxArrayString& items, |
aa61d352 | 102 | void** clientData, unsigned int pos); |
4a46cbe8 | 103 | void GtkSetSelection(int n, const bool select, const bool blockEvent); |
3ae4c570 | 104 | |
f68586e5 VZ |
105 | protected: |
106 | virtual wxSize DoGetBestSize() const; | |
6f02a879 VZ |
107 | virtual void DoSetSelection(int n, bool select); |
108 | virtual int DoAppend(const wxString& item); | |
aa61d352 | 109 | virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); |
6f02a879 VZ |
110 | virtual void DoSetItems(const wxArrayString& items, void **clientData); |
111 | virtual void DoSetFirstItem(int n); | |
aa61d352 VZ |
112 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
113 | virtual void* DoGetItemClientData(unsigned int n) const; | |
114 | virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); | |
115 | virtual wxClientData* DoGetItemClientObject(unsigned int n) const; | |
c00fed0e VZ |
116 | virtual int DoListHitTest(const wxPoint& point) const; |
117 | ||
6f02a879 | 118 | void DoApplyWidgetStyle(GtkRcStyle *style); |
f68586e5 | 119 | |
2ee3ee1b | 120 | private: |
b7e37e55 WS |
121 | void Init(); //common construction |
122 | ||
2ee3ee1b VZ |
123 | DECLARE_DYNAMIC_CLASS(wxListBox) |
124 | }; | |
dcf924a3 | 125 | |
c801d85f | 126 | #endif // __GTKLISTBOXH__ |