2009-12-03 Jeffrey Stedfast <fejj@novell.com>
[moon.git] / src / deepzoomimagetilesource.h
blobaf7f8d6e99f407228aace7f77123ced1d62ceb04
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * deepzoomimagetilesource.h
5 * Contact:
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007-2009 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
14 #ifndef __DEEPZOOMIMAGETILESOURCE_H__
15 #define __DEEPZOOMIMAGETILESOURCE_H__
17 #include <expat.h>
18 #include "multiscalesubimage.h"
19 #include "multiscaleimage.h"
20 #include "tilesource.h"
21 #include "downloader.h"
22 #include "uri.h"
24 typedef void (*msi_cb) (MultiScaleImage *msi);
26 /* @Version=2,Namespace=System.Windows.Media */
27 class DeepZoomImageTileSource : public MultiScaleTileSource {
29 msi_cb parsed_callback;
30 msi_cb failed_callback;
31 msi_cb sourcechanged_callback;
32 MultiScaleImage *cb_userdata;
34 bool downloaded;
35 bool parsed;
36 char *format;
37 bool nested;
38 GList *display_rects;
39 XML_Parser parser;
41 void Init ();
43 void UriSourceChanged ();
44 void Abort ();
46 bool isCollection;
47 int maxLevel;
48 Cancellable *get_resource_aborter;
50 protected:
51 virtual ~DeepZoomImageTileSource ();
53 public:
54 GList *subimages;
55 bool IsCollection () { return isCollection;}
56 int GetMaxLevel () { return maxLevel;}
58 /* @GenerateCBinding,GeneratePInvoke */
59 DeepZoomImageTileSource ();
60 DeepZoomImageTileSource (Uri *uri, bool nested = false);
62 void Download ();
63 void DownloaderComplete ();
64 void DownloaderFailed ();
65 bool GetTileLayer (int level, int x, int y, Uri *uri);
66 bool IsDownloaded () {return downloaded; }
67 bool IsParsed () {return parsed; }
69 virtual void OnPropertyChanged (PropertyChangedEventArgs *args, MoonError *error);
71 void XmlWrite (char* buffer, gint32 offset, gint32 n);
73 void set_callbacks (msi_cb parsed, msi_cb failed, msi_cb source_changed, MultiScaleImage *userdata)
75 parsed_callback = parsed;
76 failed_callback = failed;
77 sourcechanged_callback = source_changed;
78 cb_userdata = userdata;
83 // Properties
85 /* @PropertyType=Uri,GenerateAccessors */
86 const static int UriSourceProperty;
88 void SetUriSource (Uri* value);
89 Uri* GetUriSource ();
91 void EndElement (void *info, const char* el);
94 #endif /* __DEEPZOOMIMAGETILESOURCE_H__ */