]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/listbox.h
Patch from "Viktor Voroshylo" <viktor@voroshylo.com>
[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
7// RCS-ID: $Id:
8// Copyright: (c) 2003 David Elliott
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __WX_COCOA_LISTBOX_H__
13#define __WX_COCOA_LISTBOX_H__
14
bcaadf7e
DE
15#include "wx/cocoa/NSTableView.h"
16
17#include "wx/dynarray.h"
fb896a32
DE
18
19// ========================================================================
20// wxListBox
21// ========================================================================
bcaadf7e 22class WXDLLEXPORT wxListBox: public wxListBoxBase, protected wxCocoaNSTableView
fb896a32
DE
23{
24 DECLARE_DYNAMIC_CLASS(wxListBox)
25 DECLARE_EVENT_TABLE()
26 WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView)
27// ------------------------------------------------------------------------
28// initialization
29// ------------------------------------------------------------------------
30public:
bcaadf7e 31 wxListBox() { m_cocoaItems = NULL; }
fb896a32
DE
32 wxListBox(wxWindow *parent, wxWindowID winid,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 int n = 0, const wxString choices[] = NULL,
36 long style = 0,
37 const wxValidator& validator = wxDefaultValidator,
38 const wxString& name = wxListBoxNameStr)
39 {
40 Create(parent, winid, pos, size, n, choices, style, validator, name);
41 }
42
43 bool Create(wxWindow *parent, wxWindowID winid,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 int n = 0, const wxString choices[] = NULL,
47 long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxListBoxNameStr);
50 virtual ~wxListBox();
51
52// ------------------------------------------------------------------------
53// Cocoa callbacks
54// ------------------------------------------------------------------------
55protected:
bcaadf7e
DE
56 virtual int CocoaDataSource_numberOfRows();
57 virtual struct objc_object* CocoaDataSource_objectForTableColumn(
58 WX_NSTableColumn tableColumn, int rowIndex);
59 WX_NSMutableArray m_cocoaItems;
60 wxArrayPtrVoid m_clientData;
61 struct objc_object *m_cocoaDataSource;
fb896a32
DE
62// ------------------------------------------------------------------------
63// Implementation
64// ------------------------------------------------------------------------
65public:
66// pure virtuals from wxListBoxBase
67 virtual bool IsSelected(int n) const;
68 virtual void SetSelection(int n, bool select = TRUE);
69 virtual int GetSelections(wxArrayInt& aSelections) const;
70protected:
71 virtual void DoInsertItems(const wxArrayString& items, int pos);
72 virtual void DoSetItems(const wxArrayString& items, void **clientData);
73 virtual void DoSetFirstItem(int n);
74
75// pure virtuals from wxItemContainer
76public:
77 // deleting items
78 virtual void Clear();
79 virtual void Delete(int n);
80 // accessing strings
81 virtual int GetCount() const;
82 virtual wxString GetString(int n) const;
83 virtual void SetString(int n, const wxString& s);
84 virtual int FindString(const wxString& s) const;
85 // selection
86 virtual void Select(int n);
87 virtual int GetSelection() const;
88protected:
89 virtual int DoAppend(const wxString& item);
90 virtual void DoSetItemClientData(int n, void* clientData);
91 virtual void* DoGetItemClientData(int n) const;
92 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
93 virtual wxClientData* DoGetItemClientObject(int n) const;
94};
95
96#endif // __WX_COCOA_LISTBOX_H__