1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 12:54:43 -04:00
|
|
|
// Name: wx/gtk/combobox.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Created: 01/02/97
|
1998-10-26 05:56:58 -05:00
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
2005-01-19 11:25:34 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-08-30 01:55:56 -04:00
|
|
|
#ifndef _WX_GTK_COMBOBOX_H_
|
|
|
|
#define _WX_GTK_COMBOBOX_H_
|
1998-05-30 13:11:51 -04:00
|
|
|
|
2008-05-18 13:26:28 -04:00
|
|
|
#include "wx/choice.h"
|
|
|
|
|
2007-11-05 17:31:24 -05:00
|
|
|
typedef struct _GtkEntry GtkEntry;
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxComboBox
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2008-05-18 13:26:28 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
|
|
|
|
public wxTextEntry
|
1998-05-30 13:11:51 -04:00
|
|
|
{
|
1998-11-06 03:50:52 -05:00
|
|
|
public:
|
2008-05-27 06:17:56 -04:00
|
|
|
wxComboBox()
|
|
|
|
: wxChoice(), wxTextEntry()
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
2007-09-25 20:30:22 -04:00
|
|
|
wxComboBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
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)
|
2008-05-27 06:17:56 -04:00
|
|
|
: wxChoice(), wxTextEntry()
|
1999-10-11 06:05:36 -04:00
|
|
|
{
|
2008-05-27 06:17:56 -04:00
|
|
|
Init();
|
1999-10-11 06:05:36 -04:00
|
|
|
Create(parent, id, value, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2007-09-25 20:30:22 -04: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)
|
2008-05-27 06:17:56 -04:00
|
|
|
: wxChoice(), wxTextEntry()
|
2004-01-31 13:21:45 -05:00
|
|
|
{
|
2008-05-27 06:17:56 -04:00
|
|
|
Init();
|
2004-01-31 13:21:45 -05:00
|
|
|
Create(parent, id, value, pos, size, choices, style, validator, name);
|
|
|
|
}
|
2012-10-17 12:23:18 -04:00
|
|
|
~wxComboBox();
|
2003-09-20 12:31:06 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
2007-09-25 20:30:22 -04:00
|
|
|
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,
|
2007-09-25 20:30:22 -04:00
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr);
|
1998-05-30 13:11:51 -04:00
|
|
|
|
2008-05-18 13:26:28 -04:00
|
|
|
// Set/GetSelection() from wxTextEntry and wxChoice
|
2006-04-28 20:46:05 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void SetSelection(int n) wxOVERRIDE { wxChoice::SetSelection(n); }
|
|
|
|
virtual void SetSelection(long from, long to) wxOVERRIDE
|
2008-05-18 13:26:28 -04:00
|
|
|
{ wxTextEntry::SetSelection(from, to); }
|
2006-04-28 20:46:05 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual int GetSelection() const wxOVERRIDE { return wxChoice::GetSelection(); }
|
|
|
|
virtual void GetSelection(long *from, long *to) const wxOVERRIDE
|
2008-05-18 13:26:28 -04:00
|
|
|
{ return wxTextEntry::GetSelection(from, to); }
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxString GetStringSelection() const wxOVERRIDE
|
2007-09-25 20:30:22 -04:00
|
|
|
{
|
|
|
|
return wxItemContainer::GetStringSelection();
|
|
|
|
}
|
2012-03-11 19:55:19 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void SetString(unsigned int n, const wxString& string) wxOVERRIDE;
|
2012-03-11 19:55:19 -04:00
|
|
|
|
2010-01-23 20:00:45 -05:00
|
|
|
virtual void Popup();
|
|
|
|
virtual void Dismiss();
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2014-11-01 09:56:26 -04:00
|
|
|
virtual void Clear() wxOVERRIDE;
|
2008-05-18 13:26:28 -04:00
|
|
|
|
2011-08-21 08:06:16 -04:00
|
|
|
// See wxComboBoxBase discussion of IsEmpty().
|
|
|
|
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
|
|
|
|
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
|
2003-07-09 17:55:04 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
void OnChar( wxKeyEvent &event );
|
2003-07-09 17:55:04 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void SetValue(const wxString& value) wxOVERRIDE;
|
2010-08-16 13:48:28 -04:00
|
|
|
|
2004-12-09 10:16:51 -05:00
|
|
|
// Standard event handling
|
|
|
|
void OnCut(wxCommandEvent& event);
|
|
|
|
void OnCopy(wxCommandEvent& event);
|
|
|
|
void OnPaste(wxCommandEvent& event);
|
|
|
|
void OnUndo(wxCommandEvent& event);
|
|
|
|
void OnRedo(wxCommandEvent& event);
|
|
|
|
void OnDelete(wxCommandEvent& event);
|
|
|
|
void OnSelectAll(wxCommandEvent& event);
|
|
|
|
|
|
|
|
void OnUpdateCut(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateCopy(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdatePaste(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateUndo(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateRedo(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateDelete(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateSelectAll(wxUpdateUIEvent& event);
|
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void GTKDisableEvents() wxOVERRIDE;
|
|
|
|
virtual void GTKEnableEvents() wxOVERRIDE;
|
|
|
|
GtkWidget* GetConnectWidget() wxOVERRIDE;
|
2003-07-09 17:55:04 -04:00
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
2004-12-09 10:16:51 -05:00
|
|
|
|
1999-11-19 16:01:20 -05:00
|
|
|
protected:
|
2006-04-28 20:46:05 -04:00
|
|
|
// From wxWindowGTK:
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE;
|
2006-04-28 20:46:05 -04:00
|
|
|
|
2007-10-26 02:20:23 -04:00
|
|
|
// Widgets that use the style->base colour for the BG colour should
|
|
|
|
// override this and return true.
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual bool UseGTKStyleBase() const wxOVERRIDE { return true; }
|
2007-10-26 02:20:23 -04:00
|
|
|
|
2008-05-27 06:17:56 -04:00
|
|
|
// Override in derived classes to create combo box widgets with
|
|
|
|
// custom list stores.
|
|
|
|
virtual void GTKCreateComboBoxWidget();
|
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE;
|
2012-11-09 16:11:37 -05:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual GtkEntry *GetEntry() const wxOVERRIDE
|
2009-09-05 08:39:12 -04:00
|
|
|
{ return m_entry; }
|
2008-05-27 06:17:56 -04:00
|
|
|
|
|
|
|
GtkEntry* m_entry;
|
2007-11-05 17:31:24 -05:00
|
|
|
|
2007-10-26 02:20:23 -04:00
|
|
|
private:
|
2007-09-25 20:30:22 -04:00
|
|
|
// From wxTextEntry:
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; }
|
|
|
|
virtual GtkEditable *GetEditable() const wxOVERRIDE;
|
|
|
|
virtual void EnableTextChangedEvents(bool enable) wxOVERRIDE;
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2008-05-27 06:17:56 -04:00
|
|
|
void Init();
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox);
|
|
|
|
wxDECLARE_EVENT_TABLE();
|
1998-05-30 13:11:51 -04:00
|
|
|
};
|
|
|
|
|
2006-08-30 01:55:56 -04:00
|
|
|
#endif // _WX_GTK_COMBOBOX_H_
|