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 _SDR_EVENT_EVENTHANDLER_HXX
21 #define _SDR_EVENT_EVENTHANDLER_HXX
23 #include <sal/types.h>
26 #include <vcl/timer.hxx>
28 //////////////////////////////////////////////////////////////////////////////
38 // typedefs for a list of BaseEvents
39 typedef ::std::vector
< BaseEvent
* > BaseEventVector
;
40 } // end of namespace event
41 } // end of namespace sdr
43 //////////////////////////////////////////////////////////////////////////////
51 // the EventHandler this event is registered at
52 EventHandler
& mrEventHandler
;
56 BaseEvent(EventHandler
& rEventHandler
);
61 // the called method if the event is triggered
62 virtual void ExecuteEvent() = 0;
64 } // end of namespace event
65 } // end of namespace sdr
67 //////////////////////////////////////////////////////////////////////////////
75 BaseEventVector maVector
;
77 // to allow BaseEvents to use the add/remove functionality
78 friend class BaseEvent
;
80 // methods to add/remove events. These are private since
81 // they are used from BaseEvent only.
82 void AddEvent(BaseEvent
& rBaseEvent
);
83 void RemoveEvent(BaseEvent
& rBaseEvent
);
85 // access to a event, 0L when no more events
86 BaseEvent
* GetEvent();
93 virtual ~EventHandler();
95 // Trigger and consume the events
96 virtual void ExecuteEvents();
101 } // end of namespace event
102 } // end of namespace sdr
104 //////////////////////////////////////////////////////////////////////////////
110 class TimerEventHandler
: public EventHandler
, public Timer
113 // basic constructor.
114 TimerEventHandler(sal_uInt32 nTimeout
= 1L);
117 virtual ~TimerEventHandler();
119 // The timer when it is triggered; from class Timer
120 virtual void Timeout();
125 } // end of namespace event
126 } // end of namespace sdr
128 //////////////////////////////////////////////////////////////////////////////
130 #endif //_SDR_EVENT_EVENTHANDLER_HXX
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */