]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/listbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/listbox.h
3 // Purpose: wxListBox class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_LISTBOX_H_
13 #define _WX_LISTBOX_H_
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
18 #include "wx/dynarray.h"
19 #include "wx/arrstr.h"
21 // forward decl for GetSelections()
24 // exposed for subclasses like wxCheckListBox
26 class wxMacListControl
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;
45 virtual void MacSetClientData( unsigned int n
, void * data
) = 0;
46 virtual void * MacGetClientData( unsigned int) const = 0;
48 virtual ~wxMacListControl() { }
53 WX_DEFINE_ARRAY( char* , wxListDataArray
);
55 // ----------------------------------------------------------------------------
57 // ----------------------------------------------------------------------------
59 class WXDLLEXPORT wxListBox
: public wxListBoxBase
68 const wxPoint
& pos
= wxDefaultPosition
,
69 const wxSize
& size
= wxDefaultSize
,
70 int n
= 0, const wxString choices
[] = NULL
,
72 const wxValidator
& validator
= wxDefaultValidator
,
73 const wxString
& name
= wxListBoxNameStr
)
75 Create(parent
, winid
, pos
, size
, n
, choices
, style
, validator
, name
);
83 const wxArrayString
& choices
,
85 const wxValidator
& validator
= wxDefaultValidator
,
86 const wxString
& name
= wxListBoxNameStr
)
88 Create(parent
, winid
, pos
, size
, choices
, style
, validator
, name
);
94 const wxPoint
& pos
= wxDefaultPosition
,
95 const wxSize
& size
= wxDefaultSize
,
97 const wxString choices
[] = NULL
,
99 const wxValidator
& validator
= wxDefaultValidator
,
100 const wxString
& name
= wxListBoxNameStr
);
107 const wxArrayString
& choices
,
109 const wxValidator
& validator
= wxDefaultValidator
,
110 const wxString
& name
= wxListBoxNameStr
);
112 virtual ~wxListBox();
114 // implement base class pure virtuals
115 virtual void Refresh(bool eraseBack
= true, const wxRect
*rect
= NULL
);
116 virtual void Clear();
117 virtual void Delete(unsigned int n
);
119 virtual unsigned int GetCount() const;
120 virtual wxString
GetString(unsigned int n
) const;
121 virtual void SetString(unsigned int n
, const wxString
& s
);
122 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
124 virtual bool IsSelected(int n
) const;
125 virtual int GetSelection() const;
126 virtual int GetSelections(wxArrayInt
& aSelections
) const;
128 virtual void EnsureVisible(int n
);
130 // wxCheckListBox support
131 static wxVisualAttributes
132 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
134 wxMacListControl
* GetPeer() const;
137 // from wxItemContainer
138 virtual int DoAppend(const wxString
& item
);
139 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
140 virtual void* DoGetItemClientData(unsigned int n
) const;
141 virtual void DoSetItemClientObject(unsigned int n
, wxClientData
* clientData
);
142 virtual wxClientData
* DoGetItemClientObject(unsigned int n
) const;
144 // from wxListBoxBase
145 virtual void DoSetSelection(int n
, bool select
);
146 virtual void DoInsertItems(const wxArrayString
& items
, unsigned int pos
);
147 virtual void DoSetItems(const wxArrayString
& items
, void **clientData
);
148 virtual void DoSetFirstItem(int n
);
149 virtual int DoListHitTest(const wxPoint
& point
) const;
151 // free memory (common part of Clear() and dtor)
152 // prevent collision with some BSD definitions of macro Free()
155 virtual wxSize
DoGetBestSize() const;
158 DECLARE_DYNAMIC_CLASS(wxListBox
)
159 DECLARE_EVENT_TABLE()
162 #endif // _WX_LISTBOX_H_