Beispiel #1
0
        static void clicked(GtkApplication app, Void *userdata)
        {
            var dialog = (GtkDialog *)gtk_message_dialog_new(null,
                                                             GtkDialogFlags.GTK_DIALOG_DESTROY_WITH_PARENT,
                                                             GtkMessageType.GTK_MESSAGE_INFO,
                                                             GtkButtonsType.GTK_BUTTONS_OK,
                                                             "Hello World!");

            gtk_dialog_run(dialog);
            gtk_widget_destroy(dialog);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            GtkApplication.Init(args.Length, args);

            var builder = new UiBuilder();

            builder.AddFromFile("builder.ui", IntPtr.Zero);

            var window = builder.GetObject("window", l => new Window(l));

            window.ConnectSignal("destroy", GtkApplication.Quit, IntPtr.Zero, FreeData);

            var button = builder.GetObject("button1", l => new Button(l));

            button.ConnectSignal("clicked", PrintHello, IntPtr.Zero, FreeData);

            button = builder.GetObject("button2", l => new Button(l));
            button.ConnectSignal("clicked", PrintHello, IntPtr.Zero, FreeData);

            button = builder.GetObject("quit", l => new Button(l));
            button.ConnectSignal("clicked", GtkApplication.Quit, IntPtr.Zero, FreeData);

            GtkApplication.Run();
        }
 /// <summary>
 /// Initializes the application.
 /// </summary>
 public static void Init()
 {
     app = new GtkApplication();
     Application.Register(app, OperatingSystem.Linux);
 }