1998-09-18 06:19:10 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: listbox.h
|
|
|
|
// Purpose: wxListBox class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 17/09/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_LISTBOX_H_
|
|
|
|
#define _WX_LISTBOX_H_
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "listbox.h"
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
|
|
|
WXDLLEXPORT_DATA(extern const char*) wxListBoxNameStr;
|
|
|
|
|
|
|
|
// forward decl for GetSelections()
|
|
|
|
class WXDLLEXPORT wxArrayInt;
|
|
|
|
|
|
|
|
WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
~wxListBox();
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-07-31 16:35:41 -04:00
|
|
|
// implementation of wxControlWithItems
|
1999-11-08 09:53:39 -05:00
|
|
|
virtual int GetCount() const;
|
|
|
|
virtual int DoAppend(const wxString& item);
|
2002-12-24 13:41:42 -05: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 16:35:41 -04:00
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual void Delete(int n);
|
|
|
|
virtual int FindString(const wxString& s) const;
|
|
|
|
virtual void Clear();
|
|
|
|
virtual void SetString(int n, const wxString& s);
|
|
|
|
virtual wxString GetString(int n) const;
|
|
|
|
|
|
|
|
// implementation of wxListBoxbase
|
|
|
|
virtual void SetSelection(int n, bool select = TRUE);
|
1999-11-08 09:53:39 -05: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 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);
|
2002-02-05 11:34:33 -05: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
|
|
|
|
virtual void DoToggleItem(int item, int x) {};
|
|
|
|
#endif
|
1998-09-28 11:42:54 -04:00
|
|
|
protected:
|
1999-02-22 06:01:13 -05:00
|
|
|
int m_noItems;
|
2002-02-05 11:34:33 -05: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_
|