1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007-2008 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
14 #ifndef __BITMAPIMAGE_H__
15 #define __BITMAPIMAGE_H__
17 #include <gdk/gdkpixbuf.h>
20 #include "dependencyobject.h"
21 #include "downloader.h"
22 #include "bitmapsource.h"
24 /* @Namespace=System.Windows.Media.Imaging */
25 class BitmapImage
: public BitmapSource
{
27 Downloader
*downloader
;
28 GdkPixbufLoader
*loader
;
31 Cancellable
*get_res_aborter
;
32 DownloaderAccessPolicy policy
;
35 virtual ~BitmapImage ();
38 /* @GenerateCBinding,GeneratePInvoke */
40 virtual void Dispose ();
42 /* @PropertyType=Uri,AlwaysChange,GenerateAccessors,DefaultValue=Uri() */
43 const static int UriSourceProperty
;
44 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
45 const static int ProgressProperty
;
47 void SetUriSource (Uri
* value
);
50 void SetProgress (double progress
);
51 double GetProgress ();
53 void SetDownloadPolicy (DownloaderAccessPolicy dlpolicy
)
58 void CleanupLoader ();
59 void CreateLoader (unsigned char *buffer
);
60 /* @GenerateCBinding,GeneratePInvoke */
61 void PixbufWrite (gpointer buffer
, gint32 offset
, gint32 n
);
62 /* @GenerateCBinding,GeneratePInvoke */
63 void PixmapComplete ();
65 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
67 /* @DelegateType=EventHandler<DownloadProgressEventArgs> */
68 const static int DownloadProgressEvent
;
69 /* @DelegateType=EventHandler<ExceptionRoutedEventArgs> */
70 const static int ImageFailedEvent
;
71 /* @DelegateType=EventHandler<RoutedEventArgs> */
72 const static int ImageOpenedEvent
;
74 void SetDownloader (Downloader
*downloader
, Uri
*uri
, const char *part_name
);
75 void CleanupDownloader ();
76 void DownloaderProgressChanged ();
77 void DownloaderComplete ();
78 void DownloaderFailed ();
79 void UriSourceChanged ();
82 static void uri_source_changed_callback (EventObject
*user_data
);
83 static void downloader_progress_changed (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
84 static void downloader_complete (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
85 static void downloader_failed (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
86 static void pixbuf_write (void *buffer
, gint32 offset
, gint32 n
, gpointer data
);
89 #endif /* __BITMAPIMAGE_H__ */