~ubuntu-branches/ubuntu/natty/idesk/natty

« back to all changes in this revision

Viewing changes to src/Timer.h

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Avelar (Fixxxer)
  • Date: 2005-11-02 11:46:39 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051102114639-hqh23701tvjvhwv3
Tags: 0.7.4-1

* New upstream version.
* Many new features (how a complete image background support).
* Support for Esetroot.
* Fixed many other minor bugs. 
* Fixed a problem with the Idesk source (configure.in file) for avoid the xlibs-dev packages dependencies.
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* vim:tabstop=4:expandtab:shiftwidth=4
 
2
 * 
 
3
 * Idesk -- Timer.h
 
4
 *
 
5
 * Copyright (c) 2005, FixXxeR (avelar@gmail.com)
 
6
 * based from Timer.cc (vdesk project) by MrChuoi <mrchuoi at yahoo dot com>
 
7
 * All rights reserved.
 
8
 *
 
9
 * Redistribution and use in source and binary forms, with or without
 
10
 * modification, are permitted provided that the following conditions are met:
 
11
 * 
 
12
 *      Redistributions of source code must retain the above copyright
 
13
 *      notice, this list of conditions and the following disclaimer.
 
14
 *      
 
15
 *      Redistributions in binary form must reproduce the above copyright
 
16
 *      notice, this list of conditions and the following disclaimer in the
 
17
 *      documentation and/or other materials provided with the distribution.
 
18
 *      
 
19
 *      Neither the name of the <ORGANIZATION> nor the names of its
 
20
 *      contributors may be used to endorse or promote products derived from
 
21
 *      this software without specific prior written permission.
 
22
 *
 
23
 * (See the included file COPYING / BSD )
 
24
 */
 
25
 
 
26
#ifndef  TIMER_CLASS
 
27
#define  TIMER_CLASS
 
28
 
 
29
#include <time.h>
 
30
#include "XDesktopContainer.h"
 
31
#include <fcntl.h>
 
32
 
 
33
class TimerControl {
 
34
private:
 
35
        long start;
 
36
        long delay;
 
37
public:
 
38
        void SetDelay( long d ) { delay = d; start = time(0); }
 
39
        long GetDelay( long n ) { return start + delay - n; }
 
40
        void Finish() { start = delay;}
 
41
        long Reset() { start = time(0); return delay; }
 
42
 
 
43
        virtual bool IsOneShot() { return true; }
 
44
        virtual void OnTime() = 0;
 
45
};
 
46
 
 
47
class Timer{
 
48
private:
 
49
        static vector<TimerControl*> items;
 
50
         AbstractContainer * container;
 
51
        int c;
 
52
public:
 
53
        Timer(AbstractContainer * con);
 
54
        void Update();
 
55
public:
 
56
        static void Add( TimerControl *t, long d );
 
57
        static void Remove( TimerControl *t );
 
58
};
 
59
 
 
60
#endif