1999-12-04 22:34:54 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/listctrl.h
|
|
|
|
// Purpose: wxListCtrl class
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04.12.99
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 14:56:36 +00:00
|
|
|
// Copyright: (c) wxWidgets team
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-12-04 22:34:54 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_LISTCTRL_H_BASE_
|
|
|
|
#define _WX_LISTCTRL_H_BASE_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
2000-01-24 13:13:41 +00:00
|
|
|
#pragma interface "listctrlbase.h"
|
|
|
|
#endif
|
|
|
|
|
2004-08-04 07:03:53 +00:00
|
|
|
#include "wx/defs.h" // headers should include this before first wxUSE_XXX check
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#if wxUSE_LISTCTRL
|
|
|
|
|
2002-07-30 19:04:18 +00:00
|
|
|
#include "wx/listbase.h"
|
1999-12-04 22:34:54 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// include the wxListCtrl class declaration
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-07-07 23:22:43 +00:00
|
|
|
#if defined(__WIN32__) && !defined(__WXUNIVERSAL__)
|
2001-07-07 22:42:35 +00:00
|
|
|
#include "wx/msw/listctrl.h"
|
2002-07-22 23:03:03 +00:00
|
|
|
#else
|
|
|
|
#include "wx/generic/listctrl.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
2001-07-13 19:26:44 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxListView: a class which provides a better API for list control
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxListView : public wxListCtrl
|
|
|
|
{
|
|
|
|
public:
|
2004-01-15 13:49:22 +00:00
|
|
|
wxListView() { }
|
2001-07-13 19:26:44 +00:00
|
|
|
wxListView( wxWindow *parent,
|
2004-09-17 17:57:44 +00:00
|
|
|
wxWindowID winid = wxID_ANY,
|
2001-07-13 19:26:44 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxLC_REPORT,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2004-01-15 13:49:22 +00:00
|
|
|
const wxString &name = wxT("listctrl") )
|
|
|
|
{
|
|
|
|
Create(parent, winid, pos, size, style, validator, name);
|
|
|
|
}
|
2001-07-13 19:26:44 +00:00
|
|
|
|
2001-09-03 16:57:16 +00:00
|
|
|
// focus/selection stuff
|
|
|
|
// ---------------------
|
|
|
|
|
2001-07-13 19:26:44 +00:00
|
|
|
// [de]select an item
|
2004-09-17 17:57:44 +00:00
|
|
|
void Select(long n, bool on = true)
|
2001-07-13 19:26:44 +00: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 17:57:44 +00:00
|
|
|
// return true if the item is selected
|
2001-07-13 19:26:44 +00:00
|
|
|
bool IsSelected(long index)
|
|
|
|
{ return GetItemState(index, wxLIST_STATE_SELECTED) != 0; }
|
2001-09-03 16:57:16 +00: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 19:02:17 +00:00
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView)
|
2001-07-13 19:26:44 +00:00
|
|
|
};
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#endif // wxUSE_LISTCTRL
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
1998-08-15 00:23:28 +00:00
|
|
|
// _WX_LISTCTRL_H_BASE_
|