#ifndef QEVENT_H_
#define QEVENT_H_
#include "KWQNamespace.h"
#include "KWQRegion.h"
#include "KWQPointArray.h"
#include "KWQString.h"
class QEvent : public Qt {
public:
enum Type {
None,
Enter,
Leave,
Timer,
MouseButtonPress,
MouseButtonRelease,
MouseButtonDblClick,
MouseMove,
FocusIn,
FocusOut,
AccelAvailable,
KeyPress,
KeyRelease,
Paint,
Resize
};
QEvent( Type t ) : _type(t) {}
virtual ~QEvent();
Type type() const { return _type; }
private:
QEvent(const QEvent &);
QEvent &operator=(const QEvent &);
Type _type;
};
class QMouseEvent : public QEvent {
public:
QMouseEvent(Type type, const QPoint &pos, int button, int state);
QMouseEvent(Type type, const QPoint &pos, int button, int state, int clickCount);
QMouseEvent(Type type, const QPoint &pos, const QPoint &global, int button, int state);
int x() { return _position.x(); }
int y() { return _position.y(); }
int globalX() { return _position.x(); } int globalY() { return _position.y(); } const QPoint &pos() const { return _position; }
ButtonState button() { return _button; }
ButtonState state() { return _state; }
ButtonState stateAfter();
int clickCount() { return _clickCount; }
private:
QPoint _position;
ButtonState _button;
ButtonState _state;
int _clickCount;
};
class QTimerEvent : public QEvent {
public:
QTimerEvent(int timerId);
int timerId() const { return _timerId; }
private:
int _timerId;
};
class QKeyEvent : public QEvent {
public:
QKeyEvent(Type type, int key, int ascii, int buttonState, const QString &textVal = QString::null, bool autoRepeat = FALSE, ushort countVal = 1);
int key() const;
ButtonState state() const;
void accept();
void ignore();
bool isAutoRepeat() const;
bool isAccepted() const;
int count() const;
QString text() const;
int ascii() const;
private:
int _key;
int _ascii;
ButtonState _state;
QString _text;
bool _autoRepeat;
int _count;
bool _isAccepted;
};
class QFocusEvent : public QEvent {
public:
enum Reason { Popup, Other };
static Reason reason() { return Other; }
QFocusEvent (Type type) : QEvent (type) {}
};
class QHideEvent;
class QShowEvent;
class QWheelEvent;
class QContextMenuEvent;
class QResizeEvent : public QEvent {
public:
QResizeEvent() : QEvent(Resize) {}
};
class QCustomEvent : public QEvent {
public:
QCustomEvent(Type type, void *data = 0) : QEvent(type), d(data) { }
void *data() const { return d; }
void setData(void *data) { d = data; }
private:
void *d;
};
#endif