Skip to content

Commit

Permalink
Shell: TextWidget manual redrawing
Browse files Browse the repository at this point in the history
Added a method for immediately redrawing and showing a text widget.
  • Loading branch information
skyjake committed Jan 25, 2013
1 parent a809df1 commit b2b4f93
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doomsday/tools/shell/libshell/include/de/shell/textcanvas.h
Expand Up @@ -48,6 +48,7 @@ class DENG2_PUBLIC TextCanvas
Bold = 0x1,
Underline = 0x2,
Reverse = 0x4,
Blink = 0x8,

Dirty = 0x80000000,

Expand Down Expand Up @@ -134,7 +135,7 @@ class DENG2_PUBLIC TextCanvas

void put(Vector2i const &pos, Char const &ch);

void drawText(Vector2i const &pos, String const &text, Char::Attribs const &attribs);
void drawText(Vector2i const &pos, String const &text, Char::Attribs const &attribs = Char::DefaultAttributes);

/**
* Copies the contents of this canvas onto another canvas.
Expand Down
8 changes: 8 additions & 0 deletions doomsday/tools/shell/libshell/include/de/shell/textwidget.h
Expand Up @@ -51,6 +51,14 @@ class DENG2_PUBLIC TextWidget : public QObject, public Widget

TextCanvas *targetCanvas() const;

/**
* Draw this widget and all its children, and show the target canvas
* afterwards. Use this in special cases for faster redrawing of portions
* of the screen when only one widget's contents have changed and need
* updating.
*/
void drawAndShow();

/**
* Defines the placement of the widget on the target canvas.
*
Expand Down
10 changes: 10 additions & 0 deletions doomsday/tools/shell/libshell/src/textwidget.cpp
Expand Up @@ -66,6 +66,16 @@ TextCanvas *TextWidget::targetCanvas() const
return d->canvas;
}

void TextWidget::drawAndShow()
{
if(targetCanvas())
{
draw();
notifyTree(&Widget::draw);
targetCanvas()->show();
}
}

void TextWidget::setRule(RectangleRule *rule)
{
releaseRef(d->rule);
Expand Down

0 comments on commit b2b4f93

Please sign in to comment.