/Primitive/MainApp/crosshair.h

https://bitbucket.org/flexcomputer/primitive · C Header · 50 lines · 35 code · 12 blank · 3 comment · 0 complexity · bf591017c09aad456dd99faa64326715 MD5 · raw file

  1. #ifndef CROSSHAIR_H
  2. #define CROSSHAIR_H
  3. #include <QObject>
  4. #include <QPainter>
  5. // The crosshair class
  6. class Crosshair : public QObject
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit Crosshair(QObject *parent = 0);
  11. // States
  12. enum State {
  13. MainSelect = 0,
  14. PickPoint = 1,
  15. SelectObject = 2,
  16. Hidden = 3
  17. };
  18. // Get/set functions
  19. virtual int x() const { return _x; }
  20. virtual int y() const { return _y; }
  21. virtual QString prompt() const { return _prompt; }
  22. virtual State state() const { return _state; }
  23. virtual bool showPrompt() const { return _showPrompt; }
  24. virtual void setX(int x) { _x = x; }
  25. virtual void setY(int y) { _y = y; }
  26. virtual void setPrompt(QString prompt) { _prompt = prompt; }
  27. virtual void setState(State state) { _state = state; }
  28. virtual void setShowPrompt(bool show = true) { _showPrompt = show; }
  29. virtual void paintAt(QPainter& painter);
  30. protected:
  31. int _x, _y; // The position of the crosshair
  32. QString _prompt; // The crosshair's prompt
  33. State _state; // The crosshair's state
  34. bool _showPrompt; // True - draw the prompt
  35. signals:
  36. public slots:
  37. };
  38. #endif // CROSSHAIR_H