gtkscrolledwindow.html

来自「最新gtk中文资料集」· HTML 代码 · 共 948 行 · 第 1/4 页

HTML
948
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>GtkScrolledWindow</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GTK+ Reference Manual"><link rel="up" href="ScrollingWidgets.html" title="Scrolling"><link rel="prev" href="GtkVScrollbar.html" title="GtkVScrollbar"><link rel="next" href="Printing.html" title="Printing"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="gtk.html" title="Part&#160;I.&#160;GTK+ Overview"><link rel="part" href="gtkbase.html" title="Part&#160;II.&#160;GTK+ Core Reference"><link rel="part" href="gtkobjects.html" title="Part&#160;III.&#160;GTK+ Widgets and Objects"><link rel="chapter" href="ch01.html" title="Object Hierarchy"><link rel="chapter" href="ch02.html" title="Widget Gallery"><link rel="chapter" href="WindowWidgets.html" title="Windows"><link rel="chapter" href="DisplayWidgets.html" title="Display Widgets"><link rel="chapter" href="ButtonWidgets.html" title="Buttons and Toggles"><link rel="chapter" href="NumericEntry.html" title="Numeric/Text Data Entry"><link rel="chapter" href="TextWidgetObjects.html" title="Multiline Text Editor"><link rel="chapter" href="TreeWidgetObjects.html" title="Tree, List and Icon Grid Widgets"><link rel="chapter" href="MenusAndCombos.html" title="Menus, Combo Box, Toolbar"><link rel="chapter" href="Actions.html" title="Action-based menus and toolbars"><link rel="chapter" href="SelectorWidgets.html" title="Selectors (File/Font/Color/Input Devices)"><link rel="chapter" href="LayoutContainers.html" title="Layout Containers"><link rel="chapter" href="Ornaments.html" title="Ornaments"><link rel="chapter" href="ScrollingWidgets.html" title="Scrolling"><link rel="chapter" href="Printing.html" title="Printing"><link rel="chapter" href="MiscObjects.html" title="Miscellaneous"><link rel="chapter" href="AbstractObjects.html" title="Abstract Base Classes"><link rel="chapter" href="PlugSocket.html" title="Cross-process Embedding"><link rel="chapter" href="SpecialObjects.html" title="Special-purpose features"><link rel="chapter" href="RecentDocuments.html" title="Recently Used Documents"><link rel="chapter" href="Builder.html" title="Interface builder"><link rel="chapter" href="DeprecatedObjects.html" title="Deprecated"><link rel="part" href="migrating.html" title="Part&#160;IV.&#160;Migrating from Previous Versions of GTK+"><link rel="chapter" href="gtk-migrating-checklist.html" title="Migration Checklist"><link rel="chapter" href="gtk-migrating-GtkFileChooser.html" title="Migrating from GtkFileSelection to GtkFileChooser"><link rel="chapter" href="gtk-migrating-GtkAction.html" title="Migrating from old menu and toolbar systems to GtkAction"><link rel="chapter" href="gtk-migrating-GtkComboBox.html" title="Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and GtkComboBoxEntry"><link rel="chapter" href="gtk-migrating-GtkIconView.html" title="Migrating from GnomeIconList to GtkIconView"><link rel="chapter" href="gtk-migrating-GtkAboutDialog.html" title="Migrating from GnomeAbout to GtkAboutDialog"><link rel="chapter" href="gtk-migrating-GtkColorButton.html" title="Migrating from GnomeColorPicker to GtkColorButton"><link rel="chapter" href="gtk-migrating-GtkAssistant.html" title="Migrating from GnomeDruid to GtkAssistant"><link rel="chapter" href="gtk-migrating-GtkRecentChooser.html" title="Migrating from EggRecent to GtkRecentChooser"><link rel="chapter" href="gtk-migrating-GtkLinkButton.html" title="Migrating from GnomeHRef to GtkLinkButton"><link rel="chapter" href="gtk-migrating-GtkBuilder.html" title="Migrating from libglade to GtkBuilder"><link rel="chapter" href="gtk-migrating-tooltips.html" title="Migrating from GtkTooltips to GtkTooltip"><link rel="part" href="pt05.html" title="Part&#160;V.&#160;GTK+ Tools"><link rel="glossary" href="glossary.html" title="Glossary"><link rel="index" href="ix01.html" title="Index"><link rel="index" href="ix02.html" title="Index of deprecated symbols"><link rel="index" href="ix03.html" title="Index of new symbols in 2.2"><link rel="index" href="ix04.html" title="Index of new symbols in 2.4"><link rel="index" href="ix05.html" title="Index of new symbols in 2.6"><link rel="index" href="ix06.html" title="Index of new symbols in 2.8"><link rel="index" href="ix07.html" title="Index of new symbols in 2.10"><link rel="index" href="ix08.html" title="Index of new symbols in 2.12"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="GtkVScrollbar.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="ScrollingWidgets.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GTK+ Reference Manual</th><td><a accesskey="n" href="Printing.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id4119798" class="shortcut">Top</a>                  &#160;|&#160;                  <a href="#id4121267" class="shortcut">Description</a>                  &#160;|&#160;                  <a href="#id4120942" class="shortcut">Object Hierarchy</a>                  &#160;|&#160;                  <a href="#id4121003" class="shortcut">Implemented Interfaces</a>                  &#160;|&#160;                  <a href="#id4121033" class="shortcut">Properties</a>                  &#160;|&#160;                  <a href="#id4121174" class="shortcut">Style Properties</a>                  &#160;|&#160;                  <a href="#id4121227" class="shortcut">Signals</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="GtkScrolledWindow"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id4119798"></a><span class="refentrytitle">GtkScrolledWindow</span></h2><p>GtkScrolledWindow &#8212; Adds scrollbars to its child widget</p></td><td valign="top" align="right"><img src="scrolledwindow.png"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include &lt;gtk/gtk.h&gt;                    <a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow-struct">GtkScrolledWindow</a>;<a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>*          <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-new">gtk_scrolled_window_new</a>             (<a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a> *hadjustment,                                                         <a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a> *vadjustment);<a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a>*      <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-get-hadjustment">gtk_scrolled_window_get_hadjustment</a> (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window);<a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a>*      <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-get-vadjustment">gtk_scrolled_window_get_vadjustment</a> (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window);<a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>*          <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-get-hscrollbar">gtk_scrolled_window_get_hscrollbar</a>  (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window);<a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>*          <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-get-vscrollbar">gtk_scrolled_window_get_vscrollbar</a>  (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window);void                <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-set-policy">gtk_scrolled_window_set_policy</a>      (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window,                                                         <a class="link" href="gtk-Standard-Enumerations.html#GtkPolicyType">GtkPolicyType</a> hscrollbar_policy,                                                         <a class="link" href="gtk-Standard-Enumerations.html#GtkPolicyType">GtkPolicyType</a> vscrollbar_policy);void                <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport">gtk_scrolled_window_add_with_viewport</a>                                                        (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window,                                                         <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child);void                <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-set-placement">gtk_scrolled_window_set_placement</a>   (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window,                                                         <a class="link" href="gtk-Standard-Enumerations.html#GtkCornerType">GtkCornerType</a> window_placement);void                <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-unset-placement">gtk_scrolled_window_unset_placement</a> (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window);void                <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-set-shadow-type">gtk_scrolled_window_set_shadow_type</a> (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window,                                                         <a class="link" href="gtk-Standard-Enumerations.html#GtkShadowType">GtkShadowType</a> type);void                <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-set-hadjustment">gtk_scrolled_window_set_hadjustment</a> (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window,                                                         <a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a> *hadjustment);void                <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-set-vadjustment">gtk_scrolled_window_set_vadjustment</a> (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window,                                                         <a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a> *vadjustment);<a class="link" href="gtk-Standard-Enumerations.html#GtkCornerType">GtkCornerType</a>       <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-get-placement">gtk_scrolled_window_get_placement</a>   (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window);void                <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-get-policy">gtk_scrolled_window_get_policy</a>      (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window,                                                         <a class="link" href="gtk-Standard-Enumerations.html#GtkPolicyType">GtkPolicyType</a> *hscrollbar_policy,                                                         <a class="link" href="gtk-Standard-Enumerations.html#GtkPolicyType">GtkPolicyType</a> *vscrollbar_policy);<a class="link" href="gtk-Standard-Enumerations.html#GtkShadowType">GtkShadowType</a>       <a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-get-shadow-type">gtk_scrolled_window_get_shadow_type</a> (<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow">GtkScrolledWindow</a> *scrolled_window);</pre></div><div class="refsect1" lang="en"><a name="id4120942"></a><h2>Object Hierarchy</h2><pre class="synopsis">  <ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>   +----<ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>         +----<a class="link" href="GtkObject.html" title="GtkObject">GtkObject</a>               +----<a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>                     +----<a class="link" href="GtkContainer.html" title="GtkContainer">GtkContainer</a>                           +----<a class="link" href="GtkBin.html" title="GtkBin">GtkBin</a>                                 +----GtkScrolledWindow</pre></div><div class="refsect1" lang="en"><a name="id4121003"></a><h2>Implemented Interfaces</h2><p>GtkScrolledWindow implements AtkImplementorIface and  <a class="link" href="gtk-gtkbuildable.html#GtkBuildable">GtkBuildable</a>.</p></div><div class="refsect1" lang="en"><a name="id4121033"></a><h2>Properties</h2><pre class="synopsis">  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow--hadjustment">hadjustment</a>"              <a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a>         : Read / Write / Construct  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow--hscrollbar-policy">hscrollbar-policy</a>"        <a class="link" href="gtk-Standard-Enumerations.html#GtkPolicyType">GtkPolicyType</a>         : Read / Write  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow--shadow-type">shadow-type</a>"              <a class="link" href="gtk-Standard-Enumerations.html#GtkShadowType">GtkShadowType</a>         : Read / Write  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow--vadjustment">vadjustment</a>"              <a class="link" href="GtkAdjustment.html" title="GtkAdjustment">GtkAdjustment</a>         : Read / Write / Construct  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow--vscrollbar-policy">vscrollbar-policy</a>"        <a class="link" href="gtk-Standard-Enumerations.html#GtkPolicyType">GtkPolicyType</a>         : Read / Write  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow--window-placement">window-placement</a>"         <a class="link" href="gtk-Standard-Enumerations.html#GtkCornerType">GtkCornerType</a>         : Read / Write  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow--window-placement-set">window-placement-set</a>"     <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a>              : Read / Write</pre></div><div class="refsect1" lang="en"><a name="id4121174"></a><h2>Style Properties</h2><pre class="synopsis">  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow--scrollbar-spacing">scrollbar-spacing</a>"        <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a>                  : Read  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow--scrollbars-within-bevel">scrollbars-within-bevel</a>"  <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a>              : Read</pre></div><div class="refsect1" lang="en"><a name="id4121227"></a><h2>Signals</h2><pre class="synopsis">  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow-move-focus-out">move-focus-out</a>"                                 : Run Last / Action  "<a class="link" href="GtkScrolledWindow.html#GtkScrolledWindow-scroll-child">scroll-child</a>"                                   : Run Last / Action</pre></div><div class="refsect1" lang="en"><a name="id4121267"></a><h2>Description</h2><p><a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow"><span class="type">GtkScrolledWindow</span></a> is a <a class="link" href="GtkBin.html" title="GtkBin"><span class="type">GtkBin</span></a> subclass: it's a container the accepts a single child widget. <a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow"><span class="type">GtkScrolledWindow</span></a> adds scrollbarsto the child widget and optionally draws a beveled frame around the child widget.</p><p>The scrolled window can work in two ways. Some widgets have nativescrolling support; these widgets have "slots" for <a class="link" href="GtkAdjustment.html" title="GtkAdjustment"><span class="type">GtkAdjustment</span></a>objects. <sup>[<a name="id4121320" href="#ftn.id4121320" class="footnote">5</a>]</sup>Widgets with native scroll support include <a class="link" href="GtkTreeView.html" title="GtkTreeView"><span class="type">GtkTreeView</span></a>, <a class="link" href="GtkTextView.html" title="GtkTextView"><span class="type">GtkTextView</span></a>, and <a class="link" href="GtkLayout.html" title="GtkLayout"><span class="type">GtkLayout</span></a>.</p><p>For widgets that lack native scrolling support, the <a class="link" href="GtkViewport.html" title="GtkViewport"><span class="type">GtkViewport</span></a>widget acts as an adaptor class, implementing scrollability for childwidgets that lack their own scrolling capabilities. Use <a class="link" href="GtkViewport.html" title="GtkViewport"><span class="type">GtkViewport</span></a>to scroll child widgets such as <a class="link" href="GtkTable.html" title="GtkTable"><span class="type">GtkTable</span></a>, <a class="link" href="GtkBox.html" title="GtkBox"><span class="type">GtkBox</span></a>, and so on.</p><p>If a widget has native scrolling abilities, it can be added to the<a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow"><span class="type">GtkScrolledWindow</span></a> with <a class="link" href="GtkContainer.html#gtk-container-add"><code class="function">gtk_container_add()</code></a>. If a widget does not, youmust first add the widget to a <a class="link" href="GtkViewport.html" title="GtkViewport"><span class="type">GtkViewport</span></a>, then add the <a class="link" href="GtkViewport.html" title="GtkViewport"><span class="type">GtkViewport</span></a>to the scrolled window. The convenience function<a class="link" href="GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport"><code class="function">gtk_scrolled_window_add_with_viewport()</code></a> does exactly this, so you canignore the presence of the viewport.</p><p>The position of the scrollbars is controlled by the scrolladjustments. See <a class="link" href="GtkAdjustment.html" title="GtkAdjustment"><span class="type">GtkAdjustment</span></a> for the fields in an adjustment - for<a class="link" href="GtkScrollbar.html" title="GtkScrollbar"><span class="type">GtkScrollbar</span></a>, used by <a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow"><span class="type">GtkScrolledWindow</span></a>, the "value" fieldrepresents the position of the scrollbar, which must be between the"lower" field and "upper - page_size." The "page_size" fieldrepresents the size of the visible scrollable area. The"step_increment" and "page_increment" fields are used when the userasks to step down (using the small stepper arrows) or page down (usingfor example the PageDown key).</p><p>If a <a class="link" href="GtkScrolledWindow.html" title="GtkScrolledWindow"><span class="type">GtkScrolledWindow</span></a> doesn't behave quite as you would like, ordoesn't have exactly the right layout, it's very possible to set upyour own scrolling with <a class="link" href="GtkScrollbar.html" title="GtkScrollbar"><span class="type">GtkScrollbar</span></a> and for example a <a class="link" href="GtkTable.html" title="GtkTable"><span class="type">GtkTable</span></a>.</p>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?