1998-09-18 10:19:10 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 16:54:43 +00:00
|
|
|
// Name: wx/motif/listbox.h
|
1998-09-18 10:19:10 +00:00
|
|
|
// Purpose: wxListBox class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 17/09/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
2005-09-27 16:54:43 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-09-18 10:19:10 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_LISTBOX_H_
|
|
|
|
#define _WX_LISTBOX_H_
|
|
|
|
|
1999-11-08 14:53:39 +00:00
|
|
|
#include "wx/ctrlsub.h"
|
2002-12-24 18:41:42 +00:00
|
|
|
#include "wx/clntdata.h"
|
1998-09-18 10:19:10 +00:00
|
|
|
|
|
|
|
// forward decl for GetSelections()
|
|
|
|
class WXDLLEXPORT wxArrayInt;
|
|
|
|
|
|
|
|
// List box item
|
2001-07-22 20:05:15 +00:00
|
|
|
class WXDLLEXPORT wxListBox: public wxListBoxBase
|
1998-09-18 10:19:10 +00:00
|
|
|
{
|
2002-02-05 16:34:33 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
2005-09-27 16:54:43 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
public:
|
|
|
|
wxListBox();
|
|
|
|
wxListBox(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,
|
2002-12-24 18:41:42 +00:00
|
|
|
const wxString& name = wxListBoxNameStr)
|
2002-02-05 16:34:33 +00:00
|
|
|
{
|
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2005-09-27 16:54:43 +00:00
|
|
|
|
2004-01-31 18:21:45 +00:00
|
|
|
wxListBox(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListBoxNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, pos, size, choices, style, validator, name);
|
|
|
|
}
|
2005-09-27 16:54:43 +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 = wxListBoxNameStr);
|
2005-09-27 16:54:43 +00:00
|
|
|
|
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 = wxListBoxNameStr);
|
2005-09-27 16:54:43 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
~wxListBox();
|
2005-09-27 16:54:43 +00:00
|
|
|
|
2002-07-31 20:35:41 +00:00
|
|
|
// implementation of wxControlWithItems
|
1999-11-08 14:53:39 +00:00
|
|
|
virtual int GetCount() const;
|
|
|
|
virtual int DoAppend(const wxString& item);
|
2002-12-24 18:41:42 +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;
|
2002-07-31 20:35:41 +00:00
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual void Delete(int n);
|
2005-09-27 16:54:43 +00:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
2002-07-31 20:35:41 +00:00
|
|
|
virtual void Clear();
|
|
|
|
virtual void SetString(int n, const wxString& s);
|
|
|
|
virtual wxString GetString(int n) const;
|
|
|
|
|
|
|
|
// implementation of wxListBoxbase
|
2005-02-13 17:08:27 +00:00
|
|
|
virtual void DoSetSelection(int n, bool select);
|
1999-11-08 14:53:39 +00:00
|
|
|
virtual void DoInsertItems(const wxArrayString& items, int pos);
|
|
|
|
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
|
|
|
virtual void DoSetFirstItem(int n);
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
2002-07-31 20:35:41 +00:00
|
|
|
virtual bool IsSelected(int n) const;
|
2002-07-28 20:50:37 +00:00
|
|
|
|
2002-07-31 20:35:41 +00:00
|
|
|
// For single or multiple choice list item
|
1999-02-22 11:01:13 +00:00
|
|
|
void Command(wxCommandEvent& event);
|
2005-09-27 16:54:43 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
// Implementation
|
|
|
|
virtual void ChangeBackgroundColour();
|
|
|
|
virtual void ChangeForegroundColour();
|
|
|
|
WXWidget GetTopWidget() const;
|
2002-07-31 20:35:41 +00:00
|
|
|
|
|
|
|
#if wxUSE_CHECKLISTBOX
|
2005-10-03 16:39:45 +00:00
|
|
|
virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {};
|
2002-07-31 20:35:41 +00:00
|
|
|
#endif
|
1998-09-28 15:42:54 +00:00
|
|
|
protected:
|
2003-02-23 20:33:43 +00:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
int m_noItems;
|
2005-09-27 16:54:43 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
// List mapping positions->client data
|
2002-12-24 18:41:42 +00:00
|
|
|
wxClientDataDictionary m_clientDataDict;
|
|
|
|
private:
|
|
|
|
void SetSelectionPolicy();
|
1998-09-18 10:19:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2002-02-05 16:34:33 +00:00
|
|
|
// _WX_LISTBOX_H_
|