diff --git a/doomsday/client/include/ui/widgets/labelwidget.h b/doomsday/client/include/ui/widgets/labelwidget.h index 0694643e33..b4edb1910d 100644 --- a/doomsday/client/include/ui/widgets/labelwidget.h +++ b/doomsday/client/include/ui/widgets/labelwidget.h @@ -112,15 +112,7 @@ class LabelWidget : public GuiWidget void setTextLineAlignment(ui::Alignment const &textLineAlign); - /** - * Sets the alignment of the image when there is both an image - * and a text in the label. - * - * @param imageAlign Alignment for the image. - */ - void setImageAlignment(ui::Alignment const &imageAlign); - - void setImageFit(ui::ContentFit const &fit); + void setTextModulationColorf(de::Vector4f const &colorf); /** * Sets the maximum width used for text. By default, the maximum width is determined @@ -138,6 +130,16 @@ class LabelWidget : public GuiWidget */ void setTextStyle(de::Font::RichFormat::IStyle const *richStyle); + /** + * Sets the alignment of the image when there is both an image + * and a text in the label. + * + * @param imageAlign Alignment for the image. + */ + void setImageAlignment(ui::Alignment const &imageAlign); + + void setImageFit(ui::ContentFit const &fit); + /** * The image's actual size will be overridden by this size. * @param size Image size. diff --git a/doomsday/client/src/ui/widgets/buttonwidget.cpp b/doomsday/client/src/ui/widgets/buttonwidget.cpp index 87b37734f1..2d6fb1a582 100644 --- a/doomsday/client/src/ui/widgets/buttonwidget.cpp +++ b/doomsday/client/src/ui/widgets/buttonwidget.cpp @@ -29,7 +29,6 @@ DENG2_OBSERVES(Action, Triggered) { State state; DotPath hoverTextColor; - DotPath textColor; QScopedPointer action; Animation scale; Animation frameOpacity; @@ -62,20 +61,15 @@ DENG2_OBSERVES(Action, Triggered) if(!hoverTextColor.isEmpty()) { // Restore old color. - self.setTextColor(textColor); + self.setTextModulationColorf(Vector4f(1, 1, 1, 1)); } break; case Hover: - //scale.setValue(1.1f, .15f); - //scale.setStyle(Animation::EaseOut); frameOpacity.setValue(.4f, .15f); if(!hoverTextColor.isEmpty()) { - // Remember the old color. - textColor = self.textColorId(); - - self.setTextColor(hoverTextColor); + self.setTextModulationColorf(style().colors().colorf(hoverTextColor)); } break; @@ -152,7 +146,7 @@ DENG2_OBSERVES(Action, Triggered) ButtonWidget::ButtonWidget(String const &name) : LabelWidget(name), d(new Instance(this)) {} -void ButtonWidget::setHoverTextColor(const DotPath &hoverTextId) +void ButtonWidget::setHoverTextColor(DotPath const &hoverTextId) { d->hoverTextColor = hoverTextId; } diff --git a/doomsday/client/src/ui/widgets/labelwidget.cpp b/doomsday/client/src/ui/widgets/labelwidget.cpp index 72edba97cf..2134bad37c 100644 --- a/doomsday/client/src/ui/widgets/labelwidget.cpp +++ b/doomsday/client/src/ui/widgets/labelwidget.cpp @@ -43,6 +43,7 @@ public Font::RichFormat::IStyle Vector2f overrideImageSize; float imageScale; Vector4f imageColor; + Vector4f textGLColor; int maxTextWidth; ConstantRule *width; @@ -78,6 +79,7 @@ public Font::RichFormat::IStyle , imageFit (OriginalAspectRatio | FitToSize) , imageScale (1) , imageColor (1, 1, 1, 1) + , textGLColor (1, 1, 1, 1) , maxTextWidth(0) , gapId ("label.gap") , richStyle (0) @@ -525,6 +527,12 @@ void LabelWidget::setTextLineAlignment(Alignment const &textLineAlign) d->lineAlign = textLineAlign; } +void LabelWidget::setTextModulationColorf(Vector4f const &colorf) +{ + d->textGLColor = colorf; + requestGeometry(); +} + void LabelWidget::setImageAlignment(Alignment const &imageAlign) { d->imageAlign = imageAlign; @@ -618,7 +626,7 @@ void LabelWidget::glMakeGeometry(DefaultVertexBuf::Builder &verts) // Shadow + text. /*composer.makeVertices(verts, textPos.topLeft + Vector2i(0, 2), lineAlign, Vector4f(0, 0, 0, 1));*/ - d->glText.makeVertices(verts, layout.text, AlignCenter, d->lineAlign); + d->glText.makeVertices(verts, layout.text, AlignCenter, d->lineAlign, d->textGLColor); } } diff --git a/doomsday/client/src/ui/widgets/popupmenuwidget.cpp b/doomsday/client/src/ui/widgets/popupmenuwidget.cpp index 1ed90366d9..1eca4b8a50 100644 --- a/doomsday/client/src/ui/widgets/popupmenuwidget.cpp +++ b/doomsday/client/src/ui/widgets/popupmenuwidget.cpp @@ -240,7 +240,7 @@ void PopupMenuWidget::panelClosing() if(d->hover) { - d->hover->setTextColor("text"); + d->hover->setTextModulationColorf(Vector4f(1, 1, 1, 1)); d->hover->setImageColor(style().colors().colorf("text")); d->hover = 0; requestGeometry();