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 GetPeer()
25 class wxMacListControl
;
29 WX_DEFINE_ARRAY( char* , wxListDataArray
);
31 // ----------------------------------------------------------------------------
33 // ----------------------------------------------------------------------------
35 class WXDLLEXPORT 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
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
59 const wxArrayString
& choices
,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxListBoxNameStr
)
64 Create(parent
, id
, 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 void Delete(unsigned int n
);
95 virtual unsigned int GetCount() const;
96 virtual wxString
GetString(unsigned int n
) const;
97 virtual void SetString(unsigned int n
, const wxString
& s
);
98 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
100 virtual bool IsSelected(int n
) const;
101 virtual int GetSelection() const;
102 virtual int GetSelections(wxArrayInt
& aSelections
) const;
104 // wxCheckListBox support
105 static wxVisualAttributes
106 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
108 wxMacListControl
* GetPeer() const { return (wxMacListControl
*)m_peer
; }
110 wxArrayString m_stringArray
;
111 wxListDataArray m_dataArray
;
114 // common creation for all databrowser list implementations
115 wxMacListControl
* CreateMacListControl(const wxPoint
& pos
, const wxSize
& size
, long style
);
117 // internal storage for line n has changed, issue a redraw
118 void MacUpdateLine(int n
);
120 virtual void DoSetSelection(int n
, bool select
);
121 virtual int DoAppend(const wxString
& item
);
122 virtual void DoInsertItems(const wxArrayString
& items
, unsigned int pos
);
123 virtual void DoSetItems(const wxArrayString
& items
, void **clientData
);
124 virtual void DoSetFirstItem(int n
);
125 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
126 virtual void* DoGetItemClientData(unsigned int n
) const;
127 virtual void DoSetItemClientObject(unsigned int n
, wxClientData
* clientData
);
128 virtual wxClientData
* DoGetItemClientObject(unsigned int n
) const;
129 virtual void DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
130 virtual int DoListHitTest(const wxPoint
& point
) const;
131 virtual wxSize
DoGetBestSize() const;
133 // free memory (common part of Clear() and dtor)
134 // prevent collision with some BSD definitions of macro Free()
137 unsigned int m_noItems
;
140 DECLARE_DYNAMIC_CLASS(wxListBox
)
141 DECLARE_EVENT_TABLE()
144 #endif // _WX_LISTBOX_H_