📄 app-listwidget.html
字号:
<HTML><HEAD><TITLE>List Widget</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="Scribble"HREF="sec-scribble.html"><LINKREL="NEXT"TITLE="Functions"HREF="sec-gtklistfunctions.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="APPENDIX"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-scribble.html"><<< Previous</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="sec-gtklistfunctions.html">Next >>></A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="APPENDIX"><H1><ANAME="APP-LISTWIDGET">Appendix D. List Widget</A></H1><P>NOTE: The List widget has been superseded by the CList widget. It isdetailed here just for completeness.</P><P>The List widget is designed to act as a vertical container forwidgets that should be of the type ListItem.</P><P>A List widget has its own window to receive events and its ownbackground color which is usually white. As it is directly derivedfrom a Container it can be treated as such by using theGTK_CONTAINER(List) macro, see the Container widget for more onthis. One should already be familiar with the usage of a GList andits related functions g_list_*() to be able to use the List widgetto it full extent.</P><P>There is one field inside the structure definition of the Listwidget that will be of greater interest to us, this is:</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">struct _GtkList{ ... GList *selection; guint selection_mode; ...}; </PRE></TD></TR></TABLE><P>The selection field of a List points to a linked list of all itemsthat are currently selected, or NULL if the selection is empty. So tolearn about the current selection we read the GTK_LIST()->selectionfield, but do not modify it since the internal fields are maintainedby the gtk_list_*() functions.</P><P>The selection_mode of the List determines the selection facilitiesof a List and therefore the contents of the GTK_LIST()->selectionfield. The selection_mode may be one of the following:</P><P></P><UL><LI><P> <TTCLASS="LITERAL">GTK_SELECTION_SINGLE</TT> - The selection is either NULL or contains a GList pointer for a single selected item.</P></LI><LI><P> <TTCLASS="LITERAL">GTK_SELECTION_BROWSE</TT> - The selection is NULL if the list contains no widgets or insensitive ones only, otherwise it contains a GList pointer for one GList structure, and therefore exactly one list item.</P></LI><LI><P> <TTCLASS="LITERAL">GTK_SELECTION_MULTIPLE</TT> - The selection is NULL if no list items are selected or a GList pointer for the first selected item. That in turn points to a GList structure for the second selected item and so on.</P></LI><LI><P> <TTCLASS="LITERAL">GTK_SELECTION_EXTENDED</TT> - The selection is always NULL.</P></LI></UL><P>The default is <TTCLASS="LITERAL">GTK_SELECTION_MULTIPLE</TT>.</P><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SEC-SELECTIONSIGNALS">D.1. Signals</A></H1><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void selection_changed( GtkList *list );</PRE></TD></TR></TABLE><P>This signal will be invoked whenever the selection field of a Listhas changed. This happens when a child of thekList got selected ordeselected.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void select_child( GtkList *list, GtkWidget *child);</PRE></TD></TR></TABLE><P>This signal is invoked when a child of the List is about to getselected. This happens mainly on calls to gtk_list_select_item(),gtk_list_select_child(), button presses and sometimes indirectlytriggered on some else occasions where children get added to orremoved from the List.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void unselect_child( GtkList *list, GtkWidget *child );</PRE></TD></TR></TABLE><P>This signal is invoked when a child of the List is about to getdeselected. This happens mainly on calls to gtk_list_unselect_item(),gtk_list_unselect_child(), button presses and sometimes indirectlytriggered on some else occasions where children get added to orremoved from the List.</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-scribble.html"><<< Previous</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="gtk-tut.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="sec-gtklistfunctions.html">Next >>></A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Scribble</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"> </TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Functions</TD></TR></TABLE></DIV> </td> </tr></table> </td> </tr></table></body></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -