1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
25 #include "activity.hxx"
26 #include "unoviewcontainer.hxx"
28 #include <canvas/elapsedtime.hxx>
30 #include <boost/shared_ptr.hpp>
31 #include <boost/utility.hpp>
34 /* Definition of ActivitiesQueue class */
40 /** This class handles the XSprite updates needed for
41 animations, such as moves, scales etc. You can add
42 activity objects to this class, which are called in a
45 class ActivitiesQueue
: private ::boost::noncopyable
48 /** Create an ActivitiesQueue.
51 Pointer to global presentation timer. Used for
52 adjusting and holding global presentation time.
55 const ::boost::shared_ptr
< ::canvas::tools::ElapsedTime
>& pPresTimer
);
58 /** Add the given activity to the queue.
60 bool addActivity( const ActivitySharedPtr
& pActivity
);
62 /** Process the activities queue.
64 This method performs the smallest atomic processing
65 possible on the queue (typically, this means one
66 activity get processed).
70 /** Call all dequeued activities' dequeued() method
72 void processDequeued();
74 /** Query state of the queue
76 @return false, if queue is empty, true otherwise
80 /** Remove all pending activities from the queue.
84 /** Gets the queue's timer object.
86 ::boost::shared_ptr
< ::canvas::tools::ElapsedTime
> const &
87 getTimer() const { return mpTimer
; }
89 /** returns number of all activities, waiting, reinserted and dequeued
91 std::size_t size() const
93 return maCurrentActivitiesWaiting
.size() + maCurrentActivitiesReinsert
.size() + maDequeuedActivities
.size();
97 ::boost::shared_ptr
< ::canvas::tools::ElapsedTime
> mpTimer
;
99 typedef ::std::deque
< ActivitySharedPtr
> ActivityQueue
;
101 ActivityQueue maCurrentActivitiesWaiting
; // currently running
102 // activities, that still
103 // await processing for this
106 ActivityQueue maCurrentActivitiesReinsert
; // currently running
107 // activities, that are
108 // already processed for
109 // this round, and wants
110 // to be reinserted next
113 ActivityQueue maDequeuedActivities
; // This list collects all activities which did not request
114 // a reinsertion. After the screen update has been
115 // performed, those are notified via dequeued(). This
116 // facilitates cleanup actions taking place _after_ the
117 // current frame has been displayed.
122 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */