1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-12-04 22:34:54 +00:00
|
|
|
// Name: wx/generic/listctrl.h
|
1998-05-20 14:01:55 +00:00
|
|
|
// Purpose: Generic list control
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Created: 01/02/97
|
|
|
|
// Id:
|
|
|
|
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
1999-12-04 22:34:54 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __LISTCTRLH_G__
|
|
|
|
#define __LISTCTRLH_G__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1998-07-03 16:36:10 +00:00
|
|
|
#pragma interface "listctrl.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
1998-12-23 09:58:02 +00:00
|
|
|
#include "wx/generic/imaglist.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#include "wx/control.h"
|
|
|
|
#include "wx/timer.h"
|
1998-08-17 17:05:47 +00:00
|
|
|
#include "wx/textctrl.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#include "wx/dcclient.h"
|
|
|
|
#include "wx/scrolwin.h"
|
|
|
|
#include "wx/settings.h"
|
|
|
|
|
1998-12-20 23:49:21 +00:00
|
|
|
#if wxUSE_DRAG_AND_DROP
|
|
|
|
class WXDLLEXPORT wxDropTarget;
|
|
|
|
#endif
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 23:49:21 +00:00
|
|
|
class WXDLLEXPORT wxListItem;
|
|
|
|
class WXDLLEXPORT wxListEvent;
|
|
|
|
class WXDLLEXPORT wxListCtrl;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// internal classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 23:49:21 +00:00
|
|
|
class WXDLLEXPORT wxListHeaderData;
|
|
|
|
class WXDLLEXPORT wxListItemData;
|
|
|
|
class WXDLLEXPORT wxListLineData;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1998-12-20 23:49:21 +00:00
|
|
|
class WXDLLEXPORT wxListHeaderWindow;
|
|
|
|
class WXDLLEXPORT wxListMainWindow;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1998-12-20 23:49:21 +00:00
|
|
|
class WXDLLEXPORT wxListRenameTimer;
|
1999-07-25 12:59:58 +00:00
|
|
|
class WXDLLEXPORT wxListTextCtrl;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListCtrl
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 23:49:21 +00:00
|
|
|
class WXDLLEXPORT wxListCtrl: public wxControl
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1999-11-26 17:35:27 +00:00
|
|
|
public:
|
1999-07-25 12:59:58 +00:00
|
|
|
wxListCtrl();
|
2000-01-06 16:47:48 +00:00
|
|
|
wxListCtrl( wxWindow *parent,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxPoint &pos = wxDefaultPosition,
|
|
|
|
const wxSize &size = wxDefaultSize,
|
|
|
|
long style = wxLC_ICON,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString &name = "listctrl" )
|
1998-10-24 20:25:36 +00:00
|
|
|
{
|
1999-11-26 17:35:27 +00:00
|
|
|
Create(parent, id, pos, size, style, validator, name);
|
1998-10-24 20:25:36 +00:00
|
|
|
}
|
1999-07-25 12:59:58 +00:00
|
|
|
~wxListCtrl();
|
1999-11-26 17:35:27 +00:00
|
|
|
|
2000-01-06 16:47:48 +00:00
|
|
|
bool Create( wxWindow *parent,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxPoint &pos = wxDefaultPosition,
|
|
|
|
const wxSize &size = wxDefaultSize,
|
|
|
|
long style = wxLC_ICON,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString &name = "listctrl" );
|
1999-11-26 17:35:27 +00:00
|
|
|
|
1998-12-07 13:28:56 +00:00
|
|
|
bool GetColumn( int col, wxListItem& item ) const;
|
1998-07-04 15:17:59 +00:00
|
|
|
bool SetColumn( int col, wxListItem& item );
|
1998-12-07 13:28:56 +00:00
|
|
|
int GetColumnWidth( int col ) const;
|
1998-07-04 15:17:59 +00:00
|
|
|
bool SetColumnWidth( int col, int width);
|
1999-07-25 12:59:58 +00:00
|
|
|
int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think
|
1999-11-26 17:35:27 +00:00
|
|
|
|
1998-12-07 13:28:56 +00:00
|
|
|
bool GetItem( wxListItem& info ) const;
|
1998-05-20 14:01:55 +00:00
|
|
|
bool SetItem( wxListItem& info ) ;
|
1998-07-04 15:17:59 +00:00
|
|
|
long SetItem( long index, int col, const wxString& label, int imageId = -1 );
|
1998-12-07 13:28:56 +00:00
|
|
|
int GetItemState( long item, long stateMask ) const;
|
1998-07-04 15:17:59 +00:00
|
|
|
bool SetItemState( long item, long state, long stateMask);
|
|
|
|
bool SetItemImage( long item, int image, int selImage);
|
1998-12-07 13:28:56 +00:00
|
|
|
wxString GetItemText( long item ) const;
|
1998-07-04 15:17:59 +00:00
|
|
|
void SetItemText( long item, const wxString& str );
|
1998-12-07 13:28:56 +00:00
|
|
|
long GetItemData( long item ) const;
|
1998-07-04 15:17:59 +00:00
|
|
|
bool SetItemData( long item, long data );
|
1999-01-31 13:58:17 +00:00
|
|
|
bool GetItemRect( long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const;
|
1998-12-07 13:28:56 +00:00
|
|
|
bool GetItemPosition( long item, wxPoint& pos ) const;
|
1998-07-04 15:17:59 +00:00
|
|
|
bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
|
1999-07-25 12:59:58 +00:00
|
|
|
int GetItemCount() const;
|
|
|
|
int GetColumnCount() const;
|
1998-07-13 23:30:59 +00:00
|
|
|
void SetItemSpacing( int spacing, bool isSmall = FALSE );
|
1998-12-07 13:28:56 +00:00
|
|
|
int GetItemSpacing( bool isSmall ) const;
|
1999-07-25 12:59:58 +00:00
|
|
|
int GetSelectedItemCount() const;
|
1999-12-06 10:43:35 +00:00
|
|
|
wxColour GetTextColour() const;
|
|
|
|
void SetTextColour(const wxColour& col);
|
1999-07-25 12:59:58 +00:00
|
|
|
long GetTopItem() const;
|
1999-11-26 17:35:27 +00:00
|
|
|
|
1998-07-04 15:17:59 +00:00
|
|
|
void SetSingleStyle( long style, bool add = TRUE ) ;
|
1999-07-25 12:59:58 +00:00
|
|
|
void SetWindowStyleFlag( long style );
|
|
|
|
void RecreateWindow() {}
|
|
|
|
long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const;
|
|
|
|
wxImageList *GetImageList( int which ) const;
|
|
|
|
void SetImageList( wxImageList *imageList, int which );
|
1998-07-04 15:17:59 +00:00
|
|
|
bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
|
1999-11-08 05:18:15 +00:00
|
|
|
|
1998-12-17 14:07:46 +00:00
|
|
|
void ClearAll();
|
1998-07-04 15:17:59 +00:00
|
|
|
bool DeleteItem( long item );
|
1999-07-25 12:59:58 +00:00
|
|
|
bool DeleteAllItems();
|
|
|
|
bool DeleteAllColumns();
|
1998-07-04 15:17:59 +00:00
|
|
|
bool DeleteColumn( int col );
|
1999-11-08 05:18:15 +00:00
|
|
|
|
1999-07-25 12:59:58 +00:00
|
|
|
void EditLabel( long item ) { Edit(item); }
|
|
|
|
void Edit( long item );
|
1999-11-08 05:18:15 +00:00
|
|
|
|
1998-07-04 15:17:59 +00:00
|
|
|
bool EnsureVisible( long item );
|
1999-07-25 12:59:58 +00:00
|
|
|
long FindItem( long start, const wxString& str, bool partial = FALSE );
|
|
|
|
long FindItem( long start, long data );
|
|
|
|
long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC
|
|
|
|
long HitTest( const wxPoint& point, int& flags);
|
1998-05-20 14:01:55 +00:00
|
|
|
long InsertItem(wxListItem& info);
|
1999-07-25 12:59:58 +00:00
|
|
|
long InsertItem( long index, const wxString& label );
|
|
|
|
long InsertItem( long index, int imageIndex );
|
|
|
|
long InsertItem( long index, const wxString& label, int imageIndex );
|
|
|
|
long InsertColumn( long col, wxListItem& info );
|
|
|
|
long InsertColumn( long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT,
|
|
|
|
int width = -1 );
|
|
|
|
bool ScrollList( int dx, int dy );
|
|
|
|
bool SortItems( wxListCtrlCompare fn, long data );
|
|
|
|
bool Update( long item );
|
1999-11-26 17:35:27 +00:00
|
|
|
|
1998-08-17 20:07:50 +00:00
|
|
|
void OnIdle( wxIdleEvent &event );
|
1999-11-26 17:35:27 +00:00
|
|
|
void OnSize( wxSizeEvent &event );
|
1999-11-08 05:18:15 +00:00
|
|
|
|
1998-08-17 20:07:50 +00:00
|
|
|
// We have to hand down a few functions
|
1999-11-08 05:18:15 +00:00
|
|
|
|
1999-05-09 22:17:03 +00:00
|
|
|
bool SetBackgroundColour( const wxColour &colour );
|
|
|
|
bool SetForegroundColour( const wxColour &colour );
|
|
|
|
bool SetFont( const wxFont &font );
|
1999-11-08 05:18:15 +00:00
|
|
|
|
1998-12-20 23:49:21 +00:00
|
|
|
#if wxUSE_DRAG_AND_DROP
|
2000-02-22 15:22:21 +00:00
|
|
|
void SetDropTarget( wxDropTarget *dropTarget );
|
|
|
|
wxDropTarget *GetDropTarget() const;
|
1998-12-20 23:49:21 +00:00
|
|
|
#endif
|
|
|
|
|
2000-02-22 15:22:21 +00:00
|
|
|
bool SetCursor( const wxCursor &cursor );
|
|
|
|
wxColour GetBackgroundColour() const;
|
|
|
|
wxColour GetForegroundColour() const;
|
|
|
|
bool DoPopupMenu( wxMenu *menu, int x, int y );
|
|
|
|
void SetFocus();
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-11-26 17:35:27 +00:00
|
|
|
// implementation
|
|
|
|
// --------------
|
1999-11-08 05:18:15 +00:00
|
|
|
|
1998-08-07 15:09:04 +00:00
|
|
|
wxImageList *m_imageListNormal;
|
|
|
|
wxImageList *m_imageListSmall;
|
1998-05-20 14:01:55 +00:00
|
|
|
wxImageList *m_imageListState; // what's that ?
|
|
|
|
wxListHeaderWindow *m_headerWin;
|
|
|
|
wxListMainWindow *m_mainWin;
|
1998-08-07 15:09:04 +00:00
|
|
|
|
1999-11-26 17:35:27 +00:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListCtrl);
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // __LISTCTRLH_G__
|