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