diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2023-10-29 13:42:00 +0200 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2023-10-29 13:42:00 +0200 |
commit | 6d92006da35d74aa4aa72c5ca679aec5db125de8 (patch) | |
tree | 879a7a387708be62f95cb37f426a61369a3ba99c /src/menuhandler.cpp | |
parent | 30cc7c2464faae2a768052da092daa6705fa5401 (diff) | |
download | tastymenu-6d92006da35d74aa4aa72c5ca679aec5db125de8.tar.gz tastymenu-6d92006da35d74aa4aa72c5ca679aec5db125de8.zip |
Add initial menu transparency support
There is a (mostly aesthetic) problem related to widgets not respecting the palette's background pixmap, due to lack of support in themes (and probably the styles API?).
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src/menuhandler.cpp')
-rw-r--r-- | src/menuhandler.cpp | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/menuhandler.cpp b/src/menuhandler.cpp index 8eaeabb..e0c226f 100644 --- a/src/menuhandler.cpp +++ b/src/menuhandler.cpp @@ -1,4 +1,3 @@ - /*************************************************************************** * Copyright (C) 2006-2007 by Marco Martin * * notmart@gmail.com * @@ -30,14 +29,16 @@ #include <tqfile.h> #include <tqcursor.h> #include <tdepopupmenu.h> +#include <tqobjectlist.h> #include <kdebug.h> +#include <tqlabel.h> #include <time.h> #include "menuhandler.h" #include "buttons.h" MenuHandler::MenuHandler( TQWidget *parent, Prefs *prefs, char *name, WFlags fl) - :TQFrame(parent, name, fl ), searchMode(false) + :TQFrame(parent, name, fl ), searchMode(false), rootPix(nullptr) { prefSkel = prefs; @@ -82,6 +83,7 @@ MenuHandler::MenuHandler( TQWidget *parent, Prefs *prefs, char *name, WFlags fl) readConfig(); setupColumns(); updateWindowType(); + setBackground(); //Searchline... iconLoader = TDEGlobal::iconLoader(); @@ -139,6 +141,7 @@ MenuHandler::MenuHandler( TQWidget *parent, Prefs *prefs, char *name, WFlags fl) sessionsMenu = new TQPopupMenu(); menu->switchButton->setPopup(sessionsMenu); + menu->allAppsFrame->setPaletteBackgroundColor(colorGroup().background()); initializeRecentlyUsed( ); @@ -490,6 +493,7 @@ void MenuHandler::updateConfig() { readConfig(); updateWindowType(); + setBackground(); menu->dynamicList->setActionIconSize( _actionIconSize ); menu->rootList->setActionIconSize( _actionIconSize ); @@ -501,7 +505,7 @@ void MenuHandler::updateConfig() menuModeChanged( _menuMode ); KServiceGroup::Ptr service = KServiceGroup::root(); menu->rootList->clear(); - populateList( service, menu->rootList, NULL, false ); + populateList( service, menu->rootList, NULL, false ); } @@ -518,10 +522,8 @@ void MenuHandler::mousePressEvent( TQMouseEvent *e) } } -void MenuHandler::closeEvent ( TQCloseEvent *e) +void MenuHandler::closeEvent(TQCloseEvent *e) { - e=e; - if( _isNormalWindow ) { prefSkel->setNormalWindowWidth(width()); @@ -1697,5 +1699,29 @@ void MenuHandler::switchWindowMode() menu->detachButton->setIconSet(TQPixmap(uic_findImage(_isNormalWindow ? "attach.png" : "detach.png"))); } + +void MenuHandler::setBackground() +{ + if (rootPix) { + rootPix->stop(); + delete rootPix; + rootPix = nullptr; + } + + if (prefSkel->transparent()) { + rootPix = new KRootPixmap(this); + rootPix->setCustomPainting(true); + rootPix->setBlurEffect(0.0, prefSkel->blurBackground() ? 4.0 : 0.0); + connect(rootPix, TQT_SIGNAL(backgroundUpdated(const TQPixmap&)), + TQT_SLOT(updateBackground(const TQPixmap&))); + rootPix->start(); + } +} + +void MenuHandler::updateBackground(const TQPixmap &pix) +{ + menu->setPaletteBackgroundPixmap(pix); +} + #include "menuhandler.moc" //EOF |