PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/library/gtk_cell_renderer_toggle.e

http://github.com/tybor/Liberty
Specman e | 150 lines | 65 code | 32 blank | 53 comment | 2 complexity | e3a2f2a0892e8107e51e51c9224c1ff2 MD5 | raw file
  1indexing
  2	description: "GtkCellRendererToggle Renders a toggle button in a cell."
  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
 23class GTK_CELL_RENDERER_TOGGLE
 24	-- GtkCellRendererToggle renders a toggle button in a cell. The
 25	-- button is drawn as a radio- or checkbutton, depending on the
 26	-- radio property. When activated, it emits the toggled signal.
 27	
 28inherit
 29	GTK_CELL_RENDERER
 30	
 31insert
 32	GTK_CELL_RENDERER_TOGGLE_EXTERNALS
 33	
 34creation make, from_external_pointer
 35
 36feature {} -- size
 37	struct_size: INTEGER is
 38		external "C inline use <gtk/gtk.h>"
 39		alias "sizeof(GtkCellRenderer)"
 40		end
 41
 42feature {} -- Creation
 43	make is
 44			-- Creates a new GtkCellRendererToggle. Adjust rendering
 45			-- parameters using object properties. Object properties can
 46			-- be set globally (with G_OBJECT.set). Also, with
 47			-- GtkTreeViewColumn, you can bind a property to a value in a
 48			-- GtkTreeModel. For example, you can bind the "active"
 49			-- property on the cell renderer to a boolean value in the
 50			-- model, thus causing the check button to reflect the state
 51			-- of the model.
 52		do
 53			from_external_pointer (gtk_cell_renderer_toggle_new)
 54		end
 55
 56feature 
 57	is_radio_toggle: BOOLEAN is
 58			-- Is Current cell rendering a radio toggle rather than a checkbox?
 59		do
 60			Result:=(gtk_cell_renderer_toggle_get_radio(handle).to_boolean)
 61		end
 62	
 63	set_radio is
 64			-- Makes the cell renderer to render a radio toggle (i.e. a
 65			-- toggle in a group of mutually-exclusive toggles). This can
 66			-- be set globally for the cell renderer, or changed just
 67			-- before rendering each cell in the model (for GtkTreeView,
 68			-- you set up a per-row setting using GtkTreeViewColumn to
 69			-- associate model columns with cell renderer properties).
 70		do
 71			gtk_cell_renderer_toggle_set_radio (handle,1)
 72		ensure set: is_radio_toggle
 73		end
 74
 75	unset_radio is
 76			-- Makes the cell renderer to render a check toggle (a
 77			-- standalone boolean option). See also 'set_radio'.
 78			-- with cell renderer properties).
 79		do
 80			gtk_cell_renderer_toggle_set_radio (handle,0)
 81		ensure unset: not is_radio_toggle
 82		end
 83
 84feature -- State
 85	is_active: BOOLEAN is
 86			-- Is the cell renderer is active? See 'set_active'.
 87		do
 88			Result:=gtk_cell_renderer_toggle_get_active(handle).to_boolean
 89		end
 90
 91	set_active is
 92			-- Activates a cell renderer.
 93		do
 94			gtk_cell_renderer_toggle_set_active (handle,1)
 95		ensure set: is_active
 96		end
 97
 98	unset_active, set_inactive is
 99			-- Deactivates a cell renderer. Note TODO: this feature has 
100			-- a double name currently: 'unset_active' is more 
101			-- consistent and follow a common naming scheme while 
102			-- 'set_inactive' should be "easier" to read and understand. 
103			-- Paolo 2006-03-15.
104		do
105			gtk_cell_renderer_toggle_set_active (handle,0)
106		ensure set: is_active
107		end
108
109feature -- TODO: Property Details
110-- The "activatable" property
111
112--   "activatable"          gboolean              : Read / Write
113
114-- The toggle button can be activated.
115
116-- Default value: TRUE
117-- The "active" property
118
119--   "active"               gboolean              : Read / Write
120
121-- The toggle state of the button.
122
123-- Default value: FALSE
124-- The "inconsistent" property
125
126--   "inconsistent"         gboolean              : Read / Write
127
128-- The inconsistent state of the button.
129
130-- Default value: FALSE
131-- The "radio" property
132
133--   "radio"                gboolean              : Read / Write
134
135-- Draw the toggle button as a radio button.
136
137-- Default value: FALSE
138-- Signal Details
139-- The "toggled" signal
140
141-- void        user_function                  (GtkCellRendererToggle *cell_renderer,
142--                                             gchar *path,
143--                                             gpointer user_data);
144
145-- The ::toggled signal is emitted when the cell is toggled.
146
147-- cell_renderer : 	the object which received the signal
148-- path : 	string representation of GtkTreePath describing the event location
149-- user_data : 	user data set when the signal handler was connected.
150end