// Create a Button Box with the specified parameters
        private Frame CreateButtonBox(bool horizontal, string title, int spacing, ButtonBoxStyle layout)
        {
            Frame frame = new Frame(title);

            Gtk.ButtonBox bbox;

            if (horizontal)
            {
                bbox = new Gtk.HButtonBox();
            }
            else
            {
                bbox = new Gtk.VButtonBox();
            }

            bbox.BorderWidth = 5;
            frame.Add(bbox);

            // Set the appearance of the Button Box
            bbox.Layout  = layout;
            bbox.Spacing = spacing;

            bbox.Add(new Button(Stock.Ok));
            bbox.Add(new Button(Stock.Cancel));
            bbox.Add(new Button(Stock.Help));

            return(frame);
        }
Exemplo n.º 2
0
		public InfoBar (MessageType messageType)
		{
			BorderWidth = 6;
			Spacing = 6;
			ActionArea = new VButtonBox () {
				Spacing = 6,
				LayoutStyle = ButtonBoxStyle.Start
			};
			MessageArea = new Alignment (0f, 0f, 1f, 1f);
			
			this.PackEnd (ActionArea, false, false, 0);
			this.PackEnd (MessageArea, true, true, 0);
			this.MessageType = messageType;
		}
Exemplo n.º 3
0
        public MainWindow(InvoiceDirectory idir_)
            : base(WindowType.Toplevel)
        {
            idir = idir_;

            SetSizeRequest(500, 500);
            Title = "Fakturering 2.6";

            maingroup = new HBox(false, 0);
            buttons = new VButtonBox();
            scrolledhd = new ScrolledWindow();
            create   = Button.NewWithLabel("Skapa ny faktura");
            edit     = Button.NewWithLabel("Redigera faktura");
            delete   = Button.NewWithLabel("Radera faktura");
            showbut  = Button.NewWithLabel("Visa faktura");
            printbut = Button.NewWithLabel("Skriv ut faktura");

            CreateListView();

            Add(maingroup);
            maingroup.PackStart(scrolledhd, true, true, 0);
            maingroup.PackStart(buttons, false, false, 0);
            buttons.Layout = ButtonBoxStyle.Start;
            buttons.PackStart(create,   false, false, 0);
            buttons.PackStart(edit,     false, false, 0);
            buttons.PackStart(showbut,  false, false, 0);
            buttons.PackStart(printbut, false, false, 0);
            buttons.PackStart(delete,   false, false, 0);
            scrolledhd.AddWithViewport(listview);
            scrolledhd.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            UpdateHDList();

            create.Clicked   += new EventHandler(Create);
            edit.Clicked     += new EventHandler(Edit);
            delete.Clicked   += new EventHandler(DeleteInvoice);
            showbut.Clicked  += new EventHandler(ShowInvoice);
            printbut.Clicked += new EventHandler(PrintInvoice);

            maingroup.ShowAll();

            //Den här måste vara här då storleken inte är känd innan
            ScrollToEnd(scrolledhd);

            DeleteEvent += new Gtk.DeleteEventHandler(DeleteWindow);
        }
Exemplo n.º 4
0
		// Create a Button Box with the specified parameters
		private Frame CreateButtonBox (bool horizontal, string title, int spacing, ButtonBoxStyle layout)
		{
			Frame frame = new Frame (title);
			Gtk.ButtonBox bbox ;

			if (horizontal)
				bbox =  new Gtk.HButtonBox ();
			else
				bbox =  new Gtk.VButtonBox ();

			bbox.BorderWidth = 5;
			frame.Add (bbox);

			// Set the appearance of the Button Box
			bbox.Layout = layout;
			bbox.Spacing = spacing;

			bbox.Add (new Button (Stock.Ok));
			bbox.Add (new Button (Stock.Cancel));
			bbox.Add (new Button (Stock.Help));

			return frame;
		}
Exemplo n.º 5
0
        private void Initialize()
        {
            Title = Catalog.GetString ("New Smart Playlist");
            VBox.Spacing = 8;

            AddStockButton (Stock.Cancel, ResponseType.Cancel);
            ok_button = AddStockButton (Stock.Save, ResponseType.Ok, true);

            var builder_box = new VBox () {
                BorderWidth = 5,
                Spacing = 10
            };

            var name_box = new HBox () {
                Spacing = 2
            };

            name_box.PackStart (new Label () {
                    Text = Catalog.GetString ("Playlist _Name:"),
                    UseUnderline = true
                }, false, false, 0);

            name_box.PackStart (name_entry = new Entry (), true, true, 0);
            name_entry.Changed += HandleNameChanged;
            builder_box.PackStart (name_box, false, false, 0);

            builder_box.PackStart (builder = new BansheeQueryBox (), true, true, 0);
            builder.Show ();
            builder.Spacing = 4;

            var expander = new Expander (Catalog.GetString ("Predefined Smart Playlists"));
            var hbox = new HBox () { Spacing = 8 };
            var scrolled_window = new ScrolledWindow () {
                HscrollbarPolicy = PolicyType.Never,
                VscrollbarPolicy = PolicyType.Automatic,
                ShadowType = ShadowType.In
            };
            var button_box = new VButtonBox () {
                Spacing = 2,
                LayoutStyle = ButtonBoxStyle.Start
            };
            button_box.PackStart (adv_use_button = new Button (Catalog.GetString ("Open in editor")), false, false, 0);
            button_box.PackStart (adv_add_button = new Button (Catalog.GetString ("Create and save")), false, false, 0);

            scrolled_window.Add (adv_tree_view = new TreeView () {
                HeightRequest = 150,
                HeadersVisible = false
            });
            hbox.PackStart (scrolled_window, true, true, 0);
            hbox.PackStart (button_box, false, false, 0);

            expander.Add (hbox);

            VBox.PackStart (builder_box, true, true, 0);
            VBox.PackStart (expander, false, false, 0);

            // Model is Name, SmartPlaylistDefinition
            ListStore list_model = new ListStore (typeof(string), typeof(SmartPlaylistDefinition));

            bool have_any_predefined = false;
            foreach (SmartPlaylistDefinition def in primary_source.PredefinedSmartPlaylists) {
                list_model.AppendValues (
                    String.Format ("<b>{0}</b>\n<small>{1}</small>", def.Name, def.Description), def
                );
                have_any_predefined = true;
            }

            adv_tree_view.Selection.Mode = SelectionMode.Multiple;
            adv_tree_view.Model = list_model;
            CellRendererText renderer = new CellRendererText ();
            renderer.Ellipsize = Pango.EllipsizeMode.End;
            adv_tree_view.AppendColumn ("title", renderer, "markup", 0);
            adv_tree_view.Selection.Changed += HandleAdvSelectionChanged;

            UpdateAdvButtons (0);

            adv_add_button.Clicked += HandleAdvAdd;
            adv_use_button.Clicked += HandleAdvUse;

            if (!have_any_predefined) {
                expander.NoShowAll = true;
                expander.Hide ();
            }

            Update ();

            name_entry.GrabFocus ();

            ShowAll ();
        }
        public void ShowTools()
        {
            // Remove any open editor, if present.
            if (current_editor != null) {
                active_editor.Hide ();
                widgets.Remove (active_editor);
                active_editor = null;
                current_editor.Restore ();
                current_editor = null;
            }

            // No need to build the widget twice.
            if (buttons != null) {
                buttons.Show ();
                return;
            }

            if (widgets == null) {
                widgets = new VBox (false, 0);
                widgets.NoShowAll = true;
                widgets.Show ();
                Viewport widgets_port = new Viewport ();
                widgets_port.Add (widgets);
                Add (widgets_port);
                widgets_port.ShowAll ();
            }

            // Build the widget (first time we call this method).
            buttons = new VButtonBox ();
            buttons.BorderWidth = 5;
            buttons.Spacing = 5;
            buttons.LayoutStyle = ButtonBoxStyle.Start;

            foreach (Editor editor in editors)
                PackButton (editor);

            buttons.Show ();
            widgets.Add (buttons);
        }
Exemplo n.º 7
0
        public override void LaunchDialogue()
        {
            //the Type in the collection
            IList collection = (IList) parentRow.PropertyValue;
            string displayName = parentRow.PropertyDescriptor.DisplayName;

            //populate list with existing items
            itemStore = new ListStore (typeof (object), typeof (int), typeof (string));
            for (int i=0; i<collection.Count; i++)
            {
                itemStore.AppendValues(collection [i], i, collection [i].ToString ());
            }

            #region Building Dialogue

            //dialogue and buttons
            Dialog dialog = new Dialog ();
            dialog.Title = displayName + " Editor";
            dialog.Modal = true;
            dialog.AllowGrow = true;
            dialog.AllowShrink = true;
            dialog.Modal = true;
            dialog.AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel);
            dialog.AddActionWidget (new Button (Stock.Ok), ResponseType.Ok);

            //three columns for items, sorting, PropGrid
            HBox hBox = new HBox ();
            dialog.VBox.PackStart (hBox, true, true, 5);

            //propGrid at end
            grid = new PropertyGrid (parentRow.ParentGrid.EditorManager);
            grid.CurrentObject = null;
            grid.WidthRequest = 200;
            grid.ShowHelp = false;
            hBox.PackEnd (grid, true, true, 5);

            //followed by item sorting buttons in ButtonBox
            VButtonBox sortButtonBox = new VButtonBox ();
            sortButtonBox.LayoutStyle = ButtonBoxStyle.Start;
            Button upButton = new Button ();
            Image upImage = new Image (Stock.GoUp, IconSize.Button);
            upImage.Show ();
            upButton.Add (upImage);
            upButton.Show ();
            sortButtonBox.Add (upButton);
            Button downButton = new Button ();
            Image downImage = new Image (Stock.GoDown, IconSize.Button);
            downImage.Show ();
            downButton.Add (downImage);
            downButton.Show ();
            sortButtonBox.Add (downButton);
            hBox.PackEnd (sortButtonBox, false, false, 5);

            //Third column is a VBox
            VBox itemsBox = new VBox ();
            hBox.PackStart (itemsBox, false, false, 5);

            //which at bottom has add/remove buttons
            HButtonBox addRemoveButtons = new HButtonBox();
            addRemoveButtons.LayoutStyle = ButtonBoxStyle.End;
            Button addButton = new Button (Stock.Add);
            addRemoveButtons.Add (addButton);
            if (types [0].IsAbstract)
                addButton.Sensitive = false;
            Button removeButton = new Button (Stock.Remove);
            addRemoveButtons.Add (removeButton);
            itemsBox.PackEnd (addRemoveButtons, false, false, 10);

            //and at top has list (TreeView) in a ScrolledWindow
            ScrolledWindow listScroll = new ScrolledWindow ();
            listScroll.WidthRequest = 200;
            listScroll.HeightRequest = 320;
            itemsBox.PackStart (listScroll, true, true, 0);

            itemTree = new TreeView (itemStore);
            itemTree.Selection.Mode = SelectionMode.Single;
            itemTree.HeadersVisible = false;
            listScroll.AddWithViewport (itemTree);

            //renderers and attribs for TreeView
            CellRenderer rdr = new CellRendererText ();
            itemTree.AppendColumn (new TreeViewColumn ("Index", rdr, "text", 1));
            rdr = new CellRendererText ();
            itemTree.AppendColumn (new TreeViewColumn ("Object", rdr, "text", 2));

            #endregion

            #region Events

            addButton.Clicked += new EventHandler (addButton_Clicked);
            removeButton.Clicked += new EventHandler (removeButton_Clicked);
            itemTree.Selection.Changed += new EventHandler (Selection_Changed);
            upButton.Clicked += new EventHandler (upButton_Clicked);
            downButton.Clicked += new EventHandler (downButton_Clicked);

            #endregion

            //show and get response
            dialog.ShowAll ();
            ResponseType response = (ResponseType) dialog.Run();
            dialog.Destroy ();

            //if 'OK' put items back in collection
            if (response == ResponseType.Ok)
            {
                DesignerTransaction tran = CreateTransaction (parentRow.ParentGrid.CurrentObject);
                object old = collection;

                try {
                    collection.Clear();
                    foreach (object[] o in itemStore)
                        collection.Add (o[0]);
                    EndTransaction (parentRow.ParentGrid.CurrentObject, tran, old, collection, true);
                }
                catch {
                    EndTransaction (parentRow.ParentGrid.CurrentObject, tran, old, collection, false);
                    throw;
                }
            }

            //clean up so we start fresh if launched again

            itemTree = null;
            itemStore = null;
            grid = null;
            previousIter = TreeIter.Zero;
        }
Exemplo n.º 8
0
		// Page 3
		// Extension Preferences
		public Gtk.Widget MakeAddinsPane ()
		{
			Gtk.VBox vbox = new Gtk.VBox (false, 6);
			vbox.BorderWidth = 6;
			Gtk.Label l = new Gtk.Label (Catalog.GetString (
			                                     "The following add-ins are installed"));
			l.Xalign = 0;
			l.Show ();
			vbox.PackStart (l, false, false, 0);

			Gtk.HBox hbox = new Gtk.HBox (false, 6);

			// TreeView of Add-ins
			Gtk.TreeView tree = new Gtk.TreeView ();
			addin_tree = new Mono.Addins.Gui.AddinTreeWidget (tree);

			tree.Show ();

			Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
			sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			sw.ShadowType = Gtk.ShadowType.In;
			sw.Add (tree);
			sw.Show ();
			Gtk.LinkButton get_more_link =
				new Gtk.LinkButton ("http://live.gnome.org/Tomboy/PluginList",
				                    Catalog.GetString ("Get More Add-Ins..."));
			get_more_link.Show ();
			Gtk.VBox tree_box = new Gtk.VBox (false, 0);
			tree_box.Add (sw);
			tree_box.PackEnd (get_more_link, false, false, 5);
			tree_box.Show ();
			hbox.PackStart (tree_box, true, true, 0);

			// Action Buttons (right of TreeView)
			Gtk.VButtonBox button_box = new Gtk.VButtonBox ();
			button_box.Spacing = 4;
			button_box.Layout = Gtk.ButtonBoxStyle.Start;

			// TODO: In a future version, add in an "Install Add-ins..." button

			// TODO: In a future version, add in a "Repositories..." button

			enable_addin_button =
			        new Gtk.Button (Catalog.GetString ("_Enable"));
			enable_addin_button.Sensitive = false;
			enable_addin_button.Clicked += OnEnableAddinButton;
			enable_addin_button.Show ();

			disable_addin_button =
			        new Gtk.Button (Catalog.GetString ("_Disable"));
			disable_addin_button.Sensitive = false;
			disable_addin_button.Clicked += OnDisableAddinButton;
			disable_addin_button.Show ();

			addin_prefs_button =
			        new Gtk.Button (Gtk.Stock.Preferences);
			addin_prefs_button.Sensitive = false;
			addin_prefs_button.Clicked += OnAddinPrefsButton;
			addin_prefs_button.Show ();

			addin_info_button =
			        new Gtk.Button (Gtk.Stock.Info);
			addin_info_button.Sensitive = false;
			addin_info_button.Clicked += OnAddinInfoButton;
			addin_info_button.Show ();

			button_box.PackStart (enable_addin_button);
			button_box.PackStart (disable_addin_button);
			button_box.PackStart (addin_prefs_button);
			button_box.PackStart (addin_info_button);

			button_box.Show ();
			hbox.PackStart (button_box, false, false, 0);

			hbox.Show ();
			vbox.PackStart (hbox, true, true, 0);
			vbox.Show ();

			tree.Selection.Changed += OnAddinTreeSelectionChanged;
			LoadAddins ();

			return vbox;
		}
        void BuildGui()
        {
            CellRendererText cellId = new CellRendererText();
            TreeViewColumn idColumn = new TreeViewColumn();
            idColumn.Title = GettextCatalog.GetString("ID");
            idColumn.PackStart(cellId, false);
            idColumn.AddAttribute(cellId, "text", 0);

            CellRendererText cellTitle = new CellRendererText();
            TreeViewColumn titleColumn = new TreeViewColumn();
            titleColumn.Title = "Title";
            titleColumn.Expand = true;
            titleColumn.Sizing = TreeViewColumnSizing.Fixed;
            titleColumn.PackStart(cellTitle, true);
            titleColumn.AddAttribute(cellTitle, "text", 1);

            CellRendererCombo cellAction = new CellRendererCombo();
            TreeViewColumn actionColumn = new TreeViewColumn();
            actionColumn.Title = "Action";
            actionColumn.PackStart(cellAction, false);
            actionColumn.AddAttribute(cellAction, "text", 2);
            cellAction.Editable = true;
            cellAction.Model = checkinActions;
            cellAction.TextColumn = 0;
            cellAction.HasEntry = false;
            cellAction.Edited += OnActionChanged;
            //checkinActions.AppendValues(WorkItemCheckinAction.None.ToString());
            checkinActions.AppendValues(WorkItemCheckinAction.Associate.ToString());
            //checkinActions.AppendValues(WorkItemCheckinAction.Resolve.ToString());

            workItemsView.AppendColumn(idColumn);
            workItemsView.AppendColumn(titleColumn);
            workItemsView.AppendColumn(actionColumn);

            workItemsView.Model = workItemStore;
            workItemsView.WidthRequest = 300;
            workItemsView.HeightRequest = 120;

            this.PackStart(workItemsView, true, true, 3);

            VButtonBox buttonBox = new VButtonBox();
            Button addButton = new Button();
            addButton.Label = GettextCatalog.GetString("Add Work Item");
            addButton.Clicked += OnAddWorkItem;
            removeButton.Label = GettextCatalog.GetString("Remove Work Item");
            removeButton.Sensitive = false;
            removeButton.Clicked += OnRemoveWorkItem;

            addButton.WidthRequest = removeButton.WidthRequest = 150;

            buttonBox.PackStart(addButton);
            buttonBox.PackStart(removeButton);
            buttonBox.Layout = ButtonBoxStyle.Start;

            this.PackStart(buttonBox, false, false, 3);

            this.ShowAll();
        }