1998-09-18 06:19:10 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 12:54:43 -04:00
|
|
|
// Name: wx/motif/listbox.h
|
1998-09-18 06:19:10 -04:00
|
|
|
// Purpose: wxListBox 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_LISTBOX_H_
|
|
|
|
#define _WX_LISTBOX_H_
|
|
|
|
|
1999-11-08 09:53:39 -05:00
|
|
|
#include "wx/ctrlsub.h"
|
2002-12-24 13:41:42 -05:00
|
|
|
#include "wx/clntdata.h"
|
1998-09-18 06:19:10 -04:00
|
|
|
|
|
|
|
// forward decl for GetSelections()
|
|
|
|
class WXDLLEXPORT wxArrayInt;
|
|
|
|
|
|
|
|
// List box item
|
2001-07-22 16:05:15 -04:00
|
|
|
class WXDLLEXPORT wxListBox: public wxListBoxBase
|
1998-09-18 06:19:10 -04:00
|
|
|
{
|
2002-02-05 11:34:33 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
2005-09-27 12:54:43 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
public:
|
|
|
|
wxListBox();
|
|
|
|
wxListBox(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,
|
2002-12-24 13:41:42 -05:00
|
|
|
const wxString& name = wxListBoxNameStr)
|
2002-02-05 11:34:33 -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
|
|
|
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 12:54:43 -04:00
|
|
|
|
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,
|
|
|
|
const wxString& name = wxListBoxNameStr);
|
2005-09-27 12:54:43 -04:00
|
|
|
|
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 = wxListBoxNameStr);
|
2005-09-27 12:54:43 -04:00
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxListBox();
|
2005-09-27 12:54:43 -04:00
|
|
|
|
2002-07-31 16:35:41 -04:00
|
|
|
// implementation of wxControlWithItems
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual unsigned int GetCount() const;
|
1999-11-08 09:53:39 -05:00
|
|
|
virtual int DoAppend(const wxString& item);
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const;
|
|
|
|
virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
|
|
|
|
virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
|
2002-07-31 16:35:41 -04:00
|
|
|
virtual int GetSelection() const;
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void Delete(unsigned int n);
|
2005-09-27 12:54:43 -04:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
2002-07-31 16:35:41 -04:00
|
|
|
virtual void Clear();
|
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-07-31 16:35:41 -04:00
|
|
|
|
|
|
|
// implementation of wxListBoxbase
|
2005-02-13 12:08:27 -05:00
|
|
|
virtual void DoSetSelection(int n, bool select);
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoInsertItems(const wxArrayString& items, unsigned int pos);
|
1999-11-08 09:53:39 -05:00
|
|
|
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
|
|
|
virtual void DoSetFirstItem(int n);
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
2002-07-31 16:35:41 -04:00
|
|
|
virtual bool IsSelected(int n) const;
|
2002-07-28 16:50:37 -04:00
|
|
|
|
2002-07-31 16:35:41 -04:00
|
|
|
// For single or multiple choice list item
|
1999-02-22 06:01:13 -05:00
|
|
|
void Command(wxCommandEvent& event);
|
2005-09-27 12:54:43 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
// Implementation
|
|
|
|
virtual void ChangeBackgroundColour();
|
|
|
|
virtual void ChangeForegroundColour();
|
|
|
|
WXWidget GetTopWidget() const;
|
2002-07-31 16:35:41 -04:00
|
|
|
|
|
|
|
#if wxUSE_CHECKLISTBOX
|
2005-10-03 12:39:45 -04:00
|
|
|
virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {};
|
2002-07-31 16:35:41 -04:00
|
|
|
#endif
|
1998-09-28 11:42:54 -04:00
|
|
|
protected:
|
2003-02-23 15:33:43 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
unsigned int m_noItems;
|
2005-09-27 12:54:43 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
// List mapping positions->client data
|
2002-12-24 13:41:42 -05:00
|
|
|
wxClientDataDictionary m_clientDataDict;
|
|
|
|
private:
|
|
|
|
void SetSelectionPolicy();
|
1998-09-18 06:19:10 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2002-02-05 11:34:33 -05:00
|
|
|
// _WX_LISTBOX_H_
|