2009-10-09 Chris Toshok <toshok@ximian.com>
[moon.git] / src / glyphs.h
blob9445862cd36b1a9c9141b544911e7ab885881c54
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * glyphs.h:
5 * Contact:
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
13 #ifndef __GLYPHS_H__
14 #define __GLYPHS_H__
16 #include <glib.h>
17 #include <cairo.h>
19 #include "frameworkelement.h"
20 #include "downloader.h"
21 #include "fontfamily.h"
22 #include "fontstretch.h"
23 #include "fontstyle.h"
24 #include "fontweight.h"
25 #include "moon-path.h"
26 #include "thickness.h"
27 #include "layout.h"
28 #include "brush.h"
29 #include "fonts.h"
31 /* @Namespace=System.Windows.Documents */
32 class Glyphs : public FrameworkElement {
33 Downloader *downloader;
35 moon_path *path;
36 TextFont *font;
37 gunichar *text;
38 List *attrs;
39 Brush *fill;
41 double height;
42 double width;
43 double left;
44 double top;
46 int uri_changed:1;
47 int invalid:1;
48 int dirty:1;
50 void Layout ();
51 void SetIndicesInternal (const char *in);
53 void CleanupDownloader ();
54 void DownloaderComplete ();
56 static void downloader_complete (EventObject *sender, EventArgs *calldata, gpointer closure);
58 void LoadFont (const Uri *uri, const char *path);
59 void DownloadFont (Surface *surface, Uri *uri);
60 bool SetFontResource (const Uri *uri);
62 protected:
63 virtual ~Glyphs ();
65 public:
66 /* @PropertyType=Brush,GenerateAccessors */
67 const static int FillProperty;
68 /* @PropertyType=double,DefaultValue=0.0,GenerateAccessors */
69 const static int FontRenderingEmSizeProperty;
70 /* @PropertyType=Uri,GenerateAccessors,DefaultValue=Uri(),Validator=NonNullValidator */
71 const static int FontUriProperty;
72 /* @PropertyType=string,DefaultValue=\"\",GenerateAccessors */
73 const static int IndicesProperty;
74 /* @PropertyType=double,DefaultValue=-HUGE,Validator=FloatValidator,GenerateAccessors */
75 const static int OriginXProperty;
76 /* @PropertyType=double,DefaultValue=-HUGE,Validator=FloatValidator,GenerateAccessors */
77 const static int OriginYProperty;
78 /* @PropertyType=StyleSimulations,DefaultValue=StyleSimulationsNone,GenerateAccessors */
79 const static int StyleSimulationsProperty;
80 /* @PropertyType=string,DefaultValue=\"\",GenerateAccessors */
81 const static int UnicodeStringProperty;
83 /* @GenerateCBinding,GeneratePInvoke */
84 Glyphs ();
86 virtual void GetSizeForBrush (cairo_t *cr, double *width, double *height);
87 virtual void Render (cairo_t *cr, Region *region, bool path_only = false);
88 virtual Size ComputeActualSize ();
89 virtual void ComputeBounds ();
90 virtual Size MeasureOverride (Size availableSize);
91 virtual Size ArrangeOverride (Size finalSize);
92 virtual bool InsideObject (cairo_t *cr, double x, double y);
93 virtual Point GetTransformOrigin ();
94 virtual Point GetOriginPoint ();
95 virtual void SetSurface (Surface *surface);
96 virtual void OnPropertyChanged (PropertyChangedEventArgs *args, MoonError *error);
97 virtual void OnSubPropertyChanged (DependencyProperty *prop, DependencyObject *obj, PropertyChangedEventArgs *subobj_args);
100 // Property Accessors
102 void SetFill (Brush *fill);
103 Brush *GetFill ();
105 void SetFontRenderingEmSize (double size);
106 double GetFontRenderingEmSize ();
108 void SetFontUri (Uri *uri);
109 Uri* GetFontUri ();
111 void SetIndices (const char *indices);
112 const char *GetIndices ();
114 void SetOriginX (double origin);
115 double GetOriginX ();
117 void SetOriginY (double origin);
118 double GetOriginY ();
120 void SetStyleSimulations (StyleSimulations style);
121 StyleSimulations GetStyleSimulations ();
123 void SetUnicodeString (const char *unicode);
124 const char *GetUnicodeString ();
127 #endif /* __GLYPHS_H__ */