2009-09-12 Chris Toshok <toshok@ximian.com>
[moon.git] / src / cornerradius.cpp
bloba76ba11f0cee4d1eba0b8fd0102da84205596277
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * cornerradius.cpp: CornerRadius parsing
5 * Contact:
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
14 #include <config.h>
16 #include <string.h>
17 #include <stdlib.h>
18 #include <math.h>
20 #include "utils.h"
21 #include "cornerradius.h"
23 bool
24 CornerRadius::FromStr (const char *str, CornerRadius *corner)
26 GArray *values = double_garray_from_str (str, 0);
27 bool rv = true;
29 *corner = NULL;
31 switch (values->len) {
32 case 1:
33 *corner = CornerRadius (g_array_index (values, double, 0));
34 break;
35 case 4:
36 *corner = CornerRadius (g_array_index (values, double, 0),
37 g_array_index (values, double, 1),
38 g_array_index (values, double, 2),
39 g_array_index (values, double, 3));
40 break;
41 default:
42 g_warning ("CornerRadius specified with %d values, '%s'.", values->len, str);
43 rv = false;
44 break;
47 if (values)
48 g_array_free (values, TRUE);
50 return rv;