Пример #1
0
        public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            buttonCancel = new Gtk.Button(Gtk.Stock.Cancel);
            AddActionWidget(this.buttonCancel, ResponseType.Cancel);

            buttonOk = new Gtk.Button(Gtk.Stock.Ok);
            this.ActionArea.PackStart(buttonOk);
            buttonOk.Clicked += OnButtonOkClicked;

            mainHBox = new HBox();
            tree     = new TreeView();
            var sw = new ScrolledWindow();

            sw.Add(tree);
            sw.HscrollbarPolicy = PolicyType.Never;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.ShadowType       = ShadowType.None;

            var fboxTree = new HeaderBox();

            fboxTree.SetMargins(0, 1, 0, 1);
            fboxTree.SetPadding(0, 0, 0, 0);
            fboxTree.BackgroundColor = new Gdk.Color(255, 255, 255);
            fboxTree.Add(sw);
            mainHBox.PackStart(fboxTree, false, false, 0);

            Realized += delegate {
                fboxTree.BackgroundColor = tree.Style.Base(Gtk.StateType.Normal);
            };

            var vbox = new VBox();

            mainHBox.PackStart(vbox, true, true, 0);
            var headerBox = new HBox(false, 6);

            labelTitle        = new Label();
            labelTitle.Xalign = 0;
            textHeader        = new Alignment(0, 0, 1, 1);
            textHeader.Add(labelTitle);
            textHeader.BorderWidth = 12;
            headerBox.PackStart(textHeader, true, true, 0);

            imageHeader = new OptionsDialogHeader();
            imageHeader.Hide();
            headerBox.PackStart(imageHeader.ToGtkWidget());

            var fboxHeader = new HeaderBox();

            fboxHeader.SetMargins(0, 1, 0, 0);
            fboxHeader.Add(headerBox);
//			fbox.GradientBackround = true;
//			fbox.BackgroundColor = new Gdk.Color (255, 255, 255);
            Realized += delegate {
                var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                c.Light += 0.09;
                fboxHeader.BackgroundColor = c.ToGdkColor();
            };
            StyleSet += delegate {
                if (IsRealized)
                {
                    var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                    c.Light += 0.09;
                    fboxHeader.BackgroundColor = c.ToGdkColor();
                }
            };
            vbox.PackStart(fboxHeader, false, false, 0);

            pageFrame = new HBox();
            var fbox = new HeaderBox();

            fbox.SetMargins(0, 1, 0, 0);
            fbox.ShowTopShadow = true;
            fbox.Add(pageFrame);
            vbox.PackStart(fbox, true, true, 0);

            this.VBox.PackStart(mainHBox, true, true, 0);

            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon);

            store               = new TreeStore(typeof(OptionsDialogSection));
            tree.Model          = store;
            tree.HeadersVisible = false;

            // Column 0 is used to add some padding at the left of the expander
            TreeViewColumn col0 = new TreeViewColumn();

            col0.MinWidth = 6;
            tree.AppendColumn(col0);

            TreeViewColumn col = new TreeViewColumn();
            var            crp = new CellRendererImage();

            col.PackStart(crp, false);
            col.SetCellDataFunc(crp, PixbufCellDataFunc);
            var crt = new CellRendererText();

            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, TextCellDataFunc);
            tree.AppendColumn(col);

            tree.ExpanderColumn = col;

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            RestoreLastPanel();
            this.DefaultResponse = Gtk.ResponseType.Ok;

            buttonOk.CanDefault = true;
            buttonOk.GrabDefault();

            DefaultWidth  = 960;
            DefaultHeight = 680;
        }
Пример #2
0
		public OptionsDialog (Gtk.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
		{
			buttonCancel = new Gtk.Button (Gtk.Stock.Cancel);
			AddActionWidget (this.buttonCancel, ResponseType.Cancel);

			buttonOk = new Gtk.Button (Gtk.Stock.Ok);
			this.ActionArea.PackStart (buttonOk);
			buttonOk.Clicked += OnButtonOkClicked;

			mainHBox = new HBox ();
			tree = new TreeView ();
			var sw = new ScrolledWindow ();
			sw.Add (tree);
			sw.HscrollbarPolicy = PolicyType.Never;
			sw.VscrollbarPolicy = PolicyType.Automatic;
			sw.ShadowType = ShadowType.None;

			var fboxTree = new HeaderBox ();
			fboxTree.SetMargins (0, 1, 0, 1);
			fboxTree.SetPadding (0, 0, 0, 0);
			fboxTree.BackgroundColor = new Gdk.Color (255, 255, 255);
			fboxTree.Add (sw);
			mainHBox.PackStart (fboxTree, false, false, 0);

			Realized += delegate {
				fboxTree.BackgroundColor = tree.Style.Base (Gtk.StateType.Normal);
			};

			var vbox = new VBox ();
			mainHBox.PackStart (vbox, true, true, 0);
			var headerBox = new HBox (false, 6);
			image = new Image ();
		//	headerBox.PackStart (image, false, false, 0);

			labelTitle = new Label ();
			labelTitle.Xalign = 0;
			textHeader = new Alignment (0, 0, 1, 1);
			textHeader.Add (labelTitle);
			textHeader.BorderWidth = 12;
			headerBox.PackStart (textHeader, true, true, 0);

			imageHeader = new OptionsDialogHeader ();
			imageHeader.Hide ();
			headerBox.PackStart (imageHeader.ToGtkWidget ());

			var fboxHeader = new HeaderBox ();
			fboxHeader.SetMargins (0, 1, 0, 0);
			fboxHeader.Add (headerBox);
//			fbox.GradientBackround = true;
//			fbox.BackgroundColor = new Gdk.Color (255, 255, 255);
			Realized += delegate {
				var c = new HslColor (Style.Background (Gtk.StateType.Normal));
				c.L += 0.09;
				fboxHeader.BackgroundColor = c;
			};
			vbox.PackStart (fboxHeader, false, false, 0);

			pageFrame = new HBox ();
			var fbox = new HeaderBox ();
			fbox.SetMargins (0, 1, 0, 0);
			fbox.ShowTopShadow = true;
			fbox.Add (pageFrame);
			vbox.PackStart (fbox, true, true, 0);

			this.VBox.PackStart (mainHBox, true, true, 0);

			this.removeEmptySections = removeEmptySections;
			extensionContext = AddinManager.CreateExtensionContext ();
			
			this.mainDataObject = dataObject;
			this.extensionPath = extensionPath;
			
			if (parentWindow != null)
				TransientFor = parentWindow;
			
			ImageService.EnsureStockIconIsLoaded (emptyCategoryIcon, treeIconSize);
			ImageService.EnsureStockIconIsLoaded (emptyCategoryIcon, headerIconSize);
			
			store = new TreeStore (typeof(OptionsDialogSection));
			tree.Model = store;
			tree.HeadersVisible = false;

			// Column 0 is used to add some padding at the left of the expander
			TreeViewColumn col0 = new TreeViewColumn ();
			col0.MinWidth = 6;
			tree.AppendColumn (col0);

			TreeViewColumn col = new TreeViewColumn ();
			var crp = new CellRendererPixbuf ();
			col.PackStart (crp, false);
			col.SetCellDataFunc (crp, PixbufCellDataFunc);
			var crt = new CellRendererText ();
			col.PackStart (crt, true);
			col.SetCellDataFunc (crt, TextCellDataFunc);
			tree.AppendColumn (col);

			tree.ExpanderColumn = col;
			
			tree.Selection.Changed += OnSelectionChanged;
			
			Child.ShowAll ();
			
			InitializeContext (extensionContext);
			
			FillTree ();
			ExpandCategories ();
			this.DefaultResponse = Gtk.ResponseType.Ok;

			DefaultWidth = 722;
			DefaultHeight = 502;
		}