1999-07-26 23:02:32 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/choice.h
|
|
|
|
// Purpose: wxChoice class interface
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 26.07.99
|
2004-05-23 14:56:36 +00:00
|
|
|
// Copyright: (c) wxWidgets team
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-07-26 23:02:32 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_CHOICE_H_BASE_
|
|
|
|
#define _WX_CHOICE_H_BASE_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2005-03-16 16:18:31 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#if wxUSE_CHOICE
|
|
|
|
|
1999-10-22 18:00:39 +00:00
|
|
|
#include "wx/ctrlsub.h" // the base class
|
1999-07-26 23:02:32 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// global data
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr[];
|
1999-07-26 23:02:32 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxChoice allows to select one of a non-modifiable list of strings
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxChoiceBase : public wxControlWithItems
|
1999-07-26 23:02:32 +00:00
|
|
|
{
|
|
|
|
public:
|
2004-01-15 13:49:22 +00:00
|
|
|
wxChoiceBase() { }
|
2004-10-12 20:14:23 +00:00
|
|
|
virtual ~wxChoiceBase();
|
1999-07-26 23:02:32 +00:00
|
|
|
|
2003-07-22 00:24:07 +00:00
|
|
|
// all generic methods are in wxControlWithItems
|
|
|
|
|
2006-10-30 16:04:27 +00:00
|
|
|
// get the current selection: this can only be different from the normal
|
|
|
|
// selection if the popup items list is currently opened and the user
|
|
|
|
// selected some item in it but didn't close the list yet; otherwise (and
|
|
|
|
// currently always on platforms other than MSW) this is the same as
|
|
|
|
// GetSelection()
|
|
|
|
virtual int GetCurrentSelection() const { return GetSelection(); }
|
|
|
|
|
2003-06-23 14:49:46 +00:00
|
|
|
// set/get the number of columns in the control (as they're not supported on
|
1999-07-26 23:02:32 +00:00
|
|
|
// most platforms, they do nothing by default)
|
|
|
|
virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
|
|
|
|
virtual int GetColumns() const { return 1 ; }
|
|
|
|
|
1999-10-22 18:00:39 +00:00
|
|
|
// emulate selecting the item event.GetInt()
|
2014-03-30 00:02:23 +00:00
|
|
|
void Command(wxCommandEvent& event) wxOVERRIDE;
|
2003-07-22 00:24:07 +00:00
|
|
|
|
2007-07-26 13:54:14 +00:00
|
|
|
// override wxItemContainer::IsSorted
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual bool IsSorted() const wxOVERRIDE { return HasFlag(wxCB_SORT); }
|
2007-07-26 13:54:14 +00:00
|
|
|
|
2012-11-01 17:15:28 +00:00
|
|
|
protected:
|
|
|
|
// The generic implementation doesn't determine the height correctly and
|
|
|
|
// doesn't account for the width of the arrow but does take into account
|
|
|
|
// the string widths, so the derived classes should override it and set the
|
|
|
|
// height and add the arrow width to the size returned by this version.
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
2012-11-01 17:15:28 +00:00
|
|
|
|
2003-07-22 00:24:07 +00:00
|
|
|
private:
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxChoiceBase);
|
1999-07-26 23:02:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// include the platform-dependent class definition
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-11-17 23:13:55 +00:00
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#include "wx/univ/choice.h"
|
|
|
|
#elif defined(__WXMSW__)
|
1999-07-26 23:02:32 +00:00
|
|
|
#include "wx/msw/choice.h"
|
1998-07-10 14:15:17 +00:00
|
|
|
#elif defined(__WXMOTIF__)
|
1999-07-26 23:02:32 +00:00
|
|
|
#include "wx/motif/choice.h"
|
2006-01-23 03:27:34 +00:00
|
|
|
#elif defined(__WXGTK20__)
|
1999-07-26 23:02:32 +00:00
|
|
|
#include "wx/gtk/choice.h"
|
2006-01-23 03:27:34 +00:00
|
|
|
#elif defined(__WXGTK__)
|
|
|
|
#include "wx/gtk1/choice.h"
|
1998-08-15 00:23:28 +00:00
|
|
|
#elif defined(__WXMAC__)
|
2008-06-11 19:17:41 +00:00
|
|
|
#include "wx/osx/choice.h"
|
2014-08-24 01:50:11 +00:00
|
|
|
#elif defined(__WXQT__)
|
|
|
|
#include "wx/qt/choice.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#endif // wxUSE_CHOICE
|
|
|
|
|
2006-10-30 16:04:27 +00:00
|
|
|
#endif // _WX_CHOICE_H_BASE_
|