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-06-22 10:40:59 -04:00
|
|
|
// Id: $Id$
|
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);
|
|
|
|
}
|
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
|
|
|
|
2008-05-18 13:26:28 -04:00
|
|
|
virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
|
2007-09-25 20:30:22 -04:00
|
|
|
virtual void SetSelection(long from, long to)
|
2008-05-18 13:26:28 -04:00
|
|
|
{ wxTextEntry::SetSelection(from, to); }
|
2006-04-28 20:46:05 -04:00
|
|
|
|
2008-05-18 13:26:28 -04:00
|
|
|
virtual int GetSelection() const { return wxChoice::GetSelection(); }
|
2007-09-25 20:30:22 -04:00
|
|
|
virtual void GetSelection(long *from, long *to) const
|
2008-05-18 13:26:28 -04:00
|
|
|
{ return wxTextEntry::GetSelection(from, to); }
|
2007-09-25 20:30:22 -04:00
|
|
|
|
|
|
|
virtual wxString GetStringSelection() const
|
|
|
|
{
|
|
|
|
return wxItemContainer::GetStringSelection();
|
|
|
|
}
|
2010-01-23 20:00:45 -05:00
|
|
|
virtual void Popup();
|
|
|
|
virtual void Dismiss();
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2008-05-18 13:26:28 -04:00
|
|
|
virtual void Clear()
|
|
|
|
{
|
|
|
|
wxTextEntry::Clear();
|
|
|
|
wxItemContainer::Clear();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-08-16 13:48:28 -04:00
|
|
|
virtual void SetValue(const wxString& value);
|
|
|
|
|
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);
|
|
|
|
|
2010-05-30 13:45:40 -04:00
|
|
|
virtual void GTKDisableEvents();
|
|
|
|
virtual void GTKEnableEvents();
|
1999-10-11 06:05:36 -04:00
|
|
|
GtkWidget* GetConnectWidget();
|
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:
|
2006-08-25 08:59:28 -04:00
|
|
|
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
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.
|
|
|
|
virtual bool UseGTKStyleBase() const { return true; }
|
|
|
|
|
2008-05-27 06:17:56 -04:00
|
|
|
// Override in derived classes to create combo box widgets with
|
|
|
|
// custom list stores.
|
|
|
|
virtual void GTKCreateComboBoxWidget();
|
|
|
|
|
2009-09-05 08:39:12 -04:00
|
|
|
virtual GtkEntry *GetEntry() const
|
|
|
|
{ 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:
|
2009-03-02 07:25:01 -05:00
|
|
|
virtual wxWindow *GetEditableWindow() { return this; }
|
2007-09-25 20:30:22 -04:00
|
|
|
virtual GtkEditable *GetEditable() const;
|
2010-07-12 18:50:14 -04:00
|
|
|
virtual void EnableTextChangedEvents(bool enable);
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2008-05-27 06:17:56 -04:00
|
|
|
void Init();
|
|
|
|
|
2003-09-20 12:31:06 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
|
1999-10-11 06:05:36 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-30 13:11:51 -04:00
|
|
|
};
|
|
|
|
|
2006-08-30 01:55:56 -04:00
|
|
|
#endif // _WX_GTK_COMBOBOX_H_
|