Sha256: 79d40f5f5fca7c5c0801261c83ded1d72858a5f5e1b1c5c3f4078916b9fc1fcb

Contents?: true

Size: 1.33 KB

Versions: 11

Compression:

Stored size: 1.33 KB

Contents

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

  Copyright (c) 2002-2018 Ruby-GNOME2 Project Team
  This program is licenced under the same licence as Ruby-GNOME2.
=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

#
# Gtk::CalendarDisplayOptions::WEEK_START_MONDAY does not exist anymore
#

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

11 entries across 11 versions & 1 rubygems

Version Path
gtk3-3.4.1 sample/misc/calendar.rb
gtk3-3.4.0 sample/misc/calendar.rb
gtk3-3.3.9 sample/misc/calendar.rb
gtk3-3.3.8 sample/misc/calendar.rb
gtk3-3.3.7 sample/misc/calendar.rb
gtk3-3.3.6 sample/misc/calendar.rb
gtk3-3.3.5 sample/misc/calendar.rb
gtk3-3.3.4 sample/misc/calendar.rb
gtk3-3.3.3 sample/misc/calendar.rb
gtk3-3.3.2 sample/misc/calendar.rb
gtk3-3.3.1 sample/misc/calendar.rb