1999-01-01 16:05:26 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: checklst.h
|
|
|
|
// Purpose: wxCheckListBox class - a listbox with checkable items
|
|
|
|
// Note: this is an optional class.
|
2003-02-28 21:54:04 +00:00
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
1999-01-01 16:05:26 +00:00
|
|
|
// RCS-ID: $Id$
|
2003-02-28 21:54:04 +00:00
|
|
|
// Copyright: (c) Stefan Csomor
|
1999-01-01 16:05:26 +00:00
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_CHECKLST_H_
|
|
|
|
#define _WX_CHECKLST_H_
|
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-01-01 16:05:26 +00:00
|
|
|
#pragma interface "checklst.h"
|
|
|
|
#endif
|
|
|
|
|
2001-02-15 21:51:14 +00:00
|
|
|
#if !defined(__MWERKS__) && !defined(__UNIX__)
|
1999-01-01 16:05:26 +00:00
|
|
|
typedef unsigned int size_t;
|
|
|
|
#endif
|
|
|
|
|
2002-01-20 16:13:05 +00:00
|
|
|
class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase
|
1999-01-01 16:05:26 +00:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
|
|
|
public:
|
|
|
|
// ctors
|
2001-12-31 16:30:54 +00:00
|
|
|
wxCheckListBox() { Init(); }
|
|
|
|
wxCheckListBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int nStrings = 0,
|
|
|
|
const wxString *choices = NULL,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListBoxNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
|
|
|
Create(parent, id, pos, size, nStrings, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 18:21:45 +00:00
|
|
|
wxCheckListBox(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListBoxNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
|
|
|
Create(parent, id, pos, size, choices, style, validator, name);
|
|
|
|
}
|
2001-12-31 16:30:54 +00:00
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int nStrings = 0,
|
|
|
|
const wxString *choices = NULL,
|
2004-01-31 18:21:45 +00:00
|
|
|
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,
|
2001-12-31 16:30:54 +00:00
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListBoxNameStr);
|
1999-01-01 16:05:26 +00:00
|
|
|
|
|
|
|
// items may be checked
|
|
|
|
bool IsChecked(size_t uiIndex) const;
|
|
|
|
void Check(size_t uiIndex, bool bCheck = TRUE);
|
2001-12-31 16:30:54 +00:00
|
|
|
void OnChar(wxKeyEvent& event) ;
|
|
|
|
void OnLeftClick(wxMouseEvent& event) ;
|
|
|
|
|
2003-02-28 23:36:37 +00:00
|
|
|
// metrics
|
|
|
|
wxInt32 m_checkBoxWidth;
|
2002-04-16 21:04:38 +00:00
|
|
|
wxInt32 m_checkBoxHeight;
|
2003-02-28 23:36:37 +00:00
|
|
|
wxInt32 m_TextBaseLineOffset;
|
|
|
|
|
2001-12-31 16:30:54 +00:00
|
|
|
// the array containing the checked status of the items
|
|
|
|
wxArrayInt m_checks;
|
1999-01-01 16:05:26 +00:00
|
|
|
|
2001-12-31 16:30:54 +00:00
|
|
|
// override all methods which add/delete items to update m_checks array as
|
|
|
|
// well
|
|
|
|
virtual void Delete(int n);
|
|
|
|
protected:
|
|
|
|
virtual int DoAppend(const wxString& item);
|
|
|
|
virtual void DoInsertItems(const wxArrayString& items, int pos);
|
|
|
|
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
|
|
|
virtual void DoClear();
|
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
private:
|
1999-01-01 16:05:26 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_CHECKLST_H_
|