Author: zoltan
Date: 2007-09-25 17:49:46 -0400 (Tue, 25 Sep 2007)
New Revision: 86361

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/text.cpp
   trunk/moon/src/text.h
Log:
2007-09-26  Zoltan Varga  <[EMAIL PROTECTED]>

        * text.cpp (TextBlock): Set an empty string as a default Text property.
        (InsideObject): Implement this for text blocks.


Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-09-25 21:43:56 UTC (rev 86360)
+++ trunk/moon/src/ChangeLog    2007-09-25 21:49:46 UTC (rev 86361)
@@ -1,3 +1,8 @@
+2007-09-26  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * text.cpp (TextBlock): Set an empty string as a default Text property.
+       (InsideObject): Implement this for text blocks.
+
 2007-09-25  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * font.cpp: Fix warning.

Modified: trunk/moon/src/text.cpp
===================================================================
--- trunk/moon/src/text.cpp     2007-09-25 21:43:56 UTC (rev 86360)
+++ trunk/moon/src/text.cpp     2007-09-25 21:49:46 UTC (rev 86361)
@@ -343,6 +343,8 @@
        pango_font_description_set_style (font, font_style (style));
        FontWeights weight = text_block_get_font_weight (this);
        pango_font_description_set_weight (font, font_weight (weight));
+
+       text_block_set_text (this, (char*)"");
        
        // this has to come last, since in our OnPropertyChanged
        // method we update our bounds.
@@ -392,6 +394,28 @@
 // no-op       bounds.GrowBy (1);
 }
 
+bool
+TextBlock::InsideObject (cairo_t *cr, double x, double y)
+{
+       bool ret = false;
+
+       cairo_save (cr);
+
+       double nx = x;
+       double ny = y;
+
+       cairo_matrix_t inverse = absolute_xform;
+       cairo_matrix_invert (&inverse);
+
+       cairo_matrix_transform_point (&inverse, &nx, &ny);
+
+       if (nx >= 0.0 && ny >= 0.0 && nx < GetActualWidth () && ny < 
GetActualHeight ())
+               ret = true;
+
+       cairo_restore (cr);
+       return ret;
+}
+
 Point
 TextBlock::GetTransformOrigin ()
 {

Modified: trunk/moon/src/text.h
===================================================================
--- trunk/moon/src/text.h       2007-09-25 21:43:56 UTC (rev 86360)
+++ trunk/moon/src/text.h       2007-09-25 21:49:46 UTC (rev 86361)
@@ -163,6 +163,7 @@
        virtual void Render (cairo_t *cr, int x, int y, int width, int height);
        virtual void GetSizeForBrush (cairo_t *cr, double *width, double 
*height);
        virtual void ComputeBounds ();
+       virtual bool InsideObject (cairo_t *cr, double x, double y);
        virtual Point GetTransformOrigin ();
        virtual void OnPropertyChanged (DependencyProperty *prop);
        virtual void OnSubPropertyChanged (DependencyProperty *prop, 
DependencyProperty *subprop);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to