~ubuntu-branches/ubuntu/precise/gtk-qt-engine/precise

« back to all changes in this revision

Viewing changes to src/qt_theme_draw.c

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Venthur
  • Date: 2006-11-30 09:08:59 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061130090859-5sqtp4xfmexdn3qo
Tags: 1:0.7-4
Removed debian/gtk-qt-engine.dirs since it's not needed anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
455
455
{
456
456
        sanitize_size(window, &width, &height);
457
457
        
 
458
        if (gtkQtDebug)
 
459
                printf("Arrow (%d,%d,%d,%d) Widget: %s  Detail: %s\n", x, y, width, height,gtk_widget_get_name(widget),detail);
 
460
        
458
461
        if (DETAIL("hscrollbar") || DETAIL("vscrollbar"))
459
462
                return;
460
463
        if (DETAIL("spinbutton"))
468
471
        {
469
472
                GdkPixbuf *gpix;
470
473
                GtkWidget* parent;
471
 
                gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget),NULL, x, y, 0, 0,  width, height);
472
 
                setFillPixmap(gpix);
473
 
                g_object_unref(gpix);
 
474
                if (gdk_window_is_viewable(gtk_widget_get_parent_window(widget)))
 
475
                {
 
476
                        gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget),NULL, x, y, 0, 0,  width, height);
 
477
                        setFillPixmap(gpix);
 
478
                        g_object_unref(gpix);
 
479
                }
474
480
                
475
481
                parent = gtk_widget_get_parent(widget);
476
482
                drawArrow(window,style, GTK_WIDGET_STATE(parent), arrow_type, x, y, width, height);
555
561
        else
556
562
        {
557
563
                GdkPixbuf *gpix;
558
 
                gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget),NULL, x, y, 0, 0,  width, height);
559
 
                setFillPixmap(gpix);
560
 
                g_object_unref(gpix);
 
564
                if (gdk_window_is_viewable(gtk_widget_get_parent_window(widget)))
 
565
                {
 
566
                        gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget),NULL, x, y, 0, 0,  width, height);
 
567
                        setFillPixmap(gpix);
 
568
                        g_object_unref(gpix);
 
569
                }
561
570
                
562
571
                drawArrow(window, style, state_type, arrow_type, x, y, width, height);
563
572
                return;  
627
636
        }
628
637
        if (DETAIL("menubar"))
629
638
        {
630
 
                drawMenubar(window,style,state_type,x,y,width,height);
 
639
                if (openOfficeFix == 1)
 
640
                         parent_class->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
 
641
                else
 
642
                        drawMenubar(window,style,state_type,x,y,width,height);
631
643
                return;
632
644
        }
633
645
        if (DETAIL("menu"))
634
646
        {
635
 
                if ((x >= 0) && (y >= 0)) /* Work around weirdness in firefox */
636
 
                        drawMenu(window,style,state_type,x,y,width,height);
 
647
                if (openOfficeFix == 1)
 
648
                         parent_class->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
 
649
                else
 
650
                {
 
651
                        if ((x >= 0) && (y >= 0)) /* Work around weirdness in firefox */
 
652
                                drawMenu(window,style,state_type,x,y,width,height);
 
653
                }
637
654
                return;
638
655
        }
639
656
        if (GTK_IS_PROGRESS(widget) && DETAIL("trough"))
646
663
        }
647
664
        if (GTK_IS_PROGRESS(widget) && DETAIL("bar"))
648
665
        {
 
666
                if (area) gdk_gc_set_clip_rectangle(style->bg_gc[state_type], area);
 
667
                
649
668
                drawProgressChunk(window,style,state_type,x,y,width,height);
 
669
                
 
670
                if (area) gdk_gc_set_clip_rectangle(style->bg_gc[state_type], NULL);
650
671
                return;
651
672
        }
652
673
        if (GTK_IS_SCALE(widget) && DETAIL("trough"))
653
674
        {
654
 
                GdkPixbuf *gpix;
655
675
                GtkAdjustment* adj;
656
 
                gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget),NULL, x, y, 0, 0,  width, height);
657
 
                setFillPixmap(gpix);
658
 
                g_object_unref(gpix);
 
676
                int inverted;
 
677
                GValue *val = (GValue*)g_malloc( sizeof(GValue) );
 
678
                if (gdk_window_is_viewable(gtk_widget_get_parent_window(widget)))
 
679
                {
 
680
                        GdkPixbuf *gpix;
 
681
                        gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget),NULL, x, y, 0, 0,  width, height);
 
682
                        setFillPixmap(gpix);
 
683
                        g_object_unref(gpix);
 
684
                }
 
685
                
 
686
                memset( val, 0, sizeof(GValue) );
 
687
                g_value_init( val, G_TYPE_BOOLEAN );
 
688
                g_object_get_property(widget, "inverted", val);
 
689
                inverted = g_value_get_boolean(val);
 
690
                g_value_unset(val);
 
691
                g_free(val);
659
692
                
660
693
                adj = gtk_range_get_adjustment((GtkRange *) widget);
661
 
                drawSlider(window,style,state_type,adj,x,y,width,height, (GTK_RANGE(widget))->orientation);
 
694
                drawSlider(window,style,state_type,adj,x,y,width,height, (GTK_RANGE(widget))->orientation, inverted);
662
695
                return;
663
696
        }
664
697
        if (DETAIL("button"))
767
800
        }
768
801
        if (DETAIL("toolbar"))
769
802
        {
770
 
                drawToolbar(window,style,state_type,x,y,width,height);
 
803
                if (openOfficeFix == 1)
 
804
                        parent_class->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
 
805
                else
 
806
                        drawToolbar(window,style,state_type,x,y,width,height);
771
807
                return;
772
808
        }
773
809
        if (DETAIL("spinbutton_up"))
862
898
           gint width,
863
899
           gint height)
864
900
{
 
901
        if (gtkQtDebug)
 
902
                printf("Check (%d,%d,%d,%d) Widget: %s  Detail: %s\n", x, y, width, height,gtk_widget_get_name(widget),detail);
 
903
        
865
904
        if (GTK_IS_MENU_ITEM(widget))
866
905
        {
867
906
                if (shadow_type == GTK_SHADOW_IN)
868
907
                {
869
 
                        GdkPixbuf *gpix;
870
 
                        gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget), NULL, x, y, 0, 0, width, height);
871
 
                        setFillPixmap(gpix);
872
 
                        g_object_unref(gpix);
 
908
                        if (gdk_window_is_viewable(gtk_widget_get_parent_window(widget)))
 
909
                        {
 
910
                                GdkPixbuf *gpix;
 
911
                                gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget), NULL, x, y, 0, 0, width, height);
 
912
                                setFillPixmap(gpix);
 
913
                                g_object_unref(gpix);
 
914
                        }
873
915
                
874
916
                        drawMenuCheck(window,style,state_type,x,y,width,height);
875
917
                }
893
935
            gint width,
894
936
            gint height)
895
937
{
896
 
        GdkPixbuf *gpix;
897
 
        gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget),NULL, x, y, 0, 0,  width, height);
898
 
        setFillPixmap(gpix);
899
 
        g_object_unref(gpix);
 
938
        if (gtkQtDebug)
 
939
                printf("Option (%d,%d,%d,%d) Widget: %s  Detail: %s\n", x, y, width, height,gtk_widget_get_name(widget),detail);
 
940
        
 
941
        if (gdk_window_is_viewable(gtk_widget_get_parent_window(widget)))
 
942
        {
 
943
                GdkPixbuf *gpix;
 
944
                gpix = gdk_pixbuf_get_from_drawable(NULL, gtk_widget_get_parent_window(widget),NULL, x, y, 0, 0,  width, height);
 
945
                setFillPixmap(gpix);
 
946
                g_object_unref(gpix);
 
947
        }
900
948
 
901
949
        if (GTK_IS_MENU_ITEM(widget))
902
950
        {
921
969
         gint width,
922
970
         gint height)
923
971
{
 
972
        if (gtkQtDebug)
 
973
                printf("Tab (%d,%d,%d,%d) Widget: %s  Detail: %s\n", x, y, width, height,gtk_widget_get_name(widget),detail);
 
974
        
924
975
        gtk_paint_box(style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
925
976
}
926
977
 
1090
1141
             gint gap_width)
1091
1142
{
1092
1143
        sanitize_size (window, &width, &height);
 
1144
        
 
1145
        if (width<0 || height<0) return;  /* Eclipse really can be this stupid! */
 
1146
        
 
1147
        if (gtkQtDebug)
 
1148
                printf("Box_gap (%d,%d,%d,%d) Widget: %s  Detail: %s\n", x, y, width, height,gtk_widget_get_name(widget),detail);
 
1149
        
1093
1150
        if (DETAIL("notebook"))
1094
1151
                drawTabFrame(window,style,state_type,x,y-2,width,height+2, gtk_notebook_get_tab_pos((GtkNotebook *)widget));
1095
1152
}
1114
1171
        
1115
1172
        sanitize_size (window, &width, &height);
1116
1173
        
 
1174
        if (gtkQtDebug)
 
1175
                printf("Extension (%d,%d,%d,%d) Widget: %s  Detail: %s\n", x, y, width, height,gtk_widget_get_name(widget),detail);
 
1176
        
1117
1177
        gtk_paint_box(style, window, state_type, shadow_type, area, widget, detail,
1118
1178
                        x, y, width, height);
1119
1179
}
1148
1208
            gint height,
1149
1209
            GtkOrientation orientation)
1150
1210
{
 
1211
        if (gtkQtDebug)
 
1212
                printf("Slider (%d,%d,%d,%d) Widget: %s  Detail: %s\n", x, y, width, height,gtk_widget_get_name(widget),detail);
 
1213
        
1151
1214
        if (DETAIL("slider"))
1152
1215
        {
1153
1216
                GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(widget));
1227
1290
                                PangoAttribute *textcolorattr;
1228
1291
                                text_length = g_utf8_strlen (text, -1);
1229
1292
                                text_bytelen = strlen (text);
 
1293
 
 
1294
                                /* Try to get the attribute list of the layout */
 
1295
                                PangoAttrList* attrlist = pango_layout_get_attributes(layout);
 
1296
                                if(attrlist) {
 
1297
                                        /* Now iterate over the attribute list */
 
1298
                                        PangoAttrIterator* it = pango_attr_list_get_iterator(attrlist);
 
1299
                                        if(it) {
 
1300
                                                /* Try to get the first foreground color attribute
 
1301
                                                   Note that there can be more than one foreground 
 
1302
                                                   color, we use only the first */
 
1303
                                                PangoAttrColor* fg = (PangoAttrColor*)pango_attr_iterator_get(it, PANGO_ATTR_FOREGROUND);
 
1304
                                                if(fg) {
 
1305
                                                        /* Use this color to render the text, instead of
 
1306
                                                           the default text color */
 
1307
                                                        color.red       = fg->color.red;
 
1308
                                                        color.green     = fg->color.green;
 
1309
                                                        color.blue      = fg->color.blue;
 
1310
                                                }
 
1311
                                                pango_attr_iterator_destroy(it);
 
1312
                                        }
 
1313
                                }
1230
1314
                                
1231
1315
                                textcolorattr = pango_attr_foreground_new(color.red, color.green, color.blue);
1232
1316
                                textcolorattr->start_index = 0;
1777
1861
        {
1778
1862
          pixmap = pix_test;
1779
1863
          parent_relative = FALSE;
 
1864
          gdk_drawable_set_colormap(pixmap, style->colormap);
1780
1865
        }
1781
1866
      
 
1867
      if (pixmap && !gdk_drawable_get_colormap (pixmap)) gdk_drawable_set_colormap (pixmap, gdk_drawable_get_colormap (window));
1782
1868
      gdk_window_set_back_pixmap (window, pixmap, parent_relative);
1783
1869
    }
1784
1870
  else