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
; }
126 // callback for derived classes which may have to insert additional data
127 // at a certain line - which cannot be predetermined for sorted list data
128 virtual void OnItemInserted(unsigned int pos
);
130 virtual void DoClear();
131 virtual void DoDeleteOneItem(unsigned int n
);
133 // from wxItemContainer
134 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
136 void **clientData
, wxClientDataType type
);
138 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
139 virtual void* DoGetItemClientData(unsigned int n
) const;
141 // from wxListBoxBase
142 virtual void DoSetSelection(int n
, bool select
);
143 virtual void DoSetFirstItem(int n
);
144 virtual int DoListHitTest(const wxPoint
& point
) const;
146 // free memory (common part of Clear() and dtor)
147 // prevent collision with some BSD definitions of macro Free()
150 virtual wxSize
DoGetBestSize() const;
154 wxListWidgetColumn
* m_textColumn
;
156 // data storage (copied from univ)
158 // the array containing all items (it is sorted if the listbox has
162 wxArrayString
*unsorted
;
163 wxSortedArrayString
*sorted
;
166 // and this one the client data (either void or wxClientData)
167 wxArrayPtrVoid m_itemsClientData
;
170 DECLARE_DYNAMIC_CLASS(wxListBox
)
171 DECLARE_EVENT_TABLE()
174 #endif // _WX_LISTBOX_H_