2009-08-26 Chris Toshok <toshok@ximian.com>
[moon.git] / src / deepzoomimagetilesource.h
blobcaa8fdccd5845e0c7dca38f5edd09dde3fa0ac34
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-2008 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 "multiscalesubimage.h"
18 #include "multiscaleimage.h"
19 #include "tilesource.h"
20 #include "downloader.h"
21 #include "uri.h"
23 typedef void (*parsed_cb) (void *userdata);
25 /* @Version=2,Namespace=System.Windows.Media */
26 class DeepZoomImageTileSource : public MultiScaleTileSource {
29 Downloader* downloader;
31 parsed_cb parsed_callback;
32 parsed_cb failed_callback;
33 void *cb_userdata;
35 static void downloader_complete (EventObject *sender, EventArgs *calldata, gpointer closure);
36 static void downloader_failed (EventObject *sender, EventArgs *calldata, gpointer closure);
37 void DownloaderComplete ();
38 void download_uri (const char* url);
39 bool downloaded;
40 bool parsed;
41 char *format;
42 bool nested;
43 GList *display_rects;
45 void Init ();
47 void Parse (const char* filename);
49 bool isCollection;
50 int maxLevel;
52 protected:
53 virtual ~DeepZoomImageTileSource ();
55 public:
56 GList *subimages;
57 bool IsCollection () { return isCollection;}
58 int GetMaxLevel () { return maxLevel;}
60 /* @GenerateCBinding,GeneratePInvoke */
61 DeepZoomImageTileSource ();
63 DeepZoomImageTileSource (Uri *uri, bool nested = false);
64 void Download ();
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);
70 void set_parsed_cb (parsed_cb callback, parsed_cb f_callback, void *userdata)
72 parsed_callback = callback;
73 failed_callback = f_callback;
74 cb_userdata = userdata;
79 // Properties
81 /* @PropertyType=Uri,GenerateAccessors */
82 const static int UriSourceProperty;
84 void SetUriSource (Uri* value);
85 Uri* GetUriSource ();
87 void EndElement (void *info, const char* el);
91 #endif /* __DEEPZOOMIMAGETILESOURCE_H__ */