Esempio n. 1
0
 /// <summary>
 /// マウスの左ボタンでクリックしたときの処理です
 /// </summary>
 /// <param name="mouseEvent"></param>
 protected void OnMouseLeftClick(MouseEvent mouseEvent)
 {
     if (MouseLeftClick != null)
     {
         MouseLeftClick.Invoke(this, mouseEvent);
     }
 }
 /// <summary>Raise the MouseLeftClick event.</summary>
 protected virtual void OnMouseLeftClick(HexEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     DataContext.Model.StartHex = e.Coords;
     MouseLeftClick.Raise(this, e);
     Refresh();
 }
Esempio n. 3
0
 private TrayIcon()
 {
     trayIcon.MouseClick += (p1, p2) =>
     {
         if (p2.Button == MouseButtons.Left)
         {
             MouseLeftClick?.Invoke(p1, p2);
         }
         else if (p2.Button == MouseButtons.Right)
         {
             MouseRightClick?.Invoke(p1, p2);
         }
     };
 }
Esempio n. 4
0
        public NlmTreeListView()
        {
            DisabledHandles = new List <UIntPtr>();

            Margin = new Padding(0);
            Dock   = DockStyle.Fill;

            // Apply look from 3ds Max colour scheme and set ImageList.
            MaxLook.ApplyLook(this);
            NodeClassImageList.Apply(this);

            // Set properties.
            AllowDrop                = true;
            IsSimpleDragSource       = true;
            IsSimpleDropSink         = true;
            FullRowSelect            = true;
            UseAlternatingBackColors = true;
            RowHeight                = 20;
            UseCustomSelectionColors = true;
            HideSelection            = false;
            CellEditActivation       = ObjectListView.CellEditActivateMode.DoubleClick;
            UseFiltering             = true;
            BorderStyle              = BorderStyle.FixedSingle;
            View                               = View.Details;
            OwnerDrawnHeader                   = true;
            RevealAfterExpand                  = false; // After expanding, the expand node moves to the top of the listview. It's kinda jarring so turn it off.
            CanUseApplicationIdle              = false; // 3ds Max appears to completley suppress application idle events.
            DisabledItemStyle                  = new DisabledNodeStyle(this);
            SelectColumnsOnRightClick          = true;
            SelectColumnsOnRightClickBehaviour = ColumnSelectBehaviour.InlineMenu;
            ShowCommandMenuOnRightClick        = false;
            ShowFilterMenuOnRightClick         = false;

            // Instance feature expansion classes.
            TreeColumnRenderer   = new NlmTreeColumnRenderer();
            ColumnHeaderRenderer = new ColumnHeaderRenderer(this);
            NlmColumns           = new NlmColumnCollection(this);
            CellEditValidator    = new CellEditValidator(this);
            MouseLeftClick       = new MouseLeftClick(this);
            ModelFilter          = new NlmTreeNodeFilterEngine(this);
            NodeControl          = new NodeController(this);
            ContextMenu          = new NlmContextMenu(this);

            // Load saved state if it exists
            MaxIO.LoadNlmData(this);

            this.CellEditStarting += new CellEditEventHandler(onBeforeLabelEdit);
        }
Esempio n. 5
0
 protected void MouseEvent(int x1, int y1, int x2, int y2)
 {
     if (MouseInArea(x1, y1, x2, y2))
     {
         if ((NativeMethods.GetAsyncKeyState(KeyCode.MS_Click1) & 1) != 0)
         {
             MouseLeftClick?.Invoke(this);
         }
         else if ((NativeMethods.GetAsyncKeyState(KeyCode.MS_Click2) & 1) != 0)
         {
             MouseRightClick?.Invoke(this);
         }
         else if ((NativeMethods.GetAsyncKeyState(KeyCode.MS_Click1) & 0x8000) != 0)
         {
             MouseMove?.Invoke(this);
         }
     }
 }
Esempio n. 6
0
        public static void DeserializeState(RecallableState S, Boolean ReinstantiatePast)
        {
            if (ReinstantiatePast)
            {
                ScriptProcessor.PastStates.Clear();
                ScriptProcessor.PastStates.Push(S);
            }
            ArrayList         ReconstructEnts = new ArrayList();
            IFormatter        SerFormatter    = new BinaryFormatter();
            SurrogateSelector SS = new SurrogateSelector();

            Surrogates.Vector2SS    V2SS  = new Surrogates.Vector2SS();
            Surrogates.PointSS      PSS   = new Surrogates.PointSS();
            Surrogates.RectangleSS  RSS   = new Surrogates.RectangleSS();
            Surrogates.Texture2DSS  T2DSS = new Surrogates.Texture2DSS();
            Surrogates.ColorSS      CSS   = new Surrogates.ColorSS();
            Surrogates.SpriteFontSS SFSS  = new Surrogates.SpriteFontSS();
            SS.AddSurrogate(typeof(Vector2), new StreamingContext(StreamingContextStates.All), V2SS);
            SS.AddSurrogate(typeof(Point), new StreamingContext(StreamingContextStates.All), PSS);
            SS.AddSurrogate(typeof(Rectangle), new StreamingContext(StreamingContextStates.All), RSS);
            SS.AddSurrogate(typeof(Texture2D), new StreamingContext(StreamingContextStates.All), T2DSS);
            SS.AddSurrogate(typeof(Color), new StreamingContext(StreamingContextStates.All), CSS);
            SS.AddSurrogate(typeof(SpriteFont), new StreamingContext(StreamingContextStates.All), SFSS);
            SerFormatter.SurrogateSelector = SS;
            foreach (byte[] Br in S.SerializedEnts)
            {
                MemoryStream DecodeStream = new MemoryStream(Br);
                WorldEntity  WE           = (WorldEntity)SerFormatter.Deserialize(DecodeStream);
                DecodeStream.Close();
                ReconstructEnts.Add(WE);
            }
            ArrayList NewUEnts = new ArrayList();
            ArrayList NewREnts = new ArrayList();

            foreach (VoidDel V in MouseLeftClick.GetInvocationList())
            {
                MouseLeftClick -= V;
            }
            RunQueue = new ArrayList();
            foreach (WorldEntity W in NonSerializables)
            {
                W.AddEventTriggers();
            }
            ArrayList TempList = new ArrayList();

            foreach (WorldEntity W in DeleteQueue)
            {
                if (NonSerializables.Contains(W))
                {
                    TempList.Add(W);
                }
            }
            DeleteQueue = TempList;
            foreach (WorldEntity W in ReconstructEnts)
            {
                if (S.UpdateIDs.Contains(W.EntityID))
                {
                    NewUEnts.Add(W);
                }
                if (S.RenderIDs.Contains(W.EntityID))
                {
                    NewREnts.Add(W);
                }
                W.ReissueID();
                W.OnDeserializeDo();
            }
            ScriptProcessor.LabelEntity = S.LabelEntity;
            if (ScriptProcessor.SongCom != S.SongCom && S.SongCom != null && S.SongCom.Split('|').Length > 1)
            {
                ScriptProcessor.ActivateScriptElement(S.SongCom);
            }
            if (S.Flags != null)
            {
                Flags = (Hashtable)S.Flags.Clone();
            }
            foreach (WorldEntity W in UpdateQueue)
            {
                if (NonSerializables.Contains(W))
                {
                    NewUEnts.Add(W);
                }
            }
            foreach (WorldEntity W in RenderQueue)
            {
                if (NonSerializables.Contains(W))
                {
                    NewREnts.Add(W);
                }
            }
            UpdateQueue = new ArrayList(NewUEnts);
            RenderQueue = new ArrayList(NewREnts);
            foreach (WorldEntity W in ReconstructEnts)
            {
                W.ResubscribeEvents();
            }
            ButtonScripts.UnHideUI();
        }
Esempio n. 7
0
 private void OccurrenceIcon_MouseLeftClick(object sender, RoutedEventArgs e)
 {
     MouseLeftClick?.Invoke(this, e);
 }
Esempio n. 8
0
 /// <summary>Raise the MouseLeftClic event.</summary>
 protected virtual void OnMouseLeftClick(HexEventArgs e)
 {
     MouseLeftClick.Raise(this, e);
 }
Esempio n. 9
0
 //this gets called by GLFW (unmanaged code)
 private void MouseCallback(int btn, int action, int mods)
 {
     //scroll (3 was chosen by me, not glfw)
     if (btn == 3)
     {
         MouseScrolled.Invoke(action, this);
         MouseScrollDirection = action;
         return;
     }
     //left click
     if (btn == 0 && action == 1)
     {
         if (leftLifted)
         {
             MouseLeftClick.Invoke(MousePosition, this);
             MouseLeftClickScaled.Invoke(MousePositionScaled, this);
             iLastLeft       = MousePosition;
             leftClickToggle = true;
         }
         leftLifted = false;
     }
     if (btn == 0 && action == 0)
     {
         leftLifted = true;
         MouseLeftRelease.Invoke(MousePosition, this);
         MouseLeftReleaseScaled.Invoke(MousePositionScaled, this);
         return;
     }
     //right click
     if (btn == 1 && action == 1)
     {
         if (rightLifted)
         {
             MouseRightClick.Invoke(MousePosition, this);
             MouseRightClickScaled.Invoke(MousePositionScaled, this);
             iLastRight       = MousePosition;
             rightClickToggle = true;
         }
         rightLifted = false;
         return;
     }
     if (btn == 1 && action == 0)
     {
         rightLifted = true;
         MouseRightRelease.Invoke(MousePosition, this);
         MouseRightReleaseScaled.Invoke(MousePositionScaled, this);
         return;
     }
     //middle click
     if (btn == 2 && action == 1)
     {
         if (middleLifted)
         {
             MouseMiddleClick.Invoke(MousePosition, this);
             MouseMiddleClickScaled.Invoke(MousePositionScaled, this);
         }
         middleLifted = false;
         return;
     }
     if (btn == 2 && action == 0)
     {
         middleLifted = true;
         MouseMiddleRelease.Invoke(MousePosition, this);
         MouseMiddleReleaseScaled.Invoke(MousePositionScaled, this);
         return;
     }
 }