1998-09-18 10:19:10 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: choice.h
|
|
|
|
// Purpose: wxChoice class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 17/09/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_CHOICE_H_
|
|
|
|
#define _WX_CHOICE_H_
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "choice.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr;
|
|
|
|
|
2002-12-08 18:48:05 +00:00
|
|
|
#include "wx/clntdata.h"
|
|
|
|
#include "wx/dynarray.h"
|
|
|
|
|
|
|
|
WX_DEFINE_ARRAY(WXWidget, wxWidgetArray);
|
|
|
|
|
1998-09-18 10:19:10 +00:00
|
|
|
// Choice item
|
2002-08-24 10:54:15 +00:00
|
|
|
class WXDLLEXPORT wxChoice: public wxChoiceBase
|
1998-09-18 10:19:10 +00:00
|
|
|
{
|
1999-02-22 11:01:13 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxChoice)
|
2002-12-08 18:48:05 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
public:
|
|
|
|
wxChoice();
|
|
|
|
~wxChoice();
|
2002-02-05 16:34:33 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
wxChoice(wxWindow *parent, wxWindowID id,
|
2002-02-05 16:34:33 +00: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)
|
1999-02-22 11:01:13 +00:00
|
|
|
{
|
2002-12-08 18:48:05 +00:00
|
|
|
Init();
|
1999-02-22 11:01:13 +00:00
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2002-02-05 16:34:33 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
2002-02-05 16:34:33 +00: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);
|
2002-12-08 18:48:05 +00:00
|
|
|
|
|
|
|
// implementation of wxControlWithItems
|
1999-11-08 14:53:39 +00:00
|
|
|
virtual int GetCount() const;
|
|
|
|
virtual int DoAppend(const wxString& item);
|
|
|
|
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;
|
2002-12-08 18:48:05 +00:00
|
|
|
virtual int GetSelection() const;
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void Delete(int n);
|
2002-12-08 18:48:05 +00:00
|
|
|
virtual int FindString(const wxString& s) const;
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void Clear();
|
2002-12-08 18:48:05 +00:00
|
|
|
virtual void SetString(int n, const wxString& s);
|
|
|
|
virtual wxString GetString(int n) const;
|
|
|
|
|
|
|
|
// implementation of wxChoiceBase
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void SetSelection(int n);
|
|
|
|
virtual void SetColumns(int n = 1 );
|
|
|
|
virtual int GetColumns() const ;
|
2002-02-05 16:34:33 +00:00
|
|
|
|
2002-12-08 18:48:05 +00:00
|
|
|
// Original API
|
|
|
|
virtual void Command(wxCommandEvent& event);
|
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
void SetFocus();
|
2002-02-05 16:34:33 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
// Implementation
|
|
|
|
virtual void ChangeFont(bool keepOriginalSize = TRUE);
|
|
|
|
virtual void ChangeBackgroundColour();
|
|
|
|
virtual void ChangeForegroundColour();
|
|
|
|
WXWidget GetTopWidget() const { return m_formWidget; }
|
|
|
|
WXWidget GetMainWidget() const { return m_buttonWidget; }
|
2002-12-08 18:48:05 +00:00
|
|
|
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
|
|
|
// implementation, for wxChoiceCallback
|
|
|
|
const wxWidgetArray& GetWidgets() const { return m_widgetArray; }
|
|
|
|
const wxStringList& GetStrings() const { return m_stringList; }
|
1998-09-18 10:19:10 +00:00
|
|
|
protected:
|
2002-12-08 18:48:05 +00:00
|
|
|
// minimum size for the text ctrl
|
|
|
|
wxSize GetItemsSize() const;
|
|
|
|
// common part of all contructors
|
|
|
|
void Init();
|
|
|
|
|
2003-01-18 13:01:17 +00:00
|
|
|
size_t m_noStrings;
|
1999-02-22 11:01:13 +00:00
|
|
|
WXWidget m_menuWidget;
|
|
|
|
WXWidget m_buttonWidget;
|
2002-12-08 18:48:05 +00:00
|
|
|
wxWidgetArray m_widgetArray;
|
1999-02-22 11:01:13 +00:00
|
|
|
WXWidget m_formWidget;
|
|
|
|
wxStringList m_stringList;
|
2002-12-08 18:48:05 +00:00
|
|
|
wxClientDataDictionary m_clientDataDict;
|
2002-02-05 16:34:33 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void DoSetSize(int x, int y,
|
2002-02-05 16:34:33 +00:00
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
1998-09-18 10:19:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2002-02-05 16:34:33 +00:00
|
|
|
// _WX_CHOICE_H_
|