2009-11-08 Chris Toshok <toshok@ximian.com>
[moon.git] / src / resources.h
blobebaddbe5bfa74216c00fa3ca4001841cd8df3d7f
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
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.
8 *
9 */
11 #ifndef __MOON_RESOURCES_H__
12 #define __MOON_RESOURCES_H__
14 #include <glib.h>
16 #include "collection.h"
17 #include "value.h"
19 /* @Namespace=System.Windows */
20 class ResourceDictionary : public Collection {
21 public:
22 /* @PropertyType=ResourceDictionaryCollection,AutoCreateValue,ManagedFieldAccess=Internal,ManagedSetterAccess=Internal,GenerateAccessors */
23 const static int MergedDictionariesProperty;
25 /* @GenerateCBinding,GeneratePInvoke */
26 ResourceDictionary ();
28 /* just to provide an implementation. our CanAdd always returns true. */
29 virtual Type::Kind GetElementType () { return Type::INVALID;}
31 bool Add (const char* key, Value *value);
33 /* @GenerateCBinding,GeneratePInvoke */
34 bool AddWithError (const char* key, Value *value, MoonError *error);
36 /* @GenerateCBinding,GeneratePInvoke */
37 bool Clear ();
39 /* @GenerateCBinding,GeneratePInvoke */
40 bool ContainsKey (const char *key);
42 /* @GenerateCBinding,GeneratePInvoke */
43 bool Remove (const char *key);
45 /* @GenerateCBinding,GeneratePInvoke */
46 bool Set (const char *key, Value *value);
48 /* @GenerateCBinding,GeneratePInvoke */
49 Value* Get (const char *key, bool *exists);
50 Value* GetFromMergedDictionaries (const char *key, bool *exists);
52 ResourceDictionaryCollection *GetMergedDictionaries ();
53 void SetMergedDictionaries (ResourceDictionaryCollection* value);
55 virtual void SetSurface (Surface *surface);
56 virtual void UnregisterAllNamesRootedAt (NameScope *from_ns);
57 virtual void RegisterAllNamesRootedAt (NameScope *to_ns, MoonError *error);
59 protected:
60 virtual ~ResourceDictionary ();
62 virtual bool CanAdd (Value *value);
64 virtual bool AddedToCollection (Value *value, MoonError *error);
65 virtual void RemovedFromCollection (Value *value);
67 private:
68 GHashTable *hash;
69 bool from_resource_dictionary_api;
72 #endif /* __MOON_RESOURCES_H__ */