public void Reset(int value) { can_activate = false; Value = value; RatingEntry.ClearHover(); can_activate = true; }
public RatingAccessible(GLib.Object widget) : base() { rating = widget as RatingEntry; Name = "Rating entry"; Description = "Rating entry, from 0 to 5 stars"; Role = Atk.Role.Slider; }
protected override bool OnButtonReleaseEvent(Gdk.EventButton evnt) { if (evnt.X == 0 && evnt.Y == 0) { return(false); } RatingEntry.SetValueFromPosition(TransformX(evnt.X)); return(true); }
public RatingEntryTestModule() : base("Rating Entry") { var pbox = new VBox(); Add(pbox); var m = new Menu(); var b = new MenuBar(); var item = new MenuItem("Rate Me!") { Submenu = m }; b.Append(item); m.Append(new MenuItem("Apples")); m.Append(new MenuItem("Pears")); m.Append(new RatingMenuItem()); m.Append(new ImageMenuItem("gtk-remove", null)); m.ShowAll(); pbox.PackStart(b, false, false, 0); var box = new VBox { BorderWidth = 10, Spacing = 10 }; pbox.PackStart(box, true, true, 0); var entry1 = new RatingEntry(); box.PackStart(entry1, true, true, 0); var entry2 = new RatingEntry(); box.PackStart(entry2, false, false, 0); box.PackStart(new Entry("Normal GtkEntry"), false, false, 0); var entry3 = new RatingEntry(); Pango.FontDescription fd = entry3.PangoContext.FontDescription.Copy(); fd.Size = (int)(fd.Size * Pango.Scale.XXLarge); entry3.ModifyFont(fd); fd.Dispose(); box.PackStart(entry3, true, true, 0); pbox.ShowAll(); }
public RatingMenuItem () : base () { box = new HBox (); box.Spacing = 5; Label label = new Label (); label.Markup = String.Format ("<i>{0}</i>", GLib.Markup.EscapeText (Catalog.GetString ("Rating:"))); box.PackStart (label, false, false, 0); label.Show (); entry = new RatingEntry (); entry.HasFrame = false; entry.PreviewOnHover = true; entry.AlwaysShowEmptyStars = true; entry.Changed += OnEntryChanged; box.PackStart (entry, false, false, 0); box.ShowAll (); Add (box); }
public RatingMenuItem() : base() { box = new HBox(); box.Spacing = 5; Label label = new Label(); label.Markup = String.Format("<i>{0}</i>", GLib.Markup.EscapeText(Catalog.GetString("Rating:"))); box.PackStart(label, false, false, 0); label.Show(); entry = new RatingEntry(); entry.HasFrame = false; entry.PreviewOnHover = true; entry.AlwaysShowEmptyStars = true; entry.Changed += OnEntryChanged; box.PackStart(entry, false, false, 0); box.ShowAll(); Add(box); }
protected RatingMenuItem(RatingEntry entry) : base() { box = new HBox { Spacing = 5 }; var label = new Label { Markup = string.Format("<i>{0}</i>", GLib.Markup.EscapeText(Catalog.GetString("Rating:"))) }; box.PackStart(label, false, false, 0); label.Show(); RatingEntry = entry; entry.HasFrame = false; entry.PreviewOnHover = true; entry.AlwaysShowEmptyStars = true; entry.Changed += OnEntryChanged; box.PackStart(entry, false, false, 0); box.ShowAll(); Add(box); }
public RatingEntryTestModule() : base("Rating Entry") { VBox pbox = new VBox (); Add (pbox); Menu m = new Menu (); MenuBar b = new MenuBar (); MenuItem item = new MenuItem ("Rate Me!"); item.Submenu = m; b.Append (item); m.Append (new MenuItem ("Apples")); m.Append (new MenuItem ("Pears")); m.Append (new RatingMenuItem ()); m.Append (new ImageMenuItem ("gtk-remove", null)); m.ShowAll (); pbox.PackStart (b, false, false, 0); VBox box = new VBox (); box.BorderWidth = 10; box.Spacing = 10; pbox.PackStart (box, true, true, 0); RatingEntry entry1 = new RatingEntry (); box.PackStart (entry1, true, true, 0); RatingEntry entry2 = new RatingEntry (); box.PackStart (entry2, false, false, 0); box.PackStart (new Entry ("Normal GtkEntry"), false, false, 0); RatingEntry entry3 = new RatingEntry (); Pango.FontDescription fd = entry3.PangoContext.FontDescription.Copy (); fd.Size = (int)(fd.Size * Pango.Scale.XXLarge); entry3.OverrideFont (fd); fd.Dispose (); box.PackStart (entry3, true, true, 0); pbox.ShowAll (); }
public StationEditor(DatabaseTrackInfo track) : base() { AccelGroup accel_group = new AccelGroup (); AddAccelGroup (accel_group); Title = String.Empty; SkipTaskbarHint = true; Modal = true; this.track = track; string title = track == null ? Catalog.GetString ("Add new radio station") : Catalog.GetString ("Edit radio station"); BorderWidth = 6; DefaultResponse = ResponseType.Ok; Modal = true; ContentArea.Spacing = 6; HBox split_box = new HBox (); split_box.Spacing = 12; split_box.BorderWidth = 6; Image image = new Image (); image.IconSize = (int)IconSize.Dialog; image.IconName = "radio"; image.Yalign = 0.0f; image.Show (); VBox main_box = new VBox (); main_box.BorderWidth = 5; main_box.Spacing = 10; Label header = new Label (); header.Markup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (title)); header.Xalign = 0.0f; header.Show (); Label message = new Label (); message.Text = Catalog.GetString ("Enter the Genre, Title and URL of the radio station you wish to add. A description is optional."); message.Xalign = 0.0f; message.Wrap = true; message.Show (); table = new Table (5, 2, false); table.RowSpacing = 6; table.ColumnSpacing = 6; genre_entry = ComboBoxText.NewWithEntry (); foreach (string genre in ServiceManager.DbConnection.QueryEnumerable<string> ("SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre")) { if (!String.IsNullOrEmpty (genre)) { genre_entry.AppendText (genre); } } if (track != null && !String.IsNullOrEmpty (track.Genre)) { genre_entry.Entry.Text = track.Genre; } AddRow (Catalog.GetString ("Station Genre:"), genre_entry); name_entry = AddEntryRow (Catalog.GetString ("Station Name:")); stream_entry = AddEntryRow (Catalog.GetString ("Stream URL:")); creator_entry = AddEntryRow (Catalog.GetString ("Station Creator:")); description_entry = AddEntryRow (Catalog.GetString ("Description:")); rating_entry = new RatingEntry (); HBox rating_box = new HBox (); rating_box.PackStart (rating_entry, false, false, 0); AddRow (Catalog.GetString ("Rating:"), rating_box); table.ShowAll (); main_box.PackStart (header, false, false, 0); main_box.PackStart (message, false, false, 0); main_box.PackStart (table, false, false, 0); main_box.Show (); split_box.PackStart (image, false, false, 0); split_box.PackStart (main_box, true, true, 0); split_box.Show (); ContentArea.PackStart (split_box, true, true, 0); Button cancel_button = new Button (Stock.Cancel); cancel_button.CanDefault = false; cancel_button.UseStock = true; cancel_button.Show (); AddActionWidget (cancel_button, ResponseType.Close); cancel_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape, 0, Gtk.AccelFlags.Visible); save_button = new Button (Stock.Save); save_button.CanDefault = true; save_button.UseStock = true; save_button.Sensitive = false; save_button.Show (); AddActionWidget (save_button, ResponseType.Ok); save_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return, 0, Gtk.AccelFlags.Visible); name_entry.HasFocus = true; if (track != null) { if (!String.IsNullOrEmpty (track.TrackTitle)) { name_entry.Text = track.TrackTitle; } if (!String.IsNullOrEmpty (track.Uri.AbsoluteUri)) { stream_entry.Text = track.Uri.AbsoluteUri; } if (!String.IsNullOrEmpty (track.Comment)) { description_entry.Text = track.Comment; } if (!String.IsNullOrEmpty (track.ArtistName)) { creator_entry.Text = track.ArtistName; } rating_entry.Value = track.Rating; } error_container = new Alignment (0.0f, 0.0f, 1.0f, 1.0f); error_container.TopPadding = 6; HBox error_box = new HBox (); error_box.Spacing = 4; Image error_image = new Image (); error_image.Stock = Stock.DialogError; error_image.IconSize = (int)IconSize.Menu; error_image.Show (); error = new Label (); error.Xalign = 0.0f; error.Show (); error_box.PackStart (error_image, false, false, 0); error_box.PackStart (error, true, true, 0); error_box.Show (); error_container.Add (error_box); table.Attach (error_container, 0, 2, 6, 7, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); genre_entry.Entry.Changed += OnFieldsChanged; name_entry.Changed += OnFieldsChanged; stream_entry.Changed += OnFieldsChanged; OnFieldsChanged (this, EventArgs.Empty); }
private void BuildWidgets () { var hbox = new HBox () { Spacing = 12 }; // Left box - cover art, title, etc var left_box = new VBox () { BorderWidth = 12, Spacing = 12 }; // Cover art cover = new BookCover (this) { WidthRequest = 300, HeightRequest = 300 }; var editable_cover = CoverArtEditor.For ( cover, (x, y) => true, () => library.TrackModel[0], UpdateCover ); // Title title_label = new WrapLabel (); resume_button = new ImageButton ("", null, IconSize.LargeToolbar); resume_button.ImageWidget.Stock = Stock.MediaPlay; resume_button.LabelWidget.Xalign = 0; resume_button.Spacing = 6; // FIXME the left padding on this is not right rating_entry = new RatingEntry () { AlwaysShowEmptyStars = true, HasFrame = false }; var rating = new HBox (); rating.PackStart (rating_entry, false, false, 0); // Packing left_box.PackStart (editable_cover, false, false, 0); left_box.PackStart (title_label, false, false, 0); left_box.PackStart (resume_button, false, false, 0); //left_box.PackStart (rating, false, false, 0); hbox.PackStart (left_box, false, false, 0); // Right box - track list track_list = new BaseTrackListView () { HeaderVisible = true, IsEverReorderable = false }; var columns = new DefaultColumnController (); var file_columns = new ColumnController (); var disc_column = DefaultColumnController.Create ( BansheeQuery.DiscNumberField, 0.02, false, new ColumnCellPositiveInt (null, false, 2, 2)); file_columns.AddRange ( columns.IndicatorColumn, disc_column, columns.TitleColumn, columns.DurationColumn ); file_columns.SortColumn = columns.DiscNumberAndCountColumn; foreach (var col in file_columns) { col.Visible = true; } var track_sw = new Gtk.ScrolledWindow () { Child = track_list, ShadowType = ShadowType.None }; track_list.ColumnController = file_columns; hbox.PackEnd (track_sw, true, true, 0); Child = hbox; }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { return(RatingEntry.HandleMotionNotify(evnt.State, TransformX(evnt.X))); }
protected override bool OnKeyPressEvent(Gdk.EventKey evnt) { return(RatingEntry.HandleKeyPress(evnt)); }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { return(RatingEntry.HandleScroll(evnt)); }
protected override bool OnLeaveNotifyEvent(Gdk.EventCrossing evnt) { return(RatingEntry.HandleLeaveNotify(evnt)); }