2003-03-21 15:25:09 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/cocoa/choice.h
|
|
|
|
// Purpose: wxChoice class
|
|
|
|
// Author: David Elliott
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2003/03/16
|
2005-09-27 12:54:43 -04:00
|
|
|
// RCS-ID: $Id$
|
2003-03-21 15:25:09 -05:00
|
|
|
// Copyright: (c) 2003 David Elliott
|
2005-09-27 12:54:43 -04:00
|
|
|
// Licence: wxWindows licence
|
2003-03-21 15:25:09 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __WX_COCOA_CHOICE_H__
|
|
|
|
#define __WX_COCOA_CHOICE_H__
|
|
|
|
|
2003-09-05 20:33:02 -04:00
|
|
|
//#include "wx/cocoa/NSPopUpButton.h"
|
|
|
|
#include "wx/cocoa/NSMenu.h"
|
2003-03-21 15:25:09 -05:00
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
|
2004-01-31 13:21:45 -05:00
|
|
|
|
2003-03-21 15:25:09 -05:00
|
|
|
// ========================================================================
|
|
|
|
// wxChoice
|
|
|
|
// ========================================================================
|
2003-09-05 20:33:02 -04:00
|
|
|
class WXDLLEXPORT wxChoice: public wxChoiceBase /*, protected wxCocoaNSPopUpButton */, protected wxCocoaNSMenu
|
2003-03-21 15:25:09 -05:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxChoice)
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
// WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView)
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// initialization
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
2003-09-05 20:33:02 -04:00
|
|
|
wxChoice() { Init(); }
|
2003-03-21 15:25:09 -05: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-05 20:33:02 -04:00
|
|
|
Init();
|
2003-03-21 15:25:09 -05:00
|
|
|
Create(parent, winid, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 13:21:45 -05: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 15:25:09 -05: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 13:21:45 -05: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 15:25:09 -05:00
|
|
|
virtual ~wxChoice();
|
2003-09-05 20:33:02 -04:00
|
|
|
protected:
|
|
|
|
void Init();
|
2003-03-21 15:25:09 -05:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Cocoa callbacks
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
protected:
|
2003-09-05 20:33:02 -04:00
|
|
|
void CocoaNotification_menuDidSendAction(WX_NSNotification notification);
|
2003-03-21 15:25:09 -05:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual void DoClear();
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual unsigned int GetCount() const;
|
|
|
|
virtual wxString GetString(unsigned int) const;
|
|
|
|
virtual void SetString(unsigned int pos, const wxString&);
|
2005-09-27 12:54:43 -04:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
2003-03-21 15:25:09 -05:00
|
|
|
virtual int GetSelection() const;
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
|
|
|
unsigned int pos,
|
|
|
|
void **clientData, wxClientDataType type);
|
|
|
|
virtual void DoDeleteOneItem(unsigned int pos);
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoSetItemClientData(unsigned int, void*);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int) const;
|
|
|
|
virtual void SetSelection(int pos);
|
2003-09-05 20:33:02 -04:00
|
|
|
protected:
|
|
|
|
wxSortedArrayString *m_sortedStrings;
|
|
|
|
wxArrayPtrVoid m_itemsClientData;
|
2003-03-21 15:25:09 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __WX_COCOA_CHOICE_H__
|