class Demo::CssBasics
Public Class Methods
new()
click to toggle source
Calls superclass method
Demo::BasicWindow.new
# File gtk3/sample/gtk-demo/css_basics.rb, line 33 def initialize super("CSS Basics") set_default_size(400, 300) text = Gtk::TextBuffer.new text.create_tag("warning", "underline" => Pango::AttrUnderline::SINGLE) text.create_tag("error", "underline" => Pango::AttrUnderline::ERROR) provider = Gtk::CssProvider.new container = Gtk::ScrolledWindow.new(nil, nil) add(container) child = Gtk::TextView.new(text) container.add(child) text.signal_connect("changed") do |_text| css_text_changed(_text, provider) end text.text = File.read(File.join(__dir__, "css_basics.css")) provider.signal_connect("parsing-error") do |_provider, section, error| p section p error show_parsing_error(section, error, child.buffer) end apply_css(self, provider) end