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 | |
parent | e469ec3a8b0c41168bcb3c3071c252e196ae78a8 (diff) | |
download | mv-e768add9d172d78bd5deb7e98d228fb50bf8e2c5.tar.gz mv-e768add9d172d78bd5deb7e98d228fb50bf8e2c5.tar.bz2 mv-e768add9d172d78bd5deb7e98d228fb50bf8e2c5.tar.xz mv-e768add9d172d78bd5deb7e98d228fb50bf8e2c5.zip |
add support for unselectable guitables.
Diffstat (limited to 'src')
-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"))); |