From 797bc2c087756b0f577dd7ee02554e931d22e409 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Sat, 17 Apr 2021 19:33:25 +0100 Subject: [PATCH] Introduce ABI shims for wxListCtrl column ordering functions This way it is easier to add the functions later on without breaking ABI. --- include/wx/generic/listctrl.h | 8 ++++++++ include/wx/listbase.h | 8 ++++++++ include/wx/msw/listctrl.h | 8 ++++---- include/wx/qt/listctrl.h | 8 ++++---- src/generic/listctrl.cpp | 25 +++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 8 deletions(-) diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 8bd63b7ae5..48949dac07 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -68,6 +68,14 @@ public: bool SetColumn( int col, const wxListItem& item ) wxOVERRIDE; int GetColumnWidth( int col ) const wxOVERRIDE; bool SetColumnWidth( int col, int width) wxOVERRIDE; + + // Column ordering functions + int GetColumnOrder(int col) const wxOVERRIDE; + int GetColumnIndexFromOrder(int order) const wxOVERRIDE; + + wxArrayInt GetColumnsOrder() const wxOVERRIDE; + bool SetColumnsOrder(const wxArrayInt& orders) wxOVERRIDE; + int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think wxRect GetViewRect() const; diff --git a/include/wx/listbase.h b/include/wx/listbase.h index f786bfd278..7d8e8f68b4 100644 --- a/include/wx/listbase.h +++ b/include/wx/listbase.h @@ -399,6 +399,14 @@ public: virtual int GetColumnWidth(int col) const = 0; virtual bool SetColumnWidth(int col, int width) = 0; + // Column ordering functions + virtual int GetColumnOrder(int col) const = 0; + virtual int GetColumnIndexFromOrder(int order) const = 0; + + virtual wxArrayInt GetColumnsOrder() const = 0; + virtual bool SetColumnsOrder(const wxArrayInt& orders) = 0; + + // Other miscellaneous accessors. // ------------------------------ diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 64bac9ca90..cb5e16a2fe 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -129,14 +129,14 @@ public: // Gets the column order from its index or index from its order - int GetColumnOrder(int col) const; - int GetColumnIndexFromOrder(int order) const; + int GetColumnOrder(int col) const wxOVERRIDE; + int GetColumnIndexFromOrder(int order) const wxOVERRIDE; // Gets the column order for all columns - wxArrayInt GetColumnsOrder() const; + wxArrayInt GetColumnsOrder() const wxOVERRIDE; // Sets the column order for all columns - bool SetColumnsOrder(const wxArrayInt& orders); + bool SetColumnsOrder(const wxArrayInt& orders) wxOVERRIDE; // Gets the number of items that can fit vertically in the diff --git a/include/wx/qt/listctrl.h b/include/wx/qt/listctrl.h index ae529b503a..34a5eba779 100644 --- a/include/wx/qt/listctrl.h +++ b/include/wx/qt/listctrl.h @@ -60,14 +60,14 @@ public: // Gets the column order from its index or index from its order - int GetColumnOrder(int col) const; - int GetColumnIndexFromOrder(int order) const; + int GetColumnOrder(int col) const wxOVERRIDE; + int GetColumnIndexFromOrder(int order) const wxOVERRIDE; // Gets the column order for all columns - wxArrayInt GetColumnsOrder() const; + wxArrayInt GetColumnsOrder() const wxOVERRIDE; // Sets the column order for all columns - bool SetColumnsOrder(const wxArrayInt& orders); + bool SetColumnsOrder(const wxArrayInt& orders) wxOVERRIDE; // Gets the number of items that can fit vertically in the diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index e82b217201..3ba6b9576c 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -5162,6 +5162,31 @@ bool wxGenericListCtrl::SetColumnWidth( int col, int width ) return true; } +// Column ordering functions +int wxGenericListCtrl::GetColumnOrder(int col) const +{ + // TODO: Implement this on generic port + return col; +} + +int wxGenericListCtrl::GetColumnIndexFromOrder(int order) const +{ + // TODO: Implement this on generic port + return order; +} + +wxArrayInt wxGenericListCtrl::GetColumnsOrder() const +{ + // TODO: Implement this on generic port + return wxArrayInt(); +} + +bool wxGenericListCtrl::SetColumnsOrder(const wxArrayInt& WXUNUSED(orders)) +{ + // TODO: Implement this on generic port + return false; +} + int wxGenericListCtrl::GetCountPerPage() const { return m_mainWin->GetCountPerPage(); // different from Windows ?