Crazy Eddie's GUI System 0.8.7
Loading...
Searching...
No Matches
FalagardPropertyBase.h
1/***********************************************************************
2 created: Sat Jun 16 2012
3 author: Paul D Turner <paul@cegui.org.uk>
4*************************************************************************/
5/***************************************************************************
6 * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27#ifndef _CEGUIFalagardPropertyBase_h_
28#define _CEGUIFalagardPropertyBase_h_
29
30#include "CEGUI/TypedProperty.h"
31#include "CEGUI/falagard/PropertyDefinitionBase.h"
32
33namespace CEGUI
34{
35template <typename T>
37{
38public:
39 //------------------------------------------------------------------------//
40 typedef typename TypedProperty<T>::Helper Helper;
41
42 //------------------------------------------------------------------------//
43 FalagardPropertyBase(const String& name, const String& help,
44 const String& initialValue, const String& origin,
45 bool redrawOnWrite, bool layoutOnWrite,
46 const String& fireEvent, const String& eventNamespace) :
47 PropertyDefinitionBase(name, help, initialValue,
48 redrawOnWrite, layoutOnWrite,
49 fireEvent, eventNamespace),
50 TypedProperty<T>(name, help, origin,
51 Helper::fromString(initialValue))
52 {}
53
54 //------------------------------------------------------------------------//
56
57protected:
58 //------------------------------------------------------------------------//
59 void setNative_impl(PropertyReceiver* receiver,
60 typename Helper::pass_type /*value*/)
61 {
62 if (d_writeCausesLayout)
63 static_cast<Window*>(receiver)->performChildWindowLayout();
64
65 if (d_writeCausesRedraw)
66 static_cast<Window*>(receiver)->invalidate();
67
68 if (!d_eventFiredOnWrite.empty())
69 {
70 WindowEventArgs args(static_cast<Window*>(receiver));
71 args.window->fireEvent(d_eventFiredOnWrite, args,
72 d_eventNamespace);
73 }
74 }
75
76 //------------------------------------------------------------------------//
77};
78
79}
80
81#endif
82
virtual void fireEvent(const String &name, EventArgs &args, const String &eventNamespace="")
Fires the named event passing the given EventArgs object.
Definition FalagardPropertyBase.h:37
common base class used for types representing a new property to be available on all widgets that use ...
Definition PropertyDefinitionBase.h:43
Helper class used to convert various data types to and from the format expected in Property strings.
Definition PropertyHelper.h:84
Dummy base class to ensure correct casting of receivers.
Definition Property.h:46
String class used within the GUI system.
Definition String.h:64
bool empty(void) const
Returns true if the String is empty.
Definition String.h:633
base class for properties able to do native set/get
Definition TypedProperty.h:50
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition InputEvent.h:252
Window * window
pointer to a Window object of relevance to the event.
Definition InputEvent.h:256
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition Window.h:151
Main namespace for Crazy Eddie's GUI Library.
Definition arch_overview.dox:1