1999-01-01 11:05:26 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: choice.h
|
|
|
|
// Purpose: wxChoice class
|
|
|
|
// Author: AUTHOR
|
|
|
|
// Modified by:
|
|
|
|
// Created: ??/??/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) AUTHOR
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_CHOICE_H_
|
|
|
|
#define _WX_CHOICE_H_
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "choice.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
2001-10-02 11:56:03 -04:00
|
|
|
#include "wx/dynarray.h"
|
2001-03-04 07:46:30 -05:00
|
|
|
|
1999-01-01 11:05:26 -05:00
|
|
|
WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr;
|
|
|
|
|
2001-03-04 07:46:30 -05:00
|
|
|
WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ;
|
|
|
|
|
1999-01-01 11:05:26 -05:00
|
|
|
// Choice item
|
2001-03-04 07:46:30 -05:00
|
|
|
class WXDLLEXPORT wxChoice: public wxChoiceBase
|
1999-01-01 11:05:26 -05:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxChoice)
|
|
|
|
|
|
|
|
public:
|
2001-02-08 16:13:12 -05:00
|
|
|
wxChoice() {}
|
2001-04-01 16:42:05 -04:00
|
|
|
virtual ~wxChoice() ;
|
1999-01-01 11:05:26 -05:00
|
|
|
|
2001-02-08 16:13:12 -05:00
|
|
|
wxChoice(wxWindow *parent, wxWindowID id,
|
1999-01-01 11:05:26 -05:00
|
|
|
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 = wxChoiceNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
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 = wxChoiceNameStr);
|
|
|
|
|
2001-04-01 16:42:05 -04:00
|
|
|
// implement base class pure virtuals
|
|
|
|
virtual int DoAppend(const wxString& item);
|
1999-01-01 11:05:26 -05:00
|
|
|
virtual void Delete(int n);
|
|
|
|
virtual void Clear();
|
2001-04-01 16:42:05 -04:00
|
|
|
|
2001-03-04 07:46:30 -05:00
|
|
|
virtual int GetCount() const ;
|
1999-01-01 11:05:26 -05:00
|
|
|
virtual int GetSelection() const ;
|
|
|
|
virtual void SetSelection(int n);
|
2001-04-01 16:42:05 -04:00
|
|
|
|
1999-01-01 11:05:26 -05:00
|
|
|
virtual int FindString(const wxString& s) const;
|
|
|
|
virtual wxString GetString(int n) const ;
|
2001-03-04 07:46:30 -05:00
|
|
|
virtual void SetString( int , const wxString& s ) ;
|
2002-01-04 12:13:39 -05:00
|
|
|
void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
2001-03-04 07:46:30 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
virtual void Append(const wxString& item);
|
|
|
|
// Added min Append and GetClientData
|
|
|
|
virtual void Append(const wxString& item, void *client_data);
|
|
|
|
virtual void *GetClientData(int index) const;
|
|
|
|
virtual inline void Select( int n ) { SetSelection( n ); }
|
1999-01-01 11:05:26 -05:00
|
|
|
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
|
|
|
virtual wxString GetStringSelection() const ;
|
|
|
|
virtual bool SetStringSelection(const wxString& sel);
|
|
|
|
|
2001-04-01 16:42:05 -04:00
|
|
|
// Mac specific
|
1999-01-01 11:05:26 -05:00
|
|
|
virtual void Command(wxCommandEvent& event);
|
2002-01-04 12:13:39 -05:00
|
|
|
void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
1999-01-01 11:05:26 -05:00
|
|
|
|
|
|
|
virtual inline int GetColumns() const { return 1 ; };
|
2001-03-04 07:46:30 -05:00
|
|
|
*/
|
1999-01-01 11:05:26 -05:00
|
|
|
protected:
|
2001-07-11 16:33:12 -04:00
|
|
|
virtual wxSize DoGetBestSize() const ;
|
2001-03-04 07:46:30 -05: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;
|
|
|
|
|
|
|
|
// free all memory we have (used by Clear() and dtor)
|
|
|
|
void Free();
|
|
|
|
|
2000-08-09 07:02:59 -04:00
|
|
|
wxArrayString m_strings;
|
2001-05-10 01:27:07 -04:00
|
|
|
wxChoiceDataArray m_datas ;
|
2002-01-04 12:13:39 -05:00
|
|
|
WXHMENU m_macPopUpMenuHandle ;
|
1999-01-01 11:05:26 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_CHOICE_H_
|