1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/listbox.h
3 // Purpose: wxListBox class
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_COCOA_LISTBOX_H__
13 #define __WX_COCOA_LISTBOX_H__
15 #include "wx/cocoa/NSTableView.h"
17 #include "wx/dynarray.h"
19 // ========================================================================
21 // ========================================================================
22 class WXDLLIMPEXP_CORE wxListBox
: public wxListBoxBase
, protected wxCocoaNSTableView
24 DECLARE_DYNAMIC_CLASS(wxListBox
)
26 WX_DECLARE_COCOA_OWNER(NSTableView
,NSControl
,NSView
)
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
31 wxListBox() { m_cocoaItems
= NULL
; m_cocoaDataSource
= NULL
; }
32 wxListBox(wxWindow
*parent
, wxWindowID winid
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
35 int n
= 0, const wxString choices
[] = NULL
,
37 const wxValidator
& validator
= wxDefaultValidator
,
38 const wxString
& name
= wxListBoxNameStr
)
40 Create(parent
, winid
, pos
, size
, n
, choices
, style
, validator
, name
);
42 wxListBox(wxWindow
*parent
, wxWindowID winid
,
45 const wxArrayString
& choices
,
47 const wxValidator
& validator
= wxDefaultValidator
,
48 const wxString
& name
= wxListBoxNameStr
)
50 Create(parent
, winid
, pos
, size
, choices
, style
, validator
, name
);
53 bool Create(wxWindow
*parent
, wxWindowID winid
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
56 int n
= 0, const wxString choices
[] = NULL
,
58 const wxValidator
& validator
= wxDefaultValidator
,
59 const wxString
& name
= wxListBoxNameStr
);
60 bool Create(wxWindow
*parent
, wxWindowID winid
,
63 const wxArrayString
& choices
,
65 const wxValidator
& validator
= wxDefaultValidator
,
66 const wxString
& name
= wxListBoxNameStr
);
69 // ------------------------------------------------------------------------
71 // ------------------------------------------------------------------------
73 virtual int CocoaDataSource_numberOfRows();
74 virtual struct objc_object
* CocoaDataSource_objectForTableColumn(
75 WX_NSTableColumn tableColumn
, int rowIndex
);
76 WX_NSMutableArray m_cocoaItems
;
77 wxArrayPtrVoid m_itemClientData
;
78 struct objc_object
*m_cocoaDataSource
;
80 inline bool _WxCocoa_GetNeedsUpdate();
81 inline void _WxCocoa_SetNeedsUpdate(bool needsUpdate
);
82 virtual void OnInternalIdle();
83 // ------------------------------------------------------------------------
85 // ------------------------------------------------------------------------
87 virtual wxSize
DoGetBestSize() const;
88 // pure virtuals from wxListBoxBase
89 virtual bool IsSelected(int n
) const;
90 virtual int GetSelections(wxArrayInt
& aSelections
) const;
92 virtual void DoSetFirstItem(int n
);
93 virtual void DoSetSelection(int n
, bool select
);
95 // pure virtuals from wxItemContainer
98 virtual void DoClear();
99 virtual void DoDeleteOneItem(unsigned int n
);
101 virtual unsigned int GetCount() const;
102 virtual wxString
GetString(unsigned int n
) const;
103 virtual void SetString(unsigned int n
, const wxString
& s
);
104 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
106 virtual int GetSelection() const;
108 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
110 void **clientData
, wxClientDataType type
);
111 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
112 virtual void* DoGetItemClientData(unsigned int n
) const;
115 #endif // __WX_COCOA_LISTBOX_H__