/src/wrappers/gtk/library/gtk_text_tag_table.e

http://github.com/tybor/Liberty · Specman e · 162 lines · 67 code · 35 blank · 60 comment · 2 complexity · 9a5b3dc84371b52f5cfbc594dc76117e MD5 · raw file

  1. indexing
  2. description: "GtkTextTagTable - Collection of tags that can be used together."
  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. -- Description: You may wish to begin by reading the text
  19. -- widget conceptual overview which gives an overview of all
  20. -- the objects and data types related to the text widget and
  21. -- how they work together.
  22. class GTK_TEXT_TAG_TABLE
  23. inherit
  24. G_OBJECT rename lookup as g_object_lookup end
  25. insert
  26. GTK
  27. GTK_TEXT_TAG_TABLE_EXTERNALS
  28. creation make, from_external_pointer
  29. feature {} -- Creation
  30. make is
  31. -- Creates a new GtkTextTagTable. The table contains no tags
  32. -- by default.
  33. require
  34. gtk_initialized: gtk.is_initialized
  35. do
  36. from_external_pointer (gtk_text_tag_table_new)
  37. end
  38. feature -- Operations
  39. add (a_tag: GTK_TEXT_TAG) is
  40. -- Add a tag to the table. The tag is assigned the highest priority in the table.
  41. require
  42. tag_not_void: a_tag /= Void
  43. -- TODO: tag must not be in a tag table already,
  44. -- TODO: a tagmay not have the same name as an already-added tag.
  45. do
  46. gtk_text_tag_table_add (handle, a_tag.handle)
  47. end
  48. remove (a_tag: GTK_TEXT_TAG) is
  49. -- Remove a tag from the table. This will remove the table's
  50. -- reference to the tag, so be careful - the tag will end up
  51. -- destroyed if you don't have a reference to it.
  52. require
  53. tag_not_void: a_tag /= Void
  54. do
  55. gtk_text_tag_table_remove (handle, a_tag.handle)
  56. end
  57. feature -- Access
  58. has (a_name: STRING): BOOLEAN is
  59. do
  60. Result := lookup (a_name) /= Void
  61. end
  62. lookup (a_name: STRING): GTK_TEXT_TAG is
  63. -- Lookup the tag with `a_name', or Void if none by that name
  64. -- is in the table.
  65. local factory: G_OBJECT_EXPANDED_FACTORY [GTK_TEXT_TAG]
  66. do
  67. Result := factory.wrapper (gtk_text_tag_table_lookup (handle, a_name.to_external))
  68. ensure
  69. has (a_name) implies Result /= Void
  70. end
  71. -- gtk_text_tag_table_foreach ()
  72. -- void gtk_text_tag_table_foreach (GtkTextTagTable *table,
  73. -- GtkTextTagTableForeach func,
  74. -- gpointer data);
  75. -- Calls func on each tag in table, with user data data. Note that the table may not be modified while iterating over it (you can't add/remove tags).
  76. -- table : a GtkTextTagTable
  77. -- func : a function to call on each tag
  78. -- data : user data
  79. -- gtk_text_tag_table_get_size ()
  80. size: INTEGER is
  81. -- Returns the size of the table (number of tags)
  82. do
  83. Result := gtk_text_tag_table_get_size (handle)
  84. end
  85. feature -- TODO: Signals
  86. -- "tag-added" void user_function (GtkTextTagTable *texttagtable,
  87. -- GtkTextTag *arg1,
  88. -- gpointer user_data) : Run last
  89. -- "tag-changed"
  90. -- void user_function (GtkTextTagTable *texttagtable,
  91. -- GtkTextTag *arg1,
  92. -- gboolean arg2,
  93. -- gpointer user_data) : Run last
  94. -- "tag-removed"
  95. -- void user_function (GtkTextTagTable *texttagtable,
  96. -- GtkTextTag *arg1,
  97. -- gpointer user_data) : Run last
  98. -- Signal Details
  99. -- The "tag-added" signal
  100. -- void user_function (GtkTextTagTable *texttagtable,
  101. -- GtkTextTag *arg1,
  102. -- gpointer user_data) : Run last
  103. -- texttagtable : the object which received the signal.
  104. -- arg1 :
  105. -- user_data : user data set when the signal handler was connected.
  106. -- The "tag-changed" signal
  107. -- void user_function (GtkTextTagTable *texttagtable,
  108. -- GtkTextTag *arg1,
  109. -- gboolean arg2,
  110. -- gpointer user_data) : Run last
  111. -- texttagtable : the object which received the signal.
  112. -- arg1 :
  113. -- arg2 :
  114. -- user_data : user data set when the signal handler was connected.
  115. -- The "tag-removed" signal
  116. -- void user_function (GtkTextTagTable *texttagtable,
  117. -- GtkTextTag *arg1,
  118. -- gpointer user_data) : Run last
  119. -- texttagtable : the object which received the signal.
  120. -- arg1 :
  121. -- user_data : user data set when the signal handler was connected.
  122. feature -- size
  123. struct_size: INTEGER is
  124. external "C inline use <gtk/gtk.h>"
  125. alias "sizeof(GtkTextTagTable)"
  126. end
  127. end