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 wxMacListControl data type.
25 class wxMacListControl
;
29 WX_DEFINE_ARRAY( char* , wxListDataArray
);
31 // ----------------------------------------------------------------------------
33 // ----------------------------------------------------------------------------
35 class WXDLLIMPEXP_CORE wxListBox
: public wxListBoxBase
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
,
46 int n
= 0, const wxString choices
[] = NULL
,
48 const wxValidator
& validator
= wxDefaultValidator
,
49 const wxString
& name
= wxListBoxNameStr
)
51 Create(parent
, winid
, pos
, size
, n
, choices
, style
, validator
, name
);
59 const wxArrayString
& choices
,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxListBoxNameStr
)
64 Create(parent
, winid
, pos
, size
, choices
, style
, validator
, name
);
70 const wxPoint
& pos
= wxDefaultPosition
,
71 const wxSize
& size
= wxDefaultSize
,
73 const wxString choices
[] = NULL
,
75 const wxValidator
& validator
= wxDefaultValidator
,
76 const wxString
& name
= wxListBoxNameStr
);
83 const wxArrayString
& choices
,
85 const wxValidator
& validator
= wxDefaultValidator
,
86 const wxString
& name
= wxListBoxNameStr
);
90 // implement base class pure virtuals
91 virtual void Refresh(bool eraseBack
= true, const wxRect
*rect
= NULL
);
93 virtual unsigned int GetCount() const;
94 virtual wxString
GetString(unsigned int n
) const;
95 virtual void SetString(unsigned int n
, const wxString
& s
);
96 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
98 virtual bool IsSelected(int n
) const;
99 virtual int GetSelection() const;
100 virtual int GetSelections(wxArrayInt
& aSelections
) const;
102 virtual void EnsureVisible(int n
);
104 virtual wxVisualAttributes
GetDefaultAttributes() const
106 return GetClassDefaultAttributes(GetWindowVariant());
109 // wxCheckListBox support
110 static wxVisualAttributes
111 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
113 wxMacListControl
* GetPeer() const;
115 bool MacGetBlockEvents() const { return m_blockEvents
; }
118 virtual void DoClear();
119 virtual void DoDeleteOneItem(unsigned int n
);
121 // from wxItemContainer
122 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
124 void **clientData
, wxClientDataType type
);
126 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
127 virtual void* DoGetItemClientData(unsigned int n
) const;
129 // from wxListBoxBase
130 virtual void DoSetSelection(int n
, bool select
);
131 virtual void DoSetFirstItem(int n
);
132 virtual int DoListHitTest(const wxPoint
& point
) const;
134 // free memory (common part of Clear() and dtor)
135 // prevent collision with some BSD definitions of macro Free()
138 virtual wxSize
DoGetBestSize() const;
143 DECLARE_DYNAMIC_CLASS(wxListBox
)
144 DECLARE_EVENT_TABLE()
147 #endif // _WX_LISTBOX_H_