Added is_animating function

This commit is contained in:
Joel Holdsworth 2009-01-09 20:03:55 +00:00
parent 06f2abb6fa
commit 1f73978dd4
2 changed files with 15 additions and 7 deletions

View file

@ -40,7 +40,7 @@ namespace timeline {
TimelineLayoutHelper::TimelineLayoutHelper(TimelineWidget &owner) : TimelineLayoutHelper::TimelineLayoutHelper(TimelineWidget &owner) :
timelineWidget(owner), timelineWidget(owner),
totalHeight(0), totalHeight(0),
is_animating(false) animating(false)
{ {
} }
@ -139,11 +139,17 @@ TimelineLayoutHelper::get_total_height() const
return totalHeight; return totalHeight;
} }
bool
TimelineLayoutHelper::is_animating() const
{
return animating;
}
void void
TimelineLayoutHelper::update_layout() TimelineLayoutHelper::update_layout()
{ {
// Reset the animation state value, before it gets recalculated // Reset the animation state value, before it gets recalculated
is_animating = false; animating = false;
// Clear previously cached layout // Clear previously cached layout
headerBoxes.clear(); headerBoxes.clear();
@ -158,7 +164,7 @@ TimelineLayoutHelper::update_layout()
timelineWidget.on_layout_changed(); timelineWidget.on_layout_changed();
// Begin animating as necessary // Begin animating as necessary
if(is_animating && !animationTimer) if(animating && !animationTimer)
begin_animation(); begin_animation();
} }
@ -203,11 +209,11 @@ TimelineLayoutHelper::layout_headers_recursive(
// Is the track animating? // Is the track animating?
const bool is_track_animating = const bool is_track_animating =
timeline_track->is_expand_animating(); timeline_track->is_expand_animating();
is_animating |= is_track_animating; animating |= is_track_animating;
// Recurse to children // Recurse to children
const bool expand_child = const bool expand_child =
(is_animating || timeline_track->get_expanded()) (animating || timeline_track->get_expanded())
&& parent_expanded; && parent_expanded;
int child_branch_height = layout_headers_recursive( int child_branch_height = layout_headers_recursive(
@ -276,7 +282,7 @@ bool
TimelineLayoutHelper::on_animation_tick() TimelineLayoutHelper::on_animation_tick()
{ {
update_layout(); update_layout();
return is_animating; return animating;
} }
} // namespace timeline } // namespace timeline

View file

@ -135,6 +135,8 @@ public:
**/ **/
int get_total_height() const; int get_total_height() const;
bool is_animating() const;
protected: protected:
/** /**
@ -239,7 +241,7 @@ protected:
* @see update_layout() * @see update_layout()
* @see on_animation_tick() * @see on_animation_tick()
**/ **/
bool is_animating; bool animating;
}; };
} // namespace timeline } // namespace timeline