1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef INCLUDED_SLIDESHOW_WAKEUPEVENT_HXX
29 #define INCLUDED_SLIDESHOW_WAKEUPEVENT_HXX
31 #include <canvas/elapsedtime.hxx>
34 #include "activitiesqueue.hxx"
36 #include <boost/bind.hpp>
37 #include <boost/noncopyable.hpp>
42 /** Little helper class, used to set Activities active again
43 after some sleep period.
45 Clients can use this class to schedule wakeup events at
46 the EventQueue, to avoid busy-waiting for the next
47 discrete time instant.
49 class WakeupEvent
: public Event
,
50 private ::boost::noncopyable
54 ::boost::shared_ptr
< ::canvas::tools::ElapsedTime
> const& pTimeBase
,
55 ActivitiesQueue
& rActivityQueue
);
57 virtual void dispose();
59 virtual bool isCharged() const;
60 virtual double getActivationTime( double nCurrentTime
) const;
62 /// Start the internal timer
65 /** Set the next timeout this object should generate.
68 Absolute time, measured from the last start() call,
69 when this event should wakeup the Activity again. If
70 your time is relative, simply call start() just before
71 every setNextTimeout() call.
73 void setNextTimeout( double nextTime
);
75 /** Set activity to wakeup.
77 The activity given here will be reinserted into the
78 ActivitiesQueue, once the timeout is reached.
80 void setActivity( const ActivitySharedPtr
& rActivity
);
83 ::canvas::tools::ElapsedTime maTimer
;
85 ActivitySharedPtr mpActivity
;
86 ActivitiesQueue
& mrActivityQueue
;
89 typedef ::boost::shared_ptr
< WakeupEvent
> WakeupEventSharedPtr
;
91 } // namespace internal
92 } // namespace presentation
94 #endif /* INCLUDED_SLIDESHOW_WAKEUPEVENT_HXX */
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */