コード例 #1
0
ファイル: AnimatedVBox.cs プロジェクト: GNOME/hyena
        private Table BuildWidget(string title)
        {
            var tile = new Table (3, 2, false);

            tile.ColumnSpacing = 5;
            tile.RowSpacing = 2;

            var title_label = new Label ();
            title_label.Xalign = 0.0f;
            title_label.Ellipsize = Pango.EllipsizeMode.End;
            title_label.Markup = String.Format ("<small><b>{0}</b></small>", GLib.Markup.EscapeText (title));

            var status_label = new Label ();
            status_label.Xalign = 0.0f;
            status_label.Ellipsize = Pango.EllipsizeMode.End;
            status_label.Markup = "<small>Testing...</small>";

            var progress_bar = new ProgressBar ();
            progress_bar.SetSizeRequest (0, -1);
            progress_bar.Fraction = 0.5;
            progress_bar.Text = "Doing nothing...";

            var cancel_button = new Button (new Image (Stock.Stop, IconSize.Menu));
            cancel_button.Relief = ReliefStyle.None;

            tile.Attach (title_label, 0, 3, 0, 1,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            tile.Attach (status_label, 0, 3, 1, 2,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            tile.Attach (progress_bar, 1, 2, 2, 3,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);

            tile.Attach (cancel_button, 2, 3, 2, 3,
                AttachOptions.Shrink | AttachOptions.Fill,
                AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            tile.ShowAll ();

            return tile;
        }
コード例 #2
0
ファイル: UserJobTile.cs プロジェクト: knocte/banshee
        private void BuildWidget()
        {
            ThreadAssist.AssertInMainThread ();
            ColumnSpacing = 5;
            RowSpacing = 2;

            icon = new Image ();

            title_label = new Label ();
            title_label.Xalign = 0.0f;
            title_label.Ellipsize = Pango.EllipsizeMode.End;

            status_label = new Label ();
            status_label.Xalign = 0.0f;
            status_label.Ellipsize = Pango.EllipsizeMode.End;

            progress_bar = new ProgressBar ();
            progress_bar.SetSizeRequest (0, -1);
            progress_bar.Text = " ";
            progress_bar.Show ();

            cancel_button = new Button (new Image (Stock.Stop, IconSize.Menu));
            cancel_button.Relief = ReliefStyle.None;
            cancel_button.ShowAll ();
            cancel_button.Clicked += OnCancelClicked;

            Attach (title_label, 0, 3, 0, 1,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            Attach (status_label, 0, 3, 1, 2,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            Attach (icon, 0, 1, 2, 3,
                AttachOptions.Shrink | AttachOptions.Fill,
                AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            Attach (progress_bar, 1, 2, 2, 3,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);

            Attach (cancel_button, 2, 3, 2, 3,
                AttachOptions.Shrink | AttachOptions.Fill,
                AttachOptions.Shrink | AttachOptions.Fill, 0, 0);
        }