summaryrefslogtreecommitdiff
path: root/src/gui/table_model.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-20 16:46:17 -0700
committerIra Rice <irarice@gmail.com>2009-01-20 16:46:17 -0700
commit1b3ac1ad7a745ed7b7aac1f1dd7514616db8a998 (patch)
treed04d002a96fb2febbfd8a42b66aab38f04ee6b16 /src/gui/table_model.cpp
parentc75f6978e780a4cbe7e4103b7a3187c2ddf75c33 (diff)
downloadmana-client-1b3ac1ad7a745ed7b7aac1f1dd7514616db8a998.tar.gz
mana-client-1b3ac1ad7a745ed7b7aac1f1dd7514616db8a998.tar.bz2
mana-client-1b3ac1ad7a745ed7b7aac1f1dd7514616db8a998.tar.xz
mana-client-1b3ac1ad7a745ed7b7aac1f1dd7514616db8a998.zip
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 <irarice@gmail.com>
Diffstat (limited to 'src/gui/table_model.cpp')
-rw-r--r--src/gui/table_model.cpp48
1 files changed, 45 insertions, 3 deletions
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 <cstdlib>
+#include <guichan/graphics.hpp>
#include <guichan/widget.hpp>
#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;
+}
+