1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 12:54:43 -04:00
|
|
|
// Name: wx/gtk/choice.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-24 13:12:05 -04:00
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-10-26 02:20:23 -04:00
|
|
|
#ifndef _WX_GTK_CHOICE_H_
|
|
|
|
#define _WX_GTK_CHOICE_H_
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
|
|
|
|
class WXDLLIMPEXP_FWD_BASE wxArrayString;
|
2003-07-20 15:32:44 -04:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxChoice
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2010-08-18 17:29:53 -04:00
|
|
|
class wxGtkCollatedArrayString;
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1998-11-06 03:50:52 -05:00
|
|
|
public:
|
2008-05-27 06:17:56 -04:00
|
|
|
wxChoice()
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
1999-03-16 13:54:24 -05:00
|
|
|
wxChoice( wxWindow *parent, wxWindowID id,
|
|
|
|
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 = wxChoiceNameStr )
|
|
|
|
{
|
2008-05-27 06:17:56 -04:00
|
|
|
Init();
|
1999-03-16 13:54:24 -05:00
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 13:21:45 -05:00
|
|
|
wxChoice( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxChoiceNameStr )
|
|
|
|
{
|
2008-05-27 06:17:56 -04:00
|
|
|
Init();
|
2004-01-31 13:21:45 -05:00
|
|
|
Create(parent, id, pos, size, choices, style, validator, name);
|
|
|
|
}
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxChoice();
|
1999-03-16 13:54:24 -05:00
|
|
|
bool Create( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2009-01-19 08:55:27 -05:00
|
|
|
int n = 0, const wxString choices[] = NULL,
|
1999-03-16 13:54:24 -05:00
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxChoiceNameStr );
|
2004-01-31 13:21:45 -05:00
|
|
|
bool Create( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxChoiceNameStr );
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
int GetSelection() const wxOVERRIDE;
|
|
|
|
void SetSelection(int n) wxOVERRIDE;
|
1999-03-16 13:54:24 -05:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual unsigned int GetCount() const wxOVERRIDE;
|
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE;
|
|
|
|
virtual wxString GetString(unsigned int n) const wxOVERRIDE;
|
|
|
|
virtual void SetString(unsigned int n, const wxString& string) wxOVERRIDE;
|
1999-03-16 13:54:24 -05:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void SetColumns(int n=1) wxOVERRIDE;
|
|
|
|
virtual int GetColumns() const wxOVERRIDE;
|
2008-06-16 09:32:43 -04:00
|
|
|
|
2010-10-15 19:46:32 -04:00
|
|
|
virtual void GTKDisableEvents();
|
|
|
|
virtual void GTKEnableEvents();
|
2008-05-18 13:26:28 -04:00
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
|
|
|
|
1999-11-22 14:44:25 -05:00
|
|
|
protected:
|
2008-05-18 13:26:28 -04:00
|
|
|
// this array is only used for controls with wxCB_SORT style, so only
|
|
|
|
// allocate it if it's needed (hence using pointer)
|
2010-08-18 17:29:53 -04:00
|
|
|
wxGtkCollatedArrayString *m_strings;
|
1999-03-16 13:54:24 -05:00
|
|
|
|
2008-05-18 13:26:28 -04:00
|
|
|
// contains the client data for the items
|
|
|
|
wxArrayPtrVoid m_clientData;
|
2006-08-25 08:59:28 -04:00
|
|
|
|
2008-05-27 06:17:56 -04:00
|
|
|
// index to GtkListStore cell which displays the item text
|
|
|
|
int m_stringCellIndex;
|
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
|
|
|
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE;
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
|
|
|
unsigned int pos,
|
2014-03-29 20:02:23 -04:00
|
|
|
void **clientData, wxClientDataType type) wxOVERRIDE;
|
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE;
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE;
|
|
|
|
virtual void DoClear() wxOVERRIDE;
|
|
|
|
virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE;
|
|
|
|
|
|
|
|
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE;
|
|
|
|
virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE;
|
2004-12-18 08:13:52 -05:00
|
|
|
|
2008-05-27 06:17:56 -04:00
|
|
|
// in derived classes, implement this to insert list store entry
|
|
|
|
// with all items default except text
|
|
|
|
virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text );
|
|
|
|
|
2004-12-18 08:13:52 -05:00
|
|
|
private:
|
2008-05-27 06:17:56 -04:00
|
|
|
void Init();
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxChoice);
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
1999-06-15 16:21:59 -04:00
|
|
|
|
2007-10-26 02:20:23 -04:00
|
|
|
#endif // _WX_GTK_CHOICE_H_
|