2009-10-09 Chris Toshok <toshok@ximian.com>
[moon.git] / src / size.cpp
blobd0842cee8a733e5ad78de516a9b39fc5fb75ea25
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * size.cpp: specialized code for dealing with SizeChangedEventArgs
5 * Copyright 2007 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
9 */
11 #include <config.h>
13 #include "size.h"
14 #include "utils.h"
16 bool
17 Size::FromStr (const char *s, Size *size)
19 GArray *values = double_garray_from_str (s, 2);
21 if (!values)
22 return false;
24 *size = Size (g_array_index (values, double, 0), g_array_index (values, double, 1));
26 g_array_free (values, true);
28 return true;
31 SizeChangedEventArgs::SizeChangedEventArgs()
33 SetObjectType(Type::SIZECHANGEDEVENTARGS);
34 prev_size = Size (); new_size = Size ();
37 SizeChangedEventArgs::SizeChangedEventArgs (Size prev_size, Size new_size)
39 SetObjectType(Type::SIZECHANGEDEVENTARGS);
40 this->prev_size = prev_size;
41 this->new_size = new_size;
44 void
45 size_changed_event_args_get_prev_size (SizeChangedEventArgs *args, Size *prev_size)
47 *prev_size = args->GetPrevSize ();
50 void
51 size_changed_event_args_get_new_size (SizeChangedEventArgs *args, Size *new_size)
53 *new_size = args->GetNewSize ();