1999-12-04 17:34:54 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/listctrl.h
|
|
|
|
// Purpose: wxListCtrl class
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04.12.99
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 10:56:36 -04:00
|
|
|
// Copyright: (c) wxWidgets team
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-12-04 17:34:54 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-14 20:23:28 -04:00
|
|
|
#ifndef _WX_LISTCTRL_H_BASE_
|
|
|
|
#define _WX_LISTCTRL_H_BASE_
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2004-08-04 03:03:53 -04:00
|
|
|
#include "wx/defs.h" // headers should include this before first wxUSE_XXX check
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#if wxUSE_LISTCTRL
|
|
|
|
|
2002-07-30 15:04:18 -04:00
|
|
|
#include "wx/listbase.h"
|
1999-12-04 17:34:54 -05:00
|
|
|
|
2005-01-14 08:07:44 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[];
|
2005-01-14 08:07:44 -05:00
|
|
|
|
1999-12-04 17:34:54 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// include the wxListCtrl class declaration
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2012-03-04 15:31:42 -05:00
|
|
|
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
2001-07-07 18:42:35 -04:00
|
|
|
#include "wx/msw/listctrl.h"
|
2008-09-02 07:50:44 -04:00
|
|
|
#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
|
2009-01-17 08:38:04 -05:00
|
|
|
#include "wx/osx/listctrl.h"
|
2006-10-02 13:38:30 -04:00
|
|
|
#else
|
|
|
|
#include "wx/generic/listctrl.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
2001-07-13 15:26:44 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxListView: a class which provides a better API for list control
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxListView : public wxListCtrl
|
2001-07-13 15:26:44 -04:00
|
|
|
{
|
|
|
|
public:
|
2004-01-15 08:49:22 -05:00
|
|
|
wxListView() { }
|
2001-07-13 15:26:44 -04:00
|
|
|
wxListView( wxWindow *parent,
|
2004-09-17 13:57:44 -04:00
|
|
|
wxWindowID winid = wxID_ANY,
|
2001-07-13 15:26:44 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxLC_REPORT,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2005-01-14 08:07:44 -05:00
|
|
|
const wxString &name = wxListCtrlNameStr)
|
2004-01-15 08:49:22 -05:00
|
|
|
{
|
|
|
|
Create(parent, winid, pos, size, style, validator, name);
|
|
|
|
}
|
2001-07-13 15:26:44 -04:00
|
|
|
|
2001-09-03 12:57:16 -04:00
|
|
|
// focus/selection stuff
|
|
|
|
// ---------------------
|
|
|
|
|
2001-07-13 15:26:44 -04:00
|
|
|
// [de]select an item
|
2004-09-17 13:57:44 -04:00
|
|
|
void Select(long n, bool on = true)
|
2001-07-13 15:26:44 -04:00
|
|
|
{
|
|
|
|
SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
// focus and show the given item
|
|
|
|
void Focus(long index)
|
|
|
|
{
|
|
|
|
SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
|
|
|
|
EnsureVisible(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
// get the currently focused item or -1 if none
|
|
|
|
long GetFocusedItem() const
|
|
|
|
{
|
|
|
|
return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
|
|
|
|
}
|
|
|
|
|
|
|
|
// get first and subsequent selected items, return -1 when no more
|
|
|
|
long GetNextSelected(long item) const
|
|
|
|
{ return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }
|
|
|
|
long GetFirstSelected() const
|
|
|
|
{ return GetNextSelected(-1); }
|
|
|
|
|
2004-09-17 13:57:44 -04:00
|
|
|
// return true if the item is selected
|
2006-09-26 05:20:50 -04:00
|
|
|
bool IsSelected(long index) const
|
2001-07-13 15:26:44 -04:00
|
|
|
{ return GetItemState(index, wxLIST_STATE_SELECTED) != 0; }
|
2001-09-03 12:57:16 -04:00
|
|
|
|
|
|
|
// columns
|
|
|
|
// -------
|
|
|
|
|
|
|
|
void SetColumnImage(int col, int image)
|
|
|
|
{
|
|
|
|
wxListItem item;
|
|
|
|
item.SetMask(wxLIST_MASK_IMAGE);
|
|
|
|
item.SetImage(image);
|
|
|
|
SetColumn(col, item);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClearColumnImage(int col) { SetColumnImage(col, -1); }
|
|
|
|
|
2001-08-02 15:02:17 -04:00
|
|
|
private:
|
2003-07-21 20:24:07 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView)
|
2001-07-13 15:26:44 -04:00
|
|
|
};
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#endif // wxUSE_LISTCTRL
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
1998-08-14 20:23:28 -04:00
|
|
|
// _WX_LISTCTRL_H_BASE_
|