1998-09-18 06:19:10 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 12:54:43 -04:00
|
|
|
// Name: wx/motif/choice.h
|
1998-09-18 06:19:10 -04:00
|
|
|
// Purpose: wxChoice class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 17/09/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
2005-09-27 12:54:43 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-09-18 06:19:10 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_CHOICE_H_
|
|
|
|
#define _WX_CHOICE_H_
|
|
|
|
|
2002-12-08 13:48:05 -05:00
|
|
|
#include "wx/clntdata.h"
|
|
|
|
|
2003-09-11 17:05:19 -04:00
|
|
|
#ifndef wxWIDGET_ARRAY_DEFINED
|
|
|
|
#define wxWIDGET_ARRAY_DEFINED
|
|
|
|
|
|
|
|
#include "wx/dynarray.h"
|
2005-02-16 05:14:42 -05:00
|
|
|
WX_DEFINE_ARRAY_PTR(WXWidget, wxWidgetArray);
|
2003-09-11 17:05:19 -04:00
|
|
|
#endif
|
2002-12-08 13:48:05 -05:00
|
|
|
|
1998-09-18 06:19:10 -04:00
|
|
|
// Choice item
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase
|
1998-09-18 06:19:10 -04:00
|
|
|
{
|
1999-02-22 06:01:13 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxChoice)
|
2002-12-08 13:48:05 -05:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
public:
|
|
|
|
wxChoice();
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxChoice();
|
2005-09-27 12:54:43 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
wxChoice(wxWindow *parent, wxWindowID id,
|
2002-02-05 11:34:33 -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)
|
1999-02-22 06:01:13 -05:00
|
|
|
{
|
2002-12-08 13:48:05 -05:00
|
|
|
Init();
|
1999-02-22 06:01:13 -05:00
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2005-09-27 12:54:43 -04:00
|
|
|
|
2004-01-31 13:21:45 -05: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)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
Create(parent, id, pos, size, choices, style, validator, name);
|
|
|
|
}
|
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0, const wxString choices[] = NULL,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2004-01-31 13:21:45 -05:00
|
|
|
const wxString& name = wxChoiceNameStr);
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxString& name = wxChoiceNameStr);
|
2002-12-08 13:48:05 -05:00
|
|
|
|
|
|
|
// implementation of wxControlWithItems
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual unsigned int GetCount() const;
|
2002-12-08 13:48:05 -05:00
|
|
|
virtual int GetSelection() const;
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual void DoDeleteOneItem(unsigned int n);
|
|
|
|
virtual void DoClear();
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void SetString(unsigned int n, const wxString& s);
|
|
|
|
virtual wxString GetString(unsigned int n) const;
|
2002-12-08 13:48:05 -05:00
|
|
|
|
|
|
|
// implementation of wxChoiceBase
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void SetSelection(int n);
|
|
|
|
virtual void SetColumns(int n = 1 );
|
|
|
|
virtual int GetColumns() const ;
|
2005-09-27 12:54:43 -04:00
|
|
|
|
|
|
|
// Original API
|
2002-12-08 13:48:05 -05:00
|
|
|
virtual void Command(wxCommandEvent& event);
|
2005-09-27 12:54:43 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
void SetFocus();
|
2005-09-27 12:54:43 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
// Implementation
|
2005-02-06 12:38:33 -05:00
|
|
|
virtual void ChangeFont(bool keepOriginalSize = true);
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void ChangeBackgroundColour();
|
|
|
|
virtual void ChangeForegroundColour();
|
|
|
|
WXWidget GetTopWidget() const { return m_formWidget; }
|
|
|
|
WXWidget GetMainWidget() const { return m_buttonWidget; }
|
2002-12-08 13:48:05 -05:00
|
|
|
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
|
|
|
// implementation, for wxChoiceCallback
|
|
|
|
const wxWidgetArray& GetWidgets() const { return m_widgetArray; }
|
2009-01-07 12:29:38 -05:00
|
|
|
const wxArrayString& GetStrings() const { return m_stringArray; }
|
1998-09-18 06:19:10 -04:00
|
|
|
protected:
|
2002-12-08 13:48:05 -05:00
|
|
|
// minimum size for the text ctrl
|
|
|
|
wxSize GetItemsSize() const;
|
|
|
|
// common part of all contructors
|
|
|
|
void Init();
|
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
WXWidget m_menuWidget;
|
|
|
|
WXWidget m_buttonWidget;
|
2002-12-08 13:48:05 -05:00
|
|
|
wxWidgetArray m_widgetArray;
|
1999-02-22 06:01:13 -05:00
|
|
|
WXWidget m_formWidget;
|
2009-01-07 12:29:38 -05:00
|
|
|
wxArrayString m_stringArray;
|
2005-09-27 12:54:43 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void DoSetSize(int x, int y,
|
2002-02-05 11:34:33 -05:00
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
2007-07-26 09:54:14 -04:00
|
|
|
|
|
|
|
// implementation of wxControlWithItems
|
|
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
|
|
|
unsigned int pos,
|
|
|
|
void **clientData, wxClientDataType type);
|
1998-09-18 06:19:10 -04:00
|
|
|
};
|
|
|
|
|
2007-07-26 09:54:14 -04:00
|
|
|
#endif // _WX_CHOICE_H_
|