1 /* LIBGTK - The GTK Library
2 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
5 * Copyright (C) 1999-2003 Michael Natterer <mitch@gimp.org>
7 * This library is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 3 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see
19 * <http://www.gnu.org/licenses/>.
25 #include <glib-object.h>
27 typedef enum /*< skip >*/
38 CM_UNIT_PERCENT = 65536 /*< pdb-skip >*/
41 typedef struct _GtkCMUnitVtable GtkCMUnitVtable;
43 struct _GtkCMUnitVtable
45 gint (* unit_get_number_of_units) (void);
46 gint (* unit_get_number_of_built_in_units) (void);
48 GtkCMUnit (* unit_new) (gchar *identifier,
55 gboolean (* unit_get_deletion_flag) (GtkCMUnit unit);
56 void (* unit_set_deletion_flag) (GtkCMUnit unit,
57 gboolean deletion_flag);
59 gdouble (* unit_get_factor) (GtkCMUnit unit);
60 gint (* unit_get_digits) (GtkCMUnit unit);
61 const gchar * (* unit_get_identifier) (GtkCMUnit unit);
62 const gchar * (* unit_get_symbol) (GtkCMUnit unit);
63 const gchar * (* unit_get_abbreviation) (GtkCMUnit unit);
64 const gchar * (* unit_get_singular) (GtkCMUnit unit);
65 const gchar * (* unit_get_plural) (GtkCMUnit unit);
67 void (* _reserved_1) (void);
68 void (* _reserved_2) (void);
69 void (* _reserved_3) (void);
70 void (* _reserved_4) (void);
74 extern GtkCMUnitVtable _gimp_unit_vtable;
79 void gimp_base_init (GtkCMUnitVtable *vtable);
82 /* For information look into the C source or the html documentation */
87 * #GTK_TYPE_UNIT is a #GType derived from #G_TYPE_INT.
90 #define GTK_TYPE_UNIT (gtk_unit_get_type ())
91 #define GTK_VALUE_HOLDS_UNIT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GTK_TYPE_UNIT))
94 GType gtk_unit_get_type (void) G_GNUC_CONST;
101 #define GTK_TYPE_PARAM_UNIT (gtk_param_unit_get_type ())
102 #define GTK_IS_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GTK_TYPE_PARAM_UNIT))
104 GType gtk_param_unit_get_type (void) G_GNUC_CONST;
106 GParamSpec * gtk_param_spec_unit (const gchar *name,
109 gboolean allow_pixels,
110 gboolean allow_percent,
111 GtkCMUnit default_value,
116 gint gtk_unit_get_number_of_units (void);
117 gint gtk_unit_get_number_of_built_in_units (void) G_GNUC_CONST;
119 GtkCMUnit gtk_unit_new (gchar *identifier,
127 gboolean gtk_unit_get_deletion_flag (GtkCMUnit unit);
128 void gtk_unit_set_deletion_flag (GtkCMUnit unit,
129 gboolean deletion_flag);
131 gdouble gtk_unit_get_factor (GtkCMUnit unit);
133 gint gtk_unit_get_digits (GtkCMUnit unit);
135 const gchar * gtk_unit_get_identifier (GtkCMUnit unit);
137 const gchar * gtk_unit_get_symbol (GtkCMUnit unit);
138 const gchar * gtk_unit_get_abbreviation (GtkCMUnit unit);
139 const gchar * gtk_unit_get_singular (GtkCMUnit unit);
140 const gchar * gtk_unit_get_plural (GtkCMUnit unit);
142 gchar * gtk_unit_format_string (const gchar *format,
145 gdouble gtk_pixels_to_units (gdouble pixels,
148 gdouble gtk_units_to_pixels (gdouble value,
151 gdouble gtk_units_to_points (gdouble value,
158 #endif /* __CM_UNIT_H__ */