]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/mac/carbon/listbox.h | |
3 | // Purpose: wxListBox class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_LISTBOX_H_ | |
13 | #define _WX_LISTBOX_H_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // simple types | |
17 | // ---------------------------------------------------------------------------- | |
18 | #include "wx/dynarray.h" | |
19 | #include "wx/arrstr.h" | |
20 | ||
21 | // forward decl for GetSelections() | |
22 | class wxArrayInt; | |
23 | ||
24 | // forward decl for wxMacListControl data type. | |
25 | class wxMacListControl; | |
26 | ||
27 | // List box item | |
28 | ||
29 | WX_DEFINE_ARRAY( char* , wxListDataArray ); | |
30 | ||
31 | // ---------------------------------------------------------------------------- | |
32 | // List box control | |
33 | // ---------------------------------------------------------------------------- | |
34 | ||
35 | class WXDLLEXPORT wxListBox : public wxListBoxBase | |
36 | { | |
37 | public: | |
38 | // ctors and such | |
39 | wxListBox(); | |
40 | ||
41 | wxListBox( | |
42 | wxWindow *parent, | |
43 | wxWindowID winid, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | const wxSize& size = wxDefaultSize, | |
46 | int n = 0, const wxString choices[] = NULL, | |
47 | long style = 0, | |
48 | const wxValidator& validator = wxDefaultValidator, | |
49 | const wxString& name = wxListBoxNameStr) | |
50 | { | |
51 | Create(parent, winid, pos, size, n, choices, style, validator, name); | |
52 | } | |
53 | ||
54 | wxListBox( | |
55 | wxWindow *parent, | |
56 | wxWindowID winid, | |
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) | |
63 | { | |
64 | Create(parent, winid, pos, size, choices, style, validator, name); | |
65 | } | |
66 | ||
67 | bool Create( | |
68 | wxWindow *parent, | |
69 | wxWindowID winid, | |
70 | const wxPoint& pos = wxDefaultPosition, | |
71 | const wxSize& size = wxDefaultSize, | |
72 | int n = 0, | |
73 | const wxString choices[] = NULL, | |
74 | long style = 0, | |
75 | const wxValidator& validator = wxDefaultValidator, | |
76 | const wxString& name = wxListBoxNameStr); | |
77 | ||
78 | bool Create( | |
79 | wxWindow *parent, | |
80 | wxWindowID winid, | |
81 | const wxPoint& pos, | |
82 | const wxSize& size, | |
83 | const wxArrayString& choices, | |
84 | long style = 0, | |
85 | const wxValidator& validator = wxDefaultValidator, | |
86 | const wxString& name = wxListBoxNameStr); | |
87 | ||
88 | virtual ~wxListBox(); | |
89 | ||
90 | // implement base class pure virtuals | |
91 | virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL); | |
92 | virtual void DoClear(); | |
93 | virtual void DoDeleteOneItem(unsigned int n); | |
94 | ||
95 | virtual unsigned int GetCount() const; | |
96 | virtual wxString GetString(unsigned int n) const; | |
97 | virtual void SetString(unsigned int n, const wxString& s); | |
98 | virtual int FindString(const wxString& s, bool bCase = false) const; | |
99 | ||
100 | virtual bool IsSelected(int n) const; | |
101 | virtual int GetSelection() const; | |
102 | virtual int GetSelections(wxArrayInt& aSelections) const; | |
103 | ||
104 | virtual void EnsureVisible(int n); | |
105 | ||
106 | // wxCheckListBox support | |
107 | static wxVisualAttributes | |
108 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
109 | ||
110 | wxMacListControl* GetPeer() const; | |
111 | ||
112 | protected: | |
113 | // from wxItemContainer | |
114 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, | |
115 | unsigned int pos, | |
116 | void **clientData, wxClientDataType type); | |
117 | ||
118 | virtual void DoSetItemClientData(unsigned int n, void* clientData); | |
119 | virtual void* DoGetItemClientData(unsigned int n) const; | |
120 | ||
121 | // from wxListBoxBase | |
122 | virtual void DoSetSelection(int n, bool select); | |
123 | virtual void DoSetFirstItem(int n); | |
124 | virtual int DoListHitTest(const wxPoint& point) const; | |
125 | ||
126 | // free memory (common part of Clear() and dtor) | |
127 | // prevent collision with some BSD definitions of macro Free() | |
128 | void FreeData(); | |
129 | ||
130 | virtual wxSize DoGetBestSize() const; | |
131 | ||
132 | private: | |
133 | DECLARE_DYNAMIC_CLASS(wxListBox) | |
134 | DECLARE_EVENT_TABLE() | |
135 | }; | |
136 | ||
137 | #endif // _WX_LISTBOX_H_ |