2006-05-08 19:42:45 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/generic/combo.h
|
2006-05-16 18:57:40 -04:00
|
|
|
// Purpose: Generic wxComboCtrl
|
2006-05-08 19:42:45 -04:00
|
|
|
// Author: Jaakko Salli
|
|
|
|
// Modified by:
|
|
|
|
// Created: Apr-30-2006
|
|
|
|
// Copyright: (c) Jaakko Salli
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-09-19 13:29:45 -04:00
|
|
|
#ifndef _WX_GENERIC_COMBOCTRL_H_
|
|
|
|
#define _WX_GENERIC_COMBOCTRL_H_
|
2006-05-08 19:42:45 -04:00
|
|
|
|
2006-05-16 18:57:40 -04:00
|
|
|
#if wxUSE_COMBOCTRL
|
2006-05-08 19:42:45 -04:00
|
|
|
|
|
|
|
// Only define generic if native doesn't have all the features
|
|
|
|
#if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2006-05-16 18:57:40 -04:00
|
|
|
// Generic wxComboCtrl
|
2006-05-08 19:42:45 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
|
|
|
|
// all actions of single line text controls are supported
|
|
|
|
|
|
|
|
// popup/dismiss the choice window
|
2009-07-23 16:30:22 -04:00
|
|
|
#define wxACTION_COMBOBOX_POPUP wxT("popup")
|
|
|
|
#define wxACTION_COMBOBOX_DISMISS wxT("dismiss")
|
2006-05-08 19:42:45 -04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2011-03-20 06:59:22 -04:00
|
|
|
#include "wx/dcbuffer.h"
|
|
|
|
|
2007-11-12 16:37:46 -05:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
|
2006-05-08 19:42:45 -04:00
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase
|
2006-05-08 19:42:45 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctors and such
|
2006-09-19 13:29:45 -04:00
|
|
|
wxGenericComboCtrl() : wxComboCtrlBase() { Init(); }
|
|
|
|
|
|
|
|
wxGenericComboCtrl(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr)
|
2006-05-16 18:57:40 -04:00
|
|
|
: wxComboCtrlBase()
|
2006-05-08 19:42:45 -04:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
|
|
|
(void)Create(parent, id, value, pos, size, style, validator, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr);
|
|
|
|
|
2006-09-19 13:29:45 -04:00
|
|
|
virtual ~wxGenericComboCtrl();
|
2006-05-08 19:42:45 -04:00
|
|
|
|
2006-10-09 16:12:19 -04:00
|
|
|
void SetCustomPaintWidth( int width );
|
|
|
|
|
2006-08-12 20:35:02 -04:00
|
|
|
virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
|
|
|
|
|
2006-05-16 18:57:40 -04:00
|
|
|
static int GetFeatures() { return wxComboCtrlFeatures::All; }
|
2006-05-08 19:42:45 -04:00
|
|
|
|
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
// we have our own input handler and our own actions
|
|
|
|
virtual bool PerformAction(const wxControlAction& action,
|
|
|
|
long numArg = 0l,
|
|
|
|
const wxString& strArg = wxEmptyString);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2010-12-16 12:21:49 -05:00
|
|
|
// Dummies for platform-specific wxTextEntry implementations
|
2010-12-20 06:23:14 -05:00
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
// Looks like there's nothing we need to override here
|
2010-12-23 05:26:06 -05:00
|
|
|
#elif defined(__WXMOTIF__)
|
|
|
|
virtual WXWidget GetTextWidget() const { return NULL; }
|
2010-12-20 06:23:14 -05:00
|
|
|
#elif defined(__WXGTK__)
|
2010-12-20 08:33:39 -05:00
|
|
|
#if defined(__WXGTK20__)
|
2010-12-16 12:21:49 -05:00
|
|
|
virtual GtkEditable *GetEditable() const { return NULL; }
|
|
|
|
virtual GtkEntry *GetEntry() const { return NULL; }
|
2010-12-20 08:33:39 -05:00
|
|
|
#endif
|
2010-12-16 12:21:49 -05:00
|
|
|
#elif defined(__WXMAC__)
|
|
|
|
// Looks like there's nothing we need to override here
|
|
|
|
#endif
|
|
|
|
|
2011-03-20 06:59:22 -04:00
|
|
|
// For better transparent background rendering
|
|
|
|
virtual bool HasTransparentBackground()
|
|
|
|
{
|
|
|
|
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
|
|
|
|
#ifdef __WXGTK__
|
|
|
|
// Sanity check for GTK+
|
|
|
|
return IsDoubleBuffered();
|
|
|
|
#else
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-05-08 19:42:45 -04:00
|
|
|
// Mandatory virtuals
|
|
|
|
virtual void OnResize();
|
|
|
|
|
|
|
|
// Event handlers
|
|
|
|
void OnPaintEvent( wxPaintEvent& event );
|
|
|
|
void OnMouseEvent( wxMouseEvent& event );
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
2006-09-19 13:29:45 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl)
|
2006-05-08 19:42:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _WX_COMBOCONTROL_H_
|
|
|
|
|
2006-05-16 18:57:40 -04:00
|
|
|
// If native wxComboCtrl was not defined, then prepare a simple
|
2006-05-08 19:42:45 -04:00
|
|
|
// front-end so that wxRTTI works as expected.
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxComboCtrl : public wxGenericComboCtrl
|
2006-05-08 19:42:45 -04:00
|
|
|
{
|
|
|
|
public:
|
2006-09-19 13:29:45 -04:00
|
|
|
wxComboCtrl() : wxGenericComboCtrl() {}
|
2006-05-08 19:42:45 -04:00
|
|
|
|
2006-05-16 18:57:40 -04:00
|
|
|
wxComboCtrl(wxWindow *parent,
|
2006-09-19 13:29:45 -04:00
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr)
|
|
|
|
: wxGenericComboCtrl()
|
2006-05-08 19:42:45 -04:00
|
|
|
{
|
|
|
|
(void)Create(parent, id, value, pos, size, style, validator, name);
|
|
|
|
}
|
|
|
|
|
2006-05-16 18:57:40 -04:00
|
|
|
virtual ~wxComboCtrl() {}
|
2006-05-08 19:42:45 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
private:
|
2006-05-16 18:57:40 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxComboCtrl)
|
2006-05-08 19:42:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_COMBOCONTROL_H_
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2006-09-19 13:29:45 -04:00
|
|
|
#define wxGenericComboCtrl wxComboCtrl
|
2006-05-08 19:42:45 -04:00
|
|
|
|
|
|
|
#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
|
|
|
|
|
2006-05-16 18:57:40 -04:00
|
|
|
#endif // wxUSE_COMBOCTRL
|
2006-05-08 19:42:45 -04:00
|
|
|
#endif
|
2006-09-19 13:29:45 -04:00
|
|
|
// _WX_GENERIC_COMBOCTRL_H_
|