PageRenderTime 17ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

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