diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-12-13 22:56:33 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-12-13 22:56:33 +0100 |
commit | 59f441730d8dbd7574b2fe4c9a430be256449cab (patch) | |
tree | fe01d073652e9c0615828afc0d99ac6ee35b75fd /src/gui/table.cpp | |
parent | 7d5c6124e9c9cf447286eaa58afe17adf6c1a81d (diff) | |
download | mana-client-59f441730d8dbd7574b2fe4c9a430be256449cab.tar.gz mana-client-59f441730d8dbd7574b2fe4c9a430be256449cab.tar.bz2 mana-client-59f441730d8dbd7574b2fe4c9a430be256449cab.tar.xz mana-client-59f441730d8dbd7574b2fe4c9a430be256449cab.zip |
Code style reformatting
Got rid of "void" in functions that take no arguments and removed the
newline after the return type of a method in many places.
Diffstat (limited to 'src/gui/table.cpp')
-rw-r--r-- | src/gui/table.cpp | 102 |
1 files changed, 39 insertions, 63 deletions
diff --git a/src/gui/table.cpp b/src/gui/table.cpp index bddfbfed..fa455062 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -19,11 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "table.h" + #include <guichan/graphics.hpp> #include <guichan/actionlistener.hpp> -#include "table.h" -#include <cassert> +#include <cassert> class GuiTableActionListener : public gcn::ActionListener @@ -31,7 +32,7 @@ class GuiTableActionListener : public gcn::ActionListener public: GuiTableActionListener(GuiTable *_table, gcn::Widget *_widget, int _row, int _column); - virtual ~GuiTableActionListener(void); + virtual ~GuiTableActionListener(); virtual void action(const gcn::ActionEvent& actionEvent); @@ -55,7 +56,7 @@ GuiTableActionListener::GuiTableActionListener(GuiTable *table, gcn::Widget *wid } } -GuiTableActionListener::~GuiTableActionListener(void) +GuiTableActionListener::~GuiTableActionListener() { if (mWidget) { mWidget->removeActionListener(this); @@ -63,8 +64,7 @@ GuiTableActionListener::~GuiTableActionListener(void) } } -void -GuiTableActionListener::action(const gcn::ActionEvent& actionEvent) +void GuiTableActionListener::action(const gcn::ActionEvent& actionEvent) { mTable->setSelected(mRow, mColumn); mTable->distributeActionEvent(); @@ -83,19 +83,17 @@ GuiTable::GuiTable(TableModel *initial_model) : addKeyListener(this); } -GuiTable::~GuiTable(void) +GuiTable::~GuiTable() { delete mModel; } -TableModel * -GuiTable::getModel(void) const +TableModel *GuiTable::getModel() const { return mModel; } -void -GuiTable::setModel(TableModel *new_model) +void GuiTable::setModel(TableModel *new_model) { if (mModel) { uninstallActionListeners(); @@ -112,8 +110,7 @@ GuiTable::setModel(TableModel *new_model) } -void -GuiTable::recomputeDimensions(void) +void GuiTable::recomputeDimensions() { int rows_nr = mModel->getRows(); int columns_nr = mModel->getColumns(); @@ -135,33 +132,28 @@ GuiTable::recomputeDimensions(void) setHeight(height); } -void -GuiTable::setSelected(int row, int column) +void GuiTable::setSelected(int row, int column) { mSelectedColumn = column; mSelectedRow = row; } -int -GuiTable::getSelectedRow(void) +int GuiTable::getSelectedRow() { return mSelectedRow; } -int -GuiTable::getSelectedColumn(void) +int GuiTable::getSelectedColumn() { return mSelectedColumn; } -void -GuiTable::setLinewiseSelection(bool linewise) +void GuiTable::setLinewiseSelection(bool linewise) { mLinewiseMode = linewise; } -int -GuiTable::getRowHeight(void) +int GuiTable::getRowHeight() { if (mModel) return mModel->getRowHeight() + 1; // border @@ -169,8 +161,7 @@ GuiTable::getRowHeight(void) return 0; } -int -GuiTable::getColumnWidth(int i) +int GuiTable::getColumnWidth(int i) { if (mModel) return mModel->getColumnWidth(i) + 1; // border @@ -178,16 +169,14 @@ GuiTable::getColumnWidth(int i) return 0; } -void -GuiTable::uninstallActionListeners(void) +void GuiTable::uninstallActionListeners() { for (std::vector<GuiTableActionListener *>::const_iterator it = action_listeners.begin(); it != action_listeners.end(); it++) delete *it; action_listeners.clear(); } -void -GuiTable::installActionListeners(void) +void GuiTable::installActionListeners() { if (!mModel) return; @@ -206,8 +195,7 @@ GuiTable::installActionListeners(void) } // -- widget ops -void -GuiTable::draw(gcn::Graphics* graphics) +void GuiTable::draw(gcn::Graphics* graphics) { graphics->setColor(getBackgroundColor()); graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight())); @@ -226,7 +214,7 @@ GuiTable::draw(gcn::Graphics* graphics) int max_rows_nr = mModel->getRows() - first_row; // clip if neccessary: if (max_rows_nr < rows_nr) rows_nr = max_rows_nr; - + // Now determine the first and last column // Take the easy way out; these are usually bounded and all visible. int first_column = 0; @@ -281,42 +269,36 @@ GuiTable::draw(gcn::Graphics* graphics) } } -void -GuiTable::logic(void) +void GuiTable::logic() { } -void -GuiTable::moveToTop(gcn::Widget *widget) +void GuiTable::moveToTop(gcn::Widget *widget) { gcn::Widget::moveToTop(widget); this->mTopWidget = widget; } -void -GuiTable::moveToBottom(gcn::Widget *widget) +void GuiTable::moveToBottom(gcn::Widget *widget) { gcn::Widget::moveToBottom(widget); if (widget == this->mTopWidget) this->mTopWidget = NULL; } -gcn::Rectangle -GuiTable::getChildrenArea(void) +gcn::Rectangle GuiTable::getChildrenArea() { return gcn::Rectangle(0, 0, getWidth(), getHeight()); } // -- KeyListener notifications -void -GuiTable::keyPressed(gcn::KeyEvent& keyEvent) +void GuiTable::keyPressed(gcn::KeyEvent& keyEvent) { } // -- MouseListener notifications -void -GuiTable::mousePressed(gcn::MouseEvent& mouseEvent) +void GuiTable::mousePressed(gcn::MouseEvent& mouseEvent) { if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) { int row = getRowForY(mouseEvent.getY()); @@ -331,24 +313,20 @@ GuiTable::mousePressed(gcn::MouseEvent& mouseEvent) } } -void -GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) +void GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) { } -void -GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) +void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) { } - -void -GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent) + +void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent) { } // -- TableModelListener notifications -void -GuiTable::modelUpdated(bool completed) +void GuiTable::modelUpdated(bool completed) { if (completed) { recomputeDimensions(); @@ -359,8 +337,7 @@ GuiTable::modelUpdated(bool completed) } } -gcn::Widget * -GuiTable::getWidgetAt(int x, int y) +gcn::Widget *GuiTable::getWidgetAt(int x, int y) { int row = getRowForY(y); int column = getColumnForX(x); @@ -380,8 +357,7 @@ GuiTable::getWidgetAt(int x, int y) return NULL; } -int -GuiTable::getRowForY(int y) +int GuiTable::getRowForY(int y) { int row = y / getRowHeight(); @@ -392,8 +368,7 @@ GuiTable::getRowForY(int y) return row; } -int -GuiTable::getColumnForX(int x) +int GuiTable::getColumnForX(int x) { int column; int delta = 0; @@ -412,16 +387,17 @@ GuiTable::getColumnForX(int x) } -void -GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler) +void GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler) { gcn::Widget::_setFocusHandler(focusHandler); - if (mModel) - for (int r = 0; r < mModel->getRows(); ++r) + if (mModel) { + for (int r = 0; r < mModel->getRows(); ++r) { for (int c = 0; c < mModel->getColumns(); ++c) { gcn::Widget *w = mModel->getElementAt(r, c); if (w) w->_setFocusHandler(focusHandler); } + } + } } |