public VideoView() { preview_pos = PreviewPos.ButtonRight; VBox vbox = new VBox(false, 0); vbox.Show(); Frame frame = new Frame(); //frame.BorderWidth = 5; frame.Show(); vbox.Add(frame); mainView = new Gtk.EventBox(); mainView.WidthRequest = 400; mainView.HeightRequest = 300; mainView.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(255, 255, 255)); mainView.ModifyBg(Gtk.StateType.Active, new Gdk.Color(255, 255, 255)); mainView.Show(); //this.WidthRequest = 333; // 500; //250; //this.HeightRequest = 250; // 375; //187; 250 preview = new Gtk.DrawingArea(); preview.WidthRequest = 120; // 75; //150; preview.HeightRequest = 90; // 56; //112; preview.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0)); preview.ModifyBg(Gtk.StateType.Active, new Gdk.Color(0, 0, 0)); preview.Show(); fix = new Gtk.Fixed(); fix.Put(preview, space, space); fix.Show(); mainView.Add(fix); frame.Add(mainView); // Label label = new Label(Catalog.GetString("Video Chat in progress...")); // label.Show(); // vbox.PackStart(label, false, true, 0); Button button = new Button(Catalog.GetString("End Call")); button.Clicked += OnCloseVideoClicked; button.Show(); vbox.PackStart(button, false, false, 5); this.Add(vbox); mainView.SizeAllocated += OnSizeAllocated; // this.SizeRequested += OnsizeRequested; this.QueueResize(); MovePreview(); }
public VideoView() { preview_pos = PreviewPos.ButtonRight; VBox vbox = new VBox(false, 0); vbox.Show(); Frame frame = new Frame(); //frame.BorderWidth = 5; frame.Show(); vbox.Add(frame); mainView = new Gtk.EventBox(); mainView.WidthRequest = 400; mainView.HeightRequest = 300; mainView.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255,255,255)); mainView.ModifyBg (Gtk.StateType.Active, new Gdk.Color (255,255,255)); mainView.Show(); //this.WidthRequest = 333; // 500; //250; //this.HeightRequest = 250; // 375; //187; 250 preview = new Gtk.DrawingArea (); preview.WidthRequest = 120; // 75; //150; preview.HeightRequest = 90; // 56; //112; preview.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0,0,0)); preview.ModifyBg (Gtk.StateType.Active, new Gdk.Color (0,0,0)); preview.Show(); fix = new Gtk.Fixed (); fix.Put (preview, space, space); fix.Show(); mainView.Add(fix); frame.Add(mainView); // Label label = new Label(Catalog.GetString("Video Chat in progress...")); // label.Show(); // vbox.PackStart(label, false, true, 0); Button button = new Button(Catalog.GetString("End Call")); button.Clicked += OnCloseVideoClicked; button.Show(); vbox.PackStart(button, false, false, 5); this.Add(vbox); mainView.SizeAllocated += OnSizeAllocated; // this.SizeRequested += OnsizeRequested; this.QueueResize (); MovePreview (); }
/// <summary> /// Shows the tracker. /// </summary> /// <param name="data">The data.</param> public void ShowTracker(TrackerHitResult data) { if (this.trackerLabel == null) { // Holding the tracker label inside an EventBox allows // us to set the background color Gtk.EventBox labelHolder = new Gtk.EventBox(); this.trackerLabel = new Gtk.Label(); this.trackerLabel.SetPadding(3, 3); OxyColor bgColor = OxyColors.LightSkyBlue; labelHolder.ModifyBg(StateType.Normal, new Gdk.Color(bgColor.R, bgColor.G, bgColor.B)); labelHolder.Add(this.trackerLabel); this.Add(labelHolder); labelHolder.ShowAll(); } this.trackerLabel.Parent.Visible = true; this.trackerLabel.Text = data.ToString(); Gtk.Requisition req = this.trackerLabel.Parent.SizeRequest(); int xPos = (int)data.Position.X - req.Width / 2; int yPos = (int)data.Position.Y - req.Height; xPos = Math.Max(0, Math.Min(xPos, this.Allocation.Width - req.Width)); yPos = Math.Max(0, Math.Min(yPos, this.Allocation.Height - req.Height)); this.Move(trackerLabel.Parent, xPos, yPos); }
public void ShowWord(string word) { imageCanvas.ModifyFg(Gtk.StateType.Normal, fontColor); eventBox.ModifyBg(Gtk.StateType.Normal, backgroundColor); imageCanvas.ModifyFont(Pango.FontDescription.FromString(fontName)); imageCanvas.Text = word; imageCanvas.UseMarkup = false; imageCanvas.CanFocus = false; imageCanvas.ShowAll(); }
protected virtual void UpdateBackgroundColor() { if (_disposed || Element == null || Control == null) { return; } Color backgroundColor = Element.BackgroundColor; bool isDefault = backgroundColor.IsDefaultOrTransparent(); if (!isDefault) { Container.ModifyBg(StateType.Normal, backgroundColor.ToGtkColor()); } Container.VisibleWindow = !isDefault; }
void UpdateResultInformLabel() { try { var entry = searchEntry.Entry; if (entry == null) { LoggingService.LogError("SearchAndReplaceWidget.UpdateResultInformLabel called with null entry."); return; } if (string.IsNullOrEmpty(SearchPattern)) { resultInformLabel.Text = ""; resultInformLabelEventBox.ModifyBg(StateType.Normal, entry.Style.Base(entry.State)); resultInformLabel.ModifyFg(StateType.Normal, entry.Style.Foreground(StateType.Insensitive)); return; } // bool error = result == null && !String.IsNullOrEmpty (SearchPattern); string errorMsg; bool valid = textEditor.SearchEngine.IsValidPattern(SearchAndReplaceOptions.SearchPattern, out errorMsg); // error |= !valid; if (!valid) { IdeApp.Workbench.StatusBar.ShowError(errorMsg); } else { IdeApp.Workbench.StatusBar.ShowReady(); } if (!valid || textEditor.TextViewMargin.SearchResultMatchCount == 0) { //resultInformLabel.Markup = "<span foreground=\"#000000\" background=\"" + MonoDevelop.Components.PangoCairoHelper.GetColorString (GotoLineNumberWidget.errorColor) + "\">" + GettextCatalog.GetString ("Not found") + "</span>"; resultInformLabel.Text = GettextCatalog.GetString("Not found"); resultInformLabel.ModifyFg(StateType.Normal, Ide.Gui.Styles.Editor.SearchErrorForegroundColor.ToGdkColor()); } else { int resultIndex = 0; int foundIndex = -1; int caretOffset = textEditor.Caret.Offset; ISegment foundSegment = TextSegment.Invalid; foreach (var searchResult in textEditor.TextViewMargin.SearchResults) { if (searchResult.Offset <= caretOffset && caretOffset <= searchResult.EndOffset) { foundIndex = resultIndex + 1; foundSegment = searchResult; break; } resultIndex++; } if (foundIndex != -1) { resultInformLabel.Text = String.Format(GettextCatalog.GetString("{0} of {1}"), foundIndex, textEditor.TextViewMargin.SearchResultMatchCount); } else { resultInformLabel.Text = String.Format(GettextCatalog.GetPluralString("{0} match", "{0} matches", textEditor.TextViewMargin.SearchResultMatchCount), textEditor.TextViewMargin.SearchResultMatchCount); } resultInformLabelEventBox.ModifyBg(StateType.Normal, entry.Style.Base(entry.State)); resultInformLabel.ModifyFg(StateType.Normal, entry.Style.Foreground(StateType.Insensitive)); textEditor.TextViewMargin.HideSelection = FocusChild == table; textEditor.TextViewMargin.MainSearchResult = foundSegment; } } catch (Exception ex) { LoggingService.LogError("Exception while updating result inform label.", ex); } }
void UpdateResultInformLabel() { if (string.IsNullOrEmpty(SearchPattern)) { resultInformLabel.Text = ""; resultInformLabelEventBox.ModifyBg(StateType.Normal, searchEntry.Entry.Style.Base(searchEntry.Entry.State)); resultInformLabel.ModifyFg(StateType.Normal, searchEntry.Entry.Style.Foreground(StateType.Insensitive)); return; } // bool error = result == null && !String.IsNullOrEmpty (SearchPattern); string errorMsg; bool valid = widget.TextEditor.SearchEngine.IsValidPattern(searchPattern, out errorMsg); // error |= !valid; if (!valid) { IdeApp.Workbench.StatusBar.ShowError(errorMsg); } else { IdeApp.Workbench.StatusBar.ShowReady(); } if (!valid || widget.TextEditor.TextViewMargin.SearchResultMatchCount == 0) { //resultInformLabel.Markup = "<span foreground=\"#000000\" background=\"" + MonoDevelop.Components.PangoCairoHelper.GetColorString (GotoLineNumberWidget.errorColor) + "\">" + GettextCatalog.GetString ("Not found") + "</span>"; resultInformLabel.Text = GettextCatalog.GetString("Not found"); resultInformLabelEventBox.ModifyBg(StateType.Normal, GotoLineNumberWidget.errorColor); resultInformLabel.ModifyFg(StateType.Normal, searchEntry.Entry.Style.Foreground(StateType.Normal)); } else { int resultIndex = 0; int foundIndex = -1; int caretOffset = widget.TextEditor.Caret.Offset; ISegment foundSegment = null; foreach (ISegment searchResult in widget.TextEditor.TextViewMargin.SearchResults) { if (searchResult.Offset <= caretOffset && caretOffset <= searchResult.EndOffset) { foundIndex = resultIndex + 1; foundSegment = searchResult; break; } resultIndex++; } if (foundIndex != -1) { resultInformLabel.Text = String.Format(GettextCatalog.GetString("{0} of {1}"), foundIndex, widget.TextEditor.TextViewMargin.SearchResultMatchCount); } else { resultInformLabel.Text = String.Format(GettextCatalog.GetPluralString("{0} match", "{0} matches", widget.TextEditor.TextViewMargin.SearchResultMatchCount), widget.TextEditor.TextViewMargin.SearchResultMatchCount); } resultInformLabelEventBox.ModifyBg(StateType.Normal, searchEntry.Entry.Style.Base(searchEntry.Entry.State)); resultInformLabel.ModifyFg(StateType.Normal, searchEntry.Entry.Style.Foreground(StateType.Insensitive)); widget.TextEditor.TextViewMargin.HideSelection = FocusChild == this.table; widget.TextEditor.TextViewMargin.MainSearchResult = foundSegment; } }
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(); }
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(); }