]>
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;
51 WX_DEFINE_ARRAY( char* , wxListDataArray
);
53 // ----------------------------------------------------------------------------
55 // ----------------------------------------------------------------------------
57 class WXDLLEXPORT wxListBox
: public wxListBoxBase
66 const wxPoint
& pos
= wxDefaultPosition
,
67 const wxSize
& size
= wxDefaultSize
,
68 int n
= 0, const wxString choices
[] = NULL
,
70 const wxValidator
& validator
= wxDefaultValidator
,
71 const wxString
& name
= wxListBoxNameStr
)
73 Create(parent
, winid
, pos
, size
, n
, choices
, style
, validator
, name
);
81 const wxArrayString
& choices
,
83 const wxValidator
& validator
= wxDefaultValidator
,
84 const wxString
& name
= wxListBoxNameStr
)
86 Create(parent
, winid
, pos
, size
, choices
, style
, validator
, name
);
92 const wxPoint
& pos
= wxDefaultPosition
,
93 const wxSize
& size
= wxDefaultSize
,
95 const wxString choices
[] = NULL
,
97 const wxValidator
& validator
= wxDefaultValidator
,
98 const wxString
& name
= wxListBoxNameStr
);
105 const wxArrayString
& choices
,
107 const wxValidator
& validator
= wxDefaultValidator
,
108 const wxString
& name
= wxListBoxNameStr
);
110 virtual ~wxListBox();
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
);
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;
122 virtual bool IsSelected(int n
) const;
123 virtual int GetSelection() const;
124 virtual int GetSelections(wxArrayInt
& aSelections
) const;
126 virtual void EnsureVisible(int n
);
128 // wxCheckListBox support
129 static wxVisualAttributes
130 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
132 wxMacListControl
* GetPeer() const;
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;
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;
149 // free memory (common part of Clear() and dtor)
150 // prevent collision with some BSD definitions of macro Free()
153 virtual wxSize
DoGetBestSize() const;
156 DECLARE_DYNAMIC_CLASS(wxListBox
)
157 DECLARE_EVENT_TABLE()
160 #endif // _WX_LISTBOX_H_