Exemplo n.º 1
0
		public StatusIcon (StatusBar bar) : base (CGRect.Empty)
		{
			imageView = new NSImageView (CGRect.Empty);
			AddSubview (imageView);

			var trackingArea = new NSTrackingArea (CGRect.Empty, NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect | NSTrackingAreaOptions.MouseEnteredAndExited, this, null);
			AddTrackingArea (trackingArea);

			this.bar = bar;
		}
Exemplo n.º 2
0
		public AwesomeBar ()
		{
			RunButton = new RunButton ();
			AddSubview (RunButton);

			SelectorView = new SelectorView ();
			SelectorView.SizeChanged += (object sender, EventArgs e) => UpdateLayout ();
			AddSubview (SelectorView);

			ButtonBarContainer = new ButtonBarContainer ();
			ButtonBarContainer.SizeChanged += (object sender, EventArgs e) => UpdateLayout ();
			AddSubview (ButtonBarContainer);

			StatusBar = new StatusBar ();
			AddSubview (StatusBar);

			SearchBar = new SearchBar ();
			AddSubview (SearchBar);
		}
Exemplo n.º 3
0
		NSToolbarItem CreateStatusBarToolbarItem ()
		{
			var bar = new StatusBar ();
			viewCache.Add (bar);
			var item = new NSToolbarItem (StatusBarId) {
				View = bar,
				// Place some temporary values in there.
				MinSize = new CGSize (360, 22),
				MaxSize = new CGSize (360, 22),
			};

			Action<NSNotification> resizeAction = notif => DispatchService.GuiDispatch (() => {
				// Skip updates with a null Window. Only crashes on Mavericks.
				// The View gets updated once again when the window resize finishes.
				if (bar.Window == null)
					return;

				// We're getting notified about all windows in the application (for example, NSPopovers) that change size when really we only care about
				// the window the bar is in.
				if (notif.Object != bar.Window)
					return;

				double maxSize = Math.Round (bar.Window.Frame.Width * 0.30f);
				double minSize = Math.Round (bar.Window.Frame.Width * 0.25f);
				item.MinSize = new CGSize ((nfloat)Math.Max (220, minSize), 22);
				item.MaxSize = new CGSize ((nfloat)Math.Min (700, maxSize), 22);
				bar.RepositionStatusLayers ();
			});

			NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, resizeAction);
			NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEndLiveResizeNotification, resizeAction);
			return item;
		}
Exemplo n.º 4
0
		public StatusIcon (StatusBar bar, CALayer layer, NSTrackingArea trackingArea)
		{
			this.bar = bar;
			this.layer = layer;
			TrackingArea = trackingArea;
		}
Exemplo n.º 5
0
		NSToolbarItem CreateStatusBarToolbarItem ()
		{
			var bar = new StatusBar ();
			viewCache.Add (bar);
			var item = new NSToolbarItem (StatusBarId) {
				View = bar,
				// Place some temporary values in there.
				MinSize = new CGSize (360, 22),
				MaxSize = new CGSize (360, 22),
			};

			NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif => DispatchService.GuiDispatch (() => {
				// Skip updates with a null Window. Only crashes on Mavericks.
				// The View gets updated once again when the window resize finishes.
				if (bar.Window == null)
					return;

				double maxSize = Math.Round (bar.Window.Frame.Width * 0.30f);
				double minSize = Math.Round (bar.Window.Frame.Width * 0.25f);
				item.MinSize = new CGSize ((nfloat)Math.Max (280, minSize), 22);
				item.MaxSize = new CGSize ((nfloat)Math.Min (700, maxSize), 22);
				bar.RepositionStatusLayers ();
			}));
			return item;
		}
Exemplo n.º 6
0
 public override void MouseUp(NSEvent theEvent)
 {
     NotifyClicked(StatusBar.NSEventButtonToXwt(theEvent));
 }
Exemplo n.º 7
0
 public StatusIcon(StatusBar bar, CALayer layer, NSTrackingArea trackingArea)
 {
     this.bar     = bar;
     this.layer   = layer;
     TrackingArea = trackingArea;
 }