Kaydet (Commit) e72849cd authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

fdo#45935: try hard to paint a frame for menus

Current Oxygen theme doesn't draw frames for menus, but uses shaped
and "colored" background images. This workaround paints the window
and menu frame for menus. Any frame seems to be better then no frame
at all.

Change-Id: I4d553ea58cac2729826f8395cb2597fa200187b6
üst ab1f5eab
...@@ -17,10 +17,18 @@ ...@@ -17,10 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#define Region QtXRegion
#include <QStyle>
#include <kapplication.h>
#undef Region
#include "KDEData.hxx" #include "KDEData.hxx"
#include "KDEXLib.hxx" #include "KDEXLib.hxx"
KDEData::~KDEData() KDEData::~KDEData()
{ {
} }
...@@ -39,6 +47,15 @@ void KDEData::initNWF() ...@@ -39,6 +47,15 @@ void KDEData::initNWF()
pSVData->maNWFData.mbDockingAreaSeparateTB = true; pSVData->maNWFData.mbDockingAreaSeparateTB = true;
// no borders for menu, theming does that // no borders for menu, theming does that
pSVData->maNWFData.mbFlatMenu = true; pSVData->maNWFData.mbFlatMenu = true;
// Styled menus need additional space
QStyle *style = kapp->style();
pSVData->maNWFData.mnMenuFormatBorderX =
style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
style->pixelMetric( QStyle::PM_MenuHMargin );
pSVData->maNWFData.mnMenuFormatBorderY =
style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
style->pixelMetric( QStyle::PM_MenuVMargin );
} }
void KDEData::deInitNWF() void KDEData::deInitNWF()
......
...@@ -78,7 +78,7 @@ QRect region2QRect( const Rectangle& rControlRegion ) ...@@ -78,7 +78,7 @@ QRect region2QRect( const Rectangle& rControlRegion )
} }
KDESalGraphics::KDESalGraphics() : KDESalGraphics::KDESalGraphics() :
m_image(0) m_image(NULL)
{ {
} }
...@@ -130,13 +130,7 @@ bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par ...@@ -130,13 +130,7 @@ bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par
if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA) ) if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA) )
return true; return true;
if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) ) return true; if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) ) return true;
return false;
if ( (type == CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) ) return true;
if ( (type == CTRL_TAB_PANE) && (part == PART_ENTIRE_CONTROL) ) return true;
// no CTRL_TAB_BODY for KDE
return false; return false;
} }
...@@ -378,8 +372,10 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, ...@@ -378,8 +372,10 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
{ {
QStyleOptionMenuItem option; QStyleOptionMenuItem option;
draw( QStyle::PE_PanelMenu, &option, m_image, vclStateValue2StateFlag( nControlState, value )); draw( QStyle::PE_PanelMenu, &option, m_image, vclStateValue2StateFlag( nControlState, value ));
// Try hard to get any frame!
QStyleOptionFrame frame; QStyleOptionFrame frame;
draw( QStyle::PE_FrameMenu, &frame, m_image, vclStateValue2StateFlag( nControlState, value )); draw( QStyle::PE_FrameMenu, &frame, m_image, vclStateValue2StateFlag( nControlState, value ));
draw( QStyle::PE_FrameWindow, &frame, m_image, vclStateValue2StateFlag( nControlState, value ));
lastPopupRect = widgetRect; lastPopupRect = widgetRect;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment