]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/pango_x.cpp
Add support for wxHELP button to wxMessageDialog.
[wxWidgets.git] / src / x11 / pango_x.cpp
index 50370c89d3925caa866ba289757f2243512d27fd..0e82c04f96f0ca7f78c20895e91a419e7abd95b8 100644 (file)
@@ -1,45 +1,45 @@
 /**
 /**
- * This file gets included from dcclient.cpp and implements 
- * the X11 interface to Pango. 
+ * This file gets included from dcclient.cpp and implements
+ * the X11 interface to Pango.
  * Copyright (C) Owen Taylor and Robert Roebling.
  * Copyright (C) Owen Taylor and Robert Roebling.
- * Licence: The wxWidgets licence
+ * Licence: The wxWindows licence
  */
 
 /* Declaration */
 
 void
 x11_draw_glyphs( Drawable       drawable,
  */
 
 /* Declaration */
 
 void
 x11_draw_glyphs( Drawable       drawable,
-                        GC             gc,
-                        PangoFont     *font,
-                        int            x,
-                        int            y,
-                        PangoGlyphString *glyphs,
+                 GC             gc,
+                 PangoFont     *font,
+                 int            x,
+                 int            y,
+                 PangoGlyphString *glyphs,
                  wxColour       &colour );
                  wxColour       &colour );
-                 
-void 
+
+void
 x11_draw_layout_line_with_colors( Drawable         drawable,
                                   GC               gc,
 x11_draw_layout_line_with_colors( Drawable         drawable,
                                   GC               gc,
-                                  int              x, 
+                                  int              x,
                                   int              y,
                                   PangoLayoutLine  *line,
                                   wxColour       &colour );
                                   int              y,
                                   PangoLayoutLine  *line,
                                   wxColour       &colour );
-                                  
-void 
+
+void
 x11_draw_layout_with_colors( Drawable      drawable,
                              GC            gc,
 x11_draw_layout_with_colors( Drawable      drawable,
                              GC            gc,
-                             int           x, 
+                             int           x,
                              int           y,
                              PangoLayout  *layout,
                              wxColour     &colour );
                              int           y,
                              PangoLayout  *layout,
                              wxColour     &colour );
-                             
-void 
+
+void
 x11_draw_layout( Drawable     drawable,
                  GC           gc,
 x11_draw_layout( Drawable     drawable,
                  GC           gc,
-                 int          x, 
+                 int          x,
                  int          y,
                  PangoLayout *layout,
                  wxColour    &colour);
                  int          y,
                  PangoLayout *layout,
                  wxColour    &colour);
-                 
+
 void
 x11_pango_get_item_properties( PangoItem      *item,
                                PangoUnderline *uline,
 void
 x11_pango_get_item_properties( PangoItem      *item,
                                PangoUnderline *uline,
@@ -57,13 +57,14 @@ x11_pango_get_item_properties( PangoItem      *item,
 
 void
 x11_draw_glyphs( Drawable            drawable,
 
 void
 x11_draw_glyphs( Drawable            drawable,
-                        GC                  gc,
-                        PangoFont          *font,
-                        int                 x,
-                        int                 y,
-                        PangoGlyphString   *glyphs,
+                 GC                  gc,
+                 PangoFont          *font,
+                 int                 x,
+                 int                 y,
+                 PangoGlyphString   *glyphs,
                  wxColour           &colour )
 {
                  wxColour           &colour )
 {
+#ifdef HAVE_PANGO_XFT
     if (PANGO_XFT_IS_FONT (font))
     {
         Display* xdisplay = wxGlobalDisplay();
     if (PANGO_XFT_IS_FONT (font))
     {
         Display* xdisplay = wxGlobalDisplay();
@@ -80,19 +81,21 @@ x11_draw_glyphs( Drawable            drawable,
         color.color.blue = colour.Blue() << 8;
         color.color.alpha = 65000;
         pango_xft_render( draw, &color, font, glyphs, x, y );
         color.color.blue = colour.Blue() << 8;
         color.color.alpha = 65000;
         pango_xft_render( draw, &color, font, glyphs, x, y );
-        
+
         XftDrawDestroy( draw );
     }
     else
         XftDrawDestroy( draw );
     }
     else
+#endif
     {
     {
+        wxUnusedVar(colour);
         pango_x_render( wxGlobalDisplay(), drawable, gc, font, glyphs, x, y );
     }
 }
 
         pango_x_render( wxGlobalDisplay(), drawable, gc, font, glyphs, x, y );
     }
 }
 
-void 
+void
 x11_draw_layout_line_with_colors( Drawable         drawable,
                                   GC               gc,
 x11_draw_layout_line_with_colors( Drawable         drawable,
                                   GC               gc,
-                                  int              x, 
+                                  int              x,
                                   int              y,
                                   PangoLayoutLine *line,
                                   wxColour        &colour )
                                   int              y,
                                   PangoLayoutLine *line,
                                   wxColour        &colour )
@@ -105,9 +108,9 @@ x11_draw_layout_line_with_colors( Drawable         drawable,
     gint rise = 0;
 
     context = pango_layout_get_context (line->layout);
     gint rise = 0;
 
     context = pango_layout_get_context (line->layout);
-  
+
     pango_layout_line_get_extents (line,NULL, &overall_rect);
     pango_layout_line_get_extents (line,NULL, &overall_rect);
-  
+
     GSList *tmp_list = line->runs;
     while (tmp_list)
     {
     GSList *tmp_list = line->runs;
     while (tmp_list)
     {
@@ -116,16 +119,16 @@ x11_draw_layout_line_with_colors( Drawable         drawable,
         PangoColor fg_color, bg_color;
         gboolean strike, fg_set, bg_set, shape_set;
         gint risen_y;
         PangoColor fg_color, bg_color;
         gboolean strike, fg_set, bg_set, shape_set;
         gint risen_y;
-      
+
         tmp_list = tmp_list->next;
         tmp_list = tmp_list->next;
-      
-        x11_pango_get_item_properties (run->item, &uline, 
-            &strike, &rise,  &fg_color, &fg_set, &bg_color, &bg_set, 
+
+        x11_pango_get_item_properties (run->item, &uline,
+            &strike, &rise,  &fg_color, &fg_set, &bg_color, &bg_set,
             &shape_set, &ink_rect, &logical_rect);
 
         /* we subtract the rise because X coordinates are upside down */
         risen_y = y - rise / PANGO_SCALE;
             &shape_set, &ink_rect, &logical_rect);
 
         /* we subtract the rise because X coordinates are upside down */
         risen_y = y - rise / PANGO_SCALE;
-      
+
         if (!shape_set)
         {
             if (uline == PANGO_UNDERLINE_NONE)
         if (!shape_set)
         {
             if (uline == PANGO_UNDERLINE_NONE)
@@ -135,27 +138,27 @@ x11_draw_layout_line_with_colors( Drawable         drawable,
         }
 
 #if 0
         }
 
 #if 0
-           XDrawRectangle( drawable, gc, TRUE,
-                             x + (x_off + logical_rect.x) / PANGO_SCALE,
-                             risen_y + overall_rect.y / PANGO_SCALE,
-                             logical_rect.width / PANGO_SCALE,
-                             overall_rect.height / PANGO_SCALE);
+        XDrawRectangle( drawable, gc, TRUE,
+                  x + (x_off + logical_rect.x) / PANGO_SCALE,
+                  risen_y + overall_rect.y / PANGO_SCALE,
+                  logical_rect.width / PANGO_SCALE,
+                  overall_rect.height / PANGO_SCALE);
 #endif
 
         if (!shape_set)
         {
             int gx = x + x_off / PANGO_SCALE;
             int gy = risen_y;
 #endif
 
         if (!shape_set)
         {
             int gx = x + x_off / PANGO_SCALE;
             int gy = risen_y;
-          
+
             x11_draw_glyphs( drawable, gc, run->item->analysis.font, gx, gy, run->glyphs, colour );
         }
             x11_draw_glyphs( drawable, gc, run->item->analysis.font, gx, gy, run->glyphs, colour );
         }
-      
+
         if (uline ==  PANGO_UNDERLINE_SINGLE)
         if (uline ==  PANGO_UNDERLINE_SINGLE)
-        {  
+        {
             XDrawLine( wxGlobalDisplay(), drawable, gc,
             XDrawLine( wxGlobalDisplay(), drawable, gc,
-                         x + (x_off + ink_rect.x) / PANGO_SCALE - 1,
+              x + (x_off + ink_rect.x) / PANGO_SCALE - 1,
                           risen_y + 1,
                           risen_y + 1,
-                         x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE,
+              x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE,
                          risen_y + 1);
         }
 
                          risen_y + 1);
         }
 
@@ -163,40 +166,40 @@ x11_draw_layout_line_with_colors( Drawable         drawable,
     }
 }
 
     }
 }
 
-void 
+void
 x11_draw_layout_with_colors( Drawable      drawable,
                              GC            gc,
 x11_draw_layout_with_colors( Drawable      drawable,
                              GC            gc,
-                             int           x, 
+                             int           x,
                              int           y,
                              PangoLayout  *layout,
                              wxColour       &colour )
 {
     PangoLayoutIter *iter = pango_layout_get_iter (layout);
                              int           y,
                              PangoLayout  *layout,
                              wxColour       &colour )
 {
     PangoLayoutIter *iter = pango_layout_get_iter (layout);
-  
+
     do
     {
         PangoLayoutLine *line = pango_layout_iter_get_line (iter);
     do
     {
         PangoLayoutLine *line = pango_layout_iter_get_line (iter);
-      
+
         PangoRectangle logical_rect;
         pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
         PangoRectangle logical_rect;
         pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
-        
+
         int baseline = pango_layout_iter_get_baseline (iter);
         int baseline = pango_layout_iter_get_baseline (iter);
-      
+
         x11_draw_layout_line_with_colors( drawable, gc,
                                           x + logical_rect.x / PANGO_SCALE,
                                           y + baseline / PANGO_SCALE,
                                           line,
                                           colour );
         x11_draw_layout_line_with_colors( drawable, gc,
                                           x + logical_rect.x / PANGO_SCALE,
                                           y + baseline / PANGO_SCALE,
                                           line,
                                           colour );
-                                          
+
     } while (pango_layout_iter_next_line (iter));
 
     pango_layout_iter_free (iter);
 }
 
     } while (pango_layout_iter_next_line (iter));
 
     pango_layout_iter_free (iter);
 }
 
-void 
+void
 x11_draw_layout( Drawable     drawable,
                  GC           gc,
 x11_draw_layout( Drawable     drawable,
                  GC           gc,
-                 int          x, 
+                 int          x,
                  int          y,
                  PangoLayout *layout,
                  wxColour    &colour)
                  int          y,
                  PangoLayout *layout,
                  wxColour    &colour)
@@ -223,10 +226,10 @@ x11_pango_get_item_properties( PangoItem      *item,
 
   if (strikethrough)
       *strikethrough = FALSE;
 
   if (strikethrough)
       *strikethrough = FALSE;
-  
+
   if (fg_set)
     *fg_set = FALSE;
   if (fg_set)
     *fg_set = FALSE;
-  
+
   if (bg_set)
     *bg_set = FALSE;
 
   if (bg_set)
     *bg_set = FALSE;
 
@@ -241,50 +244,50 @@ x11_pango_get_item_properties( PangoItem      *item,
       PangoAttribute *attr = (PangoAttribute *) tmp_list->data;
 
       switch (attr->klass->type)
       PangoAttribute *attr = (PangoAttribute *) tmp_list->data;
 
       switch (attr->klass->type)
-       {
-       case PANGO_ATTR_UNDERLINE:
-         if (uline)
-           *uline = (PangoUnderline) ((PangoAttrInt *)attr)->value;
-         break;
-
-       case PANGO_ATTR_STRIKETHROUGH:
-           if (strikethrough)
-               *strikethrough = ((PangoAttrInt *)attr)->value;
-           break;
-           
-       case PANGO_ATTR_FOREGROUND:
-         if (fg_color)
-           *fg_color = ((PangoAttrColor *)attr)->color;
-         if (fg_set)
-           *fg_set = TRUE;
-         
-         break;
-         
-       case PANGO_ATTR_BACKGROUND:
-         if (bg_color)
-           *bg_color = ((PangoAttrColor *)attr)->color;
-         if (bg_set)
-           *bg_set = TRUE;
-         
-         break;
-
-       case PANGO_ATTR_SHAPE:
-         if (shape_set)
-           *shape_set = TRUE;
-         if (logical_rect)
-           *logical_rect = ((PangoAttrShape *)attr)->logical_rect;
-         if (ink_rect)
-           *ink_rect = ((PangoAttrShape *)attr)->ink_rect;
-         break;
-
-        case PANGO_ATTR_RISE:
-          if (rise)
-            *rise = ((PangoAttrInt *)attr)->value;
-          break;
-          
-       default:
-         break;
-       }
+      {
+          case PANGO_ATTR_UNDERLINE:
+              if (uline)
+                  *uline = (PangoUnderline) ((PangoAttrInt *)attr)->value;
+              break;
+
+          case PANGO_ATTR_STRIKETHROUGH:
+              if (strikethrough)
+                  *strikethrough = ((PangoAttrInt *)attr)->value;
+              break;
+
+          case PANGO_ATTR_FOREGROUND:
+              if (fg_color)
+                  *fg_color = ((PangoAttrColor *)attr)->color;
+              if (fg_set)
+                  *fg_set = TRUE;
+
+              break;
+
+          case PANGO_ATTR_BACKGROUND:
+              if (bg_color)
+                  *bg_color = ((PangoAttrColor *)attr)->color;
+              if (bg_set)
+                  *bg_set = TRUE;
+
+              break;
+
+          case PANGO_ATTR_SHAPE:
+              if (shape_set)
+                  *shape_set = TRUE;
+              if (logical_rect)
+                  *logical_rect = ((PangoAttrShape *)attr)->logical_rect;
+              if (ink_rect)
+                  *ink_rect = ((PangoAttrShape *)attr)->ink_rect;
+              break;
+
+          case PANGO_ATTR_RISE:
+              if (rise)
+                  *rise = ((PangoAttrInt *)attr)->value;
+              break;
+
+          default:
+              break;
+      }
       tmp_list = tmp_list->next;
     }
 }
       tmp_list = tmp_list->next;
     }
 }