[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/osx vcl/source vcl/unx vcl/win
Caolán McNamara
caolanm at redhat.com
Fri May 15 09:21:23 PDT 2015
include/vcl/settings.hxx | 3 +
vcl/inc/unx/gtk/gtkgdi.hxx | 1
vcl/osx/salframe.cxx | 1
vcl/source/app/settings.cxx | 16 +++++
vcl/source/window/menu.cxx | 16 ++++-
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 1
vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 76 ++++++++++++++++++--------
vcl/unx/kde/salnativewidgets-kde.cxx | 1
vcl/unx/kde4/KDESalFrame.cxx | 1
vcl/win/source/window/salframe.cxx | 1
10 files changed, 90 insertions(+), 27 deletions(-)
New commits:
commit 186eefd7e2020c65db32dacc3a9389573e7cddeb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri May 15 17:19:24 2015 +0100
gtk3: render native menubar and menubaritems
this needs the addition of a new MenuBarHighlightTextColor
which defaults to MenuHighlightTextColor on other platforms
Change-Id: Id0550294f1778229cbbe154857ba16c629dc5a87
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 445bb5a..c60aa64 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -328,6 +328,9 @@ public:
void SetMenuBarRolloverTextColor( const Color& rColor );
const Color& GetMenuBarRolloverTextColor() const;
+ void SetMenuBarHighlightTextColor( const Color& rColor );
+ const Color& GetMenuBarHighlightTextColor() const;
+
void SetMenuHighlightColor( const Color& rColor );
const Color& GetMenuHighlightColor() const;
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 0403b59..656c1ac 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -73,6 +73,7 @@ private:
static GtkStyleContext *mpToolbarSeperatorStyle;
static GtkStyleContext *mpCheckButtonStyle;
static GtkStyleContext *mpMenuBarStyle;
+ static GtkStyleContext *mpMenuBarItemStyle;
static GtkStyleContext *mpMenuStyle;
static GtkStyleContext *mpMenuItemStyle;
static GtkStyleContext *mpSpinStyle;
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index af1327f..98b49e8 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1199,6 +1199,7 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetMenuTextColor( aMenuTextColor );
aStyleSettings.SetMenuBarTextColor( aMenuTextColor );
aStyleSettings.SetMenuBarRolloverTextColor( aMenuTextColor );
+ aStyleSettings.SetMenuBarHighlightTextColor(aStyleSettings.GetMenuHighlightTextColor());
aStyleSettings.SetCursorBlinkTime( 500 );
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 5d59336..ff49e02 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -125,6 +125,7 @@ struct ImplStyleData
Color maMenuTextColor;
Color maMenuBarTextColor;
Color maMenuBarRolloverTextColor;
+ Color maMenuBarHighlightTextColor;
Color maMonoColor;
Color maRadioCheckTextColor;
Color maShadowColor;
@@ -600,6 +601,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
maMenuTextColor( rData.maMenuTextColor ),
maMenuBarTextColor( rData.maMenuBarTextColor ),
maMenuBarRolloverTextColor( rData.maMenuBarRolloverTextColor ),
+ maMenuBarHighlightTextColor( rData.maMenuBarHighlightTextColor ),
maMonoColor( rData.maMonoColor ),
maRadioCheckTextColor( rData.maRadioCheckTextColor ),
maShadowColor( rData.maShadowColor ),
@@ -734,6 +736,7 @@ void ImplStyleData::SetStandardStyles()
maMenuTextColor = Color( COL_BLACK );
maMenuBarTextColor = Color( COL_BLACK );
maMenuBarRolloverTextColor = Color( COL_WHITE );
+ maMenuBarHighlightTextColor = Color( COL_BLUE );
maMenuHighlightColor = Color( COL_BLUE );
maMenuHighlightTextColor = Color( COL_WHITE );
maHighlightColor = Color( COL_BLUE );
@@ -1271,6 +1274,19 @@ StyleSettings::GetMenuBarRolloverTextColor() const
}
void
+StyleSettings::SetMenuBarHighlightTextColor( const Color& rColor )
+{
+ CopyData();
+ mxData->maMenuBarHighlightTextColor = rColor;
+}
+
+const Color&
+StyleSettings::GetMenuBarHighlightTextColor() const
+{
+ return mxData->maMenuBarHighlightTextColor;
+}
+
+void
StyleSettings::SetMenuHighlightColor( const Color& rColor )
{
CopyData();
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 7c99003..d43c3cf 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1857,10 +1857,18 @@ void Menu::ImplPaint(vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuIt
{
if ( pThisItemOnly )
{
- if (IsMenuBar()&& bRollover )
- pWin->SetTextColor( rSettings.GetMenuBarRolloverTextColor() );
- else if ( bHighlighted )
- pWin->SetTextColor( rSettings.GetMenuHighlightTextColor() );
+ if (IsMenuBar())
+ {
+ if (bRollover)
+ pWin->SetTextColor(rSettings.GetMenuBarRolloverTextColor());
+ else if (bHighlighted)
+ pWin->SetTextColor(rSettings.GetMenuBarHighlightTextColor());
+ }
+ else
+ {
+ if (bHighlighted)
+ pWin->SetTextColor(rSettings.GetMenuHighlightTextColor());
+ }
}
Point aPos( aTopLeft );
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 20feb22..b29c13a 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -4018,6 +4018,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aTextColor = aStyleSet.GetPersonaMenuBarTextColor().get_value_or( getColor( pMenubarStyle->fg[GTK_STATE_NORMAL] ) );
aStyleSet.SetMenuBarTextColor( aTextColor );
aStyleSet.SetMenuBarRolloverTextColor( aTextColor );
+ aStyleSet.SetMenuBarHighlightTextColor(aStyleSet.GetMenuHighlightTextColor());
#if OSL_DEBUG_LEVEL > 1
std::fprintf( stderr, "==\n" );
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index aa0681b..ed0a359 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -29,6 +29,7 @@ GtkStyleContext* GtkSalGraphics::mpToolButtonStyle = NULL;
GtkStyleContext* GtkSalGraphics::mpToolbarSeperatorStyle = NULL;
GtkStyleContext* GtkSalGraphics::mpCheckButtonStyle = NULL;
GtkStyleContext* GtkSalGraphics::mpMenuBarStyle = NULL;
+GtkStyleContext* GtkSalGraphics::mpMenuBarItemStyle = NULL;
GtkStyleContext* GtkSalGraphics::mpMenuStyle = NULL;
GtkStyleContext* GtkSalGraphics::mpMenuItemStyle = NULL;
GtkStyleContext* GtkSalGraphics::mpSpinStyle = NULL;
@@ -796,6 +797,20 @@ void GtkSalGraphics::PaintCheckOrRadio(GtkStyleContext *context,
# define CHECKED GTK_STATE_FLAG_ACTIVE
#endif
+static GtkWidget* gCacheWindow;
+static GtkWidget* gDumbContainer;
+static GtkWidget* gSpinBox;
+static GtkWidget* gEntryBox;
+static GtkWidget* gComboBox;
+static GtkWidget* gComboBoxButtonWidget;
+static GtkWidget* gComboBoxEntryWidget;
+static GtkWidget* gListBox;
+static GtkWidget* gListBoxButtonWidget;
+static GtkWidget* gFrameIn;
+static GtkWidget* gFrameOut;
+static GtkWidget* gMenuBarWidget;
+static GtkWidget* gMenuItemMenuBarWidget;
+
bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
ControlState nState, const ImplControlValue& rValue,
const OUString& )
@@ -946,6 +961,22 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
context = mpFrameInStyle;
break;
}
+ case CTRL_MENUBAR:
+ if (nPart == PART_MENU_ITEM)
+ {
+ context = mpMenuBarItemStyle;
+ styleClass = GTK_STYLE_CLASS_MENUBAR;
+
+ flags = (!(nState & ControlState::ENABLED)) ? GTK_STATE_FLAG_INSENSITIVE : GTK_STATE_FLAG_NORMAL;
+ if (nState & ControlState::SELECTED)
+ flags = (GtkStateFlags) (flags | GTK_STATE_FLAG_PRELIGHT);
+ }
+ else
+ {
+ context = gtk_widget_get_style_context(gMenuBarWidget);
+ styleClass = GTK_STYLE_CLASS_BACKGROUND;
+ }
+ break;
default:
return false;
}
@@ -1096,18 +1127,6 @@ Rectangle AdjustRectForTextBordersPadding(GtkStyleContext* pStyle, long nContent
return aEditRect;
}
-static GtkWidget* gCacheWindow;
-static GtkWidget* gDumbContainer;
-static GtkWidget* gSpinBox;
-static GtkWidget* gEntryBox;
-static GtkWidget* gComboBox;
-static GtkWidget* gComboBoxButtonWidget;
-static GtkWidget* gComboBoxEntryWidget;
-static GtkWidget* gListBox;
-static GtkWidget* gListBoxButtonWidget;
-static GtkWidget* gFrameIn;
-static GtkWidget* gFrameOut;
-
bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState,
const ImplControlValue& rValue, const OUString&,
Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion )
@@ -1182,6 +1201,10 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar
if (!aEditRect.GetHeight())
aEditRect.Bottom() = aEditRect.Top() + 1;
}
+ if( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL) )
+ {
+ aEditRect = GetWidgetSize(rControlRegion, gMenuBarWidget);
+ }
else if ( (nType==CTRL_SPINBOX) &&
((nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) ||
(nPart==PART_SUB_EDIT)) )
@@ -1391,11 +1414,15 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetMenuBarColor( aBackColor );
aStyleSet.SetMenuBarRolloverColor( aBackColor );
- gtk_style_context_get_color( mpMenuBarStyle, GTK_STATE_FLAG_NORMAL, &text_color );
+ gtk_style_context_get_color( mpMenuBarItemStyle, GTK_STATE_FLAG_NORMAL, &text_color );
aTextColor = aStyleSet.GetPersonaMenuBarTextColor().get_value_or( getColor( text_color ) );
aStyleSet.SetMenuBarTextColor( aTextColor );
aStyleSet.SetMenuBarRolloverTextColor( aTextColor );
+ gtk_style_context_get_color( mpMenuBarItemStyle, GTK_STATE_FLAG_PRELIGHT, &text_color );
+ aTextColor = aStyleSet.GetPersonaMenuBarTextColor().get_value_or( getColor( text_color ) );
+ aStyleSet.SetMenuBarHighlightTextColor( aTextColor );
+
// menu items
gtk_style_context_get_color( mpMenuStyle, GTK_STATE_FLAG_NORMAL, &color );
aTextColor = getColor( color );
@@ -1418,12 +1445,10 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
gtk_style_context_get_background_color( mpMenuItemStyle, GTK_STATE_FLAG_PRELIGHT, &background_color );
::Color aHighlightColor = getColor( background_color );
+ aStyleSet.SetMenuHighlightColor( aHighlightColor );
gtk_style_context_get_color( mpMenuItemStyle, GTK_STATE_FLAG_PRELIGHT, &color );
::Color aHighlightTextColor = getColor( color );
- if( aHighlightColor == aHighlightTextColor )
- aHighlightTextColor = (aHighlightColor.GetLuminance() < 128) ? ::Color( COL_WHITE ) : ::Color( COL_BLACK );
- aStyleSet.SetMenuHighlightColor( aHighlightColor );
aStyleSet.SetMenuHighlightTextColor( aHighlightTextColor );
// hyperlink colors
@@ -1718,10 +1743,10 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
return true;
break;
-// case CTRL_MENUBAR:
-// if(nPart==PART_ENTIRE_CONTROL || nPart==PART_MENU_ITEM)
-// return true;
-// break;
+ case CTRL_MENUBAR:
+ if (nPart==PART_ENTIRE_CONTROL || nPart==PART_MENU_ITEM)
+ return true;
+ break;
case CTRL_MENU_POPUP:
if (nPart==PART_ENTIRE_CONTROL
@@ -1893,8 +1918,11 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
gtk_widget_path_free(path);
/* Menu bar */
- getStyleContext(&mpMenuBarStyle, gtk_menu_bar_new());
- gtk_style_context_add_class(mpMenuBarStyle, GTK_STYLE_CLASS_MENU);
+ gMenuBarWidget = gtk_menu_bar_new();
+ gMenuItemMenuBarWidget = gtk_menu_item_new_with_label( "b" );
+ gtk_menu_shell_append(GTK_MENU_SHELL(gMenuBarWidget), gMenuItemMenuBarWidget);
+ getStyleContext(&mpMenuBarStyle, gMenuBarWidget);
+ mpMenuBarItemStyle = gtk_widget_get_style_context(gMenuItemMenuBarWidget);
/* Spinbutton */
gSpinBox = gtk_spin_button_new(NULL, 0, 0);
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index 627a155..e014e78 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -2018,6 +2018,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetMenuBarRolloverColor( aMenuBack );
aStyleSettings.SetMenuBarRolloverTextColor( aMenuFore );
}
+ aStyleSettings.SetMenuBarHighlightTextColor(aStyleSettings.GetMenuHighlightTextColor());
// Font
aFont = toFont( pMenuBar->font(), rSettings.GetUILanguageTag().getLocale() );
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
index fa18109..51f6cf5 100644
--- a/vcl/unx/kde4/KDESalFrame.cxx
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -323,6 +323,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
style.SetMenuBarRolloverColor( aMenuBack );
style.SetMenuBarRolloverTextColor( aMenuFore );
}
+ style.SetMenuBarHighlightTextColor(style.GetMenuHighlightTextColor());
// Font
aFont = toFont( pMenuBar->font(), rSettings.GetUILanguageTag().getLocale() );
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index fae12e6..79f4e6e 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2723,6 +2723,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetMenuBarTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) );
aStyleSettings.SetMenuBarRolloverTextColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHTTEXT ) ) );
}
+ aStyleSettings.SetMenuBarHighlightTextColor(aStyleSettings.GetMenuHighlightTextColor());
aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) );
aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) );
aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) );
commit 18331ddcc8cb65183967d9763a6a02cb5dea72e9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri May 15 14:39:33 2015 +0100
gtk3: punt tooltips for now
Change-Id: I3740ea5f8a2c4d237b3a97ce981fa09c4ea94827
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index d8cd408..aa0681b 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -1652,10 +1652,12 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
{
switch(nType)
{
+ case CTRL_TOOLTIP:
+ return false; //shaped, punt that problem for now
+
case CTRL_PUSHBUTTON:
case CTRL_RADIOBUTTON:
case CTRL_CHECKBOX:
-// case CTRL_TOOLTIP:
// case CTRL_PROGRESS:
// case CTRL_LISTNODE:
// case CTRL_LISTNET:
More information about the Libreoffice-commits
mailing list