2004-03-23 12:35:05 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 12:54:43 -04:00
|
|
|
// Name: wx/mac/carbon/listbox.h
|
2004-03-23 12:35:05 -05:00
|
|
|
// Purpose: wxListBox class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Stefan Csomor
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2004-03-23 12:35:05 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_LISTBOX_H_
|
|
|
|
#define _WX_LISTBOX_H_
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// simple types
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
#include "wx/dynarray.h"
|
|
|
|
#include "wx/arrstr.h"
|
|
|
|
|
|
|
|
// forward decl for GetSelections()
|
|
|
|
class wxArrayInt;
|
|
|
|
|
2006-09-16 21:20:08 -04:00
|
|
|
// forward decl for wxMacListControl data type.
|
|
|
|
class wxMacListControl;
|
2006-04-09 02:42:32 -04:00
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
// List box item
|
|
|
|
|
2006-04-10 10:58:15 -04:00
|
|
|
WX_DEFINE_ARRAY( char* , wxListDataArray );
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// List box control
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxListBox : public wxListBoxBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctors and such
|
|
|
|
wxListBox();
|
2006-04-10 10:58:15 -04:00
|
|
|
|
|
|
|
wxListBox(
|
|
|
|
wxWindow *parent,
|
2006-04-19 02:42:21 -04:00
|
|
|
wxWindowID winid,
|
2006-04-10 10:58:15 -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)
|
2004-03-23 12:35:05 -05:00
|
|
|
{
|
2006-04-19 02:42:21 -04:00
|
|
|
Create(parent, winid, pos, size, n, choices, style, validator, name);
|
2004-03-23 12:35:05 -05:00
|
|
|
}
|
2006-04-10 10:58:15 -04:00
|
|
|
|
|
|
|
wxListBox(
|
|
|
|
wxWindow *parent,
|
2006-04-19 02:42:21 -04:00
|
|
|
wxWindowID winid,
|
2006-04-10 10:58:15 -04:00
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListBoxNameStr)
|
2004-03-23 12:35:05 -05:00
|
|
|
{
|
2006-04-19 02:42:21 -04:00
|
|
|
Create(parent, winid, pos, size, choices, style, validator, name);
|
2004-03-23 12:35:05 -05:00
|
|
|
}
|
|
|
|
|
2006-04-10 10:58:15 -04:00
|
|
|
bool Create(
|
|
|
|
wxWindow *parent,
|
2006-04-19 02:42:21 -04:00
|
|
|
wxWindowID winid,
|
2006-04-10 10:58:15 -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);
|
|
|
|
|
|
|
|
bool Create(
|
|
|
|
wxWindow *parent,
|
2006-04-19 02:42:21 -04:00
|
|
|
wxWindowID winid,
|
2006-04-10 10:58:15 -04:00
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListBoxNameStr);
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
virtual ~wxListBox();
|
2005-08-08 17:49:22 -04:00
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
// implement base class pure virtuals
|
2006-04-10 10:58:15 -04:00
|
|
|
virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL);
|
2004-03-23 12:35:05 -05:00
|
|
|
virtual void Clear();
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void Delete(unsigned int n);
|
2004-03-23 12:35:05 -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& s);
|
2005-09-27 12:54:43 -04:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
virtual bool IsSelected(int n) const;
|
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
|
|
|
|
2006-04-19 02:42:21 -04:00
|
|
|
virtual void EnsureVisible(int n);
|
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
// wxCheckListBox support
|
2004-08-10 00:07:32 -04:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
2006-05-17 20:40:16 -04:00
|
|
|
|
2006-04-19 02:42:21 -04:00
|
|
|
wxMacListControl* GetPeer() const;
|
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
protected:
|
2006-05-17 20:40:16 -04:00
|
|
|
// from wxItemContainer
|
2006-02-08 16:47:09 -05:00
|
|
|
virtual int DoAppend(const wxString& item);
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const;
|
|
|
|
virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
|
|
|
|
virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
|
2006-04-19 02:42:21 -04:00
|
|
|
|
|
|
|
// from wxListBoxBase
|
|
|
|
virtual void DoSetSelection(int n, bool select);
|
|
|
|
virtual void DoInsertItems(const wxArrayString& items, unsigned int pos);
|
|
|
|
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
|
|
|
virtual void DoSetFirstItem(int n);
|
2006-03-09 07:48:52 -05:00
|
|
|
virtual int DoListHitTest(const wxPoint& point) const;
|
2006-02-08 16:47:09 -05:00
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
// free memory (common part of Clear() and dtor)
|
2005-08-08 17:49:22 -04:00
|
|
|
// prevent collision with some BSD definitions of macro Free()
|
2004-03-23 12:35:05 -05:00
|
|
|
void FreeData();
|
|
|
|
|
2006-04-19 02:42:21 -04:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2005-08-08 17:49:22 -04:00
|
|
|
#endif // _WX_LISTBOX_H_
|