Esempio n. 1
0
        public static void NextPlayer(string name)
        {
            var but = new Gtk.Button( );

            but.TooltipMarkup = "Po kliknutí bude hrát další hráč";
            HBox hbox = new HBox();

            global::Gtk.Image im = new global::Gtk.Image();
            Label             l  = new Label();

            l.Markup = "Na tahu je hráč:\n <b>" + name + "</b>\n\nOK";
            hbox.PackStart(im);
            hbox.PackEnd(l);
            but.Add(hbox);
            var win = new Gtk.Window(Gtk.WindowType.Toplevel);

            but.Clicked += delegate {
                win.HideAll();
                win.Dispose();
                win.Destroy();
            };
            win.Add(but);
            win.Fullscreen();
            win.ShowAll();
        }
Esempio n. 2
0
        public static void AddNewWordToDic(object sender, EventArgs e)
        {
            var win = new Gtk.Window("Přidej slovo");

            win.SetPosition(WindowPosition.Mouse);
            Label l = new Label();

            l.Text = "Vloží slovo do aktuálně načteného slovníku, avšak nezmění zdroj (např. soubor dic.txt )";

            Entry  entry = new Entry();
            Button b     = new Button("Přidej");
            VBox   vbox  = new VBox();
            HBox   hbox  = new HBox();

            vbox.BorderWidth = 10;

            vbox.PackStart(l);
            vbox.PackEnd(hbox);

            hbox.PackStart(entry);
            hbox.PackEnd(b);

            b.Clicked += delegate {
                game.dictionary.Add(entry.Text);
                win.HideAll();
                win.Destroy();
                win.Dispose();
            };

            win.Add(vbox);
            win.ShowAll();
        }
Esempio n. 3
0
 public void Dispose()
 {
     win?.Dispose();
     win = null;
     app?.Dispose();
     app = null;
 }
Esempio n. 4
0
        public void ActionCancel(object sender, EventArgs args)
        {
            GlobalObj.CloseConnection();

            MainWindow.Destroy();
            MainWindow.Dispose();
            Application.Quit();
        }
Esempio n. 5
0
 protected virtual void Cleanup()
 {
     System.Windows.Forms.Application.Idle -= HandleSystemWindowsFormsApplicationIdle;
     if (m_popupWindow != null)
     {
         m_popupWindow.Destroy();
         m_popupWindow.Dispose();
     }
 }
Esempio n. 6
0
        public void Dispose()
        {
            window.ExposeEvent -= HandleWindowExposeEvent;
            DockServices.Theme.ThemeChanged -= DockyControllerThemeChanged;

            currentSurface = null;

            if (window != null)
            {
                window.Destroy();
                window.Dispose();
                window = null;
            }
            if (slices != null)
            {
                foreach (DockySurface s in slices)
                {
                    s.Dispose();
                }
                slices = null;
            }
            ResetBackgroundBuffer();
        }
Esempio n. 7
0
 /// <summary>
 /// Close GtkWindows
 /// </summary>
 public void ActionCancel(object sender, EventArgs args)
 {
     AboutDialog.Destroy();
     AboutDialog.Dispose();
 }
Esempio n. 8
0
        private void PushButton(object sender, EventArgs e)
        {
            Gtk.CheckButton check  = new Gtk.CheckButton("Down");
            Gtk.Entry       input  = new Gtk.Entry(15);
            Gtk.HBox        divide = new Gtk.HBox(false, 0);
            Gtk.Button      but    = new Gtk.Button("OK");

            input.Activated += delegate {
                but.Click();
            };

            divide.PackStart(input);
            divide.Add(check);
            divide.PackEnd(but);

            Gtk.Window w = new Gtk.Window(Gtk.WindowType.Popup);
            w.SetPosition(WindowPosition.Mouse);

            w.Add(divide);

            w.BorderWidth = 0;
            w.Modal       = true;
            w.CanFocus    = true;
            w.ShowAll();

            but.Clicked += delegate {
                if (input.Text == "")
                {
                    return;
                }
                int      i, j;
                string[] name = ((Gtk.Button)sender).Name.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                i = int.Parse(name [1]);
                j = int.Parse(name [2]);

                w.HideAll();


                if (this.game.GetActualPlayer().DoMove(
                        new Lexicon.Move(new System.Drawing.Point(i - 1, j - 1), input.Text.ToUpperInvariant(), check.Active))
                    )
                {
                    w.Destroy();
                    if (!Scrabble.Game.InitialConfig.client)
                    {
                        this.game.changePlayer();
                    }
                }
            };

            w.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                switch (args.Event.Key)
                {
                case Gdk.Key.Escape:
                    w.HideAll();
                    w.Dispose();
                    w.Destroy();
                    break;
                }
            };
        }
Esempio n. 9
0
        public static void CheckWordDialog(object sender, EventArgs e)
        {
            var lab = new Gtk.Label("Zadejte slovo: ");
            var ent = new Gtk.Entry();
            var but = new Gtk.Button("OK");
            var div = new Gtk.HBox(false, 1 );
            div.PackStart( lab );
            div.Add( ent );
            div.PackEnd( but );
            var checkWin = new Gtk.Window( Gtk.WindowType.Popup );
            checkWin.Add ( div );
            checkWin.BorderWidth = 0;
            checkWin.Modal = true;
            checkWin.CanFocus = true;
            checkWin.SetPosition( WindowPosition.Mouse );
            checkWin.ShowAll();
            ent.Activated += delegate {
                but.Click();
            };
            but.Clicked += delegate {
                checkWin.HideAll();

                if( game.dictionary.Content( ent.Text ) ) {
                    Gtk.MessageDialog ans = new Gtk.MessageDialog(
                            game.Window,
                            DialogFlags.DestroyWithParent,
                            MessageType.Info,
                            ButtonsType.Close,
                            "Slovo \""+ent.Text+"\" <b>je</b> ve slovníku"
                        );
                    ans.Run();
                    ans.Destroy();
                }
                else {
                    Gtk.MessageDialog ans = new Gtk.MessageDialog(
                            game.Window,
                            DialogFlags.DestroyWithParent,
                            MessageType.Info,
                            ButtonsType.Close,
                            "Slovo \""+ent.Text+"\" <b>není</b> ve slovníku"
                        );
                    ans.Run();
                    ans.Destroy();
                }
                checkWin.Dispose();
                checkWin.Destroy();
            };

            checkWin.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                switch( args.Event.Key ) {
                case Gdk.Key.Escape:
                    checkWin.HideAll();
                    checkWin.Dispose();
                    checkWin.Destroy();
                    break;
                case Gdk.Key.ISO_Enter:
                    but.Click();
                    break;
                }
            };
        }
Esempio n. 10
0
        public static void AddNewWordToDic(object sender, EventArgs e)
        {
            var win = new Gtk.Window("Přidej slovo");
            win.SetPosition( WindowPosition.Mouse );
            Label l = new Label();
            l.Text = "Vloží slovo do aktuálně načteného slovníku, avšak nezmění zdroj (např. soubor dic.txt )";

            Entry entry = new Entry();
            Button b = new Button("Přidej");
            VBox vbox = new VBox();
            HBox hbox = new HBox();
            vbox.BorderWidth = 10;

            vbox.PackStart( l );
            vbox.PackEnd( hbox );

            hbox.PackStart( entry );
            hbox.PackEnd( b );

            b.Clicked += delegate {
                game.dictionary.Add( entry.Text );
                win.HideAll();
                win.Destroy();
                win.Dispose();
            };

            win.Add(vbox);
            win.ShowAll();
        }
Esempio n. 11
0
        public static void NextPlayer(string name)
        {
            var but = new Gtk.Button( );
            but.TooltipMarkup = "Po kliknutí bude hrát další hráč";
            HBox hbox = new HBox();
            global::Gtk.Image im = new global::Gtk.Image ();
            Label l = new Label();
            l.Markup = "Na tahu je hráč:\n <b>" + name + "</b>\n\nOK";
            hbox.PackStart( im );
            hbox.PackEnd( l );
            but.Add( hbox );
            var win = new Gtk.Window( Gtk.WindowType.Toplevel );

            but.Clicked += delegate {
                win.HideAll();
                win.Dispose();
                win.Destroy();
            };
            win.Add( but );
            win.Fullscreen();
            win.ShowAll();
        }
Esempio n. 12
0
 /// <summary>
 /// Close GtkWindows
 /// </summary>
 public void ActionCancel(object sender, EventArgs args)
 {
     SettingsDialog.Destroy();
     SettingsDialog.Dispose();
 }
Esempio n. 13
0
        public static void CheckWordDialog(object sender, EventArgs e)
        {
            var lab = new Gtk.Label("Zadejte slovo: ");
            var ent = new Gtk.Entry();
            var but = new Gtk.Button("OK");
            var div = new Gtk.HBox(false, 1);

            div.PackStart(lab);
            div.Add(ent);
            div.PackEnd(but);
            var checkWin = new Gtk.Window(Gtk.WindowType.Popup);

            checkWin.Add(div);
            checkWin.BorderWidth = 0;
            checkWin.Modal       = true;
            checkWin.CanFocus    = true;
            checkWin.SetPosition(WindowPosition.Mouse);
            checkWin.ShowAll();
            ent.Activated += delegate {
                but.Click();
            };
            but.Clicked += delegate {
                checkWin.HideAll();

                if (game.dictionary.Content(ent.Text))
                {
                    Gtk.MessageDialog ans = new Gtk.MessageDialog(
                        game.Window,
                        DialogFlags.DestroyWithParent,
                        MessageType.Info,
                        ButtonsType.Close,
                        "Slovo \"" + ent.Text + "\" <b>je</b> ve slovníku"
                        );
                    ans.Run();
                    ans.Destroy();
                }
                else
                {
                    Gtk.MessageDialog ans = new Gtk.MessageDialog(
                        game.Window,
                        DialogFlags.DestroyWithParent,
                        MessageType.Info,
                        ButtonsType.Close,
                        "Slovo \"" + ent.Text + "\" <b>není</b> ve slovníku"
                        );
                    ans.Run();
                    ans.Destroy();
                }
                checkWin.Dispose();
                checkWin.Destroy();
            };

            checkWin.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                switch (args.Event.Key)
                {
                case Gdk.Key.Escape:
                    checkWin.HideAll();
                    checkWin.Dispose();
                    checkWin.Destroy();
                    break;

                case Gdk.Key.ISO_Enter:
                    but.Click();
                    break;
                }
            };
        }