]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/choice.h
Use gtk_list_store_insert_with_values() to set entry at same time item is inserted.
[wxWidgets.git] / include / wx / cocoa / choice.h
CommitLineData
da0634c1
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cocoa/choice.h
3// Purpose: wxChoice class
4// Author: David Elliott
5// Modified by:
6// Created: 2003/03/16
853dcc57 7// RCS-ID: $Id$
da0634c1 8// Copyright: (c) 2003 David Elliott
853dcc57 9// Licence: wxWindows licence
da0634c1
DE
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __WX_COCOA_CHOICE_H__
13#define __WX_COCOA_CHOICE_H__
14
f154ff60
DE
15//#include "wx/cocoa/NSPopUpButton.h"
16#include "wx/cocoa/NSMenu.h"
da0634c1 17
b5dbe15d 18class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
584ad2a3 19
da0634c1
DE
20// ========================================================================
21// wxChoice
22// ========================================================================
53a2db12 23class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase /*, protected wxCocoaNSPopUpButton */, protected wxCocoaNSMenu
da0634c1
DE
24{
25 DECLARE_DYNAMIC_CLASS(wxChoice)
26 DECLARE_EVENT_TABLE()
27// WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView)
28// ------------------------------------------------------------------------
29// initialization
30// ------------------------------------------------------------------------
31public:
f154ff60 32 wxChoice() { Init(); }
da0634c1
DE
33 wxChoice(wxWindow *parent, wxWindowID winid,
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 int n = 0, const wxString choices[] = NULL,
37 long style = 0,
38 const wxValidator& validator = wxDefaultValidator,
39 const wxString& name = wxChoiceNameStr)
40 {
f154ff60 41 Init();
da0634c1
DE
42 Create(parent, winid, pos, size, n, choices, style, validator, name);
43 }
584ad2a3
MB
44 wxChoice(wxWindow *parent, wxWindowID winid,
45 const wxPoint& pos,
46 const wxSize& size,
47 const wxArrayString& choices,
48 long style = 0,
49 const wxValidator& validator = wxDefaultValidator,
50 const wxString& name = wxChoiceNameStr)
51 {
52 Init();
53 Create(parent, winid, pos, size, choices, style, validator, name);
54 }
da0634c1
DE
55
56 bool Create(wxWindow *parent, wxWindowID winid,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 int n = 0, const wxString choices[] = NULL,
60 long style = 0,
61 const wxValidator& validator = wxDefaultValidator,
62 const wxString& name = wxChoiceNameStr);
584ad2a3
MB
63 bool Create(wxWindow *parent, wxWindowID winid,
64 const wxPoint& pos,
65 const wxSize& size,
66 const wxArrayString& choices,
67 long style = 0,
68 const wxValidator& validator = wxDefaultValidator,
69 const wxString& name = wxChoiceNameStr);
da0634c1 70 virtual ~wxChoice();
f154ff60
DE
71protected:
72 void Init();
da0634c1
DE
73
74// ------------------------------------------------------------------------
75// Cocoa callbacks
76// ------------------------------------------------------------------------
77protected:
f154ff60 78 void CocoaNotification_menuDidSendAction(WX_NSNotification notification);
da0634c1
DE
79// ------------------------------------------------------------------------
80// Implementation
81// ------------------------------------------------------------------------
82public:
a236aa20 83 virtual void DoClear();
aa61d352
VZ
84 virtual unsigned int GetCount() const;
85 virtual wxString GetString(unsigned int) const;
86 virtual void SetString(unsigned int pos, const wxString&);
853dcc57 87 virtual int FindString(const wxString& s, bool bCase = false) const;
da0634c1 88 virtual int GetSelection() const;
a236aa20
VZ
89 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
90 unsigned int pos,
91 void **clientData, wxClientDataType type);
92 virtual void DoDeleteOneItem(unsigned int pos);
aa61d352
VZ
93 virtual void DoSetItemClientData(unsigned int, void*);
94 virtual void* DoGetItemClientData(unsigned int) const;
aa61d352 95 virtual void SetSelection(int pos);
f154ff60
DE
96protected:
97 wxSortedArrayString *m_sortedStrings;
98 wxArrayPtrVoid m_itemsClientData;
da0634c1
DE
99};
100
101#endif // __WX_COCOA_CHOICE_H__