

#ifndef _analogck_h_ /* Thu Feb 20 10:16:35 1997 */
#define _analogck_h_

// This is a visual object that draws a rudimentary analog clock, with a date
// displayed. This object also provides a simple alarm facility.

#include "ui/timer.h"
#include "ui/bitmap.h"
#include "ui/canvas.h"

#include "base/timeofda.h"
#include "base/map.h"

class AnalogClock: public UI_Canvas {

public:
    AnalogClock (UI_VisualObject* parent, const UI_Rectangle&
                shape, UI_ViewID id);

    void SetAlarm (const CL_TimeOfDay& time,
                   const CL_AbstractBinding& binding);
    // Tell this clock to execute the given binding at the given time.
    
    const char* ClassName () const { return "AnalogClock";};

    
protected:
    ~AnalogClock ();
    
    void Initialize ();

    void Finalize ();
    
    bool _ShapeRectChanged ();
    
    bool Paint (const UI_Rectangle&);

    bool Update ();

    void _DoDraw (UI_DrawingSurface& sfc, const CL_TimeOfDay& time);
    
    CL_Binding0<AnalogClock>  _bind;
    UI_Timer                  _timer;
    UI_Bitmap*                _bitmap;
    CL_GenericMap             _alarmMap;
};


#endif /* _analogck_h_ */
