// ------------------
        public void Draw(TouchGestureStateBinding bind, TouchGestureConfig config, InputRig rig)
        {
            bool bindingEnabled = bind.enabled;


            //EditorGUILayout.BeginVertical();

            //if (bindingEnabled = EditorGUILayout.ToggleLeft(this.labelContent, bindingEnabled, GUILayout.MinWidth(30), GUILayout.ExpandWidth(true)))
            //	{
            //	CFGUI.BeginIndentedVertical();

            if (InspectorUtils.BeginIndentedCheckboxSection(this.labelContent, ref bindingEnabled))
            {
                InspectorUtils.BeginIndentedSection(new GUIContent("Press bindings"));

                this.rawPressBinding.Draw(bind.rawPressBinding, rig);
                this.rawPressMousePosBindingInsp.Draw(bind.rawPressMousePosBinding, rig);
                EditorGUILayout.Space();

                this.normalPressBinding.Draw(bind.normalPressBinding, rig);
                this.normalPressMousePosBindingInsp.Draw(bind.normalPressMousePosBinding, rig);
                EditorGUILayout.Space();

                if ((config == null) || config.detectLongPress)
                {
                    this.longPressBinding.Draw(bind.longPressBinding, rig);
                    this.longPressMousePosBindingInsp.Draw(bind.longPressMousePosBinding, rig);
                }

                EditorGUILayout.Space();

                this.rawPressEmuTouchInsp.Draw(bind.rawPressEmuTouchBinding, rig);
                this.normalPressEmuTouchInsp.Draw(bind.normalPressEmuTouchBinding, rig);

                if ((config == null) || config.detectLongPress)
                {
                    this.longPressEmuTouchInsp.Draw(bind.longPressEmuTouchBinding, rig);
                }


                InspectorUtils.EndIndentedSection();

                if ((config == null) || (config.maxTapCount >= 1) || (config.detectLongTap))
                {
                    InspectorUtils.BeginIndentedSection(new GUIContent("Tap bindings"));

                    if ((config == null) || (config.maxTapCount >= 1))
                    {
                        this.tapBinding.Draw(bind.tapBinding, rig);
                        this.tapMousePosBindingInsp.Draw(bind.tapMousePosBinding, rig);
                        EditorGUILayout.Space();
                    }

                    if ((config == null) || (config.maxTapCount >= 2))
                    {
                        this.doubleTapBinding.Draw(bind.doubleTapBinding, rig);
                        this.doubleTapMousePosBindingInsp.Draw(bind.doubleTapMousePosBinding, rig);
                        EditorGUILayout.Space();
                    }


                    if ((config == null) || (config.detectLongPress && config.detectLongTap))
                    {
                        this.longTapBinding.Draw(bind.longTapBinding, rig);
                        this.longTapMousePosBindingInsp.Draw(bind.longTapMousePosBinding, rig);
                        EditorGUILayout.Space();
                    }

                    InspectorUtils.EndIndentedSection();
                }


                InspectorUtils.BeginIndentedSection(new GUIContent("Swipe bindings"));

                this.normalPressSwipeHorzAxisBinding.Draw(bind.normalPressSwipeHorzAxisBinding, rig);
                this.normalPressSwipeVertAxisBinding.Draw(bind.normalPressSwipeVertAxisBinding, rig);
                this.normalPressSwipeMousePosBindingInsp.Draw(bind.normalPressSwipeMousePosBinding, rig);
                this.normalPressSwipeDirBinding.Draw(bind.normalPressSwipeDirBinding, rig);
                this.normalPressSwipeJoyBinding.Draw(bind.normalPressSwipeJoyBinding, rig);

                if ((config == null) || config.detectLongPress)
                {
                    this.longPressSwipeHorzAxisBinding.Draw(bind.longPressSwipeHorzAxisBinding, rig);
                    this.longPressSwipeVertAxisBinding.Draw(bind.longPressSwipeVertAxisBinding, rig);
                    this.longPressSwipeMousePosBindingInsp.Draw(bind.longPressSwipeMousePosBinding, rig);
                    this.longPressSwipeDirBinding.Draw(bind.longPressSwipeDirBinding, rig);
                    this.longPressSwipeJoyBinding.Draw(bind.longPressSwipeJoyBinding, rig);
                }

                InspectorUtils.EndIndentedSection();

                InspectorUtils.BeginIndentedSection(new GUIContent("Scroll bindings"));
                this.normalPressScrollHorzBinding.Draw(bind.normalPressScrollHorzBinding, rig);
                this.normalPressScrollVertBinding.Draw(bind.normalPressScrollVertBinding, rig);

                if ((config == null) || config.detectLongPress)
                {
                    this.longPressScrollHorzBinding.Draw(bind.longPressScrollHorzBinding, rig);
                    this.longPressScrollVertBinding.Draw(bind.longPressScrollVertBinding, rig);
                }
                InspectorUtils.EndIndentedSection();



                if (this.customPostGUICallback != null)
                {
                    InspectorUtils.BeginIndentedSection(new GUIContent("Other"));

                    this.customPostGUICallback();

                    InspectorUtils.EndIndentedSection();
                }


                InspectorUtils.EndIndentedSection();
                //CFGUI.EndIndentedVertical();
                //GUILayout.Space(InputBindingGUIUtils.VERT_MARGIN);
            }

            //EditorGUILayout.EndVertical();



            if ((bindingEnabled != bind.enabled))
            {
                CFGUI.CreateUndo("Touch Binding modification.", this.undoObject);

                bind.enabled = bindingEnabled;

                CFGUI.EndUndo(this.undoObject);
            }
        }
        // ---------------
        public void DrawGUI(TouchGestureConfig config)
        {
            int
                maxTapCount = config.maxTapCount;
            bool
                cleanTapsOnly          = config.cleanTapsOnly,
                detectLongTap          = config.detectLongTap,
                detectLongPress        = config.detectLongPress,
                endLongPressWhenMoved  = config.endLongPressWhenMoved,
                endLongPressWhenSwiped = config.endLongPressWhenSwiped;

            TouchGestureConfig.DirMode
                dirMode = config.dirMode;
            TouchGestureConfig.DirConstraint
                swipeConstraint    = config.swipeConstraint,
                swipeDirConstraint = config.swipeDirConstraint,
                scrollConstraint   = config.scrollConstraint;
            DirectionState.OriginalDirResetMode
                swipeOriginalDirResetMode = config.swipeOriginalDirResetMode;



            // GUI...


            InspectorUtils.BeginIndentedSection(this.titleContent);

            maxTapCount = CFGUI.IntSlider(new GUIContent("Max Number of Taps", "Maximal number of consecutive taps to detect.\nWhen \'Report All Taps\' option is turned off, system will wait for potential follow-up taps so they may be reported with slight delay."),
                                          maxTapCount, 0, 5, LABEL_WIDTH);

            dirMode = (TouchGestureConfig.DirMode)CFGUI.EnumPopup(new GUIContent("Swipe Dir. Mode", "Swipe Segmwnt Direction Mode"), dirMode, LABEL_WIDTH);

            swipeOriginalDirResetMode = (DirectionState.OriginalDirResetMode)CFGUI.EnumPopup(new GUIContent("Swipe Dir. Reset Mode", "Swipe Segment's Original Direction Reset Mode - choose when original direction is reset. This option is used by Direction Binding in ORIGINAL group modes..."),
                                                                                             swipeOriginalDirResetMode, LABEL_WIDTH);

            swipeDirConstraint = (TouchGestureConfig.DirConstraint)CFGUI.EnumPopup(new GUIContent("Scroll Dir Constraint", "Scroll Direction Constraint Mode"), swipeDirConstraint, LABEL_WIDTH);
            swipeConstraint    = (TouchGestureConfig.DirConstraint)CFGUI.EnumPopup(new GUIContent("Swipe Constraint", "Swipe Constraint Mode"), swipeConstraint, LABEL_WIDTH);
            scrollConstraint   = (TouchGestureConfig.DirConstraint)CFGUI.EnumPopup(new GUIContent("Scroll Constraint", "Scroll Constraint Mode"), scrollConstraint, LABEL_WIDTH);

            cleanTapsOnly = EditorGUILayout.ToggleLeft(new GUIContent("Clean Taps Only", "When turned on, only clean taps will be reported."),
                                                       cleanTapsOnly);

            detectLongPress = EditorGUILayout.ToggleLeft(new GUIContent("Detect Long Press",
                                                                        "Long Press is a static touch (tap threshold) pressed for some time (Long Press Min. Duration)."),
                                                         detectLongPress);

            if (detectLongPress)
            {
                detectLongTap = EditorGUILayout.ToggleLeft(new GUIContent("Detect Long Tap", ""),
                                                           detectLongTap);


                endLongPressWhenMoved = EditorGUILayout.ToggleLeft(new GUIContent("End Long Press When Moved", "End Long Press (and start Normal Press) when touch moved past the Tap Threshold."),
                                                                   endLongPressWhenMoved);
                endLongPressWhenSwiped = EditorGUILayout.ToggleLeft(new GUIContent("End Long Press When Swiped", "End Long Press (and start Normal Press) when touch moved past the Swipe Threshold."),
                                                                    endLongPressWhenSwiped);
            }

            InspectorUtils.EndIndentedSection();


            // Register Undo...

            if ((maxTapCount != config.maxTapCount) ||
                (cleanTapsOnly != config.cleanTapsOnly) ||
                (detectLongTap != config.detectLongTap) ||
                (detectLongPress != config.detectLongPress) ||
                (dirMode != config.dirMode) ||
                (swipeConstraint != config.swipeConstraint) ||
                (swipeDirConstraint != config.swipeDirConstraint) ||
                (scrollConstraint != config.scrollConstraint) ||
                (swipeOriginalDirResetMode != config.swipeOriginalDirResetMode) ||
                (endLongPressWhenSwiped != config.endLongPressWhenSwiped) ||
                (endLongPressWhenMoved != config.endLongPressWhenMoved))
            {
                CFGUI.CreateUndo("Gesture Config modification", this.undoObject);

                config.dirMode            = dirMode;
                config.swipeConstraint    = swipeConstraint;
                config.swipeDirConstraint = swipeDirConstraint;
                config.scrollConstraint   = scrollConstraint;

                config.maxTapCount               = maxTapCount;
                config.cleanTapsOnly             = cleanTapsOnly;
                config.detectLongPress           = detectLongPress;
                config.detectLongTap             = detectLongTap;
                config.endLongPressWhenMoved     = endLongPressWhenMoved;
                config.endLongPressWhenSwiped    = endLongPressWhenSwiped;
                config.swipeOriginalDirResetMode = swipeOriginalDirResetMode;


                CFGUI.EndUndo(this.undoObject);
            }
        }