summaryrefslogtreecommitdiff
path: root/noncore/styles/liquid/liquid.cpp
Unidiff
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 87b5488..22bf8af 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -160,24 +160,26 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
160 } 160 }
161 } 161 }
162 } 162 }
163 return(false); 163 return(false);
164} 164}
165 165
166 166
167LiquidStyle::LiquidStyle() 167LiquidStyle::LiquidStyle()
168 :QWindowsStyle() 168 :QWindowsStyle()
169{ 169{
170 setName ( "LiquidStyle" ); 170 setName ( "LiquidStyle" );
171 171
172 flatTBButtons = false;
173
172 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 174 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
173 btnMaskBmp.setMask(btnMaskBmp); 175 btnMaskBmp.setMask(btnMaskBmp);
174 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 176 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
175 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 177 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
176 headerHoverID = -1; 178 headerHoverID = -1;
177 highlightWidget = NULL; 179 highlightWidget = NULL;
178 setButtonDefaultIndicatorWidth(0); 180 setButtonDefaultIndicatorWidth(0);
179 btnDict.setAutoDelete(true); 181 btnDict.setAutoDelete(true);
180 bevelFillDict.setAutoDelete(true); 182 bevelFillDict.setAutoDelete(true);
181 smallBevelFillDict.setAutoDelete(true); 183 smallBevelFillDict.setAutoDelete(true);
182 customBtnColorList.setAutoDelete(true); 184 customBtnColorList.setAutoDelete(true);
183 customBtnIconList.setAutoDelete(true); 185 customBtnIconList.setAutoDelete(true);
@@ -822,24 +824,31 @@ void LiquidStyle::polish(QPalette &appPal)
822 else if(w->inherits("QPushButton")){ 824 else if(w->inherits("QPushButton")){
823 applyCustomAttributes((QPushButton *)w); 825 applyCustomAttributes((QPushButton *)w);
824 } 826 }
825 } 827 }
826 828
827} 829}
828 830
829void LiquidStyle::polish(QWidget *w) 831void LiquidStyle::polish(QWidget *w)
830{ 832{
831 if(w->inherits("QMenuBar")){ 833 if(w->inherits("QMenuBar")){
832 //((QFrame*)w)->setLineWidth(0); 834 //((QFrame*)w)->setLineWidth(0);
833 w->setBackgroundMode(QWidget::PaletteBackground); 835 w->setBackgroundMode(QWidget::PaletteBackground);
836 w->setBackgroundOrigin(QWidget::ParentOrigin);
837 return;
838 }
839 if(w->inherits("QToolBar")){
840 w->installEventFilter(this);
841 w->setBackgroundMode(QWidget::PaletteBackground);
842 w->setBackgroundOrigin(QWidget::WidgetOrigin);
834 return; 843 return;
835 } 844 }
836 if(w->inherits("QPopupMenu")) 845 if(w->inherits("QPopupMenu"))
837 w->setBackgroundMode(QWidget::NoBackground); 846 w->setBackgroundMode(QWidget::NoBackground);
838 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 847 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
839 w->installEventFilter(menuHandler); 848 w->installEventFilter(menuHandler);
840 } 849 }
841 850
842 if(w->isTopLevel()){ 851 if(w->isTopLevel()){
843 return; 852 return;
844 } 853 }
845 854
@@ -884,48 +893,45 @@ void LiquidStyle::polish(QWidget *w)
884 w->setAutoMask(true); 893 w->setAutoMask(true);
885 w->setBackgroundMode(QWidget::NoBackground); 894 w->setBackgroundMode(QWidget::NoBackground);
886 } 895 }
887 } 896 }
888 } 897 }
889 return; 898 return;
890 } 899 }
891 } 900 }
892 if(w->inherits("QHeader")){ 901 if(w->inherits("QHeader")){
893 w->setMouseTracking(true); 902 w->setMouseTracking(true);
894 w->installEventFilter(this); 903 w->installEventFilter(this);
895 } 904 }
896 if(w-> inherits("QToolButton")) { 905 if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) {
897 ((QToolButton*)w)->setAutoRaise (false); 906 ((QToolButton*)w)->setAutoRaise (flatTBButtons);
907 if ( flatTBButtons )
908 w->setBackgroundOrigin(QWidget::ParentOrigin);
898 } 909 }
899 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 910 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
900 return; 911 return;
901 } 912 }
902 913
903 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 914 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
904 palette().active().brush(QColorGroup::Background).pixmap()){ 915 palette().active().brush(QColorGroup::Background).pixmap()){
905 qWarning("No parent pixmap for child widget %s", w->className()); 916 qWarning("No parent pixmap for child widget %s", w->className());
906 return; 917 return;
907 } 918 }
908 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 919 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
909 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 920 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
910 if(w->backgroundMode() == QWidget::PaletteBackground || 921 if(w->backgroundMode() == QWidget::PaletteBackground ||
911 w->backgroundMode() == QWidget::PaletteButton){ 922 w->backgroundMode() == QWidget::PaletteButton){
912 w->setBackgroundMode(QWidget::X11ParentRelative); 923 w->setBackgroundMode(QWidget::X11ParentRelative);
913 } 924 }
914 } 925 }
915 if(w->inherits("QToolBar")){
916 w->installEventFilter(this);
917 w->setBackgroundMode(QWidget::PaletteBackground);
918 return;
919 }
920 926
921} 927}
922 928
923void LiquidStyle::unPolish(QWidget *w) 929void LiquidStyle::unPolish(QWidget *w)
924{ 930{
925 if(w->inherits("QMenuBar")){ 931 if(w->inherits("QMenuBar")){
926 ((QFrame *)w)->setLineWidth(1); 932 ((QFrame *)w)->setLineWidth(1);
927 w->setBackgroundMode(QWidget::PaletteBackground); 933 w->setBackgroundMode(QWidget::PaletteBackground);
928 return; 934 return;
929 } 935 }
930 936
931 if(w->inherits("QPopupMenu")) 937 if(w->inherits("QPopupMenu"))
@@ -992,24 +998,26 @@ void LiquidStyle::polish(QApplication *app)
992 if(menuAni) 998 if(menuAni)
993 app->setEffectEnabled(UI_AnimateMenu, false); 999 app->setEffectEnabled(UI_AnimateMenu, false);
994 if(menuFade) 1000 if(menuFade)
995 app->setEffectEnabled(UI_FadeMenu, false); 1001 app->setEffectEnabled(UI_FadeMenu, false);
996 1002
997 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 1003 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
998 1004
999 Config config ( "qpe" ); 1005 Config config ( "qpe" );
1000 config. setGroup ( "Liquid-Style" ); 1006 config. setGroup ( "Liquid-Style" );
1001 1007
1002 if ( config. readBoolEntry ( "WinDecoration", true )) 1008 if ( config. readBoolEntry ( "WinDecoration", true ))
1003 QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 1009 QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
1010
1011 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
1004} 1012}
1005 1013
1006void LiquidStyle::unPolish(QApplication *app) 1014void LiquidStyle::unPolish(QApplication *app)
1007{ 1015{
1008 QWindowsStyle::unPolish(app); 1016 QWindowsStyle::unPolish(app);
1009 app->setEffectEnabled(UI_AnimateMenu, menuAni); 1017 app->setEffectEnabled(UI_AnimateMenu, menuAni);
1010 app->setEffectEnabled(UI_FadeMenu, menuFade); 1018 app->setEffectEnabled(UI_FadeMenu, menuFade);
1011 1019
1012 qt_set_draw_menu_bar_impl ( 0 ); 1020 qt_set_draw_menu_bar_impl ( 0 );
1013 1021
1014 QApplication::qwsSetDecoration ( new QPEDecoration ( )); 1022 QApplication::qwsSetDecoration ( new QPEDecoration ( ));
1015} 1023}
@@ -1989,26 +1997,28 @@ void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x,
1989} 1997}
1990 1998
1991 1999
1992void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 2000void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
1993 QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) 2001 QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
1994 { 2002 {
1995 if(active){ 2003 if(active){
1996 x -= 2; // Bug in Qt/E 2004 x -= 2; // Bug in Qt/E
1997 y -= 2; 2005 y -= 2;
1998 w += 2; 2006 w += 2;
1999 h += 2; 2007 h += 2;
2000 } 2008 }
2001 2009
2002 p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); 2010 QWidget *parent = (QWidget *)p->device();
2011 p->setBrushOrigin(parent->pos());
2012 parent->erase(x, y, w, h);
2003 2013
2004 if(menuHandler->useShadowText()){ 2014 if(menuHandler->useShadowText()){
2005 QColor shadow; 2015 QColor shadow;
2006 if(p->device() && p->device()->devType() == QInternal::Widget && 2016 if(p->device() && p->device()->devType() == QInternal::Widget &&
2007 ((QWidget *)p->device())->inherits("QMenuBar")){ 2017 ((QWidget *)p->device())->inherits("QMenuBar")){
2008 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 2018 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
2009 g.background().dark(130); 2019 g.background().dark(130);
2010 } 2020 }
2011 else 2021 else
2012 shadow = g.background().dark(130); 2022 shadow = g.background().dark(130);
2013 2023
2014 if(active){ 2024 if(active){