2 * Copyright 2008 Codethink Ltd.
3 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
26 #include "my-atk-object.h"
27 #include "my-atk-value.h"
29 typedef struct _MyAtkValueInfo MyAtkValueInfo;
31 static void atk_value_interface_init (AtkValueIface *iface);
33 G_DEFINE_TYPE_WITH_CODE (MyAtkValue,
36 G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE,
37 atk_value_interface_init));
40 my_atk_set_value (AtkValue *obj, gdouble min, gdouble cur, gdouble max, gdouble step)
42 MyAtkValue *self = MY_ATK_VALUE (obj);
43 g_return_val_if_fail (MY_IS_ATK_VALUE (obj), -1);
54 my_atk_value_get_value_and_text (AtkValue *obj, gdouble *value, gchar **text)
56 MyAtkValue *self = MY_ATK_VALUE (obj);
57 g_return_if_fail (MY_IS_ATK_VALUE (obj));
60 *text = g_strdup_printf ("%f", self->cur);
64 my_atk_value_get_range (AtkValue *obj)
66 MyAtkValue *self = MY_ATK_VALUE (obj);
67 g_return_val_if_fail (MY_IS_ATK_VALUE (obj), NULL);
69 return atk_range_new (self->min, self->max, NULL);
73 my_atk_value_get_increment (AtkValue *obj)
75 MyAtkValue *self = MY_ATK_VALUE (obj);
76 g_return_val_if_fail (MY_IS_ATK_VALUE (obj), 0);
81 my_atk_value_get_sub_ranges (AtkValue *obj)
83 g_return_val_if_fail (MY_IS_ATK_VALUE (obj), NULL);
89 my_atk_value_set_value (AtkValue *obj, const gdouble val)
91 MyAtkValue *self = MY_ATK_VALUE (obj);
92 g_return_if_fail (MY_IS_ATK_VALUE (obj));
94 if ( self->min < val && val < self->max )
100 atk_value_interface_init (AtkValueIface *iface)
103 iface->get_value_and_text = my_atk_value_get_value_and_text;
104 iface->get_range = my_atk_value_get_range;
105 iface->get_increment = my_atk_value_get_increment;
106 iface->get_sub_ranges = my_atk_value_get_sub_ranges;
107 iface->set_value = my_atk_value_set_value;
111 my_atk_value_init (MyAtkValue *self)
120 my_atk_value_class_initialize (AtkObject *obj, gpointer data)
125 my_atk_value_class_finalize (GObject *obj)
130 my_atk_value_class_init(MyAtkValueClass *my_class)
132 AtkObjectClass *atk_class = ATK_OBJECT_CLASS(my_class);
133 GObjectClass *gobject_class = G_OBJECT_CLASS(my_class);
135 gobject_class->finalize = my_atk_value_class_finalize;
137 atk_class->initialize = my_atk_value_class_initialize;