fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / slideshow / source / inc / wakeupevent.hxx
blob4819d42af3f93cc05d1e326b72bf271d86ea2f21
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 .
19 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_WAKEUPEVENT_HXX
20 #define INCLUDED_SLIDESHOW_SOURCE_INC_WAKEUPEVENT_HXX
22 #include <canvas/elapsedtime.hxx>
24 #include "event.hxx"
25 #include "activitiesqueue.hxx"
27 #include <boost/bind.hpp>
28 #include <boost/noncopyable.hpp>
30 namespace slideshow {
31 namespace internal {
33 /** Little helper class, used to set Activities active again
34 after some sleep period.
36 Clients can use this class to schedule wakeup events at
37 the EventQueue, to avoid busy-waiting for the next
38 discrete time instant.
40 class WakeupEvent : public Event,
41 private ::boost::noncopyable
43 public:
44 WakeupEvent(
45 ::boost::shared_ptr< ::canvas::tools::ElapsedTime > const& pTimeBase,
46 ActivitiesQueue & rActivityQueue );
48 virtual void dispose() SAL_OVERRIDE;
49 virtual bool fire() SAL_OVERRIDE;
50 virtual bool isCharged() const SAL_OVERRIDE;
51 virtual double getActivationTime( double nCurrentTime ) const SAL_OVERRIDE;
53 /// Start the internal timer
54 void start();
56 /** Set the next timeout this object should generate.
58 @param nextTime
59 Absolute time, measured from the last start() call,
60 when this event should wakeup the Activity again. If
61 your time is relative, simply call start() just before
62 every setNextTimeout() call.
64 void setNextTimeout( double nextTime );
66 /** Set activity to wakeup.
68 The activity given here will be reinserted into the
69 ActivitiesQueue, once the timeout is reached.
71 void setActivity( const ActivitySharedPtr& rActivity );
73 private:
74 ::canvas::tools::ElapsedTime maTimer;
75 double mnNextTime;
76 ActivitySharedPtr mpActivity;
77 ActivitiesQueue& mrActivityQueue;
80 typedef ::boost::shared_ptr< WakeupEvent > WakeupEventSharedPtr;
82 } // namespace internal
83 } // namespace presentation
85 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_WAKEUPEVENT_HXX
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */