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 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
);
35 /* @ManagedDependencyProperties=Manual */
36 /* @ManagedEvents=Manual */
37 class Application
: public DependencyObject
{
39 /* @PropertyType=ResourceDictionary,AutoCreateValue,GenerateAccessors */
40 const static int ResourcesProperty
;
42 /* @GenerateCBinding,GeneratePInvoke */
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
);
65 void SetResources (ResourceDictionary
*value
);
66 ResourceDictionary
*GetResources ();
69 virtual ~Application ();
72 ApplyDefaultStyleCallback apply_default_style_cb
;
73 ApplyStyleCallback apply_style_cb
;
74 ConvertKeyframeValueCallback convert_keyframe_callback
;
75 GetResourceCallback get_resource_cb
;
79 #endif /* __APPLICATION_H__ */