Skip to content

Commit

Permalink
Menu|Definitions: Use Values to replace menu item text
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 5, 2019
1 parent d254182 commit 573c6a9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions doomsday/apps/plugins/common/src/menu/widgets/buttonwidget.cpp
Expand Up @@ -21,6 +21,7 @@
#include "common.h"
#include "menu/widgets/buttonwidget.h"

#include "g_defs.h"
#include "hu_menu.h" // menu sounds
#include "hu_stuff.h"
#include "menu/page.h" // mnRendState
Expand Down Expand Up @@ -56,7 +57,7 @@ void ButtonWidget::draw() const
{
fontid_t const fontId = mnRendState->textFonts[font()];
Vector4f const &textColor = mnRendState->textColors[color()];
float t = (isFocused()? 1 : 0);
//float t = (isFocused()? 1 : 0);

const Vector4f color = selectionFlashColor(textColor);

Expand Down Expand Up @@ -165,7 +166,15 @@ String ButtonWidget::text() const

ButtonWidget &ButtonWidget::setText(String const &newText)
{
d->text = newText;
// Widget text may be replaced with Values.
if (const auto *repl = Defs().getValueById("Menu Label|" + newText))
{
d->text = repl->text;
}
else
{
d->text = newText;
}
return *this;
}

Expand Down

0 comments on commit 573c6a9

Please sign in to comment.