⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch-rangewidgets.html

📁 gtk 开发手册和参考文档。 包括gtk glib gdk等
💻 HTML
字号:
<HTML><HEAD><TITLE>Range Widgets</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.49"><LINKREL="HOME"TITLE="GTK+ 1.2 Tutorial"HREF="gtk-tut.html"><LINKREL="PREVIOUS"TITLE="Adjustment Internals"HREF="sec-adjustmentinternals.html"><LINKREL="NEXT"TITLE="Scale Widgets"HREF="sec-scalewidgets.html"></HEAD></head><body bgcolor="#FFFFFF" marginheight=0 marginwidth=0 width="100%"><table cellspacing=6 border=0 cellpadding=0 width="100%">  <tr>    <td bgcolor="#FFFFFF" valign=top nowrap>    <centeR><A HREF="/"><img src="/images/gtk-logo-rgb.gif" width=107 height=140 border=0></A>      <font face="helvetica,lucidia" color="#000000"><BR><BR><b>GTK+<BR>The GIMP Toolkit</b></center><BR><table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B>General</B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="/">Introduction</A><BR><A HREF="/screenshots/">Screenshots</A><br><A HREF="/download/">Download</A><br><A HREF="/mailinglists.html">Mailing Lists</A><BR><A HREF="/bindings.html">Language Bindings</A><BR><A HREF="http://gtk.themes.org/">Themes</A><BR><A HREF="/bugs.html">Bug Tracker</A><BR></td></tr></table></td></tr></table><BR>  <table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B>Documentation</B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="/faq/">FAQ</A><br><A HREF="/tutorial/">Tutorial</A><BR><A HREF="/api/">API Reference</A><br><A HREF="/books.html">Published Books</A><BR></td></tr></table></td></tr></table><BR>  <table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B>Projects</B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="http://www.pango.org/">Pango</A><BR><A HREF="http://sources.redhat.com/inti/">Inti</A><BR><A HREF="http://www.gnome.org/">GNOME</A><BR><A HREF="http://user.sgic.fi/~tml/gimp/win32/">GTK+ for Win32</A><br><A HREF="http://people.redhat.com/sopwith/gtkfb/">GtkFB (Framebuffer)</A><br><A HREF="http://www.directfb.org/gtk.xml">GTK+ on DirectFB</A><BR><A HREF="/beos/">GTK+ for BeOS</A></td></tr></table></td></tr></table><BR>  <table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B><B>Applications</B></B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="http://www.gimp.org/">GIMP</A><BR><A HREF="http://www.abiword.org/">Abiword</A><BR><A HREF="http://www.lysator.liu.se/~alla/dia/dia.html">Dia</A><BR><A HREF="http://glade.pn.org/">Glade</A><BR><A HREF="http://www.gnucash.org/">GnuCash</A><BR><A HREF="http://www.gnome.org/projects/gnumeric/">Gnumeric</A><BR><BR><A HREF="http://www.gnome.org/applist/">GNOME Software Map</A><br></td></tr></table></td></tr></table><BR>      </td>  <td bgcolor="#ffffff" valign=top width="99%"><font face="lucida,helvetica"><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">GTK+ 1.2 Tutorial</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="sec-adjustmentinternals.html">&#60;&#60;&#60; Previous</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="sec-scalewidgets.html">Next &#62;&#62;&#62;</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="CH-RANGEWIDGETS">Chapter 8. Range Widgets</A></H1><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT>8.1. <AHREF="ch-rangewidgets.html#SEC-SCROLLBARWIDGETS">Scrollbar Widgets</A></DT><DT>8.2. <AHREF="sec-scalewidgets.html">Scale Widgets</A></DT><DT>8.3. <AHREF="sec-commonrangefunctions.html">Common Range Functions</A></DT><DT>8.4. <AHREF="sec-keyandmousebindings.html">Key and Mouse bindings</A></DT><DT>8.5. <AHREF="sec-rangewidgetsexample.html">Example</A></DT></DL></DIV><P>The category of range widgets includes the ubiquitous scrollbar widgetand the less common "scale" widget. Though these two types of widgetsare generally used for different purposes, they are quite similar infunction and implementation. All range widgets share a set of commongraphic elements, each of which has its own X window and receivesevents. They all contain a "trough" and a "slider" (what is sometimescalled a "thumbwheel" in other GUI environments). Dragging the sliderwith the pointer moves it back and forth within the trough, whileclicking in the trough advances the slider towards the location of theclick, either completely, or by a designated amount, depending onwhich mouse button is used.</P><P>As mentioned in <AHREF="ch-adjustments.html">Adjustments</A> above,all range widgets are associated with an adjustment object, from whichthey calculate the length of the slider and its position within thetrough. When the user manipulates the slider, the range widget willchange the value of the adjustment.</P><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SEC-SCROLLBARWIDGETS">8.1. Scrollbar Widgets</A></H1><P>These are your standard, run-of-the-mill scrollbars. These should beused only for scrolling some other widget, such as a list, a text box,or a viewport (and it's generally easier to use the scrolled windowwidget in most cases).  For other purposes, you should use scalewidgets, as they are friendlier and more featureful.</P><P>There are separate types for horizontal and vertical scrollbars.There really isn't much to say about these. You create them with thefollowing functions, defined in <TTCLASS="LITERAL">&#60;gtk/gtkhscrollbar.h&#62;</TT>and <TTCLASS="LITERAL">&#60;gtk/gtkvscrollbar.h&#62;</TT>:</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">GtkWidget *gtk_hscrollbar_new( GtkAdjustment *adjustment );GtkWidget *gtk_vscrollbar_new( GtkAdjustment *adjustment );</PRE></TD></TR></TABLE><P>and that's about it (if you don't believe me, look in the headerfiles!).  The <TTCLASS="LITERAL">adjustment</TT> argument can either be a pointer to anexisting Adjustment, or NULL, in which case one will be created foryou. Specifying NULL might actually be useful in this case, if youwish to pass the newly-created adjustment to the constructor functionof some other widget which will configure it for you, such as a textwidget.</P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="sec-adjustmentinternals.html">&#60;&#60;&#60; Previous</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="gtk-tut.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="sec-scalewidgets.html">Next &#62;&#62;&#62;</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Adjustment Internals</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top">&nbsp;</TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Scale Widgets</TD></TR></TABLE></DIV>        </td>    </tr></table>  </td>  </tr></table></body></BODY></HTML>

⌨️ 快捷键说明

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