include/vcl/combobox.hxx | 2 include/vcl/lstbox.hxx | 2 svx/source/tbxctrls/itemwin.cxx | 4 - svx/source/tbxctrls/tbcontrl.cxx | 22 +++--- svx/source/tbxctrls/tbunocontroller.cxx | 9 -- vcl/inc/unx/gtk/gtkgdi.hxx | 1 vcl/source/control/spinfld.cxx | 6 - vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 89 +++++++++++++++++--------- 8 files changed, 76 insertions(+), 59 deletions(-)
New commits: commit dfec380c3b56ee62c7d9cc1747af5663a0db81fb Author: Caolán McNamara <[email protected]> Date: Mon Apr 27 16:48:30 2015 +0100 gtk3: use same arbitrary 0.2 and 0.8 ratios as gtk does Change-Id: Ib0d04c00ff4689d53317dedbf67091596cc59fb0 diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 663843a..0112ced 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -961,8 +961,8 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co break; case RENDER_TOOLBAR_SEPERATOR: gtk_render_line(context, cr, - rControlRegion.GetWidth() / 2, 3, - rControlRegion.GetWidth() / 2, rControlRegion.GetHeight() - 3 ); + rControlRegion.GetWidth() / 2, rControlRegion.GetHeight() * 0.2, + rControlRegion.GetWidth() / 2, rControlRegion.GetHeight() * 0.8 ); break; case RENDER_ARROW: gtk_render_arrow(context, cr, commit cb1fda082cc30dba210f293ec6fea8a13363835e Author: Caolán McNamara <[email protected]> Date: Mon Apr 27 16:44:11 2015 +0100 gtk3: render vertical toolbar seperators Change-Id: I6c4e5291b24015087b3ac56e2e178dbf42bf193f diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 2c8a8dc..1e52df4 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -70,6 +70,7 @@ private: static GtkStyleContext *mpHScrollbarStyle; static GtkStyleContext *mpToolbarStyle; static GtkStyleContext *mpToolButtonStyle; + static GtkStyleContext *mpToolbarSeperatorStyle; static GtkStyleContext *mpCheckButtonStyle; static GtkStyleContext *mpMenuBarStyle; static GtkStyleContext *mpMenuStyle; diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 9f0ea76..663843a 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -25,6 +25,7 @@ GtkStyleContext* GtkSalGraphics::mpVScrollbarStyle = NULL; GtkStyleContext* GtkSalGraphics::mpHScrollbarStyle = NULL; GtkStyleContext* GtkSalGraphics::mpToolbarStyle = NULL; GtkStyleContext* GtkSalGraphics::mpToolButtonStyle = NULL; +GtkStyleContext* GtkSalGraphics::mpToolbarSeperatorStyle = NULL; GtkStyleContext* GtkSalGraphics::mpCheckButtonStyle = NULL; GtkStyleContext* GtkSalGraphics::mpMenuBarStyle = NULL; GtkStyleContext* GtkSalGraphics::mpMenuStyle = NULL; @@ -66,12 +67,13 @@ enum { RENDER_BACKGROUND_AND_FRAME = 1, RENDER_CHECK = 2, RENDER_BACKGROUND = 3, - RENDER_LINE = 4, - RENDER_ARROW = 5, - RENDER_RADIO = 6, - RENDER_SCROLLBAR = 7, - RENDER_SPINBUTTON = 8, - RENDER_COMBOBOX = 9, + RENDER_MENU_SEPERATOR = 4, + RENDER_TOOLBAR_SEPERATOR = 5, + RENDER_ARROW = 6, + RENDER_RADIO = 7, + RENDER_SCROLLBAR = 8, + RENDER_SPINBUTTON = 9, + RENDER_COMBOBOX = 10, }; static void PrepareComboboxStyle( GtkStyleContext *context, @@ -861,7 +863,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co case PART_MENU_SEPARATOR: styleClass = GTK_STYLE_CLASS_SEPARATOR; context = mpMenuItemStyle; - renderType = RENDER_LINE; + renderType = RENDER_MENU_SEPERATOR; break; case PART_MENU_SUBMENU_ARROW: context = mpMenuStyle; @@ -885,6 +887,10 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co ( (aValue.getTristateVal() == BUTTONVALUE_ON) ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_NORMAL)); context = mpToolButtonStyle; break; + case PART_SEPARATOR_VERT: + context = mpToolbarSeperatorStyle; + renderType = RENDER_TOOLBAR_SEPERATOR; + break; default: return false; } @@ -948,11 +954,16 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co case RENDER_RADIO: PaintCheckOrRadio(context, cr, rControlRegion, nType); break; - case RENDER_LINE: + case RENDER_MENU_SEPERATOR: gtk_render_line(context, cr, 3, rControlRegion.GetHeight() / 2, rControlRegion.GetWidth() - 3, rControlRegion.GetHeight() / 2); break; + case RENDER_TOOLBAR_SEPERATOR: + gtk_render_line(context, cr, + rControlRegion.GetWidth() / 2, 3, + rControlRegion.GetWidth() / 2, rControlRegion.GetHeight() - 3 ); + break; case RENDER_ARROW: gtk_render_arrow(context, cr, G_PI / 2, 0, 0, @@ -1515,7 +1526,7 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP // || nPart==PART_THUMB_VERT || nPart==PART_BUTTON // || nPart==PART_SEPARATOR_HORZ -// || nPart==PART_SEPARATOR_VERT + || nPart==PART_SEPARATOR_VERT ) return true; break; @@ -1634,6 +1645,8 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) gtk_style_context_add_class(mpToolbarStyle, GTK_STYLE_CLASS_PRIMARY_TOOLBAR); gtk_style_context_add_class(mpToolbarStyle, GTK_STYLE_CLASS_TOOLBAR); + getStyleContext(&mpToolbarSeperatorStyle, GTK_WIDGET(gtk_separator_tool_item_new())); + getStyleContext(&mpToolButtonStyle, gtk_button_new()); /* Create a widget path for our toolbutton widget */ commit 4679d6b9c3975c322cf84bcfca6dbfbfd1155981 Author: Caolán McNamara <[email protected]> Date: Mon Apr 27 15:42:33 2015 +0100 gtk3: set max spin box height before determining rect Change-Id: Ic7e2c3a76abf658cc4e639772e05c83851c1da71 diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 4406be2..9f0ea76 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1079,7 +1079,8 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar ((nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { - aEditRect = NWGetSpinButtonRect( nPart, rControlRegion ); + Rectangle aControlRegion(AdjustRectForTextBordersPadding(mpSpinStyle, rValue.getNumericVal(), rControlRegion)); + aEditRect = NWGetSpinButtonRect(nPart, aControlRegion); } else if ( (nType==CTRL_COMBOBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) commit 9b6a6705f756467b12d9ff508e572b1bc279c394 Author: Caolán McNamara <[email protected]> Date: Mon Apr 27 15:40:23 2015 +0100 if it makes sense to handle DataChanged, then the same init must be called as in the ctor Change-Id: Ib95768397dc99d09154af03846f001d647437b69 diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 6dfadc7..35ef967 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -192,6 +192,8 @@ private: } DECL_DLLPRIVATE_LINK( CheckAndMarkUnknownFont, VclWindowEvent* ); + void SetOptimalSize(); + protected: virtual void Select() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; @@ -909,10 +911,7 @@ SvxFontNameBox_Impl::SvxFontNameBox_Impl( vcl::Window* pParent, const Reference< m_xFrame (_xFrame), mbEndPreview(false) { - Size aSize(LogicToPixel(aLogicalSize, MAP_APPFONT)); - set_width_request(aSize.Width()); - set_height_request(aSize.Height()); - SetSizePixel(aSize); + SetOptimalSize(); EnableControls_Impl(); GetSubEdit()->AddEventListener( LINK( this, SvxFontNameBox_Impl, CheckAndMarkUnknownFont )); } @@ -1031,12 +1030,20 @@ bool SvxFontNameBox_Impl::Notify( NotifyEvent& rNEvt ) return nHandled || FontNameBox::Notify( rNEvt ); } +void SvxFontNameBox_Impl::SetOptimalSize() +{ + Size aSize(LogicToPixel(aLogicalSize, MAP_APPFONT)); + set_width_request(aSize.Width()); + set_height_request(aSize.Height()); + SetSizePixel(aSize); +} + void SvxFontNameBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) { if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT)); + SetOptimalSize(); } else if ( ( rDCEvt.GetType() == DataChangedEventType::FONTS ) || ( rDCEvt.GetType() == DataChangedEventType::DISPLAY ) ) commit cd962f121586e84eb7d020643dcf134e7e50a1c8 Author: Caolán McNamara <[email protected]> Date: Mon Apr 27 15:20:46 2015 +0100 manually setting drop down size is unnecessary and can end up with a font size entry in the toolbar of a different height to the other elements, because the other ones only call it on DataChange, while font size calls it all the time. Change-Id: I495e28dd0d33a093869fd731538e43513a7b8b85 diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index 34e6702..95ec9bc 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -114,8 +114,6 @@ public: virtual void setPosSizePixel( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL ) SAL_OVERRIDE; void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) SAL_OVERRIDE { Edit::SetPosSizePixel( rNewPos, rNewSize ); } - void SetDropDownSizePixel( const Size& rNewSize ) - { if( IsDropDownBox() ) setPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(), WINDOW_POSSIZE_SIZE | WINDOW_POSSIZE_DROPDOWN ); } Rectangle GetDropDownPosSizePixel() const; diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index 775e72c..3f03f63 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -103,8 +103,6 @@ public: long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL ) SAL_OVERRIDE; void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) SAL_OVERRIDE { Control::SetPosSizePixel( rNewPos, rNewSize ); } - void SetDropDownSizePixel( const Size& rNewSize ) - { if( IsDropDownBox() ) setPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(), WINDOW_POSSIZE_SIZE | WINDOW_POSSIZE_DROPDOWN ); } Rectangle GetDropDownPosSizePixel() const; diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index 92a017f..449cb7f 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -51,8 +51,6 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; -#define LOGICAL_EDIT_HEIGHT 12 - SvxLineBox::SvxLineBox( vcl::Window* pParent, const Reference< XFrame >& rFrame, WinBits nBits ) : LineLB( pParent, nBits ), nCurPos ( 0 ), @@ -235,8 +233,6 @@ void SvxLineBox::DataChanged( const DataChangedEvent& rDCEvt ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT)); - Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT); - SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT)); } LineLB::DataChanged( rDCEvt ); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 91c5be0..6dfadc7 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -93,7 +93,6 @@ #include <svx/xflclit.hxx> #define MAX_MRU_FONTNAME_ENTRIES 5 -#define LOGICAL_EDIT_HEIGHT 12 // don't make more than 15 entries visible at once #define MAX_STYLES_ENTRIES static_cast< sal_uInt16 >( 15 ) @@ -529,8 +528,6 @@ void SvxStyleBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT)); - Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT); - SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT)); } ComboBox::DataChanged( rDCEvt ); @@ -1040,8 +1037,6 @@ void SvxFontNameBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT)); - Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT); - SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT)); } else if ( ( rDCEvt.GetType() == DataChangedEventType::FONTS ) || ( rDCEvt.GetType() == DataChangedEventType::DISPLAY ) ) diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 680e9a3..0344ed8 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -38,8 +38,6 @@ #include <boost/scoped_ptr.hpp> -#define LOGICAL_EDIT_HEIGHT 12 - using namespace ::com::sun::star; namespace { @@ -132,8 +130,6 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl( SetText( "" ); } - - void SvxFontSizeBox_Impl::ReleaseFocus_Impl() { if ( !m_bRelease ) @@ -263,13 +259,8 @@ void SvxFontSizeBox_Impl::SetOptimalSize() Size aPrefSize(LogicToPixel(m_aLogicalSize, MAP_APPFONT)); aPrefSize.Width() = get_preferred_size().Width(); SetSizePixel(aPrefSize); - Size aDropSize(LogicToPixel(Size(0, LOGICAL_EDIT_HEIGHT), MAP_APPFONT)); - aDropSize.Width() = aPrefSize.Width(); - SetDropDownSizePixel(aDropSize); } - - void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) { if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && commit 653a4a659624d52945b9bd40647002cf31085fe0 Author: Caolán McNamara <[email protected]> Date: Mon Apr 27 13:39:55 2015 +0100 gtk3: semi-sane height for spinboxes Change-Id: I22fb833b59b7e2d749f8111d897f81899019e2d5 diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 15ae57f..972bded 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -667,7 +667,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec vcl::Window *pBorder = pWin->GetWindow( WINDOW_BORDER ); // get the system's spin button size - ImplControlValue aControlValue; + EditBoxValue aControlValue(pWin->GetTextHeight()); Rectangle aBound; Point aPoint; @@ -721,7 +721,7 @@ void SpinField::Resize() { ImplCalcButtonAreas( this, aSize, maDropDownRect, maUpperRect, maLowerRect ); - ImplControlValue aControlValue; + EditBoxValue aControlValue(GetTextHeight()); Point aPoint; Rectangle aContent, aBound; @@ -920,7 +920,7 @@ Size SpinField::CalcMinimumSizeForText(const OUString &rString) const aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize(); if ( GetStyle() & WB_SPIN ) { - ImplControlValue aControlValue; + EditBoxValue aControlValue(GetTextHeight()); Rectangle aArea( Point(), Size(100, aSz.Height())); Rectangle aEntireBound, aEntireContent, aEditBound, aEditContent; if ( diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 666eaf6..4406be2 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1103,6 +1103,10 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar { aEditRect = AdjustRectForTextBordersPadding(mpComboboxStyle, rValue.getNumericVal(), rControlRegion); } + else if (CTRL_SPINBOX && nPart == PART_ENTIRE_CONTROL) + { + aEditRect = AdjustRectForTextBordersPadding(mpSpinStyle, rValue.getNumericVal(), rControlRegion); + } else { return false; commit 15e88c27440b1bcebf5aa09ab36635e4e977a438 Author: Caolán McNamara <[email protected]> Date: Mon Apr 27 13:20:12 2015 +0100 gtk3: seperate calcs for lists, comboboxes and editboxes Change-Id: I38d5582e36fda2471a53e48f0611011bef30f5fe diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 355e2b2..666eaf6 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1091,10 +1091,18 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar { aEditRect = NWGetComboBoxButtonRect( nType, nPart, rControlRegion ); } - else if ((nType == CTRL_EDITBOX || nType == CTRL_LISTBOX || nType == CTRL_COMBOBOX) && nPart == PART_ENTIRE_CONTROL) + else if (nType == CTRL_EDITBOX && nPart == PART_ENTIRE_CONTROL) { aEditRect = AdjustRectForTextBordersPadding(mpEntryStyle, rValue.getNumericVal(), rControlRegion); } + else if (nType == CTRL_LISTBOX && nPart == PART_ENTIRE_CONTROL) + { + aEditRect = AdjustRectForTextBordersPadding(mpListboxStyle, rValue.getNumericVal(), rControlRegion); + } + else if (CTRL_COMBOBOX && nPart == PART_ENTIRE_CONTROL) + { + aEditRect = AdjustRectForTextBordersPadding(mpComboboxStyle, rValue.getNumericVal(), rControlRegion); + } else { return false; commit 37bb10790847bb2088e7f29211a31b1118fed2ad Author: Caolán McNamara <[email protected]> Date: Mon Apr 27 13:15:17 2015 +0100 gtk3: hive the borders and padding calc off into a standalone Change-Id: I0890a7d8c50b8646782bfc4358aa7c2f106dc22d diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index abab9e1..355e2b2 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -979,6 +979,28 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co return true; } +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); + + GtkBorder padding; + gtk_style_context_get_padding(pStyle, GTK_STATE_FLAG_NORMAL, &padding); + + gint nWidgetHeight = nTextHeight + padding.top + padding.bottom + border.top + border.bottom; + + nWidgetHeight = std::max<gint>(nWidgetHeight, rControlRegion.GetHeight()); + + Rectangle aEditRect(rControlRegion.TopLeft(), Size(rControlRegion.GetWidth(), nWidgetHeight)); + + gtk_style_context_restore(pStyle); + + return aEditRect; +} + bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState, const ImplControlValue& rValue, const OUString&, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) @@ -1071,24 +1093,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar } else if ((nType == CTRL_EDITBOX || nType == CTRL_LISTBOX || nType == CTRL_COMBOBOX) && nPart == PART_ENTIRE_CONTROL) { - gtk_style_context_save(mpEntryStyle); - gtk_style_context_add_class(mpEntryStyle, GTK_STYLE_CLASS_ENTRY); - - GtkBorder border; - gtk_style_context_get_border(mpEntryStyle, GTK_STATE_FLAG_NORMAL, &border); - - GtkBorder padding; - gtk_style_context_get_padding(mpEntryStyle, GTK_STATE_FLAG_NORMAL, &padding); - - auto nTextHeight = rValue.getNumericVal(); - - gint nWidgetHeight = nTextHeight + padding.top + padding.bottom + border.top + border.bottom; - - nWidgetHeight = std::max<gint>(nWidgetHeight, rControlRegion.GetHeight()); - - aEditRect = Rectangle(rControlRegion.TopLeft(), Size(rControlRegion.GetWidth(), nWidgetHeight)); - - gtk_style_context_restore(mpEntryStyle); + aEditRect = AdjustRectForTextBordersPadding(mpEntryStyle, rValue.getNumericVal(), rControlRegion); } else {
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
