Exemple #1
0
        public Gtk.Button create_button(Gtk.Label label, Gtk.Image image)
        {
            Gtk.Button button = new Gtk.Button();
            Gtk.VBox   vbox   = new Gtk.VBox();

            label.WidthChars    = 24;
            label.MaxWidthChars = 24;
            label.LineWrap      = true;
            label.Justify       = Gtk.Justification.Center;

            vbox.Add(image);
            vbox.Add(label);
            button.Add(vbox);
            button.ShowAll();

            int h = 46 + label.SizeRequest().Height;

            if (h < 80)
            {
                h = 80;
            }

            button.SetSizeRequest(1, h);

            return(button);
        }
 void AdjustSize()
 {
     if (label.SizeRequest().Width > 330)
     {
         label.Wrap         = true;
         label.WidthRequest = 330;
     }
     else
     {
         label.Wrap         = false;
         label.WidthRequest = -1;
     }
     RepositionWindow();
 }
Exemple #3
0
 void AdjustSize()
 {
     // always reset fixed width and wrapping for size calculations
     label.WidthRequest = -1;
     label.Wrap         = false;
     if (label.SizeRequest().Width > 330)
     {
         label.Wrap         = true;
         label.WidthRequest = 330;
     }
     else
     {
         label.Wrap         = false;
         label.WidthRequest = -1;
     }
     if (Visible)
     {
         RepositionWindow();
     }
 }