diff options
Diffstat (limited to 'src/gui/table.cpp')
-rw-r--r-- | src/gui/table.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/gui/table.cpp b/src/gui/table.cpp index 8acbc4f4..76877c6b 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra derived from original code - * from Guichan. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,7 +37,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); @@ -63,7 +62,7 @@ GuiTableActionListener::GuiTableActionListener(GuiTable *table, gcn::Widget *wid } } -GuiTableActionListener::~GuiTableActionListener(void) +GuiTableActionListener::~GuiTableActionListener() { if (mWidget) { @@ -97,12 +96,12 @@ GuiTable::GuiTable(TableModel *initial_model, gcn::Color background, addKeyListener(this); } -GuiTable::~GuiTable(void) +GuiTable::~GuiTable() { delete mModel; } -TableModel* GuiTable::getModel(void) const +TableModel *GuiTable::getModel() const { return mModel; } @@ -125,7 +124,7 @@ void GuiTable::setModel(TableModel *new_model) } } -void GuiTable::recomputeDimensions(void) +void GuiTable::recomputeDimensions() { int rows_nr = mModel->getRows(); int columns_nr = mModel->getColumns(); @@ -153,12 +152,12 @@ void GuiTable::setSelected(int row, int column) mSelectedRow = row; } -int GuiTable::getSelectedRow(void) +int GuiTable::getSelectedRow() { return mSelectedRow; } -int GuiTable::getSelectedColumn(void) +int GuiTable::getSelectedColumn() { return mSelectedColumn; } @@ -168,7 +167,7 @@ void GuiTable::setLinewiseSelection(bool linewise) mLinewiseMode = linewise; } -int GuiTable::getRowHeight(void) +int GuiTable::getRowHeight() { if (mModel) return mModel->getRowHeight() + 1; // border @@ -200,7 +199,7 @@ void GuiTable::setSelectedRow(int selected) { mSelectedRow = 0; } - else if ((selected >= mModel->getRows() && !mWrappingEnabled) || + else if ((selected >= mModel->getRows() && !mWrappingEnabled) || (selected < 0 && mWrappingEnabled)) { mSelectedRow = mModel->getRows() - 1; @@ -225,7 +224,7 @@ void GuiTable::setSelectedColumn(int selected) { mSelectedColumn = 0; } - else if ((selected >= mModel->getColumns() && !mWrappingEnabled) || + else if ((selected >= mModel->getColumns() && !mWrappingEnabled) || (selected < 0 && mWrappingEnabled)) { mSelectedColumn = mModel->getColumns() - 1; @@ -243,7 +242,7 @@ void GuiTable::uninstallActionListeners(void) action_listeners.clear(); } -void GuiTable::installActionListeners(void) +void GuiTable::installActionListeners() { if (!mModel) return; @@ -292,7 +291,7 @@ void 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; @@ -325,7 +324,7 @@ void GuiTable::draw(gcn::Graphics* graphics) if (!mLinewiseMode && c == mSelectedColumn && r == mSelectedRow) { bool valid; - const int red = + const int red = (textColor->getColor('H', valid) >> 16) & 0xFF; const int green = (textColor->getColor('H', valid) >> 8) & 0xFF; @@ -347,7 +346,7 @@ void GuiTable::draw(gcn::Graphics* graphics) if (mLinewiseMode && r == mSelectedRow) { bool valid; - const int red = + const int red = (textColor->getColor('H', valid) >> 16) & 0xFF; const int green = (textColor->getColor('H', valid) >> 8) & 0xFF; @@ -384,7 +383,7 @@ void GuiTable::moveToBottom(gcn::Widget *widget) mTopWidget = NULL; } -gcn::Rectangle GuiTable::getChildrenArea(void) +gcn::Rectangle GuiTable::getChildrenArea() { return gcn::Rectangle(0, 0, getWidth(), getHeight()); } @@ -402,25 +401,25 @@ void GuiTable::keyPressed(gcn::KeyEvent& keyEvent) else if (key.getValue() == gcn::Key::UP) { setSelectedRow(mSelectedRow - 1); - + keyEvent.consume(); } else if (key.getValue() == gcn::Key::DOWN) { setSelectedRow(mSelectedRow + 1); - + keyEvent.consume(); } else if (key.getValue() == gcn::Key::LEFT) { setSelectedColumn(mSelectedColumn - 1); - + keyEvent.consume(); } else if (key.getValue() == gcn::Key::RIGHT) { setSelectedColumn(mSelectedColumn + 1); - + keyEvent.consume(); } else if (key.getValue() == gcn::Key::HOME) @@ -478,7 +477,7 @@ void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) mouseEvent.consume(); } } - + void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent) { } @@ -498,7 +497,7 @@ void 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); @@ -550,12 +549,13 @@ void GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler) { gcn::Widget::_setFocusHandler(focusHandler); - if (mModel) - for (int r = 0; r < mModel->getRows(); ++r) - for (int c = 0; c < mModel->getColumns(); ++c) - { + 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); } + } + } } |