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$
|
|
|
|
// Copyright: (c) wxWindows team
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
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
|
|
|
|
2002-08-31 11:29:13 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
2000-01-24 13:13:41 +00:00
|
|
|
#pragma interface "listctrlbase.h"
|
|
|
|
#endif
|
|
|
|
|
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"
|
2003-01-21 23:34:02 +00:00
|
|
|
#elif defined(__WXPM__)
|
|
|
|
#include "wx/os2/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:
|
|
|
|
wxListView() { }
|
|
|
|
wxListView( wxWindow *parent,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxLC_REPORT,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2002-12-04 14:11:26 +00:00
|
|
|
const wxString &name = wxT("listctrl") )
|
2001-07-13 19:26:44 +00:00
|
|
|
{
|
2002-02-07 18:46:31 +00:00
|
|
|
Create(parent, id, 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
|
2001-07-31 20:56:17 +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); }
|
|
|
|
|
|
|
|
// return TRUE if the item is selected
|
|
|
|
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_
|