/src/wrappers/gtk/library/gtk_tree_row_reference.e

http://github.com/tybor/Liberty · Specman e · 166 lines · 78 code · 27 blank · 61 comment · 3 complexity · 13c3ebdcc8ca8e5caf80c83d9ff4164a MD5 · raw file

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