From 1b3ac1ad7a745ed7b7aac1f1dd7514616db8a998 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Tue, 20 Jan 2009 16:46:17 -0700 Subject: Reflowed skill dialog, as well as started to work on revising the table model (none of the changes yet make visible improvements yet, unfortunately). Signed-off-by: Ira Rice --- src/gui/table_model.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'src/gui/table_model.cpp') diff --git a/src/gui/table_model.cpp b/src/gui/table_model.cpp index d626423a..f7f0ab54 100644 --- a/src/gui/table_model.cpp +++ b/src/gui/table_model.cpp @@ -21,6 +21,7 @@ #include +#include #include #include "table_model.h" @@ -50,14 +51,16 @@ void TableModel::signalAfterUpdate(void) } - #define WIDGET_AT(row, column) (((row) * mColumns) + (column)) #define DYN_SIZE(h) ((h) >= 0) // determines whether this size is tagged for auto-detection -StaticTableModel::StaticTableModel(int row, int column) : +StaticTableModel::StaticTableModel(int row, int column, + gcn::Color backgroundColor, bool opacity) : mRows(row), mColumns(column), - mHeight(1) + mHeight(1), + mBackgroundColor(backgroundColor), + mOpaque(opacity) { mTableModel.resize(row * column, NULL); mWidths.resize(column, 1); @@ -144,3 +147,42 @@ int StaticTableModel::getColumns(void) { return mColumns; } + +int StaticTableModel::getWidth(void) +{ + int width = 0; + + for (unsigned int i = 0; i < mWidths.size(); i++) + { + width += mWidths[i]; + } + + return width; +} + +int StaticTableModel::getHeight(void) +{ + return (mColumns * mHeight); +} + +void StaticTableModel::drawBackground(gcn::Graphics *graphics) +{ + if (isOpaque()) + { + for (unsigned int i = 0; i < mTableModel.size(); i++) + { + mTableModel[i]->setBackgroundColor(mBackgroundColor); + } + } +} + +void StaticTableModel::setOpaque(bool opaque) +{ + mOpaque = opaque; +} + +bool StaticTableModel::isOpaque() const +{ + return mOpaque; +} + -- cgit v1.2.3-70-g09d2