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

Caolán McNamara caolanm at redhat.com
Tue Apr 28 03:37:03 PDT 2015


 vcl/inc/unx/gtk/gtkgdi.hxx                    |    1 +
 vcl/source/control/tabctrl.cxx                |    2 +-
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |   25 ++++++++++++++++++++-----
 3 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit aff76b56ea8fb87418a47bcbb85541a4f3297aff
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 28 10:58:02 2015 +0100

    gtk3: use native tab item size
    
    Change-Id: Iaef296c44f866bbcbcd2f2148402aef217c81b2c

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 1e52df4..2805ef6 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -78,6 +78,7 @@ private:
     static GtkStyleContext *mpSpinStyle;
     static GtkStyleContext *mpComboboxStyle;
     static GtkStyleContext *mpListboxStyle;
+    static GtkStyleContext *mpNoteBookStyle;
 
     void getStyleContext(GtkStyleContext** style, GtkWidget* widget);
     Rectangle NWGetScrollButtonRect( ControlPart nPart, Rectangle aAreaRect );
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index ca63e54..4ad94de 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -239,7 +239,7 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
 
     Rectangle aCtrlRegion( Point( 0, 0 ), aSize );
     Rectangle aBoundingRgn, aContentRgn;
-    const ImplControlValue aControlValue;
+    const EditBoxValue aControlValue(GetTextHeight());
     if(GetNativeControlRegion( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, aCtrlRegion,
                                            ControlState::ENABLED, aControlValue, OUString(),
                                            aBoundingRgn, aContentRgn ) )
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 8a141a4..68b52bf 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -33,6 +33,7 @@ GtkStyleContext* GtkSalGraphics::mpMenuItemStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpSpinStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpComboboxStyle = NULL;
 GtkStyleContext* GtkSalGraphics::mpListboxStyle = NULL;
+GtkStyleContext* GtkSalGraphics::mpNoteBookStyle = NULL;
 
 bool GtkSalGraphics::style_loaded = false;
 /************************************************************************
@@ -993,7 +994,6 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
 Rectangle AdjustRectForTextBordersPadding(GtkStyleContext* pStyle, long nTextHeight, const Rectangle& rControlRegion)
 {
     gtk_style_context_save(pStyle);
-    gtk_style_context_add_class(pStyle, GTK_STYLE_CLASS_ENTRY);
 
     GtkBorder border;
     gtk_style_context_get_border(pStyle, GTK_STATE_FLAG_NORMAL, &border);
@@ -1119,6 +1119,18 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar
     {
         aEditRect = AdjustRectForTextBordersPadding(mpSpinStyle, rValue.getNumericVal(), rControlRegion);
     }
+    else if (nType == CTRL_TAB_ITEM && nPart == PART_ENTIRE_CONTROL)
+    {
+        gtk_style_context_save(mpNoteBookStyle);
+
+        gtk_style_context_add_region(mpNoteBookStyle, GTK_STYLE_REGION_TAB, GTK_REGION_ONLY);
+        gtk_style_context_add_class(mpNoteBookStyle, GTK_STYLE_CLASS_TOP);
+
+
+        aEditRect = AdjustRectForTextBordersPadding(mpSpinStyle, rValue.getNumericVal(), rControlRegion);
+
+        gtk_style_context_restore(mpNoteBookStyle);
+    }
     else
     {
         return false;
@@ -1507,12 +1519,12 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
 //        case CTRL_WINDOW_BACKGROUND:
 //            return true;
 
-//        case CTRL_TAB_ITEM:
+        case CTRL_TAB_ITEM:
 //        case CTRL_TAB_PANE:
 //        case CTRL_TAB_BODY:
-//            if(nPart==PART_ENTIRE_CONTROL || nPart==PART_TABS_DRAW_RTL)
-//                return true;
-//            break;
+            if(nPart==PART_ENTIRE_CONTROL || nPart==PART_TABS_DRAW_RTL)
+                return true;
+            break;
 
         case CTRL_LISTBOX:
             if(nPart==PART_ENTIRE_CONTROL || nPart==PART_WINDOW || nPart==HAS_BACKGROUND_TEXTURE || nPart == PART_BUTTON_DOWN)
@@ -1690,6 +1702,9 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
     /* Spinbutton */
     getStyleContext(&mpSpinStyle, gtk_spin_button_new(NULL, 0, 0));
 
+    /* NoteBook */
+    getStyleContext(&mpNoteBookStyle, gtk_notebook_new());
+
     /* Combobox */
     mpComboboxStyle = gtk_style_context_new();
     PrepareComboboxStyle(mpComboboxStyle, true);


More information about the Libreoffice-commits mailing list