public WelcomePageBarButton(string title, string href, string iconResource = null) { FontFamily = Platform.IsMac ? Styles.WelcomeScreen.FontFamilyMac : Styles.WelcomeScreen.FontFamilyWindows; HoverColor = Styles.WelcomeScreen.Links.HoverColor; Color = Styles.WelcomeScreen.Links.Color; FontSize = Styles.WelcomeScreen.Links.FontSize; VisibleWindow = false; this.Text = GettextCatalog.GetString(title); this.actionLink = href; if (!string.IsNullOrEmpty(iconResource)) { imageHover = Xwt.Drawing.Image.FromResource(iconResource); imageNormal = imageHover.WithAlpha(0.7); } IconTextSpacing = Styles.WelcomeScreen.Links.IconTextSpacing; image = new Xwt.ImageView(); label = CreateLabel(); imageWidget = image.ToGtkWidget(); box.PackStart(imageWidget, false, false, 0); if (imageNormal == null) { imageWidget.NoShowAll = true; } box.PackStart(label, false, false, 0); box.ShowAll(); Add(box); Update(); Events |= (Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask); }
public PadTitleWindow(DockFrame frame, DockItem draggedItem) : base(Gtk.WindowType.Popup) { SkipTaskbarHint = true; Decorated = false; TransientFor = (Gtk.Window)frame.Toplevel; TypeHint = WindowTypeHint.Utility; var mainBox = new VBox(); var box = new HBox(false, 3); if (draggedItem.Icon != null) { var img = new Xwt.ImageView(draggedItem.Icon); box.PackStart(img.ToGtkWidget(), false, false, 0); } var la = new Label(); la.Markup = draggedItem.Label; box.PackStart(la, false, false, 0); mainBox.PackStart(box, false, false, 0); var f = new CustomFrame(); f.SetPadding(12, 12, 12, 12); f.SetMargins(1, 1, 1, 1); f.Add(mainBox); Add(f); ShowAll(); }
public TabLabel (Label label, Gtk.Image icon) : base (false, 0) { this.title = label; this.icon = icon; icon.Xpad = 2; EventBox eventBox = new EventBox (); eventBox.BorderWidth = 0; eventBox.VisibleWindow = false; eventBox.Add (icon); this.PackStart (eventBox, false, true, 0); titleBox = new EventBox (); titleBox.VisibleWindow = false; titleBox.Add (title); this.PackStart (titleBox, true, true, 0); Gtk.Rc.ParseString ("style \"MonoDevelop.TabLabel.CloseButton\" {\n GtkButton::inner-border = {0,0,0,0}\n }\n"); Gtk.Rc.ParseString ("widget \"*.MonoDevelop.TabLabel.CloseButton\" style \"MonoDevelop.TabLabel.CloseButton\"\n"); Button button = new Button (); button.CanDefault = false; var closeIcon = new Xwt.ImageView (closeImage).ToGtkWidget (); button.Image = closeIcon; button.Relief = ReliefStyle.None; button.BorderWidth = 0; button.Clicked += new EventHandler(ButtonClicked); button.Name = "MonoDevelop.TabLabel.CloseButton"; this.PackStart (button, false, true, 0); this.ClearFlag (WidgetFlags.CanFocus); this.BorderWidth = 0; this.ShowAll (); }
public WelcomePageBarButton(string title, string href, string iconResource = null) { FontFamily = Platform.IsMac ? Styles.WelcomeScreen.FontFamilyMac : Styles.WelcomeScreen.FontFamilyWindows; HoverColor = Styles.WelcomeScreen.Links.HoverColor; Color = Styles.WelcomeScreen.Links.Color; FontSize = Styles.WelcomeScreen.Links.FontSize; VisibleWindow = false; this.Text = GettextCatalog.GetString (title); this.actionLink = href; if (!string.IsNullOrEmpty (iconResource)) { imageHover = Xwt.Drawing.Image.FromResource (iconResource); imageNormal = imageHover.WithAlpha (0.7); } IconTextSpacing = Styles.WelcomeScreen.Links.IconTextSpacing; image = new Xwt.ImageView (); label = CreateLabel (); imageWidget = image.ToGtkWidget (); box.PackStart (imageWidget, false, false, 0); if (imageNormal == null) imageWidget.NoShowAll = true; box.PackStart (label, false, false, 0); box.ShowAll (); Add (box); Update (); Events |= (Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask); }
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 Xwt.ImageView(tabbarPrevImage); arr.HeightRequest = arr.WidthRequest = 10; PreviousButton = new Button(arr.ToGtkWidget()); PreviousButton.Relief = ReliefStyle.None; PreviousButton.CanDefault = PreviousButton.CanFocus = false; arr = new Xwt.ImageView(tabbarNextImage); arr.HeightRequest = arr.WidthRequest = 10; NextButton = new Button(arr.ToGtkWidget()); 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> (); }
public override Control CreateWidget() { var icon = Xwt.Drawing.Image.FromResource("lightning-16.png"); var image = new Xwt.ImageView(icon).ToGtkWidget(); var box = new HBox(false, 6); var vb = new VBox(); vb.PackStart(image, false, false, 0); box.PackStart(vb, false, false, 0); vb = new VBox(false, 6); typeLabel = new Label { Xalign = 0 }; vb.PackStart(typeLabel); messageLabel = new Label { Xalign = 0, NoShowAll = true }; vb.PackStart(messageLabel); var detailsBtn = new Xwt.LinkLabel(GettextCatalog.GetString("Show Details")); var hh = new HBox(); detailsBtn.NavigateToUrl += (o, e) => dlg.ShowDialog(); hh.PackStart(detailsBtn.ToGtkWidget(), false, false, 0); vb.PackStart(hh, false, false, 0); box.PackStart(vb, true, true, 0); vb = new VBox(); var closeButton = new ImageButton { InactiveImage = closeSelImage, Image = closeSelOverImage }; closeButton.Clicked += delegate { dlg.ShowMiniButton(); }; vb.PackStart(closeButton, false, false, 0); box.PackStart(vb, false, false, 0); exception.Changed += delegate { Application.Invoke(delegate { LoadData(); }); }; LoadData(); var eb = new PopoverWidget(); eb.ShowArrow = true; eb.EnableAnimation = true; eb.PopupPosition = PopupPosition.Left; eb.ContentBox.Add(box); eb.ShowAll(); return(eb); }
public PinWindow(Gtk.Window parent) { Events |= EventMask.ButtonPressMask; TransientFor = parent; DestroyWithParent = true; icon = new Xwt.ImageView(); Add(icon.ToGtkWidget()); AcceptFocus = false; }
public override Xwt.Widget Makeup(IXwtWrapper Parent) { Xwt.ImageView Target = new Xwt.ImageView(); if (Image != "") { Xwt.Drawing.Image img = Xwt.Drawing.Image.FromResource(System.Reflection.Assembly.GetEntryAssembly(), Image); //Target.Image = img; Target.BoundsChanged += (o, e) => { Target.Image = img.WithSize(Target.Size); }; } InitWidget(Target, Parent); return Target; }
public WelcomePageBarButton(string title, string href, string iconResource = null) { var actionHandler = new ActionDelegate(this); actionHandler.PerformPress += HandlePress; Accessible.Role = Atk.Role.Link; Accessible.SetTitle(title); if (!string.IsNullOrEmpty(href)) { Accessible.SetUrl(href); } Accessible.Description = "Opens the link in a web browser"; UpdateStyle(); VisibleWindow = false; this.Text = title; this.actionLink = href; if (!string.IsNullOrEmpty(iconResource)) { imageHover = Xwt.Drawing.Image.FromResource(iconResource); imageNormal = imageHover.WithAlpha(0.7); } box.Accessible.SetShouldIgnore(true); IconTextSpacing = Styles.WelcomeScreen.Links.IconTextSpacing; image = new Xwt.ImageView(); label = CreateLabel(); imageWidget = image.ToGtkWidget(); label.Accessible.SetShouldIgnore(true); imageWidget.Accessible.SetShouldIgnore(true); box.PackStart(imageWidget, false, false, 0); if (imageNormal == null) { imageWidget.NoShowAll = true; } box.PackStart(label, false, false, 0); box.ShowAll(); Add(box); Gui.Styles.Changed += UpdateStyle; Update(); Events |= (Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask); }
public PadTitleWindow(DockFrame frame, DockItem draggedItem) : base(Gtk.WindowType.Popup) { SkipTaskbarHint = true; Decorated = false; TransientFor = (Gtk.Window)frame.Toplevel; TypeHint = WindowTypeHint.Utility; VBox mainBox = new VBox(); HBox box = new HBox(false, 3); if (draggedItem.Icon != null) { var img = new Xwt.ImageView(draggedItem.Icon); box.PackStart(img.ToGtkWidget(), false, false, 0); } Gtk.Label la = new Label(); la.Markup = draggedItem.Label; box.PackStart(la, false, false, 0); mainBox.PackStart(box, false, false, 0); /* if (draggedItem.Widget.IsRealized) { * var win = draggedItem.Widget.GdkWindow; * var alloc = draggedItem.Widget.Allocation; * Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable (win, win.Colormap, alloc.X, alloc.Y, 0, 0, alloc.Width, alloc.Height); * * double mw = 140, mh = 140; * if (img.Width > img.Height) * mw *= 2; * else * mh *= 2; * * double r = Math.Min (mw / img.Width, mh / img.Height); * img = img.ScaleSimple ((int)(img.Width * r), (int)(img.Height * r), Gdk.InterpType.Hyper); * mainBox.PackStart (new Gtk.Image (img), false, false, 0); * }*/ CustomFrame f = new CustomFrame(); f.SetPadding(12, 12, 12, 12); f.SetMargins(1, 1, 1, 1); f.Add(mainBox); Add(f); ShowAll(); }
public StatusIcon(StatusArea statusBar, Xwt.Drawing.Image icon) { if (!icon.HasFixedSize) { icon = icon.WithSize(IconSize.Menu); } this.statusBar = statusBar; this.icon = icon; box = new EventBox(); box.VisibleWindow = false; image = new Xwt.ImageView(icon); box.Child = image.ToGtkWidget(); box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; }
public DocumentTitleWindow(PlaceholderWindow placeholder, DockNotebookTab draggedItem) : base(Gtk.WindowType.Toplevel) { this.placeholder = placeholder; SkipTaskbarHint = true; Decorated = false; //TransientFor = parent; TypeHint = WindowTypeHint.Utility; VBox mainBox = new VBox(); mainBox.Spacing = 3; titleBox = new HBox(false, 3); if (draggedItem.Icon != null) { var img = new Xwt.ImageView(draggedItem.Icon); titleBox.PackStart(img.ToGtkWidget(), false, false, 0); } Gtk.Label la = new Label(); la.Markup = draggedItem.Text; titleBox.PackStart(la, false, false, 0); mainBox.PackStart(titleBox, false, false, 0); var wi = RenderWidget(draggedItem.Content); if (wi != null) { wi = wi.WithBoxSize(200); mainBox.PackStart(new ImageView(wi), false, false, 0); } CustomFrame f = new CustomFrame(); f.SetPadding(2, 2, 2, 2); f.SetMargins(1, 1, 1, 1); f.Add(mainBox); Add(f); mainBox.CanFocus = true; Child.ShowAll(); }
public TView CreateViewElement <TView>(ITextView textView, object model) where TView : class { // Should never happen if the service's code is correct, but it's good to be paranoid. if (typeof(TView) != typeof(UIElement) || !(model is ImageElement element)) { throw new ArgumentException($"Invalid type conversion. Unsupported {nameof(model)} or {nameof(TView)} type"); } var imageElement = new Xwt.ImageView(); imageElement.Image = MonoDevelop.Ide.ImageService.GetIcon("md-monodevelop"); // Add a slight margin so we don't contact any ClassifiedTextElements directly following us. imageElement.Margin = new Xwt.WidgetSpacing(4, 4, 4, 4); imageElement.HorizontalPlacement = Xwt.WidgetPlacement.Start; imageElement.HorizontalPlacement = Xwt.WidgetPlacement.Start; return(imageElement as TView); }
public StatusIcon(StatusArea statusBar, Xwt.Drawing.Image icon) { if (!icon.HasFixedSize) { icon = icon.WithSize(IconSize.Menu); } this.statusBar = statusBar; this.icon = icon; box = new EventBox(); box.VisibleWindow = false; image = new Xwt.ImageView(icon); box.Child = image.ToGtkWidget(); box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; box.ButtonPressEvent += (o, e) => { // TODO: Refactor this in Xwt as an extension method. var m = Xwt.ModifierKeys.None; if ((e.Event.State & Gdk.ModifierType.ShiftMask) != 0) { m |= Xwt.ModifierKeys.Shift; } if ((e.Event.State & Gdk.ModifierType.ControlMask) != 0) { m |= Xwt.ModifierKeys.Control; } if ((e.Event.State & Gdk.ModifierType.Mod1Mask) != 0) { m |= Xwt.ModifierKeys.Alt; } // TODO: Backport this one. if ((e.Event.State & Gdk.ModifierType.Mod2Mask) != 0) { m |= Xwt.ModifierKeys.Command; } Clicked(o, new StatusBarIconClickedEventArgs { Button = (Xwt.PointerButton)e.Event.Button, Modifiers = m, }); }; }
public DocumentTitleWindow(PlaceholderWindow placeholder, DockNotebookTab draggedItem) : base(Gtk.WindowType.Toplevel) { this.placeholder = placeholder; SkipTaskbarHint = true; Decorated = false; //TransientFor = parent; TypeHint = WindowTypeHint.Utility; VBox mainBox = new VBox (); mainBox.Spacing = 3; titleBox = new HBox (false, 3); if (draggedItem.Icon != null) { var img = new Xwt.ImageView (draggedItem.Icon); titleBox.PackStart (img.ToGtkWidget (), false, false, 0); } Gtk.Label la = new Label (); la.Markup = draggedItem.Text; titleBox.PackStart (la, false, false, 0); mainBox.PackStart (titleBox, false, false, 0); var wi = RenderWidget (draggedItem.Content); if (wi != null) { wi = wi.WithBoxSize (200); mainBox.PackStart (new ImageView (wi), false, false, 0); } CustomFrame f = new CustomFrame (); f.SetPadding (2, 2, 2, 2); f.SetMargins (1, 1, 1, 1); f.Add (mainBox); Add (f); mainBox.CanFocus = true; Child.ShowAll (); }
public TabLabel(Label label, ImageView icon) : base(false, 0) { this.title = label; this.icon = icon; icon.Xpad = 2; EventBox eventBox = new EventBox(); eventBox.BorderWidth = 0; eventBox.VisibleWindow = false; eventBox.Add(icon); this.PackStart(eventBox, false, true, 0); titleBox = new EventBox(); titleBox.VisibleWindow = false; titleBox.Add(title); this.PackStart(titleBox, true, true, 0); Gtk.Rc.ParseString("style \"MonoDevelop.TabLabel.CloseButton\" {\n GtkButton::inner-border = {0,0,0,0}\n }\n"); Gtk.Rc.ParseString("widget \"*.MonoDevelop.TabLabel.CloseButton\" style \"MonoDevelop.TabLabel.CloseButton\"\n"); Button button = new Button(); button.CanDefault = false; var closeIcon = new Xwt.ImageView(closeImage).ToGtkWidget(); button.Image = closeIcon; button.Relief = ReliefStyle.None; button.BorderWidth = 0; button.Clicked += new EventHandler(ButtonClicked); button.Name = "MonoDevelop.TabLabel.CloseButton"; this.PackStart(button, false, true, 0); this.ClearFlag(WidgetFlags.CanFocus); this.BorderWidth = 0; this.ShowAll(); }
public PadTitleWindow (DockFrame frame, DockItem draggedItem): base (Gtk.WindowType.Popup) { SkipTaskbarHint = true; Decorated = false; TransientFor = (Gtk.Window) frame.Toplevel; TypeHint = WindowTypeHint.Utility; VBox mainBox = new VBox (); HBox box = new HBox (false, 3); if (draggedItem.Icon != null) { var img = new Xwt.ImageView (draggedItem.Icon); box.PackStart (img.ToGtkWidget (), false, false, 0); } Gtk.Label la = new Label (); la.Markup = draggedItem.Label; box.PackStart (la, false, false, 0); mainBox.PackStart (box, false, false, 0); /* if (draggedItem.Widget.IsRealized) { var win = draggedItem.Widget.GdkWindow; var alloc = draggedItem.Widget.Allocation; Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable (win, win.Colormap, alloc.X, alloc.Y, 0, 0, alloc.Width, alloc.Height); double mw = 140, mh = 140; if (img.Width > img.Height) mw *= 2; else mh *= 2; double r = Math.Min (mw / img.Width, mh / img.Height); img = img.ScaleSimple ((int)(img.Width * r), (int)(img.Height * r), Gdk.InterpType.Hyper); mainBox.PackStart (new Gtk.Image (img), false, false, 0); }*/ CustomFrame f = new CustomFrame (); f.SetPadding (12, 12, 12, 12); f.SetMargins (1, 1, 1, 1); f.Add (mainBox); Add (f); ShowAll (); }
public PadTitleWindow (DockFrame frame, DockItem draggedItem) : base (Gtk.WindowType.Popup) { SkipTaskbarHint = true; Decorated = false; TransientFor = (Gtk.Window)frame.Toplevel; TypeHint = WindowTypeHint.Utility; var mainBox = new VBox (); var box = new HBox (false, 3); if (draggedItem.Icon != null) { var img = new Xwt.ImageView (draggedItem.Icon); box.PackStart (img.ToGtkWidget (), false, false, 0); } var la = new Label (); la.Markup = draggedItem.Label; box.PackStart (la, false, false, 0); mainBox.PackStart (box, false, false, 0); var f = new CustomFrame (); f.SetPadding (12, 12, 12, 12); f.SetMargins (1, 1, 1, 1); f.Add (mainBox); Add (f); ShowAll (); }
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> (); }
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, 1, 0.0f, 0.0f); alignment.Add(arr.ToGtkWidget()); PreviousButton = new Button(alignment); PreviousButton.TooltipText = Core.GettextCatalog.GetString("Switch to previous document"); PreviousButton.Relief = ReliefStyle.None; PreviousButton.CanDefault = PreviousButton.CanFocus = false; arr = new Xwt.ImageView(tabbarNextImage); arr.HeightRequest = arr.WidthRequest = 10; alignment = new Alignment(0.5f, 1, 0.0f, 0.0f); alignment.Add(arr.ToGtkWidget()); NextButton = new Button(alignment); NextButton.TooltipText = Core.GettextCatalog.GetString("Switch to next document"); NextButton.Relief = ReliefStyle.None; NextButton.CanDefault = NextButton.CanFocus = false; DropDownButton = new MenuButton(); DropDownButton.TooltipText = Core.GettextCatalog.GetString("Document List"); 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> (); }
public override Control CreateWidget () { var icon = Xwt.Drawing.Image.FromResource ("lightning-16.png"); var image = new Xwt.ImageView (icon).ToGtkWidget (); var box = new HBox (false, 6); var vb = new VBox (); vb.PackStart (image, false, false, 0); box.PackStart (vb, false, false, 0); vb = new VBox (false, 6); typeLabel = new Label { Xalign = 0 }; vb.PackStart (typeLabel); messageLabel = new Label { Xalign = 0, NoShowAll = true }; vb.PackStart (messageLabel); var detailsBtn = new Xwt.LinkLabel (GettextCatalog.GetString ("Show Details")); var hh = new HBox (); detailsBtn.NavigateToUrl += (o, e) => dlg.ShowDialog (); hh.PackStart (detailsBtn.ToGtkWidget (), false, false, 0); vb.PackStart (hh, false, false, 0); box.PackStart (vb, true, true, 0); vb = new VBox (); var closeButton = new ImageButton { InactiveImage = closeSelImage, Image = closeSelOverImage }; closeButton.Clicked += delegate { dlg.ShowMiniButton (); }; vb.PackStart (closeButton, false, false, 0); box.PackStart (vb, false, false, 0); exception.Changed += delegate { Application.Invoke (delegate { LoadData (); }); }; LoadData (); var eb = new PopoverWidget (); eb.ShowArrow = true; eb.EnableAnimation = true; eb.PopupPosition = PopupPosition.Left; eb.ContentBox.Add (box); eb.ShowAll (); return eb; }
public TabStrip(DockNotebook notebook) { if (notebook == null) { throw new ArgumentNullException("notebook"); } Accessible.SetRole(AtkCocoa.Roles.AXTabGroup); // Handle focus for the tabs. CanFocus = true; TabWidth = 125; TargetWidth = 125; tracker = new MouseTracker(this); GtkWorkarounds.FixContainerLeak(this); innerBox = new HBox(false, 0); innerBox.Accessible.SetShouldIgnore(true); Add(innerBox); 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.TooltipText = Core.GettextCatalog.GetString("Switch to previous document"); PreviousButton.Relief = ReliefStyle.None; PreviousButton.CanDefault = false; PreviousButton.CanFocus = true; PreviousButton.Accessible.Name = "DockNotebook.Tabstrip.PreviousButton"; PreviousButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Previous document")); PreviousButton.Accessible.Description = Core.GettextCatalog.GetString("Switch to previous document"); 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.TooltipText = Core.GettextCatalog.GetString("Switch to next document"); NextButton.Relief = ReliefStyle.None; NextButton.CanDefault = false; NextButton.CanFocus = true; NextButton.Accessible.Name = "DockNotebook.Tabstrip.NextButton"; NextButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Next document")); NextButton.Accessible.Description = Core.GettextCatalog.GetString("Switch to next document"); DropDownButton = new MenuButton(); DropDownButton.TooltipText = Core.GettextCatalog.GetString("Document List"); DropDownButton.Relief = ReliefStyle.None; DropDownButton.CanDefault = false; DropDownButton.CanFocus = true; DropDownButton.Accessible.Name = "DockNotebook.Tabstrip.DocumentListButton"; DropDownButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Document list")); DropDownButton.Accessible.Description = Core.GettextCatalog.GetString("Display the document list menu"); PreviousButton.ShowAll(); PreviousButton.NoShowAll = true; NextButton.ShowAll(); NextButton.NoShowAll = true; DropDownButton.ShowAll(); PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton"; NextButton.Name = "MonoDevelop.DockNotebook.BarButton"; DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton"; innerBox.PackStart(PreviousButton, false, false, 0); innerBox.PackStart(NextButton, false, false, 0); innerBox.PackEnd(DropDownButton, false, false, 0); tracker.HoveredChanged += (sender, e) => { if (!tracker.Hovered) { SetHighlightedTab(null); UpdateTabWidth(tabEndX - tabStartX); QueueDraw(); } }; foreach (var tab in notebook.Tabs) { Accessible.AddAccessibleElement(tab.Accessible); } UpdateAccessibilityTabs(); notebook.PageAdded += PageAddedHandler; notebook.PageRemoved += PageRemovedHandler; notebook.TabsReordered += PageReorderedHandler; closingTabs = new Dictionary <int, DockNotebookTab> (); }
public Widget CreateBuildResultsWidget(Orientation orientation) { EventBox ebox = new EventBox (); Gtk.Box box; if (orientation == Orientation.Horizontal) box = new HBox (); else box = new VBox (); box.Spacing = 3; var errorIcon = ImageService.GetIcon (StockIcons.Error).WithSize (Xwt.IconSize.Small); var warningIcon = ImageService.GetIcon (StockIcons.Warning).WithSize (Xwt.IconSize.Small); var errorImage = new Xwt.ImageView (errorIcon); var warningImage = new Xwt.ImageView (warningIcon); box.PackStart (errorImage.ToGtkWidget (), false, false, 0); Label errors = new Gtk.Label (); box.PackStart (errors, false, false, 0); box.PackStart (warningImage.ToGtkWidget (), false, false, 0); Label warnings = new Gtk.Label (); box.PackStart (warnings, false, false, 0); box.NoShowAll = true; box.Show (); TaskEventHandler updateHandler = delegate { int ec=0, wc=0; foreach (Task t in TaskService.Errors) { if (t.Severity == TaskSeverity.Error) ec++; else if (t.Severity == TaskSeverity.Warning) wc++; } using (var font = FontService.SansFont.CopyModified (0.8d)) { errors.Visible = ec > 0; errors.ModifyFont (font); errors.Text = ec.ToString (); errorImage.Visible = ec > 0; warnings.Visible = wc > 0; warnings.ModifyFont (font); warnings.Text = wc.ToString (); warningImage.Visible = wc > 0; } ebox.Visible = ec > 0 || wc > 0; UpdateSeparators (); }; updateHandler (null, null); TaskService.Errors.TasksAdded += updateHandler; TaskService.Errors.TasksRemoved += updateHandler; box.Destroyed += delegate { TaskService.Errors.TasksAdded -= updateHandler; TaskService.Errors.TasksRemoved -= updateHandler; }; ebox.VisibleWindow = false; ebox.Add (box); ebox.ShowAll (); ebox.ButtonReleaseEvent += delegate { var pad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> (); pad.BringToFront (); }; errors.Visible = false; errorImage.Visible = false; warnings.Visible = false; warningImage.Visible = false; return ebox; }
public PinWindow (Gtk.Window parent) { Events |= EventMask.ButtonPressMask; TransientFor = parent; DestroyWithParent = true; icon = new Xwt.ImageView (); Add (icon.ToGtkWidget ()); AcceptFocus = false; }
internal MonoDevelopStatusBar() { BorderWidth = 0; Spacing = 0; HasResizeGrip = true; Accessible.Role = Atk.Role.Filler; HeaderBox hb = new HeaderBox(1, 0, 0, 0); hb.Accessible.Role = Atk.Role.Filler; hb.StyleSet += (o, args) => { hb.BorderColor = Styles.DockSeparatorColor.ToGdkColor(); hb.BackgroundColor = Styles.DockBarBackground.ToGdkColor(); }; var mainBox = new HBox(); mainBox.Accessible.Role = Atk.Role.Filler; var alignment = new Alignment(0f, 0f, 0f, 0f); alignment.Accessible.Role = Atk.Role.Filler; mainBox.PackStart(alignment, true, true, 0); hb.Add(mainBox); hb.ShowAll(); PackStart(hb, true, true, 0); // Feedback button if (FeedbackService.Enabled) { CustomFrame fr = new CustomFrame(0, 0, 1, 0); fr.Accessible.Role = Atk.Role.Filler; var px = Xwt.Drawing.Image.FromResource("feedback-16.png"); HBox b = new HBox(false, 3); b.Accessible.Role = Atk.Role.Filler; var im = new Xwt.ImageView(px).ToGtkWidget(); im.Accessible.Role = Atk.Role.Filler; b.PackStart(im); var label = new Gtk.Label(GettextCatalog.GetString("Feedback")); label.Accessible.Role = Atk.Role.Filler; b.PackStart(label); Gtk.Alignment al = new Gtk.Alignment(0f, 0f, 1f, 1f); al.Accessible.Role = Atk.Role.Filler; al.RightPadding = 5; al.LeftPadding = 3; al.Add(b); feedbackButton = new MiniButton(al); feedbackButton.Accessible.SetLabel(GettextCatalog.GetString("Feedback")); feedbackButton.Accessible.Description = GettextCatalog.GetString("Click to send feedback to the development team"); //feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255); fr.Add(feedbackButton); mainBox.PackStart(fr, false, false, 0); feedbackButton.Clicked += HandleFeedbackButtonClicked; feedbackButton.ButtonPressEvent += HandleFeedbackButtonButtonPressEvent; ; feedbackButton.ClickOnRelease = true; FeedbackService.FeedbackPositionGetter = delegate { int x, y; if (feedbackButton.GdkWindow != null) { feedbackButton.GdkWindow.GetOrigin(out x, out y); x += feedbackButton.Allocation.Width; y -= 6; } else { x = y = -1; } return(new Gdk.Point(x, y)); }; } // Dock area CustomFrame dfr = new CustomFrame(0, 0, 1, 0); dfr.Accessible.Role = Atk.Role.Filler; dfr.StyleSet += (o, args) => { dfr.BorderColor = Styles.DockSeparatorColor.ToGdkColor(); }; dfr.ShowAll(); DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow; var dockBar = wb.DockFrame.ExtractDockBar(PositionType.Bottom); dockBar.AlignToEnd = true; dockBar.ShowBorder = false; dockBar.NoShowAll = true; dfr.Add(dockBar); mainBox.PackStart(dfr, false, false, 0); // Resize grip resizeGrip.Accessible.SetRole(AtkCocoa.Roles.AXGrowArea); resizeGrip.WidthRequest = ResizeGripWidth; resizeGrip.HeightRequest = 0; resizeGrip.VisibleWindow = false; mainBox.PackStart(resizeGrip, false, false, 0); resizeGrip.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) { if (args.Event.Button == 1) { GdkWindow.BeginResizeDrag(Gdk.WindowEdge.SouthEast, (int)args.Event.Button, (int)args.Event.XRoot, (int)args.Event.YRoot, args.Event.Time); } }; this.ShowAll(); // // todo: Move this to the CompletionWindowManager when it's possible. // StatusBarContext completionStatus = null; // CompletionWindowManager.WindowShown += delegate { // CompletionListWindow wnd = CompletionWindowManager.Wnd; // if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1) { // if (completionStatus == null) // completionStatus = CreateContext (); // completionStatus.ShowMessage (string.Format (GettextCatalog.GetString ("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo (Commands.TextEditorCommands.ShowCompletionWindow).AccelKey)); // } // }; }
public StatusIcon(StatusArea statusBar, Xwt.Drawing.Image icon) { if (!icon.HasFixedSize) icon = icon.WithSize (IconSize.Menu); this.statusBar = statusBar; this.icon = icon; box = new EventBox (); box.VisibleWindow = false; image = new Xwt.ImageView (icon); box.Child = image.ToGtkWidget (); box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; }
public Widget CreateBuildResultsWidget(Orientation orientation) { EventBox ebox = new EventBox(); Gtk.Box box; if (orientation == Orientation.Horizontal) { box = new HBox(); } else { box = new VBox(); } box.Spacing = 3; var errorIcon = ImageService.GetIcon(StockIcons.Error).WithSize(Xwt.IconSize.Small); var warningIcon = ImageService.GetIcon(StockIcons.Warning).WithSize(Xwt.IconSize.Small); var errorImage = new Xwt.ImageView(errorIcon); var warningImage = new Xwt.ImageView(warningIcon); box.PackStart(errorImage.ToGtkWidget(), false, false, 0); Label errors = new Gtk.Label(); box.PackStart(errors, false, false, 0); box.PackStart(warningImage.ToGtkWidget(), false, false, 0); Label warnings = new Gtk.Label(); box.PackStart(warnings, false, false, 0); box.NoShowAll = true; box.Show(); TaskEventHandler updateHandler = delegate { int ec = 0, wc = 0; foreach (Task t in TaskService.Errors) { if (t.Severity == TaskSeverity.Error) { ec++; } else if (t.Severity == TaskSeverity.Warning) { wc++; } } using (var font = FontService.SansFont.CopyModified(0.8d)) { errors.Visible = ec > 0; errors.ModifyFont(font); errors.Text = ec.ToString(); errorImage.Visible = ec > 0; warnings.Visible = wc > 0; warnings.ModifyFont(font); warnings.Text = wc.ToString(); warningImage.Visible = wc > 0; } ebox.Visible = ec > 0 || wc > 0; UpdateSeparators(); }; updateHandler(null, null); TaskService.Errors.TasksAdded += updateHandler; TaskService.Errors.TasksRemoved += updateHandler; box.Destroyed += delegate { TaskService.Errors.TasksAdded -= updateHandler; TaskService.Errors.TasksRemoved -= updateHandler; }; ebox.VisibleWindow = false; ebox.Add(box); ebox.ShowAll(); ebox.ButtonReleaseEvent += delegate { var pad = IdeApp.Workbench.GetPad <MonoDevelop.Ide.Gui.Pads.ErrorListPad> (); pad.BringToFront(); }; errors.Visible = false; errorImage.Visible = false; warnings.Visible = false; warningImage.Visible = false; return(ebox); }
public OptionsDialog(Gtk.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections) { buttonCancel = new Gtk.Button(Gtk.Stock.Cancel); AddActionWidget(this.buttonCancel, ResponseType.Cancel); buttonOk = new Gtk.Button(Gtk.Stock.Ok); this.ActionArea.PackStart(buttonOk); buttonOk.Clicked += OnButtonOkClicked; mainHBox = new HBox(); tree = new TreeView(); var sw = new ScrolledWindow(); sw.Add(tree); sw.HscrollbarPolicy = PolicyType.Never; sw.VscrollbarPolicy = PolicyType.Automatic; sw.ShadowType = ShadowType.None; var fboxTree = new HeaderBox(); fboxTree.SetMargins(0, 1, 0, 1); fboxTree.SetPadding(0, 0, 0, 0); fboxTree.BackgroundColor = new Gdk.Color(255, 255, 255); fboxTree.Add(sw); mainHBox.PackStart(fboxTree, false, false, 0); Realized += delegate { fboxTree.BackgroundColor = tree.Style.Base(Gtk.StateType.Normal); }; var vbox = new VBox(); mainHBox.PackStart(vbox, true, true, 0); var headerBox = new HBox(false, 6); image = new Xwt.ImageView(); // headerBox.PackStart (image, false, false, 0); labelTitle = new Label(); labelTitle.Xalign = 0; textHeader = new Alignment(0, 0, 1, 1); textHeader.Add(labelTitle); textHeader.BorderWidth = 12; headerBox.PackStart(textHeader, true, true, 0); imageHeader = new OptionsDialogHeader(); imageHeader.Hide(); headerBox.PackStart(imageHeader.ToGtkWidget()); var fboxHeader = new HeaderBox(); fboxHeader.SetMargins(0, 1, 0, 0); fboxHeader.Add(headerBox); // fbox.GradientBackround = true; // fbox.BackgroundColor = new Gdk.Color (255, 255, 255); Realized += delegate { var c = Style.Background(Gtk.StateType.Normal).ToXwtColor(); c.Light += 0.09; fboxHeader.BackgroundColor = c.ToGdkColor(); }; vbox.PackStart(fboxHeader, false, false, 0); pageFrame = new HBox(); var fbox = new HeaderBox(); fbox.SetMargins(0, 1, 0, 0); fbox.ShowTopShadow = true; fbox.Add(pageFrame); vbox.PackStart(fbox, true, true, 0); this.VBox.PackStart(mainHBox, true, true, 0); this.removeEmptySections = removeEmptySections; extensionContext = AddinManager.CreateExtensionContext(); this.mainDataObject = dataObject; this.extensionPath = extensionPath; if (parentWindow != null) { TransientFor = parentWindow; } ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon); store = new TreeStore(typeof(OptionsDialogSection)); tree.Model = store; tree.HeadersVisible = false; // Column 0 is used to add some padding at the left of the expander TreeViewColumn col0 = new TreeViewColumn(); col0.MinWidth = 6; tree.AppendColumn(col0); TreeViewColumn col = new TreeViewColumn(); var crp = new CellRendererImage(); col.PackStart(crp, false); col.SetCellDataFunc(crp, PixbufCellDataFunc); var crt = new CellRendererText(); col.PackStart(crt, true); col.SetCellDataFunc(crt, TextCellDataFunc); tree.AppendColumn(col); tree.ExpanderColumn = col; tree.Selection.Changed += OnSelectionChanged; Child.ShowAll(); InitializeContext(extensionContext); FillTree(); ExpandCategories(); this.DefaultResponse = Gtk.ResponseType.Ok; DefaultWidth = 960; DefaultHeight = 680; }
public StatusIcon (StatusArea statusBar, Xwt.Drawing.Image icon) { if (!icon.HasFixedSize) icon = icon.WithSize (IconSize.Menu); this.statusBar = statusBar; this.icon = icon; box = new EventBox (); box.VisibleWindow = false; image = new Xwt.ImageView (icon); box.Child = image.ToGtkWidget (); box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; box.ButtonPressEvent += (o, e) => { // TODO: Refactor this in Xwt as an extension method. var m = Xwt.ModifierKeys.None; if ((e.Event.State & Gdk.ModifierType.ShiftMask) != 0) m |= Xwt.ModifierKeys.Shift; if ((e.Event.State & Gdk.ModifierType.ControlMask) != 0) m |= Xwt.ModifierKeys.Control; if ((e.Event.State & Gdk.ModifierType.Mod1Mask) != 0) m |= Xwt.ModifierKeys.Alt; // TODO: Backport this one. if ((e.Event.State & Gdk.ModifierType.Mod2Mask) != 0) m |= Xwt.ModifierKeys.Command; Clicked (o, new StatusBarIconClickedEventArgs { Button = (Xwt.PointerButton)e.Event.Button, Modifiers = m, }); }; }