Class: GerminalFontSelector
- Inherits:
-
Gtk::Box
- Object
- Gtk::Box
- GerminalFontSelector
- Defined in:
- lib/font_selector.rb
Overview
Copyright 2015-2016 Cédric LE MOIGNE, [email protected] This file is part of Germinal.
Germinal is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
Germinal is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Germinal. If not, see <www.gnu.org/licenses/>.
Instance Attribute Summary collapse
-
#font ⇒ Object
readonly
Returns the value of attribute font.
Instance Method Summary collapse
-
#initialize(window) ⇒ GerminalFontSelector
constructor
A new instance of GerminalFontSelector.
Constructor Details
#initialize(window) ⇒ GerminalFontSelector
Returns a new instance of GerminalFontSelector.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/font_selector.rb', line 18 def initialize(window) @window = window @font = @window.notebook.current.font super(:horizontal, 0) = Gtk::Button.new(:label => "Reset") .signal_connect "clicked" do font_desc = Pango::FontDescription.new(@font) @window.notebook.current.set_font(font_desc) end pack_start(, :expand => false, :fill => false, :padding => 0) = Gtk::FontButton.new .set_font(@font) .set_show_style(true) .set_show_size(true) .set_use_font(true) .set_use_size(false) .signal_connect "font-set" do font_desc = Pango::FontDescription.new(.font_name) @window.notebook.current.set_font(font_desc) end pack_start(, :expand => false, :fill => false, :padding => 0) = Gtk::Button.new(:label => "Save") .signal_connect "clicked" do new_props={} font = @window.notebook.current.font new_props["-GerminalTerminal-font"] = font.to_s toplevel.application.update_css(new_props) toplevel.notebook.each do |tab| if tab.class == GerminalTerminal tab.set_font(font) end end toplevel. end pack_start(, :expand => false, :fill => false, :padding => 0) set_name("font_selector") show_all set_halign(:center) set_valign(:end) end |
Instance Attribute Details
#font ⇒ Object (readonly)
Returns the value of attribute font.
17 18 19 |
# File 'lib/font_selector.rb', line 17 def font @font end |