revert jeff's last commit since it breaks the build
[moon.git] / src / application.h
blobf6b4a3409a63f545e7622dff64e19fecb4d71e49
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * application.h:
5 * Copyright 2008 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
8 */
10 #ifndef __APPLICATION_H__
11 #define __APPLICATION_H__
13 #include <glib.h>
15 #include "utils.h"
16 #include "enums.h"
17 #include "control.h"
18 #include "dependencyobject.h"
19 #include "downloader.h"
21 /* @CBindingRequisite */
22 typedef void (*ApplyDefaultStyleCallback)(FrameworkElement *fwe, ManagedTypeInfo *key);
23 /* @CBindingRequisite */
24 typedef void (*ApplyStyleCallback)(FrameworkElement *fwe, Style *style);
25 /* @CBindingRequisite */
26 typedef void *(*ConvertKeyframeValueCallback)(int kind, DependencyProperty *property, Value *original, Value *converted);
27 /* @CBindingRequisite */
28 typedef ManagedStreamCallbacks (*GetResourceCallback)(const char *resourceBase, const char *name);
30 enum NotifyType {NotifyStarted, NotifySize, NotifyProgressChanged, NotifyCompleted, NotifyFailed};
31 typedef void (*NotifyFunc) (NotifyType type, gint64 args, gpointer user_data);
32 typedef void (*WriteFunc) (void* buf, gint32 offset, gint32 n, gpointer user_data);
34 /* @Namespace=None */
35 /* @ManagedDependencyProperties=Manual */
36 /* @ManagedEvents=Manual */
37 class Application : public DependencyObject {
38 public:
39 /* @PropertyType=ResourceDictionary,AutoCreateValue,GenerateAccessors */
40 const static int ResourcesProperty;
42 /* @GenerateCBinding,GeneratePInvoke */
43 Application ();
45 /* @GenerateCBinding,GeneratePInvoke */
46 void RegisterCallbacks (ApplyDefaultStyleCallback apply_default_style_cb, ApplyStyleCallback apply_style_cb, GetResourceCallback get_resource_cb, ConvertKeyframeValueCallback convert_keyframe_callback);
48 void ApplyDefaultStyle (FrameworkElement *fwe, ManagedTypeInfo *key);
49 void ApplyStyle (FrameworkElement *fwe, Style *style);
51 void ConvertKeyframeValue (Type::Kind kind, DependencyProperty *property, Value *original, Value *converted);
53 bool GetResource (const char *resourceBase, const Uri *uri, NotifyFunc notify_cb, WriteFunc write_cb, DownloaderAccessPolicy policy, Cancellable *cancellable, gpointer user_data);
54 char *GetResourceAsPath (const char *resourceBase, const Uri *uri);
55 const char *GetResourceRoot ();
57 /* @GenerateCBinding,GeneratePInvoke */
58 static Application *GetCurrent ();
59 /* @GenerateCBinding,GeneratePInvoke */
60 static void SetCurrent (Application *current);
63 // Property Accessors
65 void SetResources (ResourceDictionary *value);
66 ResourceDictionary *GetResources ();
68 protected:
69 virtual ~Application ();
71 private:
72 ApplyDefaultStyleCallback apply_default_style_cb;
73 ApplyStyleCallback apply_style_cb;
74 ConvertKeyframeValueCallback convert_keyframe_callback;
75 GetResourceCallback get_resource_cb;
76 char *resource_root;
79 #endif /* __APPLICATION_H__ */