Exemplo n.º 1
1
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        private static void Main()
        {
            Application.Init();

            var window = new Window("GtkSharpDemo");
            var plotModel = new PlotModel
                         {
                             Title = "Trigonometric functions",
                             Subtitle = "Example using the FunctionSeries",
                             PlotType = PlotType.Cartesian,
                             Background = OxyColors.White
                         };
            plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)") { Color = OxyColors.Black });
            plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)") { Color = OxyColors.Green });
            plotModel.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 0.1, "cos(t),sin(t)") { Color = OxyColors.Yellow });
            
            var plotView = new OxyPlot.GtkSharp.PlotView { Model = plotModel };
            plotView.SetSizeRequest(400, 400);
            plotView.Visible = true;

            window.SetSizeRequest(600, 600);
            window.Add(plotView);
            window.Focus = plotView;
            window.Show();
            window.DeleteEvent += (s, a) =>
                {
                    Application.Quit();
                    a.RetVal = true;
                };

            Application.Run();
        }
Exemplo n.º 2
1
        public static NSWindow GetWindow(Gtk.Window window)
        {
            if (window.GdkWindow == null)
            {
                return(null);
            }
            var ptr = NativeMethods.gdk_quartz_window_get_nswindow(window.GdkWindow.Handle);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }
            return((NSWindow)MonoMac.ObjCRuntime.Runtime.GetNSObject(ptr));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates an instance of the frmAbout class.
        /// </summary>
        /// <history>
        /// [Curtis_Beard]      11/02/2006  Created
        /// </history>
        public frmAbout(Window w, DialogFlags f)
            : base("", w, f)
        {
            InitializeComponent();

             SetVersion();
        }
Exemplo n.º 4
0
 public FileChooserDialog (string title, Window parent, FileChooserAction action) :
     base (title, parent, action)
 {
     LocalOnly = Banshee.IO.Provider.LocalOnly;
     SetCurrentFolderUri (LastFileChooserUri.Get (Environment.GetFolderPath (Environment.SpecialFolder.Personal)));
     WindowPosition = WindowPosition.Center;
 }
Exemplo n.º 5
0
		public static void Main20 (string[] args)
		{
			Application.Init ();

			PopulateStore ();

			Window win = new Window ("TreeView demo");
			win.DeleteEvent += new DeleteEventHandler (DeleteCB);
			win.DefaultWidth = 320;
			win.DefaultHeight = 480;

			ScrolledWindow sw = new ScrolledWindow ();
			win.Add (sw);

			TreeView tv = new TreeView (store);
			tv.HeadersVisible = true;

			tv.AppendColumn ("One", new CellRendererText (), new TreeCellDataFunc (CellDataA));
			tv.AppendColumn ("Two", new CellRendererText (), new TreeCellDataFunc (CellDataB));

			sw.Add (tv);
			win.ShowAll ();

			Application.Run ();
		}
Exemplo n.º 6
0
        internal static string OpenExperimentDialog(Window parentWindow) 
        {
            var fileChooserDialog = new Gtk.FileChooserDialog(Mono.Unix.Catalog.GetString ("Open Experiment File"), 
                                                               parentWindow,
                                                               FileChooserAction.Open, 
                                                               Gtk.Stock.Cancel, 
                                                               Gtk.ResponseType.Cancel,
                                                               Gtk.Stock.Open, Gtk.ResponseType.Ok);

            fileChooserDialog.AlternativeButtonOrder = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel };
            fileChooserDialog.SelectMultiple = false;

            AddFilters(fileChooserDialog);

            int response = fileChooserDialog.Run();

            string filename = null;
            if(response == (int)Gtk.ResponseType.Ok) 
            {
                filename = fileChooserDialog.Filename;
            }
            
            fileChooserDialog.Destroy();

            return filename;
        }
Exemplo n.º 7
0
 internal static bool NewExperimantDialog (Window parentWindow, ref Experiment experiment)
 {
     var newExperimentDialog = new NewExperimentDialog(ref experiment);
     newExperimentDialog.Run();
    
     return newExperimentDialog.Results;
 }
Exemplo n.º 8
0
        public void Initialize() {
            Window = (Window) _builder.GetObject("LauncherWindow");
            Window.Title = _setup.Title;
            Window.Hidden += (sender, eventArgs) => Application.Quit();
            Window.Show();
            PatchNotes = (TextView)_builder.GetObject("PatchNotes");
            ProgressBar = (ProgressBar) _builder.GetObject("ProgressBar");
            PlayButton = (Button) _builder.GetObject("PlayButton");
            PlayButton.Clicked += (sender, args) => {
                Program.StartGame(_setup);
            };

            HeaderImage = (Image)_builder.GetObject("HeaderImage");
            var headerLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LaunchHeader.png");
            if (File.Exists(headerLocation))
                HeaderImage.Pixbuf = new Gdk.Pixbuf(headerLocation);

            var changeLogFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "changelog.txt");
            string patchNotesText = "You're using a BETA version of our custom launcher. Please report all issues on the forum at http://onemoreblock.com/.";

            if (File.Exists(changeLogFile))
                patchNotesText += "\n\n" + File.ReadAllText(changeLogFile);

            PatchNotes.Buffer.Text = patchNotesText;

            Task.Run(() => CheckAndUpdate());
        }
Exemplo n.º 9
0
        internal static string ShowSaveAsDialog(Window parentWindow, string currentFilename = null) 
        {
            var fileChooserDialog = new FileChooserDialog (Mono.Unix.Catalog.GetString ("Save Experiment File"),
                                             parentWindow,
                                             FileChooserAction.Save,
                                             Gtk.Stock.Cancel,
                                             Gtk.ResponseType.Cancel,
                                             Gtk.Stock.Save, Gtk.ResponseType.Ok);
            
            fileChooserDialog.DoOverwriteConfirmation = true;
            fileChooserDialog.AlternativeButtonOrder = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel };
            fileChooserDialog.SelectMultiple = false;

            if (String.IsNullOrEmpty(currentFilename) == false)
            {
                fileChooserDialog.SetFilename(currentFilename);
            }

            AddFilters(fileChooserDialog);

            int response = fileChooserDialog.Run();
            
            string filename = null;
            if(response == (int)Gtk.ResponseType.Ok) 
            {
                filename = fileChooserDialog.Filename;
            }
            
            fileChooserDialog.Destroy();
            
            return filename;
        }
Exemplo n.º 10
0
	static void Main ()
	{
		Application.Init ();
		Gtk.Window w = new Gtk.Window ("System.Drawing and Gtk#");

		// Custom widget sample
		a = new PrettyGraphic ();

		// Event-based drawing
		b = new DrawingArea ();
		b.ExposeEvent += new ExposeEventHandler (ExposeHandler);
		b.SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler);

		Button c = new Button ("Quit");
		c.Clicked += new EventHandler (quit);

		MovingText m = new MovingText ();
		
		Box box = new HBox (true, 0);
		box.Add (a);
		box.Add (b);
		box.Add (m);
		box.Add (c);
		w.Add (box);
		
		w.ShowAll ();
		Application.Run ();
	}
Exemplo n.º 11
0
 public FullscreenControls(Window toplevel, InterfaceActionService actionService)
     : base(toplevel, 1)
 {
     action_service = actionService;
     AddAccelGroup (action_service.UIManager.AccelGroup);
     BuildInterface ();
 }
Exemplo n.º 12
0
        public InfoWindow(Song song, Window w)
            : base("", w, DialogFlags.DestroyWithParent)
        {
            this.HasSeparator = false;

            Glade.XML glade_xml = new Glade.XML (null, "InfoWindow.glade", "info_contents", null);
            glade_xml.Autoconnect (this);
            this.VBox.Add (info_contents);

            cover_image = new MagicCoverImage ();
            cover_image_container.Add (cover_image);
            cover_image.Visible = true;

            // Gdk.Pixbuf cover = new Gdk.Pixbuf (null, "unknown-cover.png", 66, 66);
            // cover_image.ChangePixbuf (cover);

            user_name_label = new UrlLabel ();
            user_name_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated);
            user_name_container.Add (user_name_label);
            user_name_label.SetAlignment ((float) 0.0, (float) 0.5);
            user_name_label.Visible = true;

            real_name_label = new UrlLabel ();
            real_name_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated);
            real_name_container.Add (real_name_label);
            real_name_label.SetAlignment ((float) 0.0, (float) 0.5);
            real_name_label.Visible = true;

            this.AddButton ("gtk-close", ResponseType.Close);

            SetSong (song);
        }
Exemplo n.º 13
0
        public RatingFilterDialog(FSpot.PhotoQuery query, Gtk.Window parent_window)
            : base("RatingFilterDialog.ui", "rating_filter_dialog")
        {
            this.query = query;
            this.parent_window = parent_window;
            TransientFor = parent_window;
            DefaultResponse = ResponseType.Ok;
            ok_button.GrabFocus ();

            if (query.RatingRange != null) {
                minrating_value = (int) query.RatingRange.MinRating;
                maxrating_value = (int) query.RatingRange.MaxRating;
            }
            minrating = new Rating (minrating_value);
            maxrating = new Rating (maxrating_value);
            minrating_hbox.PackStart (minrating, false, false, 0);
            maxrating_hbox.PackStart (maxrating, false, false, 0);

            ResponseType response = (ResponseType) Run ();

            if (response == ResponseType.Ok) {
                query.RatingRange = new RatingRange ((uint) minrating.Value, (uint) maxrating.Value);
            }

            Destroy ();
        }
Exemplo n.º 14
0
		public CanvasExample () {
			Gtk.Window win = new Gtk.Window ("Canvas example");
			win.DeleteEvent += new DeleteEventHandler (Window_Delete);

			VBox vbox = new VBox (false, 0);
			win.Add (vbox);

			vbox.PackStart (new Label ("Drag - move object.\n" +
						   "Double click - change color\n" +
						   "Right click - delete object"),
					false, false, 0);
			
			canvas = new Canvas ();
			canvas.SetSizeRequest (width, height);
			canvas.SetScrollRegion (0.0, 0.0, (double) width, (double) height);
			vbox.PackStart (canvas, false, false, 0);

			HBox hbox = new HBox (false, 0);
			vbox.PackStart (hbox, false, false, 0);

			Button add_button = new Button ("Add an object");
			add_button.Clicked += new EventHandler (AddObject);
			hbox.PackStart (add_button, false, false, 0);

			Button quit_button = new Button ("Quit");
			quit_button.Clicked += new EventHandler (Quit);
			hbox.PackStart (quit_button, false, false, 0);

			win.ShowAll ();
		}
        void Initialize(Window parent)
        {
            var stream = Assembly
                .GetExecutingAssembly()
                .GetManifestResourceStream("LadderLogic.Presentation.EnvironmentVariablesDialog.glade");

            var glade = new Glade.XML(stream, "UnhandledExceptionDialog", null);
            if (stream != null)
            {
                stream.Close();
            }

            //Glade.XML glade = Glade.XML.FromAssembly("UnhandledExceptionDialog.glade","UnhandledExceptionDialog", null);
            //stream.Close();
            glade.Autoconnect(this);
            _thisDialog = ((Dialog)(glade.GetWidget("UnhandledExceptionDialog")));

            //_thisDialog = ((Dialog)(glade.GetWidget(AppController.Instance.Config.UnhandledExceptionDialogName)));
            //_thisDialog.Modal = true;
            //_thisDialog.TransientFor = parent;
            _thisDialog.SetPosition (WindowPosition.Center);

            var env = CController.Instance.GetEnvironmentVariables ();

            if (env != null) {
                etBoard.Text = env.ArduinoBoard;
                etPort.Text = env.ArduinoPort;
                etPath.Text = env.ArduinoPath;
            }
        }
Exemplo n.º 16
0
		public DialogError(string message, Exception e, Window parent) : base("Error", parent, DialogFlags.Modal, Stock.Ok, ResponseType.Ok)
		{
			HBox hbox = new HBox();
			Image icon = new Image(Stock.DialogError,IconSize.Dialog);
			Label label = new Label(message);
			Expander exp = new Expander("Details");
			ScrolledWindow sw = new ScrolledWindow();
			TextView tview = new TextView();
			
			hbox.BorderWidth = 6;
			hbox.Spacing = 6;
			label.SetAlignment(0f, 0.5f);
			exp.BorderWidth = 6;
			tview.Buffer.Text = e.Message;
			tview.Buffer.Text += "\n";
			tview.Buffer.Text += e.StackTrace;
			
			sw.Add(tview);
			exp.Add(sw);
			hbox.PackStart(icon, false, false, 0);
			hbox.PackStart(label, true, true, 0);
			this.VBox.PackStart(hbox, false, false, 0);
			this.VBox.PackStart(exp, true, true, 0);
			this.ShowAll();
			
		}
Exemplo n.º 17
0
        public GenerationMenuWidget(Window parent, IElement referer, Bus bus, string busName)
        {
            if (referer.Data != null) {
                MenuItem path = new MenuItem("Call " + referer.Name + "...");
                ObjectPath p = new ObjectPath(referer.Parent.Parent.Path);

                if (!referer.Data.IsProperty) {
                    path.Activated += delegate {
                        MethodInvokeDialog diag = new MethodInvokeDialog (parent, bus, busName, p, referer);

                        while (diag.Run () == (int)ResponseType.None);
                        diag.Destroy();
                    };
                } else {
                    path.Activated += delegate {
                        PropertyInvokeDialog diag = new PropertyInvokeDialog (parent, bus, busName, p, referer);

                        while (diag.Run () == (int)ResponseType.None);
                        diag.Destroy();
                    };
                }

                this.Append(path);
                path.ShowAll();
            }
        }
Exemplo n.º 18
0
        public static bool CompareVersions(Window parent)
        {
            _parent = parent;
            var downloadToPath = Path.GetTempPath();
            var localVersion = Versions.LocalVersion();
            var remoteVersion = Versions.RemoteVersion(RemoteVersion);
            if (string.IsNullOrWhiteSpace(remoteVersion)) //prevent to reload first version
            {
                return true;
            }
            var c = 0;
            Version v;
            if(Version.TryParse(localVersion, out v))
            {
                c = v.CompareTo(Version.Parse(remoteVersion));
            }

            if (c < 0)
            {
                BeginDownload(RemoteFile, downloadToPath, remoteVersion, LocalFile);
                return false;
            }

            return true;
        }
Exemplo n.º 19
0
		public static void ShowError (Exception ex, string message, Window parent, bool modal)
		{
			Gtk.Builder builder = new Gtk.Builder (null, "Mono.Addins.GuiGtk3.interfaces.ErrorDialog.ui", null);
			ErrorDialog dlg = new ErrorDialog (builder, builder.GetObject ("ErrorDialog").Handle);
			
			if (message == null) {
				if (ex != null)
					dlg.Message = string.Format (Catalog.GetString ("Exception occurred: {0}"), ex.Message);
				else {
					dlg.Message = "An unknown error occurred";
					dlg.AddDetails (Environment.StackTrace, false);
				}
			} else
				dlg.Message = message;
			
			if (ex != null) {
				dlg.AddDetails (string.Format (Catalog.GetString ("Exception occurred: {0}"), ex.Message) + "\n\n", true);
				dlg.AddDetails (ex.ToString (), false);
			}

			if (modal) {
				dlg.Run ();
				dlg.Destroy ();
			} else
				dlg.Show ();
		}
		/// <summary>
		/// <c>SymbolLabelInfoConfigDialog</c>'s constructor.
		/// </summary>
		/// <param name="parent">
		/// The dialog's parent window.
		/// </param>
		public SymbolLabelDialog(Window parent)
		{
			XML gxml = new XML(null, "gui.glade","symbolLabelDialog",null);
			
			gxml.Autoconnect(this);
			
			symbolLabelDialog.Modal = true;
			symbolLabelDialog.Resizable = false;
			symbolLabelDialog.TransientFor = parent;
			
			CellRendererText cellRenderer = new CellRendererText();			
			
			cellRenderer.Xalign = 0.5f;
			symbolLabelsTV.AppendColumn("Símbolo", cellRenderer,"text",0);
			symbolLabelsTV.AppendColumn("Etiqueta", new CellRendererText(),"text",1);
			
			symbolLabelsModel = new ListStore(typeof(string), 
			                                  typeof(string));
			
			symbolLabelsTV.Model = symbolLabelsModel;
			
			symbolLabelsTV.Selection.Changed += OnSymbolLabelsTVSelectionChanged;
			
			foreach (SymbolLabelInfo info in LibraryConfig.Instance.Symbols)
			{				
				symbolLabelsModel.AppendValues(info.Symbol, info.Label);
			}
			
			changes = false;
		}
Exemplo n.º 21
0
 /// <summary>
 /// <param name="parent">The parent window where this CellRendererDate
 /// will be used from.  This is needed to access the Gdk.Screen so the
 /// Calendar will popup in the proper location.</param>
 /// </summary>
 public CellRendererDate()
 {
     date = DateTime.MinValue;
     editable = false;
     popup = null;
     show_time = true;
 }
Exemplo n.º 22
0
        public static void Main()
        {
            Application.Init ();
            // TODO encapsulate in Global ()
            GtkSharp.GtkGL.ObjectManager.Initialize ();

            Gtk.Window window = new Gtk.Window ("simple");
            window.ReallocateRedraws = true;
            window.DeleteEvent += new DeleteEventHandler (OnDeleteEvent);

            int[] attrlist = {4,
                      8, 1,
                      9, 1,
                      10, 1,
                      5,
                      0};

            glarea = new GtkGL.Area (attrlist);
            glarea.RequestSize = new System.Drawing.Size (200,200);

            glarea.Realized += new EventHandler (OnRealized);
            glarea.ConfigureEvent += new ConfigureEventHandler (OnConfigure);
            glarea.ExposeEvent += new ExposeEventHandler (OnExpose);

            window.Add (glarea);
            window.Show ();
            glarea.Show ();
            Application.Run ();
        }
Exemplo n.º 23
0
 public static ResponseType show(Window parent_window, DialogFlags dialogFlags, MessageType messageType, ButtonsType buttonsType,string  message)
 {
     _dlg = new MessageDialog (parent_window, dialogFlags,messageType, buttonsType, message);
     ResponseType response = (ResponseType) _dlg.Run ();
     _dlg.Destroy ();
     return response;
 }
Exemplo n.º 24
0
        public MeeGoPanel ()
        {
            if (Instance != null) {
                throw new InvalidOperationException ("Only one MeeGoPanel instance should exist");
            }

            Instance = this;

            var timer = Log.DebugTimerStart ();

            try {
                Log.Debug ("Attempting to create MeeGo toolbar panel");
                embedded_panel = new PanelGtk ("banshee", Catalog.GetString ("media"),
                    null, "media-button", true);
                embedded_panel.ShowBeginEvent += (o, e) => {
                    ServiceManager.SourceManager.SetActiveSource (ServiceManager.SourceManager.MusicLibrary);
                    if (Contents != null) {
                        Contents.SyncSearchEntry ();
                    }
                };
                while (Gtk.Application.EventsPending ()) {
                    Gtk.Application.RunIteration ();
                }
            } catch (Exception e) {
                if (!(e is DllNotFoundException)) {
                    Log.Exception ("Could not bind to MeeGo panel", e);
                }
                window_panel = new Gtk.Window ("MeeGo Media Panel");
            }

            Log.DebugTimerPrint (timer, "MeeGo panel created: {0}");
        }
Exemplo n.º 25
0
        // Message box
        public static ResponseType ShowMessageBox(Window parent,
            MessageType mtype,
            ButtonsType buttons,
            string title,
            string message,
            params string[] args)
        {
            MessageDialog msgDlg =
                new MessageDialog(parent,
                                  DialogFlags.Modal,
                                  mtype,
                                  buttons,
                                  message,
                                  args);
            msgDlg.Title = title;
            msgDlg.UseMarkup = false;

            ResponseType response = ResponseType.None;
            msgDlg.Response += (object o, ResponseArgs args2) =>
            {
                msgDlg.Destroy();
                response = args2.ResponseId;
            };
            msgDlg.Run();
            return response;
        }
Exemplo n.º 26
0
        public void ShowAt(int x, int y, double horizontal_align, double vertical_align)
        {
            if(win == null)
            {
                win = new Window (WindowType.Popup);
            }

            Pango.Layout layout = win.CreatePangoLayout (accelerator);
            int width, height;
            layout.GetPixelSize (out width, out height);
            width += 2;
            height += 2;

            x -= (int)(horizontal_align * width);
            y -= (int)(vertical_align * height);

            win.Show ();
            win.GdkWindow.Move (x, y);
            win.GdkWindow.Resize (width, height);

            win.ExposeEvent += delegate(object Sender, ExposeEventArgs Args)
            {
                Gdk.EventExpose evnt = Args.Event;

                Cairo.Context cr = Gdk.CairoHelper.Create (win.GdkWindow);

                cr.Rectangle (evnt.Area.X, evnt.Area.Y, evnt.Area.Width, evnt.Area.Height);
                cr.Clip ();
                theme.DrawKeyTip (cr, new Cairo.Point (win.Allocation.X, win.Allocation.Y), 0, 0, layout);

                ((IDisposable)cr.Target).Dispose ();
                ((IDisposable)cr).Dispose ();
            };
        }
Exemplo n.º 27
0
 public EditCategoryDialog(ProjectLongoMatch project, EventType eventType, Window parent)
 {
     TransientFor = parent;
     this.Build ();
     timenodeproperties2.EventType = eventType;
     timenodeproperties2.Dashboard = project.Dashboard;
 }
Exemplo n.º 28
0
        public AboutDialog(Window parent)
            : base(parent, "AboutDialog")
        {
            string title = String.Empty;
            string version = String.Empty;

            var assembly = Assembly.GetExecutingAssembly();

            var titleAttributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            if (titleAttributes.Length > 0) {
                AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)titleAttributes[0];
                if (!String.IsNullOrEmpty(titleAttribute.Title)) {
                    title = titleAttribute.Title;
                }
            }

            var versionAttributes = assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute), false);
            if (versionAttributes.Length > 0) {
                AssemblyVersionAttribute versionAttribute = (AssemblyVersionAttribute)versionAttributes[0];
                if (!String.IsNullOrEmpty(versionAttribute.Version)) {
                    version =  versionAttribute.Version;
                }
            }

            Gtk.AboutDialog dialog = (Gtk.AboutDialog)base.Dialog;

            if (!String.IsNullOrEmpty(title))
                dialog.ProgramName = title;

            if (!String.IsNullOrEmpty(version))
                dialog.Version = version;
        }
Exemplo n.º 29
0
 public EditCategoryDialog(ProjectLongoMatch project, DashboardButton tagger, Window parent)
 {
     TransientFor = parent;
     this.Build ();
     timenodeproperties2.Tagger = tagger;
     timenodeproperties2.Dashboard = project.Dashboard;
 }
Exemplo n.º 30
0
		public TreeViewDemo ()
		{
			DateTime start = DateTime.Now;

			Application.Init ();
			
			PopulateStore ();

			Window win = new Window ("TreeView demo");
			win.DeleteEvent += new DeleteEventHandler (DeleteCB);
			win.SetDefaultSize (640,480);

			ScrolledWindow sw = new ScrolledWindow ();
			win.Add (sw);

			TreeView tv = new TreeView (store);
			tv.HeadersVisible = true;
			tv.EnableSearch = false;

			tv.AppendColumn ("Name", new CellRendererText (), "text", 0);
			tv.AppendColumn ("Type", new CellRendererText (), "text", 1);

			sw.Add (tv);
			
			dialog.Destroy ();
			dialog = null;

			win.ShowAll ();
			
			Console.WriteLine (count + " nodes added.");
			Console.WriteLine ("Startup time: " + DateTime.Now.Subtract (start));
			Application.Run ();
		}
Exemplo n.º 31
0
		public DemoMain ()
		{
			SetupDefaultIcon ();
		   	window = new Gtk.Window ("Gtk# Code Demos");
		   	window.SetDefaultSize (600, 400);
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			HBox hbox = new HBox (false, 0);
			window.Add (hbox);

			treeView = CreateTree ();
			hbox.PackStart (treeView, false, false, 0);

			Notebook notebook = new Notebook ();
			hbox.PackStart (notebook, true, true, 0);

			notebook.AppendPage (CreateText (infoBuffer, false), new Label ("_Info"));
			TextTag heading = new TextTag ("heading");
			heading.Font = "Sans 18";
			infoBuffer.TagTable.Add (heading);

			notebook.AppendPage (CreateText (sourceBuffer, true), new Label ("_Source"));

			window.ShowAll ();
		}
Exemplo n.º 32
0
        public void Start()
        {
            _chrono.Restart();

            _isActive = true;

            Gtk.Window parent = this.Toplevel as Gtk.Window;

            parent.FocusInEvent  += Parent_FocusInEvent;
            parent.FocusOutEvent += Parent_FocusOutEvent;

            Application.Invoke(delegate
            {
                parent.Present();

                string titleNameSection = string.IsNullOrWhiteSpace(Device.Application.TitleName) ? string.Empty
                    : $" - {Device.Application.TitleName}";

                string titleVersionSection = string.IsNullOrWhiteSpace(Device.Application.DisplayVersion) ? string.Empty
                    : $" v{Device.Application.DisplayVersion}";

                string titleIdSection = string.IsNullOrWhiteSpace(Device.Application.TitleIdText) ? string.Empty
                    : $" ({Device.Application.TitleIdText.ToUpper()})";

                string titleArchSection = Device.Application.TitleIs64Bit ? " (64-bit)" : " (32-bit)";

                parent.Title = $"Ryujinx {Program.Version}{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
            });

            Thread renderLoopThread = new Thread(Render)
            {
                Name = "GUI.RenderLoop"
            };

            renderLoopThread.Start();

            Thread nvStutterWorkaround = new Thread(NVStutterWorkaround)
            {
                Name = "GUI.NVStutterWorkaround"
            };

            nvStutterWorkaround.Start();

            MainLoop();

            renderLoopThread.Join();
            nvStutterWorkaround.Join();

            Exit();
        }
Exemplo n.º 33
0
    PersonSelectWindow(Gtk.Window parent)
    {
        Glade.XML gladeXML;
        gladeXML = Glade.XML.FromAssembly(Util.GetGladePath() + "chronojump.glade", "person_select_window", "chronojump");
        gladeXML.Autoconnect(this);

        //put an icon to window
        UtilGtk.IconWindow(person_select_window);

        FakeButtonAddPerson    = new Gtk.Button();
        FakeButtonEditPerson   = new Gtk.Button();
        FakeButtonDeletePerson = new Gtk.Button();
        FakeButtonDone         = new Gtk.Button();
    }
Exemplo n.º 34
0
        public static string Browse(Gtk.Window parent, string selection)
        {
            ThemedIconBrowser browser = new ThemedIconBrowser(parent);

            browser.list.Selection = selection;
            int response = browser.Run();

            if (response == (int)Gtk.ResponseType.Ok)
            {
                selection = browser.list.Selection;
            }
            browser.Destroy();
            return(selection);
        }
Exemplo n.º 35
0
            public AlertButton ShowException(Gtk.Window parent, string title, string message, Exception e, params AlertButton[] buttons)
            {
                var exceptionDialog = new ExceptionDialog()
                {
                    Buttons      = buttons,
                    Title        = title,
                    Message      = message,
                    Exception    = e,
                    TransientFor = parent,
                };

                exceptionDialog.Run();
                return(exceptionDialog.ResultButton);
            }
Exemplo n.º 36
0
            public AlertButton ShowException(Gtk.Window parent, string title, string message, Exception e, params AlertButton[] buttons)
            {
                var exceptionDialog = new ExceptionDialog()
                {
                    Buttons      = buttons ?? new AlertButton[] { AlertButton.Ok },
                    Title        = title ?? GettextCatalog.GetString("An error has occurred"),
                    Message      = message,
                    Exception    = e,
                    TransientFor = parent,
                };

                exceptionDialog.Run();
                return(exceptionDialog.ResultButton);
            }
Exemplo n.º 37
0
        /// <summary>Crea una instancia de la clase.</summary>
        /// <param name="parent">La ventana padre de este diálogo.</param>

        private DialogoConfiguracion(Gtk.Window parent) :
            base("", parent, Gtk.DialogFlags.DestroyWithParent)
        {
            Title        = Ventana.GetText("DialogoConfiguracion_Title");
            TransientFor = parent;
            Modal        = true;
            Resizable    = false;
            DeleteEvent += new DeleteEventHandler(Ventana.OcultarVentana);
            Resize(300, 300);
            BorderWidth  = 10;
            HasSeparator = true;
            VBox.Add(this.CrearNotebook());
            ActionArea.Add(this.CrearPanelInferior());
        }
Exemplo n.º 38
0
        public SaveConfirmationAlert(string primary, Gtk.Window parent)
            : base(string.Format(Catalog.GetString("Save changes to file '{0}' before closing?"), primary),
                   Catalog.GetString("If you don't save, all changes made since the last save will be lost."), parent)
        {
            image.SetFromStock(Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog);

            this.AddButton(Catalog.GetString("Close without Saving"), ResponseType.No);
            this.AddButton(Gtk.Stock.Cancel, ResponseType.Cancel);
            this.AddButton(Gtk.Stock.Save, ResponseType.Ok);

            this.DefaultResponse = ResponseType.Cancel;

            this.ShowAll();
        }
Exemplo n.º 39
0
        public void Build()
        {
            this.window = new Window("BattleNames");
            this.window.SetDefaultSize(800, 600);
            this.window.DeleteEvent += HandleWindowDeleteEvent;

            this.vbox = new VBox();
            {
                this.tbar = new Toolbar();
                this.tbar.ToolbarStyle = ToolbarStyle.BothHoriz;
                {
                    this.generatebutton             = new ToolButton(Stock.New);
                    this.generatebutton.TooltipText = "Generate a new battle name";
                    this.generatebutton.Label       = "Generate";
                    this.generatebutton.IsImportant = true;
                    this.generatebutton.Clicked    += HandleGeneratebuttonClicked;
                    this.clearbutton             = new ToolButton(Stock.Clear);
                    this.clearbutton.TooltipText = "Clear output";
                    this.clearbutton.Label       = "Clear";
                    this.clearbutton.Clicked    += HandleClearbuttonClicked;
                }
                this.tbar.Add(this.generatebutton);
                this.tbar.Add(this.clearbutton);

                this.hpaned = new HPaned();
                {
                    this.treescrolledwindow = new ScrolledWindow();
                    this.treeview           = new TreeView();
                    this.treeview.AppendColumn("Name", new CellRendererText(), "text", 0);
                    this.treeview.HeadersVisible = true;
                    this.treeview.Model          = this.treestore;
                    this.treescrolledwindow.Add(this.treeview);

                    this.textscrolledwindow = new ScrolledWindow();
                    this.textview           = new TextView();
                    this.textview.Editable  = false;
                    this.textscrolledwindow.Add(this.textview);
                }
                this.hpaned.Pack1(this.treescrolledwindow, false, true);
                this.hpaned.Pack2(this.textscrolledwindow, true, true);
                this.hpaned.Position = 200;

                this.sbar = new Statusbar();
            }
            this.vbox.PackStart(this.tbar, false, true, 0);
            this.vbox.PackStart(this.hpaned, true, true, 0);
            this.vbox.PackEnd(this.sbar, false, true, 0);

            this.window.Add(this.vbox);
        }
Exemplo n.º 40
0
        private void Run()
        {
            Gtk.Application.Init();
            app = new Gtk.Application("", GLib.ApplicationFlags.None);
            app.Register(GLib.Cancellable.Current);

            win = new Gtk.Window("");
            app.AddWindow(win);

            Fill();

            win.ShowAll();
            Gtk.Application.Run();
        }
Exemplo n.º 41
0
    static new public ExecuteAutoWindow Show(Gtk.Window parent, int sessionID)
    {
        if (ExecuteAutoWindowBox == null)
        {
            ExecuteAutoWindowBox = new ExecuteAutoWindow(parent);
        }

        ExecuteAutoWindowBox.initialize();
        ExecuteAutoWindowBox.sessionID = sessionID;

        ExecuteAutoWindowBox.execute_auto.Show();

        return(ExecuteAutoWindowBox);
    }
Exemplo n.º 42
0
    public static void InitializeSessionVariables(Gtk.Window mainApp, Session session, string programName, string programVersion)
    {
        app1           = mainApp;
        currentSession = session;
        progName       = programName;
        progVersion    = programVersion;

        serverSessionError      = false;
        needUpdateServerSession = false;
        updatingServerSession   = false;
        sessionUploadPersonData = new SessionUploadPersonData();
        countPersons            = 0;
        progressBarPersonsNum   = 0;
    }
Exemplo n.º 43
0
        public RestoreBackupDialog(Gtk.Window parent) : base("Saves", parent)
        {
            this.IconName = "document-revert";

            XML gxml = new XML(null, "MultiMC.GTKGUI.RestoreBackupDialog.glade", "restoreRoot", null);

            gxml.Toplevel = this;
            gxml.Autoconnect(this);

            this.VBox.PackStart(restoreRoot);

            this.WidthRequest  = 620;
            this.HeightRequest = 380;

            // set default button states
            btnCancel.Sensitive = true;
            btnOK.Sensitive     = false;

            // FIXME: store date/time properly so ordering works.
            backupsStore      = new ListStore(typeof(string), typeof(DateTime), typeof(string), typeof(string));
            restoreView.Model = backupsStore;
            restoreView.AppendColumn("Backup name", new CellRendererText(), "text", 0);
            restoreView.AppendColumn("Date", new CellRendererText(), new TreeCellDataFunc(DateTimeCell));
            restoreView.AppendColumn("Hash", new CellRendererText(), "text", 2);
            restoreView.Selection.Mode = SelectionMode.Single;

            // this binds view and model columns together for sorting
            restoreView.Columns[0].SortColumnId = 0;
            restoreView.Columns[1].SortColumnId = 1;
            restoreView.Columns[2].SortColumnId = 2;
            // the date column needs a custom sorting function that can compare DateTime objects
            backupsStore.SetSortFunc(1, new TreeIterCompareFunc(DateTimeTreeIterCompareFunc));
            backupsStore.SetSortColumnId(1, SortType.Ascending);            // sort by date
            restoreView.Selection.Changed += (sender, e) =>
            {
                if (restoreView.Selection.CountSelectedRows() != 0)
                {
                    btnOK.Sensitive = true;
                    TreeIter iter;
                    restoreView.Selection.GetSelected(out iter);
                    currentHash = backupsStore.GetValue(iter, 3) as string;
                }
                else
                {
                    btnOK.Sensitive = false;
                }
            };
            ShowAll();
        }
Exemplo n.º 44
0
        public static void Main(string[] args)
        {
            Application.Init();

            var window = new Gtk.Window(Gtk.WindowType.Toplevel)
            {
                Title       = "Treemap Example",
                BorderWidth = 0,                //12,
            };

            window.SetDefaultSize(640, 480);
            window.DeleteEvent += delegate {
                Gtk.Application.Quit();
            };
            window.Show();

            var vbox = new Gtk.VBox(false, 6);

            window.Add(vbox);
            vbox.Show();

            var treemap = new TreeMap.TreeMap()
            {
                Model        = BuildModel(),
                TextColumn   = 0,
                WeightColumn = 1,
                Title        = "Treemap Example",
            };

            vbox.PackStart(treemap, true, true, 0);
            treemap.Show();

            var buttonbox = new Gtk.HButtonBox();

            buttonbox.BorderWidth = 12;
            buttonbox.Layout      = Gtk.ButtonBoxStyle.End;
            vbox.PackStart(buttonbox, false, true, 0);
            buttonbox.Show();

            var close = new Gtk.Button(Gtk.Stock.Close);

            close.CanDefault = true;
            close.Clicked   += delegate { Gtk.Application.Quit(); };
            buttonbox.PackStart(close, false, true, 0);
            window.Default = close;
            close.Show();

            Application.Run();
        }
Exemplo n.º 45
0
        private void ShowPopup()
        {
            win              = new Gtk.Window(Gtk.WindowType.Popup);
            win.Screen       = this.Screen;
            win.WidthRequest = this.Allocation.Width;

            cal = new Gtk.Calendar();
            win.Add(cal);

            if (validDate)
            {
                cal.Date = date;
            }

            // events
            win.ButtonPressEvent       += OnWinButtonPressEvent;
            cal.DaySelectedDoubleClick += OnCalDaySelectedDoubleClick;
            cal.KeyPressEvent          += OnCalKeyPressEvent;
            cal.ButtonPressEvent       += OnCalButtonPressEvent;

            int x, y;

            GetWidgetPos(this, out x, out y);
            win.Move(x, y + Allocation.Height + 2);
            win.ShowAll();
            win.GrabFocus();

            Grab.Add(win);

            Gdk.GrabStatus grabStatus;

            grabStatus = Gdk.Pointer.Grab(win.GdkWindow, true, EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask, null, null, Gtk.Global.CurrentEventTime);
            if (grabStatus == Gdk.GrabStatus.Success)
            {
                grabStatus = Gdk.Keyboard.Grab(win.GdkWindow, true, Gtk.Global.CurrentEventTime);
                if (grabStatus != Gdk.GrabStatus.Success)
                {
                    Grab.Remove(win);
                    win.Destroy();
                    win = null;
                }
            }
            else
            {
                Grab.Remove(win);
                win.Destroy();
                win = null;
            }
        }
Exemplo n.º 46
0
        public FileMaskEntry(List <string> mask, object parent, Gtk.Window parentWindow) : base(false, 6)       //(string name, bool isFolder) : base (false, 6)
        {
            windowParent = parentWindow;

            text        = new Entry();
            this.parent = parent;
            browse      = Button.NewWithMnemonic(MainClass.Languages.Translate("browse"));

            text.Changed   += new EventHandler(OnTextChanged);
            browse.Clicked += new EventHandler(OnButtonClicked);

            PackStart(text, true, true, 0);

            PackEnd(browse, false, false, 0);

            Gdk.Pixbuf default_pixbuf = null;
            string     file           = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png");

            popupCondition = new Gtk.Menu();

            if (System.IO.File.Exists(file))
            {
                default_pixbuf = new Gdk.Pixbuf(file);

                Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf));
                btnClose.TooltipText  = MainClass.Languages.Translate("insert_path_mask");
                btnClose.Relief       = Gtk.ReliefStyle.None;
                btnClose.CanFocus     = false;
                btnClose.WidthRequest = btnClose.HeightRequest = 22;

                popupCondition.AttachToWidget(btnClose, new Gtk.MenuDetachFunc(DetachWidget));

                btnClose.Clicked += delegate {
                    popupCondition.Popup(null, null, new Gtk.MenuPositionFunc(GetPosition), 3, Gtk.Global.CurrentEventTime);
                };
                PackEnd(btnClose, false, false, 0);
            }

            if (mask != null)
            {
                foreach (string cd in mask)
                {
                    AddMenuItem(cd);
                }
            }
            popupCondition.ShowAll();

            this.ShowAll();
        }
Exemplo n.º 47
0
        public static int Main(string[] args)
        {
            Application.Init();
            Gtk.Window win = new Gtk.Window("Scribble");
            win.DeleteEvent += delegate { Application.Quit(); };
            win.BorderWidth  = 8;
            Frame frm = new Frame(null);

            frm.ShadowType = ShadowType.In;
            frm.Add(new ScribbleArea());
            win.Add(frm);
            win.ShowAll();
            Application.Run();
            return(0);
        }
Exemplo n.º 48
0
        public CompatFileChooserDialog(string title, Gtk.Window parent, Action action)
        {
            string check = Gtk.Global.CheckVersion(2, 4, 0);

            use_file_chooser = (check == "" || check == null);

            if (use_file_chooser)
            {
                create_with_file_chooser(title, parent, action);
            }
            else
            {
                create_with_file_selection(title, parent, action);
            }
        }
Exemplo n.º 49
0
        public static void Main()
        {
            Console.WriteLine("Starting Gtk engine...");

            Gtk.Application.Init();
            mainWindow = new MainWindow("Hello from Gtk");

            //Setup event handling
            mainWindow.Destroyed += new EventHandler(MainWindow_Destroyed);

            mainWindow.ShowAll();
            Gtk.Application.Run();

            Console.WriteLine("Codeflow back in HelloGtk.Main()");
        }
Exemplo n.º 50
0
    //run and destroy a standard dialog
    public static Gtk.ResponseType RunHigMessageDialog(Gtk.Window parent,
                                                       Gtk.DialogFlags flags,
                                                       Gtk.MessageType type,
                                                       Gtk.ButtonsType buttons,
                                                       string header,
                                                       string msg)
    {
        HigMessageDialog hmd = new HigMessageDialog(parent, flags, type, buttons, header, msg);

        try {
            return((Gtk.ResponseType)hmd.Run());
        } finally {
            hmd.Destroy();
        }
    }
Exemplo n.º 51
0
        public static void ShowError(Gtk.Window parent, string format, params object[] args)
        {
            string message = string.Format(format, args);

            MessageDialog errorDialog = new MessageDialog(
                parent, DialogFlags.Modal, MessageType.Error,
                ButtonsType.Ok, message);

            errorDialog.Title = "Oopz!";

            errorDialog.TransientFor = parent;

            errorDialog.Run();
            errorDialog.Destroy();
        }
Exemplo n.º 52
0
        public static void BuildMainForm()
        {
            MainForm              = new Gtk.Window("Eddie3");
            MainForm.DeleteEvent += delegate(object o, Gtk.DeleteEventArgs args)
            {
                if (m_canClose)
                {
                    return;
                }

                args.RetVal = true;                 // Avoid

                HtmlToCli("exit");
            };
        }
Exemplo n.º 53
0
        public Loupe(PhotoImageView view) : base("Loupe")
        {
            this.view = view;
            Decorated = false;

            Gtk.Window win = (Gtk.Window)view.Toplevel;

            win.GetPosition(out old_win_pos.X, out old_win_pos.Y);
            win.ConfigureEvent += HandleToplevelConfigure;

            TransientFor      = win;
            DestroyWithParent = true;

            BuildUI();
        }
Exemplo n.º 54
0
        public void GetRequiredPosition(TextEditor editor, Gtk.Window tipWindow, out int requiredWidth, out double xalign)
        {
            var win = (TooltipWindow)tipWindow;

            // Code taken from LanugageItemWindow (public int SetMaxWidth (int maxWidth))
            var label = win.Child as VBox;

            if (label == null)
            {
                requiredWidth = win.Allocation.Width;
            }

            requiredWidth = label.WidthRequest;
            xalign        = 0.5;
        }
Exemplo n.º 55
0
 /// <summary>
 /// Positions a dialog relative to its parent on platforms where default placement is known to be poor.
 /// </summary>
 public static void PlaceDialog(Gtk.Window child, Gtk.Window parent)
 {
     //HACK: Mac GTK automatic window placement is broken
     if (Platform.IsMac)
     {
         if (parent == null)
         {
             parent = GetDefaultParent(child);
         }
         if (parent != null)
         {
             CenterWindow(child, parent);
         }
     }
 }
Exemplo n.º 56
0
        //Run and destroy a standard confirmation dialog
        public static Gtk.ResponseType RunHigConfirmation(Gtk.Window parent,
                                                          Gtk.DialogFlags flags,
                                                          Gtk.MessageType type,
                                                          string header,
                                                          string msg,
                                                          string ok_caption)
        {
            HigMessageDialog hmd = new HigMessageDialog(parent, flags, type, header, msg, ok_caption);

            try {
                return((Gtk.ResponseType)hmd.Run());
            } finally {
                hmd.Destroy();
            }
        }
Exemplo n.º 57
0
        public SelectContainerDialog(Connection connection, Gtk.Window parent)
        {
            ui = new Glade.XML(null, "lat.glade", "selectContainerDialog", null);
            ui.Autoconnect(this);

            _ldapTreeview                        = new LdapTreeView(parent, connection);
            _ldapTreeview.dnSelected            += new dnSelectedHandler(ldapDNSelected);
            _ldapTreeview.BrowserSelectionMethod = (int)Preferences.Get(Preferences.BROWSER_SELECTION);

            browserScrolledWindow.AddWithViewport(_ldapTreeview);
            browserScrolledWindow.Show();

            selectContainerDialog.Resize(350, 400);
            selectContainerDialog.Icon = Global.latIcon;
        }
Exemplo n.º 58
0
    static void Main()
    {
        Application.Init();
        myWindow              = new Window("This is a window");
        myWindow.DeleteEvent += OnDelete;
        myWindow.SetDefaultSize(200, 200);

        //Put a button in the Window
        Button button = new Button("Imprimir");

        button.Clicked += OnButtonClicked;
        myWindow.Add(button);
        myWindow.ShowAll();
        Application.Run();
    }
Exemplo n.º 59
0
        public MessageDialog(DialogButtonType buttons, string primaryLabel, string secondaryLabel, MessageType messageType, Gtk.Window parent)
        {
            InicializeComponent();
            //if (parent == null) parent =MainClass.MainWindow;

            if (parent != null)
            {
                TransientFor = parent;
            }

            Buttons       = buttons;
            PrimaryText   = primaryLabel;
            SecondaryText = secondaryLabel;
            MessageType   = messageType;
        }
Exemplo n.º 60
0
        public static void Main(string[] args)
        {
            Application.Init();
            AddinManager.Initialize();

            AddinManagerWindow.AllowInstall = false;
            Gtk.Window win = new Gtk.Window(Gtk.WindowType.Toplevel);
//			win.Show ();

            AddinManagerWindow.Run(win);

            win.DeleteEvent += (o, evArgs) => Application.Quit();

            Application.Run();
        }