]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/listbox.h
renamed RGBColor setter to avoid former overload being an override
[wxWidgets.git] / include / wx / mac / carbon / listbox.h
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 // exposed for subclasses like wxCheckListBox
25
26 class wxMacListControl
27 {
28 public:
29 virtual void MacDelete( unsigned int n ) = 0;
30 virtual void MacInsert( unsigned int n, const wxString& item ) = 0;
31 virtual void MacInsert( unsigned int n, const wxArrayString& items ) = 0;
32 // returns index of newly created line
33 virtual int MacAppend( const wxString& item ) = 0;
34 virtual void MacSetString( unsigned int n, const wxString& item ) = 0;
35 virtual void MacClear() = 0;
36 virtual void MacDeselectAll() = 0;
37 virtual void MacSetSelection( unsigned int n, bool select ) = 0;
38 virtual int MacGetSelection() const = 0;
39 virtual int MacGetSelections( wxArrayInt& aSelections ) const = 0;
40 virtual bool MacIsSelected( unsigned int n ) const = 0;
41 virtual void MacScrollTo( unsigned int n ) = 0;
42 virtual wxString MacGetString( unsigned int n) const = 0;
43 virtual unsigned int MacGetCount() const = 0;
44
45 virtual void MacSetClientData( unsigned int n, void * data) = 0;
46 virtual void * MacGetClientData( unsigned int) const = 0;
47 };
48
49 // List box item
50
51 WX_DEFINE_ARRAY( char* , wxListDataArray );
52
53 // ----------------------------------------------------------------------------
54 // List box control
55 // ----------------------------------------------------------------------------
56
57 class WXDLLEXPORT wxListBox : public wxListBoxBase
58 {
59 public:
60 // ctors and such
61 wxListBox();
62
63 wxListBox(
64 wxWindow *parent,
65 wxWindowID winid,
66 const wxPoint& pos = wxDefaultPosition,
67 const wxSize& size = wxDefaultSize,
68 int n = 0, const wxString choices[] = NULL,
69 long style = 0,
70 const wxValidator& validator = wxDefaultValidator,
71 const wxString& name = wxListBoxNameStr)
72 {
73 Create(parent, winid, pos, size, n, choices, style, validator, name);
74 }
75
76 wxListBox(
77 wxWindow *parent,
78 wxWindowID winid,
79 const wxPoint& pos,
80 const wxSize& size,
81 const wxArrayString& choices,
82 long style = 0,
83 const wxValidator& validator = wxDefaultValidator,
84 const wxString& name = wxListBoxNameStr)
85 {
86 Create(parent, winid, pos, size, choices, style, validator, name);
87 }
88
89 bool Create(
90 wxWindow *parent,
91 wxWindowID winid,
92 const wxPoint& pos = wxDefaultPosition,
93 const wxSize& size = wxDefaultSize,
94 int n = 0,
95 const wxString choices[] = NULL,
96 long style = 0,
97 const wxValidator& validator = wxDefaultValidator,
98 const wxString& name = wxListBoxNameStr);
99
100 bool Create(
101 wxWindow *parent,
102 wxWindowID winid,
103 const wxPoint& pos,
104 const wxSize& size,
105 const wxArrayString& choices,
106 long style = 0,
107 const wxValidator& validator = wxDefaultValidator,
108 const wxString& name = wxListBoxNameStr);
109
110 virtual ~wxListBox();
111
112 // implement base class pure virtuals
113 virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL);
114 virtual void Clear();
115 virtual void Delete(unsigned int n);
116
117 virtual unsigned int GetCount() const;
118 virtual wxString GetString(unsigned int n) const;
119 virtual void SetString(unsigned int n, const wxString& s);
120 virtual int FindString(const wxString& s, bool bCase = false) const;
121
122 virtual bool IsSelected(int n) const;
123 virtual int GetSelection() const;
124 virtual int GetSelections(wxArrayInt& aSelections) const;
125
126 virtual void EnsureVisible(int n);
127
128 // wxCheckListBox support
129 static wxVisualAttributes
130 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
131
132 wxMacListControl* GetPeer() const;
133
134 protected:
135 // from wxItemContainer
136 virtual int DoAppend(const wxString& item);
137 virtual void DoSetItemClientData(unsigned int n, void* clientData);
138 virtual void* DoGetItemClientData(unsigned int n) const;
139 virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
140 virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
141
142 // from wxListBoxBase
143 virtual void DoSetSelection(int n, bool select);
144 virtual void DoInsertItems(const wxArrayString& items, unsigned int pos);
145 virtual void DoSetItems(const wxArrayString& items, void **clientData);
146 virtual void DoSetFirstItem(int n);
147 virtual int DoListHitTest(const wxPoint& point) const;
148
149 // free memory (common part of Clear() and dtor)
150 // prevent collision with some BSD definitions of macro Free()
151 void FreeData();
152
153 virtual wxSize DoGetBestSize() const;
154
155 private:
156 DECLARE_DYNAMIC_CLASS(wxListBox)
157 DECLARE_EVENT_TABLE()
158 };
159
160 #endif // _WX_LISTBOX_H_