1998-09-18 10:19:10 +00: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 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
|
|
|
|
|
|
|
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 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)
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
~wxListBox();
|
2002-02-05 16:34:33 +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);
|
|
|
|
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 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);
|
2002-02-05 16:34:33 +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
|
|
|
|
virtual void DoToggleItem(int item, int x) {};
|
|
|
|
#endif
|
1998-09-28 15:42:54 +00:00
|
|
|
protected:
|
1999-02-22 11:01:13 +00:00
|
|
|
int m_noItems;
|
2002-02-05 16:34:33 +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_
|