Merge branch 'qt-listctrl'
New version of wxListCtrl for wxQt, supporting virtual list controls, checkboxes, sorting and with other fixes. See https://github.com/wxWidgets/wxWidgets/pull/1551
This commit is contained in:
@@ -11,7 +11,8 @@
|
||||
#include "wx/textctrl.h"
|
||||
|
||||
class wxQtListTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
class wxQtListModel;
|
||||
class wxQtVirtualListModel;
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxImageList;
|
||||
|
||||
@@ -159,6 +160,11 @@ public:
|
||||
// list or report view
|
||||
long GetTopItem() const;
|
||||
|
||||
virtual bool HasCheckBoxes() const wxOVERRIDE;
|
||||
virtual bool EnableCheckBoxes(bool enable = true) wxOVERRIDE;
|
||||
virtual bool IsItemChecked(long item) const wxOVERRIDE;
|
||||
virtual void CheckItem(long item, bool check) wxOVERRIDE;
|
||||
|
||||
// Add or remove a single window style
|
||||
void SetSingleStyle(long style, bool add = true);
|
||||
|
||||
@@ -273,16 +279,21 @@ protected:
|
||||
// Implement base class pure virtual methods.
|
||||
virtual long DoInsertColumn(long col, const wxListItem& info) wxOVERRIDE;
|
||||
|
||||
QTreeWidgetItem *QtGetItem(int id) const;
|
||||
|
||||
wxImageList * m_imageListNormal; // The image list for normal icons
|
||||
wxImageList * m_imageListSmall; // The image list for small icons
|
||||
wxImageList * m_imageListState; // The image list state icons (not implemented yet)
|
||||
bool m_ownsImageListNormal,
|
||||
m_ownsImageListSmall,
|
||||
m_ownsImageListState;
|
||||
bool m_hasCheckBoxes;
|
||||
|
||||
private:
|
||||
// Allow access to OnGetItemXXX() method from the virtual model class.
|
||||
friend class wxQtVirtualListModel;
|
||||
|
||||
|
||||
wxQtListTreeWidget *m_qtTreeWidget;
|
||||
wxQtListModel *m_model;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS( wxListCtrl );
|
||||
};
|
||||
|
@@ -1543,7 +1543,8 @@ void MyListCtrl::OnContextMenu(wxContextMenuEvent& event)
|
||||
{
|
||||
point = ScreenToClient(point);
|
||||
}
|
||||
ShowContextMenu(point);
|
||||
int flags;
|
||||
ShowContextMenu(point, HitTest(point, flags));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1555,10 +1556,10 @@ void MyListCtrl::OnContextMenu(wxContextMenuEvent& event)
|
||||
}
|
||||
#endif
|
||||
|
||||
void MyListCtrl::ShowContextMenu(const wxPoint& pos)
|
||||
void MyListCtrl::ShowContextMenu(const wxPoint& pos, long item)
|
||||
{
|
||||
wxMenu menu;
|
||||
|
||||
menu.Append(wxID_ANY, wxString::Format("Menu for item %ld", item));
|
||||
menu.Append(wxID_ABOUT, "&About");
|
||||
menu.AppendSeparator();
|
||||
menu.Append(wxID_EXIT, "E&xit");
|
||||
|
@@ -78,7 +78,7 @@ public:
|
||||
virtual bool IsItemChecked(long item) const wxOVERRIDE;
|
||||
|
||||
private:
|
||||
void ShowContextMenu(const wxPoint& pos);
|
||||
void ShowContextMenu(const wxPoint& pos, long item);
|
||||
wxLog *m_logOld;
|
||||
void SetColumnImage(int col, int image);
|
||||
|
||||
|
1671
src/qt/listctrl.cpp
1671
src/qt/listctrl.cpp
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user