2009-12-01 Jeffrey Stedfast <fejj@novell.com>
[moon.git] / src / glyphs.h
blobe11b8a29f67836729834e08ba4d955b8282d2653
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 (Uri *uri, MoonError *error);
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 Point GetTransformOrigin ();
93 virtual Point GetOriginPoint ();
94 virtual void SetParent (DependencyObject *parent, MoonError *error);
95 virtual void OnPropertyChanged (PropertyChangedEventArgs *args, MoonError *error);
96 virtual void OnSubPropertyChanged (DependencyProperty *prop, DependencyObject *obj, PropertyChangedEventArgs *subobj_args);
99 // Property Accessors
101 void SetFill (Brush *fill);
102 Brush *GetFill ();
104 void SetFontRenderingEmSize (double size);
105 double GetFontRenderingEmSize ();
107 void SetFontUri (Uri *uri);
108 Uri* GetFontUri ();
110 void SetIndices (const char *indices);
111 const char *GetIndices ();
113 void SetOriginX (double origin);
114 double GetOriginX ();
116 void SetOriginY (double origin);
117 double GetOriginY ();
119 void SetStyleSimulations (StyleSimulations style);
120 StyleSimulations GetStyleSimulations ();
122 void SetUnicodeString (const char *unicode);
123 const char *GetUnicodeString ();
126 #endif /* __GLYPHS_H__ */