Bump version to 6.0-36
[LibreOffice.git] / slideshow / source / inc / activitiesqueue.hxx
blob5dd2f8eeba971518d15a47c6931486673c34ec7f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include <deque>
25 #include "activity.hxx"
26 #include "unoviewcontainer.hxx"
28 #include <canvas/elapsedtime.hxx>
30 #include <memory>
33 /* Definition of ActivitiesQueue class */
35 namespace slideshow
37 namespace internal
39 /** This class handles the XSprite updates needed for
40 animations, such as moves, scales etc. You can add
41 activity objects to this class, which are called in a
42 round-robin fashion.
44 class ActivitiesQueue
46 public:
47 /** Create an ActivitiesQueue.
49 @param pPresTimer
50 Pointer to global presentation timer. Used for
51 adjusting and holding global presentation time.
53 explicit ActivitiesQueue(
54 const std::shared_ptr< ::canvas::tools::ElapsedTime >& pPresTimer );
55 ~ActivitiesQueue();
56 ActivitiesQueue(const ActivitiesQueue&) = delete;
57 ActivitiesQueue& operator=(const ActivitiesQueue&) = delete;
59 /** Add the given activity to the queue.
61 bool addActivity( const ActivitySharedPtr& pActivity );
63 /** Process the activities queue.
65 This method performs the smallest atomic processing
66 possible on the queue (typically, this means one
67 activity get processed).
69 void process();
71 /** Call all dequeued activities' dequeued() method
73 void processDequeued();
75 /** Query state of the queue
77 @return false, if queue is empty, true otherwise
79 bool isEmpty() const;
81 /** Remove all pending activities from the queue.
83 void clear();
85 /** Gets the queue's timer object.
87 std::shared_ptr< ::canvas::tools::ElapsedTime > const &
88 getTimer() const { return mpTimer; }
90 private:
91 std::shared_ptr< ::canvas::tools::ElapsedTime > mpTimer;
93 typedef ::std::deque< ActivitySharedPtr > ActivityQueue;
95 ActivityQueue maCurrentActivitiesWaiting; // currently running
96 // activities, that still
97 // await processing for this
98 // round
100 ActivityQueue maCurrentActivitiesReinsert; // currently running
101 // activities, that are
102 // already processed for
103 // this round, and wants
104 // to be reinserted next
105 // round
107 ActivityQueue maDequeuedActivities; // This list collects all activities which did not request
108 // a reinsertion. After the screen update has been
109 // performed, those are notified via dequeued(). This
110 // facilitates cleanup actions taking place _after_ the
111 // current frame has been displayed.
116 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESQUEUE_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */