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
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
2000-01-24 08:13:41 -05:00
|
|
|
#pragma interface "listctrlbase.h"
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2005-01-21 13:48:22 -05:00
|
|
|
extern WXDLLEXPORT_DATA(const wxChar*) wxListCtrlNameStr;
|
2005-01-14 08:07:44 -05:00
|
|
|
|
1999-12-04 17:34:54 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// include the wxListCtrl class declaration
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-07-07 19:22:43 -04:00
|
|
|
#if defined(__WIN32__) && !defined(__WXUNIVERSAL__)
|
2001-07-07 18:42:35 -04:00
|
|
|
#include "wx/msw/listctrl.h"
|
2002-07-22 19:03:03 -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
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxListView : public wxListCtrl
|
|
|
|
{
|
|
|
|
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
|
2001-07-13 15:26:44 -04:00
|
|
|
bool IsSelected(long index)
|
|
|
|
{ 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_
|