コード例 #1
0
        void Create()
        {
            // Check if some additional tools are available that should be added to our buttons list
            Populate();

            sizegroup = new SizeGroup(SizeGroupMode.Horizontal);

            Gtk.Image prefImage = new Gtk.Image(
                Helpers.Misc.LoadIcon("lm-preferences",
                                      Sizes.WelcomeIconSize, 0));
            preferencesbutton.Add(prefImage);

            preferencesbutton.WidthRequest  = Sizes.WelcomeIconSize;
            preferencesbutton.HeightRequest = Sizes.WelcomeIconSize;

            // Our logo
            logoImage = new ImageView();

            Image text = App.Current.ResourcesLocator.LoadImage("images/logo/lm-text.svg");

            textImage = new ImageView(text);

            logoBox = new HBox();
            logoBox.Add(logoImage);
            logoBox.Add(textImage);

            //Adding the title
            vbox2.Add(logoBox);

            //Create necessary Hboxes for all icons
            List <HBox> hboxList = new List <HBox> ();

            for (int i = 0; i < NRows; i++)
            {
                Alignment al = new Alignment(0.5F, 0.5F, 0, 0);
                hboxList.Add(new HBox(true, Sizes.WelcomeIconsHSpacing));
                al.Add(hboxList [i]);
                vbox2.Add(al);
            }

            int hboxRow = 0;

            for (uint i = 0; i < buttons.Count; i++)
            {
                Widget b;
                if (i >= Sizes.WelcomeIconsFirstRow && hboxRow == 0)
                {
                    hboxRow++;
                }
                b = CreateButton(buttons [(int)i]);
                hboxList [hboxRow].Add(b);
            }

            ShowAll();
        }
コード例 #2
0
ファイル: WelcomePanel.cs プロジェクト: LongoMatch/longomatch
        Widget CreateButton(WelcomeButton b)
        {
            Button button;
            VBox box;
            Gtk.Image image;
            Gtk.Alignment alignment;
            Label label;

            if (b.Icon == null) {
                image = new Gtk.Image (
                    Helpers.Misc.LoadIcon (b.Name, StyleConf.WelcomeIconImageSize, 0));
            } else {
                image = new Gtk.Image (b.Icon.Value);
            }

            button = new Button ();
            button.Clicked += (sender, e) => (b.Func ());
            button.HeightRequest = StyleConf.WelcomeIconSize;
            button.WidthRequest = StyleConf.WelcomeIconSize;
            button.Add (image);
            if (buttonWidgets.Count == 0) {
                button.Realized += (sender, e) => button.GrabFocus ();
            }

            alignment = new Alignment (0.5f, 0.5f, 0.0f, 0.0f);
            alignment.Add (button);

            label = new Label (b.Text);
            label.ModifyFont (Pango.FontDescription.FromString ("Ubuntu 12"));
            label.LineWrap = true;
            label.LineWrapMode = Pango.WrapMode.Word;
            label.Justify = Justification.Center;
            sizegroup.AddWidget (label);

            box = new VBox (false, StyleConf.WelcomeIconsTextSpacing);
            box.PackStart (alignment, false, false, 0);
            box.PackStart (label, false, false, 0);

            box.Name = b.Name + "roundedbutton";

            return box;
        }
コード例 #3
0
 /// <summary>
 /// Bind the specified spinner to a property by name.
 /// </summary>
 /// <param name="spinner">Spinner.</param>
 public static SpinnerBinding Bind(this Gtk.Image spinner, Expression <Func <IViewModel, bool> > propertyExpression)
 {
     return(new SpinnerBinding(spinner, propertyExpression));
 }
コード例 #4
0
ファイル: WelcomePanel.cs プロジェクト: LongoMatch/longomatch
        void Create()
        {
            // Check if some additional tools are available that should be added to our buttons list
            Populate ();

            sizegroup = new SizeGroup (SizeGroupMode.Horizontal);

            Gtk.Image prefImage = new Gtk.Image (
                                      Helpers.Misc.LoadIcon ("longomatch-preferences",
                                          StyleConf.WelcomeIconSize, 0));
            preferencesbutton.Add (prefImage);
            preferencesbutton.WidthRequest = StyleConf.WelcomeIconSize;
            preferencesbutton.HeightRequest = StyleConf.WelcomeIconSize;

            // Our logo
            logoImage = new Gtk.Image ();
            logoImage.Pixbuf = App.Current.Background.Scale (StyleConf.WelcomeLogoWidth,
                StyleConf.WelcomeLogoHeight).Value;
            logoImage.WidthRequest = StyleConf.WelcomeLogoWidth;
            logoImage.HeightRequest = StyleConf.WelcomeLogoHeight;

            //Adding the title
            vbox2.Add (logoImage);

            //Create necessary Hboxes for all icons
            List<HBox> hboxList = new List<HBox> ();

            for (int i = 0; i < NRows; i++) {
                Alignment al = new Alignment (0.5F, 0.5F, 0, 0);
                hboxList.Add (new HBox (true, StyleConf.WelcomeIconsHSpacing));
                al.Add (hboxList [i]);
                vbox2.Add (al);
            }

            int hboxRow = 0;
            for (uint i = 0; i < buttons.Count; i++) {
                Widget b;
                if (i >= StyleConf.WelcomeIconsFirstRow && hboxRow == 0) {
                    hboxRow++;
                }
                b = CreateButton (buttons [(int)i]);
                hboxList [hboxRow].Add (b);
            }

            ShowAll ();
        }
コード例 #5
0
        void FillToolbar()
        {
            Toolbar toolbar = new Toolbar ();
            toolbar.Orientation = Orientation.Vertical;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;

            editimage = new Gtk.Image (Helpers.Misc.LoadIcon ("longomatch-dash-edit_active", 22));
            editbutton = new ToggleToolButton ();
            editbutton.IconWidget = editimage;
            editbutton.Toggled += HandleEditToggled;
            editbutton.TooltipText = Catalog.GetString ("Edit dashboard");
            toolbar.Add (editbutton);
            toolbar.Add (new SeparatorToolItem ());

            linksimage = new Gtk.Image (Helpers.Misc.LoadIcon ("longomatch-link-disabled", 22));
            linksbutton = new ToggleToolButton ();
            linksbutton.IconWidget = linksimage;
            linksbutton.Toggled += HandleLinksToggled;
            linksbutton.TooltipText = Catalog.GetString ("Edit action links");
            toolbar.Add (linksbutton);
            toolbar.Add (new SeparatorToolItem ());

            popupbutton = new ToggleToolButton ();
            popupbutton.IconWidget = new Gtk.Image (Helpers.Misc.LoadIcon ("longomatch-popup", 22));
            popupbutton.Active = true;
            popupbutton.Toggled += HandlePopupToggled;
            popupbutton.TooltipText = Catalog.GetString ("Disable popup window");
            toolbar.Add (popupbutton);
            toolbar.Add (new SeparatorToolItem ());

            fitbutton = new RadioToolButton ((GLib.SList)null);
            fitbutton.IconWidget = new Gtk.Image (Helpers.Misc.LoadIcon ("longomatch-dash-fit", 22));
            fitbutton.Toggled += HandleFitModeToggled;
            fitbutton.TooltipText = Catalog.GetString ("Fit dashboard");
            toolbar.Add (fitbutton);
            fillbutton = new RadioToolButton (fitbutton);
            fillbutton.IconWidget = new Gtk.Image (Helpers.Misc.LoadIcon ("longomatch-dash-fill", 22));
            fillbutton.Toggled += HandleFitModeToggled;
            fillbutton.TooltipText = Catalog.GetString ("Fill dashboard");
            toolbar.Add (fillbutton);
            d11button = new RadioToolButton (fitbutton);
            d11button.IconWidget = new Gtk.Image (Helpers.Misc.LoadIcon ("longomatch-dash-11", 22));
            d11button.Toggled += HandleFitModeToggled;
            d11button.TooltipText = Catalog.GetString ("1:1 dashboard");
            toolbar.Add (d11button);
            toolbar.ShowAll ();
            hbox2.PackEnd (toolbar, false, false, 0);

            editbutton.Active = true;
            linksbutton.Active = false;
        }