public StatusBarContext CreateContext() { StatusBarContextImpl ctx = new StatusBarContextImpl(this); contexts.Add(ctx); return(ctx); }
public StatusBarContextHandler(StatusBar statusBar) { StatusBar = statusBar; mainContext = new MainStatusBarContextImpl(this); activeContext = mainContext; contexts.Add(mainContext); }
internal void UpdateActiveContext() { for (int n = contexts.Count - 1; n >= 0; n--) { StatusBarContextImpl ctx = contexts [n]; if (ctx.StatusChanged) { if (ctx != activeContext) { activeContext = ctx; activeContext.Update(); } return; } } throw new InvalidOperationException(); // There must be at least the main context }
internal void Remove(StatusBarContextImpl ctx) { if (ctx == mainContext) { return; } StatusBarContextImpl oldActive = activeContext; contexts.Remove(ctx); UpdateActiveContext(); if (oldActive != activeContext) { // Removed the active context. Update the status bar. activeContext.Update(); } }
public StatusArea() { theme = new StatusAreaTheme(); renderArg = new RenderArg(); mainContext = new MainStatusBarContextImpl(this); activeContext = mainContext; contexts.Add(mainContext); VisibleWindow = false; NoShowAll = true; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; statusIconBox.BorderWidth = 0; statusIconBox.Spacing = 3; Action <bool> animateProgressBar = showing => this.Animate("ProgressBarFade", val => renderArg.ProgressBarAlpha = val, renderArg.ProgressBarAlpha, showing ? 1.0f : 0.0f, easing: Easing.CubicInOut); ProgressBegin += delegate { renderArg.ShowProgressBar = true; // StartBuildAnimation (); renderArg.ProgressBarFraction = 0; QueueDraw(); animateProgressBar(true); }; ProgressEnd += delegate { renderArg.ShowProgressBar = false; // StopBuildAnimation (); QueueDraw(); animateProgressBar(false); }; ProgressFraction += delegate(object sender, FractionEventArgs e) { renderArg.ProgressBarFraction = (float)e.Work; QueueDraw(); }; contentBox.PackStart(messageBox, true, true, 0); contentBox.PackEnd(statusIconBox, false, false, 0); contentBox.PackEnd(statusIconSeparator = new StatusAreaSeparator(), false, false, 0); contentBox.PackEnd(buildResultWidget = CreateBuildResultsWidget(Orientation.Horizontal), false, false, 0); HasTooltip = true; QueryTooltip += messageBoxToolTip; mainAlign = new Alignment(0, 0.5f, 1, 0); mainAlign.LeftPadding = 12; mainAlign.RightPadding = 8; mainAlign.Add(contentBox); Add(mainAlign); mainAlign.ShowAll(); statusIconBox.Hide(); statusIconSeparator.Hide(); buildResultWidget.Hide(); Show(); this.ButtonPressEvent += delegate { if (sourcePad != null) { sourcePad.BringToFront(true); } }; statusIconBox.Shown += delegate { UpdateSeparators(); }; statusIconBox.Hidden += delegate { UpdateSeparators(); }; messageQueue = new Queue <Message> (); tracker = new MouseTracker(this); tracker.MouseMoved += (sender, e) => QueueDraw(); tracker.HoveredChanged += (sender, e) => { this.Animate("Hovered", x => renderArg.HoverProgress = x, renderArg.HoverProgress, tracker.Hovered ? 1.0f : 0.0f, easing: Easing.SinInOut); }; IdeApp.FocusIn += delegate { // If there was an error while the application didn't have the focus, // trigger the error animation again when it gains the focus if (errorAnimPending) { errorAnimPending = false; TriggerErrorAnimation(); } }; }
internal bool IsCurrentContext(StatusBarContextImpl ctx) { return(ctx == activeContext); }