-// Flag values for Set/GetImageList
-enum {
- wxIMAGE_LIST_NORMAL, // Normal icons
- wxIMAGE_LIST_SMALL, // Small icons
- wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation)
- // not implemented in wxGLC (see non-existing documentation..)
-};
-
-//-----------------------------------------------------------------------------
-// wxListItem
-//-----------------------------------------------------------------------------
-
-class wxListItem: public wxObject
-{
- DECLARE_DYNAMIC_CLASS(wxListItem)
-
- public:
- long m_mask; // Indicates what fields are valid
- long m_itemId; // The zero-based item position
- int m_col; // Zero-based column, if in report mode
- long m_state; // The state of the item
- long m_stateMask; // Which flags of m_state are valid (uses same flags)
- wxString m_text; // The label/header text
- int m_image; // The zero-based index into an image list
- long m_data; // App-defined data
- wxColour *m_colour; // only wxGLC, not supported by Windows ;->
-
- // For columns only
- int m_format; // left, right, centre
- int m_width; // width of column
-
- wxListItem(void);
-};
-
-//-----------------------------------------------------------------------------
-// wxListEvent
-//-----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxListEvent: public wxCommandEvent
-{
- DECLARE_DYNAMIC_CLASS(wxListEvent)
-
- public:
- wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
-
- int m_code;
- long m_itemIndex;
- long m_oldItemIndex;
- int m_col;
- bool m_cancelled;
- wxPoint m_pointDrag;
-
- wxListItem m_item;
-};
-
-typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
-
-#define EVT_LIST_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_DELETE_ITEM(id, fn) { wxEVT_COMMAND_LIST_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) { wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_GET_INFO(id, fn) { wxEVT_COMMAND_LIST_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_SET_INFO(id, fn) { wxEVT_COMMAND_LIST_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_ITEM_SELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_ITEM_DESELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_DESELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-#define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
-
-
-//-----------------------------------------------------------------------------
-// wxListItemData (internal)
-//-----------------------------------------------------------------------------
-
-class wxListItemData : public wxObject
-{
- DECLARE_DYNAMIC_CLASS(wxListItemData);
-
- protected:
- wxString m_text;
- int m_image;
- long m_data;
- int m_xpos,m_ypos;
- int m_width,m_height;
- wxColour *m_colour;
-
- public:
- wxListItemData(void);
- wxListItemData( const wxListItem &info );
- void SetItem( const wxListItem &info );
- void SetText( const wxString &s );
- void SetImage( int image );
- void SetData( long data );
- void SetPosition( int x, int y );
- void SetSize( int width, int height );
- void SetColour( wxColour *col );
- bool HasImage(void) const;
- bool HasText(void) const;
- bool IsHit( int x, int y ) const;
- void GetText( wxString &s );
- int GetX( void ) const;
- int GetY( void ) const;
- int GetWidth(void) const;
- int GetHeight(void) const;
- int GetImage(void) const;
- void GetItem( wxListItem &info );
- wxColour *GetColour(void);
-};
-
-//-----------------------------------------------------------------------------
-// wxListHeaderData (internal)
-//-----------------------------------------------------------------------------
-
-class wxListHeaderData : public wxObject
-{
- DECLARE_DYNAMIC_CLASS(wxListHeaderData);
-
- protected:
- long m_mask;
- int m_image;
- wxString m_text;
- int m_format;
- int m_width;
- int m_xpos,m_ypos;
- int m_height;
-
- public:
- wxListHeaderData(void);
- wxListHeaderData( const wxListItem &info );
- void SetItem( const wxListItem &item );
- void SetPosition( int x, int y );
- void SetWidth( int w );
- void SetFormat( int format );
- void SetHeight( int h );
- bool HasImage(void) const;
- bool HasText(void) const;
- bool IsHit( int x, int y ) const;
- void GetItem( wxListItem &item );
- void GetText( wxString &s );
- int GetImage(void) const;
- int GetWidth(void) const;
- int GetFormat(void) const;
-};
-
-//-----------------------------------------------------------------------------
-// wxListLineData (internal)
-//-----------------------------------------------------------------------------
-
-class wxListLineData : public wxObject
-{
- DECLARE_DYNAMIC_CLASS(wxListLineData);
-
- protected:
- wxList m_items;
- wxRectangle m_bound_all;
- wxRectangle m_bound_label;
- wxRectangle m_bound_icon;
- wxRectangle m_bound_hilight;
- int m_mode;
- bool m_hilighted;
- wxBrush *m_hilightBrush;
- int m_spacing;
- wxListMainWindow *m_owner;
-
- void DoDraw( wxPaintDC *dc, bool hilight, bool paintBG );
-
- public:
- wxListLineData( void ) {};
- wxListLineData( wxListMainWindow *owner, int mode, wxBrush *hilightBrush );
- void CalculateSize( wxPaintDC *dc, int spacing );
- void SetPosition( wxPaintDC *dc, int x, int y, int window_width );
- void SetColumnPosition( int index, int x );
- 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 );
- 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 );
- void GetRect( wxRectangle &rect );
- void Hilight( bool on );
- void ReverseHilight( void );
- void DrawRubberBand( wxPaintDC *dc, bool on );
- void Draw( wxPaintDC *dc );
- bool IsInRect( int x, int y, const wxRectangle &rect );
- bool IsHilighted( void );
- void AssignRect( wxRectangle &dest, int x, int y, int width, int height );
- void AssignRect( wxRectangle &dest, const wxRectangle &source );
-};
-
-//-----------------------------------------------------------------------------
-// wxListHeaderWindow (internal)
-//-----------------------------------------------------------------------------
-
-class wxListHeaderWindow : public wxWindow
-{
- DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
-
- protected:
- wxListMainWindow *m_owner;
- wxCursor *m_currentCursor;
- wxCursor *m_resizeCursor;
-
- public:
- wxListHeaderWindow( void );
- wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
- const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
- long style = 0, const wxString &name = "columntitles" );
- void DoDrawRect( wxPaintDC *dc, int x, int y, int w, int h );
- void OnPaint( wxPaintEvent &event );
- void OnMouse( wxMouseEvent &event );
- void OnSetFocus( wxFocusEvent &event );
-
- DECLARE_EVENT_TABLE()
-};
-
-//-----------------------------------------------------------------------------
-// wxListRenameTimer (internal)
-//-----------------------------------------------------------------------------
-
-class wxListRenameTimer: public wxTimer
-{
- private:
- wxListMainWindow *m_owner;
-
- public:
- wxListRenameTimer( wxListMainWindow *owner );
- void Notify();
-};
-
-/*
-
-//-----------------------------------------------------------------------------
-// wxListTextCtrl (internal)
-//-----------------------------------------------------------------------------
-
-class wxListTextCtrl: public wxTextCtrl
-{
- DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
-
- private:
- bool *m_accept;
- wxString *m_res;
- wxListMainWindow *m_owner;
-
- public:
- wxListTextCtrl(void) : wxTextCtrl() {};
- wxListTextCtrl( wxWindow *parent, const char *value = "",
- bool *accept, wxString *res, wxListMainWindow *owner,
- int x = -1, int y = -1, int w = -1, int h = -1, int style = 0, char *name = "rawtext" ) :
- wxTextCtrl( parent, value, x, y, w, h, style, name )
- {
- m_res = res;
- m_accept = accept;
- m_owner = owner;
- };
- void OnChar( wxKeyEvent &event )
- {
- if (event.keyCode == WXK_RETURN)
- {
- (*m_accept) = TRUE;
- (*m_res) = GetValue();
- m_owner->OnRenameAccept();
-// Show( FALSE );
- delete this;
- return;
- };
- if (event.keyCode == WXK_ESCAPE)
- {
- (*m_accept) = FALSE;
- (*m_res) = "";
-// Show( FALSE );
- delete this;
- return;
- };
- };
- void OnKillFocus(void)
- {
- (*m_accept) = FALSE;
- (*m_res) = "";
-// Show( FALSE );
- delete this;
- return;
- };
-};
-
-*/
-
-//-----------------------------------------------------------------------------
-// wxListMainWindow (internal)
-//-----------------------------------------------------------------------------
-
-class wxListMainWindow: public wxScrolledWindow
-{
- DECLARE_DYNAMIC_CLASS(wxListMainWindow);
-
- public:
- long m_mode;
- wxList m_lines;
- wxList m_columns;
- wxListLineData *m_current;
- int m_visibleLines;
- wxBrush *m_hilightBrush;
- wxColour *m_hilightColour;
- wxFont *m_myFont;
- 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;
-// wxListTextCtrl *m_text;
- bool m_renameAccept;
- wxString m_renameRes;
- bool m_isCreated;
- bool m_isDragging;
-
- public:
- wxListMainWindow(void);
- wxListMainWindow( wxWindow *parent, wxWindowID id,
- const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
- long style = 0, const wxString &name = "listctrl" );
- ~wxListMainWindow(void);
- void RefreshLine( wxListLineData *line );
- void OnPaint( wxPaintEvent &event );
- void HilightAll( bool on );
- void ActivateLine( wxListLineData *line );
- void SendNotify( wxListLineData *line, wxEventType command );
- void FocusLine( wxListLineData *line );
- void UnfocusLine( wxListLineData *line );
- void SelectLine( wxListLineData *line );
- void DeselectLine( wxListLineData *line );
- void DeleteLine( wxListLineData *line );
- void RenameLine( wxListLineData *line, const wxString &newName );
- void OnRenameTimer(void);
- void OnRenameAccept(void);
- void OnMouse( wxMouseEvent &event );
- void MoveToFocus( void );
- void OnArrowChar( wxListLineData *newCurrent, bool shiftDown );
- void OnChar( wxKeyEvent &event );
- void OnSetFocus( wxFocusEvent &event );
- void OnKillFocus( wxFocusEvent &event );
- void OnSize( wxSizeEvent &event );
- wxFont *GetMyFont( void );
- void DrawImage( int index, wxPaintDC *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( void );
- int GetCountPerPage( void );
- void SetItem( wxListItem &item );
- void GetItem( wxListItem &item );
- void SetItemState( long item, long state, long stateMask );
- int GetItemState( long item, long stateMask );
- int GetItemCount( void );
- void GetItemRect( long index, wxRectangle &rect );
- int GetSelectedItemCount( void );
- void SetMode( long mode );
- long GetMode( void ) const;
- void CalculatePositions( void );
- void RealizeChanges(void);
- long GetNextItem( long item, int geometry, int state );
- void DeleteItem( long index );
- void DeleteAllItems( void );
- void DeleteColumn( int col );
- void DeleteEverything( void );
- 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 InsertColumn( long col, wxListItem &item );
- void SortItems( wxListCtrlCompare fn, long data );
- virtual bool OnListNotify( wxListEvent &event );
-
- DECLARE_EVENT_TABLE()
-};