2001-06-26 20:59:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/univ/combobox.h
|
|
|
|
// Purpose: the universal combobox
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 30.08.00
|
|
|
|
// RCS-ID: $Id$
|
2001-07-02 19:42:27 +00:00
|
|
|
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2001-06-26 20:59:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _WX_UNIV_COMBOBOX_H_
|
|
|
|
#define _WX_UNIV_COMBOBOX_H_
|
|
|
|
|
2006-05-09 16:18:19 +00:00
|
|
|
#include "wx/combo.h"
|
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxListBox;
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2006-05-09 16:18:19 +00:00
|
|
|
// NB: some actions supported by this control are in wx/generic/combo.h
|
2001-06-26 20:59:19 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// choose the next/prev/specified (by numArg) item
|
|
|
|
#define wxACTION_COMBOBOX_SELECT_NEXT _T("next")
|
|
|
|
#define wxACTION_COMBOBOX_SELECT_PREV _T("prev")
|
|
|
|
#define wxACTION_COMBOBOX_SELECT _T("select")
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxComboBox: a combination of text control and a listbox
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-05-16 22:57:40 +00:00
|
|
|
class WXDLLEXPORT wxComboBox : public wxComboCtrl, public wxComboBoxBase
|
2001-06-26 20:59:19 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctors and such
|
2004-01-15 13:49:22 +00:00
|
|
|
wxComboBox() { Init(); }
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
wxComboBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
2004-02-07 15:07:08 +00:00
|
|
|
const wxString choices[] = (const wxString *) NULL,
|
2001-06-26 20:59:19 +00:00
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2004-01-15 13:49:22 +00:00
|
|
|
const wxString& name = wxComboBoxNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
|
|
|
(void)Create(parent, id, value, pos, size, n, choices,
|
|
|
|
style, validator, name);
|
|
|
|
}
|
2004-01-31 18:21:45 +00:00
|
|
|
wxComboBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr);
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
|
|
|
const wxString choices[] = (const wxString *) NULL,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr);
|
2004-01-31 18:21:45 +00:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr);
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
virtual ~wxComboBox();
|
|
|
|
|
|
|
|
// the wxUniversal-specific methods
|
|
|
|
// --------------------------------
|
|
|
|
|
|
|
|
// implement the combobox interface
|
|
|
|
|
|
|
|
// wxTextCtrl methods
|
|
|
|
virtual wxString GetValue() const;
|
|
|
|
virtual void SetValue(const wxString& value);
|
2007-09-26 00:30:22 +00:00
|
|
|
virtual void WriteText(const wxString& value);
|
2001-06-26 20:59:19 +00:00
|
|
|
virtual void Copy();
|
|
|
|
virtual void Cut();
|
|
|
|
virtual void Paste();
|
|
|
|
virtual void SetInsertionPoint(long pos);
|
|
|
|
virtual void SetInsertionPointEnd();
|
|
|
|
virtual long GetInsertionPoint() const;
|
2005-01-19 16:25:34 +00:00
|
|
|
virtual wxTextPos GetLastPosition() const;
|
2001-06-26 20:59:19 +00:00
|
|
|
virtual void Replace(long from, long to, const wxString& value);
|
|
|
|
virtual void Remove(long from, long to);
|
|
|
|
virtual void SetSelection(long from, long to);
|
2007-09-26 00:30:22 +00:00
|
|
|
virtual void GetSelection(long *from, long *to) const;
|
2001-06-26 20:59:19 +00:00
|
|
|
virtual void SetEditable(bool editable);
|
2004-12-09 15:16:51 +00:00
|
|
|
virtual bool IsEditable() const;
|
|
|
|
|
|
|
|
virtual void Undo();
|
|
|
|
virtual void Redo();
|
|
|
|
virtual void SelectAll();
|
|
|
|
|
|
|
|
virtual bool CanCopy() const;
|
|
|
|
virtual bool CanCut() const;
|
|
|
|
virtual bool CanPaste() const;
|
|
|
|
virtual bool CanUndo() const;
|
|
|
|
virtual bool CanRedo() const;
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
// wxControlWithItems methods
|
2007-07-26 13:54:14 +00:00
|
|
|
virtual void DoClear();
|
|
|
|
virtual void DoDeleteOneItem(unsigned int n);
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual unsigned int GetCount() const;
|
|
|
|
virtual wxString GetString(unsigned int n) const;
|
|
|
|
virtual void SetString(unsigned int n, const wxString& s);
|
2005-09-27 16:54:43 +00:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
2005-02-13 17:08:27 +00:00
|
|
|
virtual void SetSelection(int n);
|
2001-06-26 20:59:19 +00:00
|
|
|
virtual int GetSelection() const;
|
2007-09-26 00:30:22 +00:00
|
|
|
virtual wxString GetStringSelection() const;
|
2001-11-21 21:42:44 +00:00
|
|
|
|
2003-09-20 16:31:06 +00:00
|
|
|
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
2001-11-20 23:59:24 +00:00
|
|
|
|
2006-05-09 16:18:19 +00:00
|
|
|
// we have our own input handler and our own actions
|
2006-05-16 22:57:40 +00:00
|
|
|
// (but wxComboCtrl already handled Popup/Dismiss)
|
2006-05-09 16:18:19 +00:00
|
|
|
/*
|
|
|
|
virtual bool PerformAction(const wxControlAction& action,
|
|
|
|
long numArg = 0l,
|
|
|
|
const wxString& strArg = wxEmptyString);
|
|
|
|
*/
|
|
|
|
|
2006-09-14 19:36:47 +00:00
|
|
|
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
|
|
|
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
|
|
|
{
|
|
|
|
return GetStdInputHandler(handlerDef);
|
|
|
|
}
|
|
|
|
|
2007-09-16 23:12:27 +00:00
|
|
|
// we delegate our client data handling to wxListBox which we use for the
|
|
|
|
// items, so override this and other methods dealing with the client data
|
2007-10-02 11:32:25 +00:00
|
|
|
virtual wxClientDataType GetClientDataType() const;
|
2007-09-16 23:12:27 +00:00
|
|
|
virtual void SetClientDataType(wxClientDataType clientDataItemsType);
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
protected:
|
2007-07-26 13:54:14 +00:00
|
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
|
|
|
unsigned int pos,
|
|
|
|
void **clientData, wxClientDataType type);
|
|
|
|
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const;
|
2001-06-26 20:59:19 +00:00
|
|
|
|
2007-09-16 23:12:27 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
// get the associated listbox
|
|
|
|
wxListBox *GetLBox() const { return m_lbox; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
// the popup listbox
|
|
|
|
wxListBox *m_lbox;
|
|
|
|
|
|
|
|
//DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_UNIV_COMBOBOX_H_
|