Author: toshok
Date: 2007-12-14 13:51:50 -0500 (Fri, 14 Dec 2007)
New Revision: 91309
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/brush.cpp
trunk/moon/src/brush.h
trunk/moon/src/type.cpp
trunk/moon/src/type.cpp.in
Log:
2007-12-14 Chris Toshok <[EMAIL PROTECTED]>
* type.cpp.in, type.cpp (types_init_register_events): need to
register DownloadProgressChanged and ImageFailed events on
imagebrushes.
* brush.h, brush.cpp: same, and hook up the events from
ImageBrush's embedded image so that we can re-emit the events.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-12-14 18:24:19 UTC (rev 91308)
+++ trunk/moon/src/ChangeLog 2007-12-14 18:51:50 UTC (rev 91309)
@@ -1,3 +1,12 @@
+2007-12-14 Chris Toshok <[EMAIL PROTECTED]>
+
+ * type.cpp.in, type.cpp (types_init_register_events): need to
+ register DownloadProgressChanged and ImageFailed events on
+ imagebrushes.
+
+ * brush.h, brush.cpp: same, and hook up the events from
+ ImageBrush's embedded image so that we can re-emit the events.
+
2007-12-14 Jeffrey Stedfast <[EMAIL PROTECTED]>
* downloader.cpp (Downloader::Abort): Don't abort if we've already
Modified: trunk/moon/src/brush.cpp
===================================================================
--- trunk/moon/src/brush.cpp 2007-12-14 18:24:19 UTC (rev 91308)
+++ trunk/moon/src/brush.cpp 2007-12-14 18:51:50 UTC (rev 91309)
@@ -776,6 +776,9 @@
DependencyProperty* ImageBrush::DownloadProgressProperty;
DependencyProperty* ImageBrush::ImageSourceProperty;
+int ImageBrush::DownloadProgressChangedEvent = -1;
+int ImageBrush::ImageFailedEvent = -1;
+
ImageBrush *
image_brush_new (void)
{
@@ -813,9 +816,25 @@
brush->SetSource (dl, PartName);
}
+void
+ImageBrush::image_progress_changed (EventObject *sender, gpointer calldata,
gpointer closure)
+{
+ ((ImageBrush*)closure)->Emit (ImageBrush::DownloadProgressChangedEvent);
+}
+
+void
+ImageBrush::image_failed (EventObject *sender, gpointer calldata, gpointer
closure)
+{
+ ((ImageBrush*)closure)->Emit (ImageBrush::ImageFailedEvent);
+}
+
ImageBrush::ImageBrush ()
{
image = new Image ();
+
+ image->AddHandler (MediaBase::DownloadProgressChangedEvent,
image_progress_changed, this);
+ image->AddHandler (Image::ImageFailedEvent, image_failed, this);
+
image->brush = this;
}
@@ -1301,4 +1320,8 @@
/* VisualBrush */
VisualBrush::VisualProperty = DependencyObject::Register
(Type::VISUALBRUSH, "Visual", new Value (Type::VISUAL));
+
+ /* lookup events */
+ Type *t = Type::Find (Type::IMAGEBRUSH);
+ ImageBrush::DownloadProgressChangedEvent = t->LookupEvent
("DownloadProgressChanged");
}
Modified: trunk/moon/src/brush.h
===================================================================
--- trunk/moon/src/brush.h 2007-12-14 18:24:19 UTC (rev 91308)
+++ trunk/moon/src/brush.h 2007-12-14 18:51:50 UTC (rev 91309)
@@ -144,11 +144,18 @@
class ImageBrush : public TileBrush {
+
+ static void image_progress_changed (EventObject *sender, gpointer
calldata, gpointer closure);
+ static void image_failed (EventObject *sender, gpointer calldata,
gpointer closure);
+
Image *image;
public:
static DependencyProperty *DownloadProgressProperty;
static DependencyProperty *ImageSourceProperty;
+ static int DownloadProgressChangedEvent;
+ static int ImageFailedEvent;
+
ImageBrush ();
virtual ~ImageBrush ();
Modified: trunk/moon/src/type.cpp
===================================================================
--- trunk/moon/src/type.cpp 2007-12-14 18:24:19 UTC (rev 91308)
+++ trunk/moon/src/type.cpp 2007-12-14 18:51:50 UTC (rev 91309)
@@ -362,6 +362,10 @@
t = Type::Find (Type::IMAGE);
t->RegisterEvent ("ImageFailed");
+ t = Type::Find (Type::IMAGEBRUSH);
+ t->RegisterEvent ("DownloadProgressChanged");
+ t->RegisterEvent ("ImageFailed");
+
t = Type::Find(Type::SURFACE);
t->RegisterEvent ("Resize");
t->RegisterEvent ("FullScreenChange");
Modified: trunk/moon/src/type.cpp.in
===================================================================
--- trunk/moon/src/type.cpp.in 2007-12-14 18:24:19 UTC (rev 91308)
+++ trunk/moon/src/type.cpp.in 2007-12-14 18:51:50 UTC (rev 91309)
@@ -357,6 +357,10 @@
t = Type::Find (Type::IMAGE);
t->RegisterEvent ("ImageFailed");
+ t = Type::Find (Type::IMAGEBRUSH);
+ t->RegisterEvent ("DownloadProgressChanged");
+ t->RegisterEvent ("ImageFailed");
+
t = Type::Find(Type::SURFACE);
t->RegisterEvent ("Resize");
t->RegisterEvent ("FullScreenChange");
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches