diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/guitable.cpp | 18 | ||||
-rw-r--r-- | src/gui/widgets/guitable.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_relations.cpp | 1 | ||||
-rw-r--r-- | src/gui/windows/botcheckerwindow.cpp | 1 |
4 files changed, 17 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) diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 072563715..d41e5589b 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -158,6 +158,9 @@ public: void requestFocus(); + void setSelectable(bool b) + { mSelectable = b; } + protected: /** Frees all action listeners on inner widgets. */ void uninstallActionListeners(); @@ -194,6 +197,7 @@ private: bool mLinewiseMode; bool mWrappingEnabled; bool mOpaque; + bool mSelectable; }; #endif // GUI_WIDGETS_GUITABLE_H diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index c1b6cc1ed..8f5802371 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -270,6 +270,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : RELATION_CHOICE_COLUMN_WIDTH); mPlayerTitleTable->setBackgroundColor(getThemeColor( Theme::TABLE_BACKGROUND)); + mPlayerTitleTable->setSelectable(false); for (int i = 0; i < COLUMNS_NR; i++) { diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp index 61dc7286c..c63a03072 100644 --- a/src/gui/windows/botcheckerwindow.cpp +++ b/src/gui/windows/botcheckerwindow.cpp @@ -293,6 +293,7 @@ BotCheckerWindow::BotCheckerWindow(): } mPlayerTitleTable->setHeight(1); + mPlayerTitleTable->setSelectable(false); // TRANSLATORS: bot checker window table header mPlayerTableTitleModel->set(0, 0, new Label(this, _("Name"))); |