BioGTK  6.7.0
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images. Including whole slide, pyramidal, and series.
Loading...
Searching...
No Matches
Resolutions.cs
1using Gtk;
2using Gdk;
3using System;
4using System.Collections.Generic;
5using System.Linq;
6using System.Text;
7using System.Threading.Tasks;
8using System.Runtime.CompilerServices;
9using System.IO;
10
11namespace BioGTK
12{
13
14 public class Resolutions : Gtk.Dialog
15 {
16 #region Properties
17 private Builder _builder;
18 public static int resolution;
19 Resolution[] ress;
20#pragma warning disable 649
21
22
23 [Builder.Object]
24 private Gtk.Button okBut;
25 [Builder.Object]
26 private Gtk.Label label;
27 [Builder.Object]
28 private Gtk.SpinButton resolutionsBox;
29
30#pragma warning restore 649
31
32 #endregion
33
34 /* A property. */
35 public int Resolution
36 {
37 get { return resolution; }
38 }
39
40 #region Constructors / Destructors
41
47 public static Resolutions Create(Resolution[] re)
48 {
49 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/Resolutions.glade", FileMode.Open));
50 Resolutions res = new Resolutions(builder, builder.GetObject("resolutions").Handle, re);
51 return res;
52 }
53
54 /* A constructor. */
55 protected Resolutions(Builder builder, IntPtr handle, Resolution[] res) : base(handle)
56 {
57 _builder = builder;
58 builder.Autoconnect(this);
59 resolutionsBox.Adjustment.Upper = res.Length - 1;
60 resolutionsBox.Adjustment.StepIncrement = 1;
61 resolutionsBox.Adjustment.PageIncrement = 1;
63 App.ApplyStyles(this);
64 }
65
66
67 #endregion
68
69 #region Handlers
70
72 protected void SetupHandlers()
73 {
74 okBut.Clicked += OkBut_Clicked;
75 resolutionsBox.Changed += ResolutionsBox_Changed;
76 this.DeleteEvent += Resolutions_DeleteEvent;
77 }
78
85 private void Resolutions_DeleteEvent(object o, DeleteEventArgs args)
86 {
87 Hide();
88 args.RetVal = true;
89 }
90
96 private void ResolutionsBox_Changed(object sender, EventArgs e)
97 {
98 resolution = resolutionsBox.ValueAsInt;
99 label.Text = ress[resolution].ToString();
100 }
101
106 private void OkBut_Clicked(object? sender, EventArgs e)
107 {
108 this.DefaultResponse = ResponseType.Ok;
109 Destroy();
110 }
111
112 #endregion
113
114 }
115}
void SetupHandlers()
It sets up the event handlers for the delete event and the ok and cancel buttons.
static Resolutions Create(Resolution[] re)
Definition ML.cs:17