summaryrefslogtreecommitdiffstats
path: root/tools/worldbuilder/code/contexts/locatorcontext.h
blob: a785b8ca45702b62e56431f68c8fee290f44b530 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "precompiled/PCH.h"

#ifndef LOCATOR_CONTEXT
#define LOCATOR_CONTEXT

//----------------------------------------
// System Includes
//----------------------------------------
#include <..\..\..\game\code\meta\locatortypes.h>
#include <..\..\..\game\code\meta\locatorevents.h>

//----------------------------------------
// Forward References
//----------------------------------------

//-----------------------------------------------------------------------------
//
// L o c a t o r C o n t e x t
//
//-----------------------------------------------------------------------------
class LocatorContext : public MPxContext
{
    public:

        enum Stimulus       // Maskable values.
        {
            BUTTONDOWN      = 0x0001,
            BUTTONUP        = 0x0002,
            MOUSEDRAG       = 0x0004,
            COMPLETED       = 0x0008,
            DELETED         = 0x0010,
            ABORTED         = 0x0020
        };
            

                        LocatorContext();
        virtual        ~LocatorContext();

        static const char* stringId;

        virtual void    toolOnSetup( MEvent& );
        virtual void    toolOffCleanup();
        virtual MStatus doPress( MEvent& );
        virtual MStatus doDrag( MEvent& );
        virtual MStatus doRelease( MEvent& event );
        virtual MStatus doHold( MEvent& event );
        virtual MStatus doEnterRegion( MEvent& event );
        virtual void    deleteAction();
        virtual void    completeAction();
        virtual void    abortAction();

    private:
        void    ProcessState( Stimulus stimulus );
        void    SetHelpString();
        void    InitLocator();

        MString     mHelp;
        
        short       mXCurrent, mYCurrent;
        short       mXDrag, mYDrag;
        MObject     mLocator;
        MObject     mLocatorTransform;
        
        static LocatorType::Type mLastLocatorType;
        static LocatorEvent::Event mLastEvent;
};

//-----------------------------------------------------------------------------
//
// I n t e r s e c t i o n C o n t e x t C m d
//
//-----------------------------------------------------------------------------
class LocatorContextCmd : public MPxContextCommand
{
    public:
                                LocatorContextCmd();
        virtual                ~LocatorContextCmd();
                                
        static  void*           creator();

        virtual MPxContext*     makeObj();

    private:
};

#endif