class PickersDemo
# Copyright © 2015-2016 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. #
Pickers¶ ↑
These widgets are mainly intended for use in preference dialogs. They allow to select colors, fonts, files, directories and applications.
Public Class Methods
new(main_window)
click to toggle source
# File gtk3/sample/gtk-demo/pickers.rb, line 11 def initialize(main_window) @window = Gtk::Window.new(:toplevel) @window.screen = main_window.screen @window.title = "Pickers" initialize_grid label = generate_label("Color:") picker = Gtk::ColorButton.new @table.attach(label, 0, 0, 1, 1) @table.attach(picker, 1, 0, 1, 1) label = generate_label("Font:") picker = Gtk::FontButton.new @table.attach(label, 0, 1, 1, 1) @table.attach(picker, 1, 1, 1, 1) label = generate_label("File:") picker = Gtk::FileChooserButton.new("Pick a file", :open) picker.local_only = true @table.attach(label, 0, 2, 1, 1) @table.attach(picker, 1, 2, 1, 1) label = generate_label("Folder:") picker = Gtk::FileChooserButton.new("Pick a folder", :select_folder) @table.attach(label, 0, 3, 1, 1) @table.attach(picker, 1, 3, 1, 1) label = generate_label("Mail:") picker = Gtk::AppChooserButton.new("x-scheme-handler/mailto") picker.show_dialog_item = true @table.attach(label, 0, 4, 1, 1) @table.attach(picker, 1, 4, 1, 1) end
Public Instance Methods
run()
click to toggle source
# File gtk3/sample/gtk-demo/pickers.rb, line 46 def run if !@window.visible? @window.show_all else @window.destroy end @window end