[Libreoffice-commits] core.git: vcl/inc vcl/unx

Caolán McNamara caolanm at redhat.com
Tue May 19 02:17:25 PDT 2015


 vcl/inc/unx/gtk/gtkgdi.hxx                    |    1 
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |   37 ++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 2 deletions(-)

New commits:
commit 9bc6cb2b405c879d6fc6d208f8deab0b295aed18
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 19 10:15:58 2015 +0100

    gtk3: nwf for progress bars
    
    Change-Id: If45020ba9916f9df9b602f57c443f828c8d1de1a

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 087ad54..af86e7f 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -89,6 +89,7 @@ private:
     static GtkStyleContext *mpFixedHoriLineStyle;
     static GtkStyleContext *mpFixedVertLineStyle;
     static GtkStyleContext *mpTreeHeaderButtonStyle;
+    static GtkStyleContext *mpProgressBarStyle;
 
     static Rectangle NWGetScrollButtonRect( ControlPart nPart, Rectangle aAreaRect );
     static Rectangle NWGetSpinButtonRect( ControlPart nPart, Rectangle aAreaRect);
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index b78de56..fbcf294 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -45,6 +45,7 @@ GtkStyleContext* GtkSalGraphics::mpFrameOutStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpFixedHoriLineStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpFixedVertLineStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpTreeHeaderButtonStyle = NULL;
+GtkStyleContext* GtkSalGraphics::mpProgressBarStyle = NULL;
 
 bool GtkSalGraphics::style_loaded = false;
 /************************************************************************
@@ -90,7 +91,8 @@ enum {
     RENDER_EXTENSION = 12,
     RENDER_EXPANDER = 13,
     RENDER_ICON = 14,
-    RENDER_FOCUS = 15,
+    RENDER_PROGRESS = 15,
+    RENDER_FOCUS = 16,
 };
 
 static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow )
@@ -1007,6 +1009,11 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
             styleClass = GTK_STYLE_CLASS_ARROW;
         }
         break;
+    case CTRL_PROGRESS:
+        context = mpProgressBarStyle;
+        renderType = RENDER_PROGRESS;
+        styleClass = GTK_STYLE_CLASS_TROUGH;
+        break;
     default:
         return false;
     }
@@ -1127,6 +1134,29 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
 
         break;
     }
+    case RENDER_PROGRESS:
+    {
+        gtk_render_background(context, cr, nX, nY, nWidth, nHeight);
+        gtk_render_frame(context, cr, nX, nY, nWidth, nHeight);
+        long nProgressWidth = rValue.getNumericVal();
+        if (nProgressWidth)
+        {
+            GtkBorder padding;
+            gtk_style_context_get_padding(context, GTK_STATE_FLAG_NORMAL, &padding);
+
+            gtk_style_context_remove_class(context, GTK_STYLE_CLASS_TROUGH);
+            gtk_style_context_add_class(context, GTK_STYLE_CLASS_PROGRESSBAR);
+            gtk_style_context_add_class(context, GTK_STYLE_CLASS_PULSE);
+            nX += padding.left;
+            nY += padding.top;
+            nHeight -= (padding.top + padding.bottom);
+            nProgressWidth -= (padding.left + padding.right);
+            gtk_render_background(context, cr, nX, nY, nProgressWidth, nHeight);
+            gtk_render_frame(context, cr, nX, nY, nProgressWidth, nHeight);
+        }
+
+        break;
+    }
     default:
         break;
     }
@@ -1726,7 +1756,7 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
         case CTRL_PUSHBUTTON:
         case CTRL_RADIOBUTTON:
         case CTRL_CHECKBOX:
-//        case CTRL_PROGRESS:
+        case CTRL_PROGRESS:
 //        case CTRL_LISTNODE:
 //        case CTRL_LISTNET:
             if (nPart==PART_ENTIRE_CONTROL || nPart == PART_FOCUS)
@@ -2033,6 +2063,9 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
     GtkWidget* pTreeHeaderCellWidget = gtk_tree_view_column_get_button(middleTreeViewColumn);
     mpTreeHeaderButtonStyle = gtk_widget_get_style_context(pTreeHeaderCellWidget);
 
+    /* Progress Bar */
+    getStyleContext(&mpProgressBarStyle, gtk_progress_bar_new());
+
     gtk_widget_show_all(gDumbContainer);
 }
 


More information about the Libreoffice-commits mailing list