diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-05-05 20:07:41 +0400 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-05-05 20:25:36 +0400 |
commit | f1005e50e795a06b5504960a94e529b48e085a91 (patch) | |
tree | feace04b0fcd9e8366f798113ff5aab1570c7ec6 /vcl/unx/gtk | |
parent | 33880a63fef2abf126163186d81c204d965031a6 (diff) |
gtk: fix drawing of separators in vertical toolbars
(regression from 0377b99b3f50a67e7845a3d728313e5a2ef36e73)
* divide PART_SEPARATOR into PART_SEPARATOR_HORZ and PART_SEPARATOR_VERT
* improve separator reduction: now the offset is (height*0.2) instead of 7.
* rename: gVSeparator -> gSeparator
* remove trailing whitespace
Change-Id: I I If144509d7e061bf1b7901cd5418c4d7dbc3aa0d0
Diffstat (limited to 'vcl/unx/gtk')
-rw-r--r-- | vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 7c06d6ade7b5..b2b6d7c0520b 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -107,7 +107,7 @@ struct NWFWidgetData GtkWidget * gTreeView; GtkWidget * gHScale; GtkWidget * gVScale; - GtkWidget * gVSeparator; + GtkWidget * gSeparator; NWPixmapCacheList* gNWPixmapCacheList; NWPixmapCache* gCacheTabItems; @@ -146,7 +146,7 @@ struct NWFWidgetData gTreeView( NULL ), gHScale( NULL ), gVScale( NULL ), - gVSeparator ( NULL ), + gSeparator( NULL ), gNWPixmapCacheList( NULL ), gCacheTabItems( NULL ), gCacheTabPages( NULL ) @@ -579,7 +579,8 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar || (nPart==PART_THUMB_HORZ) || (nPart==PART_THUMB_VERT) || (nPart==PART_BUTTON) - || (nPart==PART_SEPARATOR) + || (nPart==PART_SEPARATOR_HORZ) + || (nPart==PART_SEPARATOR_VERT) ) ) || ((nType == CTRL_MENUBAR) && @@ -2642,30 +2643,46 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar( GTK_ORIENTATION_VERTICAL ); } - else if(nPart == PART_SEPARATOR ) + else if( nPart == PART_SEPARATOR_HORZ || nPart == PART_SEPARATOR_VERT ) { gint separator_height, separator_width, wide_separators; - gtk_widget_style_get (gWidgetData[m_nXScreen].gVSeparator, + gtk_widget_style_get (gWidgetData[m_nXScreen].gSeparator, "wide-separators", &wide_separators, "separator-width", &separator_width, "separator-height", &separator_height, NULL); + + const double shim = 0.2; + if (wide_separators) - gtk_paint_box (gWidgetData[m_nXScreen].gVSeparator->style, gdkDrawable, - GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, - &clipRect, gWidgetData[m_nXScreen].gVSeparator, "vseparator", - x + (w - separator_width) / 2, - y + 7, - separator_width, - h - 14); + { + if (nPart == PART_SEPARATOR_VERT) + gtk_paint_box (gWidgetData[m_nXScreen].gSeparator->style, gdkDrawable, + GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, + &clipRect, gWidgetData[m_nXScreen].gSeparator, "vseparator", + x + (w - separator_width) / 2, y + h * shim, + separator_width, h * (1 - 2*shim)); + else + gtk_paint_box (gWidgetData[m_nXScreen].gSeparator->style, gdkDrawable, + GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, + &clipRect, gWidgetData[m_nXScreen].gSeparator, "hseparator", + x + w * shim, y + (h - separator_width) / 2, + w * (1 - 2*shim), separator_width); + } else - gtk_paint_vline (gWidgetData[m_nXScreen].gVSeparator->style, gdkDrawable, - GTK_STATE_NORMAL, - &clipRect, gWidgetData[m_nXScreen].gVSeparator, "vseparator", - y + 7, - y + h - 7, - x + w/2 - 1); + { + if (nPart == PART_SEPARATOR_VERT) + gtk_paint_vline (gWidgetData[m_nXScreen].gSeparator->style, gdkDrawable, + GTK_STATE_NORMAL, + &clipRect, gWidgetData[m_nXScreen].gSeparator, "vseparator", + y + h * shim, y + h * (1 - shim), x + w/2 - 1); + else + gtk_paint_hline (gWidgetData[m_nXScreen].gSeparator->style, gdkDrawable, + GTK_STATE_NORMAL, + &clipRect, gWidgetData[m_nXScreen].gSeparator, "hseparator", + x + w * shim, x + w * (1 - shim), y + h/2 - 1); + } } } } @@ -3972,8 +3989,8 @@ static void NWEnsureGTKToolbar( SalX11Screen nScreen ) gWidgetData[nScreen].gToolbarWidget = gtk_toolbar_new(); NWAddWidgetToCacheWindow( gWidgetData[nScreen].gToolbarWidget, nScreen ); gWidgetData[nScreen].gToolbarButtonWidget = GTK_WIDGET(gtk_button_new()); - gWidgetData[nScreen].gVSeparator = GTK_WIDGET(gtk_separator_tool_item_new()); - NWAddWidgetToCacheWindow( gWidgetData[nScreen].gVSeparator, nScreen ); + gWidgetData[nScreen].gSeparator = GTK_WIDGET(gtk_separator_tool_item_new()); + NWAddWidgetToCacheWindow( gWidgetData[nScreen].gSeparator, nScreen ); GtkReliefStyle aRelief = GTK_RELIEF_NORMAL; gtk_widget_ensure_style( gWidgetData[nScreen].gToolbarWidget ); |