Sha256: 76a60bcc8aa8e48b347b07c252dd38aae34c4a4a2d4b0b97d50e570f54c628fd

Contents?: true

Size: 1.26 KB

Versions: 38

Compression:

Stored size: 1.26 KB

Contents

=begin
  calendar.rb - Gtk::Calendar sample script.

  Copyright (c) 2002-2020 Ruby-GNOME Project Team
  This program is licenced under the same licence as Ruby-GNOME.
=end

require "gtk3"

cal = Gtk::Calendar.new

window = Gtk::Window.new("Calendar sample")
window.add(cal)
window.show_all
window.signal_connect("delete_event") do
  Gtk.main_quit
end

date = Time.new

cal.select_month(date.month, date.year)
cal.select_day(date.day)
cal.mark_day(date.day)
# cal.clear_marks

cal.set_display_options(Gtk::CalendarDisplayOptions::SHOW_HEADING |
                        Gtk::CalendarDisplayOptions::SHOW_DAY_NAMES |
                        Gtk::CalendarDisplayOptions::SHOW_WEEK_NUMBERS)

puts "this is #{cal.month} #{cal.day}, #{cal.year}"

cal.signal_connect("day_selected") do
  puts "selected day: #{cal.day}"
end
cal.signal_connect("month_changed") do
  puts "changed month: #{cal.month}"
end
cal.signal_connect("day_selected_double_click") do
  puts "dclicked day: #{cal.day}"
end
cal.signal_connect("prev_month") do
  puts "prev month: #{cal.month}"
end
cal.signal_connect("next_month") do
  puts "next_month: #{cal.month}"
end
cal.signal_connect("prev_year") do
  puts "prev_year: #{cal.year}"
end
cal.signal_connect("next_year") do
  puts "next year: #{cal.year}"
end

Gtk.main

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
gtk3-4.2.7 sample/misc/calendar.rb
gtk3-4.2.6 sample/misc/calendar.rb
gtk3-4.2.5 sample/misc/calendar.rb
gtk3-4.2.4 sample/misc/calendar.rb
gtk3-4.2.3 sample/misc/calendar.rb
gtk3-4.2.2 sample/misc/calendar.rb
gtk3-4.2.1 sample/misc/calendar.rb
gtk3-4.2.0 sample/misc/calendar.rb
gtk3-4.1.9 sample/misc/calendar.rb
gtk3-4.1.8 sample/misc/calendar.rb
gtk3-4.1.7 sample/misc/calendar.rb
gtk3-4.1.6 sample/misc/calendar.rb
gtk3-4.1.5 sample/misc/calendar.rb
gtk3-4.1.4 sample/misc/calendar.rb
gtk3-4.1.3 sample/misc/calendar.rb
gtk3-4.1.2 sample/misc/calendar.rb
gtk3-4.1.1 sample/misc/calendar.rb
gtk3-4.1.0 sample/misc/calendar.rb
gtk3-4.0.9 sample/misc/calendar.rb
gtk3-4.0.8 sample/misc/calendar.rb