KrisLibrary  1.0.0
SphereWidget.h
1 #ifndef GLDRAW_SPHERE_WIDGET_H
2 #define GLDRAW_SPHERE_WIDGET_H
3 
4 #include "Widget.h"
5 #include "TransformWidget.h"
6 #include <KrisLibrary/math3d/Sphere3D.h>
7 
8 namespace GLDraw {
9 
10 class SphereWidget : public Widget
11 {
12  public:
13  SphereWidget(const Sphere3D& s);
14  void Get(Sphere3D& s) const;
15  virtual ~SphereWidget() {}
16  virtual bool Hover(int x,int y,Camera::Viewport& viewport,double& distance);
17  virtual bool BeginDrag(int x,int y,Camera::Viewport& viewport,double& distance);
18  virtual void Drag(int dx,int dy,Camera::Viewport& viewport);
19  virtual void EndDrag();
20  virtual void DrawGL(Camera::Viewport& viewport);
21  virtual void SetHighlight(bool value);
22  virtual void SetFocus(bool value);
23 
24  Real radius;
25  TransformWidget transformWidget; //<this widget handles the center translation and rotation changes
26 
27  //editor settings
28  GLColor sphereColor,ringColor;
29  Real ringWidth;
30  bool scaleToScreen;
31 
32  //state
33  int hoverItem; //< -1: nothing, 0: center, 1: ring
34  Vector3 hoverPos;
35  int clickX,clickY,dragX,dragY;
36  Vector3 clickPos;
37  Real clickDistance;
38  Real clickStartRadius;
39 };
40 
41 } //namespace GLDraw
42 
43 #endif
Definition: SphereWidget.h:10
Base class for a visual widget.
Definition: Widget.h:16
A 3D vector class.
Definition: math3d/primitives.h:136
A 3D sphere class.
Definition: Sphere3D.h:21
A class containing viewport / camera information. This uses OpenGL coordinate convention in which x i...
Definition: viewport.h:11
Contains all definitions in the GLDraw package.
Definition: AnyGeometry.h:14
An rgba color.
Definition: GLColor.h:9
Definition: TransformWidget.h:8