-private:
- wxListMainWindow *m_owner;
-
-public:
- wxListRenameTimer( wxListMainWindow *owner );
- void Notify();
-};
-
-//-----------------------------------------------------------------------------
-// wxListTextCtrl (internal)
-//-----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxListTextCtrl: public wxTextCtrl
-{
-private:
- bool *m_accept;
- wxString *m_res;
- wxListMainWindow *m_owner;
- wxString m_startValue;
-
-public:
- wxListTextCtrl() {}
- wxListTextCtrl( wxWindow *parent, const wxWindowID id,
- bool *accept, wxString *res, wxListMainWindow *owner,
- const wxString &value = "",
- const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
- int style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString &name = "listctrltextctrl" );
- void OnChar( wxKeyEvent &event );
- void OnKeyUp( wxKeyEvent &event );
- void OnKillFocus( wxFocusEvent &event );
-
-private:
- DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
- DECLARE_EVENT_TABLE()
-};
-
-//-----------------------------------------------------------------------------
-// wxListMainWindow (internal)
-//-----------------------------------------------------------------------------
-
-WX_DECLARE_LIST(wxListHeaderData, wxListHeaderDataList);
-#include "wx/listimpl.cpp"
-WX_DEFINE_LIST(wxListHeaderDataList);
-
-class WXDLLEXPORT wxListMainWindow: public wxScrolledWindow
-{
-public:
- // the style of the control (combination of wxLC_XXX)
- long m_mode;
-
- // the array of all line objects for a non virtual list control
- wxListLineDataArray m_lines;
-
- // the total count of items in a virtual list control
- long m_countVirt;
-
- // the list of column objects
- wxListHeaderDataList m_columns;
-
- // currently focused item or NULL
- wxListLineData *m_current;
-
- // the item currently being edited or -1
- size_t m_currentEdit;
-
- 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;
- int m_dragCount;
- wxPoint m_dragStart;
-
- // for double click logic
- size_t m_lineLastClicked,
- m_lineBeforeLastClicked;
-
-public:
- wxListMainWindow();
- wxListMainWindow( wxWindow *parent,
- wxWindowID id,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString &name = _T("listctrlmainwindow") );
-
- virtual ~wxListMainWindow();
-
- // return true if this is a virtual list control
- bool IsVirtual() const { return (m_mode & wxLC_VIRTUAL) != 0; }
-
- void RefreshLine( wxListLineData *line );
- void OnPaint( wxPaintEvent &event );
- void HilightAll( bool on );
- void SendNotify( wxListLineData *line,
- wxEventType command,
- wxPoint point = wxDefaultPosition );
- void FocusLine( wxListLineData *line );
- void UnfocusLine( wxListLineData *line );
- void SelectLine( wxListLineData *line );
- void DeselectLine( wxListLineData *line );
- void DeleteLine( wxListLineData *line );
-
- void EditLabel( long item );
- void Edit( long item ) { EditLabel(item); } // deprecated
- void OnRenameTimer();
- void OnRenameAccept();
-
- void OnMouse( wxMouseEvent &event );
- void MoveToFocus();
- void OnArrowChar( wxListLineData *newCurrent, bool shiftDown );
- void OnChar( wxKeyEvent &event );
- void OnKeyDown( wxKeyEvent &event );
- void OnSetFocus( wxFocusEvent &event );
- void OnKillFocus( wxFocusEvent &event );
- void OnSize( wxSizeEvent &event );
- void OnScroll(wxScrollWinEvent& event) ;
-
- void DrawImage( int index, wxDC *dc, int x, int y );
- void GetImageSize( int index, int &width, int &height );
- int GetIndexOfLine( const wxListLineData *line );
- int GetTextLength( wxString &s ); // should be const
-
- 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 );
- int GetColumnCount();
- int GetCountPerPage();
- void SetItem( wxListItem &item );
- void GetItem( wxListItem &item );
- void SetItemState( long item, long state, long stateMask );
- int GetItemState( long item, long stateMask );
- void GetItemRect( long index, wxRect &rect );
- bool GetItemPosition( long item, wxPoint& pos );
- int GetSelectedItemCount();
- void SetMode( long mode );
- long GetMode() const;
- void CalculatePositions();
- void RealizeChanges();
- long GetNextItem( long item, int geometry, int state );
- void DeleteItem( long index );
- void DeleteAllItems();
- void DeleteColumn( int col );
- void DeleteEverything();
- void EnsureVisible( long index );
- long FindItem( long start, const wxString& str, bool partial = FALSE );
- long FindItem( long start, long data);
- long HitTest( int x, int y, int &flags );
- void InsertItem( wxListItem &item );
-// void AddItem( wxListItem &item );
- void InsertColumn( long col, wxListItem &item );
-// void AddColumn( wxListItem &item );
- void SortItems( wxListCtrlCompare fn, long data );
-
- int GetItemCount() const;
- bool IsEmpty() const { return GetItemCount() == 0; }
- void SetItemCount(long count);
-
-protected:
- // common part of all ctors
- void Init();
-
- // get the line data for the given index
- wxListLineData *GetLine(size_t n) const
- {
- wxASSERT_MSG( n != (size_t)-1, _T("invalid line index") );
-
- return &m_lines[n];
- }
-
-private:
- DECLARE_DYNAMIC_CLASS(wxListMainWindow);
- DECLARE_EVENT_TABLE()
-};
-
-// ============================================================================
-// implementation
-// ============================================================================