class Section

Public Class Methods

new(container, title) click to toggle source
# File gtk3/sample/gtk-demo/cursors.rb, line 98
def initialize(container, title)
  label = Gtk::Label.new(title)
  label.xalign = 0
  label.margin_top = 10
  label.margin_bottom = 10
  container.pack_start(label, :expand => false, :fill => true, :padding => 0)
  initialize_section
  container.pack_start(@section,
                       :expand => false, :fill => true, :padding => 0)
end

Public Instance Methods

add_button(css_name) click to toggle source
# File gtk3/sample/gtk-demo/cursors.rb, line 109
def add_button(css_name)
  cursor = Gdk::Cursor.new(css_name)
  image = nil
  if !cursor
    image = Gtk::Image.new(:icon_name => "image-missing", :size => :menu)
  else
    path = "/cursors/#{css_name.tr('-', '_')}_cursor.png"
    image = Gtk::Image.new(:resource => path)
  end
  image.set_size_request(32, 32)

  button = Gtk::Button.new
  button.add(image)
  button.style_context.add_class("image-button")
  button.signal_connect("clicked") do |_widget|
    apply_cursor(cursor)
  end
  button.set_tooltip_text(css_name)
  @section.add(button)
end