PageRenderTime 39ms CodeModel.GetById 33ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

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