Example #1
0
		public DockBarItem (DockBar bar, DockItem it, int size)
		{
			Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
			this.size = size;
			this.bar = bar;
			this.it = it;
			VisibleWindow = false;
			UpdateTab ();
			lastFrameSize = bar.Frame.Allocation.Size;
			bar.Frame.SizeAllocated += HandleBarFrameSizeAllocated;

			tracker = new MouseTracker (this);
			tracker.TrackMotion = false;
			tracker.HoveredChanged += (sender, e) => {

				if (crossfade == null)
					return;
	
				AnimateHover (tracker.Hovered);
				if (tracker.Hovered)
					crossfade.ShowSecondary ();
				else
					crossfade.ShowPrimary ();
			};

			Styles.Changed += UpdateStyle;
		}
		public TabStrip (DockNotebook notebook)
		{
			if (notebook == null)
				throw new ArgumentNullException ("notebook");
			TabWidth = 125;
			TargetWidth = 125;
			tracker = new MouseTracker (this);
			GtkWorkarounds.FixContainerLeak (this);

			this.notebook = notebook;
			WidgetFlags |= Gtk.WidgetFlags.AppPaintable;
			Events |= EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask;

			var arr = new Xwt.ImageView (tabbarPrevImage);
			arr.HeightRequest = arr.WidthRequest = 10;

			var alignment = new Alignment (0.5f, 0.5f, 0.0f, 0.0f);
			alignment.Add (arr.ToGtkWidget ());
			PreviousButton = new Button (alignment);
			PreviousButton.Relief = ReliefStyle.None;
			PreviousButton.CanDefault = PreviousButton.CanFocus = false;

			arr = new Xwt.ImageView (tabbarNextImage);
			arr.HeightRequest = arr.WidthRequest = 10;

			alignment = new Alignment (0.5f, 0.5f, 0.0f, 0.0f);
			alignment.Add (arr.ToGtkWidget ());
			NextButton = new Button (alignment);
			NextButton.Relief = ReliefStyle.None;
			NextButton.CanDefault = NextButton.CanFocus = false;

			DropDownButton = new MenuButton ();
			DropDownButton.Relief = ReliefStyle.None;
			DropDownButton.CanDefault = DropDownButton.CanFocus = false;

			PreviousButton.ShowAll ();
			NextButton.ShowAll ();
			DropDownButton.ShowAll ();

			PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton";
			NextButton.Name = "MonoDevelop.DockNotebook.BarButton";
			DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton";

			PreviousButton.Parent = this;
			NextButton.Parent = this;
			DropDownButton.Parent = this;

			children.Add (PreviousButton);
			children.Add (NextButton);
			children.Add (DropDownButton);

			tracker.HoveredChanged += (sender, e) => {
				if (!tracker.Hovered) {
					SetHighlightedTab (null);
					UpdateTabWidth (tabEndX - tabStartX);
					QueueDraw ();
				}
			};

			notebook.PageAdded += (sender, e) => QueueResize ();
			notebook.PageRemoved += (sender, e) => QueueResize ();

			closingTabs = new Dictionary<int, DockNotebookTab> ();
		}
Example #3
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 ();
                }
            };
        }
		public WelcomePageFirstRun ()
		{
			VisibleWindow = false;
			SetSizeRequest (WidgetSize.Width, WidgetSize.Height);

			string iconFile = BrandingService.GetString ("ApplicationIcon");
			if (iconFile != null) {
				iconFile = BrandingService.GetFile (iconFile);
				brandedIcon = Xwt.Drawing.Image.FromFile (iconFile);
			}

			TitleOffset = TextOffset = IconOffset = new Gdk.Point ();

			tracker = new MouseTracker (this);
			tracker.MouseMoved += (sender, e) => {
				ButtonHovered = new Gdk.Rectangle (ButtonPosistion, ButtonSize).Contains (tracker.MousePosition);
			};

			tracker.HoveredChanged += (sender, e) => {
				if (!tracker.Hovered) 
					ButtonHovered = false;
			};
		}
Example #5
0
		public TabStrip (DockNotebook notebook)
		{
			TabWidth = 125;
			TargetWidth = 125;
			tracker = new MouseTracker (this);
			GtkWorkarounds.FixContainerLeak (this);

			this.notebook = notebook;
			WidgetFlags |= Gtk.WidgetFlags.AppPaintable;
			Events |= Gdk.EventMask.PointerMotionMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonPressMask;

			var arr = new Gtk.Image (Gdk.Pixbuf.LoadFromResource ("tabbar-prev.png"));
			arr.HeightRequest = arr.WidthRequest = 10;
			PreviousButton = new Button (arr);
			PreviousButton.Relief = ReliefStyle.None;
			PreviousButton.CanDefault = PreviousButton.CanFocus = false;

			arr = new Gtk.Image (Gdk.Pixbuf.LoadFromResource ("tabbar-next.png"));
			arr.HeightRequest = arr.WidthRequest = 10;
			NextButton = new Button (arr);
			NextButton.Relief = ReliefStyle.None;
			NextButton.CanDefault = NextButton.CanFocus = false;

			DropDownButton = new MenuButton ();
			DropDownButton.Relief = ReliefStyle.None;
			DropDownButton.CanDefault = DropDownButton.CanFocus = false;

			PreviousButton.ShowAll ();
			NextButton.ShowAll ();
			DropDownButton.ShowAll ();

			PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton";
			NextButton.Name = "MonoDevelop.DockNotebook.BarButton";
			DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton";

			PreviousButton.Parent = this;
			NextButton.Parent = this;
			DropDownButton.Parent = this;

			children.Add (PreviousButton);
			children.Add (NextButton);
			children.Add (DropDownButton);

			tracker.HoveredChanged += (sender, e) => {
				if (!tracker.Hovered) {
					SetHighlightedTab (null);
					UpdateTabWidth (tabEndX - tabStartX);
					QueueDraw ();
				}
			};

			notebook.PageAdded += (object sender, EventArgs e) => QueueResize ();
			notebook.PageRemoved += (object sender, EventArgs e) => QueueResize ();

			closingTabs = new Dictionary<int, DockNotebookTab> ();
		}