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()
|
2007-11-23 14:13:50 +00:00
|
|
|
class WXDLLIMPEXP_FWD_BASE wxArrayInt;
|
1998-09-18 10:19:10 +00:00
|
|
|
|
|
|
|
// List box item
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE 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
|
|
|
|
2002-07-31 20:35:41 +00:00
|
|
|
// implementation of wxControlWithItems
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual unsigned int GetCount() const;
|
2007-07-26 13:54:14 +00:00
|
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
|
|
|
unsigned int pos,
|
|
|
|
void **clientData, wxClientDataType type);
|
2002-07-31 20:35:41 +00:00
|
|
|
virtual int GetSelection() const;
|
2007-07-26 13:54:14 +00:00
|
|
|
virtual void DoDeleteOneItem(unsigned int n);
|
2005-09-27 16:54:43 +00:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
2007-07-26 13:54:14 +00:00
|
|
|
virtual void DoClear();
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual void SetString(unsigned int n, const wxString& s);
|
|
|
|
virtual wxString GetString(unsigned int n) const;
|
2002-07-31 20:35:41 +00:00
|
|
|
|
|
|
|
// 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 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
|
2007-07-26 13:54:14 +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;
|
|
|
|
|
2006-03-23 22:05:23 +00:00
|
|
|
unsigned int m_noItems;
|
2005-09-27 16:54:43 +00:00
|
|
|
|
2002-12-24 18:41:42 +00:00
|
|
|
private:
|
|
|
|
void SetSelectionPolicy();
|
1998-09-18 10:19:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2002-02-05 16:34:33 +00:00
|
|
|
// _WX_LISTBOX_H_
|