Change 'undo' and 'clear' buttons to use symbolic icons
[gcalctool.git] / src / unit.h
blob3c9087fbc55dd9854632cdc6a103d0503043982e
1 /*
2 * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright (C) 2008-2011 Robert Ancell.
4 *
5 * This program is free software: you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation, either version 2 of the License, or (at your option) any later
8 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
9 * license.
12 #ifndef UNIT_H
13 #define UNIT_H
15 #include <glib-object.h>
16 #include "mp.h"
18 G_BEGIN_DECLS
20 #define UNIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), unit_get_type(), Unit))
22 typedef struct UnitPrivate UnitPrivate;
24 typedef struct
26 GObject parent_instance;
27 UnitPrivate *priv;
28 } Unit;
30 typedef struct
32 GObjectClass parent_class;
33 } UnitClass;
35 GType unit_get_type(void);
37 Unit *unit_new(const gchar *name,
38 const gchar *display_name,
39 const gchar *format,
40 const gchar *from_function,
41 const gchar *to_function,
42 const gchar *symbols);
44 const gchar *unit_get_name(Unit *unit);
46 const gchar *unit_get_display_name(Unit *unit);
48 gboolean unit_matches_symbol(Unit *unit, const gchar *symbol);
50 const GList *unit_get_symbols(Unit *unit);
52 gboolean unit_convert_from(Unit *unit, const MPNumber *x, MPNumber *z);
54 gboolean unit_convert_to(Unit *unit, const MPNumber *x, MPNumber *z);
56 gchar *unit_format(Unit *unit, MPNumber *x);
58 G_END_DECLS
60 #endif /* UNIT_H */