1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 12:54:43 -04:00
|
|
|
// Name: wx/msw/choice.h
|
1998-05-20 10:12:05 -04:00
|
|
|
// Purpose: wxChoice class
|
|
|
|
// Author: Julian Smart
|
1999-07-26 19:02:32 -04:00
|
|
|
// Modified by: Vadim Zeitlin to derive from wxChoiceBase
|
1998-05-20 10:12:05 -04:00
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_CHOICE_H_
|
|
|
|
#define _WX_CHOICE_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
// Choice item
|
1999-07-26 19:02:32 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-02-22 06:01:13 -05:00
|
|
|
public:
|
1999-07-26 19:02:32 -04:00
|
|
|
// ctors
|
2005-08-17 09:30:33 -04:00
|
|
|
wxChoice() { Init(); }
|
1999-10-23 19:40:55 -04:00
|
|
|
virtual ~wxChoice();
|
1999-07-26 19:02:32 -04:00
|
|
|
|
|
|
|
wxChoice(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,
|
2004-01-15 08:49:22 -05:00
|
|
|
const wxString& name = wxChoiceNameStr)
|
|
|
|
{
|
2005-09-14 08:08:24 -04:00
|
|
|
Init();
|
2004-01-15 08:49:22 -05:00
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2005-08-17 09:30:33 -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)
|
|
|
|
{
|
2005-09-14 08:08:24 -04:00
|
|
|
Init();
|
2004-01-31 13:21:45 -05:00
|
|
|
Create(parent, id, pos, size, choices, style, validator, name);
|
|
|
|
}
|
1999-02-22 06:01:13 -05:00
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
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);
|
2004-01-31 13:21:45 -05:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxChoiceNameStr);
|
1999-07-26 19:02:32 -04:00
|
|
|
|
2008-02-09 10:22:15 -05:00
|
|
|
virtual void SetLabel(const wxString& label);
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual unsigned int GetCount() const;
|
1999-07-26 19:02:32 -04:00
|
|
|
virtual int GetSelection() const;
|
2005-08-17 09:30:33 -04:00
|
|
|
virtual int GetCurrentSelection() const;
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void SetSelection(int n);
|
|
|
|
|
2005-09-27 12:54:43 -04:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual wxString GetString(unsigned int n) const;
|
|
|
|
virtual void SetString(unsigned int n, const wxString& s);
|
1999-02-22 06:01:13 -05:00
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
// MSW only
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
2004-02-25 05:45:02 -05:00
|
|
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
2005-04-10 17:55:12 -04:00
|
|
|
virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd);
|
2006-02-08 16:47:09 -05:00
|
|
|
virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg);
|
|
|
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
1998-08-07 19:52:45 -04:00
|
|
|
|
2007-08-07 15:22:43 -04:00
|
|
|
// returns true if the platform should explicitly apply a theme border
|
|
|
|
virtual bool CanApplyThemeBorder() const { return false; }
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
protected:
|
2007-11-13 07:10:34 -05:00
|
|
|
// choose the default border for this window
|
|
|
|
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
|
|
|
|
2005-08-17 09:30:33 -04:00
|
|
|
// common part of all ctors
|
|
|
|
void Init() { m_lastAcceptedSelection = wxID_NONE; }
|
|
|
|
|
2007-10-26 02:20:23 -04:00
|
|
|
virtual void DoDeleteOneItem(unsigned int n);
|
|
|
|
virtual void DoClear();
|
|
|
|
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
|
|
|
unsigned int pos,
|
|
|
|
void **clientData, wxClientDataType type);
|
|
|
|
|
2001-05-18 21:01:21 -04:00
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const;
|
1998-08-07 19:52:45 -04:00
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
// MSW implementation
|
1999-12-29 18:34:18 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2004-02-07 13:42:56 -05:00
|
|
|
virtual void DoGetSize(int *w, int *h) const;
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void DoSetSize(int x, int y,
|
1999-07-02 18:02:05 -04:00
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
1999-10-23 19:40:55 -04:00
|
|
|
|
2004-02-07 14:26:22 -05:00
|
|
|
// update the height of the drop down list to fit the number of items we
|
|
|
|
// have (without changing the visible height)
|
|
|
|
void UpdateVisibleHeight();
|
|
|
|
|
|
|
|
// create and initialize the control
|
|
|
|
bool CreateAndInit(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
int n, const wxString choices[],
|
|
|
|
long style,
|
|
|
|
const wxValidator& validator,
|
|
|
|
const wxString& name);
|
|
|
|
|
1999-10-23 19:40:55 -04:00
|
|
|
// free all memory we have (used by Clear() and dtor)
|
|
|
|
void Free();
|
2003-07-21 20:24:07 -04:00
|
|
|
|
2005-08-17 09:30:33 -04:00
|
|
|
|
|
|
|
// last "completed" selection, i.e. not the transient one while the user is
|
|
|
|
// browsing the popup list: this is only used when != wxID_NONE which is
|
|
|
|
// the case while the drop down is opened
|
|
|
|
int m_lastAcceptedSelection;
|
|
|
|
|
|
|
|
|
2003-07-21 20:24:07 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
#endif // _WX_CHOICE_H_
|