1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 12:54:43 -04:00
|
|
|
// Name: wx/os2/listbox.h
|
1999-07-29 01:11:30 -04:00
|
|
|
// 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
|
2005-11-15 02:40:12 -05:00
|
|
|
#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);
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void Delete(unsigned int n);
|
2001-11-04 21:50:59 -05:00
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual unsigned int GetCount() const;
|
|
|
|
virtual wxString GetString(unsigned int n) const;
|
|
|
|
virtual void SetString(unsigned int n, const wxString& rsString);
|
2001-11-04 21:50:59 -05:00
|
|
|
|
|
|
|
virtual bool IsSelected(int n) const;
|
2006-03-14 14:44:45 -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);
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoInsertItems( const wxArrayString& raItems, unsigned int rPos );
|
2001-11-04 21:50:59 -05:00
|
|
|
virtual void DoSetItems( const wxArrayString& raItems
|
|
|
|
,void ** ppClientData
|
|
|
|
);
|
|
|
|
|
|
|
|
virtual void DoSetFirstItem(int n);
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* pClientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const;
|
|
|
|
virtual void DoSetItemClientObject(unsigned int n, wxClientData* pClientData);
|
|
|
|
virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
|
1999-10-22 18:00:20 -04:00
|
|
|
|
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;
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
unsigned 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
|
|
|
|
2005-11-15 02:40:12 -05:00
|
|
|
#endif // _WX_LISTBOX_H_
|