private void SetupSide(string name, StandardCursorType cursor, WindowEdge edge) { var ctl = this.FindControl <Control>(name); ctl.Cursor = new Cursor(cursor); ctl.PointerPressed += (i, e) => PlatformImpl?.BeginResizeDrag(edge, e); }
public IPlatformHandle GetCursor(StandardCursorType cursorType) { var handle = s_mapping.TryGetValue(cursorType, out var shape) ? _cursors[shape] : _cursors[CursorFontShape.XC_top_left_arrow]; return(new PlatformHandle(handle, "XCURSOR")); }
public static void SetCursorOnPointerPressed(this Control control, StandardCursorType cursor) { if (control != null) { control.PointerPressed += (s, e) => { control.Cursor = new Cursor(cursor); }; } }
void SetupSide(string name, StandardCursorType cursor, WindowEdge edge, ref TemplateAppliedEventArgs e) { var ctl = e.NameScope.Get <Control>(name); ctl.Cursor = new Cursor(cursor); ctl.PointerPressed += delegate { ((Window)this.GetVisualRoot()).PlatformImpl?.BeginResizeDrag(edge); }; }
private static IPlatformHandle GetCursor(StandardCursorType type) { var platform = AvaloniaGlobals.StandardCursorFactory; if (platform == null) { throw new Exception("Could not create Cursor: IStandardCursorFactory not registered."); } return(platform.GetCursor(type)); }
private static IPlatformHandle GetCursor(StandardCursorType type) { var platform = AvaloniaLocator.Current.GetService<IStandardCursorFactory>(); if (platform == null) { throw new Exception("Could not create Cursor: IStandardCursorFactory not registered."); } return platform.GetCursor(type); }
private static IPlatformHandle GetCursor(StandardCursorType type) { var platform = AvaloniaLocator.Current.GetService <IStandardCursorFactory>(); if (platform == null) { throw new Exception("Could not create Cursor: IStandardCursorFactory not registered."); } return(platform.GetCursor(type)); }
public ICursorImpl GetCursor(StandardCursorType cursorType) { if (!Cache.TryGetValue(cursorType, out var rv)) { rv = new CursorImpl( UnmanagedMethods.LoadCursor(IntPtr.Zero, new IntPtr(CursorTypeMapping[cursorType])), false); Cache.Add(cursorType, rv); } return(rv); }
private static void LoadModuleCursor(StandardCursorType cursorType, string module, int id) { IntPtr mh = UnmanagedMethods.GetModuleHandle(module); if (mh != IntPtr.Zero) { IntPtr cursor = UnmanagedMethods.LoadCursor(mh, new IntPtr(id)); if (cursor != IntPtr.Zero) { Cache.Add(cursorType, new CursorImpl(cursor, false)); } } }
public IPlatformHandle GetCursor(StandardCursorType cursorType) { IPlatformHandle rv; if (!Cache.TryGetValue(cursorType, out rv)) { Cache[cursorType] = rv = new PlatformHandle( UnmanagedMethods.LoadCursor(IntPtr.Zero, new IntPtr(CursorTypeMapping[cursorType])), PlatformConstants.CursorHandleType); } return rv; }
public static Cursor Create(StandardCursorType cursorType) { Cursor cursor; lock (_StdCursors) { if (!_StdCursors.TryGetValue(cursorType, out cursor)) { cursor = new Cursor(cursorType); _StdCursors[cursorType] = cursor; } } return(cursor); }
public IPlatformHandle GetCursor(StandardCursorType cursorType) { IPlatformHandle rv; if (!Cache.TryGetValue(cursorType, out rv)) { Cache[cursorType] = rv = new PlatformHandle( GetCursor(CursorTypeMapping[cursorType]).Handle, "GTKCURSOR"); } return rv; }
private static void LoadModuleCursor(StandardCursorType cursorType, string module, int id) { IntPtr mh = UnmanagedMethods.GetModuleHandle(module); if (mh != IntPtr.Zero) { IntPtr cursor = UnmanagedMethods.LoadCursor(mh, new IntPtr(id)); if (cursor != IntPtr.Zero) { PlatformHandle phCursor = new PlatformHandle(cursor, PlatformConstants.CursorHandleType); Cache.Add(cursorType, phCursor); } } }
public IPlatformHandle GetCursor(StandardCursorType cursorType) { IPlatformHandle rv; if (!Cache.TryGetValue(cursorType, out rv)) { Cache[cursorType] = rv = new PlatformHandle( UnmanagedMethods.LoadCursor(IntPtr.Zero, new IntPtr(CursorTypeMapping[cursorType])), PlatformConstants.CursorHandleType); } return(rv); }
public IPlatformHandle GetCursor(StandardCursorType cursorType) { IPlatformHandle rv; if (!Cache.TryGetValue(cursorType, out rv)) { Cache[cursorType] = rv = new PlatformHandle( GetCursor(CursorTypeMapping[cursorType]).Handle, "GTKCURSOR"); } return(rv); }
public ICursorImpl GetCursor(StandardCursorType cursorType) { IntPtr handle; if (cursorType == StandardCursorType.None) { handle = _nullCursor; } else { handle = s_mapping.TryGetValue(cursorType, out var shape) ? _cursors[shape] : _cursors[CursorFontShape.XC_left_ptr]; } return(new CursorImpl(handle)); }
public IPlatformHandle GetCursor(StandardCursorType cursorType) { IntPtr handle; if (cursorType == StandardCursorType.None) { handle = _nullCursor; } else { handle = s_mapping.TryGetValue(cursorType, out var shape) ? _cursors[shape] : _cursors[CursorFontShape.XC_top_left_arrow]; } return(new PlatformHandle(handle, "XCURSOR")); }
private void UpdateCursor(IInputRoot root, DragDropEffects effect) { if (_lastRoot != root) { if (_lastRoot is InputElement ieLast) { if (_originalCursor == AvaloniaProperty.UnsetValue) { ieLast.ClearValue(InputElement.CursorProperty); } else { ieLast.Cursor = _originalCursor as Cursor; } } if (root is InputElement ieNew) { if (!ieNew.IsSet(InputElement.CursorProperty)) { _originalCursor = AvaloniaProperty.UnsetValue; } else { _originalCursor = root.Cursor; } } else { _originalCursor = null; } _lastCursorType = StandardCursorType.Arrow; _lastRoot = root; } if (root is InputElement ie) { var ct = GetCursorForDropEffect(effect); if (ct != _lastCursorType) { _lastCursorType = ct; ie.Cursor = new Cursor(ct); } } }
internal void SetUpBorder <T>(string name, StandardCursorType cursorType, WindowEdge edge) where T : Control { Control?ctl = this.Find <T>(name); if (ctl != null) { ctl.Cursor = new Cursor(cursorType); ctl.PointerPressed += (s, e_) => { this.BeginResizeDrag(edge, e_); }; } else { #if DEBUG Debug.WriteLine("The referenced control does not exist"); #endif } }
public IPlatformHandle GetCursor(StandardCursorType cursorType) { return(new PlatformHandle(IntPtr.Zero, "null")); }
/// <summary> /// Create a cursor from png/svg and hotspot position /// </summary> public CssCursor(string url, PixelPoint hotSpot, StandardCursorType fallback) { Value = $"url('{url}') {hotSpot.X} {hotSpot.Y}, {ToKeyword(fallback)}"; }
/// <summary> /// Create a cursor from base64 image /// </summary> public CssCursor(string base64, string format, PixelPoint hotspot, StandardCursorType fallback) { Value = $"url(\"data:image/{format};base64,{base64}\") {hotspot.X} {hotspot.Y}, {ToKeyword(fallback)}"; }
public IPlatformHandle GetCursor(StandardCursorType cursorType) { var cursor = _native.GetCursor((AvnStandardCursorType)cursorType); return(new AvaloniaNativeCursor(cursor)); }
public Cursor(StandardCursorType cursorType) : this( ((IStandardCursorFactory)PerspexLocator.Current.GetService(typeof(IStandardCursorFactory))).GetCursor( cursorType)) { }
ICursorImpl ICursorFactory.GetCursor(StandardCursorType cursorType) => new CursorImplStub();
public ICursorImpl GetCursor(StandardCursorType cursorType) { return(new MockCursorImpl()); }
public IPlatformHandle GetCursor(StandardCursorType cursorType) => new PlatformHandle(IntPtr.Zero, "ZeroCursor");
public IPlatformHandle GetCursor(StandardCursorType cursorType) { return(new PlatformHandle(new IntPtr((int)cursorType), "STUB")); }
public CssCursor(StandardCursorType type) { Value = ToKeyword(type); }
public ICursorImpl GetCursor(StandardCursorType cursorType) => new CursorStub();
/// <summary> /// Create a cursor from url to *.cur file. /// </summary> public CssCursor(string url, StandardCursorType fallback) { Value = $"url('{url}'), {ToKeyword(fallback)}"; }
public Cursor(StandardCursorType cursorType) : this(GetCursor(cursorType)) { }
private static string ToKeyword(StandardCursorType type) => type switch {
public IPlatformHandle GetCursor(StandardCursorType cursorType) { return(new Cursor(_cache[cursorType])); }
public IPlatformHandle GetCursor(StandardCursorType cursorType) => new PlatformHandle(IntPtr.Zero, "NULL");