Skip to content

Commit

Permalink
Fixed|libappfw: Showing and hiding LineEditWidget's hint message
Browse files Browse the repository at this point in the history
When the text of the editor was changed programmatically, the hint
message's visibility was not updated.
  • Loading branch information
skyjake committed Feb 27, 2016
1 parent 1240600 commit 28a94c0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 deletions.
34 changes: 18 additions & 16 deletions doomsday/sdk/libappfw/include/de/widgets/lineeditwidget.h
Expand Up @@ -40,6 +40,8 @@ class LIBAPPFW_PUBLIC LineEditWidget : public GuiWidget, public shell::AbstractL
public:
LineEditWidget(String const &name = "");

void setText(String const &lineText) override;

/**
* Sets the text that will be shown in the editor when it is empty.
*
Expand All @@ -63,12 +65,12 @@ class LIBAPPFW_PUBLIC LineEditWidget : public GuiWidget, public shell::AbstractL
Rectanglei cursorRect() const;

// Events.
void viewResized();
void focusGained();
void focusLost();
void update();
void drawContent();
bool handleEvent(Event const &event);
void viewResized() override;
void focusGained() override;
void focusLost() override;
void update() override;
void drawContent() override;
bool handleEvent(Event const &event) override;

public:
static KeyModifiers modifiersFromKeyEvent(KeyEvent::Modifiers const &keyMods);
Expand All @@ -78,16 +80,16 @@ class LIBAPPFW_PUBLIC LineEditWidget : public GuiWidget, public shell::AbstractL
void editorContentChanged();

protected:
void glInit();
void glDeinit();
void glMakeGeometry(DefaultVertexBuf::Builder &verts);
void updateStyle();

int maximumWidth() const;
void numberOfLinesChanged(int lineCount);
void cursorMoved();
void contentChanged();
void autoCompletionEnded(bool accepted);
void glInit() override;
void glDeinit() override;
void glMakeGeometry(DefaultVertexBuf::Builder &verts) override;
void updateStyle() override;

int maximumWidth() const override;
void numberOfLinesChanged(int lineCount) override;
void cursorMoved() override;
void contentChanged() override;
void autoCompletionEnded(bool accepted) override;

private:
DENG2_PRIVATE(d)
Expand Down
17 changes: 17 additions & 0 deletions doomsday/sdk/libappfw/src/widgets/lineeditwidget.cpp
Expand Up @@ -242,6 +242,23 @@ LineEditWidget::LineEditWidget(String const &name)
rule().setInput(Rule::Height, *d->height);
}

void LineEditWidget::setText(String const &lineText)
{
shell::AbstractLineEditor::setText(lineText);

if(d->hint)
{
if(d->showingHint())
{
d->hint->setOpacity(1, .5);
}
else
{
d->hint->setOpacity(0);
}
}
}

void LineEditWidget::setEmptyContentHint(String const &hintText)
{
if(!d->hint)
Expand Down

0 comments on commit 28a94c0

Please sign in to comment.