summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-29 20:23:25 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-29 20:23:25 +0200
commit6df16720da3ae3257636e000c10b62d0b99f752e (patch)
tree5fed84d7d00d2632335fb455e1c78440dd6cb69a
parentc2697fef772f84db637f55b7501361ea94ed66ee (diff)
downloadmana-6df16720da3ae3257636e000c10b62d0b99f752e.tar.gz
mana-6df16720da3ae3257636e000c10b62d0b99f752e.tar.bz2
mana-6df16720da3ae3257636e000c10b62d0b99f752e.tar.xz
mana-6df16720da3ae3257636e000c10b62d0b99f752e.zip
Fixed const-ness of TableModel related methods
-rw-r--r--src/gui/emotecontainer.h6
-rw-r--r--src/gui/setup_players.cpp12
-rw-r--r--src/gui/skill.cpp6
-rw-r--r--src/gui/table.cpp18
-rw-r--r--src/gui/table.h18
-rw-r--r--src/gui/tablemodel.cpp16
-rw-r--r--src/gui/tablemodel.h24
7 files changed, 49 insertions, 51 deletions
diff --git a/src/gui/emotecontainer.h b/src/gui/emotecontainer.h
index 88df29fc..db0fd6dd 100644
--- a/src/gui/emotecontainer.h
+++ b/src/gui/emotecontainer.h
@@ -109,17 +109,17 @@ class EmoteContainer : public gcn::Widget,
/**
* Find the current emote index by the most recently used emote ID
*/
- void refindSelectedEmote(void);
+ void refindSelectedEmote();
/**
* Determine and set the height of the container.
*/
- void recalculateHeight(void);
+ void recalculateHeight();
/**
* Sends out selection events to the list of selection listeners.
*/
- void distributeValueChangedEvent(void);
+ void distributeValueChangedEvent();
std::vector<const AnimatedSprite*> mEmoteImg;
Image *mSelImg;
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index 01a99567..c5dffe3d 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -99,22 +99,22 @@ public:
delete mPlayers;
}
- virtual int getRows()
+ virtual int getRows() const
{
return mPlayers->size();
}
- virtual int getColumns()
+ virtual int getColumns() const
{
return COLUMNS_NR;
}
- virtual int getRowHeight()
+ virtual int getRowHeight() const
{
return ROW_HEIGHT;
}
- virtual int getColumnWidth(int index)
+ virtual int getColumnWidth(int index) const
{
if (index == NAME_COLUMN)
return NAME_COLUMN_WIDTH;
@@ -158,7 +158,7 @@ public:
}
- virtual gcn::Widget *getElementAt(int row, int column)
+ virtual gcn::Widget *getElementAt(int row, int column) const
{
return mWidgets[WIDGET_AT(row, column)];
}
@@ -178,7 +178,7 @@ public:
mWidgets.clear();
}
- std::string getPlayerAt(int index)
+ std::string getPlayerAt(int index) const
{
return (*mPlayers)[index];
}
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 684a9ded..d7a95120 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -66,12 +66,12 @@ public:
update();
}
- virtual int getRows(void)
+ virtual int getRows() const
{
return mEntriesNr;
}
- virtual int getColumnWidth(int index)
+ virtual int getColumnWidth(int index) const
{
if (index == 0)
return 160;
@@ -79,7 +79,7 @@ public:
return 35;
}
- virtual int getRowHeight()
+ virtual int getRowHeight() const
{
return 12;
}
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index c25856a2..995c393c 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -154,12 +154,12 @@ void GuiTable::setSelected(int row, int column)
mSelectedRow = row;
}
-int GuiTable::getSelectedRow()
+int GuiTable::getSelectedRow() const
{
return mSelectedRow;
}
-int GuiTable::getSelectedColumn()
+int GuiTable::getSelectedColumn() const
{
return mSelectedColumn;
}
@@ -169,7 +169,7 @@ void GuiTable::setLinewiseSelection(bool linewise)
mLinewiseMode = linewise;
}
-int GuiTable::getRowHeight()
+int GuiTable::getRowHeight() const
{
if (mModel)
return mModel->getRowHeight() + 1; // border
@@ -177,7 +177,7 @@ int GuiTable::getRowHeight()
return 0;
}
-int GuiTable::getColumnWidth(int i)
+int GuiTable::getColumnWidth(int i) const
{
if (mModel)
return mModel->getColumnWidth(i) + 1; // border
@@ -238,7 +238,7 @@ void GuiTable::setSelectedColumn(int selected)
}
}
-void GuiTable::uninstallActionListeners(void)
+void GuiTable::uninstallActionListeners()
{
delete_all(mActionListeners);
mActionListeners.clear();
@@ -368,7 +368,7 @@ void GuiTable::moveToBottom(gcn::Widget *widget)
mTopWidget = NULL;
}
-gcn::Rectangle GuiTable::getChildrenArea()
+gcn::Rectangle GuiTable::getChildrenArea() const
{
return gcn::Rectangle(0, 0, getWidth(), getHeight());
}
@@ -478,7 +478,7 @@ void GuiTable::modelUpdated(bool completed)
}
}
-gcn::Widget *GuiTable::getWidgetAt(int x, int y)
+gcn::Widget *GuiTable::getWidgetAt(int x, int y) const
{
int row = getRowForY(y);
int column = getColumnForX(x);
@@ -498,7 +498,7 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y)
return NULL;
}
-int GuiTable::getRowForY(int y)
+int GuiTable::getRowForY(int y) const
{
int row = -1;
@@ -511,7 +511,7 @@ int GuiTable::getRowForY(int y)
return row;
}
-int GuiTable::getColumnForX(int x)
+int GuiTable::getColumnForX(int x) const
{
int column;
int delta = 0;
diff --git a/src/gui/table.h b/src/gui/table.h
index 42fbab0e..4f3c29c6 100644
--- a/src/gui/table.h
+++ b/src/gui/table.h
@@ -70,13 +70,11 @@ public:
*/
void setModel(TableModel *m);
- const TableModel* getModel() {return mModel;}
-
void setSelected(int row, int column);
- int getSelectedRow();
+ int getSelectedRow() const;
- int getSelectedColumn();
+ int getSelectedColumn() const;
void setSelectedRow(int selected);
@@ -87,7 +85,7 @@ public:
void setWrappingEnabled(bool wrappingEnabled)
{mWrappingEnabled = wrappingEnabled;}
- gcn::Rectangle getChildrenArea(void);
+ gcn::Rectangle getChildrenArea() const;
/**
* Toggle whether to use linewise selection mode, in which the table selects
@@ -105,7 +103,7 @@ public:
// Inherited from Widget
virtual void draw(gcn::Graphics* graphics);
- virtual gcn::Widget *getWidgetAt(int x, int y);
+ virtual gcn::Widget *getWidgetAt(int x, int y) const;
virtual void moveToTop(gcn::Widget *child);
@@ -150,12 +148,12 @@ protected:
/** Installs all action listeners on inner widgets. */
virtual void installActionListeners();
- virtual int getRowHeight();
- virtual int getColumnWidth(int i);
+ virtual int getRowHeight() const;
+ virtual int getColumnWidth(int i) const;
private:
- int getRowForY(int y); // -1 on error
- int getColumnForX(int x); // -1 on error
+ int getRowForY(int y) const; // -1 on error
+ int getColumnForX(int x) const; // -1 on error
void recomputeDimensions();
bool mLinewiseMode;
bool mWrappingEnabled;
diff --git a/src/gui/tablemodel.cpp b/src/gui/tablemodel.cpp
index e362a314..0d8a8e33 100644
--- a/src/gui/tablemodel.cpp
+++ b/src/gui/tablemodel.cpp
@@ -97,7 +97,7 @@ void StaticTableModel::set(int row, int column, gcn::Widget *widget)
signalAfterUpdate();
}
-gcn::Widget *StaticTableModel::getElementAt(int row, int column)
+gcn::Widget *StaticTableModel::getElementAt(int row, int column) const
{
return mTableModel[WIDGET_AT(row, column)];
}
@@ -119,12 +119,12 @@ void StaticTableModel::fixRowHeight(int height)
mHeight = -height;
}
-int StaticTableModel::getRowHeight()
+int StaticTableModel::getRowHeight() const
{
return abs(mHeight);
}
-int StaticTableModel::getColumnWidth(int column)
+int StaticTableModel::getColumnWidth(int column) const
{
if (column < 0 || column >= mColumns)
return 0;
@@ -132,17 +132,17 @@ int StaticTableModel::getColumnWidth(int column)
return abs(mWidths[column]);
}
-int StaticTableModel::getRows()
+int StaticTableModel::getRows() const
{
return mRows;
}
-int StaticTableModel::getColumns()
+int StaticTableModel::getColumns() const
{
return mColumns;
}
-int StaticTableModel::getWidth(void)
+int StaticTableModel::getWidth() const
{
int width = 0;
@@ -154,8 +154,8 @@ int StaticTableModel::getWidth(void)
return width;
}
-int StaticTableModel::getHeight(void)
+int StaticTableModel::getHeight() const
{
- return (mColumns * mHeight);
+ return mColumns * mHeight;
}
diff --git a/src/gui/tablemodel.h b/src/gui/tablemodel.h
index a884932f..ffaa0557 100644
--- a/src/gui/tablemodel.h
+++ b/src/gui/tablemodel.h
@@ -53,27 +53,27 @@ public:
/**
* Determines the number of rows (lines) in the table
*/
- virtual int getRows() = 0;
+ virtual int getRows() const = 0;
/**
* Determines the number of columns in each row
*/
- virtual int getColumns() = 0;
+ virtual int getColumns() const = 0;
/**
* Determines the height for each row
*/
- virtual int getRowHeight() = 0;
+ virtual int getRowHeight() const = 0;
/**
* Determines the width of each individual column
*/
- virtual int getColumnWidth(int index) = 0;
+ virtual int getColumnWidth(int index) const = 0;
/**
* Retrieves the widget stored at the specified location within the table.
*/
- virtual gcn::Widget *getElementAt(int row, int column) = 0;
+ virtual gcn::Widget *getElementAt(int row, int column) const = 0;
virtual void installListener(TableModelListener *listener);
@@ -128,13 +128,13 @@ public:
*/
virtual void resize();
- virtual int getRows();
- virtual int getColumns();
- virtual int getRowHeight();
- virtual int getWidth();
- virtual int getHeight();
- virtual int getColumnWidth(int index);
- virtual gcn::Widget *getElementAt(int row, int column);
+ virtual int getRows() const;
+ virtual int getColumns() const;
+ virtual int getRowHeight() const;
+ virtual int getWidth() const;
+ virtual int getHeight() const;
+ virtual int getColumnWidth(int index) const;
+ virtual gcn::Widget *getElementAt(int row, int column) const;
protected:
int mRows, mColumns;