diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-04-28 10:58:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-28 11:36:39 +0100 |
commit | aff76b56ea8fb87418a47bcbb85541a4f3297aff (patch) | |
tree | af2e0f665f87717ce43c87f1b2d01eef7186c554 | |
parent | a7d843b6112250d1a41c2a56d8e083ccf6538bca (diff) |
gtk3: use native tab item size
Change-Id: Iaef296c44f866bbcbcd2f2148402aef217c81b2c
-rw-r--r-- | vcl/inc/unx/gtk/gtkgdi.hxx | 1 | ||||
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 25 |
3 files changed, 22 insertions, 6 deletions
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 1e52df417f75..2805ef60d6e6 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 ca63e5485d68..4ad94deea591 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 8a141a410df1..68b52bf19957 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); |