[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-txtw-scrolledwin

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 13日 (木) 11:14:19 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-scrolledwin
-------------------------
@@ -17,6 +17,22 @@
     * page_increment: the increment to use to make major changes to the value. In a Gtk::Scrollbar this increment is used when the mouse is clicked in the trough, to scroll by a large amount.  
     * page_size: the page size. In a Gtk::Scrollbar this is the size of the area which is currently visible.
 
+#######
+:The API for Gtk::ScrolledWindow best explains the relationships between scrolling related widgets (Gtk::ScrolledWindow, Gtk::Viewport, Gtk::Scrollbar and Gtk::Adjustment):
+
+    Gtk::ScrolledWindow is a Gtk::Bin subclass: it is a container that accepts a single child widget. Gtk::ScrolledWindow adds scrollbars to the child widget and optionally draws a beveled frame around the child widget.
+
+    The scrolled window can work in two ways. Some widgets have native scrolling support; these widgets have "slots" for Gtk::Adjustment objects. Widgets with native scroll support include Gtk::TreeView, Gtk::TextView, Gtk::IconView, and Gtk::Layout.
+
+    For widgets that lack native scrolling support, the Gtk::Viewport widget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use Gtk::Viewport to scroll child widgets such as Gtk::Table, Gtk::Box, and so on.
+
+    If a widget has native scrolling abilities, it can be added to the Gtk::ScrolledWindow with Gtk::Container#add. If a widget is lacking native scrolling, you must first add the widget to a Gtk::Viewport, then add the Gtk::Viewport to the scrolled window. The convenience method Gtk::ScrolledWindow#add_with_viewport does exactly this, so you can ignore the presence of the viewport.
+
+    The position of the scrollbars is controlled by the scroll adjustments. See Gtk::Adjustment for the fields in an adjustment - for Gtk::Scrollbar, used by Gtk::ScrolledWindow, the "value" field represents the position of the scrollbar, which must be between the "lower" field and "upper - page_size." The "page_size" field represents the size of the visible scrollable area. The "step_increment" and "page_increment" fields are used when the user asks to step down (using the small stepper arrows) or page down (using for example the PageDown key). 
+#######
+
+
+
 
 The following listing demonstrates how to use scrolled windows and viewports. As the scrollbar is moved, the viewport will scroll as well because adjustments are synchronized. New scrolled windows are created with:   Gtk::ScrolledWindow.new(hadjustment = nil, vadjustment = nil), where the two arguments are the scrolled window's adjustments; these will be shared with the scrollbars and the child widget to keep the bars in sync with the child. Though you could supply adjustments you previously created, usually you do not specify any arguments, hence using the default nil(s) instead, which causes the scrolled window to create them for you. In our example the adjustments are used when viewport is created with Gtk::Viewport.new(horizontal, vertical). The viewport adjustments are initialized with those from the scrolled window, ensuring that both containers will be scrolled at the same time.
 




ruby-gnome2-cvs メーリングリストの案内
Back to archive index