/*$cb
 *    This file is a part of libopenmhp.
 *
 *    Copyright (C) 2005 Mikko Novaro <miknov@gmail.com>
 *
 *    See main header file (libopenmhp/openmhp.h) for licensing and
 *    contact information.
 $ce*/

#ifndef XLET_EVENT_HPP
#define XLET_EVENT_HPP

enum eEventType {
  IMAGE_UPDATE = 0,
  VIDEO_SCALE = 1
};

// Number of event types. Update when adding new events.
#define EVENT_TYPE_CNT 2

class cXletEvent {
public:
  cXletEvent(void);
  // just a tag...
};

/* Interface for generic event observer. Event type and cXletEvent
 * object are passed when event occures, and receiver should make type
 * cast to the actual event class as needed. */
class cXletEventObserver {
public:
  /* Callback function for received xlet events. The same single
     instance of an event is passed to each observer. The observer
     should assume that the event object is available only during the
     EventReceived call, and thus any information required later
     should be copied to the observer internally. The observer must
     not de-allocate the event object. */
  virtual void EventReceived(eEventType type, const cXletEvent *event) = 0;
};

// ------------------- ACTUAL EVENT CLASSES --------------------------

class cImageUpdateEvent : public cXletEvent {
public:
  int layerindex;
  cImageUpdateEvent(int layerIndex);
  ~cImageUpdateEvent(void);
};

class cVideoScaleEvent : public cXletEvent {
public:
  int posx, posy, width, height;
  cVideoScaleEvent(int PosX, int PosY, int Width, int Height);
  ~cVideoScaleEvent(void);
};

#endif
