Exemplo n.º 1
0
        Xwt.Button CreateRemoveButton()
        {
            var removeButton = new Xwt.Button("Remove Resource")
            {
                Sensitive = false,
            };

            removeButton.Clicked      += (sender, e) => RemoveSelectedRows();
            listView.SelectionChanged += (sender, e) =>
            {
                var rows = listView.SelectedRows.Length;

                bool newSensitive = rows > 0;
                if (removeButton.Sensitive != newSensitive)
                {
                    removeButton.Sensitive = newSensitive;
                }

                string newLabel = rows > 1 ? "Remove Resources" : "Remove Resource";
                if (removeButton.Label != newLabel)
                {
                    removeButton.Label = newLabel;
                }
            };
            return(removeButton);
        }
Exemplo n.º 2
0
 protected override void Dispose(bool disposing)
 {
     btn.Clicked -= ButtonClicked;
     btn          = null;
     jitter?.Dispose();
     base.Dispose(disposing);
 }
Exemplo n.º 3
0
            public PadWidget()
            {
                jitter = new DocumentJitter();

                var box = new Xwt.VBox();

                combo = new Xwt.ComboBox();
                combo.Items.Add(Jitter.Mono, "Mono JIT");
                combo.Items.Add(Jitter.MonoAOT, "Mono AOT");
                combo.SelectedIndex = 0;
                box.PackStart(combo);

                btn          = new Xwt.Button("JIT");
                btn.Clicked += ButtonClicked;
                box.PackStart(btn);

                textView = new Xwt.RichTextView
                {
                    MinHeight = 400,
                    MinWidth  = 400
                };
                box.PackStart(textView, true, true);

                Content = box;
            }
Exemplo n.º 4
0
        /// <summary>Apply the specified selector (style) to the specified widget</summary>
        /// <param name="Widget">The widget that should "got" the style</param>
        /// <param name="Style">The specified selector with the desired style</param>
        public void ApplyStyle(Xwt.Button Widget, string Pattern)
        {
            Selector Selector = CSS[Pattern];

            if (Selector.Declarations["background-color"].Value != "inherit")
            {
                Widget.BackgroundColor =
                    Utilities.GetXwtColor(
                        Selector.Declarations["background-color"].Value
                        );
            }

            if (Selector.Declarations["border-style"].Value != "inherit")
            {
                if (GetBorder(Selector.Declarations["border-style"].Value))
                {
                    Widget.Style = Xwt.ButtonStyle.Normal;
                }
                else
                {
                    Widget.Style = Xwt.ButtonStyle.Borderless;
                }
            }


            Widget.Visible = Selector.Declarations["display"].Value == "none" ? false : true;
        }
Exemplo n.º 5
0
 public override Xwt.Widget Makeup(IXwtWrapper Parent)
 {
     Xwt.Button Target = new Xwt.Button(this.Text)
     {
         Style = this.Style,
         Type = this.Type,
         UseMnemonic = this.UseMnemonic
     };
     if (this.Image != "")
     {
             Target.Image = Xwt.Drawing.Image.FromFile(this.Image).WithSize(this.ImageWidth, this.ImageHeight);
             Target.ImagePosition = this.ImagePosition;
     }
     WindowController.TryAttachEvent(Target, "Clicked", Parent, Clicked);
     InitWidget(Target, Parent);
     return Target;
 }
Exemplo n.º 6
0
 /// <summary>Display bookmark list to the XWT Box as an array of Buttons</summary>
 /// <param name="box">The XWT box</param>
 /// <param name="OnClick">What should happen if user clicks the bookmark</param>
 /// <param name="s">The Stylist that should apply usertheme to the button (or null)</param>
 public void DisplayBookmarks(Xwt.Box box, Action<string> OnClick, Stylist s = null)
 {
     if(s==null) s = new Stylist();
     box.Clear();
     foreach (Bookmark b in bookmarks)
     {
         string url = b.url;
         Xwt.Button NewBtn = new Xwt.Button(null, b.title);
         NewBtn.Clicked += (o, ea) => { OnClick(url); };
         NewBtn.CanGetFocus = false;
         NewBtn.Style = Xwt.ButtonStyle.Flat;
         NewBtn.Margin = -3;
         NewBtn.Cursor = Xwt.CursorType.Hand;
         NewBtn.Image = b.GetIcon();
         s.Stylize(NewBtn);
         box.PackStart(NewBtn);
     }
 }