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.
26 * @Short_description: A given range or subrange, to be used with #AtkValue
29 * #AtkRange are used on #AtkValue, in order to represent the full
30 * range of a given component (for example an slider or a range
31 * control), or to define each individual subrange this full range is
32 * splitted if available. See #AtkValue documentation for further
44 * @src: #AtkRange to copy
46 * Returns a new #AtkRange that is a exact copy of @src
50 * Returns: (transfer full): a new #AtkRange copy of @src
53 atk_range_copy (AtkRange *src)
55 g_return_val_if_fail (src != NULL, NULL);
57 return atk_range_new (src->lower,
64 * @range: #AtkRange to free
71 atk_range_free (AtkRange *range)
73 g_return_if_fail (range != NULL);
75 if (range->description)
76 g_free (range->description);
78 g_slice_free (AtkRange, range);
81 G_DEFINE_BOXED_TYPE (AtkRange, atk_range, atk_range_copy,
87 * @lower_limit: inferior limit for this range
88 * @upper_limit: superior limit for this range
89 * @description: human readable description of this range.
91 * Creates a new #AtkRange.
95 * Returns: (transfer full): a new #AtkRange
99 atk_range_new (gdouble lower_limit,
101 const gchar *description)
105 range = g_slice_new0 (AtkRange);
107 range->lower = lower_limit;
108 range->upper = upper_limit;
109 if (description != NULL)
110 range->description = g_strdup (description);
116 * atk_range_get_lower_limit:
117 * @range: an #AtkRange
119 * Returns the lower limit of @range
123 * Returns: the lower limit of @range
126 atk_range_get_lower_limit (AtkRange *range)
128 g_return_val_if_fail (range != NULL, 0);
134 * atk_range_get_upper_limit:
135 * @range: an #AtkRange
137 * Returns the upper limit of @range
141 * Returns: the upper limit of @range
144 atk_range_get_upper_limit (AtkRange *range)
146 g_return_val_if_fail (range != NULL, 0);
152 * atk_range_get_description:
153 * @range: an #AtkRange
155 * Returns the human readable description of @range
159 * Returns: the human-readable description of @range
162 atk_range_get_description (AtkRange *range)
164 g_return_val_if_fail (range != NULL, NULL);
166 return range->description;