void OnVerticalToolbar(object sender, System.EventArgs args) { if (toolbar.InitCompleted == false) { return; } const Gtk.Orientation orientation = Gtk.Orientation.Vertical; if ((Gtk.Orientation)Preferences.Get <int> (Preferences.ToolbarOrientationKey) != orientation) { Preferences.Set <int> (Preferences.ToolbarOrientationKey, (int)orientation); Preferences.Save(); } toolbar.Attach(orientation); }
void BuildUI() { bool show_toolbar; GtkBeans.Builder builder = new GtkBeans.Builder ("gbrainy.ui"); builder.Autoconnect (this); show_toolbar = Preferences.Get <bool> (Preferences.ToolbarShowKey) == true && low_res == false; // 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; GameSensitiveUI (); // For low resolutions, hide the toolbar and made the drawing area smaller if (drawing_area.Screen.Width> 0 && drawing_area.Screen.Height > 0) { if (drawing_area.Screen.Height < 700) { drawing_vbox.HeightRequest = 350; low_res = true; } } 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 && low_res == false; // 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) { Mono.Addins.Gui.AddinManagerWindow.Run (app_window); GameManagerPreload (session.GameManager); CustomGameDialog.Clear (); }; #else extensions_menuitem.Visible = false; #endif ActiveInputControls (false); }
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; } extensions_menuitem.Visible = false; ActiveInputControls(false); }
void BuildUI() { bool show_toolbar; GtkBeans.Builder builder = new GtkBeans.Builder("gbrainy.ui"); builder.Autoconnect(this); show_toolbar = Preferences.Get <bool> (Preferences.ToolbarShowKey) == true && low_res == false; // 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; GameSensitiveUI(); // For low resolutions, hide the toolbar and made the drawing area smaller if (drawing_area.Screen.Width > 0 && drawing_area.Screen.Height > 0) { if (drawing_area.Screen.Height < 700) { drawing_vbox.HeightRequest = 350; low_res = true; } } 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 && low_res == false; // 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) { Mono.Addins.Gui.AddinManagerWindow.Run(app_window); GameManagerPreload(session.GameManager); CustomGameDialog.Clear(); }; #else extensions_menuitem.Visible = false; #endif ActiveInputControls(false); }