Esempio n. 1
1
		void HandleOnItemSelected (object sender, SettingCollection sc)
		{
			_current_sc = sc;
			foreach(Widget w in vbox3.AllChildren) {
				vbox3.Remove (w);
				w.Dispose();
			}

			Label title = new Label (sc.Heading + " settings");
			Pango.FontDescription tpf = new Pango.FontDescription ();
			tpf.Weight = Pango.Weight.Bold;
			title.ModifyFont (tpf);
			vbox3.Add (title);
			vbox3.Add (new HSeparator());

			for(int i = sc.Settings.Length -1;i > -1; i --)  {
				isettings_viewer v = _scf.get_control(sc.Settings[i].Type);
				v.set_setting(sc.Settings[i]);
				vbox3.Add((Widget)v);
				vbox3.Add (new HSeparator ());
			}
			HSeparator h = new HSeparator();
			h.HeightRequest = 300;
			vbox3.Add (h);
			vbox3.ShowAll ();
		}
Esempio n. 2
0
		public static Gtk.Window Create ()
		{
			window = new Window ("GtkComboBox");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			ComboBoxText combo = ComboBoxText.NewWithEntry ();
			combo.AppendText ("Foo");
			combo.AppendText ("Bar");
			combo.Changed += new EventHandler (OnComboActivated);
			combo.Entry.Changed += new EventHandler (OnComboEntryChanged);
			box2.PackStart (combo, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
Esempio n. 3
0
		public static Gtk.Window Create ()
		{
			window = new Window ("GtkCombo");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			combo = new Gtk.Combo ();
			string[] pop = {"Foo", "Bar"};
			combo.PopdownStrings = pop;
			combo.Entry.Activated += new EventHandler (OnComboActivated);
			box2.PackStart (combo, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
		public void AddMessage (string msg, IconId icon)
		{
			if (lastImage != null) {
				HSeparator sep = new HSeparator ();
				sep.Show ();
				msgBox.PackStart (sep, false, false, 0);
				lastImage.IconSize = Gtk.IconSize.Menu;
			}
			
			HBox box = new HBox ();
			box.Spacing = 12;
			Alignment imgBox = new Alignment (0, 0, 0, 0);
			var img = new ImageView (icon, lastImage != null ? Gtk.IconSize.Menu : IconSize.Dialog);
			imgBox.Add (img);
			lastImage = img;
			box.PackStart (imgBox, false, false, 0);
			Label lab = new Label (msg);
			lab.UseUnderline = false;
			lab.Xalign = 0;
			lab.Yalign = 0;
			lab.Wrap = true;
			lab.WidthRequest = 500;
			box.PackStart (lab, true, true, 0);
			msgBox.PackStart (box, false, false, 0);
			box.ShowAll ();
		}
		public void AddMessage (string msg, string icon)
		{
			if (lastImage != null) {
				HSeparator sep = new HSeparator ();
				sep.Show ();
				msgBox.PackStart (sep);
				lastImage.IconSize = (int) Gtk.IconSize.Button;
			}
			
			HBox box = new HBox ();
			box.Spacing = 12;
			Alignment imgBox = new Alignment (0, 0, 0, 0);
			Image img = new Image (icon, lastImage != null ? Gtk.IconSize.Button : IconSize.Dialog);
			imgBox.Add (img);
			lastImage = img;
			box.PackStart (imgBox, false, false, 0);
			Label lab = new Label (msg);
			lab.Xalign = 0;
			lab.Yalign = 0;
			lab.Wrap = true;
			lab.WidthRequest = 500;
			box.PackStart (lab, true, true, 0);
			msgBox.PackStart (box, false, false, 0);
			box.ShowAll ();
		}
			public WidgetBuilderOptionPanelWidget (Project project) : base (false, 6)
			{
				this.project = project as DotNetProject;

				Gtk.HBox box = new Gtk.HBox (false, 3);
				Gtk.Label lbl = new Gtk.Label (GettextCatalog.GetString ("Target Gtk# version:"));
				box.PackStart (lbl, false, false, 0);
				comboVersions = ComboBox.NewText ();
				ReferenceManager refmgr = new ReferenceManager (project as DotNetProject);
				foreach (string v in refmgr.SupportedGtkVersions)
					comboVersions.AppendText (v);
				comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf (refmgr.GtkPackageVersion);
				refmgr.Dispose ();
				box.PackStart (comboVersions, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);

				HSeparator sep = new HSeparator ();
				sep.Show ();
				PackStart (sep, false, false, 0);
				
				if (!GtkDesignInfo.HasDesignedObjects (project))
					return;

				GtkDesignInfo designInfo = GtkDesignInfo.FromProject (project);
				checkGettext = new CheckButton (GettextCatalog.GetString ("Enable gettext support"));
				checkGettext.Active = designInfo.GenerateGettext;
				checkGettext.Show ();
				PackStart (checkGettext, false, false, 0);
				box = new Gtk.HBox (false, 3);
				box.PackStart (new Label (GettextCatalog.GetString ("Gettext class:")), false, false, 0);
				entryGettext = new Gtk.Entry ();
				entryGettext.Text = designInfo.GettextClass;
				entryGettext.Sensitive = checkGettext.Active;
				box.PackStart (entryGettext, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);
				
				sep= new HSeparator ();
				sep.Show ();
				PackStart (sep, false, false, 0);
				
				box = new Gtk.HBox (false, 3);
				box.PackStart (new Label (GettextCatalog.GetString ("Stetic folder name :")), false, false, 0);
				entryFolderName = new Gtk.Entry ();
				entryFolderName.Text = designInfo.SteticFolderName;
				entryFolderName.Sensitive = false;
				box.PackStart (entryFolderName, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);
				
				checkHideFiles = new CheckButton (GettextCatalog.GetString ("Hide designer files"));
				checkHideFiles.Active = designInfo.HideGtkxFiles;
				checkHideFiles.Show ();
				PackStart (checkHideFiles, false, false, 0);
			}
Esempio n. 7
0
		public TopLevelDialog ( )
		{
			vbox = new VBox ();
			separator = new HSeparator ();
			buttonBox = new HButtonBox ();
			vbox.PackEnd (buttonBox, false, false, 0);
			vbox.PackEnd (separator, false, false, 0);
			vbox.ShowAll ();
			Add (vbox);
		}
			public WidgetBuilderOptionPanelWidget (Project project) : base (false, 6)
			{
				this.project = project as DotNetProject;

				Gtk.HBox box = new Gtk.HBox (false, 3);
				Gtk.Label lbl = new Gtk.Label (GettextCatalog.GetString ("Target Gtk# version:"));
				box.PackStart (lbl, false, false, 0);
				comboVersions = ComboBox.NewText ();
				ReferenceManager refmgr = new ReferenceManager (project as DotNetProject);
				foreach (string v in refmgr.SupportedGtkVersions)
					comboVersions.AppendText (v);
				comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf (refmgr.GtkPackageVersion);
				refmgr.Dispose ();
				box.PackStart (comboVersions, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);

				HSeparator sep = new HSeparator ();
				sep.Show ();
				PackStart (sep, false, false, 0);
				
				if (!GtkDesignInfo.HasDesignedObjects (project))
					return;

				GtkDesignInfo designInfo = GtkDesignInfo.FromProject (project);
				checkGettext = new CheckButton (GettextCatalog.GetString ("Enable gettext support"));
				checkGettext.Active = designInfo.GenerateGettext;
				checkGettext.Show ();
				PackStart (checkGettext, false, false, 0);

				box = new Gtk.HBox (false, 3);
				box.PackStart (new Label (GettextCatalog.GetString ("Gettext class:")), false, false, 0);
				entryGettext = new Gtk.Entry ();
				entryGettext.Text = designInfo.GettextClass;
				entryGettext.Sensitive = checkGettext.Active;
				box.PackStart (entryGettext, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);

				box = new Gtk.HBox (false, 3);
				box.PackStart (new Label (GettextCatalog.GetString ("Resource loader class:")), false, false, 0);
				entryResourceLoader = new Gtk.Entry ();
				entryResourceLoader.Text = designInfo.ImageResourceLoaderClass;
				entryResourceLoader.Sensitive = checkGettext.Active;
				box.PackStart (entryResourceLoader, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);

				checkGettext.Clicked += delegate {
					box.Sensitive = checkGettext.Active;
					if (checkGettext.Active)
						entryGettext.Text = "Mono.Unix.Catalog";
				};
			}
Esempio n. 9
0
        public NotebookPage (Page page)
        {
            this.page = page;

            BorderWidth = 5;
            Spacing = 10;

            tab_widget = new Label (page.Name);
            tab_widget.Show ();

            Widget page_widget = page.DisplayWidget as Widget;
            if (page_widget != null) {
                page_widget.Show ();
                PackStart (page_widget, true, true, 0);
            } else {
                foreach (Section section in page) {
                    AddSection (section);
                }

                if (page.ChildPages.Count > 0) {
                    Notebook notebook = new Notebook ();
                    notebook.ShowBorder = false;
                    notebook.ShowTabs = false;
                    notebook.Show ();

                    var hbox = new HBox () { Spacing = 6 };
                    // FIXME this shouldn't be hard-coded to 'Source:', but this is the only
                    // user of this code atm...
                    var page_label = new Label (Mono.Unix.Catalog.GetString ("Source:"));
                    var page_combo = new PageComboBox (page.ChildPages, notebook);
                    hbox.PackStart (page_label, false, false, 0);
                    hbox.PackStart (page_combo, true, true, 0);
                    hbox.ShowAll ();

                    PackStart (hbox, false, false, 0);

                    HSeparator sep = new HSeparator ();
                    sep.Show ();
                    PackStart (sep, false, false, 0);

                    foreach (Page child_page in page.ChildPages) {
                        NotebookPage page_ui = new NotebookPage (child_page);
                        page_ui.BorderWidth = 0;
                        page_ui.Show ();
                        notebook.AppendPage (page_ui, null);
                    }

                    PackStart (notebook, true, true, 0);
                }
            }
        }
Esempio n. 10
0
		public static Gtk.Window Create ()
		{
			window = new Window ("GtkCheckButton");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			checked_button = new CheckButton ("_button1");
			box2.PackStart (checked_button, true, true, 0);

 			checked_button = new CheckButton ("button2");
 			box2.PackStart (checked_button, true, true, 0);

			checked_button = new CheckButton ("button3");
			box2.PackStart (checked_button, true, true, 0);

			checked_button = new CheckButton ("Inconsistent");
			checked_button.Inconsistent = true;
			box2.PackStart (checked_button, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        SetDefaultSize(200, -1);

        var table     = new Gtk.Table(5, 5, true);
        var separator = new Gtk.HSeparator();

        var label0 = new Gtk.Label("Select file to copy/move");

        _fileCopy  = new Gtk.FileChooserButton("Select A File", Gtk.FileChooserAction.Open);
        _radioCopy = new Gtk.RadioButton("Copy");
        _radioMove = new Gtk.RadioButton(_radioCopy, "Move");
        var copyButton = new Gtk.Button("Copy");

        Add(table);

        table.Attach(label0, 0, 4, 0, 1);
        table.Attach(_fileCopy, 0, 1, 1, 2);
        table.Attach(_radioCopy, 1, 2, 1, 2);
        table.Attach(_radioMove, 2, 3, 1, 2);
        table.Attach(copyButton, 3, 4, 1, 2);
        table.Attach(separator, 0, 4, 2, 3);

        var label1 = new Gtk.Label("Select destination for file(s)");

        _folder = new Gtk.FileChooserButton("Select A File", Gtk.FileChooserAction.SelectFolder);
        var pasteButton = new Gtk.Button("Paste");

        table.Attach(label1, 0, 4, 3, 4);
        table.Attach(_folder, 0, 1, 4, 5);
        table.Attach(pasteButton, 3, 4, 4, 5);

        DeleteEvent         += OnDeleteEvent;
        copyButton.Clicked  += OnCopyButtonClick;
        pasteButton.Clicked += OnPasteButtonClick;

        ShowAll();
    }
Esempio n. 12
0
        private void open_robots(String[] filenames)
        {
            foreach (String filename in filenames)
            {
                RobotFile result = RobotFile.OpenFile(filename);

                // Assign a number first, before adding to the lists
                Robot robot = arena.loadRobot(result);
                files[robot.number] = result;

                RobotWidget widget = new RobotWidget();
                robotlist[robot.number] = widget;
                robotvbox.PackStart(widget, false, true, 0);
                widget.robot = robot;
                widget.update_info();

                /* FIXME: implement closing
                 * Gtk.VBox rvbox = new Gtk.VBox();
                 * widget.AddChild(rvbox);
                 * rvbox.Homogeneous = true;
                 *
                 * Gtk.Button closebutton = new Gtk.Button(Stock.Close);
                 * Gtk.Action closeaction = robotactions[robot.number].getRobotAction("CloseAction");
                 * closeaction.ConnectProxy(closebutton);
                 * rvbox.PackStart(closebutton);
                 */

                widget.ShowAll();

                Gtk.HSeparator rsep = new Gtk.HSeparator();
                robotvbox.PackStart(rsep, false, true, 0);
                rsep.ShowAll();

                arenaview.QueueDraw();
            }
        }
Esempio n. 13
0
    public MainWindow()
        : base(WindowType.Toplevel)
    {
        VBox mainVBox = new VBox(false, 0);
        HBox nodeViewHBox = new HBox(true, 0);
        HBox crudButtonsHBox = new HBox(true, 0);
        HBox transactionContolButtonsHBox = new HBox(true, 0);

        Button refreshButton = new Button("Refresh");
        Button createButton = new Button("Create");
        Button deleteButton = new Button("Delete");
        Button commitButton = new Button("Commit");
        Button rollbackButton = new Button("Rollback");

        refreshButton.Clicked += RefreshButtonClicked;
        createButton.Clicked += CreateButtonClicked;
        deleteButton.Clicked += DeleteButtonClicked;
        commitButton.Clicked += CommitButtonClicked;
        rollbackButton.Clicked += RollbackButtonClicked;

        HSeparator separator = new HSeparator();

        view = new NodeView(Store);

        CellRendererText titleRenderer = new CellRendererText();
        CellRendererText contentRenderer = new CellRendererText();

        titleRenderer.Editable = true;
        contentRenderer.Editable = true;
        titleRenderer.Edited += NoteTitleEdited;
        contentRenderer.Edited += NoteContentEdited;

        view.AppendColumn("Title", titleRenderer, "text", 0);
        view.AppendColumn("Content", contentRenderer, "text", 1);

        ScrolledWindow scrolledWindow = new ScrolledWindow();
        scrolledWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
        scrolledWindow.AddWithViewport(view);

        try {
            //Если сервер и клиент запускаются из ИДЕ (по порядку, но практически одновременно),
            //сервер не успевает создать сокет, поэтому надо немного подождать
            System.Threading.Thread.Sleep(1000);
            RemotingConfiguration.Configure("remoteNotes.exe.config", false);

            clientActivated = new NotesClientActivated();
            singleton = new NotesSingleton();
            singlecall = new NotesTransactionSinglecall();
        } catch (System.Net.WebException) {
            Logger.Write("Unable to connect");
            return;
        }

        foreach (Note note in singleton.GetPesistentData()) {
            store.AddNode(new NoteTreeNode(note));
        }

        nodeViewHBox.PackStart(scrolledWindow, false, true, 0);
        nodeViewHBox.SetSizeRequest(200, 200);

        crudButtonsHBox.PackStart(refreshButton, false, true, 0);
        crudButtonsHBox.PackStart(createButton, false, true, 0);
        crudButtonsHBox.PackStart(deleteButton, false, true, 0);

        transactionContolButtonsHBox.PackStart(commitButton, false, true, 0);
        transactionContolButtonsHBox.PackStart(rollbackButton, false, true, 0);

        mainVBox.PackStart(nodeViewHBox, true, false, 0);
        mainVBox.PackStart(crudButtonsHBox, true, false, 0);
        mainVBox.PackStart(separator, true, false, 2);
        mainVBox.PackStart(transactionContolButtonsHBox, true, false, 0);

        Add(mainVBox);

        mainVBox.ShowAll();

        Build();
    }
Esempio n. 14
0
    public static void Main(string[] args)
    {
        if(args.Length != 1) {
            Console.WriteLine("Usage: gtkHelloWorld num, where num is 1, 2, or 3");
            return(1);
        }

        int which = Convert.ToInt32(args[0]);
        var window = new Window("packingdemo");
        window.DeleteEvent += Delete_Event;
        window.BorderWidth = 10;

        var box1 = new VBox(false, 0);

        switch(which) {
            case 1:
                var label = new Label("gtk_hbox_new(FALSE, 0);");
                var box2 = new HBox(false, 0);
                label.SetAlignment(0, 0);
                box1.PackStart(label, false, false, 0);
                label.Show();

                box2 = MakeBox(false, 0, false, false, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                box2 = MakeBox(false, 0, true, false, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                box2 = MakeBox(false, 0, true, true, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                var separator = new HSeparator();

                box1.PackStart(separator, false, true, 5);
                separator.Show();

                box1 = new VBox(true, 0);
                label = new Label("gtk_hbox_new(TRUE, 0);");
                label.SetAlignment(0, 0);
                box1.PackStart(label, false, false, 0);
                label.Show();

                box2 = MakeBox(true, 0, true, true, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                box2 = MakeBox(true, 0, true, true, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                separator = new HSeparator();

                box1.PackStart(separator, false, true, 5);
                separator.Show();
                break;
            case 2:
                break;
        }
    }
Esempio n. 15
0
        internal PropertyGrid(EditorManager editorManager)
        {
            this.editorManager = editorManager;

            #region Toolbar

            PropertyGridToolbar tb = new PropertyGridToolbar ();
            base.PackStart (tb, false, false, 0);
            toolbar = tb;

            catButton = new RadioButton ((Gtk.RadioButton)null);
            catButton.DrawIndicator = false;
            catButton.Relief = ReliefStyle.None;
            catButton.Image = new Gtk.Image (MonoDevelop.Ide.Gui.Stock.GroupByCategory, IconSize.Menu);
            catButton.Image.Show ();
            catButton.TooltipText = GettextCatalog.GetString ("Sort in categories");
            catButton.Toggled += new EventHandler (toolbarClick);
            toolbar.Insert (catButton, 0);

            alphButton = new RadioButton (catButton);
            alphButton.DrawIndicator = false;
            alphButton.Relief = ReliefStyle.None;
            alphButton.Image = new Gtk.Image (MonoDevelop.Ide.Gui.Stock.SortAlphabetically, IconSize.Menu);
            alphButton.Image.Show ();
            alphButton.TooltipText = GettextCatalog.GetString ("Sort alphabetically");
            alphButton.Clicked += new EventHandler (toolbarClick);
            toolbar.Insert (alphButton, 1);

            catButton.Active = true;

            #endregion

            vpaned = new VPaned ();

            tree = new PropertyGridTable (editorManager, this);
            tree.Changed += delegate {
                Update ();
            };

            CompactScrolledWindow sw = new CompactScrolledWindow ();
            sw.AddWithViewport (tree);
            ((Gtk.Viewport)sw.Child).ShadowType = Gtk.ShadowType.None;
            sw.ShadowType = Gtk.ShadowType.None;
            sw.HscrollbarPolicy = PolicyType.Never;
            sw.VscrollbarPolicy = PolicyType.Automatic;

            VBox tbox = new VBox ();
            toolbarSeparator = new HSeparator ();
            toolbarSeparator.Visible = true;
            tbox.PackStart (toolbarSeparator, false, false, 0);
            tbox.PackStart (sw, true, true, 0);
            helpSeparator = new HSeparator ();
            tbox.PackStart (helpSeparator, false, false, 0);
            helpSeparator.NoShowAll = true;
            vpaned.Pack1 (tbox, true, true);

            AddPropertyTab (new DefaultPropertyTab ());
            AddPropertyTab (new EventPropertyTab ());

            base.PackEnd (vpaned);
            base.FocusChain = new Gtk.Widget [] { vpaned };

            Populate ();
            UpdateTabs ();
        }
Esempio n. 16
0
        internal PropertyGrid(EditorManager editorManager)
        {
            this.editorManager = editorManager;

            #region Toolbar

            PropertyGridToolbar tb = new PropertyGridToolbar ();
            base.PackStart (tb, false, false, 0);
            toolbar = tb;

            catButton = new RadioButton ((Gtk.RadioButton)null);
            catButton.DrawIndicator = false;
            catButton.Relief = ReliefStyle.None;
            Gdk.Pixbuf pixbuf = null;
            //			try {
            //				pixbuf = new Gdk.Pixbuf (typeof (PropertyGrid).Assembly, "MonoDevelop.Components.PropertyGrid.SortByCat.png");
            //			} catch {}
            //(Exception e) {
                //LoggingService.LogError ("Can't create pixbuf from resource: MonoDevelop.Components.PropertyGrid.SortByCat.png", e);
            //}
            if (pixbuf != null) {
                catButton.Image = new Gtk.Image (pixbuf);
                catButton.Image.Show ();
            }
            catButton.TooltipText = "Sort in categories";
            catButton.Toggled += new EventHandler (toolbarClick);
            toolbar.Insert (catButton, 0);

            alphButton = new RadioButton (catButton);
            alphButton.DrawIndicator = false;
            alphButton.Relief = ReliefStyle.None;
            alphButton.Image = new Gtk.Image (Stock.SortAscending, IconSize.Menu);
            alphButton.Image.Show ();
            alphButton.TooltipText = "Sort alphabetically";
            alphButton.Clicked += new EventHandler (toolbarClick);
            toolbar.Insert (alphButton, 1);

            catButton.Active = true;

            toolbar.Insert (new SeparatorToolItem (), 2);
            helpButton = new ToggleButton ();
            helpButton.Relief = ReliefStyle.None;
            helpButton.Image = new Gtk.Image (Gtk.Stock.Help, IconSize.Menu);
            helpButton.TooltipText = "Show help panel";
            helpButton.Clicked += delegate {
                ShowHelp = helpButton.Active;
                //MonoDevelop.Core.PropertyService.Set (PROP_HELP_KEY, helpButton.Active);
            };
            toolbar.Insert (helpButton, 3);

            #endregion

            vpaned = new VPaned ();

            tree = new PropertyGridTree (editorManager, this);
            tree.Changed += delegate {
                Update ();
            };

            VBox tbox = new VBox ();
            toolbarSeparator = new HSeparator ();
            toolbarSeparator.Visible = true;
            tbox.PackStart (toolbarSeparator, false, false, 0);
            tbox.PackStart (tree, true, true, 0);
            helpSeparator = new HSeparator ();
            tbox.PackStart (helpSeparator, false, false, 0);
            helpSeparator.NoShowAll = true;
            vpaned.Pack1 (tbox, true, true);

            AddPropertyTab (new DefaultPropertyTab ());
            AddPropertyTab (new EventPropertyTab ());

            base.PackEnd (vpaned);
            base.FocusChain = new Gtk.Widget [] { vpaned };

            //helpButton.Active = ShowHelp = MonoDevelop.Core.PropertyService.Get<bool> (PROP_HELP_KEY, true);

            Populate ();
            UpdateTabs ();
        }
Esempio n. 17
0
		internal PropertyGrid (EditorManager editorManager)
		{
			this.editorManager = editorManager;
			
			#region Toolbar
			
			PropertyGridToolbar tb = new PropertyGridToolbar ();
			base.PackStart (tb, false, false, 0);
			toolbar = tb;
			
			catButton = new RadioButton ((Gtk.RadioButton)null);
			catButton.DrawIndicator = false;
			catButton.Relief = ReliefStyle.None;
			Gdk.Pixbuf pixbuf = null;
			try {
				pixbuf = new Gdk.Pixbuf (typeof (PropertyGrid).Assembly, "MonoDevelop.Components.PropertyGrid.SortByCat.png");
			} catch (Exception e) {
				LoggingService.LogError ("Can't create pixbuf from resource: MonoDevelop.Components.PropertyGrid.SortByCat.png", e);
			}
			if (pixbuf != null) {
				catButton.Image = new Gtk.Image (pixbuf);
				catButton.Image.Show ();
			}
			catButton.TooltipText = GettextCatalog.GetString ("Sort in categories");
			catButton.Toggled += new EventHandler (toolbarClick);
			toolbar.Insert (catButton, 0);
			
			alphButton = new RadioButton (catButton);
			alphButton.DrawIndicator = false;
			alphButton.Relief = ReliefStyle.None;
			alphButton.Image = new Gtk.Image (Stock.SortAscending, IconSize.Menu);
			alphButton.Image.Show ();
			alphButton.TooltipText = GettextCatalog.GetString ("Sort alphabetically");
			alphButton.Clicked += new EventHandler (toolbarClick);
			toolbar.Insert (alphButton, 1);
			
			catButton.Active = true;
			
			#endregion

			vpaned = new VPaned ();

			tree = new PropertyGridTable (editorManager, this);
			tree.Changed += delegate {
				Update ();
			};

			CompactScrolledWindow sw = new CompactScrolledWindow ();
			sw.AddWithViewport (tree);
			((Gtk.Viewport)sw.Child).ShadowType = Gtk.ShadowType.None;
			sw.ShadowType = Gtk.ShadowType.None;
			sw.HscrollbarPolicy = PolicyType.Never;
			sw.VscrollbarPolicy = PolicyType.Automatic;

			VBox tbox = new VBox ();
			toolbarSeparator = new HSeparator ();
			toolbarSeparator.Visible = true;
			tbox.PackStart (toolbarSeparator, false, false, 0);
			tbox.PackStart (sw, true, true, 0);
			helpSeparator = new HSeparator ();
			tbox.PackStart (helpSeparator, false, false, 0);
			helpSeparator.NoShowAll = true;
			vpaned.Pack1 (tbox, true, true);
			
			AddPropertyTab (new DefaultPropertyTab ());
			AddPropertyTab (new EventPropertyTab ());

			base.PackEnd (vpaned);
			base.FocusChain = new Gtk.Widget [] { vpaned };
			
			Populate ();
			UpdateTabs ();
		}
Esempio n. 18
0
    protected Widget CreateAccountWidget(ECM.Account account)
    {
        VBox accWidget = new VBox();
        accWidget.Spacing = 3;

        Label accKey = new Label(string.Format("Account #{0}", account.KeyID));
        accKey.Xalign = 0;

        HSeparator sep = new HSeparator();

        Button delAccBtn = new Button();
        delAccBtn.Relief = ReliefStyle.None;
        delAccBtn.TooltipText = "Delete Account";
        delAccBtn.Add(new Image("gtk-delete", IconSize.Menu));
        delAccBtn.Clicked += delegate(object sender, EventArgs e)
        {
            //TODO: Make this work
            Console.WriteLine(string.Format("Deleting Account #{0}", account.KeyID));
        };

        Button editAccBtn = new Button();
        editAccBtn.Relief = ReliefStyle.None;
        editAccBtn.TooltipText = "Edit Account";
        editAccBtn.Add(new Image("gtk-edit", IconSize.Menu));
        editAccBtn.Clicked += delegate(object sender, EventArgs e)
        {
            //TODO: Make this work
            Console.WriteLine(string.Format("Editing Account #{0}", account.KeyID));
        };

        HBox accHeader = new HBox();
        accHeader.Spacing = 2;
        accHeader.PackStart(accKey, false, false, 0);
        accHeader.PackStart(sep, true, true, 0);
        accHeader.PackStart(editAccBtn, false, false, 0);
        accHeader.PackStart(delAccBtn, false, false, 0);

        accWidget.PackStart(accHeader, true, false, 0);

        TextView accStats = new TextView();
        accWidget.PackStart(accStats, true, false, 0);

        TextTag expired = new TextTag("expired");
        expired.Weight = Pango.Weight.Bold;
        expired.Foreground = "red";

        accStats.Editable = false;
        accStats.Sensitive = false;

        TimeSpan playTime = new TimeSpan(0, account.LogonMinutes, 0);
        string paidUntilString = account.PaidUntil.ToLocalTime().ToString();
        string accStatus = "Paid Until:";

        if (account.PaidUntilExpired)
        {
            accKey.UseMarkup = true;
            accKey.Markup = string.Format("<span foreground=\"red\" font_weight=\"bold\">{0}</span>", accKey.Text);

            accStatus = "Expired:";
            accStats.Buffer.TagTable.Add(expired);
        }

        accStats.Buffer.Text = string.Format("Time spent playing: {0}", ECM.Helper.GetDurationInWords(playTime));

        TextIter itr = accStats.Buffer.GetIterAtLine(0);
        accStats.Buffer.InsertWithTags(ref itr, string.Format("{0} {1}\n", accStatus, paidUntilString), expired);

        foreach (ECM.Character ecmChar in account.Characters)
        {
            if (ecmChar.AutoUpdate)
                accWidget.PackStart(CreateCharacterButton(ecmChar), true, false, 0);
        }

        accWidget.ShowAll();

        return accWidget;
    }
Esempio n. 19
0
		public CommitDialog (ChangeSet changeSet)
		{
			Build ();

			store = new ListStore(typeof (Xwt.Drawing.Image), typeof (string), typeof (string), typeof(bool), typeof(object));
			fileList.Model = store;
			this.changeSet = changeSet;
			oldMessage = changeSet.GlobalComment;

			CellRendererText crt = new CellRendererText ();
			var crp = new CellRendererImage ();
			TreeViewColumn colStatus = new TreeViewColumn ();
			colStatus.Title = GettextCatalog.GetString ("Status");
			colStatus.PackStart (crp, false);
			colStatus.PackStart (crt, true);
			colStatus.Spacing = 2;
			colStatus.AddAttribute (crp, "image", 0);
			colStatus.AddAttribute (crt, "text", 1);
			CellRendererToggle cellToggle = new CellRendererToggle();
			cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler);
			TreeViewColumn colCommit = new TreeViewColumn ("", cellToggle, "active", 3);
			TreeViewColumn colFile = new TreeViewColumn (GettextCatalog.GetString ("File"), new CellRendererText(), "text", 2);
			
			fileList.AppendColumn(colCommit);
			fileList.AppendColumn(colStatus);
			fileList.AppendColumn(colFile);
			
			colCommit.Visible = false;
			
			object[] exts = AddinManager.GetExtensionObjects ("/MonoDevelop/VersionControl/CommitDialogExtensions", false);
			bool separatorRequired = false;
			
			foreach (object ob in exts) {
				CommitDialogExtension ext = ob as CommitDialogExtension;
				if (ext == null) {
					MessageService.ShowError ("Commit extension type " + ob.GetType() + " must be a subclass of CommitDialogExtension");
					continue;
				}
				if (ext.Initialize (changeSet)) {
					ext.CommitMessageTextViewHook (textview);
					if (separatorRequired) {
						HSeparator sep = new HSeparator ();
						sep.Show ();
						vboxExtensions.PackEnd (sep, false, false, 0);
					}
					vboxExtensions.PackEnd (ext, false, false, 0);
					extensions.Add (ext);
					ext.AllowCommitChanged += HandleAllowCommitChanged;
					separatorRequired = true;
				} else
					ext.Destroy ();
			}
			HandleAllowCommitChanged (null, null);

			foreach (ChangeSetItem info in changeSet.Items) {
				Xwt.Drawing.Image statusicon = VersionControlService.LoadIconForStatus (info.Status);
				string lstatus = VersionControlService.GetStatusLabel (info.Status);
				string localpath;

				if (info.IsDirectory)
					localpath = (!info.LocalPath.IsChildPathOf (changeSet.BaseLocalPath)?
									".":
									(string) info.LocalPath.ToRelative (changeSet.BaseLocalPath));
				else
					localpath = System.IO.Path.GetFileName((string) info.LocalPath);

				if (localpath.Length > 0 && localpath[0] == System.IO.Path.DirectorySeparatorChar) localpath = localpath.Substring(1);
				if (localpath == "") { localpath = "."; } // not sure if this happens
				
				store.AppendValues (statusicon, lstatus, localpath, true, info);
				selected.Add (info.LocalPath);
			}

			if (string.IsNullOrEmpty (changeSet.GlobalComment)) {
				AuthorInformation aInfo;
				CommitMessageFormat fmt = VersionControlService.GetCommitMessageFormat (changeSet, out aInfo);
				Message = changeSet.GenerateGlobalComment (fmt, aInfo);
			}
			else
				Message = changeSet.GlobalComment;
				
			textview.Buffer.Changed += OnTextChanged;
			responseSensitive = !string.IsNullOrEmpty (Message);
			
			// Focus the text view and move the insert point to the beginning. Makes it easier to insert
			// a comment header.
			textview.Buffer.MoveMark (textview.Buffer.InsertMark, textview.Buffer.StartIter);
			textview.Buffer.MoveMark (textview.Buffer.SelectionBound, textview.Buffer.StartIter);
			textview.GrabFocus ();
			textview.Buffer.MarkSet += OnMarkSet;

			SetResponseSensitive (ResponseType.Ok, responseSensitive);
		}
Esempio n. 20
0
        public ProgressBarSample()
        {
            Gtk.HSeparator  separator;
            Gtk.Table       table;
            Gtk.Button      button;
            Gtk.CheckButton check;
            Gtk.VBox        vbox;

            //Application.Init ();

            /* Allocate memory for the data that is passed to the callbacks*/
            pdata = new ProgressData();
            pdata.activity_mode    = false;
            pdata.window           = new Gtk.Window(Gtk.WindowType.Toplevel);
            pdata.window.Resizable = true;

            pdata.window.DeleteEvent += destroy_progress;
            pdata.window.Title        = "GtkProgressBar";
            pdata.window.BorderWidth  = 0;

            vbox             = new Gtk.VBox(false, 5);
            vbox.BorderWidth = 10;
            pdata.window.Add(vbox);
            vbox.Show();

            /* Create a centering alignment object */
            Gtk.Alignment align = new Gtk.Alignment(1, 1, 0, 0);
            vbox.PackStart(align, false, false, 5);
            align.Show();

            /* Create the GtkProgressBar */
            pdata.pbar      = new Gtk.ProgressBar();
            pdata.pbar.Text = "";
            align.Add(pdata.pbar);
            pdata.pbar.Show();

            /* Add a timer callback to update the value of the progress bar*/
            pdata.timer = GLib.Timeout.Add(10000, new GLib.TimeoutHandler(progress_timeout));


            separator = new Gtk.HSeparator();
            vbox.PackStart(separator, false, false, 0);
            separator.Show();

            /* rows, columns, homogeneous */
            table = new Gtk.Table(2, 3, false);
            vbox.PackStart(table, false, true, 0);
            table.Show();

            /* Add a check button to select displaying of the trough text*/
            check = new Gtk.CheckButton("Query cada 1 minuto");
            table.Attach(check, 0, 1, 0, 1,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         5, 5);
            check.Clicked += toggle_show_text;
            check.Show();

            /* Add a check button to toggle activity mode */
            check = new Gtk.CheckButton("Activity mode");
            table.Attach(check, 0, 1, 1, 2,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         5, 5);
            check.Clicked += toggle_activity_mode;
            check.Active   = true;
            check.Show();

            /* Add a check button to toggle orientation */
            check = new Gtk.CheckButton("Right to Left");
            table.Attach(check, 0, 1, 2, 3,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         5, 5);
            check.Clicked += toggle_orientation;
            check.Show();

            /* Add a button to exit the program */
            button          = new Gtk.Button("close");
            button.Clicked += button_click;
            vbox.PackStart(button, false, false, 0);

            /* This makes it so the button is the default. */
            button.CanDefault = true;

            /* This grabs this button to be the default button. Simply hitting
             * the "Enter" key will cause this button to activate. */
            button.GrabDefault();
            button.Show();

            pdata.window.ShowAll();

            //Application.Run ();
        }
Esempio n. 21
0
		void LoadUpdates (List<Update> updates)
		{
			if (updates == null || updates.Count == 0) {
				SetMessage (GettextCatalog.GetString ("No updates available"));
				return;
			}
			
			foreach (var c in productBox.Children) {
				productBox.Remove (c);
				c.Destroy ();
			}
			
			productBox.Spacing = 0;
			
			foreach (var update in updates) {
				var updateBox = new VBox () { Spacing = 2 };
				var labelBox = new HBox ();
				updateBox.PackStart (labelBox, false, false, 0);
				
				string warning = null;
				switch (update.Level) {
				case UpdateLevel.Alpha:
					warning = GettextCatalog.GetString ("ALPHA");
					break;
				case UpdateLevel.Beta:
					warning = GettextCatalog.GetString ("BETA");
					break;
				case UpdateLevel.Test:
					warning = GettextCatalog.GetString ("TEST");
					break;
				}
				if (warning != null)
					warning = "<b><span color=\"#DD1111\">" + warning + "</span></b>";
				
				var updateExpander = new Expander ("");
				updateExpander.LabelWidget = new Label () {
					Markup = string.Format ("<b>{0}</b>\n{1} ({2:yyyy-MM-dd}) {3}", update.Name, update.Version, update.Date,
					                        warning ?? ""),
				};
				labelBox.PackStart (updateExpander, true, true, 0);
				
				var downloadButton = new Button () {
					Label = GettextCatalog.GetString ("Download")
				};
				
				//NOTE: grab the variable from the loop var so the closure captures it 
				var url = update.Url;
				downloadButton.Clicked += delegate {
					DesktopService.ShowUrl (url);
				};
				labelBox.PackStart (downloadButton, false, false, 0);
				
				var sb = new StringBuilder ();
				for (int i = 0; i < update.Releases.Count; i++) {
					var release = update.Releases[i];
					if (i > 0) {
						if (i == 1) {
							sb.AppendLine ();
							sb.AppendLine ("This release also includes previous updates:");
						}
						sb.AppendLine ();
						sb.AppendFormat ("{0} ({1:yyyy-MM-dd})\n", release.Version, release.Date);
						sb.AppendLine ();
					}
					sb.Append (release.Notes.Trim ('\t', ' ', '\n', '\r'));
					sb.AppendLine ();
				}
				var buffer = new TextBuffer (null);
				buffer.Text = sb.ToString ();
				var textView = new TextView (buffer);
				textView.WrapMode = WrapMode.Word;
				textView.Editable = false;
				textView.LeftMargin = textView.RightMargin = 4;
				updateBox.PackStart (textView, false, false, 0);
				
				bool startsExpanded = false;
				updateExpander.Expanded = startsExpanded;
				updateExpander.Activated += delegate {
					textView.Visible = updateExpander.Expanded;
				};
				
				updateBox.BorderWidth = 4;
				
				productBox.PackStart (updateBox, false, false, 0);
				updateBox.ShowAll ();
				//this has to be set false after the ShowAll
				textView.Visible = startsExpanded;
				
				
				var sep = new HSeparator ();
				productBox.PackStart (sep, false, false, 0);
				sep.Show ();
			}
			
			notebook1.CurrentPage = PAGE_UPDATES;
		}
Esempio n. 22
0
        public static int Main(string[] args)
        {
            Gtk.Window window;
                        Button button;
                        VBox box1;
                        HBox box2;
                        HSeparator separator;
                        Misc misc;
                        Box quitbox;
                        int which;
                        Gtk.Label label;
                        Application.Init();

                        if (args.Length !=1) {
                                Console.WriteLine ("Usage: packbox num, where num is 1, 2 o 3");
                                return (1);
                        }

                        which = Convert.ToInt32 (args[0]);

                        window = new Gtk.Window ("packingdemo");

                        window.DeleteEvent += delete_event;

                        window.BorderWidth = 10;

                        box1 = new VBox (false, 0);

                        switch (which) {
                                case 1:
                                        label=new Gtk.Label("gtk_hbox_new (FALSE, 0);");

                                        box2 = new HBox (false, 0);

                                        label.SetAlignment (0, 0);
                                        box1.PackStart (label, false, false, 0);

                                        label.Show();

                                        box2 = make_box (false, 0, false, false, 0);

                                        box1.PackStart (box2, false, false, 0);
                                        box2.Show();

                                        box2 = make_box (false, 0, true, false, 0);
                                        box1.PackStart (box2, false, false, 0);
                                        box2.Show();

                                        box2 = make_box (false, 0, true, true, 0);
                                        box1.PackStart (box2, false, false, 0);
                                        box2.Show();

                                        separator = new HSeparator ();

                                        box1.PackStart (separator, false, true, 5);
                                        separator.Show();

                                        box1 = new VBox (true, 0);
                                        label=new Gtk.Label("gtk_hbox_new (TRUE, 0);");
                                        label.SetAlignment (0, 0);

                                        box1.PackStart(label, false, false, 0);
                                        label.Show();

                                        box2 = make_box (true, 0, true, true, 0);

                                        box1.PackStart (box2, false, false, 0);
                                        box2.Show();

                                        box2 = make_box (true, 0, true, true, 0);
                                        box1.PackStart(box2, false, false, 0);
                                        box2.Show();

                                        separator = new HSeparator();

                                        box1.PackStart (separator, false, true, 5);
                                        separator.Show();

                                        break;

                                case 2:
                                        box2 = new HBox (false, 10);
                                        label = new Gtk.Label("gtk_hbox_new (FALSE, 10);");

                                        label.SetAlignment (0, 0);
                                        box1.PackStart (box2, false, false, 0);
                                        box1.Show();

                                        box2 = make_box (false, 10, true, true, 0);
                                        box1.PackStart (box2, false, false, 0);
                                        box2.Show();

                                        separator = new HSeparator ();

                                        box1.PackStart (separator, false, true, 5);
                                        separator.Show();

                                        box2 = new HBox (false, 0);

                                        label=new Gtk.Label("gtk_hbox_new (FALSE, 0);");
                                        label.SetAlignment (0, 0);
                                        box1.PackStart (label, false, false, 0);
                                        label.Show();

                                        box2 = make_box (false, 0, true, false, 10);
                                        box1.PackStart (box2, false, false, 0);
                                        box2.Show();

                                        box2 = make_box (false, 0, true, true, 10);
                                        box1.PackStart (box2, false, false, 0);
                                        box2.Show();

                                        separator = new HSeparator ();
                                        box1.PackStart(separator, false, true, 5);
                                        separator.Show();
                                        break;

                                case 3:
                                        box2 = make_box (false, 0, false, false, 0);
                                        label = new Label ("end");
                                        box2.PackEnd(label, false, false, 0);
                                        label.Show();

                                        box1.PackStart(box2, false, false, 0);
                                        box2.Show();

                                        separator = new HSeparator();
                                        separator.SetSizeRequest(400, 5);
                                        box1.PackStart (separator, false, true, 5);
                                        separator.Show();
                                        break;
                        }
                        quitbox = new HBox (false, 0);

                        button = new Button ("Quit");

                        button.Clicked += ClickedEventHandler;

                        quitbox.PackStart(button, true, false, 0);
                        box1.PackStart (quitbox, false, false, 0);

                        window.Add(box1);
                        button.Show();
                        quitbox.Show();

                        box1.Show();
                        window.Show();

                        Application.Run();
                        return 0;
        }
Esempio n. 23
0
		public DemoUIManager () : base ("UI Manager")
		{
			ActionEntry[] entries = new ActionEntry[] {
				new ActionEntry ("FileMenu", null, "_File", null, null, null),
				new ActionEntry ("PreferencesMenu", null, "_Preferences", null, null, null),
				new ActionEntry ("ColorMenu", null, "_Color", null, null, null),
				new ActionEntry ("ShapeMenu", null, "_Shape", null, null, null),
				new ActionEntry ("HelpMenu", null, "_Help", null, null, null),
				new ActionEntry ("New", Stock.New, "_New", "<control>N", "Create a new file", new EventHandler (ActionActivated)),
				new ActionEntry ("Open", Stock.Open, "_Open", "<control>O", "Open a file", new EventHandler (ActionActivated)),
				new ActionEntry ("Save", Stock.Save, "_Save", "<control>S", "Save current file", new EventHandler (ActionActivated)),
				new ActionEntry ("SaveAs", Stock.SaveAs, "Save _As", null, "Save to a file", new EventHandler (ActionActivated)),
				new ActionEntry ("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler (ActionActivated)),
				new ActionEntry ("About", null, "_About", "<control>A", "About", new EventHandler (ActionActivated)),
				new ActionEntry ("Logo", "demo-gtk-logo", null, null, "Gtk#", new EventHandler (ActionActivated))
			};

			ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
				new ToggleActionEntry ("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler (ActionActivated), true)
			};


			RadioActionEntry[] colorEntries = new RadioActionEntry[] {
				new RadioActionEntry ("Red", null, "_Red", "<control>R", "Blood", (int)Color.Red),
				new RadioActionEntry ("Green", null, "_Green", "<control>G", "Grass", (int)Color.Green),
				new RadioActionEntry ("Blue", null, "_Blue", "<control>B", "Sky", (int)Color.Blue)
			};

			RadioActionEntry[] shapeEntries = new RadioActionEntry[] {
				new RadioActionEntry ("Square", null, "_Square", "<control>S", "Square", (int)Shape.Square),
				new RadioActionEntry ("Rectangle", null, "_Rectangle", "<control>R", "Rectangle", (int)Shape.Rectangle),
				new RadioActionEntry ("Oval", null, "_Oval", "<control>O", "Egg", (int)Shape.Oval)
			};

			ActionGroup actions = new ActionGroup ("group");
			actions.Add (entries);
			actions.Add (toggleEntries);
			actions.Add (colorEntries, (int)Color.Red, new ChangedHandler (RadioActionActivated));
			actions.Add (shapeEntries, (int)Shape.Oval, new ChangedHandler (RadioActionActivated));

			UIManager uim = new UIManager ();
			uim.InsertActionGroup (actions, 0);
			AddAccelGroup (uim.AccelGroup);
			uim.AddUiFromString (uiInfo);

			VBox box1 = new VBox (false, 0);
			Add (box1);

			box1.PackStart (uim.GetWidget ("/MenuBar"), false, false, 0);

			Label label = new Label ("Type\n<alt>\nto start");
			label.SetSizeRequest (200, 200);
			label.SetAlignment (0.5f, 0.5f);
			box1.PackStart (label, true, true, 0);

			HSeparator separator = new HSeparator ();
			box1.PackStart (separator, false, true, 0);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button button = new Button ("close");
			button.Clicked += new EventHandler (CloseClicked);
			box2.PackStart (button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();

			ShowAll ();
		}
Esempio n. 24
0
    void AddItemToCurrentMarketGroup(ECM.EveItem item, TreeModel model, TreeIter iter)
    {
        if (vbbMarketGroups.IsRealized == false)
            vbbMarketGroups.Realize();

        Image itemPic = new Image();
        itemPic.PixbufAnimation = new Gdk.PixbufAnimation(ECM.Core.LoadingSpinnerGIF);
        itemPic.WidthRequest = 64;
        itemPic.HeightRequest = 64;

        BackgroundWorker fetchImage = new BackgroundWorker();
        fetchImage.DoWork += delegate(object sender, DoWorkEventArgs e)
        {
            itemPic.Pixbuf = ECM.API.ImageApi.GetItemImageGTK(item.ID, ECM.API.ImageApi.ImageRequestSize.Size64x64);
        };

        fetchImage.RunWorkerAsync();

        Gdk.Pixbuf buf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 22, 22);
        Gdk.Pixbuf book = new Gdk.Pixbuf(ECM.Core.Skillbook22PNG);

        EveItemUseability useability = Core.CurrentCharacter.GetItemUseability(item);

        if (useability == EveItemUseability.Untrainable)
            buf.Fill(m_Untrainable.ToUint());
        else if (useability == EveItemUseability.Trainable)
            buf.Fill(m_Trainable.ToUint());
        else
            buf.Fill(m_Useable.ToUint());

        book.Composite(buf, 0, 0, buf.Width, buf.Height, 0, 0, 1, 1, Gdk.InterpType.Hyper, 255);

        Image skillsMet = new Image(buf);
        skillsMet.WidthRequest = 22;
        skillsMet.HeightRequest = 22;
        skillsMet.Xalign = 0;

        Pango.FontDescription font = new Pango.FontDescription();
        font.Size = 24;

        Label itemName = new Label();
        itemName.UseMarkup = true;
        itemName.Markup = string.Format("<span size=\"large\" weight=\"bold\">{0}</span>", item.Name);
        itemName.Xalign = 0;
        //itemName.ModifyFont(font);

        Image infoPic = new Image(ECM.Core.Info16PNG);
        infoPic.WidthRequest = 16;
        infoPic.HeightRequest = 16;

        Button btnInfo = new Button();
        btnInfo.Relief = ReliefStyle.None;
        btnInfo.Add(infoPic);
        btnInfo.Clicked += delegate(object sender, EventArgs e)
        {
            m_ViewDetails.ShowItemDetails(item);
        };

        HBox itemNameHeader = new HBox();
        itemNameHeader.PackStart(itemName, false, false, 0);
        itemNameHeader.PackStart(btnInfo, false, false, 3);

        WrapLabel itemDesc = new WrapLabel(item.Description);

        Frame picFrame = new Frame();
        picFrame.Shadow = ShadowType.Out;
        picFrame.Add(itemPic);

        VBox heading = new VBox();
        heading.Spacing = 6;
        heading.PackEnd(itemNameHeader, false, false, 0);

        if(item.HasRequirements)
            heading.PackEnd(skillsMet, false, false, 0);

        HBox inner = new HBox();
        inner.PackStart(picFrame, false, false, 0);
        inner.PackStart(heading, true, true, 1);

        Button viewDets = new Button(new Label("View Market Details"));
        viewDets.Clicked += delegate(object sender, EventArgs e)
        {
            ShowItemMarketDetails(item, model, iter);
        };

        HButtonBox itemButtons = new HButtonBox();
        itemButtons.Layout = ButtonBoxStyle.End;
        itemButtons.BorderWidth = 3;
        itemButtons.Add(viewDets);
        itemButtons.ShowAll();

        HSeparator sep = new HSeparator();

        VBox itemBlock = new VBox();
        itemBlock.Spacing = 10;
        itemBlock.PackStart(inner, false, false, 0);
        itemBlock.PackStart(itemDesc, true, true, 0);
        itemBlock.PackEnd(itemButtons, false, false, 0);

        itemBlock.ShowAll();
        sep.ShowAll();

        vbbMarketGroups.PackStart(itemBlock, false, false, 3);
        vbbMarketGroups.PackStart(sep, false, false, 3);
    }
Esempio n. 25
0
		void CreatePageWidget (SectionPage page)
		{
			List<PanelInstance> boxPanels = new List<PanelInstance> ();
			List<PanelInstance> tabPanels = new List<PanelInstance> ();
			
			foreach (PanelInstance pi in page.Panels) {
				if (pi.Widget == null) {
					pi.Widget = pi.Panel.CreatePanelWidget ();
					//HACK: work around bug 469427 - broken themes match on widget names
					if (pi.Widget.Name.IndexOf ("Panel") > 0)
						pi.Widget.Name = pi.Widget.Name.Replace ("Panel", "_");
				}
				else if (pi.Widget.Parent != null)
					((Gtk.Container) pi.Widget.Parent).Remove (pi.Widget);
					
				if (pi.Node.Grouping == PanelGrouping.Tab)
					tabPanels.Add (pi);
				else
					boxPanels.Add (pi);
			}
			
			// Try to fit panels with grouping=box or auto in the main page.
			// If they don't fit. Move auto panels to its own tab page.
			
			int mainPageSize;
			bool fits;
			do {
				PanelInstance lastAuto = null;
				mainPageSize = 0;
				foreach (PanelInstance pi in boxPanels) {
					if (pi.Node.Grouping == PanelGrouping.Auto)
						lastAuto = pi;
					// HACK: This we are parenting/unparenting the widget here as a workaround
					// for a layout issue. To properly calculate the size of the widget, the widget
					// needs to have the style that it will have when added to the window.
					pi.Widget.Parent = this;
					mainPageSize += pi.Widget.SizeRequest ().Height + 6;
					pi.Widget.Unparent ();
				}
				fits = mainPageSize <= pageFrame.Allocation.Height;
				if (!fits) {
					if (lastAuto != null && boxPanels.Count > 1) {
						boxPanels.Remove (lastAuto);
						tabPanels.Insert (0, lastAuto);
					} else {
						fits = true;
					}
				}
			} while (!fits);
			
			Gtk.VBox box = new VBox (false, 12);
			box.Show ();
			for (int n=0; n<boxPanels.Count; n++) {
				if (n != 0) {
					HSeparator sep = new HSeparator ();
					sep.Show ();
					box.PackStart (sep, false, false, 0);
				}
				PanelInstance pi = boxPanels [n];
				box.PackStart (pi.Widget, pi.Node.Fill, pi.Node.Fill, 0);
				pi.Widget.Show ();
			}
			
			box.BorderWidth = 12;

			if (tabPanels.Count > 0) {
				/*				SquaredNotebook nb = new SquaredNotebook ();
				nb.Show ();
				nb.AddTab (box, GettextCatalog.GetString ("General"));
				foreach (PanelInstance pi in tabPanels) {
					Gtk.Alignment a = new Alignment (0, 0, 1, 1);
					a.BorderWidth = 9;
					a.Show ();
					a.Add (pi.Widget);
					nb.AddTab (a, GettextCatalog.GetString (pi.Node.Label));
					pi.Widget.Show ();
				}*/
				Gtk.Notebook nb = new Notebook ();
				nb.Show ();
				Gtk.Label blab = new Gtk.Label (GettextCatalog.GetString ("General"));
				blab.Show ();
				box.BorderWidth = 9;
				nb.InsertPage (box, blab, -1);
				foreach (PanelInstance pi in tabPanels) {
					Gtk.Label lab = new Gtk.Label (GettextCatalog.GetString (pi.Node.Label));
					lab.Show ();
					Gtk.Alignment a = new Alignment (0, 0, 1, 1);
					a.BorderWidth = 9;
					a.Show ();
					a.Add (pi.Widget);
					nb.InsertPage (a, lab, -1);
					pi.Widget.Show ();
				}
				page.Widget = nb;
				nb.BorderWidth = 12;
			} else {
				page.Widget = box;
			}
		}
Esempio n. 26
0
		Widget CreateSeparator ()
		{
			var separator = new HSeparator ();
			separator.Show ();
			return separator;
		}
Esempio n. 27
0
        private void open_robots(String[] filenames)
        {
            foreach (String filename in filenames)
            {
                RobotFile result = RobotFile.OpenFile(filename);

                // Assign a number first, before adding to the lists
                Robot robot = arena.loadRobot(result);
                files[robot.number] = result;

                RobotWidget widget = new RobotWidget();
                robotlist[robot.number] = widget;
                robotvbox.PackStart(widget, false, true, 0);
                widget.robot = robot;
                widget.update_info();

                /* FIXME: implement closing
                Gtk.VBox rvbox = new Gtk.VBox();
                widget.AddChild(rvbox);
                rvbox.Homogeneous = true;

                Gtk.Button closebutton = new Gtk.Button(Stock.Close);
                Gtk.Action closeaction = robotactions[robot.number].getRobotAction("CloseAction");
                closeaction.ConnectProxy(closebutton);
                rvbox.PackStart(closebutton);
                */

                widget.ShowAll();

                Gtk.HSeparator rsep = new Gtk.HSeparator();
                robotvbox.PackStart(rsep, false, true, 0);
                rsep.ShowAll();

                arenaview.QueueDraw();
            }
        }