in plugin/:
[moon.git] / src / application.h
blob3ae3abf1801aecf091a0a2d032dbd660e0a42faf
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 UIElement* (*GetDefaultTemplateRootCallback)(ContentControl *ctrl_ptr);
25 /* @CBindingRequisite */
26 typedef void (*ApplyStyleCallback)(FrameworkElement *fwe, Style *style);
27 /* @CBindingRequisite */
28 typedef void *(*ConvertKeyframeValueCallback)(int kind, DependencyProperty *property, Value *original, Value *converted);
29 /* @CBindingRequisite */
30 typedef ManagedStreamCallbacks (*GetResourceCallback)(const char *resourceBase, const char *name);
32 enum NotifyType {NotifyStarted, NotifySize, NotifyProgressChanged, NotifyCompleted, NotifyFailed};
33 typedef void (*NotifyFunc) (NotifyType type, gint64 args, gpointer user_data);
34 typedef void (*WriteFunc) (void* buf, gint32 offset, gint32 n, gpointer user_data);
36 /* @Namespace=None */
37 /* @ManagedDependencyProperties=Manual */
38 /* @ManagedEvents=Manual */
39 class Application : public DependencyObject {
40 public:
41 /* @PropertyType=ResourceDictionary,AutoCreateValue,GenerateAccessors */
42 const static int ResourcesProperty;
44 /* @GenerateCBinding,GeneratePInvoke */
45 Application ();
47 /* @GenerateCBinding,GeneratePInvoke */
48 void RegisterCallbacks (ApplyDefaultStyleCallback apply_default_style_cb, ApplyStyleCallback apply_style_cb, GetResourceCallback get_resource_cb, ConvertKeyframeValueCallback convert_keyframe_callback, GetDefaultTemplateRootCallback get_default_template_root_cb);
50 void ApplyDefaultStyle (FrameworkElement *fwe, ManagedTypeInfo *key);
51 void ApplyStyle (FrameworkElement *fwe, Style *style);
52 UIElement *GetDefaultTemplateRoot (ContentControl *ctrl);
54 void ConvertKeyframeValue (Type::Kind kind, DependencyProperty *property, Value *original, Value *converted);
56 void GetResource (const char *resourceBase, const Uri *uri, NotifyFunc notify_cb, WriteFunc write_cb, DownloaderAccessPolicy policy, Cancellable *cancellable, gpointer user_data);
57 char *GetResourceAsPath (const char *resourceBase, const Uri *uri);
58 const char *GetResourceRoot ();
60 /* @GenerateCBinding,GeneratePInvoke */
61 static Application *GetCurrent ();
62 /* @GenerateCBinding,GeneratePInvoke */
63 static void SetCurrent (Application *current);
66 // Property Accessors
68 void SetResources (ResourceDictionary *value);
69 ResourceDictionary *GetResources ();
71 protected:
72 virtual ~Application ();
74 private:
75 ApplyDefaultStyleCallback apply_default_style_cb;
76 ApplyStyleCallback apply_style_cb;
77 ConvertKeyframeValueCallback convert_keyframe_callback;
78 GetDefaultTemplateRootCallback get_default_template_root_cb;
79 GetResourceCallback get_resource_cb;
80 char *resource_root;
83 #endif /* __APPLICATION_H__ */