1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * resources.h: Resource dictionaries.
5 * Copyright 2007 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
11 #ifndef __MOON_RESOURCES_H__
12 #define __MOON_RESOURCES_H__
16 #include "collection.h"
19 class ResourceDictionaryIterator
: public CollectionIterator
{
26 ResourceDictionaryIterator (ResourceDictionary
*resources
);
28 virtual bool Next (MoonError
*error
);
29 virtual bool Reset ();
31 virtual Value
*GetCurrent (MoonError
*error
);
33 /* @GenerateCBinding,GeneratePInvoke */
34 const char *GetCurrentKey (MoonError
*error
);
37 /* @Namespace=System.Windows */
38 class ResourceDictionary
: public Collection
{
39 friend class ResourceDictionaryIterator
;
42 /* @PropertyType=ResourceDictionaryCollection,AutoCreateValue,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors,ManagedPropertyType=PresentationFrameworkCollection<ResourceDictionary> */
43 const static int MergedDictionariesProperty
;
45 /* @GenerateCBinding,GeneratePInvoke */
46 ResourceDictionary ();
48 /* just to provide an implementation. our CanAdd always returns true. */
49 virtual Type::Kind
GetElementType () { return Type::INVALID
;}
51 virtual CollectionIterator
*GetIterator ();
53 bool Add (const char* key
, Value
*value
);
55 /* @GenerateCBinding,GeneratePInvoke */
56 bool AddWithError (const char* key
, Value
*value
, MoonError
*error
);
58 /* @GenerateCBinding,GeneratePInvoke */
61 /* @GenerateCBinding,GeneratePInvoke */
62 bool ContainsKey (const char *key
);
64 /* @GenerateCBinding,GeneratePInvoke */
65 bool Remove (const char *key
);
67 /* @GenerateCBinding,GeneratePInvoke */
68 bool Set (const char *key
, Value
*value
);
70 /* @GenerateCBinding,GeneratePInvoke */
71 Value
* Get (const char *key
, bool *exists
);
72 Value
* GetFromMergedDictionaries (const char *key
, bool *exists
);
74 ResourceDictionaryCollection
*GetMergedDictionaries ();
75 void SetMergedDictionaries (ResourceDictionaryCollection
* value
);
77 virtual void SetIsAttached (bool value
);
78 virtual void UnregisterAllNamesRootedAt (NameScope
*from_ns
);
79 virtual void RegisterAllNamesRootedAt (NameScope
*to_ns
, MoonError
*error
);
82 virtual ~ResourceDictionary ();
84 virtual bool CanAdd (Value
*value
);
86 virtual bool AddedToCollection (Value
*value
, MoonError
*error
);
87 virtual void RemovedFromCollection (Value
*value
);
91 bool from_resource_dictionary_api
;
94 #endif /* __MOON_RESOURCES_H__ */