예제 #1
0
        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();
                }
            };
        }
예제 #2
0
        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 ();
                }
            };
        }