]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/listbox.h
Try loading even English translations if provided.
[wxWidgets.git] / include / wx / cocoa / listbox.h
CommitLineData
fb896a32
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cocoa/listbox.h
3// Purpose: wxListBox class
4// Author: David Elliott
5// Modified by:
6// Created: 2003/03/16
fb896a32 7// Copyright: (c) 2003 David Elliott
853dcc57 8// Licence: wxWindows licence
fb896a32
DE
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef __WX_COCOA_LISTBOX_H__
12#define __WX_COCOA_LISTBOX_H__
13
bcaadf7e
DE
14#include "wx/cocoa/NSTableView.h"
15
16#include "wx/dynarray.h"
fb896a32
DE
17
18// ========================================================================
19// wxListBox
20// ========================================================================
53a2db12 21class WXDLLIMPEXP_CORE wxListBox: public wxListBoxBase, protected wxCocoaNSTableView
fb896a32
DE
22{
23 DECLARE_DYNAMIC_CLASS(wxListBox)
24 DECLARE_EVENT_TABLE()
25 WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView)
26// ------------------------------------------------------------------------
27// initialization
28// ------------------------------------------------------------------------
29public:
070b7b85 30 wxListBox() { m_cocoaItems = NULL; m_cocoaDataSource = NULL; }
fb896a32
DE
31 wxListBox(wxWindow *parent, wxWindowID winid,
32 const wxPoint& pos = wxDefaultPosition,
33 const wxSize& size = wxDefaultSize,
34 int n = 0, const wxString choices[] = NULL,
35 long style = 0,
36 const wxValidator& validator = wxDefaultValidator,
37 const wxString& name = wxListBoxNameStr)
38 {
39 Create(parent, winid, pos, size, n, choices, style, validator, name);
40 }
584ad2a3
MB
41 wxListBox(wxWindow *parent, wxWindowID winid,
42 const wxPoint& pos,
43 const wxSize& size,
44 const wxArrayString& choices,
45 long style = 0,
46 const wxValidator& validator = wxDefaultValidator,
47 const wxString& name = wxListBoxNameStr)
48 {
49 Create(parent, winid, pos, size, choices, style, validator, name);
50 }
fb896a32
DE
51
52 bool Create(wxWindow *parent, wxWindowID winid,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 int n = 0, const wxString choices[] = NULL,
56 long style = 0,
57 const wxValidator& validator = wxDefaultValidator,
58 const wxString& name = wxListBoxNameStr);
584ad2a3
MB
59 bool Create(wxWindow *parent, wxWindowID winid,
60 const wxPoint& pos,
61 const wxSize& size,
62 const wxArrayString& choices,
63 long style = 0,
64 const wxValidator& validator = wxDefaultValidator,
65 const wxString& name = wxListBoxNameStr);
fb896a32
DE
66 virtual ~wxListBox();
67
68// ------------------------------------------------------------------------
69// Cocoa callbacks
70// ------------------------------------------------------------------------
71protected:
bcaadf7e
DE
72 virtual int CocoaDataSource_numberOfRows();
73 virtual struct objc_object* CocoaDataSource_objectForTableColumn(
74 WX_NSTableColumn tableColumn, int rowIndex);
75 WX_NSMutableArray m_cocoaItems;
c0ccf6a9 76 wxArrayPtrVoid m_itemClientData;
bcaadf7e 77 struct objc_object *m_cocoaDataSource;
861b3043 78 bool m_needsUpdate;
580cc1eb
DE
79 inline bool _WxCocoa_GetNeedsUpdate();
80 inline void _WxCocoa_SetNeedsUpdate(bool needsUpdate);
861b3043 81 virtual void OnInternalIdle();
fb896a32
DE
82// ------------------------------------------------------------------------
83// Implementation
84// ------------------------------------------------------------------------
85public:
c86ec17b 86 virtual wxSize DoGetBestSize() const;
fb896a32
DE
87// pure virtuals from wxListBoxBase
88 virtual bool IsSelected(int n) const;
fb896a32
DE
89 virtual int GetSelections(wxArrayInt& aSelections) const;
90protected:
fb896a32 91 virtual void DoSetFirstItem(int n);
c6179a84 92 virtual void DoSetSelection(int n, bool select);
fb896a32
DE
93
94// pure virtuals from wxItemContainer
95public:
96 // deleting items
a236aa20
VZ
97 virtual void DoClear();
98 virtual void DoDeleteOneItem(unsigned int n);
fb896a32 99 // accessing strings
aa61d352
VZ
100 virtual unsigned int GetCount() const;
101 virtual wxString GetString(unsigned int n) const;
102 virtual void SetString(unsigned int n, const wxString& s);
853dcc57 103 virtual int FindString(const wxString& s, bool bCase = false) const;
fb896a32 104 // selection
fb896a32
DE
105 virtual int GetSelection() const;
106protected:
a236aa20
VZ
107 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
108 unsigned int pos,
109 void **clientData, wxClientDataType type);
aa61d352
VZ
110 virtual void DoSetItemClientData(unsigned int n, void* clientData);
111 virtual void* DoGetItemClientData(unsigned int n) const;
fb896a32
DE
112};
113
114#endif // __WX_COCOA_LISTBOX_H__