]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/SGPickAnimation.hxx
Standardise location (in XML) of hovered elements.
[simgear.git] / simgear / scene / model / SGPickAnimation.hxx
1 /* -*-c++-*-
2  *
3  * Copyright (C) 2013 James Turner
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18  * MA 02110-1301, USA.
19  *
20  */
21      
22 #ifndef SG_SCENE_PICK_ANIMATION_HXX
23 #define SG_SCENE_PICK_ANIMATION_HXX
24
25 #include <simgear/scene/model/animation.hxx>
26
27 // forward decls
28 class SGPickCallback;
29
30 //////////////////////////////////////////////////////////////////////
31 // Pick animation
32 //////////////////////////////////////////////////////////////////////
33
34 class SGPickAnimation : public SGAnimation {
35 public:
36   SGPickAnimation(const SGPropertyNode* configNode,
37                   SGPropertyNode* modelRoot);
38   virtual osg::Group* createAnimationGroup(osg::Group& parent);
39     
40     
41 protected:
42     void innerSetupPickGroup(osg::Group* commonGroup, osg::Group& parent);
43     
44 private:
45   class PickCallback;
46   class VncCallback;
47 };
48
49
50 class SGKnobAnimation : public SGPickAnimation
51 {
52 public:
53     SGKnobAnimation(const SGPropertyNode* configNode,
54                     SGPropertyNode* modelRoot);
55     virtual osg::Group* createAnimationGroup(osg::Group& parent);
56
57     /**
58      * by default mouse wheel up corresponds to increment (CW)
59      * and mouse-wheel down corresponds to decrement (CCW).
60      * Since no one can agree on that, make it a global toggle.
61      */
62     static void setAlternateMouseWheelDirection(bool aToggle);
63     
64     /**
65      * by default mouse is dragged left-right to change knobs.
66      * set this to true to default to up-down. Individual knobs
67      * can overrider this,
68      */
69     static void setAlternateDragAxis(bool aToggle);
70     
71     
72     /**
73      * Scale the drag sensitivity. This provides a global hook for
74      * the user to scale the senstivity of dragging according to
75      * personal preference.
76      */
77     static void setDragSensitivity(double aFactor);
78 private:
79     class UpdateCallback;
80     
81     SGVec3d _axis;
82     SGVec3d _center;
83     SGSharedPtr<SGExpressiond const> _animationValue;
84 };
85
86 class SGSliderAnimation : public SGPickAnimation
87 {
88 public:
89     SGSliderAnimation(const SGPropertyNode* configNode,
90                     SGPropertyNode* modelRoot);
91     virtual osg::Group* createAnimationGroup(osg::Group& parent);
92     
93 private:
94     class UpdateCallback;
95     
96     SGVec3d _axis;
97     SGSharedPtr<SGExpressiond const> _animationValue;
98 };
99
100 #endif // of SG_SCENE_PICK_ANIMATION_HXX
101