]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/motif/listbox.h | |
3 | // Purpose: wxListBox class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_LISTBOX_H_ | |
13 | #define _WX_LISTBOX_H_ | |
14 | ||
15 | #include "wx/ctrlsub.h" | |
16 | #include "wx/clntdata.h" | |
17 | ||
18 | // forward decl for GetSelections() | |
19 | class WXDLLIMPEXP_FWD_BASE wxArrayInt; | |
20 | ||
21 | // List box item | |
22 | class WXDLLIMPEXP_CORE wxListBox: public wxListBoxBase | |
23 | { | |
24 | DECLARE_DYNAMIC_CLASS(wxListBox) | |
25 | ||
26 | public: | |
27 | wxListBox(); | |
28 | wxListBox(wxWindow *parent, wxWindowID id, | |
29 | const wxPoint& pos = wxDefaultPosition, | |
30 | const wxSize& size = wxDefaultSize, | |
31 | int n = 0, const wxString choices[] = NULL, | |
32 | long style = 0, | |
33 | const wxValidator& validator = wxDefaultValidator, | |
34 | const wxString& name = wxListBoxNameStr) | |
35 | { | |
36 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
37 | } | |
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 | Create(parent, id, pos, size, choices, style, validator, name); | |
48 | } | |
49 | ||
50 | bool Create(wxWindow *parent, wxWindowID id, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | int n = 0, const wxString choices[] = NULL, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxListBoxNameStr); | |
57 | ||
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); | |
65 | ||
66 | // implementation of wxControlWithItems | |
67 | virtual unsigned int GetCount() const; | |
68 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, | |
69 | unsigned int pos, | |
70 | void **clientData, wxClientDataType type); | |
71 | virtual int GetSelection() const; | |
72 | virtual void DoDeleteOneItem(unsigned int n); | |
73 | virtual int FindString(const wxString& s, bool bCase = false) const; | |
74 | virtual void DoClear(); | |
75 | virtual void SetString(unsigned int n, const wxString& s); | |
76 | virtual wxString GetString(unsigned int n) const; | |
77 | ||
78 | // implementation of wxListBoxbase | |
79 | virtual void DoSetSelection(int n, bool select); | |
80 | virtual void DoSetFirstItem(int n); | |
81 | virtual int GetSelections(wxArrayInt& aSelections) const; | |
82 | virtual bool IsSelected(int n) const; | |
83 | ||
84 | // For single or multiple choice list item | |
85 | void Command(wxCommandEvent& event); | |
86 | ||
87 | // Implementation | |
88 | virtual void ChangeBackgroundColour(); | |
89 | virtual void ChangeForegroundColour(); | |
90 | WXWidget GetTopWidget() const; | |
91 | ||
92 | #if wxUSE_CHECKLISTBOX | |
93 | virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {} | |
94 | #endif | |
95 | protected: | |
96 | virtual wxSize DoGetBestSize() const; | |
97 | ||
98 | unsigned int m_noItems; | |
99 | ||
100 | private: | |
101 | void SetSelectionPolicy(); | |
102 | }; | |
103 | ||
104 | #endif | |
105 | // _WX_LISTBOX_H_ |