1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: choice.h
|
|
|
|
// 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
|
1999-03-16 18:54:24 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKCHOICEH__
|
|
|
|
#define __GTKCHOICEH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-10-18 15:45:28 +00:00
|
|
|
#pragma interface "choice.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxChoice
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1999-10-18 15:45:28 +00:00
|
|
|
class 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);
|
|
|
|
}
|
|
|
|
~wxChoice();
|
|
|
|
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 );
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-10-18 15:45:28 +00:00
|
|
|
// implement base class pure virtuals
|
1999-03-16 18:54:24 +00:00
|
|
|
void Delete(int n);
|
1999-10-18 15:45:28 +00:00
|
|
|
void Clear();
|
|
|
|
|
|
|
|
int GetSelection() const;
|
|
|
|
void SetSelection( int n );
|
1999-03-16 18:54:24 +00:00
|
|
|
|
1999-10-18 15:45:28 +00:00
|
|
|
virtual int GetCount() const;
|
1999-10-22 18:00:39 +00:00
|
|
|
int FindString( const wxString& string ) const;
|
1999-03-16 18:54:24 +00:00
|
|
|
wxString GetString( int n ) const;
|
1999-10-22 18:00:39 +00:00
|
|
|
void SetString( int n, const wxString& string );
|
1999-03-16 18:54:24 +00:00
|
|
|
|
|
|
|
// implementation
|
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
|
|
|
|
1999-07-22 23:28:55 +00:00
|
|
|
void DisableEvents();
|
|
|
|
void EnableEvents();
|
1999-03-16 18:54:24 +00:00
|
|
|
void AppendCommon( const wxString &item );
|
|
|
|
void ApplyWidgetStyle();
|
1999-10-22 13:12:04 +00:00
|
|
|
|
1999-10-18 15:45:28 +00:00
|
|
|
protected:
|
|
|
|
virtual int DoAppend(const wxString& item);
|
|
|
|
|
1999-10-22 18:00:39 +00:00
|
|
|
virtual void DoSetItemClientData( int n, void* clientData );
|
|
|
|
virtual void* DoGetItemClientData( int n ) const;
|
|
|
|
virtual void DoSetItemClientObject( int n, wxClientData* clientData );
|
|
|
|
virtual wxClientData* DoGetItemClientObject( int n ) const;
|
1999-10-19 10:51:48 +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()
|
|
|
|
size_t AppendHelper(GtkWidget *menu, const wxString& item);
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
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__
|