public override void ResetCursorRects () { base.ResetCursorRects (); if(Cursor == null) Cursor = NSCursor.ArrowCursor; this.AddCursorRectcursor(this.Bounds,Cursor); }
public override void ViewDidLoad() { base.ViewDidLoad(); NSCursor.Hide(); // Do any additional setup after loading the view. NSEvent.AddLocalMonitorForEventsMatchingMask(NSEventMask.KeyDown, (theEvent) => { this.KeyDown(theEvent); return(null); }); MainTimer = new Timer(1000); MainTimer.Elapsed += (sender, e) => { TimeLeft--; // Format the remaining time nicely for the label TimeSpan time = TimeSpan.FromSeconds(TimeLeft); string timeString = time.ToString(@"mm\:ss"); InvokeOnMainThread(() => { //We want to interact with the UI from a different thread, // so we must invoke this change on the main thread timerLevel.DoubleValue = (1.0) * (15 * 60 - TimeLeft); }); }; MainTimer.Start(); }
public MouseCursorImplementation(Bitmap bitmap, IntVector2 hotSpot) { var handle = bitmap.NativeBitmap; var icon = new NSImage(bitmap.NativeBitmap, new CoreGraphics.CGSize(bitmap.NativeBitmap.Width, bitmap.NativeBitmap.Height)); NativeCursor = new NSCursor(icon, new CoreGraphics.CGPoint(hotSpot.X, hotSpot.Y)); }
internal void GoFullScreen() { bool wasActive = IsActive; IsActive = false; //Some games set fullscreen in their initialize function, //before we have sized the window and set it active. //Do that now, or else mouse tracking breaks. _mainWindow.MakeKeyAndOrderFront(_mainWindow); ResetWindowBounds(); _wasResizeable = IsAllowUserResizing; string oldTitle = _view.Title; NSMenu.MenuBarVisible = false; _mainWindow.StyleMask = NSWindowStyle.Borderless; _mainWindow.HidesOnDeactivate = true; ResetWindowBounds(); if (oldTitle != null) { _view.Title = oldTitle; } if (!IsMouseVisible) { NSCursor.Hide(); } IsActive = wasActive; }
public override void AwakeFromNib() { base.AwakeFromNib(); currentDelegate = NSApplication.SharedApplication.Delegate as AppDelegate; // Blur Overlay is the Visual Effect View with Blur and Vibrancy BlurOverlay.WantsLayer = true; BlurOverlay.Material = NSVisualEffectMaterial.Dark; BlurOverlay.BlendingMode = NSVisualEffectBlendingMode.WithinWindow; ThumbnailView.WantsLayer = true; ThumbnailView.Layer.CornerRadius = 32.0f; #region Settings Menu settingsMenu = new NSMenu(); artwork = new NSMenuItem("Background Artwork", new ObjCRuntime.Selector("artwork:"), ""); launch = new NSMenuItem("Launch at Login", new ObjCRuntime.Selector("launch:"), ""); NSMenuItem about = new NSMenuItem("About", new ObjCRuntime.Selector("about:"), ""); NSMenuItem quit = new NSMenuItem("Quit Carol", new ObjCRuntime.Selector("quit:"), "q"); settingsMenu.AddItem(artwork); settingsMenu.AddItem(launch); settingsMenu.AddItem(about); settingsMenu.AddItem(NSMenuItem.SeparatorItem); settingsMenu.AddItem(quit); #endregion SettingsButton.AddTrackingArea(new NSTrackingArea(SettingsButton.Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null)); cursor = NSCursor.CurrentSystemCursor; windowController = currentDelegate.Storyboard.InstantiateControllerWithIdentifier("AboutWindow") as NSWindowController; }
//Method override to change cursor to pointing hand on Mouse Enter (Hover) public override void MouseEntered(NSEvent theEvent) { base.MouseEntered(theEvent); cursor = NSCursor.PointingHandCursor; cursor.Push(); }
public NSAttributedString(string str, NSFont font = null, NSColor foregroundColor = null, NSColor backgroundColor = null, NSColor strokeColor = null, NSColor underlineColor = null, NSColor strikethroughColor = null, NSUnderlineStyle underlineStyle = NSUnderlineStyle.None, NSUnderlineStyle strikethroughStyle = NSUnderlineStyle.None, NSParagraphStyle paragraphStyle = null, float strokeWidth = 0, NSShadow shadow = null, NSUrl link = null, bool superscript = false, NSTextAttachment attachment = null, NSLigatureType ligature = NSLigatureType.Default, float baselineOffset = 0, float kerningAdjustment = 0, float obliqueness = 0, float expansion = 0, NSCursor cursor = null, string toolTip = null, int characterShape = 0, NSGlyphInfo glyphInfo = null, NSArray writingDirection = null, bool markedClauseSegment = false, NSTextLayoutOrientation verticalGlyphForm = NSTextLayoutOrientation.Horizontal, NSTextAlternatives textAlternatives = null, NSSpellingState spellingState = NSSpellingState.None) : this(str, NSStringAttributes.ToDictionary( font : font, foregroundColor : foregroundColor, backgroundColor : backgroundColor, strokeColor : strokeColor, underlineColor : underlineColor, strikethroughColor : strikethroughColor, underlineStyle : underlineStyle, strikethroughStyle : strikethroughStyle, paragraphStyle : paragraphStyle, strokeWidth : strokeWidth, shadow : shadow, link : link, superscript : superscript, attachment : attachment, ligature : ligature, baselineOffset : baselineOffset, kerningAdjustment : kerningAdjustment, obliqueness : obliqueness, expansion : expansion, cursor : cursor, toolTip : toolTip, characterShape : characterShape, glyphInfo : glyphInfo, writingDirection : writingDirection, markedClauseSegment : markedClauseSegment, verticalGlyphForm : verticalGlyphForm, textAlternatives : textAlternatives, spellingState : spellingState )) { }
public override void MouseEntered(NSEvent theEvent) { if (!game.IsMouseVisible) { NSCursor.Hide(); } }
public ImageCursorView(IntPtr handle) : base(handle) { imageCursor = new NSCursor( NSImage.ImageNamed("cursor.png"), new CoreGraphics.CGPoint(7, 7)); InitTracking(); }
private void RemoveHoverCursor() { if (cursor != NSCursor.ArrowCursor) { cursor = NSCursor.ArrowCursor; DiscardCursorRects(); } }
public override void ResetCursorRects() { base.ResetCursorRects(); if (Cursor == null) { Cursor = NSCursor.ArrowCursor; } this.AddCursorRect(this.Bounds, Cursor); }
public override void AwakeFromNib() { swneCursor = MakeCursor("SW-NE-Arrow"); nwseCursor = MakeCursor("NW-SE-Arrow"); weCursor = MakeCursor("W-E-Arrow"); nsCursor = MakeCursor("N-S-Arrow"); base.AwakeFromNib(); }
void Awake() { _perspectiveProjection = Camera.main.GetComponent <PerspectiveProjection>(); _leftCursorScript = leftCursor.GetComponent <NSCursor>(); _rightCursorScript = rightCursor.GetComponent <NSCursor>(); _NSObjects = new Dictionary <string, GameObject>(); _NSNetwork = this.gameObject.GetComponent <RPCNetwork>(); }
partial void ToogleCursor(NSObject sender) { Hidden = false; if (Hidden) { NSCursor.Unhide(); Hidden = false; } else { NSCursor.Hide(); Hidden = true; } }
public override void AwakeFromNib() { base.AwakeFromNib(); currentDelegate = NSApplication.SharedApplication.Delegate as AppDelegate; LyricsTextView.BackgroundColor = NSColor.Clear; //Getting the font size from preferences LyricsTextView.Font = NSFont.SystemFontOfSize(NSUserDefaults.StandardUserDefaults.FloatForKey("TextSize"), 0.2f); // Blur Overlay is the Visual Effect View with Blur and Vibrancy BlurOverlay.WantsLayer = true; BlurOverlay.Material = NSVisualEffectMaterial.Dark; BlurOverlay.BlendingMode = NSVisualEffectBlendingMode.WithinWindow; ThumbnailView.WantsLayer = true; ThumbnailView.Layer.CornerRadius = 32.0f; // Progress bar shows how much of lyrics have you covered. It works with scrollview progress = ProgressBar.Frame; //Adding observer of Scroll view change in Notification Center. It helps to update the width of progress bar MainScroll.ContentView.PostsBoundsChangedNotifications = true; NSNotificationCenter.DefaultCenter.AddObserver(this, new ObjCRuntime.Selector("boundsChange:"), NSView.BoundsChangedNotification, MainScroll.ContentView); #region Settings Menu settingsMenu = new NSMenu(); artwork = new NSMenuItem("Background Artwork", new ObjCRuntime.Selector("artwork:"), ""); launch = new NSMenuItem("Launch at Login", new ObjCRuntime.Selector("launch:"), ""); NSMenuItem about = new NSMenuItem("About", new ObjCRuntime.Selector("about:"), ""); NSMenuItem quit = new NSMenuItem("Quit Carol", new ObjCRuntime.Selector("quit:"), "q"); settingsMenu.AddItem(artwork); settingsMenu.AddItem(launch); settingsMenu.AddItem(about); settingsMenu.AddItem(NSMenuItem.SeparatorItem); settingsMenu.AddItem(quit); #endregion OpenInBrowserButton.AddTrackingArea(new NSTrackingArea(OpenInBrowserButton.Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null)); ChangeTextSizeButton.AddTrackingArea(new NSTrackingArea(ChangeTextSizeButton.Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null)); SettingsButton.AddTrackingArea(new NSTrackingArea(SettingsButton.Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null)); cursor = NSCursor.CurrentSystemCursor; windowController = currentDelegate.Storyboard.InstantiateControllerWithIdentifier("AboutWindow") as NSWindowController; }
NSCursor cursor = null; // Our custom cursor public override void ResetCursorRects() { // If we do not have a cursor then we create an image size 1 x 1 // and then create our custom cursor with clear colors if (cursor == null) { cursorImage = new NSImage(new SizeF(1, 1)); cursor = new NSCursor(cursorImage, NSColor.Clear, NSColor.Clear, new PointF(0, 0)); } // if the cursor is not to be visible then we us our custom cursor. if (!game.IsMouseVisible) { AddCursorRectcursor(Frame, cursor); } else { AddCursorRectcursor(Frame, NSCursor.CurrentSystemCursor); } }
private void AddHoverCursor() { if (trackingArea == null) { trackingArea = new NSTrackingArea( VisibleRect(), NSTrackingAreaOptions.ActiveWhenFirstResponder | NSTrackingAreaOptions.CursorUpdate | NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInActiveApp | NSTrackingAreaOptions.InVisibleRect, this, null ); AddTrackingArea(trackingArea); } if (cursor != NSCursor.PointingHandCursor) { cursor = NSCursor.PointingHandCursor; AddCursorRect(VisibleRect(), cursor); } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Do any additional setup after loading the view titleText.AttributedStringValue = titleString; hoverarea = new NSTrackingArea(SettingsButton.Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null); SettingsButton.AddTrackingArea(hoverarea); //Contextual Menu for settings settingsMenu = new NSMenu(); launch = new NSMenuItem("Launch at Login", new ObjCRuntime.Selector("launch:"), ""); NSMenuItem about = new NSMenuItem("About", new ObjCRuntime.Selector("about:"), ""); NSMenuItem quit = new NSMenuItem("Quit", new ObjCRuntime.Selector("quit:"), "q"); settingsMenu.AddItem(launch); settingsMenu.AddItem(about); settingsMenu.AddItem(NSMenuItem.SeparatorItem); settingsMenu.AddItem(quit); cursor = NSCursor.CurrentSystemCursor; }
NSCursor cursor = null; // Our custom cursor public override void ResetCursorRects () { // If we do not have a cursor then we create an image size 1 x 1 // and then create our custom cursor with clear colors if (cursor == null) { cursorImage = new NSImage(new SizeF(1,1)); cursor = new NSCursor(cursorImage, NSColor.Clear, NSColor.Clear, new PointF(0,0)); } // if the cursor is not to be visible then we us our custom cursor. if (!_game.IsMouseVisible) AddCursorRect(Frame, cursor); else AddCursorRect(Frame, NSCursor.CurrentSystemCursor); }
public void SetCursor(NSCursor cursor) { _cursor = cursor ?? ArrowCursor; UpdateCursor(); }
private void PlatformDispose() { Cursor.Dispose(); Cursor = null; }
static internal NSDictionary ToDictionary( NSFont font, NSColor foregroundColor, NSColor backgroundColor, NSColor strokeColor, NSColor underlineColor, NSColor strikethroughColor, NSUnderlineStyle underlineStyle, NSUnderlineStyle strikethroughStyle, NSParagraphStyle paragraphStyle, float strokeWidth, NSShadow shadow, NSUrl link, bool superscript, NSTextAttachment attachment, NSLigatureType ligature, float baselineOffset, float kerningAdjustment, float obliqueness, float expansion, NSCursor cursor, string toolTip, int characterShape, NSGlyphInfo glyphInfo, NSArray writingDirection, bool markedClauseSegment, NSTextLayoutOrientation verticalGlyphForm, NSTextAlternatives textAlternatives, NSSpellingState spellingState) { var attr = new NSStringAttributes(); if (font != null) { attr.Font = font; } if (paragraphStyle != null) { attr.ParagraphStyle = paragraphStyle; } if (foregroundColor != null) { attr.ForegroundColor = foregroundColor; } if (underlineStyle != NSUnderlineStyle.None) { attr.UnderlineStyle = (int?)underlineStyle; } if (superscript) { attr.Superscript = true; } if (backgroundColor != null) { attr.BackgroundColor = backgroundColor; } if (attachment != null) { attr.Attachment = attachment; } if (ligature != NSLigatureType.Default) { attr.Ligature = ligature; } if (baselineOffset != 0) { attr.BaselineOffset = baselineOffset; } if (kerningAdjustment != 0) { attr.KerningAdjustment = kerningAdjustment; } if (link != null) { attr.Link = link; } if (strokeWidth != 0) { attr.StrokeWidth = strokeWidth; } if (strokeColor != null) { attr.StrokeColor = strokeColor; } if (underlineColor != null) { attr.UnderlineColor = underlineColor; } if (strikethroughStyle != NSUnderlineStyle.None) { attr.StrikethroughStyle = (int?)strikethroughStyle; } if (strikethroughColor != null) { attr.StrikethroughColor = strikethroughColor; } if (shadow != null) { attr.Shadow = shadow; } if (obliqueness != 0) { attr.Obliqueness = obliqueness; } if (expansion != 0) { attr.Expansion = expansion; } if (cursor != null) { attr.Cursor = cursor; } if (toolTip != null) { attr.ToolTip = toolTip; } if (characterShape != 0) { attr.CharacterShape = 0; } if (glyphInfo != null) { attr.GlyphInfo = glyphInfo; } if (writingDirection != null) { attr.WritingDirection = writingDirection; } if (markedClauseSegment) { attr.MarkedClauseSegment = true; } if (verticalGlyphForm != NSTextLayoutOrientation.Horizontal) { attr.VerticalGlyphForm = verticalGlyphForm; } if (textAlternatives != null) { attr.TextAlternatives = textAlternatives; } if (spellingState != NSSpellingState.None) { attr.SpellingState = spellingState; } var dict = attr.Dictionary; return(dict.Count == 0 ? null : dict); }
public override void MouseEntered(NSEvent theEvent) { cursor = NSCursor.ClosedHandCursor; cursor.Push(); base.MouseEntered(theEvent); }
void ev_timer() { lock (_lock) { if (mp == IntPtr.Zero) { return; } bool playing = false; switch (VLC.libvlc_media_player_get_state(mp)) { case VLC.State.NothingSpecial: return; case VLC.State.Opening: return; case VLC.State.Buffering: return; case VLC.State.Playing: playing = true; break; case VLC.State.Paused: playing = false; break; case VLC.State.Stopped: // Console.WriteLine("STOPPED"); NSApplication.SharedApplication.Terminate(_app); return; case VLC.State.Ended: Client.Broadcast("*ended"); Thread.Sleep(500); NSApplication.SharedApplication.Terminate(_app); return; case VLC.State.Error: NSApplication.SharedApplication.Terminate(_app); return; default: NSApplication.SharedApplication.Terminate(_app); return; } // Console.WriteLine("timer"); NSCursor.SetHiddenUntilMouseMoves(true); bool force = firsttimer; firsttimer = false; if (_playing != playing || force) { _playing = playing; if (_playing) { VLC.libvlc_set_fullscreen(mp, true); } Client.Broadcast(_playing ? "*playing" : "*paused"); } bool seekable = VLC.libvlc_media_player_is_seekable(mp); if (_seekable != seekable || force) { _seekable = seekable; Client.Broadcast(_seekable ? "*seekable" : "*notseekable"); } int audiotrack = VLC.libvlc_audio_get_track(mp); if (_audiotrack != audiotrack || force) { _audiotrack = audiotrack; Client.Broadcast("*audiotrack " + _audiotrack); } int audiotrackcount = VLC.libvlc_audio_get_track_count(mp); if (_audiotrackcount != audiotrackcount || force) { _audiotrackcount = audiotrackcount; Client.Broadcast("*audiotrackcount " + _audiotrackcount); } int subtitle = VLC.libvlc_video_get_spu(mp); if (_subtitle != subtitle || force) { _subtitle = subtitle; Client.Broadcast("*subtitle " + _subtitle); } int subtitlecount = VLC.libvlc_video_get_spu_count(mp); if (_subtitlecount != subtitlecount || force) { _subtitlecount = subtitlecount; Client.Broadcast("*subtitlecount " + _subtitlecount); } ulong time = VLC.libvlc_media_player_get_time(mp); if (_time != time || force) { _time = time; Client.Broadcast("*time " + _time); } ulong length = VLC.libvlc_media_player_get_length(mp); if (_length != length || force) { _length = length; Client.Broadcast("*length " + _length); } // Console.WriteLine("donetimer"); } }
public MouseCursorImplementation(NSCursor nativeCursor) { NativeCursor = nativeCursor; }
public NSAttributedString(string str, NSFont font = null, NSColor foregroundColor = null, NSColor backgroundColor = null, NSColor strokeColor = null, NSColor underlineColor = null, NSColor strikethroughColor = null, NSUnderlineStyle underlineStyle = NSUnderlineStyle.None, NSUnderlineStyle strikethroughStyle = NSUnderlineStyle.None, NSParagraphStyle paragraphStyle = null, float strokeWidth = 0, NSShadow shadow = null, NSUrl link = null, bool superscript = false, NSTextAttachment attachment = null, NSLigatureType ligature = NSLigatureType.Default, float baselineOffset = 0, float kerningAdjustment = 0, float obliqueness = 0, float expansion = 0, NSCursor cursor = null, string toolTip = null, int characterShape = 0, NSGlyphInfo glyphInfo = null, NSArray writingDirection = null, bool markedClauseSegment = false, NSTextLayoutOrientation verticalGlyphForm = NSTextLayoutOrientation.Horizontal, NSTextAlternatives textAlternatives = null, NSSpellingState spellingState = NSSpellingState.None) : this(str, NSStringAttributes.ToDictionary ( font: font, foregroundColor: foregroundColor, backgroundColor: backgroundColor, strokeColor: strokeColor, underlineColor: underlineColor, strikethroughColor: strikethroughColor, underlineStyle: underlineStyle, strikethroughStyle: strikethroughStyle, paragraphStyle: paragraphStyle, strokeWidth: strokeWidth, shadow: shadow, link: link, superscript: superscript, attachment: attachment, ligature: ligature, baselineOffset: baselineOffset, kerningAdjustment: kerningAdjustment, obliqueness: obliqueness, expansion: expansion, cursor: cursor, toolTip: toolTip, characterShape: characterShape, glyphInfo: glyphInfo, writingDirection: writingDirection, markedClauseSegment: markedClauseSegment, verticalGlyphForm: verticalGlyphForm, textAlternatives: textAlternatives, spellingState: spellingState )) { }
private static MouseCursor FromNSCursor(NSCursor cursor) { var implementation = new MouseCursorImplementation(cursor); return(new MouseCursor(implementation)); }
public Cursor(NSCursor native) { Native = native; }
public void SetCursor(NSCursor cursor) { _cursor = cursor; Window.InvalidateCursorRectsForView(this); }
public override void MouseExited(NSEvent theEvent) { NSCursor.Unhide(); }