The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Hide scrollbar when menu is open

These changes was commited to the Birdfont repository Sat, 28 Nov 2015 13:05:24 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 28 Nov 2015 13:05:24 +0000 (14:05 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 28 Nov 2015 13:05:24 +0000 (14:05 +0100)
commit c340ed28fe6a998b5a9ae73632652c1de6309242
tree 7c56be95990732fdf09d37759f6013d977f5115a
parent 7d1b07665a639815862d05b5b90c1c91b16327db
Hide scrollbar when menu is open

libbirdfont/AbstractMenu.vala
libbirdfont/MainWindow.vala
--- a/libbirdfont/AbstractMenu.vala +++ b/libbirdfont/AbstractMenu.vala @@ -36,11 +36,15 @@ if (tab_name == "Preview") { MenuTab.select_overview (); } + + MainWindow.hide_scrollbar (); + } else { + MainWindow.show_scrollbar (); } } } - public bool menu_visibility = false; + private bool menu_visibility = false; public SubMenu top_menu; SubMenu current_menu; @@ -219,7 +223,7 @@ y += height; } - menu_visibility = false; + show_menu = false; current_menu = (!) top_menu; GlyphCanvas.redraw (); }
--- a/libbirdfont/MainWindow.vala +++ b/libbirdfont/MainWindow.vala @@ -36,6 +36,8 @@ /** Number of pixels per mm */ public static double units = 1; + private static double scrollbar_size = -1; + public MainWindow () { singleton = this; @@ -248,10 +250,23 @@ public static void file_chooser (string title, FileChooser fc, uint flags) { MainWindow.native_window.file_chooser (title, fc, flags); + } + + public static void hide_scrollbar () { + if (!is_null (MainWindow.native_window)) { + MainWindow.native_window.set_scrollbar_size (-1); + } + } + + public static void show_scrollbar () { + if (!is_null (MainWindow.native_window)) { + MainWindow.native_window.set_scrollbar_size (scrollbar_size); + } } public static void set_scrollbar_size (double size) { if (!is_null (MainWindow.native_window)) { + scrollbar_size = size; MainWindow.native_window.set_scrollbar_size (size); } }