public void AddPage(BaseContextPage page) { Hyena.Log.DebugFormat("Adding context page {0}", page.Id); // TODO delay adding the page.Widget until the page is first activated, // that way we don't even create those objects unless used var frame = new Hyena.Widgets.RoundedFrame(); frame.Add(page.Widget); frame.Show(); // TODO implement DnD? /*if (page is ITrackContextPage) { * Gtk.Drag.DestSet (frame, DestDefaults.Highlight | DestDefaults.Motion, * new TargetEntry [] { Banshee.Gui.DragDrop.DragDropTarget.UriList }, * Gdk.DragAction.Default); * frame.DragDataReceived += delegate(object o, DragDataReceivedArgs args) { * }; * }*/ page.Widget.Show(); notebook.AppendPage(frame, null); pane_pages[page] = frame; // Setup the tab-like button that switches the notebook to this page var tab_image = new Image(IconThemeUtils.LoadIcon(22, page.IconNames)); var toggle_button = new RadioButton(radio_group) { Child = tab_image, DrawIndicator = false, Relief = ReliefStyle.None }; TooltipSetter.Set(tooltip_host, toggle_button, page.Name); toggle_button.Clicked += (s, e) => { if (pane_pages.ContainsKey(page)) { if (page.State == ContextState.Loaded) { notebook.CurrentPage = notebook.PageNum(pane_pages[page]); } SetActivePage(page); } }; toggle_button.ShowAll(); vbox.PackStart(toggle_button, false, false, 0); pane_tabs[page] = toggle_button; pages.Add(page); if (initialized && pages.Count == 1) { SetActivePage(page); toggle_button.Active = true; } UpdateVisibility(); }
public void AddWithFrame (Widget widget) { RoundedFrame frame = new RoundedFrame (); frame.Add (widget); frame.Show (); Add (frame); ProbeAdjustable (widget); }
public void AddWithFrame(Widget widget) { RoundedFrame frame = new RoundedFrame(); frame.Add(widget); frame.Show(); Add(frame); ProbeAdjustable(widget); }
protected override void OnRemoved (Widget widget) { if (widget == rounded_frame) { rounded_frame.Added -= OnFrameWidgetAdded; rounded_frame.Removed -= OnFrameWidgetRemoved; rounded_frame = null; } base.OnRemoved (widget); }
protected override void OnAdded (Widget widget) { if (widget is RoundedFrame) { rounded_frame = (RoundedFrame)widget; rounded_frame.Added += OnFrameWidgetAdded; rounded_frame.Removed += OnFrameWidgetRemoved; } base.OnAdded (widget); }
protected override void OnRemoved(Widget widget) { if (widget == rounded_frame) { rounded_frame.Added -= OnFrameWidgetAdded; rounded_frame.Removed -= OnFrameWidgetRemoved; rounded_frame = null; } base.OnRemoved(widget); }
protected override void OnAdded(Widget widget) { if (widget is RoundedFrame) { rounded_frame = (RoundedFrame)widget; rounded_frame.Added += OnFrameWidgetAdded; rounded_frame.Removed += OnFrameWidgetRemoved; } base.OnAdded(widget); }
public HomeView (HomeSource source) { this.source = source; //var sw = new Gtk.ScrolledWindow (); //sw.BorderWidth = 4; //sw.AddWithViewport (Build ()); var frame = new Hyena.Widgets.RoundedFrame (); frame.Child = Build (); PackStart (frame, true, true, 0); ShowAll (); }
public HomeView(HomeSource source) { this.source = source; //var sw = new Gtk.ScrolledWindow (); //sw.BorderWidth = 4; //sw.AddWithViewport (Build ()); var frame = new Hyena.Widgets.RoundedFrame(); frame.Child = Build(); PackStart(frame, true, true, 0); ShowAll(); }
private void Layout() { Reset(); container = new VPaned(); frame = new Hyena.Widgets.RoundedFrame(); frame.SetFillColor(new Cairo.Color(0, 0, 0)); frame.DrawBorder = false; frame.Add(filter_view); filter_view.Show(); frame.Show(); container.Pack1(frame, false, false); main_expander.Activated += OnExpander; main_expander.SizeRequested += HandleSizeRequested; container.Pack2(main_expander, true, false); container.Position = 175; PersistentPaneController.Control(container, ControllerName(-1)); ShowPack(); }
private void BuildInfoBox() { var frame = new Hyena.Widgets.RoundedFrame(); var vbox = new VBox(); vbox.Spacing = 6; vbox.BorderWidth = 2; // Description var desc = new Hyena.Widgets.WrapLabel() { Markup = String.Format("{0}", GLib.Markup.EscapeText(Hyena.StringUtil.RemoveHtml(details.Description))) }; var desc_expander = CreateSection(Catalog.GetString("Description"), desc); // Details var table = new Banshee.Gui.TrackEditor.StatisticsPage() { ShadowType = ShadowType.None, BorderWidth = 0 }; table.NameRenderer.Scale = Pango.Scale.Medium; table.ValueRenderer.Scale = Pango.Scale.Medium; // Keep the table from needing to vertically scroll /*table.Child.SizeRequested += (o, a) => { * table.SetSizeRequest (a.Requisition.Width, a.Requisition.Height); * };*/ AddToTable(table, Catalog.GetString("Creator:"), details.Creator); AddToTable(table, Catalog.GetString("Venue:"), details.Venue); AddToTable(table, Catalog.GetString("Location:"), details.Coverage); if (details.DateCreated != DateTime.MinValue) { AddToTable(table, Catalog.GetString("Date:"), details.DateCreated); } else { AddToTable(table, Catalog.GetString("Year:"), details.Year); } AddToTable(table, Catalog.GetString("Publisher:"), details.Publisher); AddToTable(table, Catalog.GetString("Keywords:"), details.Subject); AddToTable(table, Catalog.GetString("License URL:"), details.LicenseUrl); AddToTable(table, Catalog.GetString("Language:"), details.Language); table.AddSeparator(); AddToTable(table, Catalog.GetString("Downloads, overall:"), details.DownloadsAllTime); AddToTable(table, Catalog.GetString("Downloads, past month:"), details.DownloadsLastMonth); AddToTable(table, Catalog.GetString("Downloads, past week:"), details.DownloadsLastWeek); table.AddSeparator(); AddToTable(table, Catalog.GetString("Added:"), details.DateAdded); AddToTable(table, Catalog.GetString("Added by:"), details.AddedBy); AddToTable(table, Catalog.GetString("Collections:"), details.Collections); AddToTable(table, Catalog.GetString("Source:"), details.Source); AddToTable(table, Catalog.GetString("Contributor:"), details.Contributor); AddToTable(table, Catalog.GetString("Recorded by:"), details.Taper); AddToTable(table, Catalog.GetString("Lineage:"), details.Lineage); AddToTable(table, Catalog.GetString("Transferred by:"), details.Transferer); var details_expander = CreateSection(Catalog.GetString("Details"), table); // Reviews Section reviews = null; if (details.NumReviews > 0) { string [] stars = { "\u2606\u2606\u2606\u2606\u2606", "\u2605\u2606\u2606\u2606\u2606", "\u2605\u2605\u2606\u2606\u2606", "\u2605\u2605\u2605\u2606\u2606", "\u2605\u2605\u2605\u2605\u2606", "\u2605\u2605\u2605\u2605\u2605" }; var reviews_box = new VBox() { Spacing = 12, BorderWidth = 0 }; reviews = CreateSection(Catalog.GetString("Reviews"), reviews_box); var avg_label = new Label(String.Format(Catalog.GetPluralString( // Translators: {0} is the number of reviewers, {1} is the average rating (not really relevant if there's only 1) "{0} reviewer", "{0} reviewers, avg {1}", details.NumReviews), details.NumReviews, stars[Math.Max(0, Math.Min(5, (int)Math.Round(details.AvgRating)))] )); avg_label.TooltipText = String.Format("{0:N2}", details.AvgRating); avg_label.Xalign = 1.0f; reviews.Header.Box.PackEnd(avg_label, false, false, 0); var sb = new System.Text.StringBuilder(); foreach (var review in details.Reviews) { //sb.Append ("<small>"); var review_txt = new Hyena.Widgets.WrapLabel(); var title = review.Title; if (title != null) { sb.AppendFormat("<b>{0}</b>\n", GLib.Markup.EscapeText(title)); } // Translators: {0} is the unicode-stars-rating, {1} is the name of a person who reviewed this item, and {1} is a date/time string sb.AppendFormat(Catalog.GetString("{0} by {1} on {2}"), stars[Math.Max(0, Math.Min(5, review.Stars))], GLib.Markup.EscapeText(review.Reviewer), GLib.Markup.EscapeText(review.DateReviewed.ToLocalTime().ToShortDateString()) ); var body = review.Body; if (body != null) { body = body.Replace("\r\n", "\n"); body = body.Replace("\n\n", "\n"); sb.Append("\n"); sb.Append(GLib.Markup.EscapeText(body)); } //sb.Append ("</small>"); review_txt.Markup = sb.ToString(); sb.Length = 0; reviews_box.PackStart(review_txt, false, false, 0); } } // Packing vbox.PackStart(desc_expander, true, true, 0); vbox.PackStart(details_expander, true, true, 0); if (reviews != null) { vbox.PackStart(reviews, true, true, 0); } string write_review_url = String.Format("http://www.archive.org/write-review.php?identifier={0}", item.Id); var write_review_button = new LinkButton(write_review_url, Catalog.GetString("Write your own review")); write_review_button.Clicked += (o, a) => Banshee.Web.Browser.Open(write_review_url); write_review_button.Xalign = 0f; vbox.PackStart(write_review_button, false, false, 0); var vbox2 = new VBox(); vbox2.PackStart(vbox, false, false, 0); var sw = new Gtk.ScrolledWindow() { ShadowType = ShadowType.None }; sw.AddWithViewport(vbox2); (sw.Child as Viewport).ShadowType = ShadowType.None; frame.Child = sw; frame.ShowAll(); sw.Child.OverrideBackgroundColor(StateFlags.Normal, StyleContext.GetBackgroundColor(StateFlags.Normal)); sw.Child.OverrideColor(StateFlags.Normal, StyleContext.GetColor(StateFlags.Normal)); StyleUpdated += delegate { sw.Child.OverrideBackgroundColor(StateFlags.Normal, StyleContext.GetBackgroundColor(StateFlags.Normal)); sw.Child.OverrideColor(StateFlags.Normal, StyleContext.GetColor(StateFlags.Normal)); }; PackStart(frame, true, true, 0); }
public void AddPage (BaseContextPage page) { Hyena.Log.DebugFormat ("Adding context page {0}", page.Id); // TODO delay adding the page.Widget until the page is first activated, // that way we don't even create those objects unless used var frame = new Hyena.Widgets.RoundedFrame (); frame.Add (page.Widget); frame.Show (); // TODO implement DnD? /*if (page is ITrackContextPage) { Gtk.Drag.DestSet (frame, DestDefaults.Highlight | DestDefaults.Motion, new TargetEntry [] { Banshee.Gui.DragDrop.DragDropTarget.UriList }, Gdk.DragAction.Default); frame.DragDataReceived += delegate(object o, DragDataReceivedArgs args) { }; }*/ page.Widget.Show (); notebook.AppendPage (frame, null); pane_pages[page] = frame; // Setup the tab-like button that switches the notebook to this page var tab_image = new Image (IconThemeUtils.LoadIcon (22, page.IconNames)); var toggle_button = new RadioButton (radio_group) { Child = tab_image, DrawIndicator = false, Relief = ReliefStyle.None }; TooltipSetter.Set (tooltip_host, toggle_button, page.Name); toggle_button.Clicked += (s, e) => { if (pane_pages.ContainsKey (page)) { if (page.State == ContextState.Loaded) { notebook.CurrentPage = notebook.PageNum (pane_pages[page]); } SetActivePage (page); } }; toggle_button.ShowAll (); vbox.PackStart (toggle_button, false, false, 0); pane_tabs[page] = toggle_button; pages.Add (page); if (initialized && pages.Count == 1) { SetActivePage (page); toggle_button.Active = true; } UpdateVisibility (); }
private void CreateContextNotebook () { notebook = new Notebook () { ShowBorder = false, ShowTabs = false }; // 'No active track' and 'Loading' widgets no_active = new RoundedFrame (); no_active.Add (new Label () { Markup = String.Format ("<b>{0}</b>", Catalog.GetString ("Waiting for playback to begin...")) }); no_active.ShowAll (); notebook.Add (no_active); loading = new RoundedFrame (); loading.Add (new Label () { Markup = String.Format ("<b>{0}</b>", Catalog.GetString ("Loading...")) }); loading.ShowAll (); notebook.Add (loading); PackStart (notebook, true, true, 0); notebook.Show (); }
private void Layout() { Reset (); container = new VPaned (); frame = new Hyena.Widgets.RoundedFrame (); frame.SetFillColor (new Cairo.Color (0, 0, 0)); frame.DrawBorder = false; frame.Add (filter_view); filter_view.Show(); frame.Show (); container.Pack1 (frame, false, false); main_expander.Activated += OnExpander; main_expander.SizeRequested += HandleSizeRequested; container.Pack2 (main_expander, true, false); container.Position = 175; PersistentPaneController.Control (container, ControllerName (-1)); ShowPack (); }