/src/wrappers/gtk/library/gtk_text_mark.e

http://github.com/tybor/Liberty · Specman e · 145 lines · 81 code · 25 blank · 39 comment · 3 complexity · dd63c088c4450f1cd17d996717451fd1 MD5 · raw file

  1. indexing
  2. description: "GtkTextMark -- a position in the buffer preserved across buffer modifications."
  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. class GTK_TEXT_MARK
  19. -- You may wish to begin by reading the text widget
  20. -- conceptual overview which gives an overview of all
  21. -- the objects and data types related to the text
  22. -- widget and how they work together.
  23. -- A GtkTextMark is like a bookmark in a text buffer; it preserves a position
  24. -- in the text. You can convert the mark to an iterator using
  25. -- GTK_TEXT_BUFFER's `iter_at_mark'. Unlike iterators, marks remain valid
  26. -- across buffer mutations, because their behavior is defined when text is
  27. -- inserted or deleted. When text containing a mark is deleted, the mark
  28. -- remains in the position originally occupied by the deleted text. When text
  29. -- is inserted at a mark, a mark with left gravity will be moved to the
  30. -- beginning of the newly-inserted text, and a mark with right gravity will
  31. -- be moved to the end.
  32. -- Marks are reference counted, but the reference count only controls the
  33. -- validity of the memory; marks can be deleted from the buffer at any time
  34. -- with GTK_TEXT_BUFFER's `delete_mark'. Once deleted from the buffer, a mark
  35. -- is essentially useless.
  36. -- Marks optionally have names; these can be convenient to avoid passing the
  37. -- GtkTextMark object around.
  38. -- Marks are typically created using the GTK_TEXT_BUFFER's `create_mark'
  39. -- function.
  40. inherit G_OBJECT
  41. creation from_external_pointer
  42. feature
  43. set_visible is
  44. -- Makes the mark visible; the insertion point is normally
  45. -- visible, i.e. you can see it as a vertical bar. Also, the
  46. -- text widget uses a visible mark to indicate where a drop
  47. -- will occur when dragging-and-dropping text. Most other
  48. -- marks are not visible. Marks are not visible by default.
  49. do
  50. gtk_text_mark_set_visible (handle, 1)
  51. ensure visible: is_visible
  52. end
  53. set_invisible is
  54. -- Makes the mark invisible; see also `set_visible'
  55. do
  56. gtk_text_mark_set_visible (handle, 0)
  57. ensure invisible: not is_visible
  58. end
  59. is_visible: BOOLEAN is
  60. -- Is the mark visible ? (i.e. a cursor is displayed for it)
  61. do
  62. Result := (gtk_text_mark_get_visible (handle).to_boolean)
  63. end
  64. is_deleted: BOOLEAN is
  65. -- Has the mark been removed from its buffer with
  66. -- `GTK_TEXT_BUFFER.delete_mark'?. Marks can't be used once
  67. -- deleted.
  68. do
  69. Result := (gtk_text_mark_get_deleted (handle).to_boolean)
  70. end
  71. name: STRING is
  72. -- the mark name; Void for anonymous marks.
  73. local ptr: POINTER
  74. do
  75. ptr := gtk_text_mark_get_name (handle)
  76. if ptr.is_not_null then
  77. create Result.from_external_copy (ptr)
  78. end
  79. end
  80. buffer: GTK_TEXT_BUFFER is
  81. -- the buffer this mark is located inside, or Void if the
  82. -- mark is deleted.
  83. local factory: G_OBJECT_EXPANDED_FACTORY [GTK_TEXT_BUFFER]
  84. do
  85. Result := factory.wrapper_or_void (gtk_text_mark_get_buffer (handle))
  86. end
  87. has_left_gravity: BOOLEAN is
  88. -- Does the mark have left gravity? "left" and "right" here
  89. -- refer to logical direction (left is the toward the start
  90. -- of the buffer); in some languages such as Hebrew the
  91. -- logically-leftmost text is not actually on the left when
  92. -- displayed.
  93. do
  94. Result:=(gtk_text_mark_get_left_gravity (handle).to_boolean)
  95. end
  96. feature -- size
  97. struct_size: INTEGER is
  98. external "C inline use <gtk/gtk.h>"
  99. alias "sizeof(GtkTextMark)"
  100. end
  101. feature {} -- External features
  102. gtk_text_mark_set_visible (a_mark: POINTER; a_gboolean_setting: INTEGER) is
  103. external "C use <gtk/gtk.h>"
  104. end
  105. gtk_text_mark_get_visible (a_mark: POINTER): INTEGER is --gboolean
  106. external "C use <gtk/gtk.h>"
  107. end
  108. gtk_text_mark_get_deleted (a_mark: POINTER): INTEGER is -- gboolean
  109. external "C use <gtk/gtk.h>"
  110. end
  111. gtk_text_mark_get_name (a_mark: POINTER): POINTER is -- const gchar*
  112. external "C use <gtk/gtk.h>"
  113. end
  114. gtk_text_mark_get_buffer (a_mark: POINTER): POINTER is -- GtkTextBuffer*
  115. external "C use <gtk/gtk.h>"
  116. end
  117. gtk_text_mark_get_left_gravity (a_mark: POINTER): INTEGER is -- gboolean
  118. external "C use <gtk/gtk.h>"
  119. end
  120. end