Sha256: e59e913ee81ba12d5b3df30002bd64c68107af8d7a0520407d2a95dfe1cc1aed

Contents?: true

Size: 1.61 KB

Versions: 38

Compression:

Stored size: 1.61 KB

Contents

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

  Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
  This program is licenced under the same licence as Ruby-GNOME2.

  $Id: calendar.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
=end

require 'gtk3'

cal = Gtk::Calendar.new

w = Gtk::Window.new("Calendar sample")
w.add(cal).show_all.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::Calendar::DisplayOptions::WEEK_START_MONDAY does not exist anymore
#

cal.set_display_options(Gtk::Calendar::DisplayOptions::SHOW_HEADING |
                Gtk::Calendar::DisplayOptions::SHOW_DAY_NAMES |
                Gtk::Calendar::DisplayOptions::NO_MONTH_CHANGE |
                Gtk::Calendar::DisplayOptions::SHOW_WEEK_NUMBERS)
year, month, day = cal.date
puts "this is #{month} #{day}, #{year}"

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

Gtk.main

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
gtk3-2.2.5-x64-mingw32 sample/misc/calendar.rb
gtk3-2.2.5-x86-mingw32 sample/misc/calendar.rb
gtk3-2.2.5 sample/misc/calendar.rb
gtk3-2.2.4-x64-mingw32 sample/misc/calendar.rb
gtk3-2.2.4-x86-mingw32 sample/misc/calendar.rb
gtk3-2.2.4 sample/misc/calendar.rb
gtk3-2.2.3-x86-mingw32 sample/misc/calendar.rb
gtk3-2.2.3 sample/misc/calendar.rb
gtk3-2.2.2-x86-mingw32 sample/misc/calendar.rb
gtk3-2.2.2 sample/misc/calendar.rb
gtk3-2.2.1-x86-mingw32 sample/misc/calendar.rb
gtk3-2.2.1 sample/misc/calendar.rb
gtk3-2.2.0-x86-mingw32 sample/misc/calendar.rb
gtk3-2.2.0 sample/misc/calendar.rb
gtk3-2.1.0-x86-mingw32 sample/misc/calendar.rb
gtk3-2.1.0 sample/misc/calendar.rb
gtk3-2.0.3-x86-mingw32 sample/misc/calendar.rb
gtk3-2.0.3 sample/misc/calendar.rb
gtk3-2.0.2-x86-mingw32 sample/misc/calendar.rb
gtk3-2.0.2 sample/misc/calendar.rb