[ruby-gnome2-doc-cvs] [Hiki] update - Gtk::ScrolledWindow

Back to archive index

ruby-****@lists***** ruby-****@lists*****
2003年 4月 28日 (月) 13:21:24 JST


-------------------------
REMOTE_ADDR = 61.204.181.66
REMOTE_HOST = 
-------------------------

-------------------------
= class Gtk::ScrolledWindow
Gtk::ScrolledWindow is a Gtk::Bin subclass: it's a container the 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, 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 does not, 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). 

If a Gtk::ScrolledWindow doesn't behave quite as you would like, or doesn't have exactly the right layout, it's very possible to set up your own scrolling with Gtk::Scrollbar and for example a Gtk::Table. 

== super class
* ((<Gtk::Bin>))

== class methods
--- Gtk::ScrolledWindow.new(hadjustment = nil, vadjustment = nil)
    Creates a new scrolled window. 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. Usually you want to pass nil for the adjustments, which will cause the scrolled window to create them for you. 
    * hadjustment: Horizontal adjustment. (Gtk::Adjustment)
    * vadjustment: Vertical adjustment.  (Gtk::Adjustment)
    * Returns: New scrolled window.  

== public instance methods
--- add_with_viewport(child)
    Used to add children without native scrolling capabilities. This is simply a convenience method; it is equivalent to adding the unscrollable child to a viewport, then adding the viewport to the scrolled window. If a child has native scrolling, use Gtk::Container#add instead of this method. 

The viewport scrolls the child by moving its Gdk::Window, and takes the size of the child to be the size of its toplevel Gdk::Window. This will be very wrong for most widgets that support native scrolling; for example, if you add a widget such as Gtk::TreeView with a viewport, the whole widget will scroll, including the column headings. Thus, widgets with native scrolling support should not be used with the Gtk::Viewport proxy. 
    * child: Gtk::Widget you want to scroll.  

--- hadjustment
    Returns the horizontal scrollbar's adjustment, used to connect the horizontal scrollbar to the child widget's horizontal scroll functionality. 
    * Returns: The horizontal Gtk::Adjustment.  
--- hadjustment=(hadjustment)
    Sets the Gtk::Adjustment for the horizontal scrollbar. 
    * hadjustment : Horizontal scroll adjustment.  
    * Returns: hadjustment
--- set_hadjustment(hadjustment)
    Same as hadjustment=.
    * hadjustment : Horizontal scroll adjustment.  
    * Returns: self

--- vadjustment
    Returns the vertical scrollbar's adjustment, used to connect the vertical scrollbar to the child widget's vertical scroll functionality. 
    * Returns: The vertical Gtk::Adjustment.  
--- vadjustment=(vadjustment)
    Sets the GtkAdjustment for the vertical scrollbar. 
    * vadjustment: Vertical scroll adjustment.  
    * Returns: vadjustment
--- set_vadjustment(vadjustment)
    Same as vadjustment=.
    * vadjustment: Vertical scroll adjustment.  
    * Returns: self

--- policy
    Retrieves the current policy values for the horizontal and vertical scrollbars. See Gtk::ScrolledWindow#set_policy.
    * Returns: [hscrollbar_policy, vscrollbar_policy]
--- set_policy(hscrollbar_policy, vscrollbar_policy)
    Sets the scrollbar policy for the horizontal and vertical scrollbars. The policy determines when the scrollbar should appear; it is a value from the ((<GtkPolicyType|Gtk#GtkPolicyType>)) constants. If Gtk::POLICY_ALWAYS, the scrollbar is always present; if Gtk::POLICY_NEVER, the scrollbar is never present; if Gtk::POLICY_AUTOMATIC, the scrollbar is present only if needed (that is, if the slider part of the bar would be smaller than the trough - the display is larger than the page size). 
    * hscrollbar_policy: Policy for horizontal bar. (((<GtkPolicyType|Gtk#GtkPolicyType>))) 
    * vscrollbar_policy: Policy for vertical bar. (((<GtkPolicyType|Gtk#GtkPolicyType>)))
    * Returns: self

--- hscrollbar_policy
    Retrieves the current policy values for the horizontal scrollbar. See Gtk::ScrolledWindow#set_policy.
    * Returns: Policy for horizontal bar. (((<GtkPolicyType|Gtk#GtkPolicyType>))) 
--- hscrollbar_policy=(hscrollbar_policy)
    Sets the scrollbar policy for the horizontal scrollbar.
    * hscrollbar_policy: Policy for horizontal bar. (((<GtkPolicyType|Gtk#GtkPolicyType>))) 
    * Returns: hscrollbar_policy
--- set_hscrollbar_policy(vscrollbar_policy)
    Same as hscrollbar_policy=.
    * hscrollbar_policy: Policy for horizontal bar. (((<GtkPolicyType|Gtk#GtkPolicyType>))) 
    * Returns: self

--- vscrollbar_policy
    Retrieves the current policy values for the vertical scrollbar. See Gtk::ScrolledWindow#set_policy.
    * Returns: Policy for vertical bar. (((<GtkPolicyType|Gtk#GtkPolicyType>))) 
--- vscrollbar_policy=(vscrollbar_policy)
    Sets the scrollbar policy for the vertical scrollbar.
    * vscrollbar_policy: Policy for vertical bar. (((<GtkPolicyType|Gtk#GtkPolicyType>))) 
    * Returns: vscrollbar_policy
--- set_vscrollbar_policy(vscrollbar_policy)
    Same as vscrollbar_policy=.
    * vscrollbar_policy: Policy for vertical bar. (((<GtkPolicyType|Gtk#GtkPolicyType>))) 
    * Returns: self

--- shadow_type
    Gets the shadow type of the scrolled window. See Gtk::ScrolledWindow#shadow_type=.
    * Returns: the current shadow type  
--- shadow_type=(type)
    Changes the type of shadow drawn around the contents of scrolled_window.
    * type: kind of shadow to draw around scrolled window contents(((<GtkShadowType|Gtk#GtkShadowType>)))
    * Returns: type  

--- set_shadow_type(type)
    Same as shadow_type=.
    * type: kind of shadow to draw around scrolled window contents(((<GtkShadowType|Gtk#GtkShadowType>)))
    * Returns: self

--- window_placement
--- window_placement=(window_placement)
    Determines the location of the child widget with respect to the scrollbars. The default is Gtk::CORNER_TOP_LEFT, meaning the child is in the top left, with the scrollbars underneath and to the right. Other values in ((<GtkCornerType|Gtk#GtkCornerType>)) are Gtk::CORNER_TOP_RIGHT, Gtk::CORNER_BOTTOM_LEFT, and Gtk::CORNER_BOTTOM_RIGHT.
    * window_placement: Position of the child window. (((<GtkCornerType|Gtk#GtkCornerType>))) 
    * Returns: window_placement
--- set_window_placement(window_placement)
    Same as window_placement=.
    * window_placement: Position of the child window. (((<GtkCornerType|Gtk#GtkCornerType>))) 
    * Returns: self

== See Also
Gtk::Viewport, Gtk:Adjustment


((<Masao>))




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