1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: choice.h
|
|
|
|
// Purpose: wxChoice class
|
|
|
|
// Author: Julian Smart
|
1999-07-26 23:02:32 +00:00
|
|
|
// Modified by: Vadim Zeitlin to derive from wxChoiceBase
|
1998-05-20 14:12:05 +00:00
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 23:52:45 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_CHOICE_H_
|
|
|
|
#define _WX_CHOICE_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-07-26 23:02:32 +00:00
|
|
|
#pragma interface "choice.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
1998-05-20 14:12:05 +00:00
|
|
|
// Choice item
|
1999-07-26 23:02:32 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxChoice : public wxChoiceBase
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
1999-02-22 11:01:13 +00:00
|
|
|
public:
|
1999-07-26 23:02:32 +00:00
|
|
|
// ctors
|
2005-08-17 13:30:33 +00:00
|
|
|
wxChoice() { Init(); }
|
1999-10-23 23:40:55 +00:00
|
|
|
virtual ~wxChoice();
|
1999-07-26 23:02:32 +00: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 13:49:22 +00:00
|
|
|
const wxString& name = wxChoiceNameStr)
|
|
|
|
{
|
2005-09-14 12:08:24 +00:00
|
|
|
Init();
|
2004-01-15 13:49:22 +00:00
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2005-08-17 13:30:33 +00:00
|
|
|
|
2004-01-31 18:21:45 +00: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 12:08:24 +00:00
|
|
|
Init();
|
2004-01-31 18:21:45 +00:00
|
|
|
Create(parent, id, pos, size, choices, style, validator, name);
|
|
|
|
}
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-07-26 23:02:32 +00: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 18:21:45 +00: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 23:02:32 +00:00
|
|
|
|
|
|
|
// implement base class pure virtuals
|
1999-10-03 00:05:52 +00:00
|
|
|
virtual int DoAppend(const wxString& item);
|
2003-05-09 12:58:28 +00:00
|
|
|
virtual int DoInsert(const wxString& item, int pos);
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void Delete(int n);
|
|
|
|
virtual void Clear();
|
1999-07-26 23:02:32 +00:00
|
|
|
|
|
|
|
virtual int GetCount() const;
|
|
|
|
virtual int GetSelection() const;
|
2005-08-17 13:30:33 +00:00
|
|
|
#if wxABI_VERSION >= 20602
|
|
|
|
virtual int GetCurrentSelection() const;
|
|
|
|
#endif
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void SetSelection(int n);
|
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
virtual int FindString(const wxString& s) const;
|
|
|
|
virtual wxString GetString(int n) const;
|
1999-10-22 18:00:39 +00:00
|
|
|
virtual void SetString(int n, const wxString& s);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
// MSW only
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
2004-02-25 10:45:02 +00:00
|
|
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
2005-04-10 21:55:12 +00:00
|
|
|
virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd);
|
1998-08-07 23:52:45 +00:00
|
|
|
|
|
|
|
protected:
|
2005-08-17 13:30:33 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init() { m_lastAcceptedSelection = wxID_NONE; }
|
|
|
|
|
2001-05-19 01:01:21 +00:00
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
1999-10-22 18:00:39 +00: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;
|
1998-08-07 23:52:45 +00:00
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
// MSW implementation
|
1999-12-29 23:34:18 +00:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2004-02-07 18:42:56 +00:00
|
|
|
virtual void DoGetSize(int *w, int *h) const;
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void DoSetSize(int x, int y,
|
1999-07-02 22:02:05 +00:00
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
1999-10-23 23:40:55 +00:00
|
|
|
|
2004-05-07 10:46:19 +00:00
|
|
|
virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg);
|
|
|
|
|
2004-02-07 19:26:22 +00:00
|
|
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
|
|
|
|
|
|
|
// 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 23:40:55 +00:00
|
|
|
// free all memory we have (used by Clear() and dtor)
|
|
|
|
void Free();
|
2003-07-22 00:24:07 +00:00
|
|
|
|
2005-08-17 13:30:33 +00: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-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice)
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
#endif // _WX_CHOICE_H_
|