コード例 #1
0
 /// <summary>
 /// Creates a debug string for spamming the display with too much information
 /// </summary>
 /// <returns>A formatted debug string</returns>
 public override string ToString()
 {
     return
         ("CurrentColumn: " + CurrentColumn.ToString() + "\n" +
          "CurrentRow:" + CurrentRow.ToString() + "\n" +
          "ApplicationCursorKeysMode:" + ApplicationCursorKeysMode.ToString() + "\n" +
          "Attribute:\n" + Attributes.ToString() + "\n" +
          "TabStops:" + string.Join(",", TabStops.Select(x => x.ToString()).ToList()) + "\n" +
          "WordWrap:" + WordWrap.ToString() + "\n" +
          "ReverseVideoMode:" + ReverseVideoMode.ToString() + "\n" +
          "OriginMode:" + OriginMode.ToString() + "\n" +
          "InsertMode:" + InsertMode.ToString() + "\n" +
          "ShowCursor:" + ShowCursor.ToString() + "\n" +
          "BlinkingCursor:" + BlinkingCursor.ToString() + "\n" +
          "CursorShape:" + CursorShape.ToString() + "\n" +
          "Utf8:" + Utf8.ToString() + "\n" +
          "CharacterSetMode:" + CharacterSetMode.ToString() + "\n" +
          "G0:" + G0.ToString() + "\n" +
          "G1:" + G1.ToString() + "\n" +
          "G2:" + G2.ToString() + "\n" +
          "G3:" + G3.ToString() + "\n" +
          "Vt300G1:" + Vt300G1.ToString() + "\n" +
          "Vt300G2:" + Vt300G2.ToString() + "\n" +
          "Vt300G3:" + Vt300G3.ToString() + "\n" +
          "Vt52AlternateKeypad: " + Vt52AlternateKeypad.ToString() + "\n" +
          "Vt52GraphicsMode: " + Vt52GraphicsMode.ToString() + "\n" +
          "AutomaticNewLine:" + AutomaticNewLine.ToString() + "\n" +
          "ConfiguredColumns:" + ConfiguredColumns.ToString() + "\n" +
          "National Character Replacement Mode:" + NationalCharacterReplacementMode.ToString() + "\n" +
          "Single shift character mode:" + SingleShiftSelectCharacterMode.ToString() + "\n"
         );
 }
コード例 #2
0
ファイル: GLFW.cs プロジェクト: PlumpMath/CSharpGameLibrary
        public static Cursor CreateCursor(CursorShape shape)
        {
            var result = glfwCreateStandardCursor(shape);

            CheckError();
            return(result);
        }
コード例 #3
0
ファイル: VkWindow.cs プロジェクト: jpbruyere/vke.net
 /// <summary>
 /// Set current mouse cursor in the GLFW window.
 /// </summary>
 /// <param name="cursor">New mouse cursor to set.</param>
 public void SetCursor(CursorShape cursor)
 {
     if (currentCursor != IntPtr.Zero)
     {
         Glfw3.DestroyCursor(currentCursor);
     }
     currentCursor = Glfw3.CreateStandardCursor(cursor);
     Glfw3.SetCursor(hWin, currentCursor);
 }
コード例 #4
0
ファイル: GLFWNative.cs プロジェクト: voltairianman/opentk
 public static extern Cursor *glfwCreateStandardCursor(CursorShape shape);
コード例 #5
0
ファイル: GdkExtensions.cs プロジェクト: mfcallahan/Pinta
        /// <summary>
        /// Create a cursor icon with a shape that visually represents the tool's thickness.
        /// </summary>
        /// <param name="imgName">A string containing the name of the tool's icon image to use.</param>
        /// <param name="shape">The shape to draw.</param>
        /// <param name="shapeWidth">The width of the shape.</param>
        /// <param name="imgToShapeX">The horizontal distance between the image's top-left corner and the shape center.</param>
        /// <param name="imgToShapeY">The verical distance between the image's top-left corner and the shape center.</param>
        /// <param name="shapeX">The X position in the returned Pixbuf that will be the center of the shape.</param>
        /// <param name="shapeY">The Y position in the returned Pixbuf that will be the center of the shape.</param>
        /// <returns>The new cursor icon with an shape that represents the tool's thickness.</returns>
        public static Gdk.Pixbuf CreateIconWithShape(string imgName, CursorShape shape, int shapeWidth,
                                                     int imgToShapeX, int imgToShapeY,
                                                     out int shapeX, out int shapeY)
        {
            Gdk.Pixbuf img = PintaCore.Resources.GetIcon(imgName);

            double zoom = 1d;

            if (PintaCore.Workspace.HasOpenDocuments)
            {
                zoom = Math.Min(30d, PintaCore.Workspace.ActiveDocument.Workspace.Scale);
            }

            shapeWidth = (int)Math.Min(800d, ((double)shapeWidth) * zoom);
            int halfOfShapeWidth = shapeWidth / 2;

            // Calculate bounding boxes around the both image and shape
            // relative to the image top-left corner.
            Gdk.Rectangle imgBBox   = new Gdk.Rectangle(0, 0, img.Width, img.Height);
            Gdk.Rectangle shapeBBox = new Gdk.Rectangle(
                imgToShapeX - halfOfShapeWidth,
                imgToShapeY - halfOfShapeWidth,
                shapeWidth,
                shapeWidth);

            // Inflate shape bounding box to allow for anti-aliasing
            shapeBBox.Inflate(2, 2);

            // To determine required size of icon,
            // find union of the image and shape bounding boxes
            // (still relative to image top-left corner)
            Gdk.Rectangle iconBBox = imgBBox.Union(shapeBBox);

            // Image top-left corner in icon co-ordinates
            int imgX = imgBBox.Left - iconBBox.Left;
            int imgY = imgBBox.Top - iconBBox.Top;

            // Shape center point in icon co-ordinates
            shapeX = imgToShapeX - iconBBox.Left;
            shapeY = imgToShapeY - iconBBox.Top;

            using (var i = CairoExtensions.CreateImageSurface(Cairo.Format.ARGB32, iconBBox.Width, iconBBox.Height)) {
                using (var g = new Cairo.Context(i)) {
                    // Don't show shape if shapeWidth less than 3,
                    if (shapeWidth > 3)
                    {
                        int             diam      = Math.Max(1, shapeWidth - 2);
                        Cairo.Rectangle shapeRect = new Cairo.Rectangle(shapeX - halfOfShapeWidth,
                                                                        shapeY - halfOfShapeWidth,
                                                                        diam,
                                                                        diam);

                        Cairo.Color outerColor = new Cairo.Color(255, 255, 255, 0.75);
                        Cairo.Color innerColor = new Cairo.Color(0, 0, 0);

                        switch (shape)
                        {
                        case CursorShape.Ellipse:
                            g.DrawEllipse(shapeRect, outerColor, 2);
                            shapeRect = shapeRect.Inflate(-1, -1);
                            g.DrawEllipse(shapeRect, innerColor, 1);
                            break;

                        case CursorShape.Rectangle:
                            g.DrawRectangle(shapeRect, outerColor, 1);
                            shapeRect = shapeRect.Inflate(-1, -1);
                            g.DrawRectangle(shapeRect, innerColor, 1);
                            break;
                        }
                    }

                    // Draw the image
                    g.DrawPixbuf(img, new Cairo.Point(imgX, imgY));
                }

                return(CairoExtensions.ToPixbuf(i));
            }
        }
コード例 #6
0
 /// <inheritdoc />
 public abstract unsafe Cursor *CreateStandardCursor(CursorShape shape);
コード例 #7
0
ファイル: BaseTool.cs プロジェクト: JoeyScarr/Pinta
        /// <summary>
        /// Create a cursor icon with a shape that visually represents the tool's thickness.
        /// </summary>
        /// <param name="imgName">A string containing the name of the tool's icon image to use.</param>
        /// <param name="shape">The shape to draw.</param>
        /// <param name="shapeWidth">The width of the shape.</param>
        /// <param name="imgToShapeX">The horizontal distance between the image's top-left corner and the shape center.</param>
        /// <param name="imgToShapeX">The verical distance between the image's top-left corner and the shape center.</param>
        /// <param name="shapeX">The X position in the returned Pixbuf that will be the center of the shape.</param>
        /// <param name="shapeY">The Y position in the returned Pixbuf that will be the center of the shape.</param>
        /// <returns>The new cursor icon with an shape that represents the tool's thickness.</returns>
        protected Gdk.Pixbuf CreateIconWithShape(string imgName, CursorShape shape, int shapeWidth,
		                                          int imgToShapeX, int imgToShapeY,
		                                          out int shapeX, out int shapeY)
        {
            Gdk.Pixbuf img = PintaCore.Resources.GetIcon(imgName);

            double zoom = 1d;
            if (PintaCore.Workspace.HasOpenDocuments)
            {
                zoom = Math.Min(30d, PintaCore.Workspace.ActiveDocument.Workspace.Scale);
            }

            shapeWidth = (int)Math.Min(800d, ((double)shapeWidth) * zoom);
            int halfOfShapeWidth = shapeWidth / 2;

            // Calculate bounding boxes around the both image and shape
            // relative to the image top-left corner.
            Gdk.Rectangle imgBBox = new Gdk.Rectangle(0, 0, img.Width, img.Height);
            Gdk.Rectangle shapeBBox = new Gdk.Rectangle(
                imgToShapeX - halfOfShapeWidth,
                imgToShapeY - halfOfShapeWidth,
                shapeWidth,
                shapeWidth);

            // Inflate shape bounding box to allow for anti-aliasing
            shapeBBox.Inflate(2, 2);

            // To determine required size of icon,
            // find union of the image and shape bounding boxes
            // (still relative to image top-left corner)
            Gdk.Rectangle iconBBox = imgBBox.Union (shapeBBox);

            // Image top-left corner in icon co-ordinates
            int imgX = imgBBox.Left - iconBBox.Left;
            int imgY = imgBBox.Top - iconBBox.Top;

            // Shape center point in icon co-ordinates
            shapeX = imgToShapeX - iconBBox.Left;
            shapeY = imgToShapeY - iconBBox.Top;

            ImageSurface i = new ImageSurface(Format.ARGB32, iconBBox.Width, iconBBox.Height);
            using (Context g = new Context(i))
            {
                // Don't show shape if shapeWidth less than 3,
                if (shapeWidth > 3)
                {
                    int diam = Math.Max (1, shapeWidth - 2);
                    Cairo.Rectangle shapeRect = new Cairo.Rectangle(shapeX - halfOfShapeWidth,
                                                                     shapeY - halfOfShapeWidth,
                                                                     diam,
                                                                     diam);

                    Cairo.Color outerColor = new Cairo.Color (255, 255, 255, 0.5);
                    Cairo.Color innerColor = new Cairo.Color (0, 0, 0);

                    switch (shape)
                    {
                    case CursorShape.Ellipse:
                        g.DrawEllipse(shapeRect, outerColor, 1);
                        shapeRect = shapeRect.Inflate (-1, -1);
                        g.DrawEllipse(shapeRect, innerColor, 1);
                        break;
                    case CursorShape.Rectangle:
                        g.DrawRectangle(shapeRect, outerColor, 1);
                        shapeRect = shapeRect.Inflate (-1, -1);
                        g.DrawRectangle(shapeRect, innerColor, 1);
                        break;
                    }
                }

                // Draw the image
                g.DrawPixbuf(img, new Cairo.Point(imgX, imgY));
            }

            return CairoExtensions.ToPixbuf(i);
        }
コード例 #8
0
ファイル: Cursor.cs プロジェクト: yrest/urho
 /// <summary>
 /// Set current shape.
 /// </summary>
 public void SetShape(CursorShape shape)
 {
     Runtime.ValidateRefCounted(this);
     Cursor_SetShape1(handle, shape);
 }
コード例 #9
0
ファイル: Cursor.cs プロジェクト: yrest/urho
 internal static extern void Cursor_SetShape1(IntPtr handle, CursorShape shape);
コード例 #10
0
ファイル: Cursor.cs プロジェクト: yrest/urho
 /// <summary>
 /// Define a shape.
 /// </summary>
 public void DefineShape(CursorShape shape, Image image, Urho.IntRect imageRect, Urho.IntVector2 hotSpot)
 {
     Runtime.ValidateRefCounted(this);
     Cursor_DefineShape0(handle, shape, (object)image == null ? IntPtr.Zero : image.Handle, ref imageRect, ref hotSpot);
 }
コード例 #11
0
ファイル: Cursor.cs プロジェクト: yrest/urho
 internal static extern void Cursor_DefineShape0(IntPtr handle, CursorShape shape, IntPtr image, ref Urho.IntRect imageRect, ref Urho.IntVector2 hotSpot);
コード例 #12
0
ファイル: Cursor.cs プロジェクト: jpbruyere/glfw-sharp
 public Cursor(CursorShape cursor)
 {
     hnd = Glfw3.CreateStandardCursor(cursor);
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModeInfo"/> class.
 /// </summary>
 /// <param name="cursorShape">Cursor shape info.</param>
 /// <param name="cellPercentage">Cursor size info.</param>
 /// <param name="cursorBlinking">Cursor blinking info.</param>
 public ModeInfo(CursorShape cursorShape, int cellPercentage, CursorBlinking cursorBlinking)
 {
     this.CursorShape    = cursorShape;
     this.CellPercentage = cellPercentage;
     this.CursorBlinking = cursorBlinking;
 }