// $Source: /usr/local/SimSoft/Sfx3D/src/gts/gtscb.h,v $
// $Revision: 1.2 $
// $Author: baum $
// $Date: 2001/11/29 15:18:10 $
//
// Login name of the user who locked the revision
// $Locker:  $
// Tag name used to checkout the file
// $Name: Release-14 $
// State assigned to revision
// $State: Exp $
//
//
// $Log: gtscb.h,v $
// Revision 1.2  2001/11/29 15:18:10  baum
// -Realzeitsteuerung eingebaut
// -Handsteuerung eingebaut
//

#ifndef _GTSCALLBACK_H
#define _GTSCALLBACK_H 1

#include "DynArray.h"
#include "Vec3D.h"
#include "Angle.h"

#include "XGraph/Wrap.h"
#include "XGraph/Color.h"
#include "XGraph/OGLCB.h"
#include "XGraph/GeoObj.h"
#include "XGraph/ToglView.h"

//==================================================================
//      some definitions	
//	for class GTSCallback
//==================================================================
class GTSCallback;

typedef void (ButtonHandling)  (GTSCallback * who, OGLView* view,
                                int button, int state, int x, int y);

typedef void (MotionHandling)  (GTSCallback * who, OGLView* view,
                                int state, int x, int y);

typedef void (PassiveHandling) (GTSCallback * who, OGLView* view,
                                int x, int y);

//==================================================================
//		Class-Header
//		for class GTSCallback
//==================================================================

class GTSCallback : public OGLViewCallback {
  public:
    // constructor
    GTSCallback ();

    // destructor
    virtual ~GTSCallback     ();

    void setToZooming        ();
    void setToCamera         ();
    void setToObjectMoving   ();
    void setToObjectRotation ();

    void setToNewCombining   ();
    void setToDeleteCombining();
    void setToInfoCombining  ();
    void setToNewRouting     ();
    void setToDeleteRouting  ();
    void setToInfoRouting    ();
    void setToWorkScheduling ();

    void  setMoveStep  (float movestep);
    float getMoveStep  ();
    void  setAngleStep (unsigned anglestep);
    Angle getAngleStep ();

  protected:
    virtual void MouseButtonCB  (OGLView* view, int button, int state, int x, int y);
    virtual void MouseMotionCB  (OGLView* view, int state, int x, int y);
    virtual void MousePassiveCB (OGLView* view, int x, int y);

  private:
           void updateCursor      (OGLView *view, unsigned activ);
           void setActivCursor    (OGLView *view, Ustring cursor);
           void setPassivCursor   (OGLView *view, Ustring cursor);
           void setCursorButton   (GTSCallback* who, OGLView* view, bool down,
                                   Ustring dc1, Ustring dc2, Ustring uc1, Ustring uc2);
           void MenueInfoBaustein (const GeoObject* zgeo);
           void beginZoomRect     (GTSCallback *who, OGLView *view, int x, int y);
           void drawZoomRect      (GTSCallback *who, OGLView *view, int x, int y);
           void endZoomRect       (GTSCallback *who, OGLView *view, int x, int y);
           void beginSelectRect   (GTSCallback *who, OGLView *view, int x, int y);
           void drawSelectRect    (GTSCallback *who, OGLView *view, int x, int y);
           void endSelectRect     (GTSCallback *who, OGLView *view, int x, int y, const bool shift = false);
    static void combInfoButton    (GTSCallback *who, OGLView *view, int button, int state, int x, int y);
    static void combLoescheButton (GTSCallback *who, OGLView *view, int button, int state, int x, int y);
    static void combErzeugeButton (GTSCallback *who, OGLView *view, int button, int state, int x, int y);
    static void routeButtonWithShift (GTSCallback* who, OGLView* view);
    static void routeButton       (GTSCallback *who, OGLView *view,
                                   Ustring art, int meld1, int meld2);
    static void routeInfoButton    (GTSCallback *who, OGLView *view, int button, int state, int x, int y);
    static void routeLoescheButton (GTSCallback *who, OGLView *view, int button, int state, int x, int y);
    static void routeErzeugeButton (GTSCallback *who, OGLView *view, int button, int state, int x, int y);
    static void camButton    (GTSCallback *who, OGLView *view, int button, int state, int x, int y);

    void moveButtonNewObjectSelect (GTSCallback *who, OGLView *view, int button, int state, int x, int y);
    static void moveButton         (GTSCallback *who, OGLView *view, int button, int state, int x, int y);

    static void rotateButton (GTSCallback *who, OGLView *view, int button, int state, int x, int y);
    static void zoomButton   (GTSCallback *who, OGLView *view, int button, int state, int x, int y);

    static void routeMotion  (GTSCallback *who, OGLView *view, int state, int x, int y);
    static void combMotion   (GTSCallback *who, OGLView *view, int state, int x, int y);
           void bewegeKamera (GTSCallback * who, OGLView* view, int state);
    static void camMotion    (GTSCallback *who, OGLView *view, int state, int x, int y);

    void moveMotionWithSelectObject (GTSCallback *who, OGLView *view, int state, int x, int y);
    static void moveMotion          (GTSCallback *who, OGLView *view, int state, int x, int y);

    static void rotateMotion (GTSCallback *who, OGLView *view, int state, int x, int y);
    static void zoomMotion   (GTSCallback *who, OGLView *view, int state, int x, int y);

    static void selectPassive (GTSCallback *who, OGLView *view, int x, int y);

    static Pattern *ClassRedRect;
    static Pattern *ClassBlueRect;

    // data-members
    int             ObjStartX;
    int             ObjStartY;
    int             ObjStartZ;
    Vec3D           ObjStartVec;
    unsigned        ObjCursor;
    Ustring         ObjActivCursor;
    Ustring         ObjPassivCursor;
    double          ObjMoveStep;
    Angle           ObjAngleStep;
    GeoObject       ObjZoomRect;
    GeoObject       *ObjActSelection;
    bool            ObjBoxZeichnen;
    bool            ObjDrehen;
    ButtonHandling  *ObjButtonHandling;
    MotionHandling  *ObjMotionHandling;
    PassiveHandling *ObjPassiveHandling;

    // copy constructor declared, but not defined
    GTSCallback (const GTSCallback&);

    // assignment operator declared, but not defined
    GTSCallback& operator = (const GTSCallback&);
};


#endif // !_GTSCALLBACK_H


