1 /* ATK - Accessibility Toolkit
2 * Copyright 2014 Igalia S.L.
4 * Author: Alejandro PiƱeiro Iglesias <apinheiro@igalia.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but 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.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
28 * @Short_description: A given range or subrange, to be used with #AtkValue
31 * #AtkRange are used on #AtkValue, in order to represent the full
32 * range of a given component (for example an slider or a range
33 * control), or to define each individual subrange this full range is
34 * splitted if available. See #AtkValue documentation for further
46 * @src: #AtkRange to copy
48 * Returns a new #AtkRange that is a exact copy of @src
52 * Returns: (transfer full): a new #AtkRange copy of @src
55 atk_range_copy (AtkRange
*src
)
57 g_return_val_if_fail (src
!= NULL
, NULL
);
59 return atk_range_new (src
->lower
,
66 * @range: #AtkRange to free
73 atk_range_free (AtkRange
*range
)
75 g_return_if_fail (range
!= NULL
);
77 if (range
->description
)
78 g_free (range
->description
);
80 g_slice_free (AtkRange
, range
);
83 G_DEFINE_BOXED_TYPE (AtkRange
, atk_range
, atk_range_copy
,
89 * @lower_limit: inferior limit for this range
90 * @upper_limit: superior limit for this range
91 * @description: human readable description of this range.
93 * Creates a new #AtkRange.
97 * Returns: (transfer full): a new #AtkRange
101 atk_range_new (gdouble lower_limit
,
103 const gchar
*description
)
107 range
= g_slice_new0 (AtkRange
);
109 range
->lower
= lower_limit
;
110 range
->upper
= upper_limit
;
111 if (description
!= NULL
)
112 range
->description
= g_strdup (description
);
118 * atk_range_get_lower_limit:
119 * @range: an #AtkRange
121 * Returns the lower limit of @range
125 * Returns: the lower limit of @range
128 atk_range_get_lower_limit (AtkRange
*range
)
130 g_return_val_if_fail (range
!= NULL
, 0);
136 * atk_range_get_upper_limit:
137 * @range: an #AtkRange
139 * Returns the upper limit of @range
143 * Returns: the upper limit of @range
146 atk_range_get_upper_limit (AtkRange
*range
)
148 g_return_val_if_fail (range
!= NULL
, 0);
154 * atk_range_get_description:
155 * @range: an #AtkRange
157 * Returns the human readable description of @range
161 * Returns: the human-readable description of @range
164 atk_range_get_description (AtkRange
*range
)
166 g_return_val_if_fail (range
!= NULL
, NULL
);
168 return range
->description
;