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 // forward decl for wxListWidgetImpl implementation type.
25 class wxListWidgetImpl
;
29 WX_DEFINE_ARRAY( char* , wxListDataArray
);
31 // ----------------------------------------------------------------------------
33 // ----------------------------------------------------------------------------
35 class WXDLLIMPEXP_FWD_CORE wxListWidgetColumn
;
37 class WXDLLIMPEXP_FWD_CORE wxListWidgetCellValue
;
39 class WXDLLIMPEXP_CORE wxListBox
: public wxListBoxBase
48 const wxPoint
& pos
= wxDefaultPosition
,
49 const wxSize
& size
= wxDefaultSize
,
50 int n
= 0, const wxString choices
[] = NULL
,
52 const wxValidator
& validator
= wxDefaultValidator
,
53 const wxString
& name
= wxListBoxNameStr
)
55 Create(parent
, winid
, pos
, size
, n
, choices
, style
, validator
, name
);
63 const wxArrayString
& choices
,
65 const wxValidator
& validator
= wxDefaultValidator
,
66 const wxString
& name
= wxListBoxNameStr
)
68 Create(parent
, winid
, pos
, size
, choices
, style
, validator
, name
);
74 const wxPoint
& pos
= wxDefaultPosition
,
75 const wxSize
& size
= wxDefaultSize
,
77 const wxString choices
[] = NULL
,
79 const wxValidator
& validator
= wxDefaultValidator
,
80 const wxString
& name
= wxListBoxNameStr
);
87 const wxArrayString
& choices
,
89 const wxValidator
& validator
= wxDefaultValidator
,
90 const wxString
& name
= wxListBoxNameStr
);
94 // implement base class pure virtuals
95 virtual void Refresh(bool eraseBack
= true, const wxRect
*rect
= NULL
);
97 virtual unsigned int GetCount() const;
98 virtual wxString
GetString(unsigned int n
) const;
99 virtual void SetString(unsigned int n
, const wxString
& s
);
100 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
103 virtual void GetValueCallback( unsigned int n
, wxListWidgetColumn
* col
, wxListWidgetCellValue
& value
);
104 virtual void SetValueCallback( unsigned int n
, wxListWidgetColumn
* col
, wxListWidgetCellValue
& value
);
106 virtual bool IsSelected(int n
) const;
107 virtual int GetSelection() const;
108 virtual int GetSelections(wxArrayInt
& aSelections
) const;
110 virtual void EnsureVisible(int n
);
112 virtual wxVisualAttributes
GetDefaultAttributes() const
114 return GetClassDefaultAttributes(GetWindowVariant());
117 // wxCheckListBox support
118 static wxVisualAttributes
119 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
121 wxListWidgetImpl
* GetListPeer() const;
123 bool MacGetBlockEvents() const { return m_blockEvents
; }
125 virtual void HandleLineEvent( unsigned int n
, bool doubleClick
);
127 // callback for derived classes which may have to insert additional data
128 // at a certain line - which cannot be predetermined for sorted list data
129 virtual void OnItemInserted(unsigned int pos
);
131 virtual void DoClear();
132 virtual void DoDeleteOneItem(unsigned int n
);
134 // from wxItemContainer
135 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
137 void **clientData
, wxClientDataType type
);
139 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
140 virtual void* DoGetItemClientData(unsigned int n
) const;
142 // from wxListBoxBase
143 virtual void DoSetSelection(int n
, bool select
);
144 virtual void DoSetFirstItem(int n
);
145 virtual int DoListHitTest(const wxPoint
& point
) const;
147 // free memory (common part of Clear() and dtor)
148 // prevent collision with some BSD definitions of macro Free()
151 virtual wxSize
DoGetBestSize() const;
155 wxListWidgetColumn
* m_textColumn
;
157 // data storage (copied from univ)
159 // the array containing all items (it is sorted if the listbox has
163 wxArrayString
*unsorted
;
164 wxSortedArrayString
*sorted
;
167 // and this one the client data (either void or wxClientData)
168 wxArrayPtrVoid m_itemsClientData
;
171 DECLARE_DYNAMIC_CLASS(wxListBox
)
172 DECLARE_EVENT_TABLE()
175 #endif // _WX_LISTBOX_H_