math-buttons: Remove widget background color tints
[gcalctool.git] / src / mp-serializer.h
blob63e59374c528b1d0342da511f28ebd73720234de
1 /*
2 * Copyright (C) 2010 Robin Sonefors
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 MP_SERIALIZER_H
13 #define MP_SERIALIZER_H
15 #include <glib.h>
16 #include <glib-object.h>
18 #include "mp.h"
20 G_BEGIN_DECLS
22 #define MP_TYPE_SERIALIZER (mp_serializer_get_type())
23 #define MP_SERIALIZER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), mp_serializer_get_type(), MpSerializer))
25 typedef struct MpSerializerPrivate MpSerializerPrivate;
27 typedef struct {
28 GObject parent;
29 MpSerializerPrivate *priv;
30 } MpSerializer;
32 typedef struct {
33 GObjectClass parent;
34 } MpSerializerClass;
36 /* Number display mode. */
37 typedef enum {
38 MP_DISPLAY_FORMAT_AUTOMATIC,
39 MP_DISPLAY_FORMAT_FIXED,
40 MP_DISPLAY_FORMAT_SCIENTIFIC,
41 MP_DISPLAY_FORMAT_ENGINEERING
42 } MpDisplayFormat;
44 GType mp_serializer_get_type(void);
46 MpSerializer *mp_serializer_new(MpDisplayFormat format, int base, int trailing_digits);
48 gchar *mp_serializer_to_string(MpSerializer *serializer, const MPNumber *z);
49 gboolean mp_serializer_from_string(MpSerializer *serializer, const gchar *str, MPNumber *z);
51 void mp_serializer_set_number_format(MpSerializer *serializer, MpDisplayFormat format);
52 MpDisplayFormat mp_serializer_get_number_format(MpSerializer *serializer);
54 void mp_serializer_set_base(MpSerializer *serializer, int base);
55 int mp_serializer_get_base(MpSerializer *serializer);
57 void mp_serializer_set_leading_digits(MpSerializer *serializer, int leading_digits);
58 int mp_serializer_get_leading_digits(MpSerializer *serializer);
60 void mp_serializer_set_trailing_digits(MpSerializer *serializer, int trailing_digits);
61 int mp_serializer_get_trailing_digits(MpSerializer *serializer);
63 void mp_serializer_set_radix(MpSerializer *serializer, gunichar radix);
64 gunichar mp_serializer_get_radix(MpSerializer *serializer);
66 void mp_serializer_set_thousands_separator(MpSerializer *serializer, gunichar separator);
67 gunichar mp_serializer_get_thousands_separator(MpSerializer *serializer);
69 gint mp_serializer_get_thousands_separator_count(MpSerializer *serializer);
71 void mp_serializer_set_show_trailing_zeroes(MpSerializer *serializer, gboolean visible);
72 gboolean mp_serializer_get_show_trailing_zeroes(MpSerializer *serializer);
74 void mp_serializer_set_show_thousands_separators(MpSerializer *serializer, gboolean visible);
75 gboolean mp_serializer_get_show_thousands_separators(MpSerializer *serializer);
77 G_END_DECLS
79 #endif /* MP_SERIALIZER_H */