~ubuntu-branches/ubuntu/karmic/moon/karmic

« back to all changes in this revision

Viewing changes to src/usercontrol.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-14 12:01:08 UTC
  • Revision ID: james.westby@ubuntu.com-20090214120108-06539vb25vhbd8bn
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * control.cpp:
 
3
 *
 
4
 * Copyright 2007 Novell, Inc. (http://www.novell.com)
 
5
 *
 
6
 * See the LICENSE file included with the distribution for details.
 
7
 * 
 
8
 */
 
9
 
 
10
#include <config.h>
 
11
#include "usercontrol.h"
 
12
 
 
13
UIElement *
 
14
user_control_get_content (UserControl *user_control)
 
15
{
 
16
        Value* v =user_control-> GetValue (UserControl::ContentProperty);
 
17
        if (!v)
 
18
                return NULL;
 
19
        return v->AsUIElement ();
 
20
}
 
21
 
 
22
void
 
23
UserControl::OnPropertyChanged (PropertyChangedEventArgs *args)
 
24
{
 
25
        if (args->property->GetOwnerType() != Type::USERCONTROL) {
 
26
                Control::OnPropertyChanged (args);
 
27
                return;
 
28
        }
 
29
        
 
30
        if (args->property == UserControl::ContentProperty){
 
31
                if (args->old_value) {
 
32
                        ElementRemoved (args->old_value->AsUIElement ());
 
33
                }
 
34
                if (args->new_value) {
 
35
                        ElementAdded (args->new_value->AsUIElement ());
 
36
                }
 
37
 
 
38
                UpdateBounds ();
 
39
        }
 
40
        NotifyListenersOfPropertyChange (args);
 
41
}
 
42
 
 
43
UserControl::UserControl ()
 
44
{
 
45
}
 
46
 
 
47
UserControl::~UserControl ()
 
48
{
 
49
}