/src/wrappers/gtk/library/gtk_tree_row_reference.e
Specman e | 166 lines | 78 code | 27 blank | 61 comment | 3 complexity | 13c3ebdcc8ca8e5caf80c83d9ff4164a MD5 | raw file
1indexing 2 description: "." 3 copyright: "[ 4 Copyright (C) 2006 eiffel-libraries team, GTK+ team 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public License 8 as published by the Free Software Foundation; either version 2.1 of 9 the License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with this library; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 02110-1301 USA 20 ]" 21 date: "$Date:$" 22 revision: "$Revision:$" 23 24class GTK_TREE_ROW_REFERENCE 25 26inherit 27 C_STRUCT redefine copy end 28 29 30insert 31 GTK 32 GTK_TREE_MODEL_EXTERNALS 33 34creation make, copy, from_external_pointer 35 36feature {} -- size 37 struct_size: INTEGER is 38 external "C inline use <gtk/gtk.h>" 39 alias "sizeof(GtkTreeRowReference)" 40 end 41 42feature {} -- Creation 43 make (a_model: GTK_TREE_MODEL; a_path: GTK_TREE_PATH) is 44 -- Creates a row reference based on `a_path'. This reference 45 -- will keep pointing to the node pointed to by `a_path', so 46 -- long as it exists. It listens to all signals emitted by 47 -- `a_model', and updates its path appropriately. If path 48 -- isn't a valid path in model, then exists will be False. 49 require 50 gtk_initialized: gtk.is_initialized 51 valid_model: a_model /= Void 52 valid_path: a_path /= Void 53 do 54 from_external_pointer(gtk_tree_row_reference_new (a_model.handle, a_path.handle)) 55 end 56 57feature 58 copy (another: like Current) is 59 -- Create Current fron `another' GtkTreeRowReference. 60 do 61 from_external_pointer (gtk_tree_row_reference_copy (another.handle)) 62 end 63 64 -- Currently not wrapped: GtkTreeRowReference* 65 -- gtk_tree_row_reference_new_proxy (GObject *proxy, GtkTreeModel 66 -- *model, GtkTreePath *path); You do not need to use this 67 -- function. Creates a row reference based on path. This reference 68 -- will keep pointing to the node pointed to by path, so long as it 69 -- exists. If path isn't a valid path in model, then NULL is 70 -- returned. However, unlike references created with 71 -- gtk_tree_row_reference_new(), it does not listen to the model 72 -- for changes. The creator of the row reference must do this 73 -- explicitly using gtk_tree_row_reference_inserted(), 74 -- gtk_tree_row_reference_deleted(), 75 -- gtk_tree_row_reference_reordered(). These functions must be 76 -- called exactly once per proxy when the corresponding signal on 77 -- the model is emitted. This single call updates all row 78 -- references for that proxy. Since built-in GTK+ objects like 79 -- GtkTreeView already use this mechanism internally, using them as 80 -- the proxy object will produce unpredictable results. Further 81 -- more, passing the same object as model and proxy doesn't work 82 -- for reasons of internal implementation. This type of row 83 -- reference is primarily meant by structures that need to 84 -- carefully monitor exactly when a row_reference updates itself, 85 -- and is not generally needed by most applications. proxy : A 86 -- proxy GObject -- model : A GtkTreeModel -- path : A valid 87 -- GtkTreePath to monitor -- Returns : A newly allocated 88 -- GtkTreeRowReference, or NULL -- gtk_tree_row_reference_get_model 89 -- () 90 91feature -- Queries 92 model: GTK_TREE_MODEL is 93 -- the model which reference is monitoring in order to 94 -- appropriately the path. Can be Void 95 local factory: G_OBJECT_EXPANDED_FACTORY[GTK_TREE_MODEL] 96 do 97 Result:= factory.wrapper_or_void (gtk_tree_row_reference_get_model (handle)) 98 end 99 100 path: GTK_TREE_PATH is 101 -- The path that the row reference currently points to, or 102 -- Void if the path pointed to is no longer valid. 103 local ptr: POINTER 104 do 105 ptr := gtk_tree_row_reference_get_path (handle) 106 if ptr.is_not_null 107 then create Result.from_external_pointer (handle) 108 end 109 ensure is_valid implies Result /= Void 110 end 111 112 is_valid: BOOLEAN is 113 -- Does Current reference points to a valid path? 114 do 115 Result := (gtk_tree_row_reference_valid(handle)).to_boolean 116 end 117 118feature -- Disposing 119 dispose is 120 do 121 -- Free's reference. reference may be NULL. 122 gtk_tree_row_reference_free (handle) 123 end 124 125feature {} -- Unimplemented 126-- gtk_tree_row_reference_inserted () 127 128-- void gtk_tree_row_reference_inserted (GObject *proxy, 129-- GtkTreePath *path); 130 131-- Lets a set of row reference created by gtk_tree_row_reference_new_proxy() know that the model emitted the "row_inserted" signal. 132 133-- proxy : A GObject 134-- path : The row position that was inserted 135-- gtk_tree_row_reference_deleted () 136 137-- void gtk_tree_row_reference_deleted (GObject *proxy, 138-- GtkTreePath *path); 139 140-- Lets a set of row reference created by gtk_tree_row_reference_new_proxy() know that the model emitted the "row_deleted" signal. 141 142-- proxy : A GObject 143-- path : The path position that was deleted 144-- gtk_tree_row_reference_reordered () 145 146-- void gtk_tree_row_reference_reordered 147-- (GObject *proxy, 148-- GtkTreePath *path, 149-- GtkTreeIter *iter, 150-- gint *new_order); 151 152-- Lets a set of row reference created by gtk_tree_row_reference_new_proxy() know that the model emitted the "rows_reordered" signal. 153 154-- proxy : A GObject 155-- path : The parent path of the reordered signal 156-- iter : The iter pointing to the parent of the reordered 157-- new_order : The new order of rows 158feature {} -- Notices 159 no_wrapper_for_model_notice: STRING is 160 "[ 161 Warning! GTK_TREE_REFERENCE.model receved from GTK library 162 a unwrapped pointer to a GtkTreeModel. Please report this 163 as a bug to Eiffel Wrapper Library Collection project. 164 ]" 165 166end