public RepeatActionButton(bool iconOnly) { box.Spacing = 4; label.UseUnderline = true; image.IconSize = (int)IconSize.Menu; box.PackStart (image, false, false, (uint)(iconOnly ? 4 : 0)); if (!iconOnly) { box.PackStart (label, true, true, 0); } button = new MenuButton (box, actions.CreateMenu (), false); Add (button); actions.Changed += OnActionChanged; OnActionChanged (null, null); ShowAll (); }
public NavigationControl () { back_button.Clicked += (o, e) => { if (web_view != null && web_view.CanGoBack) { web_view.GoBack (); } }; forward_button.Clicked += (o, e) => { if (web_view != null && web_view.CanGoForward) { web_view.GoForward (); } }; reload_button.Clicked += (o, e) => { if (web_view != null) { web_view.Reload (!GtkUtilities.NoImportantModifiersAreSet ()); } }; home_button.Clicked += (o, e) => { var handler = GoHomeEvent; if (handler != null) { handler (this, EventArgs.Empty); } }; shortcut_menu_button = new MenuButton (home_button, shortcut_menu, true); UpdateNavigation (); PackStart (back_button, false, false, 0); PackStart (forward_button, false, false, 0); PackStart (reload_button, false, false, 5); PackStart (shortcut_menu_button, false, false, 0); ShowAll (); ClearLinks (); }
private void BuildHeader () { header_table = new Table (2, 2, false); header_table.Show (); primary_vbox.PackStart (header_table, false, false, 0); main_menu = new MainMenu (); if (!PlatformDetection.IsMac && !PlatformDetection.IsMeeGo) { main_menu.Show (); header_table.Attach (main_menu, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); } Alignment toolbar_alignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f); toolbar_alignment.TopPadding = PlatformDetection.IsMeeGo ? 0u : 3u; toolbar_alignment.BottomPadding = PlatformDetection.IsMeeGo ? 0u : 3u; header_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/HeaderToolbar"); header_toolbar.ShowArrow = false; header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; header_toolbar.Show (); if (PlatformDetection.IsMeeGo) { header_toolbar.IconSize = IconSize.LargeToolbar; header_toolbar.Name = "meego-toolbar"; } toolbar_alignment.Add (header_toolbar); toolbar_alignment.Show (); header_table.Attach (toolbar_alignment, 0, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); var next_button = new NextButton (ActionService, PlatformDetection.IsMeeGo); next_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/NextArrowButton", next_button); seek_slider = new ConnectedSeekSlider () { Resizable = ShowSeekSliderResizer.Get () }; seek_slider.SeekSlider.WidthRequest = SeekSliderWidth.Get (); seek_slider.SeekSlider.SizeAllocated += (o, a) => { SeekSliderWidth.Set (seek_slider.SeekSlider.Allocation.Width); }; seek_slider.ShowAll (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/SeekSlider", seek_slider); var track_info_display = new ClassicTrackInfoDisplay (); track_info_display.Show (); track_info_container = TrackInfoDisplay.GetEditable (track_info_display); track_info_container.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/TrackInfoDisplay", track_info_container, true); if (PlatformDetection.IsMeeGo) { track_info_display.ArtworkSpacing = 5; seek_slider.LeftPadding = 20; seek_slider.RightPadding = 20; var menu = (Menu)(ActionService.UIManager.GetWidget ("/ToolbarMenu")); var menu_button = new Hyena.Widgets.MenuButton (new Image (Stock.Preferences, IconSize.LargeToolbar), menu, true); menu_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ToolbarMenuPlaceholder", menu_button); var close_button = new Button (Image.NewFromIconName ("window-close", IconSize.LargeToolbar)) { TooltipText = Catalog.GetString ("Close") }; close_button.Clicked += (o, e) => Hide (); close_button.ShowAll (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ClosePlaceholder", close_button); } else { var volume_button = new ConnectedVolumeButton (); volume_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/VolumeButton", volume_button); } }
private void BuildHeader() { header_table = new Table(2, 2, false); header_table.Show(); primary_vbox.PackStart(header_table, false, false, 0); main_menu = new MainMenu(); if (!PlatformDetection.IsMac && !PlatformDetection.IsMeeGo) { main_menu.Show(); header_table.Attach(main_menu, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); } Alignment toolbar_alignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f); toolbar_alignment.TopPadding = PlatformDetection.IsMeeGo ? 0u : 3u; toolbar_alignment.BottomPadding = PlatformDetection.IsMeeGo ? 0u : 3u; header_toolbar = (Toolbar)ActionService.UIManager.GetWidget("/HeaderToolbar"); header_toolbar.ShowArrow = false; header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; header_toolbar.Show(); if (PlatformDetection.IsMeeGo) { header_toolbar.IconSize = IconSize.LargeToolbar; header_toolbar.Name = "meego-toolbar"; } toolbar_alignment.Add(header_toolbar); toolbar_alignment.Show(); header_table.Attach(toolbar_alignment, 0, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); var next_button = new NextButton(ActionService, PlatformDetection.IsMeeGo); next_button.Show(); ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/NextArrowButton", next_button); seek_slider = new ConnectedSeekSlider() { Resizable = ShowSeekSliderResizer.Get() }; seek_slider.SeekSlider.WidthRequest = SeekSliderWidth.Get(); seek_slider.SeekSlider.SizeAllocated += (o, a) => { SeekSliderWidth.Set(seek_slider.SeekSlider.Allocation.Width); }; seek_slider.ShowAll(); ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/SeekSlider", seek_slider); var track_info_display = new ClassicTrackInfoDisplay(); track_info_display.Show(); track_info_container = TrackInfoDisplay.GetEditable(track_info_display); track_info_container.Show(); ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/TrackInfoDisplay", track_info_container, true); if (PlatformDetection.IsMeeGo) { track_info_display.ArtworkSpacing = 5; seek_slider.LeftPadding = 20; seek_slider.RightPadding = 20; var menu = (Menu)(ActionService.UIManager.GetWidget("/ToolbarMenu")); var menu_button = new Hyena.Widgets.MenuButton(new Image(Stock.Preferences, IconSize.LargeToolbar), menu, true); menu_button.Show(); ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/ToolbarMenuPlaceholder", menu_button); var close_button = new Button(Image.NewFromIconName("window-close", IconSize.LargeToolbar)) { TooltipText = Catalog.GetString("Close") }; close_button.Clicked += (o, e) => { if (ServiceManager.PlayerEngine.IsPlaying() && (ServiceManager.PlayerEngine.CurrentState != PlayerState.Paused) && ServiceManager.PlayerEngine.CurrentTrack.HasAttribute(TrackMediaAttributes.VideoStream)) { ServiceManager.PlayerEngine.Pause(); } Hide(); }; close_button.ShowAll(); ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/ClosePlaceholder", close_button); } else { var volume_button = new ConnectedVolumeButton(); volume_button.Show(); ActionService.PopulateToolbarPlaceholder(header_toolbar, "/HeaderToolbar/VolumeButton", volume_button); } }
private void Build() { var vbox = new VBox () { Spacing = 12 }; var top = new HBox () { Spacing = 6 }; var bot = new HBox () { Spacing = 6 }; vbox.PackStart (top, false, false, 0); vbox.PackStart (bot, false, false, 0); // Top row: playback buttons, seek slider, full-mode button, volume Widget previous_button = ActionService.PlaybackActions["PreviousAction"].CreateToolItem (); Widget playpause_button = ActionService.PlaybackActions["PlayPauseAction"].CreateToolItem (); Widget button = ActionService.PlaybackActions["NextAction"].CreateToolItem (); Menu menu = ActionService.PlaybackActions.ShuffleActions.CreateMenu (); MenuButton next_button = new MenuButton (button, menu, true); top.PackStart (previous_button, false, false, 0); top.PackStart (playpause_button, false, false, 0); top.PackStart (next_button, false, false, 0); seek_slider = new ConnectedSeekSlider (); top.PackStart (seek_slider, true, true, 0); var fullmode_button = new Button () { Label = Catalog.GetString ("Full Mode"), Image = new Image (Stock.LeaveFullscreen, Gtk.IconSize.Button), Relief = Gtk.ReliefStyle.None }; fullmode_button.Clicked += OnFullmode; top.PackStart (fullmode_button, false, false, 0); volume_button = new ConnectedVolumeButton (); top.PackStart (volume_button, false, false, 0); // Bottom row: source dropdown, track info display (cover art, etc), repeat mode button source_combo_box = new SourceComboBox (); bot.PackStart (source_combo_box, false, false, 0); track_info_display = new ClassicTrackInfoDisplay (); track_info_display.WidthRequest = 250; bot.PackStart (track_info_display, true, true, 0); var repeat_align = new Alignment (1, 1, 1, 1); var repeat_toggle_button = new RepeatActionButton (true); repeat_align.Add (repeat_toggle_button); bot.PackEnd (repeat_align, false, false, 0); fullmode_button.TooltipText = Catalog.GetString ("Switch back to full mode"); repeat_toggle_button.TooltipText = Catalog.GetString ("Change repeat playback mode"); Add (vbox); }