Skip to content

Commit

Permalink
Client|ScrollAreaWidget: Setting content size using rules
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jun 15, 2013
1 parent 34b92d9 commit a5d171a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doomsday/client/include/ui/widgets/scrollareawidget.h
Expand Up @@ -45,6 +45,8 @@ class ScrollAreaWidget : public GuiWidget

void setContentWidth(int width);
void setContentHeight(int height);
void setContentWidth(de::Rule const &width);
void setContentHeight(de::Rule const &height);
void setContentSize(de::Vector2i const &size);

void modifyContentWidth(int delta);
Expand Down
15 changes: 14 additions & 1 deletion doomsday/client/src/ui/widgets/scrollareawidget.cpp
Expand Up @@ -159,12 +159,24 @@ void ScrollAreaWidget::setContentWidth(int width)
d->contentRule.setInput(Rule::Width, Const(width));
}

void ScrollAreaWidget::setContentWidth(Rule const &width)
{
DENG2_GUARD(d);
d->contentRule.setInput(Rule::Width, width);
}

void ScrollAreaWidget::setContentHeight(int height)
{
DENG2_GUARD(d);
d->contentRule.setInput(Rule::Height, Const(height));
}

void ScrollAreaWidget::setContentHeight(Rule const &height)
{
DENG2_GUARD(d);
d->contentRule.setInput(Rule::Height, height);
}

void ScrollAreaWidget::setContentSize(Vector2i const &size)
{
DENG2_GUARD(d);
Expand Down Expand Up @@ -316,7 +328,8 @@ bool ScrollAreaWidget::handleEvent(Event const &event)
if(mouse.wheelMotion() == MouseEvent::FineAngle)
{
d->y->set(de::clamp(0, int(d->y->animation().target()) +
mouse.wheel().y / 2, d->maxY->valuei()), .05f);
mouse.wheel().y / 2 * (d->origin == Top? -1 : 1),
d->maxY->valuei()), .05f);
d->restartScrollOpacityFade();
}
return true;
Expand Down

0 comments on commit a5d171a

Please sign in to comment.