1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-12-04 17:34:54 -05:00
|
|
|
// Name: wx/generic/listctrl.h
|
1998-05-20 10:01:55 -04: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 17:34:54 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __LISTCTRLH_G__
|
|
|
|
#define __LISTCTRLH_G__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1998-07-03 12:36:10 -04:00
|
|
|
#pragma interface "listctrl.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
1998-12-23 04:58:02 -05:00
|
|
|
#include "wx/generic/imaglist.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#include "wx/control.h"
|
|
|
|
#include "wx/timer.h"
|
1998-08-17 13:05:47 -04:00
|
|
|
#include "wx/textctrl.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#include "wx/dcclient.h"
|
|
|
|
#include "wx/scrolwin.h"
|
|
|
|
#include "wx/settings.h"
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
#if wxUSE_DRAG_AND_DROP
|
|
|
|
class WXDLLEXPORT wxDropTarget;
|
|
|
|
#endif
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListItem;
|
|
|
|
class WXDLLEXPORT wxListEvent;
|
|
|
|
class WXDLLEXPORT wxListCtrl;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// internal classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListHeaderData;
|
|
|
|
class WXDLLEXPORT wxListItemData;
|
|
|
|
class WXDLLEXPORT wxListLineData;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListHeaderWindow;
|
|
|
|
class WXDLLEXPORT wxListMainWindow;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListRenameTimer;
|
1999-07-25 08:59:58 -04:00
|
|
|
class WXDLLEXPORT wxListTextCtrl;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListItemData (internal)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListItemData : public wxObject
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-08-16 08:18:40 -04:00
|
|
|
public:
|
1998-05-20 10:01:55 -04:00
|
|
|
wxString m_text;
|
|
|
|
int m_image;
|
|
|
|
long m_data;
|
|
|
|
int m_xpos,m_ypos;
|
|
|
|
int m_width,m_height;
|
1999-12-06 05:43:35 -05:00
|
|
|
|
|
|
|
wxListItemAttr *m_attr;
|
1998-08-07 11:09:04 -04:00
|
|
|
|
1999-08-16 08:18:40 -04:00
|
|
|
public:
|
|
|
|
wxListItemData();
|
1999-12-06 05:43:35 -05:00
|
|
|
~wxListItemData() { delete m_attr; }
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
wxListItemData( const wxListItem &info );
|
|
|
|
void SetItem( const wxListItem &info );
|
|
|
|
void SetText( const wxString &s );
|
1998-07-04 11:17:59 -04:00
|
|
|
void SetImage( int image );
|
|
|
|
void SetData( long data );
|
|
|
|
void SetPosition( int x, int y );
|
|
|
|
void SetSize( int width, int height );
|
1999-08-16 08:18:40 -04:00
|
|
|
bool HasImage() const;
|
|
|
|
bool HasText() const;
|
1998-07-04 11:17:59 -04:00
|
|
|
bool IsHit( int x, int y ) const;
|
1998-05-20 10:01:55 -04:00
|
|
|
void GetText( wxString &s );
|
1999-12-06 05:43:35 -05:00
|
|
|
const wxString& GetText() { return m_text; }
|
1998-05-20 10:01:55 -04:00
|
|
|
int GetX( void ) const;
|
|
|
|
int GetY( void ) const;
|
1999-08-16 08:18:40 -04:00
|
|
|
int GetWidth() const;
|
|
|
|
int GetHeight() const;
|
|
|
|
int GetImage() const;
|
1999-12-06 05:43:35 -05:00
|
|
|
void GetItem( wxListItem &info ) const;
|
|
|
|
|
|
|
|
wxListItemAttr *GetAttributes() const { return m_attr; }
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1999-08-16 08:18:40 -04:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListItemData);
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListHeaderData (internal)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListHeaderData : public wxObject
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-11-26 12:35:27 -05:00
|
|
|
protected:
|
1998-05-20 10:01:55 -04:00
|
|
|
long m_mask;
|
|
|
|
int m_image;
|
|
|
|
wxString m_text;
|
|
|
|
int m_format;
|
|
|
|
int m_width;
|
|
|
|
int m_xpos,m_ypos;
|
|
|
|
int m_height;
|
1998-08-07 11:09:04 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
public:
|
1999-08-16 08:18:40 -04:00
|
|
|
wxListHeaderData();
|
1998-05-20 10:01:55 -04:00
|
|
|
wxListHeaderData( const wxListItem &info );
|
|
|
|
void SetItem( const wxListItem &item );
|
1998-07-04 11:17:59 -04:00
|
|
|
void SetPosition( int x, int y );
|
|
|
|
void SetWidth( int w );
|
|
|
|
void SetFormat( int format );
|
|
|
|
void SetHeight( int h );
|
1999-08-16 08:18:40 -04:00
|
|
|
bool HasImage() const;
|
|
|
|
bool HasText() const;
|
1998-07-04 11:17:59 -04:00
|
|
|
bool IsHit( int x, int y ) const;
|
1998-05-20 10:01:55 -04:00
|
|
|
void GetItem( wxListItem &item );
|
|
|
|
void GetText( wxString &s );
|
1999-08-16 08:18:40 -04:00
|
|
|
int GetImage() const;
|
|
|
|
int GetWidth() const;
|
|
|
|
int GetFormat() const;
|
1999-11-26 12:35:27 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListHeaderData);
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListLineData (internal)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListLineData : public wxObject
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-11-26 12:35:27 -05:00
|
|
|
public:
|
1998-05-20 10:01:55 -04:00
|
|
|
wxList m_items;
|
1999-08-16 08:18:40 -04:00
|
|
|
wxRect m_bound_all;
|
|
|
|
wxRect m_bound_label;
|
|
|
|
wxRect m_bound_icon;
|
|
|
|
wxRect m_bound_hilight;
|
1998-05-20 10:01:55 -04:00
|
|
|
int m_mode;
|
|
|
|
bool m_hilighted;
|
|
|
|
wxBrush *m_hilightBrush;
|
|
|
|
int m_spacing;
|
|
|
|
wxListMainWindow *m_owner;
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
void DoDraw( wxDC *dc, bool hilight, bool paintBG );
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
public:
|
|
|
|
wxListLineData() {}
|
1998-07-04 11:17:59 -04:00
|
|
|
wxListLineData( wxListMainWindow *owner, int mode, wxBrush *hilightBrush );
|
1998-12-20 18:49:21 -05:00
|
|
|
void CalculateSize( wxDC *dc, int spacing );
|
|
|
|
void SetPosition( wxDC *dc, int x, int y, int window_width );
|
1998-07-04 11:17:59 -04:00
|
|
|
void SetColumnPosition( int index, int x );
|
1998-05-20 10:01:55 -04:00
|
|
|
void GetSize( int &width, int &height );
|
|
|
|
void GetExtent( int &x, int &y, int &width, int &height );
|
|
|
|
void GetLabelExtent( int &x, int &y, int &width, int &height );
|
1998-07-04 11:17:59 -04:00
|
|
|
long IsHit( int x, int y );
|
|
|
|
void InitItems( int num );
|
|
|
|
void SetItem( int index, const wxListItem &info );
|
|
|
|
void GetItem( int index, wxListItem &info );
|
|
|
|
void GetText( int index, wxString &s );
|
|
|
|
void SetText( int index, const wxString s );
|
|
|
|
int GetImage( int index );
|
1999-01-31 08:58:17 -05:00
|
|
|
void GetRect( wxRect &rect );
|
1998-07-04 11:17:59 -04:00
|
|
|
void Hilight( bool on );
|
1999-08-16 08:18:40 -04:00
|
|
|
void ReverseHilight();
|
1998-12-20 18:49:21 -05:00
|
|
|
void DrawRubberBand( wxDC *dc, bool on );
|
|
|
|
void Draw( wxDC *dc );
|
1999-01-31 08:58:17 -05:00
|
|
|
bool IsInRect( int x, int y, const wxRect &rect );
|
1999-08-16 08:18:40 -04:00
|
|
|
bool IsHilighted();
|
1999-01-31 08:58:17 -05:00
|
|
|
void AssignRect( wxRect &dest, int x, int y, int width, int height );
|
|
|
|
void AssignRect( wxRect &dest, const wxRect &source );
|
1999-11-26 12:35:27 -05:00
|
|
|
|
|
|
|
private:
|
1999-12-06 05:43:35 -05:00
|
|
|
void SetAttributes(wxDC *dc,
|
|
|
|
const wxListItemAttr *attr,
|
1999-12-07 09:15:23 -05:00
|
|
|
const wxColour& colText, const wxFont& font,
|
|
|
|
bool hilight);
|
1999-12-06 05:43:35 -05:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxListLineData);
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListHeaderWindow (internal)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListHeaderWindow : public wxWindow
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-11-26 12:35:27 -05:00
|
|
|
protected:
|
1998-05-20 10:01:55 -04:00
|
|
|
wxListMainWindow *m_owner;
|
|
|
|
wxCursor *m_currentCursor;
|
|
|
|
wxCursor *m_resizeCursor;
|
1999-05-24 19:53:12 -04:00
|
|
|
bool m_isDragging;
|
1998-10-30 04:17:24 -05:00
|
|
|
int m_column;
|
|
|
|
int m_minX;
|
|
|
|
int m_currentX;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
public:
|
1999-08-16 08:18:40 -04:00
|
|
|
wxListHeaderWindow();
|
|
|
|
~wxListHeaderWindow();
|
1998-08-07 11:09:04 -04:00
|
|
|
wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
|
1998-07-04 11:17:59 -04:00
|
|
|
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
|
|
|
long style = 0, const wxString &name = "columntitles" );
|
1998-12-20 18:49:21 -05:00
|
|
|
void DoDrawRect( wxDC *dc, int x, int y, int w, int h );
|
1998-05-20 10:01:55 -04:00
|
|
|
void OnPaint( wxPaintEvent &event );
|
1998-10-30 04:17:24 -05:00
|
|
|
void DrawCurrent();
|
1998-05-20 10:01:55 -04:00
|
|
|
void OnMouse( wxMouseEvent &event );
|
|
|
|
void OnSetFocus( wxFocusEvent &event );
|
1998-08-07 11:09:04 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListRenameTimer (internal)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListRenameTimer: public wxTimer
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-11-26 12:35:27 -05:00
|
|
|
private:
|
|
|
|
wxListMainWindow *m_owner;
|
1998-08-07 11:09:04 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
public:
|
|
|
|
wxListRenameTimer( wxListMainWindow *owner );
|
|
|
|
void Notify();
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListTextCtrl (internal)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListTextCtrl: public wxTextCtrl
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-11-26 12:35:27 -05:00
|
|
|
private:
|
1998-05-20 10:01:55 -04:00
|
|
|
bool *m_accept;
|
|
|
|
wxString *m_res;
|
|
|
|
wxListMainWindow *m_owner;
|
1999-07-26 12:06:20 -04:00
|
|
|
wxString m_startValue;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
public:
|
|
|
|
wxListTextCtrl() {}
|
1999-11-08 00:18:15 -05:00
|
|
|
wxListTextCtrl( wxWindow *parent, const wxWindowID id,
|
1998-08-17 13:05:47 -04:00
|
|
|
bool *accept, wxString *res, wxListMainWindow *owner,
|
|
|
|
const wxString &value = "",
|
|
|
|
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
1999-12-06 05:43:35 -05:00
|
|
|
int style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
1998-08-17 13:05:47 -04:00
|
|
|
const wxString &name = "wxListTextCtrlText" );
|
|
|
|
void OnChar( wxKeyEvent &event );
|
|
|
|
void OnKillFocus( wxFocusEvent &event );
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListMainWindow (internal)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListMainWindow: public wxScrolledWindow
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-11-26 12:35:27 -05:00
|
|
|
public:
|
1998-05-20 10:01:55 -04:00
|
|
|
long m_mode;
|
|
|
|
wxList m_lines;
|
1998-08-07 11:09:04 -04:00
|
|
|
wxList m_columns;
|
1998-05-20 10:01:55 -04:00
|
|
|
wxListLineData *m_current;
|
1999-07-25 08:59:58 -04:00
|
|
|
wxListLineData *m_currentEdit;
|
1998-05-20 10:01:55 -04:00
|
|
|
int m_visibleLines;
|
|
|
|
wxBrush *m_hilightBrush;
|
|
|
|
wxColour *m_hilightColour;
|
|
|
|
int m_xScroll,m_yScroll;
|
|
|
|
bool m_dirty;
|
|
|
|
wxImageList *m_small_image_list;
|
|
|
|
wxImageList *m_normal_image_list;
|
|
|
|
int m_small_spacing;
|
|
|
|
int m_normal_spacing;
|
|
|
|
bool m_hasFocus;
|
|
|
|
bool m_usedKeys;
|
|
|
|
bool m_lastOnSame;
|
|
|
|
wxTimer *m_renameTimer;
|
|
|
|
bool m_renameAccept;
|
|
|
|
wxString m_renameRes;
|
|
|
|
bool m_isCreated;
|
1998-07-27 16:50:48 -04:00
|
|
|
int m_dragCount;
|
1999-08-16 08:18:40 -04:00
|
|
|
wxPoint m_dragStart;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
public:
|
1999-07-25 08:59:58 -04:00
|
|
|
wxListMainWindow();
|
1998-08-07 11:09:04 -04:00
|
|
|
wxListMainWindow( wxWindow *parent, wxWindowID id,
|
1998-07-04 11:17:59 -04:00
|
|
|
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
|
|
|
long style = 0, const wxString &name = "listctrl" );
|
1999-07-25 08:59:58 -04:00
|
|
|
~wxListMainWindow();
|
1998-05-20 10:01:55 -04:00
|
|
|
void RefreshLine( wxListLineData *line );
|
|
|
|
void OnPaint( wxPaintEvent &event );
|
1998-07-04 11:17:59 -04:00
|
|
|
void HilightAll( bool on );
|
1998-06-26 16:19:48 -04:00
|
|
|
void SendNotify( wxListLineData *line, wxEventType command );
|
1998-05-20 10:01:55 -04:00
|
|
|
void FocusLine( wxListLineData *line );
|
|
|
|
void UnfocusLine( wxListLineData *line );
|
|
|
|
void SelectLine( wxListLineData *line );
|
|
|
|
void DeselectLine( wxListLineData *line );
|
|
|
|
void DeleteLine( wxListLineData *line );
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1999-07-26 12:06:20 -04:00
|
|
|
void EditLabel( long item );
|
|
|
|
void Edit( long item ) { EditLabel(item); } // deprecated
|
1999-07-25 08:59:58 -04:00
|
|
|
void OnRenameTimer();
|
|
|
|
void OnRenameAccept();
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
void OnMouse( wxMouseEvent &event );
|
1999-07-25 08:59:58 -04:00
|
|
|
void MoveToFocus();
|
1998-05-20 10:01:55 -04:00
|
|
|
void OnArrowChar( wxListLineData *newCurrent, bool shiftDown );
|
|
|
|
void OnChar( wxKeyEvent &event );
|
1999-05-19 06:46:48 -04:00
|
|
|
void OnKeyDown( wxKeyEvent &event );
|
1998-05-20 10:01:55 -04:00
|
|
|
void OnSetFocus( wxFocusEvent &event );
|
|
|
|
void OnKillFocus( wxFocusEvent &event );
|
|
|
|
void OnSize( wxSizeEvent &event );
|
1999-12-06 05:43:35 -05:00
|
|
|
void OnScroll(wxScrollWinEvent& event) ;
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
void DrawImage( int index, wxDC *dc, int x, int y );
|
1998-05-20 10:01:55 -04:00
|
|
|
void GetImageSize( int index, int &width, int &height );
|
|
|
|
int GetIndexOfLine( const wxListLineData *line );
|
|
|
|
int GetTextLength( wxString &s ); // should be const
|
|
|
|
|
1998-07-04 11:17:59 -04:00
|
|
|
void SetImageList( wxImageList *imageList, int which );
|
|
|
|
void SetItemSpacing( int spacing, bool isSmall = FALSE );
|
|
|
|
int GetItemSpacing( bool isSmall = FALSE );
|
|
|
|
void SetColumn( int col, wxListItem &item );
|
|
|
|
void SetColumnWidth( int col, int width );
|
|
|
|
void GetColumn( int col, wxListItem &item );
|
|
|
|
int GetColumnWidth( int vol );
|
1999-07-25 08:59:58 -04:00
|
|
|
int GetColumnCount();
|
|
|
|
int GetCountPerPage();
|
1998-05-20 10:01:55 -04:00
|
|
|
void SetItem( wxListItem &item );
|
|
|
|
void GetItem( wxListItem &item );
|
1998-08-07 11:09:04 -04:00
|
|
|
void SetItemState( long item, long state, long stateMask );
|
1998-07-04 11:17:59 -04:00
|
|
|
int GetItemState( long item, long stateMask );
|
1999-07-25 08:59:58 -04:00
|
|
|
int GetItemCount();
|
1999-01-31 08:58:17 -05:00
|
|
|
void GetItemRect( long index, wxRect &rect );
|
1999-07-25 08:59:58 -04:00
|
|
|
bool GetItemPosition( long item, wxPoint& pos );
|
|
|
|
int GetSelectedItemCount();
|
1998-07-04 11:17:59 -04:00
|
|
|
void SetMode( long mode );
|
1999-07-25 08:59:58 -04:00
|
|
|
long GetMode() const;
|
|
|
|
void CalculatePositions();
|
|
|
|
void RealizeChanges();
|
1998-07-04 11:17:59 -04:00
|
|
|
long GetNextItem( long item, int geometry, int state );
|
|
|
|
void DeleteItem( long index );
|
1999-07-25 08:59:58 -04:00
|
|
|
void DeleteAllItems();
|
1998-07-04 11:17:59 -04:00
|
|
|
void DeleteColumn( int col );
|
1999-07-25 08:59:58 -04:00
|
|
|
void DeleteEverything();
|
1998-07-04 11:17:59 -04:00
|
|
|
void EnsureVisible( long index );
|
1999-07-25 08:59:58 -04:00
|
|
|
long FindItem( long start, const wxString& str, bool partial = FALSE );
|
|
|
|
long FindItem( long start, long data);
|
1998-07-04 11:17:59 -04:00
|
|
|
long HitTest( int x, int y, int &flags );
|
1998-05-20 10:01:55 -04:00
|
|
|
void InsertItem( wxListItem &item );
|
1998-08-09 09:06:25 -04:00
|
|
|
// void AddItem( wxListItem &item );
|
1998-07-04 11:17:59 -04:00
|
|
|
void InsertColumn( long col, wxListItem &item );
|
1998-08-09 09:06:25 -04:00
|
|
|
// void AddColumn( wxListItem &item );
|
1998-05-20 10:01:55 -04:00
|
|
|
void SortItems( wxListCtrlCompare fn, long data );
|
1998-08-07 11:09:04 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListMainWindow);
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxListCtrl
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
class WXDLLEXPORT wxListCtrl: public wxControl
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-11-26 12:35:27 -05:00
|
|
|
public:
|
1999-07-25 08:59:58 -04:00
|
|
|
wxListCtrl();
|
2000-01-06 11:47:48 -05: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 16:25:36 -04:00
|
|
|
{
|
1999-11-26 12:35:27 -05:00
|
|
|
Create(parent, id, pos, size, style, validator, name);
|
1998-10-24 16:25:36 -04:00
|
|
|
}
|
1999-07-25 08:59:58 -04:00
|
|
|
~wxListCtrl();
|
1999-11-26 12:35:27 -05:00
|
|
|
|
2000-01-06 11:47:48 -05: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 12:35:27 -05:00
|
|
|
|
1998-12-07 08:28:56 -05:00
|
|
|
bool GetColumn( int col, wxListItem& item ) const;
|
1998-07-04 11:17:59 -04:00
|
|
|
bool SetColumn( int col, wxListItem& item );
|
1998-12-07 08:28:56 -05:00
|
|
|
int GetColumnWidth( int col ) const;
|
1998-07-04 11:17:59 -04:00
|
|
|
bool SetColumnWidth( int col, int width);
|
1999-07-25 08:59:58 -04:00
|
|
|
int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think
|
1999-11-26 12:35:27 -05:00
|
|
|
|
1998-12-07 08:28:56 -05:00
|
|
|
bool GetItem( wxListItem& info ) const;
|
1998-05-20 10:01:55 -04:00
|
|
|
bool SetItem( wxListItem& info ) ;
|
1998-07-04 11:17:59 -04:00
|
|
|
long SetItem( long index, int col, const wxString& label, int imageId = -1 );
|
1998-12-07 08:28:56 -05:00
|
|
|
int GetItemState( long item, long stateMask ) const;
|
1998-07-04 11:17:59 -04:00
|
|
|
bool SetItemState( long item, long state, long stateMask);
|
|
|
|
bool SetItemImage( long item, int image, int selImage);
|
1998-12-07 08:28:56 -05:00
|
|
|
wxString GetItemText( long item ) const;
|
1998-07-04 11:17:59 -04:00
|
|
|
void SetItemText( long item, const wxString& str );
|
1998-12-07 08:28:56 -05:00
|
|
|
long GetItemData( long item ) const;
|
1998-07-04 11:17:59 -04:00
|
|
|
bool SetItemData( long item, long data );
|
1999-01-31 08:58:17 -05:00
|
|
|
bool GetItemRect( long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const;
|
1998-12-07 08:28:56 -05:00
|
|
|
bool GetItemPosition( long item, wxPoint& pos ) const;
|
1998-07-04 11:17:59 -04:00
|
|
|
bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
|
1999-07-25 08:59:58 -04:00
|
|
|
int GetItemCount() const;
|
|
|
|
int GetColumnCount() const;
|
1998-07-13 19:30:59 -04:00
|
|
|
void SetItemSpacing( int spacing, bool isSmall = FALSE );
|
1998-12-07 08:28:56 -05:00
|
|
|
int GetItemSpacing( bool isSmall ) const;
|
1999-07-25 08:59:58 -04:00
|
|
|
int GetSelectedItemCount() const;
|
1999-12-06 05:43:35 -05:00
|
|
|
wxColour GetTextColour() const;
|
|
|
|
void SetTextColour(const wxColour& col);
|
1999-07-25 08:59:58 -04:00
|
|
|
long GetTopItem() const;
|
1999-11-26 12:35:27 -05:00
|
|
|
|
1998-07-04 11:17:59 -04:00
|
|
|
void SetSingleStyle( long style, bool add = TRUE ) ;
|
1999-07-25 08:59:58 -04: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 11:17:59 -04:00
|
|
|
bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1998-12-17 09:07:46 -05:00
|
|
|
void ClearAll();
|
1998-07-04 11:17:59 -04:00
|
|
|
bool DeleteItem( long item );
|
1999-07-25 08:59:58 -04:00
|
|
|
bool DeleteAllItems();
|
|
|
|
bool DeleteAllColumns();
|
1998-07-04 11:17:59 -04:00
|
|
|
bool DeleteColumn( int col );
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1999-07-25 08:59:58 -04:00
|
|
|
void EditLabel( long item ) { Edit(item); }
|
|
|
|
void Edit( long item );
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1998-07-04 11:17:59 -04:00
|
|
|
bool EnsureVisible( long item );
|
1999-07-25 08:59:58 -04: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 10:01:55 -04:00
|
|
|
long InsertItem(wxListItem& info);
|
1999-07-25 08:59:58 -04: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 12:35:27 -05:00
|
|
|
|
1998-08-17 16:07:50 -04:00
|
|
|
void OnIdle( wxIdleEvent &event );
|
1999-11-26 12:35:27 -05:00
|
|
|
void OnSize( wxSizeEvent &event );
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1998-08-17 16:07:50 -04:00
|
|
|
// We have to hand down a few functions
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1999-05-09 18:17:03 -04:00
|
|
|
bool SetBackgroundColour( const wxColour &colour );
|
|
|
|
bool SetForegroundColour( const wxColour &colour );
|
|
|
|
bool SetFont( const wxFont &font );
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1998-12-20 18:49:21 -05:00
|
|
|
#if wxUSE_DRAG_AND_DROP
|
1998-05-20 10:01:55 -04:00
|
|
|
void SetDropTarget( wxDropTarget *dropTarget )
|
1998-08-17 16:07:50 -04:00
|
|
|
{ m_mainWin->SetDropTarget( dropTarget ); }
|
1998-05-20 10:01:55 -04:00
|
|
|
wxDropTarget *GetDropTarget() const
|
1998-08-17 16:07:50 -04:00
|
|
|
{ return m_mainWin->GetDropTarget(); }
|
1998-12-20 18:49:21 -05:00
|
|
|
#endif
|
|
|
|
|
1999-05-09 18:17:03 -04:00
|
|
|
bool SetCursor( const wxCursor &cursor )
|
|
|
|
{ return m_mainWin ? m_mainWin->wxWindow::SetCursor(cursor) : FALSE; }
|
1998-08-17 16:07:50 -04:00
|
|
|
wxColour GetBackgroundColour() const
|
1999-05-09 18:17:03 -04:00
|
|
|
{ return m_mainWin ? m_mainWin->GetBackgroundColour() : wxColour(); }
|
1998-08-17 16:07:50 -04:00
|
|
|
wxColour GetForegroundColour() const
|
1999-05-09 18:17:03 -04:00
|
|
|
{ return m_mainWin ? m_mainWin->GetForegroundColour() : wxColour(); }
|
1999-07-20 19:22:30 -04:00
|
|
|
bool DoPopupMenu( wxMenu *menu, int x, int y )
|
1998-08-18 10:59:26 -04:00
|
|
|
{ return m_mainWin->PopupMenu( menu, x, y ); }
|
1998-12-17 03:40:34 -05:00
|
|
|
void SetFocus()
|
1999-11-26 12:35:27 -05:00
|
|
|
{
|
1999-11-24 10:11:29 -05:00
|
|
|
/* The test in window.cpp fails as we are a composite
|
|
|
|
window, so it checks against "this", but not m_mainWin. */
|
1999-11-26 12:35:27 -05:00
|
|
|
if (FindFocus() != this)
|
|
|
|
m_mainWin->SetFocus();
|
|
|
|
}
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
// implementation
|
|
|
|
// --------------
|
1999-11-08 00:18:15 -05:00
|
|
|
|
1998-08-07 11:09:04 -04:00
|
|
|
wxImageList *m_imageListNormal;
|
|
|
|
wxImageList *m_imageListSmall;
|
1998-05-20 10:01:55 -04:00
|
|
|
wxImageList *m_imageListState; // what's that ?
|
|
|
|
wxListHeaderWindow *m_headerWin;
|
|
|
|
wxListMainWindow *m_mainWin;
|
1998-08-07 11:09:04 -04:00
|
|
|
|
1999-11-26 12:35:27 -05:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListCtrl);
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // __LISTCTRLH_G__
|