/// <summary> /// Build the UI manually to avoid resize glitches when we adjust the widget to the selected image. /// </summary> /// <param name="width">The image width.</param> /// <param name="height">The image height.</param> void Build(int width, int height) { WindowPosition = WindowPosition.CenterAlways; fixed1 = new Fixed(); fixed1.WidthRequest = width; fixed1.HeightRequest = height; fixed1.HasWindow = false; progressbar1 = new ProgressBar(); progressbar1.WidthRequest = width * 60 / 100; progressbar1.HeightRequest = 20; fixed1.Add(progressbar1); Fixed.FixedChild w1 = (Fixed.FixedChild)(fixed1 [progressbar1]); w1.X = width * 20 / 100; w1.Y = height - 50; splashimage = new ImageView(); splashimage.SetSize(width, height); fixed1.Add(splashimage); Add(fixed1); if ((Child != null)) { Child.ShowAll(); } DefaultWidth = width; DefaultHeight = height; Show(); }
public void Q8_24_AddNoOverflow() { var pos = new Fixed <Q8_24>(16); var neg = new Fixed <Q8_24>(-32); var posRes = pos.Add(pos); var posNeg = pos.Add(neg); var negPos = neg.Add(pos); var negRes = neg.Add(neg); Assert.AreEqual("32", posRes.ToString()); Assert.AreEqual("-16", posNeg.ToString()); Assert.AreEqual("-16", negPos.ToString()); Assert.AreEqual("-64", negRes.ToString()); }
public void Q24_8_AddNoOverflow() { var pos = new Fixed <Q24_8>(128); var neg = new Fixed <Q24_8>(-1024); var posRes = pos.Add(pos); var posNeg = pos.Add(neg); var negPos = neg.Add(pos); var negRes = neg.Add(neg); Assert.AreEqual("256", posRes.ToString()); Assert.AreEqual("-896", posNeg.ToString()); Assert.AreEqual("-896", negPos.ToString()); Assert.AreEqual("-2048", negRes.ToString()); }
public void Q24_8_ZeroValueTest() { var zeroVal = new Fixed <Q24_8>(0); var five = zeroVal.Add(5); Assert.AreEqual("5", five.ToString()); }
public void Q8_24Test() { for (int i = 0; i < 1000; i++) { f9 = f7.Add(f8); } }
public void Q16_16Test() { for (int i = 0; i < 1000; i++) { f6 = f4.Add(f5); } }
public void Q24_8Test() { for (int i = 0; i < 1000; i++) { f3 = f1.Add(f2); } }
private void RefreshContent(GtkFormsContainer newContent) { _contentContainer.RemoveFromContainer(_content); _content = newContent; _contentContainer.Add(_content); _content.ShowAll(); }
private void RefreshContent(GtkFormsContainer newContent) { _content.Destroy(); _content = newContent; _contentContainer.Add(_content); _content.ShowAll(); }
} // Instance of a figure // 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; }
private void RefreshContent(EventBox newContent) { _contentContainer.RemoveFromContainer(_content); _content = newContent; _contentContainer.Add(_content); _content.ShowAll(); }
private void BuildPage() { _defaultBackgroundColor = Style.Backgrounds[(int)StateType.Normal]; _toolbar = new HBox(); _content = new GtkFormsContainer(); var root = new VBox(false, 0); _headerContainer = new GtkFormsContainer(); root.PackStart(_headerContainer, false, false, 0); _image = new ImageControl(); _image.Aspect = ImageAspect.Fill; _contentContainerWrapper = new GtkFormsContainer(); _contentContainerWrapper.SizeAllocated += OnContentContainerWrapperSizeAllocated; _contentContainer = new Fixed(); _contentContainer.Add(_image); _contentContainerWrapper.Add(_contentContainer); root.PackStart(_contentContainerWrapper, true, true, 0); // Should fill all available space Attach(root, 0, 1, 0, 1); ShowAll(); }
public void AdditionTestingSameTypesQ24_8(int in1, int in2, string exp) { var f1 = new Fixed <Q24_8>(in1); var f2 = new Fixed <Q24_8>(in2); Assert.Equal(exp, f1.Add(f2).ToString()); }
private MainWindow(Builder builder) : base(builder.GetObject("MainWindow").Handle) { builder.Autoconnect(this); DeleteEvent += Window_DeleteEvent; _buttonPlay.Clicked += ButtonPlay_Clicked; _buttonPause.Clicked += ButtonPause_Clicked; _buttonStop.Clicked += ButtonStop_Clicked; _buttonOpen.Clicked += ButtonOpen_Clicked; _scroll.ChangeValue += Scrollbar_Changed; new Task(() => Scrollbar_Update()).Start(); _treeView = new TreeView(); _treeView.RowActivated += OnRowActivated; TreeViewColumn listOfFiles = new TreeViewColumn(); listOfFiles.Title = "Список воспроизведения"; treestore = new TreeStore(typeof(string)); CellRendererText cell = new CellRendererText(); listOfFiles.PackStart(cell, true); listOfFiles.AddAttribute(cell, "text", 0); treestore = new TreeStore(typeof(string)); _treeView.AppendColumn(listOfFiles); _treeView.Model = treestore; _treeView.MarginLeft = 10; _treeView.MarginTop = 110; _fixed.Add(_treeView); _fixed.ShowAll(); }
// Method that describe what happen when a tile is clicked private void onTileClicked(object obj, ButtonPressEventArgs args) { if (((Gdk.EventButton)args.Event).Type == Gdk.EventType.ButtonPress) { TileWidget tile = (TileWidget)obj; //Console.WriteLine (tile.position.x + ", " + tile.position.y + " " + tile.color + " " + tile.figure); if (!this.clicked) { this.clickedPosition = new coord(tile.position.x, tile.position.y); if (this.callback(this.clickedPosition, this.clickedPosition)) { this.clicked = true; Fixed f = (Fixed)(tile.Child); Image circle = tile.loadCircle(this.tileSize); f.Add(circle); f.ShowAll(); } } else { //remove the ring whenn the user clicks agen on the same tile if (this.callback(this.clickedPosition, tile.position) && this.clickedPosition.Equals(tile.position)) { Fixed f = (Fixed)(tile.Child); if (f.Children.Length > 1) { f.Remove(f.Children [1]); } } this.clicked = false; } } }
protected void OnButtonMovePressed(object sender, EventArgs e) { int mx, my; Gdk.Display.Default.GetPointer(out mx, out my); fixedLayout.Remove(this); fixedLayout.Add(this); x = Math.Max(0, x); y = Math.Max(0, y); w = this.WidthRequest; h = this.HeightRequest; fixedLayout.Move(this, curx, cury); ResetCursor(); fixedLayout.Add(tmpwidget); fixedLayout.Move(tmpwidget, curx + w, cury + h); tmpwidget.Show(); timer.Stop(); timer = new Timer(10); timer.Elapsed += delegate { try { Gtk.Application.Invoke(delegate { int mx2, my2; Gdk.Display.Default.GetPointer(out mx2, out my2); if (mx2 != mx || my2 != my) { x = x - mx + mx2; y = y - my + my2; mx = mx2; my = my2; curx = Math.Max(0, x); cury = Math.Max(0, y); fixedLayout.Move(this, curx, cury); } }); } catch { } }; timer.Start(); }
public void TestAddition(int intValue1, int intValue2, string expectedResult) { f1 = new Fixed <Q>(intValue1); f2 = new Fixed <Q>(intValue2); var f3 = f1.Add(f2); Assert.AreEqual(expectedResult, f3.ToString()); }
public void test2() { var f1 = new Fixed <Q24_8>(3); var f2 = new Fixed <Q24_8>(2); var f3 = f1.Add(f2); Assert.AreEqual(f3.ToString(), "5"); }
public static void Add_additionOfSimpleNumbers_SideTestOfToString(Fixed <Q> a, Fixed <Q> b) { //Act var result = a.Add(b); //Assert Assert.AreEqual("66", result.ToString()); //result test }
public void Addicion3() { var f1 = new Fixed <Q8_24>(3); var f2 = new Fixed <Q8_24>(-100); var f3 = f1.Add(f2); Assert.AreEqual("-97", f3.ToString()); }
public void Q24_8_AddOverflow() { var max = new Fixed <Q24_8>(Int32.MaxValue); var res = max.Add(max); Assert.AreEqual("-2", res.ToString()); }
public void Addicion1() { var f1 = new Fixed <Q24_8>(3); var f2 = new Fixed <Q24_8>(2); var f3 = f1.Add(f2); Assert.AreEqual("5", f3.ToString()); }
public void Addicion2() { var f1 = new Fixed <Q16_16>(3); var f2 = new Fixed <Q16_16>(-3); var f3 = f1.Add(f2); Assert.AreEqual("0", f3.ToString()); }
public void Addicion3() { var f1 = new Fixed <Q24_8>(3); var f2 = new Fixed <Q24_8>(-20000); var f3 = f1.Add(f2); Assert.AreEqual("-19997", f3.ToString()); }
public void Q24_8_AddDecimal() { var lhs = new Fixed <Q24_8>(10).Divide(new Fixed <Q24_8>(4)); var rhs = new Fixed <Q24_8>(5).Divide(new Fixed <Q24_8>(2)); var res = lhs.Add(rhs); Assert.AreEqual("5", res.ToString()); }
public Fixed <T> Add <T>(int a, int b) where T : IArithmetics, new() { var aFixed = new Fixed <T>(a); var bFixed = new Fixed <T>(b); var resultFixed = aFixed.Add(bFixed); Assert.AreEqual(Math.Round(b + (double)a, roundDeximalCount), Math.Round(resultFixed, roundDeximalCount)); return(resultFixed); }
private void BuildSmallWidget(ref SmallSecretWidget widg, int x = 0, int y = 0) { widg = new SmallSecretWidget(); //img.WidthRequest = 16; //img.HeightRequest = 20; fixed1.Add(widg); Fixed.FixedChild w = ((Fixed.FixedChild)(fixed1[widg])); w.X = x; w.Y = y; }
private void BuildSymbol(ref Gtk.Image img, int x = 0, int y = 0) { img = new Gtk.Image(); img.WidthRequest = 16; img.HeightRequest = 20; fixed1.Add(img); Fixed.FixedChild w = ((Fixed.FixedChild)(fixed1[img])); w.X = x; w.Y = y; }
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); }
protected void ReparentTextView(Fixed parent, ScrolledWindow window, int x, int y) { var source = (Fixed)window.Parent; source.Remove(window); parent.Add(window); Fixed.FixedChild child = ((Fixed.FixedChild)(parent[window])); child.X = x; child.Y = y; }