]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/listbox.h
Add wxSize::IncBy() and DecBy() overloads taking wxPoint.
[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
853dcc57 7// RCS-ID: $Id$
fb896a32 8// Copyright: (c) 2003 David Elliott
853dcc57 9// Licence: wxWindows licence
fb896a32
DE
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// ========================================================================
53a2db12 22class WXDLLIMPEXP_CORE 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:
070b7b85 31 wxListBox() { m_cocoaItems = NULL; m_cocoaDataSource = 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 }
584ad2a3
MB
42 wxListBox(wxWindow *parent, wxWindowID winid,
43 const wxPoint& pos,
44 const wxSize& size,
45 const wxArrayString& choices,
46 long style = 0,
47 const wxValidator& validator = wxDefaultValidator,
48 const wxString& name = wxListBoxNameStr)
49 {
50 Create(parent, winid, pos, size, choices, style, validator, name);
51 }
fb896a32
DE
52
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,
57 long style = 0,
58 const wxValidator& validator = wxDefaultValidator,
59 const wxString& name = wxListBoxNameStr);
584ad2a3
MB
60 bool Create(wxWindow *parent, wxWindowID winid,
61 const wxPoint& pos,
62 const wxSize& size,
63 const wxArrayString& choices,
64 long style = 0,
65 const wxValidator& validator = wxDefaultValidator,
66 const wxString& name = wxListBoxNameStr);
fb896a32
DE
67 virtual ~wxListBox();
68
69// ------------------------------------------------------------------------
70// Cocoa callbacks
71// ------------------------------------------------------------------------
72protected:
bcaadf7e
DE
73 virtual int CocoaDataSource_numberOfRows();
74 virtual struct objc_object* CocoaDataSource_objectForTableColumn(
75 WX_NSTableColumn tableColumn, int rowIndex);
76 WX_NSMutableArray m_cocoaItems;
c0ccf6a9 77 wxArrayPtrVoid m_itemClientData;
bcaadf7e 78 struct objc_object *m_cocoaDataSource;
861b3043 79 bool m_needsUpdate;
580cc1eb
DE
80 inline bool _WxCocoa_GetNeedsUpdate();
81 inline void _WxCocoa_SetNeedsUpdate(bool needsUpdate);
861b3043 82 virtual void OnInternalIdle();
fb896a32
DE
83// ------------------------------------------------------------------------
84// Implementation
85// ------------------------------------------------------------------------
86public:
c86ec17b 87 virtual wxSize DoGetBestSize() const;
fb896a32
DE
88// pure virtuals from wxListBoxBase
89 virtual bool IsSelected(int n) const;
fb896a32
DE
90 virtual int GetSelections(wxArrayInt& aSelections) const;
91protected:
fb896a32 92 virtual void DoSetFirstItem(int n);
c6179a84 93 virtual void DoSetSelection(int n, bool select);
fb896a32
DE
94
95// pure virtuals from wxItemContainer
96public:
97 // deleting items
a236aa20
VZ
98 virtual void DoClear();
99 virtual void DoDeleteOneItem(unsigned int n);
fb896a32 100 // accessing strings
aa61d352
VZ
101 virtual unsigned int GetCount() const;
102 virtual wxString GetString(unsigned int n) const;
103 virtual void SetString(unsigned int n, const wxString& s);
853dcc57 104 virtual int FindString(const wxString& s, bool bCase = false) const;
fb896a32 105 // selection
fb896a32
DE
106 virtual int GetSelection() const;
107protected:
a236aa20
VZ
108 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
109 unsigned int pos,
110 void **clientData, wxClientDataType type);
aa61d352
VZ
111 virtual void DoSetItemClientData(unsigned int n, void* clientData);
112 virtual void* DoGetItemClientData(unsigned int n) const;
fb896a32
DE
113};
114
115#endif // __WX_COCOA_LISTBOX_H__