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 bool ValidateDownloadPolicy ();
60 void CleanupLoader ();
61 void CreateLoader (unsigned char *buffer
);
62 /* @GenerateCBinding,GeneratePInvoke */
63 void PixbufWrite (gpointer buffer
, gint32 offset
, gint32 n
);
64 /* @GenerateCBinding,GeneratePInvoke */
65 void PixmapComplete ();
67 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
69 /* @DelegateType=EventHandler<DownloadProgressEventArgs> */
70 const static int DownloadProgressEvent
;
71 /* @DelegateType=EventHandler<ExceptionRoutedEventArgs> */
72 const static int ImageFailedEvent
;
73 /* @DelegateType=EventHandler<RoutedEventArgs> */
74 const static int ImageOpenedEvent
;
76 void SetDownloader (Downloader
*downloader
, Uri
*uri
, const char *part_name
);
77 void CleanupDownloader ();
78 void DownloaderProgressChanged ();
79 void DownloaderComplete ();
80 void DownloaderFailed ();
81 void UriSourceChanged ();
84 static void uri_source_changed_callback (EventObject
*user_data
);
85 static void downloader_progress_changed (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
86 static void downloader_complete (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
87 static void downloader_failed (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
88 static void pixbuf_write (void *buffer
, gint32 offset
, gint32 n
, gpointer data
);
91 #endif /* __BITMAPIMAGE_H__ */