1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: listbox.h
|
|
|
|
// Purpose: wxListBox class
|
1999-10-10 14:36:14 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-10-10 14:36:14 -04:00
|
|
|
// Created: 10/09/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-10-10 14:36:14 -04:00
|
|
|
// Copyright: (c) David Webster
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_LISTBOX_H_
|
|
|
|
#define _WX_LISTBOX_H_
|
|
|
|
|
1999-10-22 18:00:20 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// simple types
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-10 14:36:14 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
2005-07-21 13:18:43 -04:00
|
|
|
class WXDLLEXPORT wxOwnerDrawn;
|
1999-10-10 14:36:14 -04:00
|
|
|
|
2005-07-21 13:18:43 -04:00
|
|
|
// define the array of list box items
|
|
|
|
#include <wx/dynarray.h>
|
1999-10-10 14:36:14 -04:00
|
|
|
|
2005-07-21 13:18:43 -04:00
|
|
|
WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray);
|
1999-10-22 18:00:20 -04:00
|
|
|
#endif // wxUSE_OWNER_DRAWN
|
1999-10-10 14:36:14 -04:00
|
|
|
|
1999-07-29 01:11:30 -04:00
|
|
|
// forward decl for GetSelections()
|
1999-10-22 18:00:20 -04:00
|
|
|
class wxArrayInt;
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-22 18:00:20 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// List box control
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-22 18:00:20 -04:00
|
|
|
class WXDLLEXPORT wxListBox : public wxListBoxBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
1999-10-22 18:00:20 -04:00
|
|
|
public:
|
|
|
|
// ctors and such
|
|
|
|
wxListBox();
|
2001-11-04 21:50:59 -05:00
|
|
|
wxListBox( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,int n = 0
|
|
|
|
,const wxString asChoices[] = NULL
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
|
|
|
,const wxString& rsName = wxListBoxNameStr)
|
1999-10-22 18:00:20 -04:00
|
|
|
{
|
2001-11-04 21:50:59 -05:00
|
|
|
Create( pParent
|
|
|
|
,vId
|
|
|
|
,rPos
|
|
|
|
,rSize
|
|
|
|
,n
|
|
|
|
,asChoices
|
|
|
|
,lStyle
|
|
|
|
,rValidator
|
|
|
|
,rsName
|
|
|
|
);
|
1999-10-22 18:00:20 -04:00
|
|
|
}
|
2004-01-31 13:21:45 -05:00
|
|
|
wxListBox( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos
|
|
|
|
,const wxSize& rSize
|
|
|
|
,const wxArrayString& asChoices
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
|
|
|
,const wxString& rsName = wxListBoxNameStr)
|
|
|
|
{
|
|
|
|
Create( pParent
|
|
|
|
,vId
|
|
|
|
,rPos
|
|
|
|
,rSize
|
|
|
|
,asChoices
|
|
|
|
,lStyle
|
|
|
|
,rValidator
|
|
|
|
,rsName
|
|
|
|
);
|
|
|
|
}
|
1999-10-22 18:00:20 -04:00
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
bool Create( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,int n = 0
|
|
|
|
,const wxString asChoices[] = NULL
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
|
|
|
,const wxString& rsName = wxListBoxNameStr
|
|
|
|
);
|
2004-01-31 13:21:45 -05:00
|
|
|
bool Create( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos
|
|
|
|
,const wxSize& rSize
|
|
|
|
,const wxArrayString& asChoices
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
|
|
|
,const wxString& rsName = wxListBoxNameStr
|
|
|
|
);
|
1999-10-22 18:00:20 -04:00
|
|
|
|
|
|
|
virtual ~wxListBox();
|
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
//
|
|
|
|
// Implement base class pure virtuals
|
|
|
|
//
|
|
|
|
virtual void Clear(void);
|
|
|
|
virtual void Delete(int n);
|
|
|
|
|
|
|
|
virtual int GetCount(void) const;
|
|
|
|
virtual wxString GetString(int n) const;
|
|
|
|
virtual void SetString( int n
|
|
|
|
,const wxString& rsString
|
|
|
|
);
|
|
|
|
virtual int FindString(const wxString& rsString) const;
|
|
|
|
|
|
|
|
virtual bool IsSelected(int n) const;
|
2005-02-13 12:08:27 -05:00
|
|
|
virtual void DoSetSelection( int n
|
|
|
|
,bool bSelect
|
2001-11-04 21:50:59 -05:00
|
|
|
);
|
|
|
|
virtual int GetSelection(void) const;
|
|
|
|
virtual int GetSelections(wxArrayInt& raSelections) const;
|
|
|
|
|
|
|
|
virtual int DoAppend(const wxString& rsItem);
|
|
|
|
virtual void DoInsertItems( const wxArrayString& raItems
|
|
|
|
,int rPos
|
|
|
|
);
|
|
|
|
virtual void DoSetItems( const wxArrayString& raItems
|
|
|
|
,void ** ppClientData
|
|
|
|
);
|
|
|
|
|
|
|
|
virtual void DoSetFirstItem(int n);
|
|
|
|
|
|
|
|
virtual void DoSetItemClientData( int n
|
|
|
|
,void* pClientData
|
|
|
|
);
|
|
|
|
virtual void* DoGetItemClientData(int n) const;
|
|
|
|
virtual void DoSetItemClientObject( int n
|
|
|
|
,wxClientData* pClientData
|
|
|
|
);
|
1999-10-22 18:00:20 -04:00
|
|
|
virtual wxClientData* DoGetItemClientObject(int n) const;
|
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
//
|
1999-10-22 18:00:20 -04:00
|
|
|
// wxCheckListBox support
|
2001-11-04 21:50:59 -05:00
|
|
|
//
|
1999-10-10 14:36:14 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
2002-09-03 18:26:53 -04:00
|
|
|
long OS2OnMeasure(WXMEASUREITEMSTRUCT *item);
|
2001-11-04 21:50:59 -05:00
|
|
|
bool OS2OnDraw(WXDRAWITEMSTRUCT *item);
|
1999-10-10 14:36:14 -04:00
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
virtual wxOwnerDrawn* CreateItem(size_t n);
|
|
|
|
wxOwnerDrawn* GetItem(size_t n) const { return m_aItems[n]; }
|
|
|
|
int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
|
1999-10-10 14:36:14 -04:00
|
|
|
#endif // wxUSE_OWNER_DRAWN
|
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
bool OS2Command( WXUINT uParam
|
|
|
|
,WXWORD wId
|
|
|
|
);
|
|
|
|
virtual void SetupColours(void);
|
1999-10-10 14:36:14 -04:00
|
|
|
|
|
|
|
protected:
|
1999-10-22 18:00:20 -04:00
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
bool HasMultipleSelection(void) const;
|
|
|
|
virtual wxSize DoGetBestSize(void) const;
|
|
|
|
|
|
|
|
int m_nNumItems;
|
|
|
|
int m_nSelected;
|
1999-10-10 14:36:14 -04:00
|
|
|
|
|
|
|
|
|
|
|
#if wxUSE_OWNER_DRAWN
|
2001-11-04 21:50:59 -05:00
|
|
|
//
|
|
|
|
// Control items
|
|
|
|
//
|
|
|
|
wxListBoxItemsArray m_aItems;
|
1999-10-10 14:36:14 -04:00
|
|
|
#endif
|
1999-10-22 18:00:20 -04:00
|
|
|
|
1999-10-10 14:36:14 -04:00
|
|
|
private:
|
1999-10-22 18:00:20 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
2001-11-04 21:50:59 -05:00
|
|
|
}; // end of wxListBox
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_LISTBOX_H_
|