#define wxLC_AUTOARRANGE 0x0100 // not supported in wxGLC
#define wxLC_USER_TEXT 0x0200 // not supported in wxGLC (how does it work?)
#define wxLC_EDIT_LABELS 0x0400
-#define wxLC_NO_HEADER 0x0800 // not supported in wxGLC
+#define wxLC_NO_HEADER 0x0800
#define wxLC_NO_SORT_HEADER 0x1000 // not supported in wxGLC
#define wxLC_SINGLE_SEL 0x2000
#define wxLC_SORT_ASCENDING 0x4000
class WXDLLEXPORT wxListItem: public wxObject
{
- DECLARE_DYNAMIC_CLASS(wxListItem)
-
- public:
+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
int m_format; // left, right, centre
int m_width; // width of column
- wxListItem(void);
-};
-
-//-----------------------------------------------------------------------------
-// wxListEvent
-//-----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxListEvent: public wxNotifyEvent
-{
- 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;
+ wxListItem();
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxListItem)
};
-typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
-
-#define EVT_LIST_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_DELETE_ITEM(id, fn) { wxEVT_COMMAND_LIST_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) { wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_GET_INFO(id, fn) { wxEVT_COMMAND_LIST_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_SET_INFO(id, fn) { wxEVT_COMMAND_LIST_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_ITEM_SELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_ITEM_DESELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_DESELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) { wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) { wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-#define EVT_LIST_ITEM_ACTIVATED(id, fn) { wxEVT_COMMAND_LIST_ITEM_ACTIVATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
-
//-----------------------------------------------------------------------------
// wxListItemData (internal)
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxListItemData : public wxObject
{
- DECLARE_DYNAMIC_CLASS(wxListItemData);
-
- public:
+public:
wxString m_text;
int m_image;
long m_data;
int m_width,m_height;
wxColour *m_colour;
- public:
- wxListItemData(void);
+public:
+ wxListItemData();
wxListItemData( const wxListItem &info );
void SetItem( const wxListItem &info );
void SetText( const wxString &s );
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 HasImage() const;
+ bool HasText() 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;
+ int GetWidth() const;
+ int GetHeight() const;
+ int GetImage() const;
void GetItem( wxListItem &info );
- wxColour *GetColour(void);
+ wxColour *GetColour();
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxListItemData);
};
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxListHeaderData : public wxObject
{
- DECLARE_DYNAMIC_CLASS(wxListHeaderData);
-
- protected:
+protected:
long m_mask;
int m_image;
wxString m_text;
int m_xpos,m_ypos;
int m_height;
- public:
- wxListHeaderData(void);
+public:
+ wxListHeaderData();
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 HasImage() const;
+ bool HasText() 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;
+ int GetImage() const;
+ int GetWidth() const;
+ int GetFormat() const;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxListHeaderData);
};
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxListLineData : public wxObject
{
- DECLARE_DYNAMIC_CLASS(wxListLineData);
-
- public:
+public:
wxList m_items;
- wxRect m_bound_all;
- wxRect m_bound_label;
- wxRect m_bound_icon;
- wxRect m_bound_hilight;
+ wxRect m_bound_all;
+ wxRect m_bound_label;
+ wxRect m_bound_icon;
+ wxRect m_bound_hilight;
int m_mode;
bool m_hilighted;
wxBrush *m_hilightBrush;
void DoDraw( wxDC *dc, bool hilight, bool paintBG );
- public:
- wxListLineData( void ) {};
+public:
+ wxListLineData() {}
wxListLineData( wxListMainWindow *owner, int mode, wxBrush *hilightBrush );
void CalculateSize( wxDC *dc, int spacing );
void SetPosition( wxDC *dc, int x, int y, int window_width );
int GetImage( int index );
void GetRect( wxRect &rect );
void Hilight( bool on );
- void ReverseHilight( void );
+ void ReverseHilight();
void DrawRubberBand( wxDC *dc, bool on );
void Draw( wxDC *dc );
bool IsInRect( int x, int y, const wxRect &rect );
- bool IsHilighted( void );
+ bool IsHilighted();
void AssignRect( wxRect &dest, int x, int y, int width, int height );
void AssignRect( wxRect &dest, const wxRect &source );
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxListLineData);
};
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxListHeaderWindow : public wxWindow
{
- DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
-
- protected:
+protected:
wxListMainWindow *m_owner;
wxCursor *m_currentCursor;
wxCursor *m_resizeCursor;
int m_minX;
int m_currentX;
- public:
- wxListHeaderWindow( void );
- ~wxListHeaderWindow( void );
+public:
+ wxListHeaderWindow();
+ ~wxListHeaderWindow();
wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = "columntitles" );
void OnMouse( wxMouseEvent &event );
void OnSetFocus( wxFocusEvent &event );
- DECLARE_EVENT_TABLE()
+private:
+ DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
+ DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxListRenameTimer: public wxTimer
{
- private:
- wxListMainWindow *m_owner;
+private:
+ wxListMainWindow *m_owner;
- public:
- wxListRenameTimer( wxListMainWindow *owner );
- void Notify();
+public:
+ wxListRenameTimer( wxListMainWindow *owner );
+ void Notify();
};
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxListTextCtrl: public wxTextCtrl
{
- DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
-
- private:
+private:
bool *m_accept;
wxString *m_res;
wxListMainWindow *m_owner;
+ wxString m_startValue;
- public:
- wxListTextCtrl(void) {};
- wxListTextCtrl( wxWindow *parent, const wxWindowID id,
+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,
+#if wxUSE_VALIDATORS
int style = 0, const wxValidator& validator = wxDefaultValidator,
+#endif
const wxString &name = "wxListTextCtrlText" );
void OnChar( wxKeyEvent &event );
void OnKillFocus( wxFocusEvent &event );
-
- DECLARE_EVENT_TABLE()
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
+ DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxListMainWindow: public wxScrolledWindow
{
- DECLARE_DYNAMIC_CLASS(wxListMainWindow);
-
- public:
+public:
long m_mode;
wxList m_lines;
wxList m_columns;
wxString m_renameRes;
bool m_isCreated;
int m_dragCount;
+ wxPoint m_dragStart;
- public:
+public:
wxListMainWindow();
wxListMainWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
void SelectLine( wxListLineData *line );
void DeselectLine( wxListLineData *line );
void DeleteLine( wxListLineData *line );
-
- void Edit( long item );
+
+ 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 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 );
// void AddColumn( wxListItem &item );
void SortItems( wxListCtrlCompare fn, long data );
- DECLARE_EVENT_TABLE()
+private:
+ DECLARE_DYNAMIC_CLASS(wxListMainWindow);
+ DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxListCtrl: public wxControl
{
- DECLARE_DYNAMIC_CLASS(wxListCtrl);
-
- public:
+public:
wxListCtrl();
wxListCtrl( wxWindow *parent, wxWindowID id = -1,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
+#if wxUSE_VALIDATORS
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
+#endif
const wxString &name = "listctrl" )
{
- Create(parent, id, pos, size, style, validator, name);
+ Create(parent, id, pos, size, style, validator, name);
}
~wxListCtrl();
+
bool Create( wxWindow *parent, wxWindowID id = -1,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
+#if wxUSE_VALIDATORS
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
- const wxString &name = "listctrl" );
- void OnSize( wxSizeEvent &event );
+#endif
+ const wxString &name = "listctrl" );
+
bool GetColumn( int col, wxListItem& item ) const;
bool SetColumn( int col, wxListItem& item );
int GetColumnWidth( int col ) const;
bool SetColumnWidth( int col, int width);
int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think
+
bool GetItem( wxListItem& info ) const;
bool SetItem( wxListItem& info ) ;
long SetItem( long index, int col, const wxString& label, int imageId = -1 );
// wxColour GetTextColour() const; // wxGLC has colours for every Item (see wxListItem)
// void SetTextColour(const wxColour& col);
long GetTopItem() const;
+
void SetSingleStyle( long style, bool add = TRUE ) ;
void SetWindowStyleFlag( long style );
void RecreateWindow() {}
wxImageList *GetImageList( int which ) const;
void SetImageList( wxImageList *imageList, int which );
bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
-
+
void ClearAll();
bool DeleteItem( long item );
bool DeleteAllItems();
bool DeleteAllColumns();
bool DeleteColumn( int col );
-
+
void EditLabel( long item ) { Edit(item); }
void Edit( long item );
-
+
bool EnsureVisible( long item );
long FindItem( long start, const wxString& str, bool partial = FALSE );
long FindItem( long start, long data );
bool ScrollList( int dx, int dy );
bool SortItems( wxListCtrlCompare fn, long data );
bool Update( long item );
- void OnIdle( wxIdleEvent &event );
+ void OnIdle( wxIdleEvent &event );
+ void OnSize( wxSizeEvent &event );
+
// We have to hand down a few functions
-
+
bool SetBackgroundColour( const wxColour &colour );
bool SetForegroundColour( const wxColour &colour );
bool SetFont( const wxFont &font );
-
+
#if wxUSE_DRAG_AND_DROP
void SetDropTarget( wxDropTarget *dropTarget )
{ m_mainWin->SetDropTarget( dropTarget ); }
bool DoPopupMenu( wxMenu *menu, int x, int y )
{ return m_mainWin->PopupMenu( menu, x, y ); }
void SetFocus()
- { m_mainWin->SetFocus(); }
+ {
+ /* The test in window.cpp fails as we are a composite
+ window, so it checks against "this", but not m_mainWin. */
+ if (FindFocus() != this)
+ m_mainWin->SetFocus();
+ }
+
+ // implementation
+ // --------------
- // implementation
-
wxImageList *m_imageListNormal;
wxImageList *m_imageListSmall;
wxImageList *m_imageListState; // what's that ?
wxListHeaderWindow *m_headerWin;
wxListMainWindow *m_mainWin;
- DECLARE_EVENT_TABLE()
-
+private:
+ DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxListCtrl);
};