public CarbonCursor (Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) { this.id = StdCursor.Default; this.bmp = bitmap; this.mask = mask; this.cursor_color = cursor_pixel; this.mask_color = mask_pixel; this.hot_x = xHotSpot; this.hot_y = yHotSpot; standard = true; }
public CarbonCursor (StdCursor id) { this.id = id; this.bmp = null; this.mask = null; this.cursor_color = Color.Black; this.mask_color = Color.Black; this.hot_x = 0; this.hot_y = 0; standard = true; }
public CocoaCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) { this.id = StdCursor.Default; this.bmp = bitmap; this.mask = mask; this.cursor_color = cursor_pixel; this.mask_color = mask_pixel; this.hot_x = xHotSpot; this.hot_y = yHotSpot; standard = true; }
public CocoaCursor(StdCursor id) { this.id = id; this.bmp = null; this.mask = null; this.cursor_color = Color.Black; this.mask_color = Color.Black; this.hot_x = 0; this.hot_y = 0; standard = true; }
internal Cursor(StdCursor cursor) : this(XplatUI.DefineStdCursor(cursor)) { std_cursor = cursor; }
internal abstract IntPtr DefineStdCursor(StdCursor id);
internal override IntPtr DefineStdCursor (StdCursor id) { return Carbon.Cursor.DefineStdCursor (id); }
internal override Bitmap DefineStdCursorBitmap (StdCursor id) { return display.DefineStdCursorBitmap (id); }
internal override IntPtr DefineStdCursor(StdCursor id) { switch(id) { case StdCursor.AppStarting: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_APPSTARTING); case StdCursor.Arrow: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); case StdCursor.Cross: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_CROSS); case StdCursor.Default: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); case StdCursor.Hand: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_HAND); case StdCursor.Help: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_HELP); case StdCursor.HSplit: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.IBeam: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_IBEAM); case StdCursor.No: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_NO); case StdCursor.NoMove2D: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.NoMoveHoriz: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.NoMoveVert: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.PanEast: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.PanNE: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.PanNorth: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.PanNW: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.PanSE: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.PanSouth: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.PanSW: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.PanWest: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.SizeAll: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZEALL); case StdCursor.SizeNESW: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZENESW); case StdCursor.SizeNS: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZENS); case StdCursor.SizeNWSE: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZENWSE); case StdCursor.SizeWE: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZEWE); case StdCursor.UpArrow: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_UPARROW); case StdCursor.VSplit: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME case StdCursor.WaitCursor: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_WAIT); } throw new NotImplementedException (); }
internal abstract Bitmap DefineStdCursorBitmap(StdCursor id);
internal override Bitmap DefineStdCursorBitmap(StdCursor id) { throw new NotImplementedException(); }
internal static IntPtr DefineStdCursor (StdCursor id) { return driver.DefineStdCursor (id); }
internal static Bitmap DefineStdCursorBitmap (StdCursor id) { // FIXME return new Bitmap (16, 16); }
internal static IntPtr DefineStdCursor (StdCursor id) { CarbonCursor cc = new CarbonCursor (id); return (IntPtr) GCHandle.Alloc (cc); }
internal override IntPtr DefineStdCursor(StdCursor id) { return(display.DefineStdCursor(id)); }
internal override Bitmap DefineStdCursorBitmap(StdCursor id) { return(display.DefineStdCursorBitmap(id)); }
internal override IntPtr DefineStdCursor (StdCursor id) { return display.DefineStdCursor (id); }
public static string ToCursorFileName(Alt.GUI.Cursor cursor) { StdCursor stdCursor = StdCursor.Unknown; //TEMP cursor.StdCursor; switch (stdCursor) { case Alt.GUI.StdCursor.Unknown: { //return ""; return("AltCursors\\arrow_m.cur"); } case Alt.GUI.StdCursor.Default: { return(""); } case Alt.GUI.StdCursor.AppStarting: { return(""); } case Alt.GUI.StdCursor.Arrow: { return(""); } case Alt.GUI.StdCursor.Cross: { return(""); } case Alt.GUI.StdCursor.Hand: { return(""); } case Alt.GUI.StdCursor.Help: { return(""); } case Alt.GUI.StdCursor.HSplit: { return(""); } case Alt.GUI.StdCursor.IBeam: { return(""); } case Alt.GUI.StdCursor.No: { return(""); } case Alt.GUI.StdCursor.NoMove2D: { return(""); } case Alt.GUI.StdCursor.NoMoveHoriz: { return(""); } case Alt.GUI.StdCursor.NoMoveVert: { return(""); } case Alt.GUI.StdCursor.PanEast: { return(""); } case Alt.GUI.StdCursor.PanNE: { return(""); } case Alt.GUI.StdCursor.PanNorth: { return(""); } case Alt.GUI.StdCursor.PanNW: { return(""); } case Alt.GUI.StdCursor.PanSE: { return(""); } case Alt.GUI.StdCursor.PanSouth: { return(""); } case Alt.GUI.StdCursor.PanSW: { return(""); } case Alt.GUI.StdCursor.PanWest: { return(""); } case Alt.GUI.StdCursor.SizeAll: { return(""); } case Alt.GUI.StdCursor.SizeNESW: { return(""); } case Alt.GUI.StdCursor.SizeNS: { return(""); } case Alt.GUI.StdCursor.SizeNWSE: { return(""); } case Alt.GUI.StdCursor.SizeWE: { return(""); } case Alt.GUI.StdCursor.UpArrow: { return(""); } case Alt.GUI.StdCursor.VSplit: { return(""); } case Alt.GUI.StdCursor.WaitCursor: { return(""); } } return("GUI/Cursors/DefaultSystem.cur"); }
internal static IntPtr DefineStdCursor(StdCursor id) { return(driver.DefineStdCursor(id)); }
internal override Bitmap DefineStdCursorBitmap (StdCursor id) { CursorFontShape shape; string name; IntPtr theme; int size; Bitmap bmp = null; try { shape = StdCursorToFontShape (id); name = shape.ToString ().Replace ("XC_", string.Empty); size = XcursorGetDefaultSize (DisplayHandle); theme = XcursorGetTheme (DisplayHandle); IntPtr images_ptr = XcursorLibraryLoadImages (name, theme, size); DriverDebug ("DefineStdCursorBitmap, id={0}, #id={1}, name{2}, size={3}, theme: {4}, images_ptr={5}", id, (int) id, name, size, Marshal.PtrToStringAnsi (theme), images_ptr); if (images_ptr == IntPtr.Zero) { return null; } XcursorImages images = (XcursorImages) Marshal.PtrToStructure (images_ptr, typeof (XcursorImages)); DriverDebug ("DefineStdCursorBitmap, cursor has {0} images", images.nimage); if (images.nimage > 0) { // We only care about the first image. XcursorImage image = (XcursorImage)Marshal.PtrToStructure (Marshal.ReadIntPtr (images.images), typeof (XcursorImage)); DriverDebug ("DefineStdCursorBitmap, loaded image <size={0}, height={1}, width={2}, xhot={3}, yhot={4}, pixels={5}", image.size, image.height, image.width, image.xhot, image.yhot, image.pixels); // A sanity check if (image.width <= short.MaxValue && image.height <= short.MaxValue) { int [] pixels = new int [image.width * image.height]; Marshal.Copy (image.pixels, pixels, 0, pixels.Length); bmp = new Bitmap (image.width, image.height); for (int w = 0; w < image.width; w++) { for (int h = 0; h < image.height; h++) { bmp.SetPixel (w, h, Color.FromArgb (pixels [h * image.width + w])); } } } } XcursorImagesDestroy (images_ptr); } catch (DllNotFoundException ex) { Console.WriteLine ("Could not load libXcursor: " + ex.Message + " (" + ex.GetType ().Name + ")"); return null; } return bmp; }
internal override IntPtr DefineStdCursor(StdCursor id) { throw new NotImplementedException(); }
internal static CursorFontShape StdCursorToFontShape (StdCursor id) { CursorFontShape shape; // FIXME - define missing shapes switch (id) { case StdCursor.AppStarting: { shape = CursorFontShape.XC_watch; break; } case StdCursor.Arrow: { shape = CursorFontShape.XC_top_left_arrow; break; } case StdCursor.Cross: { shape = CursorFontShape.XC_crosshair; break; } case StdCursor.Default: { shape = CursorFontShape.XC_top_left_arrow; break; } case StdCursor.Hand: { shape = CursorFontShape.XC_hand1; break; } case StdCursor.Help: { shape = CursorFontShape.XC_question_arrow; break; } case StdCursor.HSplit: { shape = CursorFontShape.XC_sb_v_double_arrow; break; } case StdCursor.IBeam: { shape = CursorFontShape.XC_xterm; break; } case StdCursor.No: { shape = CursorFontShape.XC_circle; break; } case StdCursor.NoMove2D: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.NoMoveHoriz: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.NoMoveVert: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanEast: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanNE: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanNorth: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanNW: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanSE: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanSouth: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanSW: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanWest: { shape = CursorFontShape.XC_sizing; break; } case StdCursor.SizeAll: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.SizeNESW: { shape = CursorFontShape.XC_top_right_corner; break; } case StdCursor.SizeNS: { shape = CursorFontShape.XC_sb_v_double_arrow; break; } case StdCursor.SizeNWSE: { shape = CursorFontShape.XC_top_left_corner; break; } case StdCursor.SizeWE: { shape = CursorFontShape.XC_sb_h_double_arrow; break; } case StdCursor.UpArrow: { shape = CursorFontShape.XC_center_ptr; break; } case StdCursor.VSplit: { shape = CursorFontShape.XC_sb_h_double_arrow; break; } case StdCursor.WaitCursor: { shape = CursorFontShape.XC_watch; break; } default: { shape = (CursorFontShape) 0; break; } } return shape; }
public IntPtr DefineStdCursor (StdCursor id) { CursorFontShape shape; // FIXME - define missing shapes switch (id) { case StdCursor.AppStarting: shape = CursorFontShape.XC_watch; break; case StdCursor.Arrow: shape = CursorFontShape.XC_top_left_arrow; break; case StdCursor.Cross: shape = CursorFontShape.XC_crosshair; break; case StdCursor.Default: shape = CursorFontShape.XC_top_left_arrow; break; case StdCursor.Hand: shape = CursorFontShape.XC_hand1; break; case StdCursor.Help: shape = CursorFontShape.XC_question_arrow; break; case StdCursor.HSplit: shape = CursorFontShape.XC_sb_v_double_arrow; break; case StdCursor.IBeam: shape = CursorFontShape.XC_xterm; break; case StdCursor.No: shape = CursorFontShape.XC_circle; break; case StdCursor.NoMove2D: shape = CursorFontShape.XC_fleur; break; case StdCursor.NoMoveHoriz: shape = CursorFontShape.XC_fleur; break; case StdCursor.NoMoveVert: shape = CursorFontShape.XC_fleur; break; case StdCursor.PanEast: shape = CursorFontShape.XC_fleur; break; case StdCursor.PanNE: shape = CursorFontShape.XC_fleur; break; case StdCursor.PanNorth: shape = CursorFontShape.XC_fleur; break; case StdCursor.PanNW: shape = CursorFontShape.XC_fleur; break; case StdCursor.PanSE: shape = CursorFontShape.XC_fleur; break; case StdCursor.PanSouth: shape = CursorFontShape.XC_fleur; break; case StdCursor.PanSW: shape = CursorFontShape.XC_fleur; break; case StdCursor.PanWest: shape = CursorFontShape.XC_sizing; break; case StdCursor.SizeAll: shape = CursorFontShape.XC_fleur; break; case StdCursor.SizeNESW: shape = CursorFontShape.XC_top_right_corner; break; case StdCursor.SizeNS: shape = CursorFontShape.XC_sb_v_double_arrow; break; case StdCursor.SizeNWSE: shape = CursorFontShape.XC_top_left_corner; break; case StdCursor.SizeWE: shape = CursorFontShape.XC_sb_h_double_arrow; break; case StdCursor.UpArrow: shape = CursorFontShape.XC_center_ptr; break; case StdCursor.VSplit: shape = CursorFontShape.XC_sb_h_double_arrow; break; case StdCursor.WaitCursor: shape = CursorFontShape.XC_watch; break; default: return IntPtr.Zero; } return Xlib.XCreateFontCursor (display, shape); }
internal static Bitmap DefineStdCursorBitmap (StdCursor id) { return driver.DefineStdCursorBitmap (id); }
internal static Bitmap DefineStdCursorBitmap(StdCursor id) { return(driver.DefineStdCursorBitmap(id)); }
internal static Bitmap DefineStdCursorBitmap(StdCursor id) { // FIXME return(new Bitmap(16, 16)); }
internal override IntPtr DefineStdCursor(StdCursor id) { CursorFontShape shape; IntPtr cursor; shape = StdCursorToFontShape (id); lock (XlibLock) { cursor = XCreateFontCursor(DisplayHandle, shape); } return cursor; }
internal static IntPtr DefineStdCursor(StdCursor id) { CocoaCursor cc = new CocoaCursor(id); return((IntPtr)GCHandle.Alloc(cc)); }
internal override Bitmap DefineStdCursorBitmap (StdCursor id) { // We load the cursor, create a bitmap, draw the cursor onto the bitmap and return the bitmap. IntPtr cursor = DefineStdCursor (id); // Windows only have one possible cursor size! int width = Win32GetSystemMetrics (SystemMetrics.SM_CXCURSOR); int height = Win32GetSystemMetrics (SystemMetrics.SM_CYCURSOR); Bitmap bmp = new Bitmap (width, height); Graphics gc = Graphics.FromImage (bmp); IntPtr hdc = gc.GetHdc (); Win32DrawIcon (hdc, 0, 0, cursor); gc.ReleaseHdc (hdc); gc.Dispose (); return bmp; }
internal override Bitmap DefineStdCursorBitmap (StdCursor id) { return Carbon.Cursor.DefineStdCursorBitmap (id); }
internal Cursor (StdCursor cursor) : this (XplatUI.DefineStdCursor (cursor)) { std_cursor = cursor; }
internal override IntPtr DefineStdCursor (StdCursor id) { CursorFontShape shape; IntPtr cursor; // FIXME - define missing shapes switch (id) { case StdCursor.AppStarting: { shape = CursorFontShape.XC_watch; break; } case StdCursor.Arrow: { return IntPtr.Zero; } case StdCursor.Cross: { shape = CursorFontShape.XC_crosshair; break; } case StdCursor.Default: { return IntPtr.Zero; } case StdCursor.Hand: { shape = CursorFontShape.XC_hand1; break; } case StdCursor.Help: { shape = CursorFontShape.XC_question_arrow; break; } case StdCursor.HSplit: { shape = CursorFontShape.XC_sb_v_double_arrow; break; } case StdCursor.IBeam: { shape = CursorFontShape.XC_xterm; break; } case StdCursor.No: { shape = CursorFontShape.XC_circle; break; } case StdCursor.NoMove2D: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.NoMoveHoriz: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.NoMoveVert: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanEast: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanNE: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanNorth: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanNW: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanSE: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanSouth: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanSW: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.PanWest: { shape = CursorFontShape.XC_sizing; break; } case StdCursor.SizeAll: { shape = CursorFontShape.XC_fleur; break; } case StdCursor.SizeNESW: { shape = CursorFontShape.XC_top_right_corner; break; } case StdCursor.SizeNS: { shape = CursorFontShape.XC_sb_v_double_arrow; break; } case StdCursor.SizeNWSE: { shape = CursorFontShape.XC_top_left_corner; break; } case StdCursor.SizeWE: { shape = CursorFontShape.XC_sb_h_double_arrow; break; } case StdCursor.UpArrow: { shape = CursorFontShape.XC_center_ptr; break; } case StdCursor.VSplit: { shape = CursorFontShape.XC_sb_h_double_arrow; break; } case StdCursor.WaitCursor: { shape = CursorFontShape.XC_watch; break; } default: { return IntPtr.Zero; } } lock (XlibLock) { cursor = XCreateFontCursor (DisplayHandle, shape); } return cursor; }