From 59f441730d8dbd7574b2fe4c9a430be256449cab Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 13 Dec 2008 22:56:33 +0100 Subject: 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. --- src/gui/table.cpp | 102 +++++++++++++++++++++--------------------------------- 1 file changed, 39 insertions(+), 63 deletions(-) (limited to 'src/gui/table.cpp') 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 #include -#include "table.h" -#include +#include 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::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); } + } + } } -- cgit v1.2.3-70-g09d2