author | sandman <sandman> | 2002-07-15 00:52:50 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-07-15 00:52:50 (UTC) |
commit | ecf2a873be3274bb30be0c659b7db6ef8a43be84 (patch) (side-by-side diff) | |
tree | 5c80fb0863966fffd245f6ed44c6bf524c11842b /noncore/styles/liquid/liquid.cpp | |
parent | 4feeec8b5b41cfd3d13274411f515524f687da09 (diff) | |
download | opie-ecf2a873be3274bb30be0c659b7db6ef8a43be84.zip opie-ecf2a873be3274bb30be0c659b7db6ef8a43be84.tar.gz opie-ecf2a873be3274bb30be0c659b7db6ef8a43be84.tar.bz2 |
Added an option to make toolbar buttons flat
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 28 |
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 @@ -166,12 +166,14 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) LiquidStyle::LiquidStyle() :QWindowsStyle() { setName ( "LiquidStyle" ); + flatTBButtons = false; + btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); btnMaskBmp.setMask(btnMaskBmp); htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); headerHoverID = -1; highlightWidget = NULL; @@ -828,12 +830,19 @@ void LiquidStyle::polish(QPalette &appPal) void LiquidStyle::polish(QWidget *w) { if(w->inherits("QMenuBar")){ //((QFrame*)w)->setLineWidth(0); w->setBackgroundMode(QWidget::PaletteBackground); + w->setBackgroundOrigin(QWidget::ParentOrigin); + return; + } + if(w->inherits("QToolBar")){ + w->installEventFilter(this); + w->setBackgroundMode(QWidget::PaletteBackground); + w->setBackgroundOrigin(QWidget::WidgetOrigin); return; } if(w->inherits("QPopupMenu")) w->setBackgroundMode(QWidget::NoBackground); else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { w->installEventFilter(menuHandler); @@ -890,14 +899,16 @@ void LiquidStyle::polish(QWidget *w) } } if(w->inherits("QHeader")){ w->setMouseTracking(true); w->installEventFilter(this); } - if(w-> inherits("QToolButton")) { - ((QToolButton*)w)->setAutoRaise (false); + if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { + ((QToolButton*)w)->setAutoRaise (flatTBButtons); + if ( flatTBButtons ) + w->setBackgroundOrigin(QWidget::ParentOrigin); } if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ return; } if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> @@ -909,17 +920,12 @@ void LiquidStyle::polish(QWidget *w) !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { if(w->backgroundMode() == QWidget::PaletteBackground || w->backgroundMode() == QWidget::PaletteButton){ w->setBackgroundMode(QWidget::X11ParentRelative); } } - if(w->inherits("QToolBar")){ - w->installEventFilter(this); - w->setBackgroundMode(QWidget::PaletteBackground); - return; - } } void LiquidStyle::unPolish(QWidget *w) { if(w->inherits("QMenuBar")){ @@ -998,12 +1004,14 @@ void LiquidStyle::polish(QApplication *app) Config config ( "qpe" ); config. setGroup ( "Liquid-Style" ); if ( config. readBoolEntry ( "WinDecoration", true )) QApplication::qwsSetDecoration ( new LiquidDecoration ( )); + + flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); } void LiquidStyle::unPolish(QApplication *app) { QWindowsStyle::unPolish(app); app->setEffectEnabled(UI_AnimateMenu, menuAni); @@ -1995,14 +2003,16 @@ void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, if(active){ x -= 2; // Bug in Qt/E y -= 2; w += 2; h += 2; } - - p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); + + QWidget *parent = (QWidget *)p->device(); + p->setBrushOrigin(parent->pos()); + parent->erase(x, y, w, h); if(menuHandler->useShadowText()){ QColor shadow; if(p->device() && p->device()->devType() == QInternal::Widget && ((QWidget *)p->device())->inherits("QMenuBar")){ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |