1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-01-23 02:28:01 +00:00
|
|
|
// Name: wx/gtk1/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
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKCHOICEH__
|
|
|
|
#define __GTKCHOICEH__
|
|
|
|
|
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
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
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:
|
1999-03-16 18:54:24 +00:00
|
|
|
wxChoice();
|
|
|
|
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 )
|
|
|
|
{
|
1999-10-22 13:12:04 +00:00
|
|
|
m_strings = (wxSortedArrayString *)NULL;
|
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
m_strings = (wxSortedArrayString *)NULL;
|
|
|
|
|
|
|
|
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,
|
|
|
|
int n = 0, const wxString choices[] = (wxString *) NULL,
|
|
|
|
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
|
|
|
// implement base class pure virtuals
|
2006-03-23 22:05:23 +00:00
|
|
|
void Delete(unsigned int n);
|
1999-10-18 15:45:28 +00:00
|
|
|
void Clear();
|
|
|
|
|
|
|
|
int GetSelection() const;
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual 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
|
|
|
|
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:
|
1999-10-22 13:12:04 +00:00
|
|
|
wxList m_clientList; // contains the client data for the items
|
1999-03-16 18:54:24 +00:00
|
|
|
|
2004-06-14 17:34:00 +00:00
|
|
|
void DoApplyWidgetStyle(GtkRcStyle *style);
|
1999-10-18 15:45:28 +00:00
|
|
|
virtual int DoAppend(const wxString& item);
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual int DoInsert(const wxString& item, unsigned int pos);
|
1999-10-18 15:45:28 +00:00
|
|
|
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const;
|
|
|
|
virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
|
|
|
|
virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
|
1999-10-19 10:51:48 +00:00
|
|
|
|
1999-11-19 21:01:20 +00:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2003-07-08 11:18:42 +00:00
|
|
|
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
2004-05-06 17:26:25 +00:00
|
|
|
|
1999-10-11 10:05:36 +00:00
|
|
|
private:
|
1999-10-22 13:12:04 +00:00
|
|
|
// common part of Create() and DoAppend()
|
2006-03-23 22:05:23 +00:00
|
|
|
int GtkAddHelper(GtkWidget *menu, unsigned int pos, const wxString& item);
|
1999-10-22 13:12:04 +00:00
|
|
|
|
|
|
|
// this array is only used for controls with wxCB_SORT style, so only
|
|
|
|
// allocate it if it's needed (hence using pointer)
|
|
|
|
wxSortedArrayString *m_strings;
|
|
|
|
|
2004-12-18 13:13:52 +00:00
|
|
|
public:
|
2005-09-27 16:54:43 +00:00
|
|
|
// this circumvents a GTK+ 2.0 bug so that the selection is
|
|
|
|
// invalidated properly
|
2004-12-06 12:47:06 +00:00
|
|
|
int m_selection_hack;
|
2004-12-18 13:13:52 +00:00
|
|
|
|
|
|
|
private:
|
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
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif // __GTKCHOICEH__
|