ruby-****@sourc*****
ruby-****@sourc*****
2009年 3月 9日 (月) 04:42:25 JST
------------------------- REMOTE_ADDR = 74.15.84.244 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-agtkw-cal ------------------------- TITLE = tut-gtk2-agtkw-cal KEYWORD = = Additional GTK+ Widgets {{link "tut-gtk2-agtkw-draww", "tut-gtk2-agtkw", "tut-gtk", "tut-gtk2-agtkw-prtsupp"}} == Calendars GTK+ provides the Gtk::Calendar widget, which is a widget that displays one month of a calendar. It allows the user to move among months and years with scroll arrows. You can also display three letter abbreviations of the day names and week numbers for the chosen year. {{image_left("agtkw-01-cal.png")}} {{br}} Following is a simple example from the original Japanese tutorial Ruby/GNOME2 site. ((*calendar_modes.rb*)) #!/usr/bin/env ruby require 'gtk2' window = Gtk::Window.new window.signal_connect("delete_event") {Gtk.main_quit} hbox = Gtk::HBox.new(false, 10) window.add(hbox) flag = 0 [ Gtk::Calendar::SHOW_HEADING, Gtk::Calendar::SHOW_DAY_NAMES, Gtk::Calendar::NO_MONTH_CHANGE, Gtk::Calendar::SHOW_WEEK_NUMBERS, Gtk::Calendar::WEEK_START_MONDAY, ].each do |f| c = Gtk::Calendar.new flag |= f c.display_options(flag) hbox.pack_start(c, true, true, 0) end window.show_all Gtk.main == Status Icons The Gtk::StatusIcon object was introduced in GTK+ 2.10 and is used to display an icon in the system tray (notification area) in a platform-independent manner. The "system tray" or notification area is normally used for transient icons that indicate some special state. For example, a system tray icon might appear to tell the user that they have new mail, or have an incoming instant message, or something along those lines. The basic idea is that creating an icon in the notification area is less annoying than popping up a dialogue. A Gtk::StatusIcon object can be used to display an icon in a "system tray". The icon can have a tool-tip, and the user can interact with it by activating it or popping up a context menu. Critical information should not solely be displayed in a Gtk::StatusIcon, since it may not be visible (e.g. when the user doesn't have a notification area on his panel). This can be checked with Gtk::StatusIcon#embedded?. On X11, the implementation follows the freedesktop.org "System Tray" specification. Implementations of the "tray" side of this specification can be found e.g. in the GNOME and KDE panel applications. It will also show up in the Dock or the System tray on Mac OSX and Windows, respectively. Note that a Gtk::StatusIcon is not a widget, but just a GLib::Object. Making it a widget would be impractical, since the system tray on Win32 doesn't allow to embed arbitrary widgets.