1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5 * Copyright 2008 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
10 #ifndef __APPLICATION_H__
11 #define __APPLICATION_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
);
37 /* @ManagedDependencyProperties=Manual */
38 /* @ManagedEvents=Manual */
39 class Application
: public DependencyObject
{
41 /* @PropertyType=ResourceDictionary,AutoCreateValue,GenerateAccessors */
42 const static int ResourcesProperty
;
44 /* @GenerateCBinding,GeneratePInvoke */
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
);
68 void SetResources (ResourceDictionary
*value
);
69 ResourceDictionary
*GetResources ();
72 virtual ~Application ();
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
;
83 #endif /* __APPLICATION_H__ */