1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-10-22 11:55:27 -04:00
|
|
|
// Name: wx/msw/listbox.h
|
1998-05-20 10:12:05 -04:00
|
|
|
// Purpose: wxListBox class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
1999-10-23 19:40:55 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_LISTBOX_H_
|
|
|
|
#define _WX_LISTBOX_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-10-23 19:40:55 -04:00
|
|
|
#pragma interface "listbox.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#if wxUSE_LISTBOX
|
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// simple types
|
|
|
|
// ----------------------------------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
1998-05-20 10:12:05 -04:00
|
|
|
class WXDLLEXPORT wxOwnerDrawn;
|
|
|
|
|
|
|
|
// define the array of list box items
|
2002-06-01 07:48:26 -04:00
|
|
|
#include "wx/dynarray.h"
|
1998-11-22 17:32:53 -05:00
|
|
|
|
1999-10-12 19:57:40 -04:00
|
|
|
WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray);
|
1999-10-22 11:55:27 -04:00
|
|
|
#endif // wxUSE_OWNER_DRAWN
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1998-06-22 17:54:19 -04:00
|
|
|
// forward decl for GetSelections()
|
|
|
|
class wxArrayInt;
|
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// List box control
|
|
|
|
// ----------------------------------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
class WXDLLEXPORT wxListBox : public wxListBoxBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-02-22 06:01:13 -05:00
|
|
|
public:
|
1999-10-22 11:55:27 -04:00
|
|
|
// ctors and such
|
1999-02-22 06:01:13 -05:00
|
|
|
wxListBox();
|
|
|
|
wxListBox(wxWindow *parent, wxWindowID id,
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
Create(parent, id, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
1999-10-22 11:55:27 -04: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
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
virtual ~wxListBox();
|
1999-02-22 06:01:13 -05:00
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
// implement base class pure virtuals
|
|
|
|
virtual void Clear();
|
|
|
|
virtual void Delete(int n);
|
|
|
|
|
|
|
|
virtual int GetCount() const;
|
|
|
|
virtual wxString GetString(int n) const;
|
|
|
|
virtual void SetString(int n, const wxString& s);
|
|
|
|
virtual int FindString(const wxString& s) const;
|
|
|
|
|
|
|
|
virtual bool IsSelected(int n) const;
|
|
|
|
virtual void SetSelection(int n, bool select = TRUE);
|
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
|
|
|
|
|
|
|
virtual int DoAppend(const wxString& item);
|
|
|
|
virtual void DoInsertItems(const wxArrayString& items, int pos);
|
|
|
|
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
virtual void DoSetFirstItem(int n);
|
|
|
|
|
1999-10-22 14:00:39 -04: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;
|
1999-10-22 11:55:27 -04:00
|
|
|
|
|
|
|
// wxCheckListBox support
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
1999-02-22 06:01:13 -05:00
|
|
|
bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item);
|
|
|
|
bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
// plug-in for derived classes
|
2002-12-04 09:11:26 -05:00
|
|
|
virtual wxOwnerDrawn *CreateLboxItem(size_t n);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
// allows to get the item and use SetXXX functions to set it's appearance
|
|
|
|
wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; }
|
1999-02-28 10:35:51 -05:00
|
|
|
|
|
|
|
// get the index of the given item
|
|
|
|
int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
|
1999-02-22 06:01:13 -05:00
|
|
|
#endif // wxUSE_OWNER_DRAWN
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
// Windows-specific code to set the horizontal extent of the listbox, if
|
|
|
|
// necessary. If s is non-NULL, it's used to calculate the horizontal
|
|
|
|
// extent. Otherwise, all strings are used.
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void SetHorizontalExtent(const wxString& s = wxEmptyString);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-10-22 11:55:27 -04:00
|
|
|
// Windows callbacks
|
|
|
|
bool MSWCommand(WXUINT param, WXWORD id);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void SetupColours();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
protected:
|
1999-10-23 19:40:55 -04:00
|
|
|
// free memory (common part of Clear() and dtor)
|
|
|
|
void Free();
|
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
int m_noItems;
|
|
|
|
int m_selected;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-19 16:01:20 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
1999-07-19 18:17:40 -04:00
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
1999-02-22 06:01:13 -05:00
|
|
|
// control items
|
|
|
|
wxListBoxItemsArray m_aItems;
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
1999-10-22 11:55:27 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#endif // wxUSE_LISTBOX
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_LISTBOX_H_
|