2003-03-21 20:25:09 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/cocoa/choice.h
|
|
|
|
// Purpose: wxChoice class
|
|
|
|
// Author: David Elliott
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2003/03/16
|
|
|
|
// RCS-ID: $Id:
|
|
|
|
// Copyright: (c) 2003 David Elliott
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2003-03-21 20:25:09 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __WX_COCOA_CHOICE_H__
|
|
|
|
#define __WX_COCOA_CHOICE_H__
|
|
|
|
|
2003-09-06 00:33:02 +00:00
|
|
|
//#include "wx/cocoa/NSPopUpButton.h"
|
|
|
|
#include "wx/cocoa/NSMenu.h"
|
2003-03-21 20:25:09 +00:00
|
|
|
|
2004-01-31 18:21:45 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxSortedArrayString;
|
|
|
|
|
2003-03-21 20:25:09 +00:00
|
|
|
// ========================================================================
|
|
|
|
// wxChoice
|
|
|
|
// ========================================================================
|
2003-09-06 00:33:02 +00:00
|
|
|
class WXDLLEXPORT wxChoice: public wxChoiceBase /*, protected wxCocoaNSPopUpButton */, protected wxCocoaNSMenu
|
2003-03-21 20:25:09 +00:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxChoice)
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
// WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView)
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// initialization
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
2003-09-06 00:33:02 +00:00
|
|
|
wxChoice() { Init(); }
|
2003-03-21 20:25:09 +00:00
|
|
|
wxChoice(wxWindow *parent, wxWindowID winid,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0, const wxString choices[] = NULL,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxChoiceNameStr)
|
|
|
|
{
|
2003-09-06 00:33:02 +00:00
|
|
|
Init();
|
2003-03-21 20:25:09 +00:00
|
|
|
Create(parent, winid, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 18:21:45 +00:00
|
|
|
wxChoice(wxWindow *parent, wxWindowID winid,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxChoiceNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
Create(parent, winid, pos, size, choices, style, validator, name);
|
|
|
|
}
|
2003-03-21 20:25:09 +00:00
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID winid,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0, const wxString choices[] = NULL,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxChoiceNameStr);
|
2004-01-31 18:21:45 +00:00
|
|
|
bool Create(wxWindow *parent, wxWindowID winid,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxChoiceNameStr);
|
2003-03-21 20:25:09 +00:00
|
|
|
virtual ~wxChoice();
|
2003-09-06 00:33:02 +00:00
|
|
|
protected:
|
|
|
|
void Init();
|
2003-03-21 20:25:09 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Cocoa callbacks
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
protected:
|
2003-09-06 00:33:02 +00:00
|
|
|
void CocoaNotification_menuDidSendAction(WX_NSNotification notification);
|
2003-03-21 20:25:09 +00:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
|
|
|
virtual void Clear();
|
|
|
|
virtual void Delete(int);
|
|
|
|
virtual int GetCount() const;
|
|
|
|
virtual wxString GetString(int) const;
|
|
|
|
virtual void SetString(int, const wxString&);
|
|
|
|
virtual int FindString(const wxString&) const;
|
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual int DoAppend(const wxString&);
|
2003-06-07 01:38:13 +00:00
|
|
|
virtual int DoInsert(const wxString&, int);
|
2003-03-21 20:25:09 +00:00
|
|
|
virtual void DoSetItemClientData(int, void*);
|
|
|
|
virtual void* DoGetItemClientData(int) const;
|
|
|
|
virtual void DoSetItemClientObject(int, wxClientData*);
|
|
|
|
virtual wxClientData* DoGetItemClientObject(int) const;
|
|
|
|
virtual void SetSelection(int);
|
2003-09-06 00:33:02 +00:00
|
|
|
protected:
|
|
|
|
wxSortedArrayString *m_sortedStrings;
|
|
|
|
wxArrayPtrVoid m_itemsClientData;
|
2003-03-21 20:25:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __WX_COCOA_CHOICE_H__
|