public void InitializeComponent() { ResourceService resourceService = (ResourceService)ServiceManager.GetService(typeof(ResourceService)); this.fixedcontainer = new Gtk.Fixed(); this.continueButton = new Gtk.Button(); this.ignoreButton = new Gtk.Button(); this.abortButton = new Gtk.Button(); this.copyErrorCheckButton = new Gtk.CheckButton(); this.includeSysInfoCheckButton = new Gtk.CheckButton(); this.label = new Gtk.Label(); this.scrolledwindow = new Gtk.ScrolledWindow(); this.exceptionTextView = new Gtk.TextView(); try { this.image = new Gtk.Image(resourceService.GetBitmap("ErrorReport")); } catch (NullReferenceException ex) { this.image = new Gtk.Image(); this.image.SetFromStock("gtk-dialog-error", Gtk.IconSize.Dialog); } this.SuspendLayout(); // // continueButton // this.continueButton.Label = "Continue"; this.continueButton.SetSizeRequest (112, 40); this.continueButton.Clicked += new System.EventHandler(this.ContinueButton_Clicked); // // abortButton // this.abortButton.Label = "Abort"; this.abortButton.SetSizeRequest (112, 40); this.abortButton.Clicked += new System.EventHandler(this.AbortButton_Clicked); // // ignoreButton // this.ignoreButton.Label = "Ignore"; this.ignoreButton.SetSizeRequest (112, 40); this.ignoreButton.Clicked += new System.EventHandler(this.IgnoreButton_Clicked); // // copyErrorCheckButton // this.copyErrorCheckButton.Label = "Copy error to clipboard"; this.copyErrorCheckButton.SetSizeRequest (672, 24); // // includeSysInfoCheckButton // this.includeSysInfoCheckButton.Label = "Include system info (Mono version, O.S. version)"; this.copyErrorCheckButton.SetSizeRequest (672, 24); // // label // this.label.LineWrap = true; this.label.Text = "An error has ocurred." + System.Environment.NewLine + "This may be due to a programming error." + System.Environment.NewLine + "Please, help us to make MonoDevelop a better program for everyone." + System.Environment.NewLine + "Thanks in advance for your help."; this.label.SetSizeRequest (480, 88); // // scrolledwindow // this.scrolledwindow.HscrollbarPolicy = Gtk.PolicyType.Automatic; this.scrolledwindow.VscrollbarPolicy = Gtk.PolicyType.Automatic; this.scrolledwindow.AddWithViewport(this.exceptionTextView); this.scrolledwindow.SetSizeRequest (480, 256); // // exceptionTextView // this.exceptionTextView.Editable = false; // // image // this.image.SetSizeRequest (226, 466); // // fixedcontainer // this.fixedcontainer.SetSizeRequest (740, 483); this.fixedcontainer.Put(continueButton, 624, 432); this.fixedcontainer.Put(abortButton, 368, 432); this.fixedcontainer.Put(ignoreButton, 496, 432); this.fixedcontainer.Put(copyErrorCheckButton, 256, 360); this.fixedcontainer.Put(includeSysInfoCheckButton, 256, 392); this.fixedcontainer.Put(label, 256, 8); this.fixedcontainer.Put(scrolledwindow, 256, 96); this.fixedcontainer.Put(image, 8, 8); // // this // this.Resizable = false; this.WindowPosition = Gtk.WindowPosition.Center; this.Add(fixedcontainer); }
public MainWindow_Event() : base("") { SetDefaultSize(250, 200); SetPosition(WindowPosition.Center); DeleteEvent += delegate { Application.Quit(); }; Fixed fix = new Fixed(); Button btn = new Button("Enter"); btn.EnterNotifyEvent += OnEnter; _quit = new Button("Quit"); //_quit.Clicked += OnClick; _quit.SetSizeRequest(80, 35); CheckButton cb = new CheckButton("connect"); cb.Toggled += OnToggled; fix.Put(btn, 50, 20); fix.Put(_quit, 50, 50); fix.Put(cb, 120, 20); Add(fix); ShowAll(); }
// Constructor. It builds our application. It also calls its parent constructor through the base() keyword. public GUI_Proof() : base("Example GTK# App"){ // Sets a default size for our window. this.SetDefaultSize(700, 500); // Centers the window on the screen. this.SetPosition(WindowPosition.Center); // Sets an icon from the current directory //SetIconFromFile("web.png"); // WIDGETS------------------------------------------ // Containers Fixed fix = new Fixed(); // Labels result.Text = "Pick a datatype"; // ComboBox ComboBox cb = new ComboBox(dataTypes); // WIDGET's SETTINGS-------------------------------- fix.Put(cb, 50, 30); fix.Put(result, 200, 30); // ADDS--------------------------------------------- fix.Add(cb); fix.Add(result); this.Add(fix); // EVENT's ATTACH /* We plug a delegate to the DeleteEvent. This event is triggered, * when we click on the close button in the titlebar. Or press Alt+F4. * Our delegate quits the application for good. */ //DeleteEvent += delegate { Application.Quit(); }; /* This is another way, how we can plug an event handler to an event. * It is just a bit more verbose. */ this.DeleteEvent += new DeleteEventHandler(OnDelete); cb.Changed += OnChanged; // Now we show the window. The window is not visible, until we call the Show() method. //Show(); // This will work for all widgets and panels in the application this.ShowAll(); }
public SharpApp() : base("Center") { SetDefaultSize(250, 200); SetPosition(WindowPosition.Center); DeleteEvent += delegate { Application.Quit(); }; Fixed fix = new Fixed(); Button btn1 = new Button("Button"); btn1.Sensitive = false; Button btn2 = new Button("Button"); Button btn3 = new Button(Stock.Close); Button btn4 = new Button("Button"); btn4.SetSizeRequest(80,40); fix.Put(btn1, 20, 30); fix.Put(btn2, 100, 30); fix.Put(btn3, 20, 80); fix.Put(btn4, 100, 80); Add(fix); ShowAll(); }
public void Init() { try{ var fxd = new Fixed(); _window.Add(fxd); _wbkt = new WebView(); fxd.Add(_wbkt); //init window this.SetSizeRequest(_window_width, _window_height); _window.AllowShrink = false; _window.Resizable = false; _window.SetPosition(WindowPosition.CenterAlways); //subscribe on events _window.DeleteEvent += OnDelete; _wbkt.LoadFinished += OnWindowLoaded; //webkit init _wbkt.Open(string.Format (URL, this._app_id, _scope, _display, _api_veresion)); } catch(Exception ex) { this.throwError(22, "Error while window initialization: " + ex.Message); } }
public MainWindow_Widget() : base("You know I'm no good") { SetDefaultSize(800, 600); BorderWidth = 8; SetPosition(WindowPosition.Center); // Title Title = "Widget Test"; // Label DeleteEvent += delegate { Application.Quit(); }; Fixed fix = new Fixed(); ComboBox combo = new ComboBox(distros); combo.Changed += OnChanged; lyrics = new Label(text); fix.Put(combo, 50, 30); fix.Put(lyrics, 50, 150); Add(fix); ShowAll(); }
public NotifyMessage(int x, int y, int width, int height) { // Setup Window SetDefaultSize(width, height); Move(x, y); // Setup Image string fileName = System.IO.Path.GetTempFileName(); NotifyArea area = new NotifyArea(x, y, width, height); area.Save(fileName); Setup(fileName); File.Delete(fileName); // Setup Fixed this.fixBox = new Gtk.Fixed(); this.Add(this.fixBox); buttonClose = new Gtk.Button(new Gtk.Image(Gtk.Stock.Close, Gtk.IconSize.Menu)); buttonClose.Clicked += new EventHandler(OnButtonClose); buttonClose.Relief = Gtk.ReliefStyle.None; this.fixBox.Put(buttonClose, 5, 20); labelTitle = new Gtk.Label("<span size='x-large'><b>Prova</b></span>"); labelTitle.UseMarkup = true; this.fixBox.Put(labelTitle, 40, 20); }
public MainWindow_Widget2() : base("Widget2") { SetDefaultSize(800, 600); SetPosition(WindowPosition.Center); BorderWidth = 7; DeleteEvent += delegate { Application.Quit(); }; _label = new Label("..."); Entry entry = new Entry(); entry.Changed += OnChangedEntry; // scale and image HScale scale = new HScale(0, 100, 1); { scale.SetSizeRequest(160, 35); scale.ValueChanged += OnChangeScale; LoadImage(); _image = new Image(img1); } // Color ToggleButton red = new ToggleButton("red"); { red.SetSizeRequest(80, 35); red.Clicked += OnRed; _area = new DrawingArea(); _area.SetSizeRequest(150, 150); } Calendar calendar = new Calendar(); { calendar.DaySelected += OnDaySelected; } Fixed fix = new Fixed(); fix.Put(entry, 60, 100); fix.Put(_label, 60, 40); fix.Put(scale, 60, 200); fix.Put(_image, 10, 240); fix.Put(red, 300, 250); fix.Put(_area, 300, 500); fix.Put(calendar, 500, 300); Add(fix); ShowAll(); }
private void AddWindowContent() { _container = new Fixed (); Button addGameButton = new Button (); addGameButton.Label = "Add Games"; addGameButton.Clicked += OnAddGameClicked; _tempGameListLabel = new Label(); _tempGameListLabel.Text = "Games will show here once added"; _container.Put(_tempGameListLabel, 20, 50); _container.Put (addGameButton, 20, 20); Add(_container); }
public override void DefaultPlace(object target, int x, int y, int w, int h) { Gtk.Widget wi = target as Gtk.Widget; if (wi == null) { return; } Gtk.Fixed fix = wi.Parent as Gtk.Fixed; if (fix != null) { fix.Move(wi, x, y); wi.SetSizeRequest(w, h); } }
public MainWindow() : base("Icon") { SetDefaultSize(250, 160); SetPosition(WindowPosition.Center); //DeleteEvent += new DeleteEventHandler(OnDeleteEvent); DeleteEvent += delegate { Application.Quit(); }; ModifyBg(StateType.Normal, new Gdk.Color(40, 40, 40)); try { _image1 = new Gdk.Pixbuf("evolution.png"); } catch (Exception ex) { // MessageDialog box = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.Ok, ex.Data.ToString()); box.Show(); } Image img1 = new Image(_image1); Fixed fix = new Fixed(); // Button btn1 = new Button("Button1"); // btn1.Sensitive = false; // Button btn2 = new Button("Button2"); // Button btn3 = new Button(Stock.Close); // Button btn4 = new Button(); // btn4.SetSizeRequest(80, 40); fix.Put(img1, 0, 0); // fix.Put(btn1, 20, 30); // fix.Put(btn2, 100, 30); // fix.Put(btn3, 20, 80); // fix.Put(btn4, 100, 80); Add(fix); ShowAll(); }
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); }
private void AddGameToMenu() { //Initialize widgets _launchButton = new Button(); _launchButton.Label = "Play"; _updateButton = new Button (); _updateButton.Label = "Update"; _titleLabel = new Label (_game.Title); _infoLabel = new Label (" "); _fix = new Fixed (); _fix.Add (_launchButton); _fix.Add (_updateButton); _fix.Add (_titleLabel); _fix.Add (_infoLabel); 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 MainWindow_Pango() : base("pango + unicode + font") { SetPosition(WindowPosition.Center); DeleteEvent += delegate { Application.Quit(); }; ScrolledWindow sw = new ScrolledWindow(); sw.ShadowType = ShadowType.EtchedIn; sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); Context context = this.CreatePangoContext(); _fonts = context.Families; _store = CreateModel(); TreeView view = new TreeView(); view.RulesHint = true; sw.Add(view); CreateColumn(view); string text = @"하늘과 바람과 별과 시 - 윤동주\n1821 года в Москве.Был вторым из 7 детей. Отец, Михаил Андреевич"; _label = new Label(text); Pango.FontDescription fontDesc = Pango.FontDescription.FromString("SignPainter 20"); _label.ModifyFont(fontDesc); Fixed fix = new Fixed(); fix.Put(_label, 5, 5); Add(fix); //Add(sw); ShowAll(); }
public MainClass() : base("Buttons") { sPort.PortName = "/dev/ttyACM0"; sPort.BaudRate = 9600; sPort.Open (); SetDefaultSize (250, 300); SetPosition (WindowPosition.Center); DeleteEvent += delegate{ Application.Quit (); }; Fixed fix = new Fixed (); Button green = new Button ("Green"); green.Name = ("Green"); green.SetSizeRequest(50,30); Button red = new Button ("Red"); red.Name = ("Red"); red.SetSizeRequest(50,30); Button yellow = new Button ("Yellow"); yellow.Name = ("Yellow"); yellow.SetSizeRequest(50,30); green.Clicked += new EventHandler (OnClick); red.Clicked += new EventHandler (OnClick); yellow.Clicked += new EventHandler (OnClick); fix.Put(green,20,30); fix.Put (red, 80, 30); fix.Put (yellow, 140, 30); Add (fix); ShowAll (); }
// constructor public TileWidget(string colorBg, string figure, string color, coord size) { string imgName; if (color != "" && figure != "" && figure.ToLower () != "empty") { if (figure.ToLower () != "knight") { imgName = color.ToLower () [0].ToString () + figure.ToUpper () [0].ToString (); } else { imgName = color.ToLower () [0].ToString () + "N"; } Image img = loadSvg (imgName, size); Fixed f = new Fixed (); f.Add (img); f.ShowAll (); this.Add (f); this.Show (); } if (colorBg != "") { Gdk.Color col = new Gdk.Color (); Gdk.Color.Parse (colorBg, ref col); this.ModifyBg (StateType.Normal, col); } this.figure = figure; this.color = color; }
public static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Need socket id and file-name as an argument."); return; } uint socket_id = UInt32.Parse(args[0]); string filename=args[1]; Console.WriteLine("filename="+filename); Console.WriteLine("using socket "+socket_id); // Glib.Thread.Init(); Gdk.Threads.Init(); Application.Init(); Gdk.Threads.Enter(); try { Plug plug= new Plug(socket_id); Fixed fixed1 = new Fixed(); fixed1.Put(new Label("File: \""+filename+"\""), 10, 10); fixed1.Put(new Entry("HELLO"), 10, 50); fixed1.Put(new Entry("World"), 10, 100); fixed1.ShowAll(); plug.Add(fixed1); plug.ShowAll(); Console.WriteLine("app is running.."); Application.Run(); } finally { Gdk.Threads.Leave(); } Console.WriteLine("Done!"); }
internal Panel() { _frame = new Gtk.Fixed(); }
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; }
public UICommandElement(Gtk.Fixed parent, GameConfigButtonDescriptor commandDescriptor) { _parent = parent; _commandDescriptor = commandDescriptor; }
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 void test(Fixed _fixed) { double[] a = {0, 200, 140, 14, 240, 320, 150, 80, 170, 90}; //Теперь можно нарисовать соответствующую линию и задать ей название в легенде LinePlot lp = new LinePlot(); lp.DataSource = a; lp.Label = "My Label"; //По умолчанию линия черная и тонкая. Это можно изменить предварительно созданным объектом System.Drawing.Pen lp.Pen = new Pen(new SolidBrush(System.Drawing.Color.Black)); //Для лучшего вида на график наносится сетка Grid myGrid = new Grid(); //По неясной причине, Vertical обозначает горизонтальные линии, которые будут видимы в данном случае myGrid.VerticalGridType = Grid.GridType.Fine; //а Horizontal — вертикальные линии сетки, которые будут убраны myGrid.HorizontalGridType = Grid.GridType.None; NPlot.Gtk.PlotSurface2D plot = new NPlot.Gtk.PlotSurface2D(); //И очистить его от лишнего содержимого, если имеется plot.Clear(); //Можно установить заголовок plot.Title = "Title"; //Добавить рамочку с легендой графика plot.Legend = new Legend(); //переместить ее вправо-вниз plot.Legend.AttachTo(NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Right); //отодвинуть от оси, чтобы не перекрывать числа plot.Legend.YOffset = 16; //и вынести за плоскость графика plot.Legend.HorizontalEdgePlacement = Legend.Placement.Outside; plot.Legend.VerticalEdgePlacement = Legend.Placement.Inside; //Расширим пространство вокруг плоскости графика plot.Padding = 40; //Чтобы линии выглядели не так убого, стоит их сгладить plot.SmoothingMode=System.Drawing.Drawing2D.SmoothingMode.AntiAlias; //Осталось добавить все элементы на график plot.Add(myGrid); plot.Add(lp); //Если график финансовый, то надо это четко обозначить, подписав ось plot.YAxis1.Label = "Money"; //и сделав нормальное отображение чисел на оси (по умолчанию — экспоненциальный вид) plot.YAxis1.NumberFormat = "{0:n}"; //Последний шаг plot.Refresh(); plot.Show(); _fixed.Put(plot, 0, 120); }
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 void SetupWindow() { this.background_window = new Window("Sticky"); this.background_window.ModifyBg( StateType.Normal, new Gdk.Color (0, 0, 0) ); this.background_window.Decorated = false; this.background_window.Opacity = 0.6; this.background_window.Maximize(); // Fullscreen() later this.background_window.DeleteEvent += new DeleteEventHandler (Window_Delete); this.background_window.KeyReleaseEvent += new KeyReleaseEventHandler(check_shortcuts); this.note_windows = new GLib.List (typeof (NoteWindow)); this.add_eventbox = new EventBox(); this.add_eventbox.Add(new Gtk.Image("./note-add.png")); this.add_eventbox.VisibleWindow = false; this.add_eventbox.ButtonPressEvent += new ButtonPressEventHandler (AddNote); //this.add_eventbox.EnterNotifyEvent += new EnterNotifyEventHandler (AddNote); this.grid = new Fixed(); this.grid.Put(add_eventbox, 10, 10); this.background_window.Add(this.grid); }
private void AllowStaticAccess() { _tvShareBrowser = this.tvShareBrowser; _tvPlaylist = this.tvPlaylist; _cbShareType = this.cbShareType; _hsVolume = this.hsVolume; _hsProgress = this.hsProgress; _tbMute = this.tbMute; _bPrevious = this.bPrevious; _tbPlay = this.tbPlay; _tbStop = this.tbStop; _bNext = this.bNext; _imgNowPlaying = this.imgNowPlaying; _imgLoading = this.imgLoading; _fixedNowPlaying= this.fixedNowPlaying; _lArtist = this.lArtist; _lSong = this.lSong; _lAlbum = this.lAlbum; _lGenre = this.lGenre; _lProgress = this.lProgress; _lDuration = this.lDuration; _lYear = this.lYear; _nbDataContainer= this.nbDataContainer; }
public MainView(Personne man) : base(Gtk.WindowType.Toplevel) { employe.id = man.id; employe.prenom = man.prenom; employe.nom = man.nom; employe.login = man.login; employe.password = man.password; employe.idPoste = man.idPoste; this.Build (); // affiche le nom et prénom de la personne connecté dans la Status bar labelSessionPersonne.Text = man.prenom + " " + man.nom; labelDateDuJour.Text = DateTime.Now.ToString ("dd/MM/yyyy"); List<Operation> operations = ConnectionBdd.getOperationsFromIdPoste (man.idPoste); foreach (Operation operation in operations) { action = new Gtk.Button (); actions.Add (action); Label labelOperation = new Label (); NodeView nodeViewOperation = new NodeView (); VBox vbox54 = new VBox (); HBox hbox54 = new HBox (); Fixed boucheTrou = new Fixed (); nodeViewOperation.AppendColumn ("Date et Heure", new Gtk.CellRendererText (), "text", 0); nodeViewOperation.AppendColumn ("Numero Traçabilité", new Gtk.CellRendererText (), "text", 1); nodeViewOperation.AppendColumn ("Prenom", new Gtk.CellRendererText (), "text", 2); nodeViewOperation.AppendColumn ("Nom", new Gtk.CellRendererText (), "text", 3); nodeViewOperation.AppendColumn ("Dernière Operation", new Gtk.CellRendererText (), "text", 4); nodeViewOperation.AppendColumn ("Numero Fiche", new Gtk.CellRendererText (), "text", 5); nodeViewOperation.AppendColumn ("Numero Operation", new Gtk.CellRendererText (), "text", 6); nodeViewOperation.NodeStore = ConnectionBdd.getFicheNodeStoreFromIdOperation (operation.id); labelOperation.Name = operation.libelleOperation; labelOperation.LabelProp = operation.libelleOperation.ToUpper (); notebookOperation.Add (vbox54); notebookOperation.SetTabLabel (vbox54, labelOperation); action.Label = operation.libelleAction; action.Name = operation.id.ToString (); action.Sensitive = false; if (operation.ordre == 1) { vbox54.Add (hbox54); hbox54.Add (action); Box.BoxChild v1 = (Box.BoxChild)vbox54 [hbox54]; v1.Fill = false; Box.BoxChild h1 = (Box.BoxChild)hbox54 [action]; h1.Fill = false; action.WidthRequest = 200; action.HeightRequest = 80; } else { vbox54.Add (nodeViewOperation); vbox54.Add (hbox54); hbox54.Add (boucheTrou); hbox54.Add (action); Box.BoxChild v2 = (Box.BoxChild)vbox54 [hbox54]; v2.Expand = false; v2.Padding = 5; Box.BoxChild h1 = (Box.BoxChild)hbox54 [boucheTrou]; h1.Position = 0; Box.BoxChild h2 = (Box.BoxChild)hbox54 [action]; h2.Position = 1; h2.Expand = false; } action.Clicked += delegate (object sender, EventArgs e) { Button btn = (Gtk.Button)sender; FicheView ficheView = new FicheView (ConnectionBdd.getOperation (btn.Name)); ficheView.ShowAll (); ficheView.init (); }; nodeViewOperation.NodeSelection.Changed += nodeSelectedChange; } }
public void InitializeGui() { m_MainPanel = new Fixed(); m_OutConnectionStatus = new Label("Jaco is not connected."); m_GeneralPanel = new Fixed(); m_TxtSerial = new Label("Jaco serial # :"); m_TxtModel = new Label("Jaco model :"); m_TxtSoftwareVersion = new Label("Software version :"); m_TxtClientID = new Label("Client ID :"); m_TxtClientName = new Label("Client name :"); m_TxtClientOrganization = new Label("Client organization :"); m_OutSerial = new Label("????"); m_OutModel = new Label("????"); m_OutSoftwareVersion = new Label("????"); m_InClientID = new Entry(""); m_InClientName = new Entry(""); m_InClientOrganization = new Entry(""); m_BTNUpdateGeneral = new Button("Update Jaco"); m_BTNUpdateGeneral.Clicked += new EventHandler(BTN_UpdateClick); m_BTNReadGeneral = new Button("Read from Jaco"); m_BTNReadGeneral.Clicked += new EventHandler (BTN_ReadClick); m_ConfigurationPanel = new Fixed(); m_TxtSensitivity = new Label("Control's sensitivity :"); m_TxtMaxSpeed = new Label("Permitted max speed :"); m_TxtDrinkingHeight = new Label("Drinking height :"); m_TxtDrinkingDistance = new Label("Drinking distance :"); m_TxtLaterality = new Label("Laterality :"); m_TxtFingersInverted = new Label("Fingers inverted :"); m_TxtRetractAngle = new Label("Retracted position angle :"); m_InSensitivity = new Entry(""); m_InMaxSpeed = new Entry(""); m_InDrinkingHeight = new Entry(""); m_InDrinkingDistance = new Entry(""); m_RadioRightHanded = new RadioButton("Righthanded"); m_RadioLeftHanded = new RadioButton("Lefthanded"); m_RadioLeftHanded.Group = m_RadioRightHanded.Group; m_CheckFingersInverted = new CheckButton("Invert fingers"); m_InRetractAngle = new Entry(""); m_BTNUpdateConfig = new Button("Update Jaco"); m_BTNUpdateConfig.Clicked += new EventHandler(BTN_UpdateClick); m_BTNReadConfig = new Button("Read from Jaco"); m_BTNReadConfig.Clicked += new EventHandler(BTN_ReadClick); m_DiagnosisPanel = new Fixed(); m_TxtAxis1Version = new Label("Axis 1 version :"); m_TxtAxis2Version = new Label("Axis 2 version :"); m_TxtAxis3Version = new Label("Axis 3 version :"); m_TxtAxis4Version = new Label("Axis 4 version :"); m_TxtAxis5Version = new Label("Axis 5 version :"); m_TxtAxis6Version = new Label("Axis 6 version :"); m_TxtFinger1Version = new Label("Finger 1 version :"); m_TxtFinger2Version = new Label("Finger 2 version :"); m_TxtFinger3Version = new Label("Finger 3 version :"); m_TxtMainCANVersion = new Label("Main CAN version :"); m_TxtExtCANVersion = new Label("Ext CAN Version :"); m_OutAxis1Version = new Label("????"); m_OutAxis2Version = new Label("????"); m_OutAxis3Version = new Label("????"); m_OutAxis4Version = new Label("????"); m_OutAxis5Version = new Label("????"); m_OutAxis6Version = new Label("????"); m_OutFinger1Version = new Label("????"); m_OutFinger2Version = new Label("????"); m_OutFinger3Version = new Label("????"); m_OutMainCANVersion = new Label("????"); m_OutExtCANVersion = new Label("????"); m_TxtInfo = new Label(""); m_InFileReprogram = new FileChooserButton("Select a file", FileChooserAction.Open); m_InFileReprogram.WidthRequest = 440; m_BTNReprogram = new Button("Reprogram Jaco"); m_BTNReprogram.Clicked += new EventHandler(BTN_ReprogramClick); m_BTNReadDiagnosis = new Button("Read from Jaco"); m_BTNReadDiagnosis.Clicked += new EventHandler(BTN_ReadClick); m_MainTitle = new Label("Kinova software example"); Pango.FontDescription fontMaintTile = Pango.FontDescription.FromString("Garamond 30"); m_MainTitle.ModifyFont(fontMaintTile); m_TabGeneral = new Label("General"); m_TabConfiguration = new Label("Configuration"); m_TabDiagnosis = new Label("Diagnosis"); m_MainTab = new Notebook(); m_MainTab.WidthRequest = 500; m_MainTab.HeightRequest = 500; m_MainTab.AppendPage(m_GeneralPanel, m_TabGeneral); m_MainTab.AppendPage(m_ConfigurationPanel, m_TabConfiguration); m_MainTab.AppendPage(m_DiagnosisPanel, m_TabDiagnosis); }
/// <summary> /// The set up buttons. /// </summary> private void SetUpButtons() { var x = 5; var y = 5; this._fixedContainer = new Fixed(); this._weatherButton = new CWeatherButton(0, 300); this._watchButton = new CWatchButton(0, 375); IRemoteDevice[] devs = CommLayerManager.Instance.GetAllDevices(DeviceAuthorizedEnum.Authorized).ToArray(); foreach (IRemoteDevice dev in devs) { var p1 = new CThemperatureButton(x, y, dev); var e1 = new EventBox(); e1.VisibleWindow = false; e1.Add(p1); e1.AddEvents((int)( EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.KeyPressMask | EventMask.PointerMotionMask)); e1.ButtonPressEvent += HandleButtonPressEvent; _fixedContainer.Put(e1, x, y); x += p1.WidthRequest + 5; } _fixedContainer.Add(this._weatherButton); _fixedContainer.Add(this._watchButton); //var chart = new CChart(0, 120); //chart.Show(); //_fixedContainer.Add(chart); //test(_fixedContainer); this.Add(_fixedContainer); }
public UICommandExposedArgument(Gtk.Fixed parent, GameConfigButtonDescriptor commandDescriptor) : base(parent, commandDescriptor) { }
public void Start() { window = new Window(WindowType.Toplevel); window.Move(10, 60); window.Resize(230, 700); window.Title = "Toolbar"; window.Deletable = false; window.ModifyBg(StateType.Normal, new Gdk.Color(182, 195, 205)); Fixed fix = new Fixed(); openButton = new Button(); openButton.Label = "Open Images"; openButton.SetSizeRequest(100, 30); openButton.TooltipText = "Shortcut: " + keymap["open images"].ToString(); openButton.Name = "open images"; openButton.Clicked += OperatorButtonClicked; saveButton = new Button(); saveButton.Label = "Save Collage"; saveButton.SetSizeRequest(100, 30); saveButton.TooltipText = "Shortcut: " + keymap["save collage"].ToString(); saveButton.Name = "save collage"; saveButton.Clicked += OperatorButtonClicked; deleteButton = new Button(); deleteButton.Label = "Delete"; deleteButton.SetSizeRequest(100, 30); deleteButton.TooltipText = "Shortcut: " + keymap["delete images"].ToString(); deleteButton.Name = "delete images"; deleteButton.Clicked += OperatorButtonClicked; changeAspectRatioButton = new Button(); changeAspectRatioButton.Label = "Aspect Ratio"; changeAspectRatioButton.SetSizeRequest(100, 30); changeAspectRatioButton.TooltipText = "Shortcut: " + keymap["change aspect ratio"].ToString(); changeAspectRatioButton.Name = "change aspect ratio"; changeAspectRatioButton.Clicked += OperatorButtonClicked; autoPositionButton = new Button(); autoPositionButton.Label = "Auto Position"; autoPositionButton.SetSizeRequest(100, 30); autoPositionButton.TooltipText = "Shortcut: " + keymap["auto position"].ToString(); autoPositionButton.Name = "auto position"; autoPositionButton.Clicked += OperatorButtonClicked; changeBackgroundColorButton = new Button(); changeBackgroundColorButton.Label = "Background"; changeBackgroundColorButton.SetSizeRequest(100, 30); changeBackgroundColorButton.TooltipText = "Shortcut: " + keymap["change background color"].ToString(); changeBackgroundColorButton.Name = "change background color"; changeBackgroundColorButton.Clicked += OperatorButtonClicked; setBackwardButton = new Button(); setBackwardButton.Label = "Set Backward"; setBackwardButton.SetSizeRequest(100, 30); setBackwardButton.TooltipText = "Shortcut: " + keymap["set backward"].ToString(); setBackwardButton.Name = "set backward"; setBackwardButton.Clicked += OperatorButtonClicked; setForwardButton = new Button(); setForwardButton.Label = "Set Forward"; setForwardButton.SetSizeRequest(100, 30); setForwardButton.TooltipText = "Shortcut: " + keymap["set forward"].ToString(); setForwardButton.Name = "set forward"; setForwardButton.Clicked += OperatorButtonClicked; setAsBackgroundButton = new Button(); setAsBackgroundButton.Label = "Set Background"; setAsBackgroundButton.SetSizeRequest(100, 30); setAsBackgroundButton.TooltipText = "Shortcut: " + keymap["set as background"].ToString(); setAsBackgroundButton.Name = "set as background"; setAsBackgroundButton.Clicked += OperatorButtonClicked; setToFrontButton = new Button(); setToFrontButton.Label = "Set to Front"; setToFrontButton.SetSizeRequest(100, 30); setToFrontButton.TooltipText = "Shortcut: " + keymap["set to front"].ToString(); setToFrontButton.Name = "set to front"; setToFrontButton.Clicked += OperatorButtonClicked; clearButton = new Button(); clearButton.Label = "Clear Collage"; clearButton.SetSizeRequest(100, 30); clearButton.TooltipText = "Shortcut: " + keymap["clear collage"].ToString(); clearButton.Name = "clear collage"; clearButton.Clicked += OperatorButtonClicked; selectAllButton = new Button(); selectAllButton.Label = "Select All"; selectAllButton.SetSizeRequest(100, 30); selectAllButton.TooltipText = "Shortcut: " + keymap["select all"].ToString(); selectAllButton.Name = "select all"; selectAllButton.Clicked += OperatorButtonClicked; undoButton = new Button(); undoButton.Label = "Undo"; undoButton.SetSizeRequest(100, 30); undoButton.TooltipText = "Shortcut: " + keymap["undo"].ToString(); undoButton.Name = "undo"; undoButton.Clicked += OperatorButtonClicked; redoButton = new Button(); redoButton.Label = "Redo"; redoButton.SetSizeRequest(100, 30); redoButton.TooltipText = "Shortcut: " + keymap["redo"].ToString(); redoButton.Name = "redo"; redoButton.Clicked += OperatorButtonClicked; stayOnTopCheckbutton = new CheckButton(); stayOnTopCheckbutton.Label = "Stay on Top"; stayOnTopCheckbutton.Toggled += StayOnTopToogled; // place objects in window fix.Put(openButton, 10, 20); fix.Put(saveButton, 120, 20); fix.Put(deleteButton, 10, 55); fix.Put(changeAspectRatioButton, 120, 55); fix.Put(autoPositionButton, 10, 90); fix.Put(changeBackgroundColorButton, 120, 90); fix.Put(setBackwardButton, 10, 140); fix.Put(setForwardButton, 120, 140); fix.Put(setAsBackgroundButton, 10, 175); fix.Put(setToFrontButton, 120, 175); fix.Put(clearButton, 10, 210); fix.Put(selectAllButton, 120, 210); fix.Put(undoButton, 10, 260); fix.Put(redoButton, 120, 260); fix.Put(stayOnTopCheckbutton, 10, 300); window.Add(fix); window.ShowAll(); }
public void InitializeGui() { m_ColorConnectionClosed = new Gdk.Color(255,0,0); m_ColorConnectionOpened = new Gdk.Color(0,255,0); Pango.FontDescription fontMaintTitle = Pango.FontDescription.FromString("Garamond 30"); m_MainPanel = new Fixed(); m_OutConnectionStatus = new Label("Jaco is not connected."); m_OutConnectionStatus.ModifyFg(StateType.Normal, m_ColorConnectionClosed); m_MainTitle = new Label("Kinova software example"); m_TxtTimeAbsolute = new Label("Time absolute :"); m_TxtTimeStartUp = new Label("Time from startup :"); m_TxtTimeStampSavings = new Label("timestamp savings :"); m_TxtSupplyVoltage = new Label("Supply voltage :"); m_TxtCurrentConsumed = new Label("Current consumed :"); m_TxtPowerConsumed = new Label("Power consumed :"); m_TxtAveragePower = new Label("Average power :"); m_TxtAccelerationX = new Label("Acceleration X :"); m_TxtAccelerationY = new Label("Acceleration Y :"); m_TxtAccelerationZ = new Label("Acceleration Z :"); m_TxtCodeVersion = new Label("Code version :"); m_TxtCodeRevision = new Label("Code revision :"); m_TxtControlOperator = new Label("Control operator :"); m_TxtControlMode = new Label("Control mode :"); m_TxtHandMode = new Label("Hand mode :"); m_TxtConnectedJointQuantity = new Label("Connected joint quantity :"); m_TxtPositionType = new Label("Position type :"); m_TxtErrorsSpiMain = new Label("Main SPI errors :"); m_TxtErrorsSpiExternal = new Label("External SPI errors :"); m_TxtErrorsMainCAN = new Label("Main CAN errors :"); m_TxtErrorsExternalCAN = new Label("External CAN errors :"); m_TxtCartesianX = new Label("Cartesian X :"); m_TxtCartesianY = new Label("Cartesian Y :"); m_TxtCartesianZ = new Label("Cartesian Z :"); m_TxtCartesianThetaX = new Label("Cartesian Theta X :"); m_TxtCartesianThetaY = new Label("Cartesian Theta Y :"); m_TxtCartesianThetaZ = new Label("Cartesian Theta Z :"); m_TxtAngle1 = new Label("Angle 1 :"); m_TxtAngle2 = new Label("Angle 2 :"); m_TxtAngle3 = new Label("Angle 3 :"); m_TxtAngle4 = new Label("Angle 4 :"); m_TxtAngle5 = new Label("Angle 5 :"); m_TxtAngle6 = new Label("Angle 6 :"); m_OutTimeAbsolute = new Label("????"); m_OutTimeStartUp = new Label("????"); m_OutTimeStampSavings = new Label("????"); m_OutSupplyVoltage = new Label("????"); m_OutCurrentConsumed = new Label("????"); m_OutPowerConsumed = new Label("????"); m_OutAveragePower = new Label("????"); m_OutAccelerationX = new Label("????"); m_OutAccelerationY = new Label("????"); m_OutAccelerationZ = new Label("????"); m_OutCodeVersion = new Label("????"); m_OutCodeRevision = new Label("????"); m_OutControlOperator = new Label("????"); m_OutControlMode = new Label("????"); m_OutHandMode = new Label("????"); m_OutConnectedJointQuantity = new Label("????"); m_OutPositionType = new Label("????"); m_OutErrorsSpiMain = new Label("????"); m_OutErrorsSpiExternal = new Label("????"); m_OutErrorsMainCAN = new Label("????"); m_OutErrorsExternalCAN = new Label("????"); m_OutCartesianX = new Label("????"); m_OutCartesianY = new Label("????"); m_OutCartesianZ = new Label("????"); m_OutCartesianThetaX = new Label("????"); m_OutCartesianThetaY = new Label("????"); m_OutCartesianThetaZ = new Label("????"); m_OutAngle1 = new Label("????"); m_OutAngle2 = new Label("????"); m_OutAngle3 = new Label("????"); m_OutAngle4 = new Label("????"); m_OutAngle5 = new Label("????"); m_OutAngle6 = new Label("????"); m_MainTitle.ModifyFont(fontMaintTitle); }
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 ResizableFixed () { GtkWorkarounds.FixContainerLeak (this); fixd = new Fixed (); Add (fixd); this.CanFocus = true; this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask | EventMask.KeyPressMask; // fixd.ModifyBg (Gtk.StateType.Normal, this.Style.Mid (Gtk.StateType.Normal)); // VisibleWindow = false; selectionBox = new SelectionHandleBox (this); selectionBox.Show (); }
public UICommandButton(Gtk.Fixed parent, GameConfigButtonDescriptor commandDescriptor) : base(parent, commandDescriptor) { }