2003-07-14 11:58:33 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/cocoa/combobox.h
|
|
|
|
// Purpose: wxComboBox class
|
2005-02-16 23:45:13 -05:00
|
|
|
// Author: Ryan Norton
|
2003-07-14 11:58:33 -04:00
|
|
|
// Modified by:
|
2005-02-16 23:45:13 -05:00
|
|
|
// Created: 2005/02/16
|
2003-07-14 11:58:33 -04:00
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2003 David Elliott
|
2005-01-19 11:25:34 -05:00
|
|
|
// Licence: wxWindows licence
|
2003-07-14 11:58:33 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __WX_COCOA_COMBOBOX_H__
|
|
|
|
#define __WX_COCOA_COMBOBOX_H__
|
|
|
|
|
2005-02-16 23:45:13 -05:00
|
|
|
//Begin NSComboBox.h
|
|
|
|
|
|
|
|
#include "wx/hashmap.h"
|
|
|
|
#include "wx/cocoa/ObjcAssociate.h"
|
|
|
|
|
2007-10-05 16:12:02 -04:00
|
|
|
#include "wx/textctrl.h"
|
|
|
|
|
2005-02-16 23:45:13 -05:00
|
|
|
DECLARE_WXCOCOA_OBJC_CLASS(NSComboBox);
|
|
|
|
|
|
|
|
WX_DECLARE_OBJC_HASHMAP(NSComboBox);
|
|
|
|
class wxCocoaNSComboBox
|
|
|
|
{
|
|
|
|
WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSComboBox)
|
|
|
|
public:
|
|
|
|
void AssociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
|
|
|
|
void DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
|
2005-09-27 12:54:43 -04:00
|
|
|
|
2005-02-16 23:45:13 -05:00
|
|
|
virtual void doWxEvent(int nEvent) = 0;
|
2006-03-12 10:10:23 -05:00
|
|
|
virtual ~wxCocoaNSComboBox() { }
|
2005-02-16 23:45:13 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
//begin combobox.h
|
|
|
|
|
|
|
|
#include "wx/dynarray.h"
|
2003-07-14 11:58:33 -04:00
|
|
|
|
|
|
|
// ========================================================================
|
|
|
|
// wxComboBox
|
|
|
|
// ========================================================================
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase, protected wxCocoaNSComboBox, protected wxCocoaNSTextField
|
2003-07-14 11:58:33 -04:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
|
|
|
DECLARE_EVENT_TABLE()
|
2005-02-16 23:45:13 -05:00
|
|
|
WX_DECLARE_COCOA_OWNER(NSComboBox,NSTextField,NSView)
|
2007-10-05 16:12:02 -04:00
|
|
|
WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView)
|
2003-07-14 11:58:33 -04:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// initialization
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
|
|
|
wxComboBox() { }
|
|
|
|
wxComboBox(wxWindow *parent, wxWindowID winid,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
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 = wxComboBoxNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, winid, value, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 13:21:45 -05:00
|
|
|
wxComboBox(wxWindow *parent, wxWindowID winid,
|
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, winid, value, pos, size, choices, style,
|
|
|
|
validator, name);
|
|
|
|
}
|
2003-07-14 11:58:33 -04:00
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID winid,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
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 = wxComboBoxNameStr);
|
2004-01-31 13:21:45 -05:00
|
|
|
bool Create(wxWindow *parent, wxWindowID winid,
|
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr);
|
2003-07-14 11:58:33 -04:00
|
|
|
virtual ~wxComboBox();
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Cocoa callbacks
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
protected:
|
2005-02-16 23:45:13 -05:00
|
|
|
wxArrayPtrVoid m_Datas;
|
|
|
|
virtual void doWxEvent(int nEvent);
|
|
|
|
|
2007-10-05 16:12:02 -04:00
|
|
|
virtual void Cocoa_didChangeText()
|
|
|
|
{}
|
2003-07-14 11:58:33 -04:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
2007-07-26 14:40:44 -04:00
|
|
|
void Clear() // HACK
|
|
|
|
{ wxComboBoxBase::Clear(); }
|
|
|
|
|
2003-07-14 11:58:33 -04:00
|
|
|
// wxCombobox methods
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void SetSelection(int pos);
|
2003-07-14 11:58:33 -04:00
|
|
|
// Overlapping methods
|
|
|
|
virtual wxString GetStringSelection();
|
|
|
|
// wxItemContainer
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual void DoClear();
|
|
|
|
virtual void DoDeleteOneItem(unsigned int n);
|
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-07-14 11:58:33 -04: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);
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoSetItemClientData(unsigned int, void*);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int) const;
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
|
2007-10-05 16:12:02 -04:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// wxTextEntryBase virtual implementations:
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// FIXME: This needs to be moved to some sort of common code.
|
|
|
|
virtual void WriteText(const wxString&);
|
|
|
|
virtual wxString GetValue() const;
|
|
|
|
virtual void Remove(long, long);
|
|
|
|
virtual void Cut();
|
|
|
|
virtual void Copy();
|
|
|
|
virtual void Paste();
|
|
|
|
virtual void Undo();
|
|
|
|
virtual void Redo();
|
|
|
|
virtual bool CanUndo() const;
|
|
|
|
virtual bool CanRedo() const;
|
|
|
|
virtual void SetInsertionPoint(long pos);
|
|
|
|
virtual long GetInsertionPoint() const;
|
|
|
|
virtual wxTextPos GetLastPosition() const;
|
|
|
|
virtual void SetSelection(long from, long to);
|
|
|
|
virtual void GetSelection(long *from, long *to) const;
|
|
|
|
virtual bool IsEditable() const;
|
|
|
|
virtual void SetEditable(bool editable);
|
2009-03-02 07:25:01 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
// implement wxTextEntry pure virtual method
|
|
|
|
virtual wxWindow *GetEditableWindow() { return this; }
|
2003-07-14 11:58:33 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __WX_COCOA_COMBOBOX_H__
|