public DeleteConfirmationDialog(ISource delfeed)
            : base(WindowType.Toplevel)
        {
            feed = delfeed;

            Title = "Delete feed?";
            IconName = "edit-delete";

            DeleteEvent += OnCancel;

            Resizable = false;
            BorderWidth = 6;

            vbox = new VBox(false, 6);
            Add(vbox);
            hbox = new HBox(false, 6);

            vbox.PackStart(hbox);

            image = new Image(Stock.Delete, IconSize.Dialog);
            hbox.PackStart(image);

            table = new Table(2, 3, false);
            table.RowSpacing = 6;
            hbox.PackEnd(table);

            label = new Label();
            label.Wrap = true;
            label.Markup = "<b><big>Delete feed "+feed.Name+"?</big></b>";
            table.Attach(label, 1, 2, 0, 1);

            warn_label = new Label();
            warn_label.Wrap = true;
            warn_label.Markup = "This cannot be undone.";
            warn_label.SetAlignment(0.0F, 0.5F);
            table.Attach(warn_label, 1, 2, 1, 2);

            bbox = new HButtonBox();
            bbox.Layout = ButtonBoxStyle.End;
            bbox.Spacing = 6;
            vbox.PackEnd(bbox);

            cancel_button = new Button(Stock.Cancel);
            cancel_button.Clicked += new EventHandler(OnCancel);
            bbox.PackStart(cancel_button);

            delete_button = new Button(Stock.Delete);
            delete_button.Clicked += new EventHandler(OnDelete);
            bbox.PackEnd(delete_button);
        }
示例#2
0
        private void BuildInterface()
        {
            VBox usersPane = new VBox ();
            VBox photosPane = new VBox ();
            HBox panes = new HBox ();

            #region Users pane
            usersLabel = new Label ("Users");
            usersView = new TreeView ();
            usersView.SetSizeRequest (320, 240);

            TreeViewColumn userIdColumn = new TreeViewColumn ();
            TreeViewColumn userUidColumn = new TreeViewColumn ();
            TreeViewColumn userNameColumn = new TreeViewColumn ();

            userIdColumn.Title = "ID";
            userUidColumn.Title = "UID";
            userNameColumn.Title = "Name";

            CellRendererText idRenderer = new CellRendererText ();
            CellRendererText uidRenderer = new CellRendererText ();
            CellRendererText nameRenderer = new CellRendererText ();

            userIdColumn.PackStart (idRenderer, true);
            userUidColumn.PackStart (uidRenderer, true);
            userNameColumn.PackStart (nameRenderer, true);

            userIdColumn.SetCellDataFunc (idRenderer, new TreeCellDataFunc (RenderUserId));
            userUidColumn.SetCellDataFunc (uidRenderer, new TreeCellDataFunc (RenderUserUid));
            userNameColumn.SetCellDataFunc (nameRenderer, new TreeCellDataFunc (RenderUserName));

            usersView.AppendColumn (userIdColumn);
            usersView.AppendColumn (userUidColumn);
            usersView.AppendColumn (userNameColumn);

            usersPane.PackStart (usersLabel, false, false, 8);
            usersPane.PackStart (usersView);
            #endregion

            #region Photos pane
            photosLabel = new Label ("Photos");
            addPhotoButton = new Button ("Add photo");
            deletePhotoButton = new Button ("Delete photo");

            addPhotoButton.Sensitive = false;
            deletePhotoButton.Sensitive = false;

            photoManagementButtons = new HButtonBox ();
            photoManagementButtons.LayoutStyle = ButtonBoxStyle.Start;
            photoManagementButtons.PackStart (addPhotoButton);
            photoManagementButtons.PackStart (deletePhotoButton);

            photosView = new TreeView ();
            photosView.SetSizeRequest (320, 240);
            TreeViewColumn photoIdColumn = new TreeViewColumn ();
            photoIdColumn.Title = "ID";
            TreeViewColumn photoImageColumn = new TreeViewColumn();
            photoImageColumn.Title = "Image";

            CellRendererText photoIdRenderer = new CellRendererText();
            CellRendererPixbuf imageRenderer = new CellRendererPixbuf();

            photoIdColumn.PackStart(photoIdRenderer, true);
            photoImageColumn.PackStart(imageRenderer, true);

            photoIdColumn.SetCellDataFunc(photoIdRenderer, new TreeCellDataFunc(RenderPhotoId));
            photoImageColumn.SetCellDataFunc(imageRenderer, new TreeCellDataFunc(RenderPhotoImage));

            photosView.AppendColumn (photoIdColumn);
            photosView.AppendColumn (photoImageColumn);

            ListStore photosStore = new ListStore (typeof(Photo));
            photosView.Model = photosStore;

            photosPane.PackStart (photosLabel, false, false, 8);
            photosPane.PackStart (photosView);
            photosPane.PackStart (photoManagementButtons);
            #endregion

            panes.PackStart (usersPane);
            panes.PackStart (photosPane);

            #region Control buttons
            controlButtons = new HButtonBox ();
            saveButton = new Button ("Save");
            cancelButton = new Button ("Cancel");
            controlButtons.PackStart (saveButton, false, false, 8);
            controlButtons.PackStart (cancelButton, false, false, 8);
            controlButtons.LayoutStyle = ButtonBoxStyle.End;
            #endregion

            VBox rows = new VBox ();
            rows.PackStart (panes);
            rows.PackStart (controlButtons);
            this.Add (rows);
            this.ShowAll ();

            #region Event Handlers Setup
            this.DeleteEvent += new DeleteEventHandler (OnDelete);
            usersView.CursorChanged += new EventHandler (UsersViewCursorChanged);
            addPhotoButton.Clicked += new EventHandler (AddPhotoButtonClicked);
            #endregion
        }