From df994f808e69d567fddc742656a1df86c15bf576 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 17 Jun 2013 13:21:59 +0300 Subject: improve tablemodel. --- src/gui/widgets/guitable.cpp | 4 ++-- src/gui/widgets/guitable.h | 4 ++-- src/gui/widgets/tablemodel.cpp | 5 +++-- src/gui/widgets/tablemodel.h | 14 +++++++------- 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 37fe17d95..460fd4218 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -199,7 +199,7 @@ int GuiTable::getRowHeight() const return 0; } -int GuiTable::getColumnWidth(int i) const +int GuiTable::getColumnWidth(const int i) const { if (mModel) return mModel->getColumnWidth(i) + 4; // border @@ -514,7 +514,7 @@ void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent) setSelectedColumn(getColumnForX(x)); } -void GuiTable::modelUpdated(bool completed) +void GuiTable::modelUpdated(const bool completed) { if (completed) { diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index b5c8883c3..2296df87b 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -151,7 +151,7 @@ public: void mouseDragged(gcn::MouseEvent& mouseEvent) override; // Constraints inherited from TableModelListener - void modelUpdated(bool) override; + void modelUpdated(const bool completed) override; void requestFocus(); @@ -163,7 +163,7 @@ protected: int getRowHeight() const A_WARN_UNUSED; - int getColumnWidth(int i) const A_WARN_UNUSED; + int getColumnWidth(const int i) const A_WARN_UNUSED; private: int getRowForY(int y) const A_WARN_UNUSED; // -1 on error diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp index 3b0c3e854..87c620afc 100644 --- a/src/gui/widgets/tablemodel.cpp +++ b/src/gui/widgets/tablemodel.cpp @@ -119,7 +119,8 @@ void StaticTableModel::set(const int row, const int column, signalAfterUpdate(); } -gcn::Widget *StaticTableModel::getElementAt(int row, int column) const +gcn::Widget *StaticTableModel::getElementAt(const int row, + const int column) const { return mTableModel[WIDGET_AT(row, column)]; } @@ -145,7 +146,7 @@ int StaticTableModel::getRowHeight() const return abs(mHeight); } -int StaticTableModel::getColumnWidth(int column) const +int StaticTableModel::getColumnWidth(const int column) const { if (column < 0 || column >= mColumns) return 0; diff --git a/src/gui/widgets/tablemodel.h b/src/gui/widgets/tablemodel.h index dccce65ad..427b8bf3a 100644 --- a/src/gui/widgets/tablemodel.h +++ b/src/gui/widgets/tablemodel.h @@ -45,7 +45,7 @@ public: * * \param completed whether we are signalling the end of the update */ - virtual void modelUpdated(bool completed) = 0; + virtual void modelUpdated(const bool completed) = 0; virtual ~TableModelListener() { } @@ -82,12 +82,12 @@ public: /** * Determines the width of each individual column */ - virtual int getColumnWidth(int index) const A_WARN_UNUSED = 0; + virtual int getColumnWidth(const int index) const A_WARN_UNUSED = 0; /** * Retrieves the widget stored at the specified location within the table. */ - virtual gcn::Widget *getElementAt(int row, int column) + virtual gcn::Widget *getElementAt(const int row, const int column) const A_WARN_UNUSED = 0; virtual void installListener(TableModelListener *const listener); @@ -147,13 +147,13 @@ public: */ virtual void resize(); - virtual int getRows() const A_WARN_UNUSED; - virtual int getColumns() const A_WARN_UNUSED; + virtual int getRows() const override A_WARN_UNUSED; + virtual int getColumns() const override A_WARN_UNUSED; virtual int getRowHeight() const override A_WARN_UNUSED; virtual int getWidth() const A_WARN_UNUSED; virtual int getHeight() const A_WARN_UNUSED; - virtual int getColumnWidth(int index) const A_WARN_UNUSED; - virtual gcn::Widget *getElementAt(int row, int column) + virtual int getColumnWidth(const int index) const override A_WARN_UNUSED; + virtual gcn::Widget *getElementAt(const int row, const int column) const override A_WARN_UNUSED; protected: -- cgit v1.2.3-70-g09d2