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 GtkAspNetProjectTemplateWizardPageWidget () { this.Build (); if (Platform.IsMac) { int labelPaddingHeight = 5; if (IsYosemiteOrHigher ()) labelPaddingHeight--; includeLabelPadding.HeightRequest = labelPaddingHeight; testingLabelPadding.HeightRequest = labelPaddingHeight; int leftPaddingWidth = 28; mvcDescriptionLeftHandPadding.WidthRequest = leftPaddingWidth; webFormsDescriptionLeftHandPadding.WidthRequest = leftPaddingWidth; webApiDescriptionLeftHandPadding.WidthRequest = leftPaddingWidth; includeUnitTestProjectDescriptionLeftHandPadding.WidthRequest = leftPaddingWidth; } backgroundImage = Xwt.Drawing.Image.FromResource ("aspnet-wizard-page.png"); backgroundImageView = new ImageView (backgroundImage); backgroundImageView.Xalign = 1.0f; backgroundImageView.Yalign = 1.0f; backgroundLargeImageVBox.PackStart (backgroundImageView, true, true, 0); var separatorColor = Ide.Gui.Styles.NewProjectDialog.ProjectConfigurationSeparatorColor.ToGdkColor (); var backgroundColor = Ide.Gui.Styles.NewProjectDialog.ProjectConfigurationLeftHandBackgroundColor.ToGdkColor (); testingSeparator.ModifyBg (StateType.Normal, separatorColor); leftBorderEventBox.ModifyBg (StateType.Normal, backgroundColor); configurationTopEventBox.ModifyBg (StateType.Normal, backgroundColor); configurationTableEventBox.ModifyBg (StateType.Normal, backgroundColor); configurationBottomEventBox.ModifyBg (StateType.Normal, backgroundColor); backgroundLargeImageEventBox.ModifyBg (StateType.Normal, backgroundColor); }
public void AddMessage (string msg, IconId icon) { if (lastImage != null) { HSeparator sep = new HSeparator (); sep.Show (); msgBox.PackStart (sep, false, false, 0); lastImage.IconSize = Gtk.IconSize.Menu; } HBox box = new HBox (); box.Spacing = 12; Alignment imgBox = new Alignment (0, 0, 0, 0); var img = new ImageView (icon, lastImage != null ? Gtk.IconSize.Menu : IconSize.Dialog); imgBox.Add (img); lastImage = img; box.PackStart (imgBox, false, false, 0); Label lab = new Label (msg); lab.UseUnderline = false; lab.Xalign = 0; lab.Yalign = 0; lab.Wrap = true; lab.WidthRequest = 500; box.PackStart (lab, true, true, 0); msgBox.PackStart (box, false, false, 0); box.ShowAll (); }
public ImageEventBox(PropertyItem propertyItem, PropertyDescriptor propertyDescriptor) : this() { Gtk.Drag.DestSet(this, DestDefaults.All, ImageEventBox.target_tableWindows, DragAction.Copy | DragAction.Move | DragAction.Link); Gtk.Drag.SourceSet(this, ModifierType.Button1Mask, ImageEventBox.target_tableWindows, DragAction.Copy | DragAction.Move | DragAction.Link); this._propertyItem = propertyItem; this._propertyDescriptor = propertyDescriptor; if (this._propertyItem != null) { this.imageWidget = new MonoDevelop.Components.ImageView(); this.imageWidget.WidthRequest = 46; this.imageWidget.HeightRequest = 46; base.Add(this.imageWidget); this.imageWidget.Show(); this.Refresh(); if (propertyItem.Instance is INotifyPropertyChanged) { (propertyItem.Instance as INotifyPropertyChanged).PropertyChanged += new PropertyChangedEventHandler(this.ImageEventBox_PropertyChanged); } Gtk.MenuItem menuItem = new Gtk.MenuItem(LanguageInfo.Command_OpenDirectory); menuItem.ButtonReleaseEvent += new ButtonReleaseEventHandler(this.item1_ButtonReleaseEvent); Gtk.MenuItem menuItem2 = new Gtk.MenuItem(LanguageInfo.Property_CopyFileName); menuItem2.ButtonPressEvent += new ButtonPressEventHandler(this.item2_ButtonPressEvent); Gtk.MenuItem menuItem3 = new Gtk.MenuItem(LanguageInfo.Property_CopyPhyDir); menuItem3.ButtonPressEvent += new ButtonPressEventHandler(this.item3_ButtonPressEvent); Gtk.MenuItem menuItem4 = new Gtk.MenuItem(LanguageInfo.Scene_Menucontext_ResetDefault); menuItem4.ButtonPressEvent += new ButtonPressEventHandler(this.item4_ButtonPressEvent); this._contentMenu.Add(menuItem); this._contentMenu.Add(menuItem2); this._contentMenu.Add(menuItem3); this._contentMenu.Add(menuItem4); } }
public ImageButton () { Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask; VisibleWindow = false; imageWidget = new ImageView (); imageWidget.Show (); Add (imageWidget); }
public HoverImageButton() { Gtk.Alignment al = new Alignment (0.5f, 0.5f, 0f, 0f); al.Show (); CanFocus = true; VisibleWindow = false; image = new ImageView(); image.Show(); al.Add (image); Add(al); }
void SetImage (string iconName) { if (iconName == null) { if (img != null) { this.Remove (img); img.Destroy (); img = null; } return; } if (img == null) { img = new ImageView (iconName, IconSize.Dialog); messageHBox.PackEnd (img, false, false, 12); img.SetAlignment (0.5f, 0.5f); } else { img.IconId = iconName; } }
public GtkPackagingProjectTemplateWizardPageWidget () { this.Build (); backgroundImage = Xwt.Drawing.Image.FromResource ("preview-nuget.png"); backgroundImageView = new ImageView (backgroundImage); backgroundImageView.Xalign = 1.0f; backgroundImageView.Yalign = 0.5f; backgroundLargeImageVBox.PackStart (backgroundImageView, true, true, 0); var separatorColor = Styles.NewProjectDialog.ProjectConfigurationSeparatorColor.ToGdkColor (); separator.ModifyBg (StateType.Normal, separatorColor); backgroundColor = Styles.NewProjectDialog.ProjectConfigurationLeftHandBackgroundColor.ToGdkColor (); leftBorderEventBox.ModifyBg (StateType.Normal, backgroundColor); configurationTopEventBox.ModifyBg (StateType.Normal, backgroundColor); configurationTableEventBox.ModifyBg (StateType.Normal, backgroundColor); configurationBottomEventBox.ModifyBg (StateType.Normal, backgroundColor); backgroundLargeImageEventBox.ModifyBg (StateType.Normal, backgroundColor); }
static void SetButtonIcon (Button button, string stockIcon) { Alignment alignment = new Alignment (0.5f, 0.5f, 0f, 0f); Label label = new Label (button.Label); HBox hbox = new HBox (false, 2); ImageView image = new ImageView (); image.Image = ImageService.GetIcon (stockIcon, IconSize.Menu); image.Show (); hbox.Add (image); label.Show (); hbox.Add (label); hbox.Show (); alignment.Add (hbox); button.Child.Destroy (); alignment.Show (); button.Add (alignment); }
public GtkAspNetProjectTemplateWizardPageWidget () { this.Build (); if (Platform.IsMac) { int labelPaddingHeight = 5; if (IsYosemiteOrHigher ()) labelPaddingHeight--; includeLabelPadding.HeightRequest = labelPaddingHeight; testingLabelPadding.HeightRequest = labelPaddingHeight; int leftPaddingWidth = 28; mvcDescriptionLeftHandPadding.WidthRequest = leftPaddingWidth; webFormsDescriptionLeftHandPadding.WidthRequest = leftPaddingWidth; webApiDescriptionLeftHandPadding.WidthRequest = leftPaddingWidth; includeUnitTestProjectDescriptionLeftHandPadding.WidthRequest = leftPaddingWidth; } double scale = GtkWorkarounds.GetPixelScale (); backgroundImage = Xwt.Drawing.Image.FromResource ("aspnet-wizard-page.png"); backgroundImageView = new ImageView (backgroundImage); backgroundImageView.Xalign = (float)(1/scale); backgroundImageView.Yalign = (float)(1/scale); backgroundLargeImageVBox.PackStart (backgroundImageView, true, true, 0); var separatorColor = new Color (176, 178, 181); testingSeparator.ModifyBg (StateType.Normal, separatorColor); leftBorderEventBox.ModifyBg (StateType.Normal, backgroundColor); configurationTopEventBox.ModifyBg (StateType.Normal, backgroundColor); configurationTableEventBox.ModifyBg (StateType.Normal, backgroundColor); configurationBottomEventBox.ModifyBg (StateType.Normal, backgroundColor); backgroundLargeImageEventBox.ModifyBg (StateType.Normal, backgroundColor); if (Platform.IsWindows && scale > 1.0) ScaleWidgets (scale); }
static Gtk.MenuItem CreateMenuItem (ContextMenuItem item) { if (!item.Visible) return null; if (item.IsSeparator) { return new Gtk.SeparatorMenuItem (); } Gtk.MenuItem menuItem; if (item is RadioButtonContextMenuItem) { var radioItem = (RadioButtonContextMenuItem)item; menuItem = new Gtk.CheckMenuItem (item.Label) { Active = radioItem.Checked, DrawAsRadio = true }; } else if (item is CheckBoxContextMenuItem) { var checkItem = (CheckBoxContextMenuItem)item; menuItem = new Gtk.CheckMenuItem (item.Label) { Active = checkItem.Checked }; } else { menuItem = new Gtk.ImageMenuItem (item.Label); } if (item.SubMenu != null && item.SubMenu.Items.Count > 0) { menuItem.Submenu = FromMenu (item.SubMenu); } else { menuItem.Activated += (sender, e) => item.Click (); } menuItem.Sensitive = item.Sensitive; var label = (Gtk.Label) menuItem.Child; label.UseUnderline = item.UseMnemonic; if (item.UseMnemonic) label.TextWithMnemonic = item.Label; if (item.Image != null) { Gtk.ImageMenuItem imageItem = menuItem as Gtk.ImageMenuItem; if (imageItem != null) { var img = new ImageView (item.Image); img.ShowAll (); imageItem.Image = img; GtkWorkarounds.ForceImageOnMenuItem (imageItem); } } return menuItem; }
void UpdateImage() { if (string.IsNullOrEmpty (icon)) { if (image != null) { box.Remove (image); image.Destroy (); image = null; } return; } if (image == null) { image = new ImageView (); box.PackStart (image, false, false, 0); box.ReorderChild (image, 0); } image.Image = ImageService.GetIcon (icon, iconSize); }
void Build () { BorderWidth = 0; WidthRequest = 901; HeightRequest = 632; Name = "wizard_dialog"; Title = GettextCatalog.GetString ("New Project"); WindowPosition = WindowPosition.CenterOnParent; TransientFor = IdeApp.Workbench.RootWindow; projectConfigurationWidget = new GtkProjectConfigurationWidget (); projectConfigurationWidget.Name = "projectConfigurationWidget"; // Top banner of dialog. var topLabelEventBox = new EventBox (); topLabelEventBox.Name = "topLabelEventBox"; topLabelEventBox.HeightRequest = 52; topLabelEventBox.ModifyBg (StateType.Normal, bannerBackgroundColor); topLabelEventBox.ModifyFg (StateType.Normal, whiteColor); topLabelEventBox.BorderWidth = 0; var topBannerTopEdgeLineEventBox = new EventBox (); topBannerTopEdgeLineEventBox.Name = "topBannerTopEdgeLineEventBox"; topBannerTopEdgeLineEventBox.HeightRequest = 1; topBannerTopEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor); topBannerTopEdgeLineEventBox.BorderWidth = 0; var topBannerBottomEdgeLineEventBox = new EventBox (); topBannerBottomEdgeLineEventBox.Name = "topBannerBottomEdgeLineEventBox"; topBannerBottomEdgeLineEventBox.HeightRequest = 1; topBannerBottomEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor); topBannerBottomEdgeLineEventBox.BorderWidth = 0; topBannerLabel = new Label (); topBannerLabel.Name = "topBannerLabel"; Pango.FontDescription font = topBannerLabel.Style.FontDescription.Copy (); // UNDONE: VV: Use FontService? font.Size = (int)(font.Size * 1.8); topBannerLabel.ModifyFont (font); topBannerLabel.ModifyFg (StateType.Normal, whiteColor); var topLabelHBox = new HBox (); topLabelHBox.Name = "topLabelHBox"; topLabelHBox.PackStart (topBannerLabel, false, false, 20); topLabelEventBox.Add (topLabelHBox); VBox.PackStart (topBannerTopEdgeLineEventBox, false, false, 0); VBox.PackStart (topLabelEventBox, false, false, 0); VBox.PackStart (topBannerBottomEdgeLineEventBox, false, false, 0); // Main templates section. centreVBox = new VBox (); centreVBox.Name = "centreVBox"; VBox.PackStart (centreVBox, true, true, 0); templatesHBox = new HBox (); templatesHBox.Name = "templatesHBox"; centreVBox.PackEnd (templatesHBox, true, true, 0); // Template categories. var templateCategoriesBgBox = new EventBox (); templateCategoriesBgBox.Name = "templateCategoriesVBox"; templateCategoriesBgBox.BorderWidth = 0; templateCategoriesBgBox.ModifyBg (StateType.Normal, categoriesBackgroundColor); templateCategoriesBgBox.WidthRequest = 220; var templateCategoriesScrolledWindow = new ScrolledWindow (); templateCategoriesScrolledWindow.Name = "templateCategoriesScrolledWindow"; templateCategoriesScrolledWindow.HscrollbarPolicy = PolicyType.Never; // Template categories tree view. templateCategoriesTreeView = new TreeView (); templateCategoriesTreeView.Name = "templateCategoriesTreeView"; templateCategoriesTreeView.BorderWidth = 0; templateCategoriesTreeView.HeadersVisible = false; templateCategoriesTreeView.Model = templateCategoriesListStore; templateCategoriesTreeView.SearchColumn = -1; // disable the interactive search templateCategoriesTreeView.AppendColumn (CreateTemplateCategoriesTreeViewColumn ()); templateCategoriesScrolledWindow.Add (templateCategoriesTreeView); templateCategoriesBgBox.Add (templateCategoriesScrolledWindow); templatesHBox.PackStart (templateCategoriesBgBox, false, false, 0); // Templates. var templatesBgBox = new EventBox (); templatesBgBox.ModifyBg (StateType.Normal, templateListBackgroundColor); templatesBgBox.Name = "templatesVBox"; templatesBgBox.WidthRequest = 400; templatesHBox.PackStart (templatesBgBox, false, false, 0); var templatesScrolledWindow = new ScrolledWindow (); templatesScrolledWindow.Name = "templatesScrolledWindow"; templatesScrolledWindow.HscrollbarPolicy = PolicyType.Never; // Templates tree view. templatesTreeView = new TreeView (); templatesTreeView.Name = "templatesTreeView"; templatesTreeView.HeadersVisible = false; templatesTreeView.Model = templatesListStore; templatesTreeView.SearchColumn = -1; // disable the interactive search templatesTreeView.AppendColumn (CreateTemplateListTreeViewColumn ()); templatesScrolledWindow.Add (templatesTreeView); templatesBgBox.Add (templatesScrolledWindow); // Template var templateEventBox = new EventBox (); templateEventBox.Name = "templateEventBox"; templateEventBox.ModifyBg (StateType.Normal, templateBackgroundColor); templatesHBox.PackStart (templateEventBox, true, true, 0); templateVBox = new VBox (); templateVBox.Visible = false; templateVBox.BorderWidth = 20; templateVBox.Spacing = 10; templateEventBox.Add (templateVBox); // Template large image. templateImage = new ImageView (); templateImage.Name = "templateImage"; templateImage.HeightRequest = 140; templateImage.WidthRequest = 240; templateVBox.PackStart (templateImage, false, false, 10); // Template description. templateNameLabel = new Label (); templateNameLabel.Name = "templateNameLabel"; templateNameLabel.WidthRequest = 240; templateNameLabel.Wrap = true; templateNameLabel.Xalign = 0; templateNameLabel.Markup = MarkupTemplateName ("TemplateName"); templateVBox.PackStart (templateNameLabel, false, false, 0); templateDescriptionLabel = new Label (); templateDescriptionLabel.Name = "templateDescriptionLabel"; templateDescriptionLabel.WidthRequest = 240; templateDescriptionLabel.Wrap = true; templateDescriptionLabel.Xalign = 0; templateVBox.PackStart (templateDescriptionLabel, false, false, 0); templateVBox.PackStart (new Label (), true, true, 0); // Template - button separator. var templateSectionSeparatorEventBox = new EventBox (); templateSectionSeparatorEventBox.Name = "templateSectionSeparatorEventBox"; templateSectionSeparatorEventBox.HeightRequest = 1; templateSectionSeparatorEventBox.ModifyBg (StateType.Normal, templateSectionSeparatorColor); VBox.PackStart (templateSectionSeparatorEventBox, false, false, 0); // Buttons at bottom of dialog. var bottomHBox = new HBox (); bottomHBox.Name = "bottomHBox"; VBox.PackStart (bottomHBox, false, false, 0); // Cancel button - bottom left. var cancelButtonBox = new HButtonBox (); cancelButtonBox.Name = "cancelButtonBox"; cancelButtonBox.BorderWidth = 16; cancelButton = new Button (); cancelButton.Name = "cancelButton"; cancelButton.Label = "gtk-cancel"; cancelButton.UseStock = true; cancelButtonBox.PackStart (cancelButton, false, false, 0); bottomHBox.PackStart (cancelButtonBox, false, false, 0); // Previous button - bottom right. var previousNextButtonBox = new HButtonBox (); previousNextButtonBox.Name = "previousNextButtonBox"; previousNextButtonBox.BorderWidth = 16; previousNextButtonBox.Spacing = 9; bottomHBox.PackStart (previousNextButtonBox); previousNextButtonBox.Layout = ButtonBoxStyle.End; previousButton = new Button (); previousButton.Name = "previousButton"; previousButton.Label = GettextCatalog.GetString ("Previous"); previousButton.Sensitive = false; previousNextButtonBox.PackEnd (previousButton); // Next button - bottom right. nextButton = new Button (); nextButton.Name = "nextButton"; nextButton.Label = GettextCatalog.GetString ("Next"); previousNextButtonBox.PackEnd (nextButton); // Remove default button action area. VBox.Remove (ActionArea); if (Child != null) { Child.ShowAll (); } Show (); templatesTreeView.HasFocus = true; Resizable = false; }
public GtkAlertDialog (MessageDescription message) { Init (); this.buttons = message.Buttons.ToArray (); Modal = true; string primaryText; string secondaryText; if (string.IsNullOrEmpty (message.SecondaryText)) { secondaryText = message.Text; primaryText = null; } else { primaryText = message.Text; secondaryText = message.SecondaryText; } if (!message.UseMarkup) { primaryText = GLib.Markup.EscapeText (primaryText); secondaryText = GLib.Markup.EscapeText (secondaryText); } if (!string.IsNullOrEmpty (message.Icon)) { image = new ImageView (); image.Yalign = 0.00f; image.Image = ImageService.GetIcon (message.Icon, IconSize.Dialog); hbox.PackStart (image, false, false, 0); hbox.ReorderChild (image, 0); } StringBuilder markup = new StringBuilder (@"<span weight=""bold"" size=""larger"">"); markup.Append (primaryText); markup.Append ("</span>"); if (!String.IsNullOrEmpty (secondaryText)) { if (!String.IsNullOrEmpty (primaryText)) { markup.AppendLine (); markup.AppendLine (); } markup.Append (secondaryText); } label.Markup = markup.ToString (); label.Selectable = true; label.CanFocus = false; foreach (AlertButton button in message.Buttons) { Button newButton = new Button (); newButton.Label = button.Label; newButton.UseUnderline = true; newButton.UseStock = button.IsStockButton; if (!String.IsNullOrEmpty (button.Icon)) newButton.Image = new Image (button.Icon, IconSize.Button); newButton.Clicked += ButtonClicked; ActionArea.Add (newButton); } foreach (var op in message.Options) { CheckButton check = new CheckButton (op.Text); check.Active = op.Value; labelsBox.PackStart (check, false, false, 0); check.Toggled += delegate { message.SetOptionValue (op.Id, check.Active); }; } if (message.AllowApplyToAll) { CheckButton check = new CheckButton (GettextCatalog.GetString ("Apply to all")); labelsBox.PackStart (check, false, false, 0); check.Toggled += delegate { ApplyToAll = check.Active; }; } //don't show this yet, let the consumer decide when this.Child.ShowAll (); }
public void SetLabel (Gtk.Widget page, Xwt.Drawing.Image icon, string label) { this.label = label; this.page = page; if (Child != null) { Gtk.Widget oc = Child; Remove (oc); oc.Destroy (); } Gtk.HBox box = new HBox (); box.Spacing = -2; if (icon == null) icon = ImageService.GetIcon ("md-empty"); tabIcon = new ImageView (icon); tabIcon.Show (); box.PackStart (tabIcon, false, false, 3); if (!string.IsNullOrEmpty (label)) { labelWidget = new ExtendedLabel (label); labelWidget.UseMarkup = true; labelWidget.Yalign = 0.85f; var alignLabel = new Alignment (0.0f, 1.0f, 1, 1); alignLabel.BottomPadding = 0; alignLabel.RightPadding = 15; alignLabel.Add (labelWidget); box.PackStart (alignLabel, true, true, 0); } else { labelWidget = null; } btnDock = new ImageButton (); btnDock.Image = pixAutoHide; btnDock.TooltipText = GettextCatalog.GetString ("Auto Hide"); btnDock.CanFocus = false; // btnDock.WidthRequest = btnDock.HeightRequest = 17; btnDock.Clicked += OnClickDock; btnDock.ButtonPressEvent += (o, args) => args.RetVal = true; btnDock.WidthRequest = btnDock.SizeRequest ().Width; btnClose = new ImageButton (); btnClose.Image = pixClose; btnClose.TooltipText = GettextCatalog.GetString ("Close"); btnClose.CanFocus = false; // btnClose.WidthRequest = btnClose.HeightRequest = 17; btnClose.WidthRequest = btnDock.SizeRequest ().Width; btnClose.Clicked += delegate { item.Visible = false; }; btnClose.ButtonPressEvent += (o, args) => args.RetVal = true; Gtk.Alignment al = new Alignment (0, 0.5f, 1, 1); HBox btnBox = new HBox (false, 0); btnBox.PackStart (btnDock, false, false, 3); btnBox.PackStart (btnClose, false, false, 1); al.Add (btnBox); box.PackEnd (al, false, false, 3); Add (box); // Get the required size before setting the ellipsize property, since ellipsized labels // have a width request of 0 box.ShowAll (); Show (); UpdateBehavior (); UpdateVisualStyle (); }
void AddWarningLabel () { var alignment = new Alignment (0.0f, 0.5f, 1.0f, 1.0f) { TopPadding = 8, LeftPadding = 18, RightPadding = 18 }; warning = new Label (GettextCatalog.GetString ("Test Error")); warning.SetAlignment (0.0f, 0.5f); warning.Show (); infoImage = new ImageView (Xwt.Drawing.Image.FromResource (GetType ().Assembly, "warning-16.png")); warningImage = new ImageView (Xwt.Drawing.Image.FromResource (GetType ().Assembly, "error-16.png")); warningHBox = new HBox (false, 6); warningHBox.PackStart (infoImage, false, false, 0); warningHBox.PackStart (warningImage, false, false, 0); warningHBox.PackStart (warning, false, true, 0); alignment.Child = warningHBox; alignment.Show (); VBox.PackStart (alignment, false, true, 0); }
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 ImageView (draggedItem.Icon); box.PackStart (img, 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 (); }
Widget CreateExceptionHeader () { var icon = new ImageView (WarningIconPixbuf); icon.Yalign = 0; ExceptionTypeLabel = new Label { Xalign = 0.0f, Selectable = true }; ExceptionMessageLabel = new Label { Wrap = true, Xalign = 0.0f, Selectable = true }; ExceptionTypeLabel.ModifyFg (StateType.Normal, new Gdk.Color (255, 255, 255)); ExceptionMessageLabel.ModifyFg (StateType.Normal, new Gdk.Color (255, 255, 255)); if (Platform.IsWindows) { ExceptionTypeLabel.ModifyFont (Pango.FontDescription.FromString ("bold 19")); ExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString ("10")); } else { ExceptionTypeLabel.ModifyFont (Pango.FontDescription.FromString ("21")); ExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString ("12")); } //Force rendering of background with EventBox var eventBox = new EventBox (); var hBox = new HBox (); var leftVBox = new VBox (); rightVBox = new VBox (); leftVBox.PackStart (icon, false, false, (uint)(Platform.IsWindows ? 5 : 0)); // as we change frame.BorderWidth below, we need to compensate rightVBox.PackStart (ExceptionTypeLabel, false, false, (uint)(Platform.IsWindows ? 0 : 2)); rightVBox.PackStart (ExceptionMessageLabel, true, true, (uint)(Platform.IsWindows ? 6 : 5)); hBox.PackStart (leftVBox, false, false, (uint)(Platform.IsWindows ? 5 : 0)); // as we change frame.BorderWidth below, we need to compensate hBox.PackStart (rightVBox, true, true, (uint)(Platform.IsWindows ? 5 : 10)); var frame = new Frame (); frame.Add (hBox); frame.BorderWidth = (uint)(Platform.IsWindows ? 5 : 10); // on Windows we need to have smaller border due to ExceptionTypeLabel vertical misalignment frame.Shadow = ShadowType.None; frame.ShadowType = ShadowType.None; eventBox.Add (frame); eventBox.ShowAll (); eventBox.ModifyBg (StateType.Normal, new Gdk.Color (119, 130, 140)); return eventBox; }
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 ImageView (draggedItem.Icon); box.PackStart (img, 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 void Update (CommandTargetRoute targetRoute) { CommandInfo cmdInfo = IdeApp.CommandService.GetCommandInfo (cmdId, targetRoute); bool hasAccel = string.IsNullOrEmpty (cmdInfo.AccelKey); bool hasIcon = !cmdInfo.Icon.IsNull; string desc = cmdInfo.Description; bool displayText = !(displayType == CommandEntryDisplayType.IconHasPriority && hasIcon) && displayType != CommandEntryDisplayType.IconOnly; //If the button only has an icon it's not always clear what it does. In such cases, use the label as a //fallback tooltip. Also do this if there's an accelerator, so the user can see what it is. if (string.IsNullOrEmpty (desc) && (!displayText || hasAccel)) desc = cmdInfo.Text; if (lastDesc != desc) { string toolTip; if (hasAccel) { toolTip = desc; } else { toolTip = desc + " (" + KeyBindingManager.BindingToDisplayLabel (cmdInfo.AccelKey, false) + ")"; } button.TooltipText = toolTip; lastDesc = desc; } if (displayText && button.Label != cmdInfo.Text) { button.Label = cmdInfo.Text; } if (displayType != CommandEntryDisplayType.TextOnly && cmdInfo.Icon != stockId) { stockId = cmdInfo.Icon; button.Image = image = new ImageView (cmdInfo.Icon, Gtk.IconSize.Menu); } if (button.Image != null && cmdInfo.Enabled != button.Sensitive) image.Image = image.Image.WithStyles (cmdInfo.Enabled ? "" : "disabled").WithAlpha (cmdInfo.Enabled ? 1.0 : 0.4); if (cmdInfo.Enabled != button.Sensitive) button.Sensitive = cmdInfo.Enabled; if (cmdInfo.Visible != button.Visible) button.Visible = cmdInfo.Visible; ToggleButton toggle = button as ToggleButton; if (toggle != null && cmdInfo.Checked != toggle.Active) toggle.Active = cmdInfo.Checked; if (button.Image != null) button.Image.Show (); }
public override Control CreatePanelWidget () { HBox hbox = new HBox (false, 6); Label label = new Label (); label.MarkupWithMnemonic = GettextCatalog.GetString ("_Policy:"); hbox.PackStart (label, false, false, 0); store = new ListStore (typeof (string), typeof (PolicySet)); policyCombo = new ComboBox (store); CellRenderer renderer = new CellRendererText (); policyCombo.PackStart (renderer, true); policyCombo.AddAttribute (renderer, "text", 0); label.MnemonicWidget = policyCombo; policyCombo.RowSeparatorFunc = (TreeModel model, TreeIter iter) => ((string) model.GetValue (iter, 0)) == "--"; hbox.PackStart (policyCombo, false, false, 0); VBox vbox = new VBox (false, 6); vbox.PackStart (hbox, false, false, 0); vbox.ShowAll (); // Warning message to be shown when the user modifies the default policy warningMessage = new HBox (); warningMessage.Spacing = 6; var img = new ImageView (Stock.Warning, IconSize.Menu); warningMessage.PackStart (img, false, false, 0); Label wl = new Label (GettextCatalog.GetString ("Changes done in this section will only be applied to new projects. " + "Settings for existing projects can be modified in the project (or solution) options dialog.")); wl.Xalign = 0; wl.Wrap = true; wl.WidthRequest = 450; warningMessage.PackStart (wl, true, true, 0); warningMessage.ShowAll (); warningMessage.Visible = false; vbox.PackEnd (warningMessage, false, false, 0); notebook = new Notebook (); // Get the panels for all mime types List<string> types = new List<string> (); types.AddRange (DesktopService.GetMimeTypeInheritanceChain (mimeType)); panelData.SectionLoaded = true; panels = panelData.Panels; foreach (IMimeTypePolicyOptionsPanel panel in panelData.Panels) { panel.SetParentSection (this); Widget child = panel.CreateMimePanelWidget (); Label tlabel = new Label (panel.Label); label.Show (); child.Show (); Alignment align = new Alignment (0.5f, 0.5f, 1f, 1f); align.BorderWidth = 6; align.Add (child); align.Show (); notebook.AppendPage (align, tlabel); panel.LoadCurrentPolicy (); } notebook.SwitchPage += delegate(object o, SwitchPageArgs args) { if (notebook.Page >= 0 && notebook.Page < this.panels.Count) this.panels[notebook.Page].PanelSelected (); }; notebook.Show (); vbox.PackEnd (notebook, true, true, 0); FillPolicies (); policyCombo.Active = 0; loading = false; if (!isRoot && panelData.UseParentPolicy) { //in this case "parent" is always first in the list policyCombo.Active = 0; notebook.Sensitive = false; } else { UpdateSelectedNamedPolicy (); } policyCombo.Changed += HandlePolicyComboChanged; return vbox; }
Widget CreateExceptionHeader () { var icon = new ImageView (WarningIconPixbuf); icon.Show (); var hbox = new HBox (false, 12) { BorderWidth = 12 }; hbox.PackStart (icon, false, true, 0); hbox.PackStart (CreateExceptionInfoHeader (), true, true, 0); hbox.Show (); return hbox; }
static Gtk.MenuItem CreateMenuItem (ContextMenuItem item) { if (!item.Visible) return null; if (item.IsSeparator) { return new Gtk.SeparatorMenuItem (); } Gtk.MenuItem menuItem; if (item is RadioButtonContextMenuItem) { var radioItem = (RadioButtonContextMenuItem)item; menuItem = new Gtk.CheckMenuItem (item.Label) { Active = radioItem.Checked, DrawAsRadio = true }; } else if (item is CheckBoxContextMenuItem) { var checkItem = (CheckBoxContextMenuItem)item; menuItem = new Gtk.CheckMenuItem (item.Label) { Active = checkItem.Checked }; } else { menuItem = new Gtk.ImageMenuItem (item.Label); } menuItem.Selected += delegate (object sender, EventArgs e) { var si = sender as Gtk.MenuItem; if (si == null || si.GdkWindow == null) return; int x, y; si.GdkWindow.GetOrigin (out x, out y); int rx, ry; IdeApp.Workbench.RootWindow.GdkWindow.GetOrigin (out rx, out ry); item.FireSelectedEvent (new Xwt.Rectangle (x - rx, y - ry, si.Allocation.Width, si.Allocation.Height)); }; menuItem.Deselected += delegate { item.FireDeselectedEvent (); }; if (item.SubMenu != null && item.SubMenu.Items.Count > 0) { menuItem.Submenu = FromMenu (item.SubMenu, null); } else { menuItem.Activated += (sender, e) => item.Click (); } menuItem.Sensitive = item.Sensitive; var label = (Gtk.Label) menuItem.Child; label.UseUnderline = item.UseMnemonic; if (item.UseMnemonic) label.TextWithMnemonic = item.Label; if (item.Image != null) { Gtk.ImageMenuItem imageItem = menuItem as Gtk.ImageMenuItem; if (imageItem != null) { var img = new ImageView (item.Image); img.ShowAll (); imageItem.Image = img; Xwt.GtkBackend.GtkWorkarounds.ForceImageOnMenuItem (imageItem); } } return menuItem; }
Widget CreateInnerExceptionMessage () { var hboxMain = new HBox (); vboxAroundInnerExceptionMessage = new VBox (); var hbox = new HBox (); var icon = new ImageView (WarningIconPixbufInner); icon.Yalign = 0; hbox.PackStart (icon, false, false, 0); InnerExceptionTypeLabel = new Label (); InnerExceptionTypeLabel.UseMarkup = true; InnerExceptionTypeLabel.Xalign = 0; InnerExceptionTypeLabel.Selectable = true; hbox.PackStart (InnerExceptionTypeLabel, false, true, 4); InnerExceptionMessageLabel = new Label (); InnerExceptionMessageLabel.Wrap = true; InnerExceptionMessageLabel.Selectable = true; InnerExceptionMessageLabel.Xalign = 0; InnerExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString (Platform.IsWindows ? "9" : "11")); vboxAroundInnerExceptionMessage.PackStart (hbox, false, true, 0); vboxAroundInnerExceptionMessage.PackStart (InnerExceptionMessageLabel, true, true, 10); hboxMain.PackStart (vboxAroundInnerExceptionMessage, true, true, 10); hboxMain.ShowAll (); return hboxMain; }
public SdkLocationWidget (SdkLocationPanel panel) : base (false, 12) { this.panel = panel; this.PackStart (new Label () { Markup = "<b>" + GLib.Markup.EscapeText (panel.Label) + "</b>", Xalign = 0f, }); var alignment = new Alignment (0f, 0f, 1f, 1f) { LeftPadding = 24 }; this.PackStart (alignment); var vbox = new VBox (false , 6); var locationBox = new HBox (false, 6); var messageBox = new HBox (false, 6); alignment.Add (vbox); vbox.PackStart (messageBox, false, false, 0); vbox.PackStart (locationBox, false, false, 0); locationBox.PackStart (new Label (GettextCatalog.GetString ("Location:")), false, false, 0); locationBox.PackStart (locationEntry, true, true, 0); messageBox.PackStart (messageIcon, false, false, 0); messageBox.PackStart (messageLabel, true, true, 0); messageLabel.Xalign = 0f; string location = panel.LoadSdkLocationSetting (); locationEntry.Path = location ?? ""; locationEntry.PathChanged += delegate { Validate (); }; Validate (); if (panel.RequiresRestart) { PackStart (new HSeparator (), false, false, 0); var tableRestart = new Table (2, 3, false) { RowSpacing = 6, ColumnSpacing = 6 }; var btnRestart = new Button () { Label = GettextCatalog.GetString ("Restart {0}", BrandingService.ApplicationName), CanFocus = true, UseUnderline = true }; tableRestart.Attach (btnRestart, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0); var imageRestart = new ImageView ("md-information", IconSize.Menu); tableRestart.Attach (imageRestart, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0); var labelRestart = new Label (GettextCatalog.GetString ("These preferences will take effect next time you start {0}", BrandingService.ApplicationName)); tableRestart.Attach (labelRestart, 1, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0); PackStart (tableRestart, false, false, 0); btnRestart.Clicked += (sender, e) => { ApplyChanges (); IdeApp.Restart (true); }; } 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 ImageView (tabbarPrevImage); arr.HeightRequest = arr.WidthRequest = 10; PreviousButton = new Button (arr); PreviousButton.Relief = ReliefStyle.None; PreviousButton.CanDefault = PreviousButton.CanFocus = false; arr = new ImageView (tabbarNextImage); 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 += (sender, e) => QueueResize (); notebook.PageRemoved += (sender, e) => QueueResize (); closingTabs = new Dictionary<int, DockNotebookTab> (); }
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 ImageView (draggedItem.Icon); titleBox.PackStart (img, 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 (); }