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>
19 #include "dependencyobject.h"
20 #include "downloader.h"
21 #include "bitmapsource.h"
23 /* @Namespace=System.Windows.Media.Imaging */
24 class BitmapImage
: public BitmapSource
{
26 Downloader
*downloader
;
27 GdkPixbufLoader
*loader
;
32 virtual ~BitmapImage ();
35 /* @GenerateCBinding,GeneratePInvoke */
37 virtual void Dispose ();
39 /* @PropertyType=Uri,GenerateAccessors,DefaultValue=Uri() */
40 const static int UriSourceProperty
;
41 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
42 const static int ProgressProperty
;
44 void SetUriSource (Uri
* value
);
47 void SetProgress (double progress
);
48 double GetProgress ();
50 void CleanupLoader ();
51 void CreateLoader (unsigned char *buffer
);
52 /* @GenerateCBinding,GeneratePInvoke */
53 void PixbufWrite (gpointer buffer
, gint32 offset
, gint32 n
);
54 /* @GenerateCBinding,GeneratePInvoke */
55 void PixmapComplete ();
57 virtual void OnPropertyChanged (PropertyChangedEventArgs
*args
, MoonError
*error
);
59 const static int DownloadProgressEvent
;
60 const static int ImageFailedEvent
;
61 const static int ImageOpenedEvent
;
63 void SetDownloader (Downloader
*downloader
, Uri
*uri
, const char *part_name
);
64 void CleanupDownloader ();
65 void DownloaderProgressChanged ();
66 void DownloaderComplete ();
67 void DownloaderFailed ();
68 void UriSourceChanged ();
70 static void uri_source_changed_callback (EventObject
*user_data
);
71 static void downloader_progress_changed (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
72 static void downloader_complete (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
73 static void downloader_failed (EventObject
*sender
, EventArgs
*calldata
, gpointer closure
);
74 static void pixbuf_write (void *buffer
, gint32 offset
, gint32 n
, gpointer data
);
77 #endif /* __BITMAPIMAGE_H__ */