2001-06-26 16:59:19 -04: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 15:42:27 -04:00
|
|
|
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2001-06-26 16:59:19 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _WX_UNIV_COMBOBOX_H_
|
|
|
|
#define _WX_UNIV_COMBOBOX_H_
|
|
|
|
|
2006-05-09 12:18:19 -04:00
|
|
|
#include "wx/combo.h"
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxListBox;
|
2001-06-26 16:59:19 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2006-05-09 12:18:19 -04:00
|
|
|
// NB: some actions supported by this control are in wx/generic/combo.h
|
2001-06-26 16:59:19 -04: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
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxComboBox : public wxComboCtrl, public wxComboBoxBase
|
2001-06-26 16:59:19 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctors and such
|
2004-01-15 08:49:22 -05:00
|
|
|
wxComboBox() { Init(); }
|
2001-06-26 16:59:19 -04:00
|
|
|
|
|
|
|
wxComboBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
2004-02-07 10:07:08 -05:00
|
|
|
const wxString choices[] = (const wxString *) NULL,
|
2001-06-26 16:59:19 -04:00
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2004-01-15 08:49:22 -05:00
|
|
|
const wxString& name = wxComboBoxNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
|
|
|
(void)Create(parent, id, value, pos, size, n, choices,
|
|
|
|
style, validator, name);
|
|
|
|
}
|
2004-01-31 13:21:45 -05: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 16:59:19 -04: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 13:21:45 -05: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 16:59:19 -04: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-25 20:30:22 -04:00
|
|
|
virtual void WriteText(const wxString& value);
|
2001-06-26 16:59:19 -04: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 11:25:34 -05:00
|
|
|
virtual wxTextPos GetLastPosition() const;
|
2001-06-26 16:59:19 -04: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-25 20:30:22 -04:00
|
|
|
virtual void GetSelection(long *from, long *to) const;
|
2001-06-26 16:59:19 -04:00
|
|
|
virtual void SetEditable(bool editable);
|
2004-12-09 10:16:51 -05: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 16:59:19 -04:00
|
|
|
|
|
|
|
// wxControlWithItems methods
|
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 n) const;
|
|
|
|
virtual void SetString(unsigned int n, const wxString& s);
|
2005-09-27 12:54:43 -04:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
2005-02-13 12:08:27 -05:00
|
|
|
virtual void SetSelection(int n);
|
2001-06-26 16:59:19 -04:00
|
|
|
virtual int GetSelection() const;
|
2007-09-25 20:30:22 -04:00
|
|
|
virtual wxString GetStringSelection() const;
|
2001-11-21 16:42:44 -05:00
|
|
|
|
2003-09-20 12:31:06 -04:00
|
|
|
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
2001-11-20 18:59:24 -05:00
|
|
|
|
2006-05-09 12:18:19 -04:00
|
|
|
// we have our own input handler and our own actions
|
2006-05-16 18:57:40 -04:00
|
|
|
// (but wxComboCtrl already handled Popup/Dismiss)
|
2006-05-09 12:18:19 -04:00
|
|
|
/*
|
|
|
|
virtual bool PerformAction(const wxControlAction& action,
|
|
|
|
long numArg = 0l,
|
|
|
|
const wxString& strArg = wxEmptyString);
|
|
|
|
*/
|
|
|
|
|
2006-09-14 15:36:47 -04:00
|
|
|
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
|
|
|
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
|
|
|
{
|
|
|
|
return GetStdInputHandler(handlerDef);
|
|
|
|
}
|
|
|
|
|
2007-09-16 19:12:27 -04: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 07:32:25 -04:00
|
|
|
virtual wxClientDataType GetClientDataType() const;
|
2007-09-16 19:12:27 -04:00
|
|
|
virtual void SetClientDataType(wxClientDataType clientDataItemsType);
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
protected:
|
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 n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const;
|
2001-06-26 16:59:19 -04:00
|
|
|
|
2007-09-16 19:12:27 -04:00
|
|
|
|
2001-06-26 16:59:19 -04: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_
|