예제 #1
0
        void OnCustomGame(object sender, EventArgs args)
        {
            CustomGameDialog dialog;

            dialog = new CustomGameDialog(Translations, session);
            dialog.Run();
            dialog.Destroy();

            if (dialog.SelectionDone == true)
            {
                OnNewGame(GameSession.Types.Custom);
            }
        }
예제 #2
0
파일: gbrainy.cs 프로젝트: nated099/gbrainy
        void BuildUI()
        {
            bool show_toolbar;

            Builder builder = new Builder("gbrainy.ui");

            builder.Autoconnect(this);

            show_toolbar = Preferences.Get <bool> (Preferences.ToolbarShowKey) == true;

            // Toolbar creation
            toolbar = new Widgets.Toolbar(main_hbox, framework_vbox);
            toolbar.Attach((Gtk.Orientation)Preferences.Get <int> (Preferences.ToolbarOrientationKey));
            toolbar.AllButton.Clicked         += OnAllGames;
            toolbar.LogicButton.Clicked       += OnLogicOnly;
            toolbar.CalculationButton.Clicked += OnMathOnly;
            toolbar.MemoryButton.Clicked      += OnMemoryOnly;
            toolbar.VerbalButton.Clicked      += OnVerbalOnly;
            toolbar.PauseButton.Clicked       += OnPauseGame;
            toolbar.FinishButton.Clicked      += OnEndGame;

            drawing_area          = new GameDrawingArea();
            drawing_area.Drawable = session;
            drawing_area.Vexpand  = true;
            drawing_area.SetSizeRequest(drawing_vbox.WidthRequest, drawing_vbox.HeightRequest);
            GameSensitiveUI();

            EventBox eb = new EventBox();              // Provides a window for drawing area windowless widget

            eb.Events = Gdk.EventMask.PointerMotionMask;
            drawing_vbox.Add(eb);

            eb.Add(drawing_area);

            eb.MotionNotifyEvent += OnMouseMotionEvent;
            eb.ButtonPressEvent  += OnHandleButtonPress;

            show_toolbar = Preferences.Get <bool> (Preferences.ToolbarShowKey) == true;

            // We only disable the Arrow if we are going to show the toolbar.
            // It has an impact on the total window width size even if we do not show it
            if (show_toolbar)
            {
                toolbar.ShowArrow = false;
            }

            app_window.IconName = "gbrainy";

            app_window.ShowAll();

            toolbar_orientation_menuitem.Sensitive = toolbar.Visible;

            // Check default radio button
            switch (toolbar.Orientation)
            {
            case Gtk.Orientation.Vertical:
                vertical_radiomenuitem.Active = true;
                break;

            case Gtk.Orientation.Horizontal:
                horizontal_radiomenuitem.Active = true;
                break;

            default:
                throw new InvalidOperationException();
            }

            // The toolbar by default is enabled. By setting this menu entry to false
            // triggers the OnActivateToolbar event that hides the toolbar
            if (show_toolbar == false)
            {
                showtoolbar_menuitem.Active = false;
            }

                #if MONO_ADDINS
            extensions_menuitem.Activated += delegate(object sender, EventArgs ar)
            {
                if (pluggins_loaded == false)
                {
                    session.GameManager.LoadPlugins();
                }
                Mono.Addins.Gui.AddinManagerWindow.Run(app_window);
                GameManagerPreload(session.GameManager);
                CustomGameDialog.Clear();
            };
                #else
            extensions_menuitem.Visible = false;
                #endif
            ActiveInputControls(false);
        }