#include <oaf-factory.idl>

module SandUhr {
 
  interface Timer;

  interface AlarmAction {
    exception DeliveryFailed {
      string Reason;
    };

    readonly attribute boolean NeedsPopup;

    void Attach (in Timer T);
    void Detach (in Timer T);
    void Deliver (in string TimeSpec, in string Message)
						raises (DeliveryFailed);
  };

  interface AlarmBeep: AlarmAction {
    attribute unsigned short Count;
  };

  interface AlarmSound: AlarmAction {
    attribute string SoundFile;
  };

  interface AlarmCommand: AlarmAction {
    attribute string CommandString;
  };


  interface Timer {
    exception NotRunning { };

    enum TimerState { TSPrepare, TSRunning, TSDone };
    readonly attribute TimerState State;

    attribute string TimeSpec;
    attribute string Message;
    attribute AlarmAction Alarm;

    struct Color {
      unsigned short Red, Green, Blue;
    };
    attribute Color SandColor;

    attribute boolean WindowDecorations;

    enum Layer { LayerDesktop, LayerBelow, LayerNormal, LayerOntop };
    attribute Layer WindowLayer;

    void Destroy ();
    unsigned long TimeLeft () raises (NotRunning);
  };


  interface TimerFactory: GNOME::ObjectFactory {
    exception InvalidTime { };

    AlarmBeep CreateAlarmBeep (in unsigned short Count);
    AlarmSound CreateAlarmSound (in string SoundFile);
    AlarmCommand CreateAlarmCommand (in string CommandString);

    Timer CreateTimer (in string TimeSpec, in string Message)
						raises (InvalidTime);

    typedef sequence<Timer> TimerVec;
    readonly attribute TimerVec Timers;

    void ShowControl (in boolean Show);
  };

};
