diff options
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) |