public RecentFileListWindow(string title, Gtk.Window parent, DialogFlags flags, params object[] button_data)
            : base(title, parent, flags, button_data)
        {
            _searchView = new Gtk.Entry ("");
            _searchView.SetSizeRequest (500, 40);
            _searchView.Changed += _searchView_Changed;
            _searchView.KeyReleaseEvent += HandleSearchViewKeyReleaseEvent;
            _searchView.KeyPressEvent += HandleKeyPressEvent;
            _searchView.FocusOutEvent += HandleFocusOutEvent;
            VBox.Add (_searchView);

            CreateTree ();
            VBox.Add (_treeView);

            _pathLabel = new Gtk.Label ();
            _pathLabel.SetSizeRequest (500, 40);
            VBox.Add (_pathLabel);

            MemberExtensionsHelper.Instance.IsDirty = true;
            UpdateDocuments ();
            this.SetSizeRequest (500, 700);

            CanFocus = true;
            _searchView.CanFocus = true;
            _searchView.IsEditable = true;
            _searchView.GrabFocus ();
            ShowAll ();
        }
예제 #2
0
        public RecentFileListWindow(string title, Gtk.Window parent, DialogFlags flags, params object[] button_data) : base(title, parent, flags, button_data)
        {
            _searchView = new Gtk.Entry("");
            _searchView.SetSizeRequest(500, 40);
            _searchView.Changed         += _searchView_Changed;
            _searchView.KeyReleaseEvent += HandleSearchViewKeyReleaseEvent;
            _searchView.KeyPressEvent   += HandleKeyPressEvent;
            _searchView.FocusOutEvent   += HandleFocusOutEvent;
            VBox.Add(_searchView);

            CreateTree();
            _scrolledWindow = new Gtk.ScrolledWindow();
            _scrolledWindow.SetSizeRequest(500, 600);
            _scrolledWindow.Add(_treeView);
            VBox.Add(_scrolledWindow);
            _pathLabel = new Gtk.Label();
            _pathLabel.SetSizeRequest(500, 40);
            VBox.Add(_pathLabel);

            MemberExtensionsHelper.Instance.IsDirty = true;
            UpdateDocuments();
            VBox.SetSizeRequest(500, 700);
            this.SetSizeRequest(500, 700);

            CanFocus               = true;
            _searchView.CanFocus   = true;
            _searchView.IsEditable = true;
            _searchView.GrabFocus();
            ShowAll();
        }
        public MemberListWindow(string title, Gtk.Window parent, DialogFlags flags, params object[] button_data)
            : base(title, parent, flags, button_data)
        {
            if (IdeApp.Workbench == null) {
                return;
            }
            var rootWindow = IdeApp.Workbench.RootWindow;
            _searchView = new Gtk.Entry ("");
            _searchView.SetSizeRequest (500, 40);
            _searchView.Changed += _searchView_Changed;
            _searchView.KeyReleaseEvent += HandleSearchViewKeyReleaseEvent;
            _searchView.KeyPressEvent += HandleKeyPressEvent;
            _searchView.FocusOutEvent += HandleFocusOutEvent;
            VBox.Add (_searchView);

            CreateTree ();
            VBox.Add (_treeView);

            MemberExtensionsHelper.Instance.IsDirty = true;
            UpdateMembers ();
            var editor = IdeApp.Workbench.ActiveDocument.Editor;
            var visualInsertLocation = editor.LogicalToVisualLocation (editor.Caret.Location);
            var targetView = IdeApp.Workbench.RootWindow;

            this.SetSizeRequest (500, 700);

            CanFocus = true;
            _searchView.CanFocus = true;
            _searchView.IsEditable = true;
            _searchView.GrabFocus ();
            ShowAll ();
        }
예제 #4
0
        protected override void OnSizeAllocated(Gdk.Rectangle allocation)
        {
            base.OnSizeAllocated(allocation);

            _entry.SetSizeRequest(allocation.Width, allocation.Height);

            ShowPlaceholderIfNeeded();
        }
예제 #5
0
        private void AddWindowContent()
        {
            Label label = new Label("Add game"), titleLabel = new Label("Host address"), saveLabel = new Label("Save path");
            AddGameButton = new Button();
            _hostPathBox = new Entry();
            _hostPathBox.SetSizeRequest(300, _hostPathBox.HeightRequest);
            Fixed fix = new Fixed();

            AddGameButton.Label = "Add game";
            AddGameButton.Clicked += OnAddGame;

            fix.Put(label, 5, 10);
            fix.Put(titleLabel, 5, 30);
            fix.Put(_hostPathBox, 5, 100);
            fix.Put(AddGameButton, 5, 140);

            Add(fix);
        }
		public Screen()
			: base(Gtk.WindowType.Toplevel)
		{
			Build();

			this.SetSizeRequest(500, 100);
			this.DefaultSize = new Gdk.Size(500, 100);

			/* Create a new button */
			buttonLoad = new Button();
			buttonSend = new Button();

			/* Connect the "clicked" signal of the button to our callback */
			buttonLoad.Clicked += new EventHandler(buttonLoad_Clicked);
			buttonLoad.Label = "Load";
			buttonLoad.SetSizeRequest(80, 20);

			buttonSend.Clicked += new EventHandler(buttonSend_Clicked);
			buttonSend.Label = "Send";
			buttonSend.SetSizeRequest(80, 20);

			textBoxLoad = new Entry("image file");
			textBoxLoad.SetSizeRequest(320, 20);
			textBoxSend = new Entry(HolisticWare.SlideShow.BusinessLogic.WebServiceClientProxy.Url);
			textBoxSend.SetSizeRequest(320, 20);

			fix = new Fixed();

			fix.Put(textBoxLoad, 20, 20);
			fix.Put(textBoxSend, 20, 50);
			fix.Put(buttonLoad, 360, 20);
			fix.Put(buttonSend, 360, 50);

			Add(fix);

			this.ShowAll();

			return;
		}
        public LevelRangeWidget(string label, int low, int high)
        {
            IConfigSource config = new DotNetConfigSource(DotNetConfigSource.GetFullConfigPath());

            int entrySize = config.Configs["defaults"].GetInt("entrySize");
            int entryWidth = config.Configs["defaults"].GetInt("entryWidth");

            Low = new Entry(entrySize);
            Low.SetSizeRequest(entryWidth, Low.SizeRequest().Height);
            Low.WidthChars = entrySize;
            Low.IsEditable = false;
            Low.CanFocus = false;

            Label = new Label(label);
            Label.Justify = Justification.Center;
            Label.SetSizeRequest(150, Label.SizeRequest().Height);

            High = new Entry(entrySize);
            High.SetSizeRequest(entryWidth, High.SizeRequest().Height);
            High.WidthChars = entrySize;
            High.IsEditable = false;
            High.CanFocus = false;
        }
        public MemberListWindow(string title, Gtk.Window parent, DialogFlags flags, IUnresolvedEntity selectedEntry, params object[] button_data) : base(title, parent, flags, button_data)
        {
            if (IdeApp.Workbench == null)
            {
                return;
            }
            SelectedEntity = selectedEntry;

            _searchView = new Gtk.Entry("");
            _searchView.SetSizeRequest(500, 40);
            _searchView.Changed         += _searchView_Changed;
            _searchView.KeyReleaseEvent += HandleSearchViewKeyReleaseEvent;
            _searchView.KeyPressEvent   += HandleKeyPressEvent;
            _searchView.FocusOutEvent   += HandleFocusOutEvent;
            VBox.Add(_searchView);

            CreateTree();
            _scrolledWindow = new Gtk.ScrolledWindow();
            _scrolledWindow.SetSizeRequest(500, 600);
            _scrolledWindow.Add(_treeView);
            VBox.Add(_scrolledWindow);

            MemberExtensionsHelper.Instance.IsDirty = true;
            UpdateMembers();
            var editor = IdeApp.Workbench.ActiveDocument.Editor;
            var visualInsertLocation = editor.LogicalToVisualLocation(editor.Caret.Location);
            var targetView           = IdeApp.Workbench.RootWindow;

            this.SetSizeRequest(500, 700);

            CanFocus               = true;
            _searchView.CanFocus   = true;
            _searchView.IsEditable = true;
            _searchView.GrabFocus();
            ShowAll();
        }
예제 #9
0
        public void Start()
        {
            window = new Window(WindowType.Toplevel);
            window.SetPosition(WindowPosition.Mouse);
            window.KeepAbove = true;
            window.Resize(200, 150);
            window.Title = "Dimensions";
            window.Deletable = false;

            Fixed fix = new Fixed();

            // width
            widthLabel = new Label();
            widthLabel.Text = "Width";
            fix.Put(widthLabel, 15, 25);

            widthInputEntry = new Entry();
            widthInputEntry.SetSizeRequest(100, 25);
            widthInputEntry.TextInserted += OnlyNumber;
            widthInputEntry.TextInserted += ChangeWidth;
            widthInputEntry.TextDeleted += ChangeWidth;
            fix.Put(widthInputEntry, 80, 20);

            // height
            heightLabel = new Label();
            heightLabel.Text = "Height";
            fix.Put(heightLabel, 15, 75);

            heightInputEntry = new Entry();
            heightInputEntry.SetSizeRequest(100, 25);
            heightInputEntry.TextInserted += OnlyNumber;
            heightInputEntry.TextInserted += ChangeHeight;
            heightInputEntry.TextDeleted += ChangeHeight;
            fix.Put(heightInputEntry, 80, 70);

            // Buttons
            okButton = new Button();
            okButton.Label = "OK";
            okButton.SetSizeRequest(80, 30);
            okButton.Clicked += okButton_Clicked;
            fix.Put(okButton, 10, 110);

            cancelButton = new Button();
            cancelButton.Label = "Cancel";
            cancelButton.SetSizeRequest(80, 30);
            cancelButton.Clicked += cancelButton_Clicked;
            fix.Put(cancelButton, 110, 110);

            window.Add(fix);
            window.ShowAll();

            widthInputEntry.Text = "" + width;
            heightInputEntry.Text = "" + height;
        }
예제 #10
0
        public static void FetchForm(Container Parent, XmlNode Nodes)
        {
            int cIndex = 0;

            string[]    UFont;
            XmlNodeList original = Nodes.ChildNodes;
            XmlNodeList reverse  = new ReverseXmlList(original);

            foreach (XmlNode C in reverse)
            {
                if (C.Name == "Object")
                {
                    cIndex++;
                    if (C.Attributes[0].Name == "type")
                    {
                        if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button"))
                        {
                            var PB = new Gtk.Button();
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB]));
                            Parent.Add(PB);
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes["name"].Value)
                                    {
                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "Name":
                                        PB.Name = V.InnerText;
                                        break;

                                    case "ForeColor":
                                        var FColor = V.InnerText.GetXColor().ToNative();
                                        PB.Children[0].ModifyFg(StateType.Normal, FColor);
                                        PB.Children[0].ModifyFg(StateType.Active, FColor);
                                        PB.Children[0].ModifyFg(StateType.Prelight, FColor);
                                        PB.Children[0].ModifyFg(StateType.Selected, FColor);
                                        break;

                                    case "Caption":
                                    case "Text":
                                        PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")));
                                        break;

                                    case "BackColor":
                                        var BColor = V.InnerText.GetXColor().ToNative();
                                        PB.ModifyBg(StateType.Normal, BColor);
                                        PB.ModifyBg(StateType.Active, BColor);
                                        PB.ModifyBg(StateType.Insensitive, BColor);
                                        PB.ModifyBg(StateType.Prelight, BColor);
                                        PB.ModifyBg(StateType.Selected, BColor);
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "Size":
                                        PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;

                                    case "Font":
                                        string VC = V.InnerText;
                                        UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                        string VCFName = UFont[0];
                                        float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                        float  Z       = (float)(VCSize * App.ScaleFactorY);
                                        PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                        break;

                                    case "Image":
                                        if (V.HasChildNodes)
                                        {
                                            string IMGData = V.FirstChild.InnerText;
                                            byte[] B       = System.Convert.FromBase64String(IMGData);
                                            Pixbuf P       = new Pixbuf(B);
                                            P        = P.ScaleSimple(PB.WidthRequest - 10, PB.HeightRequest, InterpType.Bilinear);
                                            PB.Image = new Gtk.Image(P);
                                        }
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        }
                        else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label"))
                        {
                            var CE = new Gtk.EventBox();
                            CE.ResizeMode = ResizeMode.Parent;
                            var CC = new Gtk.Label();
                            CE.Add(CC);
                            Parent.Add(CE);
                            CC.LineWrapMode = Pango.WrapMode.Word;
                            CC.LineWrap     = true;
                            CC.Wrap         = true;
                            CC.Justify      = Justification.Fill;
                            global::Gtk.Fixed.FixedChild PBC1;
                            if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild")
                            {
                                var XVC = Parent[CE].Parent.Parent;
                                PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]);
                            }
                            else
                            {
                                PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE]));
                            }
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes["name"].Value)
                                    {
                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "Name":
                                        CC.Name = V.InnerText;
                                        break;

                                    case "Font":
                                        string VC = V.InnerText;
                                        UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                        string VCFName = UFont[0];
                                        float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                        float  Z       = (float)(VCSize * App.ScaleFactorY);
                                        CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z));
                                        break;

                                    case "ForeColor":
                                        var FColor = V.InnerText.GetXColor().ToNative();
                                        CC.ModifyFg(StateType.Normal, FColor);
                                        CC.ModifyFg(StateType.Active, FColor);
                                        CC.ModifyFg(StateType.Insensitive, FColor);
                                        CC.ModifyFg(StateType.Prelight, FColor);
                                        CC.ModifyFg(StateType.Selected, FColor);
                                        CE.ModifyFg(StateType.Normal, FColor);
                                        CE.ModifyFg(StateType.Active, FColor);
                                        CE.ModifyFg(StateType.Insensitive, FColor);
                                        CE.ModifyFg(StateType.Prelight, FColor);
                                        CE.ModifyFg(StateType.Selected, FColor);
                                        CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>";
                                        break;

                                    case "Caption":
                                    case "Text":
                                        CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n"));
                                        break;

                                    case "BackColor":
                                        if (V.InnerText != "Transparent")
                                        {
                                            var BColor = V.InnerText.GetXColor().ToNative();
                                            CE.ModifyBg(StateType.Normal, BColor);
                                            CE.ModifyBg(StateType.Active, BColor);
                                            CE.ModifyBg(StateType.Insensitive, BColor);
                                            CE.ModifyBg(StateType.Prelight, BColor);
                                            CE.ModifyBg(StateType.Selected, BColor);
                                        }
                                        else
                                        {
                                            CE.Visible       = false;
                                            CE.VisibleWindow = false;
                                        }
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "TextAlign":
                                        CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left));
                                        break;

                                    case "Size":
                                        CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    var TZJE = new Fixed();
                                }
                            }
                        }
                        else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox"))
                        {
                            if (C.InnerXml.IndexOf("\"Multiline\">True") > -1)
                            {
                                var CC = new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add(CC);
                                foreach (XmlNode V in C.ChildNodes)
                                {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                            case "Text":
                                            {
                                                if (V.InnerText.Contains("%"))
                                                {
                                                    CC.Text     = System.Environment.ExpandEnvironmentVariables(V.InnerText);
                                                    CC.Position = CC.Text.Length;
                                                }
                                                break;
                                            }

                                            case "Location":
                                                PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                                PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                                break;

                                            case "Size":
                                                CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                                break;

                                            case "Name":
                                                CC.Name = V.InnerText;
                                                break;

                                            case "Font":
                                                string VC = V.InnerText;
                                                UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                                string VCFName = UFont[0];
                                                float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                                float  Z       = (float)(VCSize * App.ScaleFactorY);
                                                CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                                System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString());
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                var CC = new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add(CC);
                                foreach (XmlNode V in C.ChildNodes)
                                {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                            case "Name":
                                                CC.Name = V.InnerText;
                                                break;

                                            case "Text":
                                            {
                                                if (V.InnerText.Contains("%"))
                                                {
                                                    CC.Text     = System.Environment.ExpandEnvironmentVariables(V.InnerText);
                                                    CC.Position = CC.Text.Length;
                                                }
                                                break;
                                            }

                                            case "Location":
                                                PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                                PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                                break;

                                            case "Size":
                                                CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                                break;

                                            case "PasswordChar":
                                                CC.InvisibleChar = '*';
                                                CC.Visibility    = false;
                                                break;

                                            case "Font":
                                                string VC = V.InnerText;
                                                UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                                string VCFName = UFont[0];
                                                float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                                float  Z       = (float)(VCSize * App.ScaleFactorY);
                                                CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                                System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString());
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.Panel"))
                        {
                            var CP = new Gtk.Fixed();
                            //CP.Clicked += HandleClick;
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP]));
                            Parent.Add(CP);
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes ["name"].Value)
                                    {
                                    case "Name":
                                        CP.Name = V.InnerText;
                                        break;

                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "ForeColor":

                                        CP.Children [0].ModifyFg(StateType.Normal, V.InnerText.GetXColor().ToNative());
                                        break;

                                    case "BackColor":
                                        CP.ModifyBg(StateType.Normal, V.InnerText.GetXColor().ToNative());
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "Size":
                                        CP.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        }
                        else
                        {
                            System.Diagnostics.Debug.WriteLine(C.Attributes ["type"].Value);
                        }
                    }
                }
            }
            Parent.ShowAll();
        }
        private HBox BuildLimitFooter()
        {
            HBox limitFooter = new HBox();
            limitFooter.Show();
            limitFooter.Spacing = 5;

            limitCheckBox = new CheckButton("Limit to");
            limitCheckBox.Show();
            limitCheckBox.Toggled += OnLimitCheckBoxToggled;
            limitFooter.PackStart(limitCheckBox, false, false, 0);

            limitEntry = new Entry("25");
            limitEntry.Show();
            limitEntry.SetSizeRequest(50, -1);
            limitFooter.PackStart(limitEntry, false, false, 0);

            limitComboBox = ComboBox.NewText();
            limitComboBox.Show();
            foreach(string criteria in model.LimitCriteria)
                limitComboBox.AppendText(criteria);
            limitComboBox.Active = 0;
            limitFooter.PackStart(limitComboBox, false, false, 0);

            Label orderLabel = new Label("selected by");
            orderLabel.Show();
            limitFooter.PackStart(orderLabel, false, false, 0);

            orderComboBox = ComboBox.NewText();
            orderComboBox.Show();
            foreach(string order in model.OrderCriteria)
                orderComboBox.AppendText(order);
            orderComboBox.Active = 0;
            limitFooter.PackStart(orderComboBox, false, false, 0);

            limitCheckBox.Active = false;
            OnLimitCheckBoxToggled(limitCheckBox, null);

            return limitFooter;
        }
예제 #12
0
        public static void FetchForm(Container Parent, XmlNode Nodes)
        {
            int cIndex = 0;
            string[] UFont;
            XmlNodeList original = Nodes.ChildNodes;
            XmlNodeList reverse = new ReverseXmlList(original);

            foreach (XmlNode C in reverse) {
                if (C.Name == "Object") {
                    cIndex++;
                    if (C.Attributes[0].Name == "type") {
                        if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button")) {
                            var PB = new Gtk.Button();
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB]));
                            Parent.Add(PB);
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes["name"].Value) {
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "Name":
                                            PB.Name = V.InnerText;
                                            break;
                                        case "ForeColor":
                                            var FColor = V.InnerText.GetXColor().ToNative();
                                            PB.Children[0].ModifyFg(StateType.Normal, FColor);
                                            PB.Children[0].ModifyFg(StateType.Active, FColor);
                                            PB.Children[0].ModifyFg(StateType.Prelight, FColor);
                                            PB.Children[0].ModifyFg(StateType.Selected, FColor);
                                            break;
                                        case "Caption":
                                        case "Text":
                                            PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")));
                                            break;
                                        case "BackColor":
                                            var BColor = V.InnerText.GetXColor().ToNative();
                                            PB.ModifyBg(StateType.Normal, BColor);
                                            PB.ModifyBg(StateType.Active, BColor);
                                            PB.ModifyBg(StateType.Insensitive, BColor);
                                            PB.ModifyBg(StateType.Prelight, BColor);
                                            PB.ModifyBg(StateType.Selected, BColor);
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "Size":
                                            PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            break;
                                        case "Font":
                                            string VC = V.InnerText;
                                            UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                            string VCFName = UFont[0];
                                            float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                            float Z = (float)(VCSize * App.ScaleFactorY);
                                            PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                            break;
                                        case "Image":
                                            if (V.HasChildNodes) {
                                                string IMGData = V.FirstChild.InnerText;
                                                byte[] B = System.Convert.FromBase64String(IMGData);
                                                Pixbuf P = new Pixbuf(B);
                                                P=P.ScaleSimple(PB.WidthRequest-10, PB.HeightRequest, InterpType.Bilinear);
                                                PB.Image = new Gtk.Image(P);
                                            }
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        } else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label")) {
                            var CE = new Gtk.EventBox();
                            CE.ResizeMode = ResizeMode.Parent;
                            var CC = new Gtk.Label();
                            CE.Add(CC);
                            Parent.Add(CE);
                            CC.LineWrapMode = Pango.WrapMode.Word;
                            CC.LineWrap = true;
                            CC.Wrap = true;
                            CC.Justify = Justification.Fill;
                            global::Gtk.Fixed.FixedChild PBC1;
                            if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild") {
                                var XVC = Parent[CE].Parent.Parent;
                                PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]);
                            } else {
                                PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE]));
                            }
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes["name"].Value) {
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "Name":
                                            CC.Name = V.InnerText;
                                            break;
                                        case "Font":
                                            string VC = V.InnerText;
                                            UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                            string VCFName = UFont[0];
                                            float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                            float Z = (float)(VCSize * App.ScaleFactorY);
                                            CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z));
                                            break;
                                        case "ForeColor":
                                            var FColor = V.InnerText.GetXColor().ToNative();
                                            CC.ModifyFg(StateType.Normal, FColor);
                                            CC.ModifyFg(StateType.Active, FColor);
                                            CC.ModifyFg(StateType.Insensitive, FColor);
                                            CC.ModifyFg(StateType.Prelight,FColor);
                                            CC.ModifyFg(StateType.Selected, FColor);
                                            CE.ModifyFg(StateType.Normal, FColor);
                                            CE.ModifyFg(StateType.Active, FColor);
                                            CE.ModifyFg(StateType.Insensitive, FColor);
                                            CE.ModifyFg(StateType.Prelight, FColor);
                                            CE.ModifyFg(StateType.Selected, FColor);
                                            CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>";
                                            break;
                                        case "Caption":
                                        case "Text":
                                            CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n"));
                                            break;
                                        case "BackColor":
                                            if (V.InnerText != "Transparent") {
                                                var BColor = V.InnerText.GetXColor().ToNative();
                                                CE.ModifyBg(StateType.Normal, BColor);
                                                CE.ModifyBg(StateType.Active, BColor);
                                                CE.ModifyBg(StateType.Insensitive, BColor);
                                                CE.ModifyBg(StateType.Prelight, BColor);
                                                CE.ModifyBg(StateType.Selected, BColor);
                                            } else {
                                                CE.Visible = false;
                                                CE.VisibleWindow = false;
                                            }
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "TextAlign":
                                            CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left));
                                            break;
                                        case "Size":
                                            CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    var TZJE = new Fixed();

                                }
                            }
                        } else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox")) {
                            if (C.InnerXml.IndexOf("\"Multiline\">True") > -1)
                            {
                                var CC = new Gtk.Entry ();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add (CC);
                                foreach (XmlNode V in C.ChildNodes) {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                                case "Text":
                                                    {
                                                        if (V.InnerText.Contains ("%")) {
                                                            CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText);
                                                            CC.Position = CC.Text.Length;
                                                        }
                                                        break;
                                                    }
                                                case "Location":
                                                    PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                                    PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                                    break;
                                                case "Size":
                                                    CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                                    break;
                                                case "Name":
                                                    CC.Name = V.InnerText;
                                                    break;
                                                case "Font":
                                                    string VC = V.InnerText;
                                                    UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                                    string VCFName = UFont[0];
                                                    float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                                    float Z = (float)(VCSize * App.ScaleFactorY);
                                                    CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString()));
                                                    System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString());
                                                    break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                var CC= new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add (CC);
                                foreach (XmlNode V in C.ChildNodes) {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                                case "Name":
                                                    CC.Name = V.InnerText;
                                                    break;
                                                case "Text":
                                                    {
                                                        if (V.InnerText.Contains ("%")) {
                                                            CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText);
                                                            CC.Position = CC.Text.Length;
                                                        }
                                                        break;
                                                    }
                                                case "Location":
                                                    PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                                    PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                                    break;
                                                case "Size":
                                                    CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                                    break;
                                                case "PasswordChar":
                                                    CC.InvisibleChar = '*';
                                                    CC.Visibility = false;
                                                    break;
                                                case "Font":
                                                    string VC = V.InnerText;
                                                    UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                                    string VCFName = UFont[0];
                                                    float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                                    float Z = (float)(VCSize * App.ScaleFactorY);
                                                    CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString()));
                                                    System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString());
                                                    break;
                                            }
                                        }
                                    }
                                }
                            }
                        } else if (C.Attributes ["type"].Value.StartsWith ("System.Windows.Forms.Panel")) {
                            var CP = new Gtk.Fixed ();
                            //CP.Clicked += HandleClick;
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP]));
                            Parent.Add (CP);
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes ["name"].Value) {
                                        case "Name":
                                            CP.Name = V.InnerText;
                                            break;
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "ForeColor":

                                            CP.Children [0].ModifyFg (StateType.Normal, V.InnerText.GetXColor ().ToNative ());
                                            break;
                                        case "BackColor":
                                            CP.ModifyBg (StateType.Normal, V.InnerText.GetXColor().ToNative ());
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "Size":
                                            CP.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        } else {
                            System.Diagnostics.Debug.WriteLine (C.Attributes ["type"].Value);

                        }
                    }
                }

            }
            Parent.ShowAll();
        }