diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-11-30 16:05:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-11-30 16:09:34 +0300 |
commit | e768add9d172d78bd5deb7e98d228fb50bf8e2c5 (patch) | |
tree | 44b9767ce542e3f5649b2f1b14e66dc4e6472941 /src/gui/widgets/guitable.cpp | |
parent | e469ec3a8b0c41168bcb3c3071c252e196ae78a8 (diff) | |
download | manaplus-e768add9d172d78bd5deb7e98d228fb50bf8e2c5.tar.gz manaplus-e768add9d172d78bd5deb7e98d228fb50bf8e2c5.tar.bz2 manaplus-e768add9d172d78bd5deb7e98d228fb50bf8e2c5.tar.xz manaplus-e768add9d172d78bd5deb7e98d228fb50bf8e2c5.zip |
add support for unselectable guitables.
Diffstat (limited to 'src/gui/widgets/guitable.cpp')
-rw-r--r-- | src/gui/widgets/guitable.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 15765763e..9d6eb0926 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -104,7 +104,8 @@ GuiTable::GuiTable(const Widget2 *const widget, mSelectedColumn(-1), mLinewiseMode(false), mWrappingEnabled(false), - mOpaque(opacity) + mOpaque(opacity), + mSelectable(true) { mBackgroundColor = getThemeColor(Theme::BACKGROUND); @@ -157,11 +158,14 @@ void GuiTable::recomputeDimensions() const int columns_nr = mModel->getColumns(); int width = 0; - if (mSelectedRow >= rows_nr) - mSelectedRow = rows_nr - 1; + if (mSelectable) + { + if (mSelectedRow >= rows_nr) + mSelectedRow = rows_nr - 1; - if (mSelectedColumn >= columns_nr) - mSelectedColumn = columns_nr - 1; + if (mSelectedColumn >= columns_nr) + mSelectedColumn = columns_nr - 1; + } for (int i = 0; i < columns_nr; i++) width += getColumnWidth(i); @@ -204,7 +208,7 @@ int GuiTable::getColumnWidth(const int i) const void GuiTable::setSelectedRow(const int selected) { - if (!mModel) + if (!mModel || !mSelectable) { mSelectedRow = -1; } @@ -457,7 +461,7 @@ void GuiTable::keyPressed(gcn::KeyEvent& keyEvent) // -- MouseListener notifications void GuiTable::mousePressed(gcn::MouseEvent& mouseEvent) { - if (!mModel) + if (!mModel || !mSelectable) return; if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) |