1/*
2 * Copyright 2006, Haiku.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Stephan Aßmus <superstippi@gmx.de>
7 */
8
9#include "PropertyEditorFactory.h"
10
11#include "ColorProperty.h"
12#include "Property.h"
13#include "IconProperty.h"
14#include "Int64Property.h"
15#include "OptionProperty.h"
16
17#include "BoolValueView.h"
18#include "ColorValueView.h"
19#include "FloatValueView.h"
20#include "IconValueView.h"
21#include "IntValueView.h"
22#include "Int64ValueView.h"
23#include "OptionValueView.h"
24#include "StringValueView.h"
25
26PropertyEditorView*
27EditorFor(Property* p)
28{
29	if (!p)
30		return NULL;
31
32	if (IntProperty* i = dynamic_cast<IntProperty*>(p))
33		return new IntValueView(i);
34
35	if (FloatProperty* f = dynamic_cast<FloatProperty*>(p))
36		return new FloatValueView(f);
37
38	if (BoolProperty* b = dynamic_cast<BoolProperty*>(p))
39		return new BoolValueView(b);
40
41	if (StringProperty* s = dynamic_cast<StringProperty*>(p))
42		return new StringValueView(s);
43
44	if (Int64Property* i = dynamic_cast<Int64Property*>(p))
45		return new Int64ValueView(i);
46
47	if (OptionProperty* o = dynamic_cast<OptionProperty*>(p))
48		return new OptionValueView(o);
49
50	if (ColorProperty* c = dynamic_cast<ColorProperty*>(p))
51		return new ColorValueView(c);
52
53	if (IconProperty* i = dynamic_cast<IconProperty*>(p)) {
54		IconValueView* view = new IconValueView(i);
55		view->SetIcon(i->Icon(), i->Width(), i->Height(), i->Format());
56		return view;
57	}
58
59
60	return NULL;
61}
62
63