2004-03-23 17:35:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 16:54:43 +00:00
|
|
|
// Name: wx/mac/carbon/listbox.h
|
2004-03-23 17:35:05 +00:00
|
|
|
// Purpose: wxListBox class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Stefan Csomor
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2004-03-23 17:35:05 +00: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-04-09 06:42:32 +00:00
|
|
|
// forward decl for GetPeer()
|
|
|
|
class wxMacListControl ;
|
|
|
|
|
2004-03-23 17:35:05 +00:00
|
|
|
// List box item
|
|
|
|
|
|
|
|
WX_DEFINE_ARRAY( char * , wxListDataArray ) ;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// List box control
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxListBox : public wxListBoxBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctors and such
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(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);
|
|
|
|
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);
|
|
|
|
|
|
|
|
virtual ~wxListBox();
|
2006-03-14 19:44:45 +00:00
|
|
|
virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL);
|
2005-08-08 21:49:22 +00:00
|
|
|
|
2004-03-23 17:35:05 +00:00
|
|
|
// implement base class pure virtuals
|
|
|
|
virtual void Clear();
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual void Delete(unsigned int n);
|
2004-03-23 17:35:05 +00:00
|
|
|
|
2006-03-23 22:05:23 +00: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 16:54:43 +00:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
2004-03-23 17:35:05 +00:00
|
|
|
|
|
|
|
virtual bool IsSelected(int n) const;
|
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
|
|
|
|
|
|
|
// wxCheckListBox support
|
2004-08-10 04:07:32 +00:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
2005-08-08 21:49:22 +00:00
|
|
|
|
2004-03-23 17:35:05 +00:00
|
|
|
wxArrayString m_stringArray ;
|
|
|
|
wxListDataArray m_dataArray ;
|
2006-04-09 06:42:32 +00:00
|
|
|
|
|
|
|
wxMacListControl* GetPeer() const { return (wxMacListControl*) m_peer ; }
|
2005-08-08 21:49:22 +00:00
|
|
|
|
2004-03-23 17:35:05 +00:00
|
|
|
protected:
|
2006-04-09 06:42:32 +00:00
|
|
|
// internal storage for line n has changed, issue a redraw
|
|
|
|
void MacUpdateLine( int n ) ;
|
|
|
|
|
2006-02-08 21:47:09 +00:00
|
|
|
virtual void DoSetSelection(int n, bool select);
|
|
|
|
virtual int DoAppend(const wxString& item);
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual void DoInsertItems(const wxArrayString& items, unsigned int pos);
|
2006-02-08 21:47:09 +00:00
|
|
|
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
|
|
|
virtual void DoSetFirstItem(int n);
|
2006-03-23 22:05:23 +00: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-02-08 21:47:09 +00:00
|
|
|
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
2006-03-09 12:48:52 +00:00
|
|
|
virtual int DoListHitTest(const wxPoint& point) const;
|
2006-02-08 21:47:09 +00:00
|
|
|
|
2004-03-23 17:35:05 +00:00
|
|
|
// free memory (common part of Clear() and dtor)
|
2005-08-08 21:49:22 +00:00
|
|
|
// prevent collision with some BSD definitions of macro Free()
|
2004-03-23 17:35:05 +00:00
|
|
|
void FreeData();
|
|
|
|
|
2006-03-23 22:05:23 +00:00
|
|
|
unsigned int m_noItems;
|
2006-04-10 11:45:54 +00:00
|
|
|
|
2004-03-23 17:35:05 +00:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2006-04-09 06:42:32 +00:00
|
|
|
// common creation for all databrowser list implementations
|
|
|
|
wxMacListControl* CreateMacListControl(const wxPoint& pos, const wxSize& size, long style) ;
|
|
|
|
|
2004-03-23 17:35:05 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2005-08-08 21:49:22 +00:00
|
|
|
#endif // _WX_LISTBOX_H_
|