sec-treewidgetinternals.html
来自「gtk的教材和问答集」· HTML 代码 · 共 859 行 · 第 1/2 页
HTML
859 行
WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_prepend( GtkTree *tree, GtkWidget *tree_item );</PRE></TD></TR></TABLE><P>Prepend a tree item to a Tree.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_insert( GtkTree *tree, GtkWidget *tree_item, gint position );</PRE></TD></TR></TABLE><P>Insert a tree item into a Tree at the position in the listspecified by <TTCLASS="LITERAL">position.</TT></P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_remove_items( GtkTree *tree, GList *items );</PRE></TD></TR></TABLE><P>Remove a list of items (in the form of a GList *) from a Tree.Note that removing an item from a tree dereferences (and thus usually)destroys it <ICLASS="EMPHASIS">and</I> its subtree, if it has one, <ICLASS="EMPHASIS">and</I> allsubtrees in that subtree. If you want to remove only one item, youcan use gtk_container_remove().</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_clear_items( GtkTree *tree, gint start, gint end );</PRE></TD></TR></TABLE><P>Remove the items from position <TTCLASS="LITERAL">start</TT> to position <TTCLASS="LITERAL">end</TT>from a Tree. The same warning about dereferencing applies here, asgtk_tree_clear_items() simply constructs a list and passes it togtk_tree_remove_items().</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_select_item( GtkTree *tree, gint item );</PRE></TD></TR></TABLE><P>Emits the "select_item" signal for the child at position<TTCLASS="LITERAL">item</TT>, thus selecting the child (unless you unselect it in asignal handler).</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_unselect_item( GtkTree *tree, gint item );</PRE></TD></TR></TABLE><P>Emits the "unselect_item" signal for the child at position<TTCLASS="LITERAL">item</TT>, thus unselecting the child.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_select_child( GtkTree *tree, GtkWidget *tree_item );</PRE></TD></TR></TABLE><P>Emits the "select_item" signal for the child <TTCLASS="LITERAL">tree_item</TT>, thusselecting it.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_unselect_child( GtkTree *tree, GtkWidget *tree_item );</PRE></TD></TR></TABLE><P>Emits the "unselect_item" signal for the child <TTCLASS="LITERAL">tree_item</TT>,thus unselecting it.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">gint gtk_tree_child_position( GtkTree *tree, GtkWidget *child );</PRE></TD></TR></TABLE><P>Returns the position in the tree of <TTCLASS="LITERAL">child</TT>, unless<TTCLASS="LITERAL">child</TT> is not in the tree, in which case it returns -1.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_set_selection_mode( GtkTree *tree, GtkSelectionMode mode );</PRE></TD></TR></TABLE><P>Sets the selection mode, which can be one of <TTCLASS="LITERAL">GTK_SELECTION_SINGLE</TT> (thedefault), <TTCLASS="LITERAL">GTK_SELECTION_BROWSE</TT>, <TTCLASS="LITERAL">GTK_SELECTION_MULTIPLE</TT>, or<TTCLASS="LITERAL">GTK_SELECTION_EXTENDED</TT>. This is only defined for root trees, whichmakes sense, since the root tree "owns" the selection. Setting it forsubtrees has no effect at all; the value is simply ignored.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_set_view_mode( GtkTree *tree, GtkTreeViewMode mode ); </PRE></TD></TR></TABLE><P>Sets the "view mode", which can be either <TTCLASS="LITERAL">GTK_TREE_VIEW_LINE</TT> (thedefault) or <TTCLASS="LITERAL">GTK_TREE_VIEW_ITEM</TT>. The view mode propagates from atree to its subtrees, and can't be set exclusively to a subtree (thisis not exactly true - see the example code comments).</P><P>The term "view mode" is rather ambiguous - basically, it controls theway the highlight is drawn when one of a tree's children is selected.If it's <TTCLASS="LITERAL">GTK_TREE_VIEW_LINE</TT>, the entire TreeItem widget ishighlighted, while for <TTCLASS="LITERAL">GTK_TREE_VIEW_ITEM</TT>, only the child widget(i.e., usually the label) is highlighted.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_tree_set_view_lines( GtkTree *tree, guint flag );</PRE></TD></TR></TABLE><P>Controls whether connecting lines between tree items are drawn.<TTCLASS="LITERAL">flag</TT> is either TRUE, in which case they are, or FALSE, inwhich case they aren't.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">GtkTree *GTK_TREE (gpointer obj);</PRE></TD></TR></TABLE><P>Cast a generic pointer to "GtkTree *".</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">GtkTreeClass *GTK_TREE_CLASS (gpointer class);</PRE></TD></TR></TABLE><P>Cast a generic pointer to "GtkTreeClass *".</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">gint GTK_IS_TREE (gpointer obj);</PRE></TD></TR></TABLE><P>Determine if a generic pointer refers to a "GtkTree" object.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">gint GTK_IS_ROOT_TREE (gpointer obj)</PRE></TD></TR></TABLE><P>Determine if a generic pointer refers to a "GtkTree" object<ICLASS="EMPHASIS">and</I> is a root tree. Though this will accept any pointer, theresults of passing it a pointer that does not refer to a Tree areundefined and possibly harmful.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">GtkTree *GTK_TREE_ROOT_TREE (gpointer obj)</PRE></TD></TR></TABLE><P>Return the root tree of a pointer to a "GtkTree" object. The abovewarning applies.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">GList *GTK_TREE_SELECTION( gpointer obj)</PRE></TD></TR></TABLE><P>Return the selection list of the root tree of a "GtkTree" object. Theabove warning applies here, too.</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-handlingtheselectionlist.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-treeitemwidget.html">Next >>></A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Handling the Selection List</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ch-treewidget.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Tree Item Widget</TD></TR></TABLE></DIV> </td> </tr></table> </td> </tr></table></body></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?