diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-03-25 20:37:57 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-03-26 01:06:13 +0100 |
commit | 42573cc6b43972357d166b0eabf665b1de64f0ac (patch) | |
tree | 9c84befb71dcad1076657618f616d82ab440b1ec | |
parent | 931f305a785fdaf3b310aeed1c2033d3e42ec82a (diff) | |
download | tde-style-baghira-42573cc6b43972357d166b0eabf665b1de64f0ac.tar.gz tde-style-baghira-42573cc6b43972357d166b0eabf665b1de64f0ac.zip |
Update to new style API
Rename KStyle to TDEStyle
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r-- | bab/main.cpp | 2 | ||||
-rw-r--r-- | config/Makefile.am | 16 | ||||
-rw-r--r-- | config/tdestyle_baghira_config.cpp (renamed from config/kstyle_baghira_config.cpp) | 184 | ||||
-rw-r--r-- | config/tdestyle_baghira_config.h (renamed from config/kstyle_baghira_config.h) | 10 | ||||
-rw-r--r-- | configure.in.in | 1 | ||||
-rw-r--r-- | kickermenu/configure.in.in | 2 | ||||
-rw-r--r-- | sidebar/configure.in.in | 2 | ||||
-rw-r--r-- | style/Makefile.am | 2 | ||||
-rw-r--r-- | style/baghira.cpp | 301 | ||||
-rw-r--r-- | style/baghira.h | 146 | ||||
-rw-r--r-- | style/baghira.themerc | 2 | ||||
-rw-r--r-- | style/eventfilter.cpp | 32 | ||||
-rw-r--r-- | style/polish.cpp | 109 |
13 files changed, 464 insertions, 345 deletions
diff --git a/bab/main.cpp b/bab/main.cpp index 4adf380..c4bf7ac 100644 --- a/bab/main.cpp +++ b/bab/main.cpp @@ -204,7 +204,7 @@ void bab::configureBaghira() // any errors that arise KLibLoader* loader = KLibLoader::self(); - KLibrary* library = loader->library( TQFile::encodeName("kstyle_baghira_config") ); + KLibrary* library = loader->library( TQFile::encodeName("tdestyle_baghira_config") ); if (!library) { tqWarning("There was an error loading the configuration dialog for this style."); diff --git a/config/Makefile.am b/config/Makefile.am index fb84c20..1c1e6af 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -1,21 +1,21 @@ INCLUDES = $(all_includes) -noinst_HEADERS = about.h configdialog.h help.h kstyle_baghira_config.h colordialog.h colorpicker.h +noinst_HEADERS = about.h configdialog.h help.h tdestyle_baghira_config.h colordialog.h colorpicker.h METASOURCES = AUTO # Install this plugin in the KDE modules directory -kde_module_LTLIBRARIES = kstyle_baghira_config.la +kde_module_LTLIBRARIES = tdestyle_baghira_config.la -kstyle_baghira_config_la_SOURCES = kstyle_baghira_config.cpp colordialog.cpp colorpicker.cpp configdialog.ui help.ui about.ui -# kstyle_baghira_config_la_METASOURCES = AUTO -kstyle_baghira_config_la_LIBADD = $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_TDEIO) -kstyle_baghira_config_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined $(KDE_PLUGIN) +tdestyle_baghira_config_la_SOURCES = tdestyle_baghira_config.cpp colordialog.cpp colorpicker.cpp configdialog.ui help.ui about.ui +# tdestyle_baghira_config_la_METASOURCES = AUTO +tdestyle_baghira_config_la_LIBADD = $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_TDEIO) +tdestyle_baghira_config_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined $(KDE_PLUGIN) messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/kstyle_baghira_config.pot + $(XGETTEXT) *.cpp -o $(podir)/tdestyle_baghira_config.pot pixmaps.h: $(srcdir)/generatePixmaps.sh $(SHELL) $(srcdir)/generatePixmaps.sh $(top_srcdir) CLEANFILES = pixmaps.h -kstyle_baghira_config.lo: pixmaps.h +tdestyle_baghira_config.lo: pixmaps.h diff --git a/config/kstyle_baghira_config.cpp b/config/tdestyle_baghira_config.cpp index ad43805..f94c50b 100644 --- a/config/kstyle_baghira_config.cpp +++ b/config/tdestyle_baghira_config.cpp @@ -57,7 +57,7 @@ #include <X11/Xutil.h> #include <fixx11h.h> -#include "kstyle_baghira_config.h" +#include "tdestyle_baghira_config.h" #include "pixmaps.h" #include "colordialog.h" #include "colorpicker.h" @@ -84,7 +84,7 @@ iGrey = 255 - grey;\ destR = (iGrey * (srcR - delta) + grey * R) / 255; \ destG = (iGrey * (srcG - delta) + grey * G) / 255; \ - destB = (iGrey * (srcB - delta) + grey * B) / 255; + destB = (iGrey * (srcB - delta) + grey * B) / 255; #define SATURATION_COLOR2(S,R,G,B) \ int max = (int)(255+0.65*(100-S)); \ @@ -94,38 +94,38 @@ destR = (S*destR + (100-S)*R)/100; \ destG = (S*destG + (100-S)*G)/100; \ destB = (S*destB + (100-S)*B)/100; - + #define COLOR_SPACE(R,G,B) \ if ( R < 0 ) R = 0; else if ( R > 255 ) R = 255; \ if ( G < 0 ) G = 0; else if ( G > 255 ) G = 255; \ if ( B < 0 ) B = 0; else if ( B > 255 ) B = 255; -void kstyle_baghira_config::openHtml1() +void tdestyle_baghira_config::openHtml1() { TQStringList args; args << "exec" << "http://baghira.sf.net/"; kapp->tdeinitExec("kfmclient", args); } -void kstyle_baghira_config::openHtml2() +void tdestyle_baghira_config::openHtml2() { TQStringList args; args << "exec" << "http://www.sf.net/projects/baghira/files/"; kapp->tdeinitExec("kfmclient", args); } -void kstyle_baghira_config::startBab() +void tdestyle_baghira_config::startBab() { kapp->tdeinitExec("bab"); } -void kstyle_baghira_config::startKRuler() +void tdestyle_baghira_config::startKRuler() { kapp->tdeinitExec("kruler"); } -TQImage* kstyle_baghira_config::tintButton(TQImage &src, TQColor c) +TQImage* tdestyle_baghira_config::tintButton(TQImage &src, TQColor c) { TQImage *dest = new TQImage( src.width(), src.height(), 32, 0 ); dest->setAlphaBuffer( true ); @@ -154,7 +154,7 @@ TQImage* kstyle_baghira_config::tintButton(TQImage &src, TQColor c) return ( dest ); } -TQImage* kstyle_baghira_config::tintBrush( TQImage &img, TQColor c) +TQImage* tdestyle_baghira_config::tintBrush( TQImage &img, TQColor c) { TQImage *dest = new TQImage( img.width(), img.height(), 32, 0 ); unsigned int *data = ( unsigned int * ) img.bits(); @@ -164,12 +164,12 @@ TQImage* kstyle_baghira_config::tintBrush( TQImage &img, TQColor c) int delta; int red, green, blue, grey, iGrey; int destR, destG, destB, alpha; - + int srcR = c.red(); int srcG = c.green(); int srcB = c.blue(); - - + + // float srcPercent, destPercent; for ( current = 0 ; current < total ; ++current ) { alpha = tqAlpha( data[ current ] ); @@ -184,7 +184,7 @@ TQImage* kstyle_baghira_config::tintBrush( TQImage &img, TQColor c) return ( dest ); } -void kstyle_baghira_config::sliderButtonRedChanged(int value) +void tdestyle_baghira_config::sliderButtonRedChanged(int value) { sliderButtonRedValue = value; dialog_->valueButtonRed->setNum(value); @@ -193,7 +193,7 @@ void kstyle_baghira_config::sliderButtonRedChanged(int value) configChanged(); } -void kstyle_baghira_config::sliderButtonGreenChanged(int value) +void tdestyle_baghira_config::sliderButtonGreenChanged(int value) { sliderButtonGreenValue = value; dialog_->valueButtonGreen->setNum(value); @@ -202,7 +202,7 @@ void kstyle_baghira_config::sliderButtonGreenChanged(int value) configChanged(); } -void kstyle_baghira_config::sliderButtonBlueChanged(int value) +void tdestyle_baghira_config::sliderButtonBlueChanged(int value) { sliderButtonBlueValue = value; dialog_->valueButtonBlue->setNum(value); @@ -211,7 +211,7 @@ void kstyle_baghira_config::sliderButtonBlueChanged(int value) configChanged(); } -void kstyle_baghira_config::sliderBrushRedChanged(int value) +void tdestyle_baghira_config::sliderBrushRedChanged(int value) { sliderBrushRedValue = value; dialog_->pixmapBrushPreview->setPixmap(*tintBrush(baseImage2, TQColor(sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue))); @@ -219,7 +219,7 @@ void kstyle_baghira_config::sliderBrushRedChanged(int value) configChanged(); } -void kstyle_baghira_config::sliderBrushGreenChanged(int value) +void tdestyle_baghira_config::sliderBrushGreenChanged(int value) { sliderBrushGreenValue = value; dialog_->pixmapBrushPreview->setPixmap(*tintBrush(baseImage2, TQColor(sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue))); @@ -227,7 +227,7 @@ void kstyle_baghira_config::sliderBrushGreenChanged(int value) configChanged(); } -void kstyle_baghira_config::sliderBrushBlueChanged(int value) +void tdestyle_baghira_config::sliderBrushBlueChanged(int value) { sliderBrushBlueValue = value; dialog_->pixmapBrushPreview->setPixmap(*tintBrush(baseImage2, TQColor(sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue))); @@ -235,7 +235,7 @@ void kstyle_baghira_config::sliderBrushBlueChanged(int value) configChanged(); } -// void kstyle_baghira_config::sliderBrushSaturationChanged(int value) +// void tdestyle_baghira_config::sliderBrushSaturationChanged(int value) // { // sliderBrushSaturationValue = value; // dialog_->pixmapBrushPreview->setPixmap(*tintBrush(baseImage2, TQColor(sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue), sliderBrushSaturationValue)); @@ -255,14 +255,14 @@ int presetColor[NUMBEROFCOLORS][3] = {{84,144,218},{130,170,190},{103,118,134},{ // -------------------------------- -typedef KGenericFactory<kstyle_baghira_config, TQWidget> kstyle_baghira_configFactory; -K_EXPORT_COMPONENT_FACTORY( kcm_kstyle_baghira_config, kstyle_baghira_configFactory("kcmkstyle_baghira_config")) +typedef KGenericFactory<tdestyle_baghira_config, TQWidget> tdestyle_baghira_configFactory; +K_EXPORT_COMPONENT_FACTORY( tdecm_tdestyle_baghira_config, tdestyle_baghira_configFactory("tdecmtdestyle_baghira_config")) //extern TQImage uic_findImage(const TQString& name); //extern void qInitImages_baghira(); //extern void qCleanupImages_baghira(); -void kstyle_baghira_config::updateCR() +void tdestyle_baghira_config::updateCR() { if (!about_->isShown()) { @@ -276,7 +276,7 @@ void kstyle_baghira_config::updateCR() about_->crLabel->setText(crNotes[crCurrent]); } -void kstyle_baghira_config::showAbout() +void tdestyle_baghira_config::showAbout() { crCurrent = 0; about_->crLabel->setText(crNotes[0]); @@ -284,7 +284,7 @@ void kstyle_baghira_config::showAbout() about_->exec(); } -kstyle_baghira_config::kstyle_baghira_config(TQWidget *parent, const char *name, const TQStringList&) : TQWidget(parent, name )//, myAboutData(0) +tdestyle_baghira_config::tdestyle_baghira_config(TQWidget *parent, const char *name, const TQStringList&) : TQWidget(parent, name )//, myAboutData(0) { loadDone = false; if (parent) parent->setCaption("Configure Your Cat"); @@ -293,7 +293,7 @@ kstyle_baghira_config::kstyle_baghira_config(TQWidget *parent, const char *name, for (int i = 0; i < NUMBEROFCOLORS; i++) dialog_->colorPresets->insertItem ( presetColorName[i], i ); - + TQWidget *rulesWidget = new TQWidget(dialog_->tabWidget); TQHBoxLayout *rwlh = new TQHBoxLayout(rulesWidget); applist = new TDEListView(rulesWidget); @@ -344,9 +344,9 @@ kstyle_baghira_config::kstyle_baghira_config(TQWidget *parent, const char *name, connect(appsetter, SIGNAL(removeApp(TQString)), this, SLOT(removeApp(TQString))); // preview stuff baseImage = uic_findImage("button-base"); - + layout->addWidget(dialog_); - + dialog_->show(); help_ = new Help(dialog_); about_ = new About(dialog_); @@ -362,7 +362,7 @@ kstyle_baghira_config::kstyle_baghira_config(TQWidget *parent, const char *name, about_->systemLabel->setText(tmpString.section(' ',1,1)); about_->cpuLabel->setText(tmpString.section(' ',0,0)); about_->setFixedSize (380, 430); - + // connections // buttons connect(dialog_->buttonHelp, SIGNAL(clicked()), help_, SLOT(exec())); @@ -374,7 +374,7 @@ kstyle_baghira_config::kstyle_baghira_config(TQWidget *parent, const char *name, connect(dialog_->buttonLoad, SIGNAL(clicked()), this, SLOT(buttonLoadAction())); connect(dialog_->buttonSaveAs, SIGNAL(clicked()), this, SLOT(buttonSaveAsAction())); connect(dialog_->colorPresets, SIGNAL(activated(int)), this, SLOT(setPresetColor(int))); - + // changes connect(dialog_->defaultStyle, SIGNAL(activated(int)), this, SLOT(configChanged())); connect(dialog_->buttonStyle, SIGNAL(activated(int)), this, SLOT(handleButtonStyles(int))); @@ -412,7 +412,7 @@ kstyle_baghira_config::kstyle_baghira_config(TQWidget *parent, const char *name, connect(dialog_->useCustomColors, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); connect(dialog_->drawMenuStripe, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); connect(dialog_->glossyMenus, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); - + connect(dialog_->customInactiveColor, SIGNAL(changed(const TQColor &)), this, SLOT(configChanged())); connect(dialog_->toolbuttonHighColor, SIGNAL(changed(const TQColor &)), this, SLOT(changeTooluttonHighlightColor(const TQColor &))); connect(dialog_->treeLineColor, SIGNAL(changed(const TQColor &)), this, SLOT(configChanged())); @@ -432,7 +432,7 @@ connect(dialog_->toolbuttonHighColor, SIGNAL(changed(const TQColor &)), this, SL connect(dialog_->inactiveTabColor, SIGNAL(changed(const TQColor &)), this, SLOT(configChanged())); connect(dialog_->activeTabColor, SIGNAL(changed(const TQColor &)), this, SLOT(configChanged())); connect(dialog_->menuStripeColor, SIGNAL(changed(const TQColor &)), this, SLOT(configChanged())); - + connect(dialog_->sliderButtonRed, SIGNAL(valueChanged (int)), this, SLOT(sliderButtonRedChanged(int))); connect(dialog_->sliderButtonGreen, SIGNAL(valueChanged (int)), this, SLOT(sliderButtonGreenChanged(int))); connect(dialog_->sliderButtonBlue, SIGNAL(valueChanged (int)), this, SLOT(sliderButtonBlueChanged(int))); @@ -440,7 +440,7 @@ connect(dialog_->toolbuttonHighColor, SIGNAL(changed(const TQColor &)), this, SL connect(dialog_->sliderBrushRed, SIGNAL(valueChanged (int)), this, SLOT(sliderBrushRedChanged(int))); connect(dialog_->sliderBrushGreen, SIGNAL(valueChanged (int)), this, SLOT(sliderBrushGreenChanged(int))); connect(dialog_->sliderBrushBlue, SIGNAL(valueChanged (int)), this, SLOT(sliderBrushBlueChanged(int))); - + // GUI connect (dialog_->defaultStyle, SIGNAL(activated(int)), this, SLOT(setDesign(int))); connect (dialog_->inactiveColorType, SIGNAL(activated(int)), this, SLOT(enableInButtonColor(int))); @@ -452,34 +452,34 @@ connect(dialog_->toolbuttonHighColor, SIGNAL(changed(const TQColor &)), this, SL connect (dialog_->drawMenuStripe, SIGNAL(toggled(bool)), dialog_->menuStripeColor, SLOT(setEnabled(bool))); // connect (dialog_->tintBrush, SIGNAL(toggled(bool)), dialog_->brushBox, SLOT(setEnabled(bool))); connect (dialog_->useCustomColors, SIGNAL(toggled(bool)), dialog_->colorFrame, SLOT(setEnabled(bool))); - + // load settings load(); loadDone = true; - + dialog_->pixmapButtonPreview->setPixmap(*tintButton(baseImage, TQColor(sliderButtonRedValue, sliderButtonGreenValue, sliderButtonBlueValue))); }; -kstyle_baghira_config::~kstyle_baghira_config() +tdestyle_baghira_config::~tdestyle_baghira_config() { if (timer) delete timer; } -void kstyle_baghira_config::setPresetColor(int i) +void tdestyle_baghira_config::setPresetColor(int i) { dialog_->sliderButtonRed->setValue(presetColor[i][0]); dialog_->sliderButtonGreen->setValue(presetColor[i][1]); dialog_->sliderButtonBlue->setValue(presetColor[i][2]); } -void kstyle_baghira_config::load() +void tdestyle_baghira_config::load() { TQString tmpString = TQDir::homeDirPath() + "/.qt/baghirarc"; load (tmpString); } -void kstyle_baghira_config::load(TQString &fileName) +void tdestyle_baghira_config::load(TQString &fileName) { TDEConfig *config = new TDEConfig(fileName); // TQSettings config; @@ -508,7 +508,7 @@ void kstyle_baghira_config::load(TQString &fileName) dialog_->valueButtonRed->setNum(sliderButtonRedValue); dialog_->valueButtonGreen->setNum(sliderButtonGreenValue); dialog_->valueButtonBlue->setNum(sliderButtonBlueValue); - + // special Widgets //ListViews dialog_->useRectLVH->setChecked( config->readBoolEntry( "Special_UseFlatLVH", false)); @@ -535,7 +535,7 @@ void kstyle_baghira_config::load(TQString &fileName) //Tabs dialog_->aquaTabs->setCurrentItem(config->readNumEntry("Design_TabStyleAqua", 0 )); dialog_->brushedTabs->setCurrentItem(config->readNumEntry("Design_TabStyleBrushed", 1 )); - + // menus dialog_->menuBackground->setCurrentItem( config->readNumEntry( "Menu_Background", 0)); dialog_->menuOpacity->setValue( config->readNumEntry( "Menu_Opacity", 70)); @@ -575,7 +575,7 @@ void kstyle_baghira_config::load(TQString &fileName) dialog_->menuMaxWidth->setValue(config->readNumEntry("Width", TQDesktopWidget().availableGeometry().width())); config->setGroup("Sidebar"); delete config; - + config = new TDEConfig("kdeglobals"); config->setGroup( "Toolbar style" ); dialog_->toolbuttonHighColor->setColor(config->readColorEntry("HighlightColor", new TQColor(103,141,178)) ); @@ -583,7 +583,7 @@ void kstyle_baghira_config::load(TQString &fileName) } -void kstyle_baghira_config::defaults() +void tdestyle_baghira_config::defaults() { dialog_->defaultStyle->setCurrentItem(0); dialog_->buttonStyle->setCurrentItem(1); @@ -605,7 +605,7 @@ void kstyle_baghira_config::defaults() dialog_->valueButtonRed->setNum(sliderButtonRedValue); dialog_->valueButtonGreen->setNum(sliderButtonGreenValue); dialog_->valueButtonBlue->setNum(sliderButtonBlueValue); - + // special Widgets // dialog_->animateSlider; dialog_->shadowSlider->setChecked( false); @@ -625,7 +625,7 @@ void kstyle_baghira_config::defaults() dialog_->progressType->setCurrentItem( 0); dialog_->aquaTabs->setCurrentItem( 0 ); dialog_->brushedTabs->setCurrentItem(1); - + // menus // dialog_->transGroup; dialog_->menuBackground->setCurrentItem(0); @@ -640,7 +640,7 @@ void kstyle_baghira_config::defaults() dialog_->drawMenuStripe->setChecked(false); dialog_->glossyMenus->setChecked(true); dialog_->menuStripeColor->setColor( TQt::white.rgb()); - + // custom colors dialog_->useCustomColors->setChecked( false); dialog_->radioOffColor->setColor( colorGroup().background().rgb()); @@ -657,14 +657,14 @@ void kstyle_baghira_config::defaults() emit changed(true); } -void kstyle_baghira_config::save() +void tdestyle_baghira_config::save() { TQString tmpString = TQDir::homeDirPath() + "/.qt/baghirarc"; save(tmpString); // emit changed(true); } -void kstyle_baghira_config::changeTooluttonHighlightColor(const TQColor & color) +void tdestyle_baghira_config::changeTooluttonHighlightColor(const TQColor & color) { TDEConfig *config = new TDEConfig("kdeglobals"); config->setGroup( "Toolbar style" ); @@ -672,7 +672,7 @@ void kstyle_baghira_config::changeTooluttonHighlightColor(const TQColor & color) delete config; } -void kstyle_baghira_config::handleButtonStyles(int i) +void tdestyle_baghira_config::handleButtonStyles(int i) { if (i != 2 && sender() == dialog_->buttonStyle && dialog_->toolbuttonStyle->currentItem() != 2) dialog_->toolbuttonStyle->setCurrentItem(i); @@ -681,7 +681,7 @@ void kstyle_baghira_config::handleButtonStyles(int i) configChanged(); } -void kstyle_baghira_config::save(TQString &fileName) +void tdestyle_baghira_config::save(TQString &fileName) { // TQSettings *config = new TQSettings; TDEConfig *config = new TDEConfig(fileName); @@ -705,7 +705,7 @@ void kstyle_baghira_config::save(TQString &fileName) config->writeEntry("Design_CenterTabs", dialog_->centerTabs->isOn()); //button color stuff config->writeEntry("Design_ButtonColor", (int)(TQColor(sliderButtonRedValue, sliderButtonGreenValue, sliderButtonBlueValue).rgb())); - + // special Widgets //listviews // dialog_->animateSlider; @@ -733,7 +733,7 @@ void kstyle_baghira_config::save(TQString &fileName) if (dialog_->replaceMenubar->isOn()) { file.open(IO_WriteOnly); - const char *msg = + const char *msg = "[Desktop Entry]\n\ Hidden=true\n\ Type=Plugin\n\ @@ -774,7 +774,7 @@ X-TDE-UniqueApplet=true\n"; config->writeEntry("Menu_DrawMenuStripe", dialog_->drawMenuStripe->isOn()); config->writeEntry("Menu_Glossy", dialog_->glossyMenus->isOn()); config->writeEntry("Menu_StripeColor", (int)dialog_->menuStripeColor->color().rgb()); - + // custom colors config->writeEntry("Colors_UseCustomColors", dialog_->useCustomColors->isOn()); config->writeEntry("Colors_RadioOff", (int)dialog_->radioOffColor->color().rgb()); @@ -797,7 +797,7 @@ X-TDE-UniqueApplet=true\n"; } -void kstyle_baghira_config::configChanged() +void tdestyle_baghira_config::configChanged() { if (loadDone) { @@ -807,26 +807,26 @@ void kstyle_baghira_config::configChanged() } -TQString kstyle_baghira_config::quickHelp() const +TQString tdestyle_baghira_config::quickHelp() const { return i18n("Configure Your Cat"); } -void kstyle_baghira_config::setDesign(int d) +void tdestyle_baghira_config::setDesign(int d) { bool b = (d == 0); dialog_->stippleBackground->setEnabled(b); dialog_->stippleContrast->setEnabled(b); dialog_->shadowGroups->setEnabled(b); - dialog_->shadowIntensity->setEnabled(b); + dialog_->shadowIntensity->setEnabled(b); } -void kstyle_baghira_config::enableInButtonColor(int d) +void tdestyle_baghira_config::enableInButtonColor(int d) { dialog_->customInactiveColor->setEnabled(d == 3); } -void kstyle_baghira_config::enableMenuColorStuff(int d) +void tdestyle_baghira_config::enableMenuColorStuff(int d) { bool b = (d == 2); dialog_->menuTextColor->setEnabled(b); @@ -834,45 +834,45 @@ void kstyle_baghira_config::enableMenuColorStuff(int d) dialog_->menuColor2->setEnabled(b && dialog_->menuBackground->currentItem() > 1); } -void kstyle_baghira_config::buttonLoadAction() +void tdestyle_baghira_config::buttonLoadAction() { TQString tmpString = KFileDialog::getOpenFileName(TQDir::homeDirPath(), "*", this, "Select a Baghira config file"); if (!tmpString.isEmpty()) load(tmpString); } -void kstyle_baghira_config::buttonSaveAsAction() +void tdestyle_baghira_config::buttonSaveAsAction() { TQString tmpString = KFileDialog::getSaveFileName(TQDir::homeDirPath(), "*", this, "Save current Baghira configuration as"); save(tmpString); } -void kstyle_baghira_config::editApp() +void tdestyle_baghira_config::editApp() { emit editApp(applist->currentItem()->text(0), applist->currentItem()->text(1)); } -void kstyle_baghira_config::removeApp() +void tdestyle_baghira_config::removeApp() { TQString string = TQDir::homeDirPath() + "/.baghira/" + applist->currentItem()->text(0); TQFile::remove(string); applist->takeItem(applist->currentItem()); } -void kstyle_baghira_config::removeApp(TQString name) +void tdestyle_baghira_config::removeApp(TQString name) { TQString string = TQDir::homeDirPath() + "/.baghira/" + name; TQFile::remove(string); applist->takeItem(applist->findItem(name, 0, TQt::ExactMatch)); } -void kstyle_baghira_config::addApp(TQString string, TQString linkString) +void tdestyle_baghira_config::addApp(TQString string, TQString linkString) { applist->insertItem(new TDEListViewItem(applist, string, linkString)); applist->sort(); } -void kstyle_baghira_config::selectWindow() +void tdestyle_baghira_config::selectWindow() // taken from kcmkwin { // use a dialog, so that all user input is blocked @@ -888,7 +888,7 @@ void kstyle_baghira_config::selectWindow() Atom wm_state = XInternAtom( tqt_xdisplay(), "WM_STATE", False ); // Atom wm_state = XInternAtom( tqt_xdisplay(), "WM_COMMAND", False ); -bool kstyle_baghira_config::eventFilter( TQObject* o, TQEvent* e ) +bool tdestyle_baghira_config::eventFilter( TQObject* o, TQEvent* e ) // adapted from kcmkwin... again ;) { if( o != grabber ) @@ -912,7 +912,7 @@ bool kstyle_baghira_config::eventFilter( TQObject* o, TQEvent* e ) return true; } -WId kstyle_baghira_config::findWindow() +WId tdestyle_baghira_config::findWindow() // taken from kcmkwin... as well =) { Window root; @@ -946,7 +946,7 @@ WId kstyle_baghira_config::findWindow() } -void kstyle_baghira_config::menuToggled(bool active) +void tdestyle_baghira_config::menuToggled(bool active) { if (!active || !loadDone) return; @@ -965,30 +965,30 @@ void kstyle_baghira_config::menuToggled(bool active) ////////////////////////////////////////////////////////////////////////////// // Plugin Stuff // ////////////////////////////////////////////////////////////////////////////// - + extern "C" -{ - TQWidget* allocate_kstyle_config(TQWidget* parent){ - return(new kstyle_baghira_config(parent, "BaghiraConfig")); +{ + TQWidget* allocate_tdestyle_config(TQWidget* parent){ + return(new tdestyle_baghira_config(parent, "BaghiraConfig")); } } AppSetter::AppSetter(TQWidget *parent, const char *name) : TQWidget(parent, name, TQt::WType_Dialog | TQt::WShowModal ) { isEdit = FALSE; - + TQLabel *label1 = new TQLabel(i18n("<qt><b>Application Name</b></qt>"), this); command = new TQLineEdit(this); - + TQLabel *linkTo = new TQLabel(i18n("<qt><b>Just like</b></qt>"),this); link = new TQComboBox(this); - + box = new TQGroupBox(2,TQt::Horizontal,i18n("Custom Settings"),this); box->setCheckable( true ); - + new TQLabel(i18n("<qt><b>Style</b></qt>"), box); new TQLabel("<qt><b>Deco</b></qt>", box); - + style = new TQComboBox(box); style->insertItem(i18n("Don't set")); style->insertItem("Jaguar"); @@ -996,7 +996,7 @@ AppSetter::AppSetter(TQWidget *parent, const char *name) : TQWidget(parent, name style->insertItem("Brushed Metal"); style->insertItem("Tiger"); style->insertItem("Milk"); - + deco = new TQComboBox(box); deco->insertItem(i18n("Don't set")); deco->insertItem("Jaguar"); @@ -1004,49 +1004,49 @@ AppSetter::AppSetter(TQWidget *parent, const char *name) : TQWidget(parent, name deco->insertItem("Brushed Metal"); deco->insertItem("Tiger"); deco->insertItem("Milk"); - + new TQLabel(i18n("<qt><b>Buttons</b></qt>"), box); new TQLabel(i18n("<qt><b>Toolbuttons</b></qt>"), box); - + buttons = new TQComboBox(box); buttons->insertItem("Jaguar"); buttons->insertItem("Panther"); buttons->insertItem("iTunes"); buttons->insertItem("Tiger"); buttons->insertItem("Milk"); - - + + toolButtons = new TQComboBox(box); toolButtons->insertItem("Jaguar"); toolButtons->insertItem("Panther"); toolButtons->insertItem("iTunes"); toolButtons->insertItem("Tiger"); toolButtons->insertItem("Milk"); - + new TQLabel(i18n("<qt><b>Tab vs. Chooser</b></qt>"), box); new TQLabel(i18n("<qt>Inactive Button</qt>"), box); - + tabs = new TQComboBox(box); tabs->insertItem(i18n("Don't set")); tabs->insertItem("Tabs"); tabs->insertItem("Adaptive"); tabs->insertItem("Choosers"); - - + + inbutton = new TQComboBox(box); inbutton->insertItem("Fixed"); inbutton->insertItem("Background"); inbutton->insertItem("Active Button"); - + scanlines = new TQCheckBox("Show scanlines", box); - + TQWidget *dumb = new TQWidget(box); customColors = new TQCheckBox(dumb); buttonColors = new TQPushButton("Custom Colors", dumb); TQHBoxLayout *clh = new TQHBoxLayout(dumb); clh->addWidget(customColors); clh->addWidget(buttonColors); - + TQVBoxLayout *lv = new TQVBoxLayout(this,11,6); lv->addWidget(label1); lv->addWidget(command); @@ -1059,9 +1059,9 @@ AppSetter::AppSetter(TQWidget *parent, const char *name) : TQWidget(parent, name lh->addWidget(cancel); TQPushButton *ok = new TQPushButton("Ok",this); lh->addWidget(ok); - + colorDialog = new ColorDialog(this); - + connect(box, SIGNAL(toggled( bool )), link, SLOT(setDisabled(bool))); connect(box, SIGNAL(toggled( bool )), linkTo, SLOT(setDisabled(bool))); connect(style, SIGNAL(activated( int )), this, SLOT(handler(int))); @@ -1240,4 +1240,4 @@ void AppSetter::reset() box->setChecked ( false ); } -#include "kstyle_baghira_config.moc" +#include "tdestyle_baghira_config.moc" diff --git a/config/kstyle_baghira_config.h b/config/tdestyle_baghira_config.h index 8b5afe1..0fb6b93 100644 --- a/config/kstyle_baghira_config.h +++ b/config/tdestyle_baghira_config.h @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _KSTYLE_BAGHIRA_CONFIG_H_ -#define _KSTYLE_BAGHIRA_CONFIG_H_ +#ifndef _TDESTYLE_BAGHIRA_CONFIG_H_ +#define _TDESTYLE_BAGHIRA_CONFIG_H_ //#include <tdecmodule.h> #include <tqcolor.h> @@ -37,13 +37,13 @@ class TQCheckBox; class TQComboBox; class TQGroupBox; -class kstyle_baghira_config: public TQWidget +class tdestyle_baghira_config: public TQWidget { Q_OBJECT public: - kstyle_baghira_config( TQWidget *parent=0, const char *name=0, const TQStringList& = TQStringList() ); - ~kstyle_baghira_config(); + tdestyle_baghira_config( TQWidget *parent=0, const char *name=0, const TQStringList& = TQStringList() ); + ~tdestyle_baghira_config(); virtual void load(); void load(TQString &fileName); diff --git a/configure.in.in b/configure.in.in index 778345c..044b727 100644 --- a/configure.in.in +++ b/configure.in.in @@ -1,5 +1,6 @@ #MIN_CONFIG(3.0.0) KDE_USE_QT(3.3.0) +KDE_ENABLE_HIDDEN_VISIBILITY AM_INIT_AUTOMAKE(baghira, cvs) AC_C_BIGENDIAN diff --git a/kickermenu/configure.in.in b/kickermenu/configure.in.in index 29a7674..b3a79d3 100644 --- a/kickermenu/configure.in.in +++ b/kickermenu/configure.in.in @@ -1,2 +1,2 @@ -AM_CONDITIONAL( HAVE_3_4, test $(tde-config --version | grep "KDE:" | cut -d" " -f2 | cut -d"." -f2) -gt 3 ) +AM_CONDITIONAL( HAVE_3_4, test $($KDECONFIG --version | grep "TDE:" | cut -d" " -f2 | cut -d"." -f2) -gt 3 ) diff --git a/sidebar/configure.in.in b/sidebar/configure.in.in index 29a7674..b3a79d3 100644 --- a/sidebar/configure.in.in +++ b/sidebar/configure.in.in @@ -1,2 +1,2 @@ -AM_CONDITIONAL( HAVE_3_4, test $(tde-config --version | grep "KDE:" | cut -d" " -f2 | cut -d"." -f2) -gt 3 ) +AM_CONDITIONAL( HAVE_3_4, test $($KDECONFIG --version | grep "TDE:" | cut -d" " -f2 | cut -d"." -f2) -gt 3 ) diff --git a/style/Makefile.am b/style/Makefile.am index 12efbcb..c4e51de 100644 --- a/style/Makefile.am +++ b/style/Makefile.am @@ -7,7 +7,7 @@ kde_style_LTLIBRARIES = baghira.la baghira_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module baghira_la_LIBADD = $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx -lXtst baghira_la_SOURCES = baghira.cpp optionHandler.cpp polish.cpp utils.cpp -lnkdir = $(kde_datadir)/kstyle/themes +lnkdir = $(kde_datadir)/tdestyle/themes lnk_DATA = baghira.themerc EXTRA_DIST = $(lnk_DATA) pixmaps.h: $(srcdir)/generatePixmaps.sh diff --git a/style/baghira.cpp b/style/baghira.cpp index 09397ac..8434cf1 100644 --- a/style/baghira.cpp +++ b/style/baghira.cpp @@ -201,7 +201,7 @@ LiquidStyle::LiquidStyle() : TDEStyle( AllowMenuTransparency | FilledFrameWorkar // tabDict.setAutoDelete( true ); initialPaletteLoaded = false; qtrcModificationTime = 0; - + // animations kram! progAnimShift = 0; prog2AnimShift = 0; @@ -288,22 +288,22 @@ LiquidStyle::LiquidStyle() : TDEStyle( AllowMenuTransparency | FilledFrameWorkar default: break; } - + if ( btnBorderImg && btnBorderImg->depth() < 32 ) * btnBorderImg = btnBorderImg->convertDepth( 32 ); - + if ( btnShadowImg && btnShadowImg->depth() < 32 ) * btnShadowImg = btnShadowImg->convertDepth( 32 ); - + if ( buttonGlow && buttonGlow->depth() < 32 ) * buttonGlow = buttonGlow->convertDepth( 32 ); - + if ( combo && combo->depth() < 32 ) * combo = combo->convertDepth( 32 ); - + if ( comboShadow && comboShadow->depth() < 32 ) * comboShadow = comboShadow->convertDepth( 32 ); - + if ( rectbutton && rectbutton->depth() < 32 ) * rectbutton = rectbutton->convertDepth( 32 ); @@ -317,7 +317,7 @@ LiquidStyle::LiquidStyle() : TDEStyle( AllowMenuTransparency | FilledFrameWorkar slider_top = new TQImage( uic_findImage( "sbslider_top" ) ); slider_btm = new TQImage( uic_findImage( "sbslider_btm" ) ); } - + if ( slider_top->depth() < 32 ) * slider_top = slider_top->convertDepth( 32 ); @@ -329,7 +329,7 @@ LiquidStyle::LiquidStyle() : TDEStyle( AllowMenuTransparency | FilledFrameWorkar slider_top_shd = new TQImage( uic_findImage( "sbslider_top_shd" ) ); if ( slider_top_shd->depth() < 32 ) * slider_top_shd = slider_top_shd->convertDepth( 32 ); - + slider_btm_shd = new TQImage( uic_findImage( "sbslider_btm_shd" ) ); if ( slider_btm_shd->depth() < 32 ) * slider_btm_shd = slider_btm_shd->convertDepth( 32 ); @@ -343,7 +343,7 @@ LiquidStyle::LiquidStyle() : TDEStyle( AllowMenuTransparency | FilledFrameWorkar roundFrame = new TQImage( uic_findImage( "roundFrame" ) ); if ( roundFrame->depth() < 32 ) * roundFrame = roundFrame->convertDepth( 32 ); - + menuPix = NULL; tmpBtnPix = NULL; @@ -385,7 +385,7 @@ LiquidStyle::LiquidStyle() : TDEStyle( AllowMenuTransparency | FilledFrameWorkar p.drawLine( 0, i, 63, i ); } } - + if (optionHandler->style() == Brushed) { plainBrush = optionHandler->TintBrush() ? @@ -447,7 +447,7 @@ LiquidStyle::~LiquidStyle() { if (rectbutton) delete rectbutton; delete roundFrame; - + if ( tmpBtnPix ) delete tmpBtnPix; if ( menuPix ) @@ -462,7 +462,7 @@ LiquidStyle::~LiquidStyle() { delete groupShadow; } - + inline void LiquidStyle::updateProgressPos() { progAnimShift = (progAnimShift + 1) % 20; @@ -492,13 +492,18 @@ bool LiquidStyle::isPlain() const { } -void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, - const TQRect &r, const TQColorGroup &cg, - SFlags flags, const TQStyleOption &opt ) const +void LiquidStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption &opt ) const { bool down = flags & Style_Down; bool on = flags & Style_On; - + switch ( pe ) { case PE_TabBarBase: @@ -542,7 +547,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, p->drawPoint(right-1,y2+3); p->drawLine(x,y2+5,x,bottom); p->drawLine(right,y2+5,right,bottom); - + p->setPen( mid ); p->drawPoint(x+4, y2);p->drawPoint(x+5,y2); p->drawPoint(right-4, y2);p->drawPoint(right-5,y2); @@ -555,7 +560,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, p->drawPoint(right-2,y2+3); p->drawPoint(x,y2+4);p->drawPoint(x+1,y2+4); p->drawPoint(right,y2+4);p->drawPoint(right+1,y2+4); - + p->setPen(bright); p->drawPoint(x+3,y2);p->drawPoint(right-3,y2); p->drawLine(x+4,y2+2,right-4,y2+2); @@ -718,7 +723,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, bool isHover = currentScrollBar->hasMouse(); bool isPressed = currentScrollBar->draggingSlider(); bool drawSlider = currentScrollBar->minValue() < currentScrollBar->maxValue(); - + // horizontal slider if ( flags & Style_Horizontal ) { @@ -737,7 +742,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, } else painter.drawTiledPixmap( bgR.x(), bgR.y() + 1, bgR.width(), 13, *getPixmap( HSBSliderMidBg ) ); - + // lines painter.setPen( sbBgColor.dark( 110 ) ); painter.drawLine( bgR.x(), bgR.y(), bgR.right(), bgR.y()); @@ -773,7 +778,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, { int extent = currentScrollBar->width(); TQRect bgR( 0, extent, extent, currentScrollBar->height() - extent * 3 + 1 ); - + if ( sbBuffer.size() != currentScrollBar->size() ) const_cast<LiquidStyle*>( this ) -> sbBuffer.resize( currentScrollBar->size() ); TQPainter painter; @@ -789,17 +794,17 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, } else painter.drawTiledPixmap( bgR.x() + 1, bgR.y(), 13, bgR.height(), *getPixmap( VSBSliderMidBg ) ); - + painter.setPen( sbBgColor.dark( 110 ) ); painter.drawLine( bgR.x(), bgR.y(), bgR.x(), bgR.bottom() ); painter.drawLine( bgR.right(), bgR.y(), bgR.right(), bgR.bottom() ); - + // here we are, now the slider if ( pe == PE_ScrollBarSlider && drawSlider ) { int offset = isPressed * ( optionHandler->squeezeSbSlider() + optionHandler->shadowSbSlider()*2); int offset2 = (isPressed * optionHandler->squeezeSbSlider()) + optionHandler->shadowSbSlider()*2; - + painter.drawPixmap( r.x() + 1, r.y() + offset, isPressed ? *getPixmap( VSBSliderTopPressed ) : (isHover || isActive || isOOO) ? *getPixmap( VSBSliderTopActive ) : @@ -827,9 +832,9 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, optionHandler->customColor( CustomSBGroove ) : tqApp->palette().active().background() ); TQColor pixColor = flags & Style_Down ? tqApp->palette().active().button() : c; - - bool drawSlider = currentScrollBar->minValue() < currentScrollBar->maxValue(); - + + bool drawSlider = currentScrollBar->minValue() < currentScrollBar->maxValue(); + if ( flags & Style_Horizontal ) { p->drawTiledPixmap( r.x(), r.y() + 1, r.width(), 13, *getPixmap(drawSlider ? HSBSliderMidBgI : HSBSliderMidBg)); @@ -862,7 +867,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, bool drawSlider = currentScrollBar->minValue() < currentScrollBar->maxValue(); - if ( flags & Style_Horizontal ) + if ( flags & Style_Horizontal ) { if ( top ) { @@ -1021,7 +1026,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, TQWidget* w = (p->device() && p->device()->devType() == TQInternal::Widget) ? (TQWidget*)(p->device()) : 0; TQGroupBox* gb = ::tqt_cast<TQGroupBox*>(w); - + optionHandler->drawGroupBoxShadow() ? bgColor = TQColor(cg.background().dark( 100 + optionHandler->ShadowDarkness() )) : bgColor = TQColor(cg.background()); @@ -1049,7 +1054,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, if (gb->parentWidget()) { const TQPixmap *pix = gb->parentWidget()->paletteBackgroundPixmap(); - + if (optionHandler->drawGroupBoxShadow()) { TQPointArray pa1(3); @@ -1068,7 +1073,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, pa4.setPoint(0, x+5,bottom); pa4.setPoint(1, x,bottom); pa4.setPoint(2, x,bottom-5); - + TQRegion reg2(0,0, r.right(), titleHeight); p->setClipRegion(TQRegion(pa1)+TQRegion(pa2)+TQRegion(pa3)+TQRegion(pa4)+reg2); } @@ -1087,7 +1092,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, p->setClipRegion(oldClip); p->setClipping(hadClip); } - + //outer rect // top p->setPen( dark ); @@ -1112,7 +1117,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, p->drawLine(x,y2,x,bottom-5); p->drawLine(right,y2,right,bottom-5); } - + p->setPen( mid ); if (pe == PE_PanelGroupBox) { @@ -1139,7 +1144,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, p->drawPoint(x+2, bottom - 1); p->drawPoint(x+3, bottom - 1); p->drawPoint(right-2, bottom - 1); p->drawPoint(right-3, bottom - 1); p->drawLine(x + 4, bottom,right - 4, bottom); - + p->setPen(bright); // top stuff if (pe == PE_PanelGroupBox) @@ -1187,7 +1192,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, bool isDialog = optionHandler->TabStyle() == Clever && (p->device() && p->device()->devType() == TQInternal::Widget)&& ((TQWidget*)p->device())->topLevelWidget()->inherits("TQDialog"); - + TQColor bright( cg.background().dark( 110 ) ); TQColor mid( cg.background().dark( 130 ) ); TQColor dark( cg.background().dark( 150 ) ); @@ -1200,7 +1205,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, // vertcal outer lines p->drawLine(x,y2,x,bottom-5); p->drawLine(right,y2,right,bottom-5); - + p->setPen( mid ); // bottom stuff p->drawPoint(x,bottom - 4); p->drawPoint(x+1,bottom - 4); @@ -1212,13 +1217,13 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, p->drawPoint(x+2, bottom - 1); p->drawPoint(x+3, bottom - 1); p->drawPoint(right-2, bottom - 1); p->drawPoint(right-3, bottom - 1); p->drawLine(x + 4, bottom,right - 4, bottom); - + p->setPen(bright); // top stuff // vertical lines p->drawLine(x+1,y2,x+1,bottom-5); p->drawLine(right-1,y2,right-1,bottom-5); - + // bottom stuff p->drawPoint(x, bottom-3);p->drawPoint(right, bottom-3); p->drawPoint(x+3, bottom);p->drawPoint(right-3, bottom); @@ -1271,7 +1276,7 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, break; //don't draw anything if (!(p->device() && p->device()->devType() == TQInternal::Widget && ::tqt_cast<TQToolBar*>((TQWidget*)p->device()))) { - if ( !( flags & Style_Horizontal ) ) + if ( !( flags & Style_Horizontal ) ) { p->setPen( cg.mid() ); p->drawLine( 4, r.height() / 2, r.width() - 5, r.height() / 2 ); @@ -1357,15 +1362,20 @@ void LiquidStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, p->setBrush( oldBrush ); } else - TDEStyle::drawPrimitive( pe, p, r, cg, flags, opt ); + TDEStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); } } // general switch } -void LiquidStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, TQPainter* p, - const TQWidget* widget, const TQRect &r, - const TQColorGroup &cg, SFlags flags, - const TQStyleOption &opt ) const +void LiquidStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption &opt, + const TQWidget* widget ) const { switch ( kpe ) { @@ -1432,7 +1442,7 @@ void LiquidStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, TQPainter* p, int x, y, w, h; r.rect( &x, &y, &w, &h ); if (qstrcmp( tqApp->argv() [ 0 ], "kmix" ) == 0) x = x+3; - if ( ( ( const TQSlider * ) widget ) ->orientation() == TQt::Horizontal ) + if ( ceData.orientation == TQt::Horizontal ) { int x2 = x + w - 1; y = y + ( h - 5 ) / 2; @@ -1471,7 +1481,7 @@ void LiquidStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, TQPainter* p, p->drawPixmap( r.x(), r.y(), *getPixmap( flags & Style_Enabled ? RadioOffHover : RadioOff)); break; } - if ((( const TQSlider * ) widget ) ->orientation() == TQt::Horizontal) + if ( ceData.orientation == TQt::Horizontal ) (widget && widget->height() < 17) ? p->drawPixmap( r.x(), r.y(), *getPixmap( flags & Style_Enabled ? RadioOffHover : RadioOff)) : p->drawPixmap( r.x(), (optionHandler->style() == Milk) ? r.y() : r.y()+2, *getPixmap( flags & Style_Enabled ? HSlider : HSliderInactive)); else { @@ -1486,13 +1496,13 @@ void LiquidStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, TQPainter* p, // int radius = ( r.width() - 4 ) / 2; // int centerx = r.x() + r.width() / 2; // int centery = r.y() + r.height() / 2; - // + // // int red, green, blue; // red = ( cg.dark().red() >> 1 ) + ( cg.base().red() >> 1 ); // green = ( cg.dark().green() >> 1 ) + ( cg.base().green() >> 1 ); // blue = ( cg.dark().blue() >> 1 ) + ( cg.base().blue() >> 1 ); // TQColor blendColor( red, green, blue ); - // + // // p->setPen( cg.dark() ); // p->drawLine( r.x() + 1, r.y(), r.right() - 1, r.y() ); // p->drawLine( r.x() + 1, r.bottom(), r.right() - 1, r.bottom() ); @@ -1514,14 +1524,19 @@ void LiquidStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, TQPainter* p, break; } default: - TDEStyle::drawTDEStylePrimitive( kpe, p, widget, r, cg, flags, opt ); + TDEStyle::drawTDEStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget ); } } -void LiquidStyle::drawControl( ControlElement element, TQPainter *p, - const TQWidget *widget, const TQRect &r, - const TQColorGroup &cg, SFlags flags, - const TQStyleOption &opt ) const +void LiquidStyle::drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption &opt, + const TQWidget *widget ) const { switch ( element ) { @@ -1536,7 +1551,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, { // tqWarning("%s - %s,%s : %s,%s",tqApp->argv()[0],widget->className(),widget->name(),widget->parentWidget()->className(),widget->parentWidget()->name()); const TQProgressBar *progress = ( const TQProgressBar * ) widget; - TQRect contentsR( subRect( SR_ProgressBarContents, widget ) ); + TQRect contentsR( subRect( SR_ProgressBarContents, ceData, elementFlags, widget ) ); double val = progress->progress(); bool reverse = TQApplication::reverseLayout(); val = val / progress->totalSteps(); @@ -1614,14 +1629,14 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, TQRect rect = r; TQt::ArrowType arrowType = opt.isDefault() ? TQt::DownArrow : opt.arrowType(); - + int shiftX = 0; int shiftY = 0; if (flags & (Style_Down | Style_On)) { - shiftX = pixelMetric(PM_ButtonShiftHorizontal, widget); - shiftY = pixelMetric(PM_ButtonShiftVertical, widget); + shiftX = pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget); + shiftY = pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget); } - + if (!opt.isDefault()) { PrimitiveElement pe; @@ -1633,21 +1648,21 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, default: case TQt::DownArrow: pe = PE_ArrowDown; break; } - + rect.moveBy(shiftX, shiftY); - drawPrimitive(pe, p, rect, cg, flags, opt); + drawPrimitive(pe, p, ceData, elementFlags, rect, cg, flags, opt); } else { TQColor btext = TQt::black;//(flags & (Style_Down | Style_On)) ? tqApp->palette().color(TQPalette::Active,TQColorGroup::ButtonText) : toolbutton->paletteForegroundColor(); - + if (toolbutton->iconSet().isNull() && ! toolbutton->text().isNull() && ! toolbutton->usesTextLabel()) { int alignment = AlignCenter | ShowPrefix; - if (!styleHint(SH_UnderlineAccelerator, widget, TQStyleOption::Default, 0)) + if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) alignment |= NoAccel; - + rect.moveBy(shiftX, shiftY); drawItem(p, rect, alignment, cg, flags & Style_Enabled, 0, toolbutton->text(), @@ -1667,15 +1682,15 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, else mode = TQIconSet::Normal; pm = toolbutton->iconSet().pixmap( size, mode, state ); - + if ( toolbutton->usesTextLabel() ) { p->setFont( toolbutton->font() ); TQRect pr = rect, tr = rect; int alignment = ShowPrefix; - if (!styleHint(SH_UnderlineAccelerator, widget, TQStyleOption::Default, 0)) + if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) alignment |= NoAccel; - + if ( toolbutton->textPosition() == TQToolButton::Under ) { int fh = p->fontMetrics().height(); @@ -1690,11 +1705,11 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, pr.setWidth( pm.width() + 8 ); tr.addCoords( pr.right(), 0, 0, 0 ); pr.moveBy(shiftX, shiftY); - + drawItem( p, pr, AlignCenter, cg, TRUE, &pm, TQString::null ); alignment |= AlignLeft | AlignVCenter; } - + tr.moveBy(shiftX, shiftY); drawItem( p, tr, alignment, cg, flags & Style_Enabled, 0, toolbutton->textLabel(), @@ -1707,7 +1722,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, } } } - + break; }*/ @@ -1717,7 +1732,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, TQRect rect = r; const TQHeader* header = (const TQHeader *) widget; int section = opt.headerSection(); - + TQIconSet* icon = header->iconSet( section ); if ( icon ) { TQPixmap pixmap = icon->pixmap( TQIconSet::Small, @@ -1726,7 +1741,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, int pixw = pixmap.width(); int pixh = pixmap.height(); // "pixh - 1" because of tricky integer division - + TQRect pixRect = rect; pixRect.setY( rect.center().y() - (pixh - 1) / 2 ); drawItem ( p, pixRect, AlignVCenter, cg, flags & Style_Enabled, @@ -1741,7 +1756,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, { if (optionHandler->DrawProgressLabel()) { - TQRect contentsR( subRect( SR_ProgressBarContents, widget ) ); + TQRect contentsR( subRect( SR_ProgressBarContents, ceData, elementFlags, widget ) ); if ( !contentsR.isValid() ) return ; TQFont font( p->font() ); @@ -1768,7 +1783,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, pos = left; else if (tabBar->indexOf(opt.tab()->identifier()) == tabBar->count() - 1) pos = right; - else + else pos = center; TQColor c; @@ -1881,7 +1896,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, if ( !isPlain() && !btn->autoMask() ) const_cast<LiquidStyle*>( this ) ->btnOffset = btn->backgroundOffset(); const_cast<LiquidStyle*>( this ) ->paintWidget = const_cast<TQWidget*>( widget ); - drawPrimitive( PE_ButtonDefault, p, r, cg, flags, TQStyleOption( btn )); + drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags, TQStyleOption( btn )); const_cast<LiquidStyle*>( this ) ->paintWidget = 0L; const_cast<LiquidStyle*>( this ) ->isHTMLButton = false; break; @@ -1918,7 +1933,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, if ( btn->isMenuButton() ) { - drawPrimitive( PE_ArrowDown, p, TQRect( w-14, (int)(h/2), 7, 7 ) , cg, flags, opt ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect( w-14, (int)(h/2), 7, 7 ) , cg, flags, opt ); w -= 14; } TQColor tmp; @@ -2041,7 +2056,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, cflags |= Style_Enabled; if ( act ) cflags |= Style_On; - drawPrimitive( PE_CheckMark, p, visualRect( TQRect( xp, y + windowsItemFrame, checkcol - 2 * windowsItemFrame, h - 2 * windowsItemFrame ), r ), cg, cflags ); + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, visualRect( TQRect( xp, y + windowsItemFrame, checkcol - 2 * windowsItemFrame, h - 2 * windowsItemFrame ), r ), cg, cflags ); } } TQColor discol; @@ -2136,14 +2151,14 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, if ( !dis ) discol = cg.highlightedText(); TQColorGroup g2( discol, cg.highlight(), white, white, dis ? discol : white, discol, white ); - drawPrimitive( arrow, p, vrect, g2, Style_Enabled ); + drawPrimitive( arrow, p, ceData, elementFlags, vrect, g2, Style_Enabled ); } else { if ( !dis ) discol = optionHandler->textColor(); TQColorGroup g2( discol, cg.background(), white, white, dis ? discol : white, discol, white ); - drawPrimitive( arrow, p, vrect, g2, mi->isEnabled() ? Style_Enabled : Style_Default ); + drawPrimitive( arrow, p, ceData, elementFlags, vrect, g2, mi->isEnabled() ? Style_Enabled : Style_Default ); } } break; @@ -2154,7 +2169,7 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, break; }*/ default: - TDEStyle::drawControl( element, p, widget, r, cg, flags, opt ); + TDEStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); } } @@ -2182,7 +2197,17 @@ void LiquidStyle::drawControl( ControlElement element, TQPainter *p, // // } // } -void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags flags, SCFlags controls, SCFlags active, const TQStyleOption &opt ) const +void LiquidStyle::drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + SCFlags controls, + SCFlags active, + const TQStyleOption &opt, + const TQWidget *widget ) const { switch ( control ) { @@ -2249,8 +2274,8 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons const_cast<LiquidStyle*>( this ) ->paintWidget = const_cast<TQWidget*>( widget ); const KAccessToolBarButton *toolbutton2 = 0L; TQRect button, menuarea; - button = querySubControlMetrics( control, widget, SC_ToolButton, opt ); - menuarea = querySubControlMetrics( control, widget, SC_ToolButtonMenu, opt ); + button = querySubControlMetrics( control, ceData, elementFlags, SC_ToolButton, opt, widget ); + menuarea = querySubControlMetrics( control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget ); if (::tqt_cast<TDEToolBarButton*>(toolbutton)) { toolbutton2 = (const KAccessToolBarButton*)toolbutton; @@ -2396,15 +2421,15 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons if ( controls & SC_ToolButtonMenu ) { if ( mflags & ( Style_Down | Style_On | Style_Raised ) ) - drawPrimitive( PE_ButtonDropDown, p, menuarea, cg, mflags, opt ); - drawPrimitive( PE_ArrowDown, p, menuarea, cg, mflags, opt ); + drawPrimitive( PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt ); } #if 0 if ( toolbutton->hasFocus() && !toolbutton->focusProxy() ) { TQRect fr = toolbutton->rect(); fr.addCoords( 3, 3, -3, -3 ); - drawPrimitive( PE_FocusRect, p, fr, cg ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg ); } #endif const_cast<LiquidStyle*>( this ) ->paintWidget = 0L; @@ -2413,7 +2438,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons case CC_ScrollBar: { const_cast<LiquidStyle*>( this ) ->currentScrollBar = ( TQScrollBar * ) widget; - TDEStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt ); + TDEStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget ); break; } case CC_SpinWidget: { @@ -2436,7 +2461,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons TQRect re = sw->upRect(); TQColorGroup ucg = sw->isUpEnabled() ? cg : sw->palette().disabled(); p->fillRect(re, ucg.base()); - drawPrimitive(pe, p, re, ucg, flags); + drawPrimitive(pe, p, ceData, elementFlags, re, ucg, flags); } if ( controls & SC_SpinWidgetDown ) { @@ -2451,7 +2476,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons TQRect re = sw->downRect(); TQColorGroup dcg = sw->isDownEnabled() ? cg : sw->palette().disabled(); p->fillRect(re, dcg.base()); - drawPrimitive(pe, p, re, dcg, flags); + drawPrimitive(pe, p, ceData, elementFlags, re, dcg, flags); } break; } @@ -2459,8 +2484,8 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons // ------------------------------------------------------------------- case CC_Slider: { const TQSlider* slider = (const TQSlider*)widget; - TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, opt); - TQRect handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, opt); + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, opt, widget); + TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, opt, widget); // Double-buffer slider for no flicker TQPixmap pix(widget->size()); @@ -2511,23 +2536,23 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons // Draw slider groove if ((controls & SC_SliderGroove) && groove.isValid()) { - drawTDEStylePrimitive( KPE_SliderGroove, &p2, widget, groove, cg, flags, opt ); + drawTDEStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, flags, opt, widget ); // Draw the focus rect around the groove /* if (slider->hasFocus()) - drawPrimitive(PE_FocusRect, &p2, groove, cg);*/ + drawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg);*/ } // Draw the tickmarks if (controls & SC_SliderTickmarks) - TQCommonStyle::drawComplexControl(control, &p2, widget, - r, cg, flags, SC_SliderTickmarks, active, opt); + TQCommonStyle::drawComplexControl(control, &p2, ceData, elementFlags, + r, cg, flags, SC_SliderTickmarks, active, opt, widget); // Draw the slider handle if ((controls & SC_SliderHandle) && handle.isValid()) { if (active == SC_SliderHandle) flags |= Style_Active; - drawTDEStylePrimitive( KPE_SliderHandle, &p2, widget, handle, cg, flags, opt ); + drawTDEStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, flags, opt, widget ); } p2.end(); @@ -2538,7 +2563,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons #ifndef QT_NO_LISTVIEW case CC_ListView: { if ( controls & SC_ListView ) { - TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt ); + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget ); } if ( controls & ( SC_ListViewBranch | SC_ListViewExpand ) ) { if ( opt.isDefault() ) @@ -2761,7 +2786,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons } if ( controls & SC_TitleBarLabel ) { - TQRect ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarLabel ), widget ); + TQRect ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarLabel, TQStyleOption::Default, widget ), widget ); p->setPen( cg.text() ); p->drawText(ir.x()+2, ir.y(), ir.width()-2, ir.height(), AlignCenter | AlignVCenter | SingleLine, widget->caption() ); } @@ -2772,7 +2797,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons if ( controls & SC_TitleBarCloseButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarCloseButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarCloseButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarCloseButton; if (optionHandler->buttonStyle() == Brushed) drawRectangularButton( p, cg, down ? optionHandler->titleButtonColor(0).dark(120) : optionHandler->titleButtonColor(0), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); @@ -2781,7 +2806,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons } if ( controls & SC_TitleBarSysMenu ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarSysMenu ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarSysMenu, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarSysMenu; if (optionHandler->buttonStyle() == Brushed) drawRectangularButton( p, cg, down ? cg.button().dark(120) : cg.button(), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); @@ -2791,7 +2816,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons if ( controls & SC_TitleBarMaxButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarMaxButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarMaxButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarMaxButton; if (optionHandler->buttonStyle() == Brushed) drawRectangularButton( p, cg, down ? optionHandler->titleButtonColor(2).dark(120) : optionHandler->titleButtonColor(2), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); @@ -2801,7 +2826,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons if ( controls & SC_TitleBarMinButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarMinButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarMinButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarMinButton; if (optionHandler->buttonStyle() == Brushed) drawRectangularButton( p, cg, down ? optionHandler->titleButtonColor(1).dark(120) : optionHandler->titleButtonColor(1), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); @@ -2810,7 +2835,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons } if ( controls & SC_TitleBarNormalButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarNormalButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarNormalButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarNormalButton; if (optionHandler->buttonStyle() == Brushed) drawRectangularButton( p, cg, down ? optionHandler->titleButtonColor(1).dark(120) : optionHandler->titleButtonColor(1), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); @@ -2820,7 +2845,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons if ( controls & SC_TitleBarShadeButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarShadeButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarShadeButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarShadeButton; if (optionHandler->buttonStyle() == Brushed) drawRectangularButton( p, cg, down ? cg.button().dark(120) : cg.button(), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); @@ -2830,7 +2855,7 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons if ( controls & SC_TitleBarUnshadeButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarUnshadeButton ), widget ); + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarUnshadeButton, TQStyleOption::Default, widget ), widget ); down = active & SC_TitleBarUnshadeButton; if (optionHandler->buttonStyle() == Brushed) drawRectangularButton( p, cg, down ? cg.button().dark(120) : cg.button(), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); @@ -2842,13 +2867,18 @@ void LiquidStyle::drawComplexControl( ComplexControl control, TQPainter *p, cons #endif //QT_NO_TITLEBAR default: - TDEStyle::drawComplexControl( control, p, widget, - r, cg, flags, controls, active, opt ); + TDEStyle::drawComplexControl( control, p, ceData, elementFlags, + r, cg, flags, controls, active, opt, widget ); break; } } -int LiquidStyle::styleHint(StyleHint sh, const TQWidget * w, const TQStyleOption & opt, TQStyleHintReturn * shr) const +int LiquidStyle::styleHint(StyleHint sh, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption & opt, + TQStyleHintReturn * shr, + const TQWidget * w) const { switch (sh) { @@ -2860,20 +2890,26 @@ int LiquidStyle::styleHint(StyleHint sh, const TQWidget * w, const TQStyleOption if (optionHandler->CenterTabs() && !TQApplication::reverseLayout()) return AlignHCenter; else - return TDEStyle::styleHint(sh, w, opt, shr); + return TDEStyle::styleHint(sh, ceData, elementFlags, opt, shr, w); default: - return TDEStyle::styleHint(sh, w, opt, shr); + return TDEStyle::styleHint(sh, ceData, elementFlags, opt, shr, w); } } -TQRect LiquidStyle::subRect( SubRect r, const TQWidget *widget ) const { +TQRect LiquidStyle::subRect( SubRect r, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget ) const { if (r == SR_ComboBoxFocusRect){ - return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); + return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget ); } - return ( TDEStyle::subRect( r, widget ) ); + return ( TDEStyle::subRect( r, ceData, elementFlags, widget ) ); } -int LiquidStyle::pixelMetric( PixelMetric m, const TQWidget *widget ) const +int LiquidStyle::pixelMetric( PixelMetric m, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget ) const { switch ( m ) { @@ -2905,7 +2941,7 @@ int LiquidStyle::pixelMetric( PixelMetric m, const TQWidget *widget ) const return 0; case PM_DefaultFrameWidth: { - /* + /* if (widget && ::tqt_cast<TQFrame*>(widget) && ((TQFrame*)widget)->frameShape() == TQFrame::LineEditPanel) return 6;*/ if (widget && widget->parentWidget() && ::tqt_cast<TQTabWidget*>(widget->parentWidget()) && widget->parentWidget()->parentWidget() && (widget->parentWidget()->parentWidget()->inherits("KonqMainWindow") || widget->parentWidget()->parentWidget()->inherits("KonqFrameContainer"))) //for the konqueror statusbar offset, thanks konqueror team... ... ... f***f***f***!!! @@ -2955,14 +2991,16 @@ int LiquidStyle::pixelMetric( PixelMetric m, const TQWidget *widget ) const case PM_ButtonShiftVertical: return 0; default: - return TDEStyle::pixelMetric( m, widget ); + return TDEStyle::pixelMetric( m, ceData, elementFlags, widget ); } } TQSize LiquidStyle::sizeFromContents( ContentsType contents, - const TQWidget *widget, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQSize &contentSize, - const TQStyleOption& opt ) const { + const TQStyleOption& opt, + const TQWidget *widget ) const { switch ( contents ) { case CT_PushButton: { // this is a little funky - we give values not based on pixelMetric @@ -2974,7 +3012,7 @@ TQSize LiquidStyle::sizeFromContents( ContentsType contents, int h = contentSize.height() > 24 ? contentSize.height() : 25; if ( button->text().isEmpty() ) - return ( TQSize( contentSize.width() + 2 * pixelMetric( PM_ButtonMargin, widget ), h ) ); + return ( TQSize( contentSize.width() + 2 * pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ), h ) ); return ( TQSize( w, h ) ); } @@ -3000,7 +3038,7 @@ TQSize LiquidStyle::sizeFromContents( ContentsType contents, } case CT_ComboBox: { - // TQSize sz = TDEStyle::sizeFromContents( contents, widget, contentSize, opt ); + // TQSize sz = TDEStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget ); // return ( TQSize( sz.width()+3, sz.height() > 25 ? sz.height() : 25 ) ); if ( ::tqt_cast<const TQComboBox *>(widget) && ((const TQComboBox *)widget)->editable()) return ( TQSize( contentSize.width()+27, contentSize.height() + 4 > 22 ? contentSize.height() + 4 : 26 ) ); @@ -3054,19 +3092,26 @@ TQSize LiquidStyle::sizeFromContents( ContentsType contents, default: break; } - return TDEStyle::sizeFromContents( contents, widget, contentSize, opt ); + return TDEStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget ); } TQPixmap LiquidStyle::stylePixmap( StylePixmap stylepixmap, - const TQWidget* widget, - const TQStyleOption& opt ) const { - return TDEStyle::stylePixmap( stylepixmap, widget, opt ); + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& opt, + const TQWidget* widget ) const { + return TDEStyle::stylePixmap( stylepixmap, ceData, elementFlags, opt, widget ); } #include "eventfilter.cpp" -TQRect LiquidStyle::querySubControlMetrics( ComplexControl control, const TQWidget *widget, SubControl subcontrol, const TQStyleOption &opt ) const +TQRect LiquidStyle::querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl subcontrol, + const TQStyleOption &opt, + const TQWidget *widget ) const { if ( control == CC_ComboBox && subcontrol == SC_ComboBoxEditField ) return TQRect( 8, 3, widget->width() - 32, widget->height() - 7 ); @@ -3091,11 +3136,11 @@ TQRect LiquidStyle::querySubControlMetrics( ComplexControl control, const TQWidg case SC_TitleBarUnshadeButton: return TQRect( widget->width() - 29, 1, 24, 16 ); default: - return ( TDEStyle::querySubControlMetrics( control, widget, subcontrol, opt ) ); + return ( TDEStyle::querySubControlMetrics( control, ceData, elementFlags, subcontrol, opt, widget ) ); } } else - return ( TDEStyle::querySubControlMetrics( control, widget, subcontrol, opt ) ); + return ( TDEStyle::querySubControlMetrics( control, ceData, elementFlags, subcontrol, opt, widget ) ); } TQImage LiquidStyle::fetchImage( const char *name ){ @@ -3347,7 +3392,7 @@ TQPixmap* LiquidStyle::getPixmap( BitmapData item ) const case progress2: ptr->pixmaps[ progress2 ] = processEmbedded( "progress2", btnColor ); break; - + case TitleBar: { if (optionHandler->style() == Jaguar) diff --git a/style/baghira.h b/style/baghira.h index 340738a..e0ee8a5 100644 --- a/style/baghira.h +++ b/style/baghira.h @@ -107,7 +107,7 @@ public: const TQColor& bgColor(); const TQColor& buttonColor(); static int custCols[8]; - + inline void reset() { menusProcessed = false; @@ -154,7 +154,7 @@ public: { return ( contrast ); } - inline static bool useReverseBtnColor() + inline static bool useReverseBtnColor() { return ( reverseBtnColor ); } @@ -256,7 +256,7 @@ public: { return smootherLVH; } - + inline static bool IcyButtons() { return icyButtons; @@ -319,27 +319,27 @@ public: { return color2; } - + inline static bool DrawProgressLabel() { return drawProgressLabel; } - + inline static tabStyle TabStyle() { return tabStyle_; } - + inline static TQColor & BrushTint() { return brushTint; } - + inline static bool TintBrush() { return tintBrush; } - + inline static bool AnimateSlider() { return animateSlider; @@ -352,12 +352,12 @@ public: { return customButtonColor; } - + inline static bool AnimateButton() { return animateButton; } - + inline static TQColor aDecoColor1() { return aDecoColor1_; @@ -374,7 +374,7 @@ public: { return titleButtonColor_[i]; } - + TQMenuBar *currentMenu; TQPixmap *indicatedMenuItemPix; TQRect *indicatedMenuItemRect; @@ -384,13 +384,13 @@ public: WId lastIndicatedMenuItemID; static unsigned long wmDesign; - + public slots: inline void warningSlot() { tqWarning("widget destroyed"); } - + protected: static TQColor titleColor_[2]; static TQColor titleButtonColor_[3]; @@ -449,7 +449,7 @@ protected: static Style _toolbuttonStyle; static bool drawProgressLabel; static tabStyle tabStyle_; - + TQString colorStr, fgColorStr/*, panelColorStr*/; static TQColor brushTint; static TQColor aDecoColor1_; @@ -458,7 +458,7 @@ protected: static bool animateSlider; static bool animateProgress; }; - + class EventKiller : public TQObject { Q_OBJECT @@ -468,7 +468,7 @@ public: return TRUE; } }; - + class BMShower : public TQObject { Q_OBJECT @@ -476,8 +476,8 @@ public: BMShower(TQObject *parent); bool eventFilter( TQObject *object, TQEvent *event ); }; - -class ButtonFadeInfo + +class ButtonFadeInfo { public: ButtonFadeInfo() @@ -498,42 +498,100 @@ public: LiquidStyle(); virtual ~LiquidStyle(); bool isPlain() const; - - virtual void polish( TQWidget *w ); -// virtual void polishPopupMenu( TQPopupMenu *w ); - virtual void unPolish( TQWidget *w ); + + virtual void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); +// virtual void polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, TQPopupMenu *w ); + virtual void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); virtual void polish( TQPalette &p ); - virtual void unPolish( TQApplication *a ); - int styleHint(StyleHint sh, const TQWidget * w, const TQStyleOption & opt, TQStyleHintReturn * shr) const; - void drawTDEStylePrimitive( TDEStylePrimitive kpe, TQPainter* p, const TQWidget* widget, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, const TQStyleOption& = TQStyleOption::Default ) const; - void drawPrimitive( PrimitiveElement pe, TQPainter* p, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, const TQStyleOption& = TQStyleOption::Default ) const; - void drawControl( ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, const TQStyleOption& = TQStyleOption::Default ) const; -// void drawControlMask( ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQStyleOption& = TQStyleOption::Default ) const; - void drawComplexControl( ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, const TQStyleOption& = TQStyleOption::Default ) const; -// void drawComplexControlMask( ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQStyleOption& = TQStyleOption::Default ) const; - - int pixelMetric( PixelMetric m, const TQWidget *widget = 0 ) const; - - TQSize sizeFromContents( ContentsType contents, const TQWidget *widget, const TQSize &contentSize, const TQStyleOption& opt ) const; - TQRect subRect( SubRect r, const TQWidget *widget ) const; - TQRect querySubControlMetrics( ComplexControl control, const TQWidget *widget, SubControl subcontrol, const TQStyleOption &opt = TQStyleOption::Default ) const; + virtual void applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + int styleHint(StyleHint, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption & opt, + TQStyleHintReturn * shr, + const TQWidget * = 0) const; + void drawTDEStylePrimitive( TDEStylePrimitive kpe, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; + void drawPrimitive( PrimitiveElement pe, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default ) const; + void drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; +// void drawControlMask( ControlElement element, TQPainter *p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQStyleOption& = TQStyleOption::Default, const TQWidget *widget = 0 ) const; + void drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + SCFlags controls = SC_All, + SCFlags active = SC_None, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; +// void drawComplexControlMask( ComplexControl control, TQPainter *p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQStyleOption& = TQStyleOption::Default, const TQWidget *widget =0 ) const; + + int pixelMetric( PixelMetric m, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget = 0 ) const; + + TQSize sizeFromContents( ContentsType contents, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &contentSize, + const TQStyleOption& opt, + const TQWidget *widget = 0 ) const; + TQRect subRect( SubRect r, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget ) const; + TQRect querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl subcontrol, + const TQStyleOption &opt = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; // Fix TQt3's wacky image positions - TQPixmap stylePixmap( StylePixmap stylepixmap, const TQWidget *widget = 0, const TQStyleOption& = TQStyleOption::Default ) const; + TQPixmap stylePixmap( StylePixmap stylepixmap, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; bool eventFilter( TQObject *object, TQEvent *event ); - + private slots: void updateProgressPos(); void updateSliderPos(); void progressBarDestroyed(TQObject*); void fakeMouse(); - + protected: void clearImage( TQImage &img ) const; ButtonTile* createButtonTile( const TQColor &c, const TQColor &bgColor, TQImage *buttonImage, TQImage *shadowImage, TQImage *glowImage, TQIntDict <ButtonTile>*buttonDict, TQIntDict<ButtonTile>*shadowDict, TQIntDict<ButtonTile>*glowDict, int w, int h, int xOff, int yOff, int centerW, int centerH, int shadowH, int glowWH, bool sunken) const; ButtonTile* createRoundFrameTile(TQImage &img, const TQColor &color, const TQColor *bg, const TQColor &baseColor ) const; TQPixmap* createSliderEnd( const TQColor &c, const TQColor &bgColor, bool top/*, bool vertical*/ ) const; ButtonTile* separateTiles( TQPixmap *pix, int xO, int yO, int w, int h, int sh, bool sunken) const; - + TQPixmap* getPixmap( BitmapData item ) const; TQPixmap* adjustHSV( TQImage &img, const TQColor &c, const TQColor *bg = NULL ) const; TQImage* adjustHSVImage( TQImage &img, const TQColor &c, const TQColor *bg = NULL ) const; @@ -559,8 +617,8 @@ private: void fadeOut(TQPushButton *button); TQColor brushedMetalColor(TQColor &c) const; TQColor originalBgColor; - - + + TQBitmap *sbLeft, *sbRight, *sbUp, *sbDown, *checkmark; TQImage *btnBorderImg, *btnShadowImg, *slider_top, *slider_btm, *slider_top_shd, *slider_btm_shd, *rectbutton, *combo, *comboShadow, *buttonGlow, *roundFrame; TQPixmap *btnBlendPix, *menuPix, *groupShadow ; @@ -590,7 +648,7 @@ private: TQPalette polishedPalette, tooltipPalette; unsigned int qtrcModificationTime; - + int progAnimShift; int prog2AnimShift; int sliderAnimShift; @@ -623,5 +681,5 @@ private: static TQPixmap popupBack; TQWidget *paintWidget; }; - + #endif diff --git a/style/baghira.themerc b/style/baghira.themerc index d6bfd1f..98f0aef 100644 --- a/style/baghira.themerc +++ b/style/baghira.themerc @@ -1,6 +1,6 @@ [Misc] Name=Baghira Comment=The Big Black Cat -ConfigPage=kstyle_baghira_config +ConfigPage=tdestyle_baghira_config [KDE] WidgetStyle=Baghira diff --git a/style/eventfilter.cpp b/style/eventfilter.cpp index 4f860b5..4d1eb4b 100644 --- a/style/eventfilter.cpp +++ b/style/eventfilter.cpp @@ -1,5 +1,5 @@ #include <tqcursor.h> -#include <kpixmapeffect.h> +#include <kpixmapeffect.h> #include <X11/keysym.h> #include <X11/extensions/XTest.h> #include <fixx11h.h> @@ -179,14 +179,16 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) TQButton * btn = ( TQButton * ) obj; bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "TQStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) ); bool isRadio = obj->inherits( "TQRadioButton" ); + const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(btn, TQStyleOption()); + ControlElementFlags elementFlags = getControlElementFlagsForObject(btn, TQStyleOption()); btn->erase(); TQPainter p; p.begin( btn ); TQFontMetrics fm = btn->fontMetrics(); TQSize lsz = fm.size( ShowPrefix, btn->text() ); TQSize sz = isRadio ? - TQSize( pixelMetric( PM_ExclusiveIndicatorWidth ), pixelMetric( PM_ExclusiveIndicatorHeight ) ) : - TQSize( pixelMetric( PM_IndicatorWidth ), pixelMetric( PM_IndicatorHeight ) ); + TQSize( pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags ) ) : + TQSize( pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), pixelMetric( PM_IndicatorHeight, ceData, elementFlags ) ); int x = 0; int y = isStatusChild ? 0 : ( btn->height() - lsz.height() + fm.height() - sz.height() ) / 2; SFlags flags = Style_Default; @@ -203,9 +205,9 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) else if ( btn->state() == TQButton::Off ) flags |= Style_Off; if ( isRadio ) - drawControl( CE_RadioButton, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + drawControl( CE_RadioButton, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn ); else - drawControl( CE_CheckBox, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + drawControl( CE_CheckBox, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn ); x = sz.width() + 6; y = 0; if ( btn->hasFocus() ) @@ -340,12 +342,14 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) { bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "TQStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) ); bool isRadio = obj->inherits( "TQRadioButton" ); + const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(btn, TQStyleOption()); + ControlElementFlags elementFlags = getControlElementFlagsForObject(btn, TQStyleOption()); highlightWidget = btn; TQFontMetrics fm = btn->fontMetrics(); TQSize lsz = fm.size( ShowPrefix, btn->text() ); TQSize sz = isRadio ? - TQSize( pixelMetric( PM_ExclusiveIndicatorWidth ), pixelMetric( PM_ExclusiveIndicatorHeight ) ) : - TQSize( pixelMetric( PM_IndicatorWidth ), pixelMetric( PM_IndicatorHeight ) ); + TQSize( pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags ) ) : + TQSize( pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), pixelMetric( PM_IndicatorHeight, ceData, elementFlags ) ); int x = 0; int y = isStatusChild ? 0 : ( btn->height() - lsz.height() + fm.height() - sz.height() ) / 2; TQPainter p; @@ -364,9 +368,9 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) else if ( btn->state() == TQButton::Off ) flags |= Style_Off; if ( isRadio ) - drawControl( CE_RadioButton, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + drawControl( CE_RadioButton, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn ); else - drawControl( CE_CheckBox, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + drawControl( CE_CheckBox, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn ); p.end(); } return false; @@ -485,12 +489,14 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) { bool isRadio = obj->inherits( "TQRadioButton" ); bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "TQStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) ); + const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(btn, TQStyleOption()); + ControlElementFlags elementFlags = getControlElementFlagsForObject(btn, TQStyleOption()); highlightWidget = NULL; TQFontMetrics fm = btn->fontMetrics(); TQSize lsz = fm.size( ShowPrefix, btn->text() ); TQSize sz = isRadio ? - TQSize( pixelMetric( PM_ExclusiveIndicatorWidth ), pixelMetric( PM_ExclusiveIndicatorHeight ) ) : - TQSize( pixelMetric( PM_IndicatorWidth ), pixelMetric( PM_IndicatorHeight ) ); + TQSize( pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags ) ) : + TQSize( pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), pixelMetric( PM_IndicatorHeight, ceData, elementFlags ) ); int x = 0; int y = isStatusChild ? 0 : ( btn->height() - lsz.height() + fm.height() - sz.height() ) / 2; TQPainter p; @@ -509,9 +515,9 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev ) else if ( btn->state() == TQButton::Off ) flags |= Style_Off; if ( isRadio ) - drawControl( CE_RadioButton, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + drawControl( CE_RadioButton, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn ); else - drawControl( CE_CheckBox, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + drawControl( CE_CheckBox, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn ); p.end(); } return false; diff --git a/style/polish.cpp b/style/polish.cpp index 650afc9..73d1f49 100644 --- a/style/polish.cpp +++ b/style/polish.cpp @@ -107,7 +107,7 @@ void LiquidStyle::polish( TQPalette &pal ) pal.setColor(TQPalette::Active, TQColorGroup::HighlightedText, TQColor(optionHandler->custCols[5])); pal.setColor(TQPalette::Active, TQColorGroup::ButtonText, TQColor(optionHandler->custCols[6])); pal.setColor(TQColorGroup::Mid, TQColor((tqRed(optionHandler->custCols[2])+tqRed(optionHandler->custCols[3]))/2,(tqGreen(optionHandler->custCols[2])+tqGreen(optionHandler->custCols[3]))/2,(tqBlue(optionHandler->custCols[2])+tqBlue(optionHandler->custCols[3]))/2)); - + pal.setColor(TQPalette::Inactive, TQColorGroup::Text, TQColor(optionHandler->custCols[3])); pal.setColor(TQPalette::Inactive, TQColorGroup::HighlightedText, TQColor(optionHandler->custCols[5])); pal.setColor(TQPalette::Inactive, TQColorGroup::ButtonText, TQColor(optionHandler->custCols[6])); @@ -120,10 +120,10 @@ void LiquidStyle::polish( TQPalette &pal ) origPanelBrush = pal.brush( TQPalette::Active, TQColorGroup::Background ); origPanelPalette = pal; TQColor c( pal.active().background() ); - + if ( optionHandler->usePanelCustomColor() && optionHandler->panelCustomColor().isValid() ) c = optionHandler->panelCustomColor(); - + kickerColor = c; pal.setColor( TQColorGroup::Mid, optionHandler->CustomButtonColor().dark( 110 ) ); @@ -185,7 +185,7 @@ void LiquidStyle::polish( TQPalette &pal ) TQBrush brush( c, stipple ); pal.setBrush( TQColorGroup::Background, brush ); } - + if (optionHandler->bevelHighlights()) { TQColor c(pal.active().highlight()); @@ -204,36 +204,40 @@ void LiquidStyle::polish( TQPalette &pal ) optionHandler->reset(); } -void LiquidStyle::unPolish( TQApplication *app ) +void LiquidStyle::applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { - popupBack.resize(0,0); - TQPalette pal( app->palette() ); - inExitPolish = true; - - if ( !isPlain() ) - { - // reset any stipples - if ( pal.brush( TQPalette::Active, TQColorGroup::Background ).pixmap() ) - pal.setBrush( TQColorGroup::Background, pal.active().background() ); - if ( pal.brush( TQPalette::Active, TQColorGroup::Button ).pixmap() ) - pal.setBrush( TQColorGroup::Button, pal.active().button() ); -// app->blockSignals( TRUE ); - app->setPalette( pal ); -// app->blockSignals( FALSE ); - } + if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) { + TQApplication *app = reinterpret_cast<TQApplication*>(ptr); + popupBack.resize(0,0); + TQPalette pal( app->palette() ); + inExitPolish = true; + + if ( !isPlain() ) { + // reset any stipples + if ( pal.brush( TQPalette::Active, TQColorGroup::Background ).pixmap() ) + pal.setBrush( TQColorGroup::Background, pal.active().background() ); + if ( pal.brush( TQPalette::Active, TQColorGroup::Button ).pixmap() ) + pal.setBrush( TQColorGroup::Button, pal.active().button() ); +// app->blockSignals( TRUE ); + app->setPalette( pal ); +// app->blockSignals( FALSE ); + } - inExitPolish = false; + inExitPolish = false; + } } Atom baghira_deco_design = XInternAtom(tqt_xdisplay(), "BAGHIRA_DECO_DESIGN", False); -void LiquidStyle::polish( TQWidget *w ) +void LiquidStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { // bool testWidget = w->inherits("Splash"); // int testInt = 0; // if (w->sizePolicy().horData() == TQSizePolicy::Minimum || w->sizePolicy().horData() == TQSizePolicy::MinimumExpanding) // tqWarning("%s, \"%s\"",w->className(), w->name()); // w->installEventFilter(this); + if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + TQWidget *w = reinterpret_cast<TQWidget*>(ptr); bool tmpBool = false; bool isViewport = qstrcmp( w->name(), "qt_viewport" ) == 0 || @@ -358,7 +362,7 @@ void LiquidStyle::polish( TQWidget *w ) goto kstpolish; } - + if (w->inherits("KColorGrid")) { // kiconedit doesn't check for the paintevent rect size, but tries to create a (possibly) NULL Pixmap (after palette change event e.g.) @@ -367,18 +371,18 @@ void LiquidStyle::polish( TQWidget *w ) w->installEventFilter( this ); goto kstpolish; } - + if (w->inherits("BGMonitor") || w->inherits("mapWidget") || w->isA("MyButton") || (w->parentWidget() && w->parentWidget()->inherits("Thumbnail"))) // don't touch these widgets at all - they don't like it { goto kstpolish; } - + if (qstrcmp( w->name(), "tde toolbar widget" ) == 0 ) w->installEventFilter( this ); - + if (::tqt_cast<TQButton*>(w)) { w->setBackgroundOrigin(TQWidget::WindowOrigin); @@ -413,7 +417,7 @@ void LiquidStyle::polish( TQWidget *w ) goto kstpolish; } } - + if ( ::tqt_cast<TQToolBar*>(w)) { if (optionHandler->useToolButtonFrame() && w->inherits("TDEToolBar")) @@ -433,7 +437,7 @@ void LiquidStyle::polish( TQWidget *w ) goto kstpolish ; } //if (testWidget) tqWarning("testwidget stage %d",testInt++); - + if (tmpBool = ::tqt_cast<TQToolButton*>(w) || w->inherits( "TQToolBarSeparator" ) || w->inherits( "TDEToolBarSeparator" ) ) { if (tmpBool && w->parentWidget() && ::tqt_cast<TQToolBar*>(w->parentWidget()) ) @@ -445,7 +449,7 @@ void LiquidStyle::polish( TQWidget *w ) w->installEventFilter( this ); goto kstpolish; } - + if (::tqt_cast<TQComboBox*>(w)) { w->setBackgroundMode(NoBackground); @@ -453,7 +457,7 @@ void LiquidStyle::polish( TQWidget *w ) w->setBackgroundOrigin(TQWidget::WindowOrigin); goto kstpolish; } - + if (w->inherits("TaskBar")) { w->setBackgroundOrigin(TQWidget::WidgetOrigin); @@ -464,7 +468,7 @@ void LiquidStyle::polish( TQWidget *w ) w->installEventFilter( this ); goto kstpolish; } - + if ( !isPlain () && (w->inherits( "KonqIconViewWidget" ) || w->inherits( "tdehtml")/* || w->inherits( "TQtVisionView")*/)) { // if you want custom backgrounds in konqueror, you have to reset pixmap, since Konq animation can't handle it @@ -480,7 +484,7 @@ void LiquidStyle::polish( TQWidget *w ) w->setBackgroundMode( TQWidget::NoBackground ); goto kstpolish; } - + if ((::tqt_cast<TQScrollView*>(w) || w->inherits("KateView") || w->inherits("TEWidget") || w->inherits("CHexViewWidget")) && !(w->isA("KOAgenda"))) { if (::tqt_cast<TDEListView*>(w) && optionHandler->custCols[7] != -1 && ((TDEListView*)w)->alternateBackground() == TDEGlobalSettings::alternateBackgroundColor()) @@ -519,7 +523,7 @@ void LiquidStyle::polish( TQWidget *w ) w->installEventFilter( this ); goto kstpolish; } - + if (w->inherits("TQStatusBar")) { w->setBackgroundOrigin(TQWidget::WindowOrigin); @@ -530,14 +534,14 @@ void LiquidStyle::polish( TQWidget *w ) } goto kstpolish; } - + if (w->inherits( "TQLineEdit" ) || w->inherits("TQSplitterHandle") || w->isA( "AppletHandleDrag" ) || w->inherits( "KMiniPagerButton" )) { w->setBackgroundOrigin(TQWidget::WindowOrigin); w->installEventFilter( this ); goto kstpolish; } - + if (w->inherits( "TaskContainer" )) { w->installEventFilter( this ); @@ -552,7 +556,7 @@ void LiquidStyle::polish( TQWidget *w ) goto kstpolish; } - if ( !isPlain() ) + if ( !isPlain() ) { if ( !isViewport && w->parent() && qstrcmp( w->parent() ->name(), "proxyview" ) == 0 ) { @@ -626,7 +630,7 @@ void LiquidStyle::polish( TQWidget *w ) #endif goto kstpolish ; } - + if (::tqt_cast<TQFrame*>(w)) { w->setBackgroundOrigin(TQWidget::WindowOrigin); @@ -669,8 +673,8 @@ void LiquidStyle::polish( TQWidget *w ) } } //if (testWidget) tqWarning("testwidget stage %d",testInt++); - - + + if ( w->parentWidget() && ( ( ::tqt_cast<TQListBox*>(w) && ::tqt_cast<TQPushButton*>(w->parentWidget())) || w->inherits( "TDECompletionBox" ) ) ) { TQListBox* listbox = (TQListBox*) w; listbox->setBackgroundMode( NoBackground ); @@ -679,7 +683,7 @@ void LiquidStyle::polish( TQWidget *w ) } //if (testWidget) tqWarning("testwidget stage %d",testInt++); - + if (::tqt_cast<TQHeader*>(w)){ // if (::tqt_cast<TQListView*>(w->parentWidget())) // headerSortID = ((TQListView*)w->parentWidget())->sortColumn(); @@ -690,7 +694,7 @@ void LiquidStyle::polish( TQWidget *w ) } //if (testWidget) tqWarning("testwidget stage %d",testInt++); - + if (::tqt_cast<TQTabBar*>(w)){ // tqWarning("installing tab event"); w->setMouseTracking( true ); @@ -698,7 +702,7 @@ void LiquidStyle::polish( TQWidget *w ) w->setBackgroundOrigin(TQWidget::WindowOrigin); goto kstpolish; } - + if (::tqt_cast<TQGroupBox*>(w) && ((TQGroupBox*)w)->frameShape() == TQFrame::GroupBoxPanel && !((TQGroupBox*)w)->isFlat()) { if ( optionHandler->drawGroupBoxShadow() ) @@ -726,7 +730,7 @@ void LiquidStyle::polish( TQWidget *w ) connect(w, SIGNAL(destroyed(TQObject*)), this, SLOT(progressBarDestroyed(TQObject*))); goto kstpolish; } - + if ( w->inherits( "TQDockWindow" ) ) { w->setBackgroundMode( TQWidget::PaletteBackground ); w->setBackgroundOrigin(TQWidget::WindowOrigin); @@ -744,25 +748,29 @@ void LiquidStyle::polish( TQWidget *w ) if ( w->inherits( "KdetvView")) { w->setBackgroundMode( TQWidget::NoBackground ); } + } //if (testWidget) tqWarning("testwidget stage %d",testInt++); - kstpolish: TDEStyle::polish( w ); // nothing of all above? do default kde stuff + kstpolish: TDEStyle::polish( ceData, elementFlags, ptr ); // nothing of all above? do default kde stuff } -void LiquidStyle::unPolish( TQWidget *w ) { +void LiquidStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { + + if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + TQWidget *w = reinterpret_cast<TQWidget*>(ptr); bool isViewport; bool isViewportChild; - + // general - better than querying for each and ever widget if it got one... w->removeEventFilter( this ); - + if (w->inherits("KColorGrid")){ goto kstunpolish; } - + if ( w->inherits("TQToolBar") || qstrcmp( w->name(), "tde toolbar widget" ) == 0 ) { w->setBackgroundOrigin( TQWidget::WidgetOrigin ); // w->unsetPalette(); @@ -874,5 +882,6 @@ void LiquidStyle::unPolish( TQWidget *w ) { goto kstunpolish; } } -kstunpolish: TDEStyle::unPolish( w ); - } + } +kstunpolish: TDEStyle::unPolish( ceData, elementFlags, ptr ); +} |