summaryrefslogtreecommitdiffstats
path: root/style/qtcurve.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'style/qtcurve.cpp')
-rw-r--r--style/qtcurve.cpp5645
1 files changed, 3966 insertions, 1679 deletions
diff --git a/style/qtcurve.cpp b/style/qtcurve.cpp
index de2cc1f..f5dbdbc 100644
--- a/style/qtcurve.cpp
+++ b/style/qtcurve.cpp
@@ -1,5 +1,5 @@
/*
- QtCurve (C) Craig Drummond, 2003 - 2007 [email protected]
+ QtCurve (C) Craig Drummond, 2003 - 2010 [email protected]
----
@@ -54,13 +54,17 @@ Srollbars:
For some reason Scrollbars in KHTML seem to lose the bottom/left pixels. As if KHTML expects
the scrollbar to be 1 pixel smaller/thinner than it actually is. To 'fix' this, the pixelMetric
-function will return 1 scrollbar with 1 greater than standard for form widgets, or where widget==NULL
+function will return 1 scrollbar with 1 greater than standard for form widgets, or where widget==0L
In the CC_ScrollBar draw code, the rects used for each component are shrunk by 1, in the appropriate
dimension, so as to draw the scrollbar at the correct size.
*/
+#include <qtable.h>
+#include "config.h"
+#ifndef QTC_QT_ONLY
#include <kdeversion.h>
+#endif
#include <qsettings.h>
#include <qmenubar.h>
#include <qapplication.h>
@@ -95,11 +99,15 @@ dimension, so as to draw the scrollbar at the correct size.
#include <qtimer.h>
#include <qdatetimeedit.h>
#include <qobjectlist.h>
+#include <qpixmapcache.h>
+#include <qbitmap.h>
+#include <qmainwindow.h>
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
-#define QTC_COMMON_FUNCTIONS
+#include <iostream>
+#define COMMON_FUNCTIONS
#include "qtcurve.h"
#define CONFIG_READ
#include "config_file.c"
@@ -109,9 +117,134 @@ dimension, so as to draw the scrollbar at the correct size.
#include <qstyleplugin.h>
#include <qgroupbox.h>
#include <qdir.h>
+// Need access to classname from within QMetaObject...
+#define private public
+#include <qmetaobject.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
-#include <fixx11h.h>
+#include "qtc_fixx11h.h"
+
+static const Atom constNetMoveResize = XInternAtom(qt_xdisplay(), "_NET_WM_MOVERESIZE", False);
+static const QWidget * getTopLevel(const QWidget *widget)
+{
+ const QWidget *w=widget;
+
+ while(w && !w->isTopLevel())
+ w=w->parentWidget();
+ return w;
+}
+
+static void emitMenuSize(const QWidget *widget, unsigned short size)
+{
+ const QWidget *w=getTopLevel(widget);
+
+ if(w)
+ {
+ static const Atom constAtom = XInternAtom(qt_xdisplay(), MENU_SIZE_ATOM, False);
+ XChangeProperty(qt_xdisplay(), w->parentWidget() ? w->parentWidget()->winId() : w->winId(),
+ constAtom, XA_CARDINAL, 16, PropModeReplace, (unsigned char *)&size, 1);
+ }
+}
+
+void setBgndProp(QWidget *widget, unsigned short app)
+{
+ const QWidget *w=getTopLevel(widget);
+
+ if(w)
+ {
+ static const Atom constAtom = XInternAtom(qt_xdisplay(), BGND_ATOM, False);
+ XChangeProperty(qt_xdisplay(), w->parentWidget() ? w->parentWidget()->winId() : w->winId(),
+ constAtom, XA_CARDINAL, 16, PropModeReplace, (unsigned char *)&app, 1);
+ }
+}
+
+static void triggerWMMove(const QWidget *w, const QPoint &p)
+{
+ //...Taken from bespin...
+ // stolen... errr "adapted!" from QSizeGrip
+ XEvent xev;
+ xev.xclient.type = ClientMessage;
+ xev.xclient.message_type = constNetMoveResize;
+ xev.xclient.display = qt_xdisplay();
+ xev.xclient.window = w->parentWidget() ? w->parentWidget()->winId() : w->winId();
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = p.x();
+ xev.xclient.data.l[1] = p.y();
+ xev.xclient.data.l[2] = 8; // NET::Move
+ xev.xclient.data.l[3] = Button1;
+ xev.xclient.data.l[4] = 0;
+ XUngrabPointer(qt_xdisplay(), CurrentTime);
+ XSendEvent(qt_xdisplay(), qt_xrootwin(), False,
+ SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+}
+
+#define MO_ARROW_X(FLAGS, COL) (MO_NONE!=opts.coloredMouseOver && FLAGS&Style_MouseOver && FLAGS&Style_Enabled ? itsMouseOverCols[ARROW_MO_SHADE] : COL)
+#define MO_ARROW(COL) MO_ARROW_X(flags, COL)
+
+static const int constMenuPixmapWidth=22;
+
+static bool useQt3Settings()
+{
+ static int ver=0;
+
+ if(0==ver)
+ {
+ const char *sessionVersion=getenv("KDE_SESSION_VERSION");
+
+ ver=sessionVersion
+ ? atoi(sessionVersion)<4
+ ? 3
+ : 4
+#ifdef QTC_DEFAULT_TO_KDE3
+ : 3;
+#else
+ : getenv("KDE_FULL_SESSION")
+ ? 3
+ : 4;
+#endif
+ }
+
+ return 3==ver;
+}
+
+static QRect adjusted(const QRect r, int xp1, int yp1, int xp2, int yp2)
+{
+ int x1, y1, x2, y2;
+
+ r.coords(&x1, &y1, &x2, &y2);
+ return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2));
+}
+
+static void adjust(QRect &r, int dx1, int dy1, int dx2, int dy2)
+{
+ int x1, y1, x2, y2;
+
+ r.coords(&x1, &y1, &x2, &y2);
+ x1 += dx1;
+ y1 += dy1;
+ x2 += dx2;
+ y2 += dy2;
+ r.setCoords(x1, y1, x2, y2);
+}
+
+inline bool isSpecialHover(QWidget *w)
+{
+ return w && (
+#if QT_VERSION >= 0x030200
+ ::qt_cast<QRadioButton *>(w) ||
+ ::qt_cast<QCheckBox *>(w) ||
+#endif
+ ::qt_cast<QScrollBar *>(w) ||
+#if defined KDE_VERSION && KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
+ ::qt_cast<QToolButton *>(w) ||
+
+#endif
+ ::qt_cast<QHeader *>(w) ||
+ ::qt_cast<QSpinWidget *>(w) ||
+ ::qt_cast<QComboBox *>(w) ||
+ ::qt_cast<QTabBar *>(w)
+ );
+}
static QString readEnvPath(const char *env)
{
@@ -120,41 +253,90 @@ static QString readEnvPath(const char *env)
return path.isEmpty() ? QString::null : QFile::decodeName(path);
}
-static QString kdeHome()
+static QString kdeHome(bool kde3=false)
{
- QString env(readEnvPath(getuid() ? "KDEHOME" : "KDEROOTHOME"));
+ static QString kdeHome[2];
+
+ // Execute kde-config to ascertain users KDEHOME
+ if(kdeHome[kde3 ? 0 : 1].isEmpty())
+ {
+ FILE *fpipe;
+
+ if (fpipe = (FILE*)popen(kde3 ? "kde-config --localprefix 2> /dev/null" : "kde4-config --localprefix 2> /dev/null", "r"))
+ {
+ char line[1024];
+
+ while(fgets(line, sizeof line, fpipe))
+ {
+ kdeHome[kde3 ? 0 : 1]=QFile::decodeName(line).replace("\n", "");
+ break;
+ }
+ pclose(fpipe);
+ }
+ }
- return env.isEmpty()
- ? QDir::homeDirPath()+"/.kde"
- : env;
+ // Try env vars...
+ if(kdeHome[kde3 ? 0 : 1].isEmpty())
+ {
+ kdeHome[kde3 ? 0 : 1]=readEnvPath(getuid() ? "KDEHOME" : "KDEROOTHOME");
+ if (kdeHome[kde3 ? 0 : 1].isEmpty())
+ {
+ QDir homeDir(QDir::homeDirPath());
+ QString kdeConfDir("/.kde");
+ if (!kde3 && homeDir.exists(".kde4"))
+ kdeConfDir = QString("/.kde4");
+ kdeHome[kde3 ? 0 : 1] = QDir::homeDirPath() + kdeConfDir;
+ }
+ }
+ return kdeHome[kde3 ? 0 : 1];
}
-static void getStyles(const QString &dir, QStringList &styles)
+#ifdef QTC_STYLE_SUPPORT
+static void getStyles(const QString &dir, const char *sub, QStringList &styles)
{
- QDir d(dir+QTC_THEME_DIR);
+ QDir d(dir+sub);
- d.setNameFilter(QTC_THEME_PREFIX"*"QTC_THEME_SUFFIX);
+ if(d.exists())
+ {
+ d.setNameFilter(THEME_PREFIX"*"THEME_SUFFIX);
- QStringList entries(d.entryList());
- QStringList::ConstIterator it(entries.begin()),
- end(entries.end());
+ QStringList entries(d.entryList());
+ QStringList::ConstIterator it(entries.begin()),
+ end(entries.end());
- for(; it!=end; ++it)
- {
- QString style((*it).left((*it).findRev(QTC_THEME_SUFFIX)));
+ for(; it!=end; ++it)
+ {
+ QString style((*it).left((*it).findRev(THEME_SUFFIX)));
- if(!styles.contains(style))
- styles.append(style);
+ if(!styles.contains(style))
+ styles.append(style);
+ }
}
}
-static QString themeFile(const QString &dir, const QString &n)
+static void getStyles(const QString &dir, QStringList &styles)
+{
+ getStyles(dir, THEME_DIR, styles);
+ getStyles(dir, THEME_DIR4, styles);
+}
+
+static QString themeFile(const QString &dir, const QString &n, const char *sub)
{
- QString name(dir+QTC_THEME_DIR+n+QTC_THEME_SUFFIX);
+ QString name(dir+sub+n+THEME_SUFFIX);
return QFile(name).exists() ? name : QString();
}
+static QString themeFile(const QString &dir, const QString &n, bool kde3=true)
+{
+ QString name(themeFile(dir, n, kde3 ? THEME_DIR : THEME_DIR4));
+
+ if(name.isEmpty())
+ name=themeFile(dir, n, kde3 ? THEME_DIR4 : THEME_DIR);
+ return name;
+}
+#endif
+
class QtCurveStylePlugin : public QStylePlugin
{
public:
@@ -166,9 +348,12 @@ class QtCurveStylePlugin : public QStylePlugin
QStringList list;
list << "QtCurve";
- getStyles(kdeHome(), list);
- getStyles(KDE_PREFIX(3), list);
- getStyles(KDE_PREFIX(4), list);
+#ifdef QTC_STYLE_SUPPORT
+ getStyles(kdeHome(useQt3Settings()), list);
+ getStyles(kdeHome(!useQt3Settings()), list);
+ getStyles(KDE_PREFIX(useQt3Settings() ? 3 : 4), list);
+ getStyles(KDE_PREFIX(useQt3Settings() ? 4 : 3), list);
+#endif
return list;
}
@@ -177,36 +362,42 @@ class QtCurveStylePlugin : public QStylePlugin
{
return "qtcurve"==s.lower()
? new QtCurveStyle
- : 0==s.find(QTC_THEME_PREFIX)
+#ifdef QTC_STYLE_SUPPORT
+ : 0==s.find(THEME_PREFIX)
? new QtCurveStyle(s)
+#endif
: 0;
}
};
Q_EXPORT_PLUGIN(QtCurveStylePlugin)
-#define QTC_SKIP_TASKBAR (APP_SKIP_TASKBAR==itsThemedApp || APP_KPRINTER==itsThemedApp || APP_KDIALOG==itsThemedApp)
+#define SKIP_TASKBAR (APP_SKIP_TASKBAR==itsThemedApp || APP_KPRINTER==itsThemedApp || APP_KDIALOG==itsThemedApp)
-#if KDE_VERSION >= 0x30200
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
#include <qfile.h>
#endif
-#define QTC_NO_SECT -1
+#define NO_SECT -1
+
+#define VERTICAL_TB_BUTTON 0x01000000
+#define CHECK_BUTTON 0x02000000
+#define STD_TOOLBUTTON 0x04000000
+#define TOGGLE_BUTTON 0x08000000
+#define NO_ETCH_BUTTON 0x10000000
+#define DW_CLOSE_BUTTON 0x80000000
+#define LISTVIEW_ITEM 0x20000000
+#define MENU_ITEM 0x40000000
+#define WINDOWTITLE_SPACER 0x10000000
-#define QTC_VERTICAL_TB_BUTTON 0x01000000
-#define QTC_CHECK_BUTTON 0x02000000
-#define QTC_STD_TOOLBUTTON 0x04000000
-#define QTC_TOGGLE_BUTTON 0x08000000
-#define QTC_NO_ETCH_BUTTON 0x10000000
-#define QTC_LISTVIEW_ITEM 0x20000000
-#define QTC_MENU_ITEM 0x40000000
+#define DW_BGND 105
-#if KDE_VERSION >= 0x30200
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
// Try to read $KDEHOME/share/config/kickerrc to find out if kicker is transparent...
static bool kickerIsTrans()
{
- QString cfgFileName(kdeHome()+"/share/config/kickerrc");
+ QString cfgFileName(kdeHome(true)+"/share/config/kickerrc");
bool trans(false);
QFile cfgFile(cfgFileName);
@@ -223,16 +414,16 @@ static bool kickerIsTrans()
if(inGen)
{
- if(0==line.find("Transparent=")) // Found it!
+ if(0==line.find("Transparent=", false)) // Found it!
{
- if(-1!=line.find("true"))
+ if(-1!=line.find("true", false))
trans=true;
stop=true;
}
else if(line[0]==QChar('[')) // Then wasn't in General section...
stop=true;
}
- else if(0==line.find("[General]"))
+ else if(0==line.find("[General]", false))
inGen=true;
}
cfgFile.close();
@@ -242,13 +433,6 @@ static bool kickerIsTrans()
}
#endif
-inline QColor midColor(const QColor &a, const QColor &b, double factor=1.0)
-{
- return QColor((a.red()+limit(b.red()*factor))>>1,
- (a.green()+limit(b.green()*factor))>>1,
- (a.blue()+limit(b.blue()*factor))>>1);
-}
-
static bool isKhtmlWidget(const QWidget *w, int level=1)
{
return w && ((w->name() && 0==strcmp(w->name(), "__khtml")) ||
@@ -264,7 +448,7 @@ static bool isKhtmlFormWidget(const QWidget *widget)
//Form widgets are in the KHTMLView, but that has 2 further inner levels
//of widgets - QClipperWidget, and outside of that, QViewportWidget
- QWidget *potentialClipPort(widget ? widget->parentWidget() : NULL);
+ QWidget *potentialClipPort(widget ? widget->parentWidget() : 0L);
if (!potentialClipPort || potentialClipPort->isTopLevel())
return false;
@@ -284,20 +468,118 @@ static bool isKhtmlFormWidget(const QWidget *widget)
return true;
}
-QColor shade(const QColor &a, float k)
+static bool inStackWidget(const QWidget *w)
{
- QColor mod;
+ while(w)
+ {
+ if(::qt_cast<const QTabWidget *>(w))
+ return true;
+ w=w->parentWidget();
+ }
+
+ return false;
+}
- shade(a, &mod, k);
- return mod;
+static void setRgb(QColor *col, const QStringList &rgb)
+{
+ if(3==rgb.size())
+ *col=QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt());
+}
+
+struct KDESettings
+{
+ KDESettings()
+ {
+ inactiveHighlight=false;
+ }
+
+ bool inactiveHighlight;
+ QColor hover,
+ focus;
+};
+
+static KDESettings kdeSettings;
+static bool readKdeGlobals()
+{
+ static int lastCheck=0;
+
+ int now=time(0L);
+
+ // Dont keep on reading kdeglobals file - only read if its been at least 2 seconds since the last time...
+ if(abs(now-lastCheck)<3)
+ return false;
+
+
+ QColor highlight(QApplication::palette().active().highlight());
+ bool inactiveEnabled(false),
+ changeSelectionColor(false),
+ useQt3(useQt3Settings());
+ QFile f(kdeHome(useQt3)+"/share/config/kdeglobals");
+
+ lastCheck=now;
+
+ if(useQt3)
+ kdeSettings.hover=kdeSettings.focus=highlight;
+ else
+ {
+ kdeSettings.hover=QColor(119, 183, 255);
+ kdeSettings.focus=QColor( 43, 116, 199);
+ }
+
+ if(f.open(IO_ReadOnly))
+ {
+ QTextStream in(&f);
+ bool inPal(false),
+ inInactive(false),
+ donePal(useQt3),
+ doneInactive(false);
+
+ while (!in.atEnd() && (!donePal || !doneInactive))
+ {
+ QString line(in.readLine());
+ if(inPal)
+ {
+ if(0==line.find("DecorationFocus=", false))
+ setRgb(&kdeSettings.focus, QStringList::split(",", line.mid(16)));
+ else if(0==line.find("DecorationHover=", false))
+ setRgb(&kdeSettings.hover, QStringList::split(",", line.mid(16)));
+ else if (-1!=line.find('['))
+ {
+ donePal=true;
+ inPal=false;
+ }
+ }
+ else if(inInactive)
+ {
+ if(0==line.find("ChangeSelectionColor=", false))
+ changeSelectionColor=line.find("=true");
+ else if(0==line.find("Enable=", false))
+ inactiveEnabled=line.find("=true");
+ else if (-1!=line.find('['))
+ {
+ doneInactive=true;
+ inInactive=false;
+ }
+ }
+ if(!inPal && !inInactive)
+ if(!useQt3 && 0==line.find("[Colors:Button]", false))
+ inPal=true;
+ else if(!useQt3 && 0==line.find("[ColorEffects:Inactive]", false))
+ inInactive=true;
+ }
+ f.close();
+ }
+
+ kdeSettings.inactiveHighlight=changeSelectionColor && inactiveEnabled;
+ return true;
}
static void drawLines(QPainter *p, const QRect &r, bool horiz, int nLines, int offset,
- const QColor *cols, int startOffset, int dark, int etchedDisp=1,
- bool light=true)
+ const QColor *cols, int startOffset, int dark, ELine type)
{
- int space((nLines*2)+(etchedDisp || !light ? (nLines-1) : 0)),
- step(etchedDisp || !light ? 3 : 2),
+ int space((nLines*2)+(LINE_DASHES!=type ? (nLines-1) : 0)),
+ step(LINE_DASHES!=type ? 3 : 2),
+ etchedDisp(LINE_SUNKEN==type ? 1 : 0),
x(horiz ? r.x(): r.x()+((r.width()-space)>>1)),
y(horiz ? r.y()+((r.height()-space)>>1): r.y()),
x2(r.x()+r.width()-1),
@@ -311,13 +593,15 @@ static void drawLines(QPainter *p, const QRect &r, bool horiz, int nLines, int o
p->setPen(cols[dark]);
for(i=0; i<space; i+=step)
- p->drawLine(x+offset, y+i, x2-(offset+etchedDisp), y+i);
+ p->drawLine(x+offset, y+i, x2-offset, y+i);
- if(light)
+ if(LINE_FLAT!=type)
{
+ x+=etchedDisp;
+ x2+=etchedDisp;
p->setPen(cols[0]);
for(i=1; i<space; i+=step)
- p->drawLine(x+offset+etchedDisp, y+i, x2-offset, y+i);
+ p->drawLine(x+offset, y+i, x2-offset, y+i);
}
}
else
@@ -327,13 +611,15 @@ static void drawLines(QPainter *p, const QRect &r, bool horiz, int nLines, int o
p->setPen(cols[dark]);
for(i=0; i<space; i+=step)
- p->drawLine(x+i, y+offset, x+i, y2-(offset+etchedDisp));
+ p->drawLine(x+i, y+offset, x+i, y2-offset);
- if(light)
+ if(LINE_FLAT!=type)
{
+ y+=etchedDisp;
+ y2+=etchedDisp;
p->setPen(cols[0]);
for(i=1; i<space; i+=step)
- p->drawLine(x+i, y+offset+etchedDisp, x+i, y2-offset);
+ p->drawLine(x+i, y+offset, x+i, y2-offset);
}
}
}
@@ -387,38 +673,28 @@ static bool onToolBar(QWidget *widget, int l=0)
: false;
}
-enum ECacheAppearance
-{
- CACHE_APPEARANCE_SELECTED=APPEARANCE_BEVELLED+1
-};
+#define PIXMAP_DIMENSION 10
-inline int app2App(EAppearance app, bool sel)
+enum ECacheFlags
{
- return sel ? (int)CACHE_APPEARANCE_SELECTED : (int)app;
-}
-
-#define QTC_PIXMAP_DIMENSION 10
+ CACHE_STD,
+ CACHE_COL_SEL_TAB
+};
-static int double2int(double d) { return (int)(d*100); }
-static QString createKey(int size, QRgb color, bool horiz, bool increase=false, int app=0,
- EWidget w=WIDGET_OTHER, double shadeTop=0.0, double shadeBot=0.0)
+static QString createKey(int size, QRgb color, bool horiz, int app, ECacheFlags flags)
{
QString key;
- if(WIDGET_DEF_BUTTON==w && !IS_GLASS(app)) // Glass uses different shading for def button...
- w=WIDGET_STD_BUTTON;
-
- QTextOStream(&key) << size << color << horiz << increase << app << (int)w
- << ' ' << double2int(shadeTop) << ' ' << double2int(shadeBot);
+ QTextOStream(&key) << size << '-' << color << '-' << horiz << '-' << app << '-' << flags;
return key;
}
-static QString createKey(QRgb color)
+static QString createKey(QRgb color, char type='p')
{
QString key;
- QTextOStream(&key) << 'p' << color;
+ QTextOStream(&key) << type << color;
return key;
}
@@ -432,104 +708,39 @@ static QString createKey(QRgb color, EPixmap p)
return key;
}
-static void readPal(QString &line, QPalette::ColorGroup grp, QPalette &pal)
+#ifdef SET_MDI_WINDOW_BUTTON_POSITIONS
+static void parseWindowLine(const QString &line, QValueList<int> &data)
{
- QStringList cols(QStringList::split(", ", line.mid(line.find("=#")+1)));
-
- if(17==cols.count())
- {
- QStringList::ConstIterator it(cols.begin()),
- end(cols.end());
- QColorGroup group;
-
- for(int i=0; it!=end, i<16; ++it, ++i)
- {
- QColor col;
-
- setRgb(&col, (*it).latin1());
- group.setColor((QColorGroup::ColorRole)i, col);
- }
+ int len(line.length());
- switch(grp)
+ for(int i=0; i<len; ++i)
+ switch(line[i].latin1())
{
- case QPalette::Active:
- pal.setActive(group);
+ case 'M':
+ data.append(QStyle::SC_TitleBarSysMenu);
+ break;
+ case '_':
+ data.append(WINDOWTITLE_SPACER);
+ break;
+// case 'H':
+// data.append(QStyle::SC_TitleBarContextHelpButton);
+// break;
+ case 'L':
+ data.append(QStyle::SC_TitleBarShadeButton);
break;
- case QPalette::Disabled:
- pal.setDisabled(group);
+ case 'I':
+ data.append(QStyle::SC_TitleBarMinButton);
break;
- case QPalette::Inactive:
- pal.setInactive(group);
+ case 'A':
+ data.append(QStyle::SC_TitleBarMaxButton);
+ break;
+ case 'X':
+ data.append(QStyle::SC_TitleBarCloseButton);
default:
break;
}
- }
-}
-
-static bool readQt4(QFile &f, QPalette &pal, QFont &font)
-{
- bool inSect(false),
- gotPal(false),
- gotFont(false);
-
- if(f.open(IO_ReadOnly))
- {
- QTextStream in(&f);
-
- while (!in.atEnd())
- {
- QString line(in.readLine());
-
- if(inSect)
- {
- gotPal=true;
- if(0==line.find("Palette\\active=#"))
- {
- readPal(line, QPalette::Active, pal);
- gotPal=true;
- }
- else if(0==line.find("Palette\\disabled=#"))
- {
- readPal(line, QPalette::Disabled, pal);
- gotPal=true;
- }
- else if(0==line.find("Palette\\inactive=#"))
- {
- readPal(line, QPalette::Inactive, pal);
- gotPal=true;
- }
- else if(0==line.find("font=\""))
- gotFont=font.fromString(line.mid(6, line.findRev('\"')-6));
- else if (0==line.find('['))
- break;
- }
- else if(0==line.find("[Qt]"))
- inSect=true;
- }
- f.close();
- }
-
- return gotPal && gotFont;
-}
-
-static bool useQt4Settings()
-{
- static const char *vers=getenv("KDE_SESSION_VERSION");
-
- return vers && atoi(vers)>=4;
-}
-
-static bool readQt4(QPalette &pal, QFont &font)
-{
- if(useQt4Settings())
- {
- QFile file(xdgConfigFolder()+QString("Trolltech.conf"));
-
- if(file.exists())
- return readQt4(file, pal, font);
- }
- return false;
}
+#endif
static bool isCheckBoxOfGroupBox(const QObject *w)
{
@@ -538,108 +749,346 @@ static bool isCheckBoxOfGroupBox(const QObject *w)
!qstrcmp(w->name(), "qt_groupbox_checkbox");
}
-//
-// OO.o 2.x checks to see whether the used theme "inherits" from HighContrastStyle,
-// if so it uses the highlightedText color to draw highlighted menubar and popup menu
-// items. Otherwise it uses the standard color. So faking this inheritance, solves this
-// problem.
-HighContrastStyle::HighContrastStyle()
- : KStyle(AllowMenuTransparency, WindowsStyleScrollBar)
+static void drawArrow(QPainter *p, const QRect &r, const QColor &col, QStyle::PrimitiveElement pe, const Options &opts, bool small=false)
{
+ QPointArray a;
+
+ if(small)
+ switch(pe)
+ {
+ case QStyle::PE_ArrowUp:
+ a.setPoints(opts.vArrows ? 6 : 3, 2,0, 0,-2, -2,0, -2,1, 0,-1, 2,1);
+ break;
+ case QStyle::PE_ArrowDown:
+ a.setPoints(opts.vArrows ? 6 : 3, 2,0, 0,2, -2,0, -2,-1, 0,1, 2,-1);
+ break;
+ case QStyle::PE_ArrowRight:
+ a.setPoints(opts.vArrows ? 6 : 3, 0,-2, 2,0, 0,2, -1,2, 1,0 -1,-2);
+ break;
+ case QStyle::PE_ArrowLeft:
+ a.setPoints(opts.vArrows ? 6 : 3, 0,-2, -2,0, 0,2, 1,2, -1,0, 1,-2);
+ break;
+ default:
+ return;
+ }
+ else // Large arrows...
+ switch(pe)
+ {
+ case QStyle::PE_ArrowUp:
+ a.setPoints(opts.vArrows ? 8 : 3, 3,1, 0,-2, -3,1, -3,2, -2,2, 0,0, 2,2, 3,2);
+ break;
+ case QStyle::PE_ArrowDown:
+ a.setPoints(opts.vArrows ? 8 : 3, 3,-1, 0,2, -3,-1, -3,-2, -2,-2, 0,0, 2,-2, 3,-2);
+ break;
+ case QStyle::PE_ArrowRight:
+ a.setPoints(opts.vArrows ? 8 : 3, -1,-3, 2,0, -1,3, -2,3, -2,2, 0,0, -2,-2, -2,-3);
+ break;
+ case QStyle::PE_ArrowLeft:
+ a.setPoints(opts.vArrows ? 8 : 3, 1,-3, -2,0, 1,3, 2,3, 2,2, 0,0, 2,-2, 2,-3);
+ break;
+ default:
+ return;
+ }
+
+ if(a.isNull())
+ return;
+
+ p->save();
+ a.translate((r.x()+(r.width()>>1)),(r.y()+(r.height()>>1)));
+ p->setBrush(col);
+ p->setPen(col);
+ p->drawPolygon(a);
+ p->restore();
}
+#ifdef QTC_STYLE_SUPPORT
QtCurveStyle::QtCurveStyle(const QString &name)
- : itsSliderCols(NULL),
- itsDefBtnCols(NULL),
- itsMouseOverCols(NULL),
- itsSidebarButtonsCols(NULL),
+#else
+QtCurveStyle::QtCurveStyle()
+#endif
+ : BASE_STYLE(AllowMenuTransparency, WindowsStyleScrollBar),
+ itsSliderCols(0L),
+ itsDefBtnCols(0L),
+ itsMouseOverCols(0L),
+ itsComboBtnCols(0L),
+ itsCheckRadioSelCols(0L),
+ itsSortedLvColors(0L),
+ itsProgressCols(0L),
+ itsSidebarButtonsCols(0L),
+ itsActiveMdiColors(0L),
+ itsMdiColors(0L),
itsThemedApp(APP_OTHER),
itsPixmapCache(150000, 499),
-#if KDE_VERSION >= 0x30200
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
itsIsTransKicker(false),
#endif
itsHover(HOVER_NONE),
itsOldPos(-1, -1),
itsFormMode(false),
- itsHoverWidget(NULL),
- itsHoverSect(QTC_NO_SECT),
- itsHoverTab(NULL),
- itsMactorPal(NULL),
+ itsHoverWidget(0L),
+ itsHoverSect(NO_SECT),
+ itsHoverTab(0L),
+ itsMactorPal(0L),
itsActive(true),
- itsIsSpecialHover(false)
+ itsIsSpecialHover(false),
+ itsDragWidget(0L),
+ itsDragWidgetHadMouseTracking(false)
{
+#ifdef QTC_STYLE_SUPPORT
QString rcFile;
-
- defaultSettings(&opts);
if(!name.isEmpty())
{
- rcFile=themeFile(kdeHome(), name);
+ rcFile=themeFile(kdeHome(), name, useQt3Settings());
if(rcFile.isEmpty())
{
- rcFile=themeFile(KDE_PREFIX(useQt4Settings() ? 4 : 3), name);
+ rcFile=themeFile(kdeHome(true), name);
if(rcFile.isEmpty())
- rcFile=themeFile(KDE_PREFIX(useQt4Settings() ? 3 : 4), name);
+ {
+ rcFile=themeFile(KDE_PREFIX(useQt3Settings() ? 3 : 4), name, useQt3Settings());
+ if(rcFile.isEmpty())
+ rcFile=themeFile(KDE_PREFIX(useQt3Settings() ? 4 : 3), name, !useQt3Settings());
+ }
}
}
- readConfig(rcFile, &opts, &opts);
- opts.contrast=QSettings().readNumEntry("/Qt/KDE/contrast", 7);
+ readConfig(rcFile, &opts);
+#else
+ readConfig(QString(), &opts);
+#endif
+
+ if(FRAME_LINE==opts.groupBox || opts.gbLabel&GB_LBL_BOLD)
+ opts.groupBox=FRAME_NONE;
+
+ opts.contrast=QSettings().readNumEntry("/Qt/KDE/contrast", DEFAULT_CONTRAST);
if(opts.contrast<0 || opts.contrast>10)
- opts.contrast=7;
- itsPixmapCache.setAutoDelete(true);
+ opts.contrast=DEFAULT_CONTRAST;
- if ((SHADE_CUSTOM==opts.shadeMenubars || SHADE_BLEND_SELECTED==opts.shadeMenubars) &&
- "soffice.bin"==QString(qApp->argv()[0]) && TOO_DARK(SHADE_CUSTOM==opts.shadeMenubars
- ? opts.customMenubarsColor
- : itsMenuitemCols[ORIGINAL_SHADE]))
- opts.shadeMenubars=SHADE_DARKEN;
+ itsPixmapCache.setAutoDelete(true);
- shadeColors(QApplication::palette().active().highlight(), itsMenuitemCols);
+ shadeColors(QApplication::palette().active().highlight(), itsHighlightCols);
shadeColors(QApplication::palette().active().background(), itsBackgroundCols);
shadeColors(QApplication::palette().active().button(), itsButtonCols);
- if(SHADE_SELECTED==opts.shadeSliders)
- itsSliderCols=itsMenuitemCols;
- else if(SHADE_NONE!=opts.shadeSliders)
+
+ setDecorationColors(true);
+
+ switch(opts.shadeSliders)
{
- itsSliderCols=new QColor [TOTAL_SHADES+1];
- shadeColors(SHADE_BLEND_SELECTED==opts.shadeSliders
- ? midColor(itsMenuitemCols[ORIGINAL_SHADE],
- itsButtonCols[ORIGINAL_SHADE])
- : opts.customSlidersColor,
- itsSliderCols);
+ default:
+ case SHADE_DARKEN:
+ case SHADE_NONE:
+ break;
+ case SHADE_SELECTED:
+ itsSliderCols=itsHighlightCols;
+ break;
+ case SHADE_BLEND_SELECTED:
+ case SHADE_CUSTOM:
+ if(!itsSliderCols)
+ itsSliderCols=new QColor [TOTAL_SHADES+1];
+ shadeColors(SHADE_BLEND_SELECTED==opts.shadeSliders
+ ? midColor(itsHighlightCols[ORIGINAL_SHADE],
+ itsButtonCols[ORIGINAL_SHADE])
+ : opts.customSlidersColor,
+ itsSliderCols);
}
- if(IND_COLORED==opts.defBtnIndicator)
- if(SHADE_BLEND_SELECTED==opts.shadeSliders)
- itsDefBtnCols=itsSliderCols;
- else
- {
+ switch(opts.defBtnIndicator)
+ {
+ case IND_GLOW:
+ case IND_SELECTED:
+ itsDefBtnCols=itsHighlightCols;
+ break;
+ case IND_TINT:
itsDefBtnCols=new QColor [TOTAL_SHADES+1];
- shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE],
- itsButtonCols[ORIGINAL_SHADE]), itsDefBtnCols);
- }
+ shadeColors(tint(itsButtonCols[ORIGINAL_SHADE],
+ itsHighlightCols[ORIGINAL_SHADE], DEF_BNT_TINT), itsDefBtnCols);
+ break;
+ default:
+ break;
+ case IND_COLORED:
+ if(SHADE_BLEND_SELECTED==opts.shadeSliders)
+ itsDefBtnCols=itsSliderCols;
+ else
+ {
+ itsDefBtnCols=new QColor [TOTAL_SHADES+1];
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE],
+ itsButtonCols[ORIGINAL_SHADE]), itsDefBtnCols);
+ }
+ }
+
+ switch(opts.comboBtn)
+ {
+ default:
+ case SHADE_DARKEN:
+ case SHADE_NONE:
+ break;
+ case SHADE_SELECTED:
+ itsComboBtnCols=itsHighlightCols;
+ break;
+ case SHADE_BLEND_SELECTED:
+ if(opts.shadeSliders==SHADE_BLEND_SELECTED)
+ {
+ itsComboBtnCols=itsSliderCols;
+ break;
+ }
+ case SHADE_CUSTOM:
+ if(opts.shadeSliders==SHADE_CUSTOM && opts.customSlidersColor==opts.customComboBtnColor)
+ {
+ itsComboBtnCols=itsSliderCols;
+ break;
+ }
+ if(!itsComboBtnCols)
+ itsComboBtnCols=new QColor [TOTAL_SHADES+1];
+ shadeColors(SHADE_BLEND_SELECTED==opts.comboBtn
+ ? midColor(itsHighlightCols[ORIGINAL_SHADE],
+ itsButtonCols[ORIGINAL_SHADE])
+ : opts.customComboBtnColor,
+ itsComboBtnCols);
+ }
- if(opts.coloredMouseOver)
- if(itsDefBtnCols)
- itsMouseOverCols=itsDefBtnCols;
- else
- {
- itsMouseOverCols=new QColor [TOTAL_SHADES+1];
- shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE],
- itsButtonCols[ORIGINAL_SHADE]), itsMouseOverCols);
- }
+ switch(opts.sortedLv)
+ {
+ case SHADE_DARKEN:
+ if(!itsSortedLvColors)
+ itsSortedLvColors=new QColor [TOTAL_SHADES+1];
+ shadeColors(shade(opts.lvButton ? itsButtonCols[ORIGINAL_SHADE] : itsBackgroundCols[ORIGINAL_SHADE], LV_HEADER_DARK_FACTOR), itsSortedLvColors);
+ break;
+ default:
+ case SHADE_NONE:
+ break;
+ case SHADE_SELECTED:
+ itsSortedLvColors=itsHighlightCols;
+ break;
+ case SHADE_BLEND_SELECTED:
+ if(SHADE_BLEND_SELECTED==opts.shadeSliders)
+ {
+ itsSortedLvColors=itsSliderCols;
+ break;
+ }
+ else if(SHADE_BLEND_SELECTED==opts.comboBtn)
+ {
+ itsSortedLvColors=itsComboBtnCols;
+ break;
+ }
+ case SHADE_CUSTOM:
+ if(opts.shadeSliders==SHADE_CUSTOM && opts.customSlidersColor==opts.customSortedLvColor)
+ {
+ itsSortedLvColors=itsSliderCols;
+ break;
+ }
+ if(opts.comboBtn==SHADE_CUSTOM && opts.customComboBtnColor==opts.customSortedLvColor)
+ {
+ itsSortedLvColors=itsComboBtnCols;
+ break;
+ }
+ if(!itsSortedLvColors)
+ itsSortedLvColors=new QColor [TOTAL_SHADES+1];
+ shadeColors(SHADE_BLEND_SELECTED==opts.sortedLv
+ ? midColor(itsHighlightCols[ORIGINAL_SHADE],
+ (opts.lvButton ? itsButtonCols[ORIGINAL_SHADE] : itsBackgroundCols[ORIGINAL_SHADE]))
+ : opts.customSortedLvColor,
+ itsSortedLvColors);
+ }
+
+ switch(opts.crColor)
+ {
+ default:
+ case SHADE_NONE:
+ itsCheckRadioSelCols=itsButtonCols;
+ break;
+ case SHADE_DARKEN:
+ if(!itsCheckRadioSelCols)
+ itsCheckRadioSelCols=new QColor [TOTAL_SHADES+1];
+ shadeColors(shade(itsButtonCols[ORIGINAL_SHADE], LV_HEADER_DARK_FACTOR), itsCheckRadioSelCols);
+ break;
+ case SHADE_SELECTED:
+ itsCheckRadioSelCols=itsHighlightCols;
+ break;
+ case SHADE_CUSTOM:
+ if(SHADE_CUSTOM==opts.shadeSliders && opts.customSlidersColor==opts.customCrBgndColor)
+ itsCheckRadioSelCols=itsSliderCols;
+ else if(SHADE_CUSTOM==opts.comboBtn && opts.customComboBtnColor==opts.customCrBgndColor)
+ itsCheckRadioSelCols=itsComboBtnCols;
+ else if(SHADE_CUSTOM==opts.sortedLv && opts.customSortedLvColor==opts.customCrBgndColor)
+ itsCheckRadioSelCols=itsSortedLvColors;
+ else
+ {
+ if(!itsCheckRadioSelCols)
+ itsCheckRadioSelCols=new QColor [TOTAL_SHADES+1];
+ shadeColors(opts.customCrBgndColor, itsCheckRadioSelCols);
+ }
+ break;
+ case SHADE_BLEND_SELECTED:
+ if(SHADE_BLEND_SELECTED==opts.shadeSliders)
+ itsCheckRadioSelCols=itsSliderCols;
+ else if(SHADE_BLEND_SELECTED==opts.comboBtn)
+ itsCheckRadioSelCols=itsComboBtnCols;
+ else if(SHADE_BLEND_SELECTED==opts.sortedLv)
+ itsCheckRadioSelCols=itsSortedLvColors;
+ else
+ {
+ if(!itsCheckRadioSelCols)
+ itsCheckRadioSelCols=new QColor [TOTAL_SHADES+1];
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]), itsCheckRadioSelCols);
+ }
+ }
+
+ switch(opts.progressColor)
+ {
+ case SHADE_NONE:
+ itsProgressCols=itsBackgroundCols;
+ break;
+ default:
+ // Not set!
+ break;
+ case SHADE_CUSTOM:
+ if(SHADE_CUSTOM==opts.shadeSliders && opts.customSlidersColor==opts.customProgressColor)
+ itsProgressCols=itsSliderCols;
+ else if(SHADE_CUSTOM==opts.comboBtn && opts.customComboBtnColor==opts.customProgressColor)
+ itsProgressCols=itsComboBtnCols;
+ else if(SHADE_CUSTOM==opts.sortedLv && opts.customSortedLvColor==opts.customProgressColor)
+ itsProgressCols=itsSortedLvColors;
+ else if(SHADE_CUSTOM==opts.crColor && opts.customCrBgndColor==opts.customProgressColor)
+ itsProgressCols=itsCheckRadioSelCols;
+ else
+ {
+ if(!itsProgressCols)
+ itsProgressCols=new QColor [TOTAL_SHADES+1];
+ shadeColors(opts.customProgressColor, itsProgressCols);
+ }
+ break;
+ case SHADE_BLEND_SELECTED:
+ if(SHADE_BLEND_SELECTED==opts.shadeSliders)
+ itsProgressCols=itsSliderCols;
+ else if(SHADE_BLEND_SELECTED==opts.comboBtn)
+ itsProgressCols=itsComboBtnCols;
+ else if(SHADE_BLEND_SELECTED==opts.sortedLv)
+ itsProgressCols=itsSortedLvColors;
+ else
+ {
+ if(!itsProgressCols)
+ itsProgressCols=new QColor [TOTAL_SHADES+1];
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsBackgroundCols[ORIGINAL_SHADE]), itsProgressCols);
+ }
+ }
setMenuColors(QApplication::palette().active());
- if(opts.lighterPopupMenuBgnd)
+ if(USE_LIGHTER_POPUP_MENU)
itsLighterPopupMenuBgndCol=shade(itsBackgroundCols[ORIGINAL_SHADE],
- POPUPMENU_LIGHT_FACTOR);
+ TO_FACTOR(opts.lighterPopupMenuBgnd));
+
+ if ((SHADE_CUSTOM==opts.shadeMenubars || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars) &&
+ "soffice.bin"==QString(qApp->argv()[0]) && TOO_DARK(SHADE_CUSTOM==opts.shadeMenubars
+ ? opts.customMenubarsColor
+ : itsHighlightCols[ORIGINAL_SHADE]))
+ opts.shadeMenubars=SHADE_DARKEN;
switch(opts.shadeCheckRadio)
{
default:
- itsCheckRadioCol=QApplication::palette().active().text();
+ itsCheckRadioCol=opts.crButton ? QApplication::palette().active().buttonText()
+ : QApplication::palette().active().text();
break;
case SHADE_BLEND_SELECTED:
case SHADE_SELECTED:
@@ -663,12 +1112,28 @@ QtCurveStyle::~QtCurveStyle()
if(itsSidebarButtonsCols!=itsSliderCols &&
itsSidebarButtonsCols!=itsDefBtnCols)
delete [] itsSidebarButtonsCols;
+ if(itsActiveMdiColors && itsActiveMdiColors!=itsHighlightCols)
+ delete [] itsActiveMdiColors;
+ if(itsMdiColors && itsMdiColors!=itsBackgroundCols)
+ delete [] itsMdiColors;
if(itsMouseOverCols && itsMouseOverCols!=itsDefBtnCols &&
itsMouseOverCols!=itsSliderCols)
delete [] itsMouseOverCols;
- if(itsDefBtnCols && itsDefBtnCols!=itsSliderCols)
+ if(itsDefBtnCols && itsDefBtnCols!=itsSliderCols && itsDefBtnCols!=itsFocusCols && itsDefBtnCols!=itsHighlightCols)
delete [] itsDefBtnCols;
- if(itsSliderCols && itsSliderCols!=itsMenuitemCols)
+ if(itsProgressCols && itsProgressCols!=itsHighlightCols && itsProgressCols!=itsBackgroundCols &&
+ itsProgressCols!=itsSliderCols && itsProgressCols!=itsComboBtnCols && itsProgressCols!=itsCheckRadioSelCols && itsProgressCols!=itsSortedLvColors)
+ delete [] itsProgressCols;
+ if(itsCheckRadioSelCols && itsCheckRadioSelCols!=itsDefBtnCols && itsCheckRadioSelCols!=itsSliderCols &&
+ itsCheckRadioSelCols!=itsComboBtnCols && itsCheckRadioSelCols!=itsSortedLvColors &&
+ itsCheckRadioSelCols!=itsButtonCols && itsCheckRadioSelCols!=itsHighlightCols)
+ delete [] itsCheckRadioSelCols;
+ if(itsSortedLvColors && itsSortedLvColors!=itsHighlightCols && itsSortedLvColors!=itsSliderCols &&
+ itsSortedLvColors!=itsComboBtnCols)
+ delete [] itsSortedLvColors;
+ if(itsComboBtnCols && itsComboBtnCols!=itsHighlightCols && itsComboBtnCols!=itsSliderCols)
+ delete [] itsComboBtnCols;
+ if(itsSliderCols && itsSliderCols!=itsHighlightCols)
delete [] itsSliderCols;
delete itsMactorPal;
}
@@ -689,10 +1154,13 @@ void QtCurveStyle::polish(QApplication *app)
{
QString appName(getFile(app->argv()[0]));
+ if(NULL!=getenv("QTCURVE_DEBUG"))
+ std::cout << "QtCurve: Application name: \"" << appName.latin1() << "\"\n";
+
if ("kicker"==appName || "appletproxy"==appName)
{
itsThemedApp=APP_KICKER;
-#if KDE_VERSION >= 0x30200
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
itsIsTransKicker=kickerIsTrans();
#endif
}
@@ -700,12 +1168,15 @@ void QtCurveStyle::polish(QApplication *app)
itsThemedApp=APP_KONTACT;
else if ("konqueror"==appName)
itsThemedApp=APP_KONQUEROR;
+ else if ("kate"==appName)
+ itsThemedApp=APP_KATE;
else if ("kpresenter"==appName)
itsThemedApp=APP_KPRESENTER;
else if ("soffice.bin"==appName)
{
itsThemedApp=APP_OPENOFFICE;
- opts.framelessGroupBoxes=false;
+ opts.groupBox=FRAME_PLAIN;
+ opts.gbLabel=0;
}
else if ("kdefilepicker"==appName)
itsThemedApp=APP_SKIP_TASKBAR;
@@ -719,10 +1190,12 @@ void QtCurveStyle::polish(QApplication *app)
itsThemedApp=APP_TORA;
else if ("opera"==appName)
itsThemedApp=APP_OPERA;
+ else if ("systemsettings"==appName)
+ itsThemedApp=APP_SYSTEMSETTINGS;
else if ("korn"==appName)
{
itsThemedApp=APP_KORN;
-#if KDE_VERSION >= 0x30200
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
itsIsTransKicker=kickerIsTrans();
#endif
}
@@ -737,12 +1210,31 @@ void QtCurveStyle::polish(QApplication *app)
if(APP_OPENOFFICE==itsThemedApp)
{
+ //
+ // OO.o 2.x checks to see whether the used theme "inherits" from HighContrastStyle,
+ // if so it uses the highlightedText color to draw highlighted menubar and popup menu
+ // items. Otherwise it uses the standard color. Changing the metaobject's class name
+ // works around this...
+ if(opts.useHighlightForMenu)
+ {
+ QMetaObject *meta=(QMetaObject *)metaObject();
+
+ meta->classname="HighContrastStyle";
+ }
+
if(opts.scrollbarType==SCROLLBAR_NEXT)
opts.scrollbarType=SCROLLBAR_KDE;
else if(opts.scrollbarType==SCROLLBAR_NONE)
opts.scrollbarType=SCROLLBAR_WINDOWS;
setSbType();
}
+
+ if(SHADE_NONE!=opts.menuStripe && opts.noMenuStripeApps.contains(appName))
+ opts.menuStripe=SHADE_NONE;
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
+ if(opts.fixParentlessDialogs && (opts.noDlgFixApps.contains(appName) || opts.noDlgFixApps.contains("kde")))
+ opts.fixParentlessDialogs=false;
+#endif
}
void QtCurveStyle::polish(QPalette &pal)
@@ -751,16 +1243,13 @@ void QtCurveStyle::polish(QPalette &pal)
pal.active().background()!=itsMactorPal->active().background())
return;
- QPalette pal4;
- QFont font;
QSettings settings;
+ int contrast(settings.readNumEntry("/Qt/KDE/contrast", DEFAULT_CONTRAST));
+ bool newContrast(false);
- if(readQt4(pal4, font))
- {
- pal=pal4;
- QApplication::setFont(font);
- }
- else if(!opts.inactiveHighlight)// Read in Qt3 palette... Required for the inactive settings...
+ readKdeGlobals();
+
+ if(!kdeSettings.inactiveHighlight)// Read in Qt3 palette... Required for the inactive settings...
{
QStringList active(settings.readListEntry("/Qt/Palette/active")),
inactive(settings.readListEntry("/Qt/Palette/inactive"));
@@ -775,7 +1264,7 @@ void QtCurveStyle::polish(QPalette &pal)
QColor(active[QColorGroup::HighlightedText])==pal.color(QPalette::Active, QColorGroup::HighlightedText))
{
QColor h(inactive[QColorGroup::Highlight]),
- t(inactive[QColorGroup::HighlightedText]);
+ t(inactive[QColorGroup::HighlightedText]);
if(h!=pal.color(QPalette::Inactive, QColorGroup::Highlight) || t!=QPalette::Inactive, QColorGroup::HighlightedText)
{
@@ -785,40 +1274,52 @@ void QtCurveStyle::polish(QPalette &pal)
}
}
- if(opts.inactiveHighlight)
+ if(contrast<0 || contrast>10)
+ contrast=DEFAULT_CONTRAST;
+
+ if(contrast!=opts.contrast)
{
- pal.setColor(QPalette::Inactive, QColorGroup::Highlight,
- midColor(pal.color(QPalette::Active, QColorGroup::Background),
- pal.color(QPalette::Active, QColorGroup::Highlight), INACTIVE_HIGHLIGHT_FACTOR));
- pal.setColor(QPalette::Inactive, QColorGroup::HighlightedText, pal.color(QPalette::Active, QColorGroup::Foreground));
+ opts.contrast=contrast;
+ newContrast=true;
}
- int c(settings.readNumEntry("/Qt/KDE/contrast", 7));
- bool newContrast(false);
-
- if(c<0 || c>10)
- c=7;
-
- if(c!=opts.contrast)
+ if(kdeSettings.inactiveHighlight)
{
- opts.contrast=c;
- newContrast=true;
+ pal.setColor(QPalette::Inactive, QColorGroup::Highlight,
+ tint(QApplication::palette().active().background(),
+ QApplication::palette().active().highlight(), 0.4));
+ // KDE4 does not set text colour :-(
+ //pal.setColor(QPalette::Inactive, QColorGroup::HighlightedText, pal.color(QPalette::Active, QColorGroup::Foreground));
}
bool newMenu(newContrast ||
- itsMenuitemCols[ORIGINAL_SHADE]!=QApplication::palette().active().highlight()),
+ itsHighlightCols[ORIGINAL_SHADE]!=QApplication::palette().active().highlight()),
newGray(newContrast ||
itsBackgroundCols[ORIGINAL_SHADE]!=QApplication::palette().active().background()),
newButton(newContrast ||
itsButtonCols[ORIGINAL_SHADE]!=QApplication::palette().active().button()),
newSlider(itsSliderCols && SHADE_BLEND_SELECTED==opts.shadeSliders &&
(newContrast || newButton || newMenu)),
- newDefBtn(itsDefBtnCols && IND_COLORED==opts.defBtnIndicator &&
- SHADE_BLEND_SELECTED!=opts.shadeSliders &&
+ newDefBtn(itsDefBtnCols && /*( (IND_COLORED==opts.defBtnIndicator &&*/
+ SHADE_BLEND_SELECTED!=opts.shadeSliders/*) ||*/
+ /*(IND_TINT==opts.defBtnIndicator) )*/ &&
+ IND_SELECTED!=opts.defBtnIndicator && IND_GLOW!=opts.defBtnIndicator &&
(newContrast || newButton || newMenu)),
- newMouseOver(itsMouseOverCols && itsMouseOverCols!=itsDefBtnCols &&
- itsMouseOverCols!=itsSliderCols &&
- (newContrast || newButton || newMenu));
+ newComboBtn(itsComboBtnCols && itsHighlightCols!=itsComboBtnCols && itsSliderCols!=itsComboBtnCols &&
+ SHADE_BLEND_SELECTED==opts.comboBtn &&
+ (newContrast || newButton || newMenu)),
+ newSortedLv(itsSortedLvColors && ( (SHADE_BLEND_SELECTED==opts.sortedLv && itsHighlightCols!=itsSortedLvColors && itsSliderCols!=itsSortedLvColors &&
+ itsComboBtnCols!=itsSortedLvColors) ||
+ SHADE_DARKEN==opts.sortedLv) &&
+ (newContrast || (opts.lvButton ? newButton : newGray))),
+ newCheckRadioSelCols(itsCheckRadioSelCols && ( (SHADE_BLEND_SELECTED==opts.crColor && itsDefBtnCols!=itsCheckRadioSelCols &&
+ itsSliderCols!=itsCheckRadioSelCols && itsComboBtnCols!=itsCheckRadioSelCols &&
+ itsSortedLvColors!=itsCheckRadioSelCols) ||
+ SHADE_DARKEN==opts.crColor) &&
+ (newContrast || newButton)),
+ newProgressCols(itsProgressCols && SHADE_BLEND_SELECTED==opts.progressColor &&
+ itsSliderCols!=itsProgressCols && itsComboBtnCols!=itsProgressCols &&
+ itsSortedLvColors!=itsProgressCols && itsCheckRadioSelCols!=itsProgressCols && (newContrast || newButton));
if(newGray)
shadeColors(QApplication::palette().active().background(), itsBackgroundCols);
@@ -827,72 +1328,60 @@ void QtCurveStyle::polish(QPalette &pal)
shadeColors(QApplication::palette().active().button(), itsButtonCols);
if(newMenu)
- shadeColors(QApplication::palette().active().highlight(), itsMenuitemCols);
+ shadeColors(QApplication::palette().active().highlight(), itsHighlightCols);
+
+ setDecorationColors();
setMenuColors(QApplication::palette().active());
if(newSlider)
- shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE],
- itsButtonCols[ORIGINAL_SHADE]), itsSliderCols);
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]), itsSliderCols);
- if(newDefBtn)
- shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE],
- itsButtonCols[ORIGINAL_SHADE]), itsDefBtnCols);
+ if(newComboBtn)
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]), itsComboBtnCols);
- if(newMouseOver)
- shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE],
- itsButtonCols[ORIGINAL_SHADE]), itsMouseOverCols);
+ if(newSortedLv)
+ if(SHADE_BLEND_SELECTED==opts.sortedLv)
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE],
+ opts.lvButton ? itsButtonCols[ORIGINAL_SHADE] : itsBackgroundCols[ORIGINAL_SHADE]), itsSortedLvColors);
+ else
+ shadeColors(shade(opts.lvButton ? itsButtonCols[ORIGINAL_SHADE] : itsBackgroundCols[ORIGINAL_SHADE], LV_HEADER_DARK_FACTOR), itsSortedLvColors);
+
+ if(newDefBtn)
+ if(IND_TINT==opts.defBtnIndicator)
+ shadeColors(tint(itsButtonCols[ORIGINAL_SHADE],
+ itsHighlightCols[ORIGINAL_SHADE], DEF_BNT_TINT), itsDefBtnCols);
+ else if(IND_GLOW!=opts.defBtnIndicator)
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE],
+ itsButtonCols[ORIGINAL_SHADE]), itsDefBtnCols);
if(itsSidebarButtonsCols && SHADE_BLEND_SELECTED!=opts.shadeSliders &&
IND_COLORED!=opts.defBtnIndicator)
- shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE],
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE],
itsButtonCols[ORIGINAL_SHADE]), itsSidebarButtonsCols);
- if(opts.lighterPopupMenuBgnd && newGray)
+ if(USE_LIGHTER_POPUP_MENU && newGray)
itsLighterPopupMenuBgndCol=shade(itsBackgroundCols[ORIGINAL_SHADE],
- POPUPMENU_LIGHT_FACTOR);
-
- const QColorGroup &actGroup(pal.active()),
- &inactGroup(pal.inactive()),
- &disGroup(pal.disabled());
- const QColor *use(backgroundColors(actGroup));
- QColorGroup newAct(actGroup.foreground(), actGroup.button(), use[0], use[QT_STD_BORDER],
- actGroup.mid(), actGroup.text(), actGroup.brightText(),
- actGroup.base(), actGroup.background());
- QColorGroup::ColorRole roles[]={QColorGroup::Midlight, QColorGroup::ButtonText,
- QColorGroup::Shadow, QColorGroup::Highlight,
- QColorGroup::HighlightedText,
- QColorGroup::NColorRoles };
- int r(0);
+ TO_FACTOR(opts.lighterPopupMenuBgnd));
- for(r=0; roles[r]!=QColorGroup::NColorRoles; ++r)
- newAct.setColor(roles[r], actGroup.color(roles[r]));
- pal.setActive(newAct);
-
- use=backgroundColors(inactGroup);
-
- QColorGroup newInact(inactGroup.foreground(), inactGroup.button(), use[0], use[QT_STD_BORDER],
- inactGroup.mid(), inactGroup.text(), inactGroup.brightText(),
- inactGroup.base(), inactGroup.background());
-
- for(r=0; roles[r]!=QColorGroup::NColorRoles; ++r)
- newInact.setColor(roles[r], inactGroup.color(roles[r]));
- pal.setInactive(newInact);
-
- use=backgroundColors(disGroup);
+ if(newCheckRadioSelCols)
+ if(SHADE_BLEND_SELECTED==opts.crColor)
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]), itsCheckRadioSelCols);
+ else
+ shadeColors(shade(itsButtonCols[ORIGINAL_SHADE], LV_HEADER_DARK_FACTOR), itsCheckRadioSelCols);
- QColorGroup newDis(disGroup.foreground(), disGroup.button(), use[0], use[QT_STD_BORDER],
- disGroup.mid(), disGroup.text(), disGroup.brightText(),
- disGroup.base(), disGroup.background());
+ if(newProgressCols)
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsBackgroundCols[ORIGINAL_SHADE]), itsProgressCols);
- for(r=0; roles[r]!=QColorGroup::NColorRoles; ++r)
- newDis.setColor(roles[r], disGroup.color(roles[r]));
- pal.setDisabled(newDis);
+ pal.setActive(setColorGroup(pal.active(), pal.active()));
+ pal.setInactive(setColorGroup(pal.inactive(), pal.active()));
+ pal.setDisabled(setColorGroup(pal.disabled(), pal.active(), true));
switch(opts.shadeCheckRadio)
{
default:
- itsCheckRadioCol=QApplication::palette().active().text();
+ itsCheckRadioCol=opts.crButton ? QApplication::palette().active().buttonText()
+ : QApplication::palette().active().text();
break;
case SHADE_SELECTED:
case SHADE_BLEND_SELECTED:
@@ -904,13 +1393,56 @@ void QtCurveStyle::polish(QPalette &pal)
if(itsMactorPal)
*itsMactorPal=pal;
+ // Force this to be re-generated!
+ if(SHADE_BLEND_SELECTED==opts.menuStripe)
+ opts.customMenuStripeColor=Qt::black;
+
+ if(APPEARANCE_STRIPED==opts.bgndAppearance)
+ pal.setBrush(QColorGroup::Background, QBrush(pal.active().background(), *createStripePixmap(pal.active().background(), true)));
+}
+
+static QColor disable(const QColor &col, const QColor &bgnd)
+{
+ QColor c = col;
+ c = ColorUtils_darken(&c, 0.1, 1.0);
+ c = ColorUtils_mix(&c, &bgnd, 0.65);
+ return c;
+}
+
+QColorGroup QtCurveStyle::setColorGroup(const QColorGroup &old, const QColorGroup &act, bool dis)
+{
+ QColor mid(old.mid());
+
+ if(dis)
+ mid=disable(act.foreground(), old.background());
+
+ const QColor *use(backgroundColors(old));
+ QColorGroup newGrp(old.foreground(), old.button(), use[0], use[STD_BORDER],
+ mid, old.text(), old.brightText(),
+ old.base(), old.background());
+ QColorGroup::ColorRole roles[]={QColorGroup::Midlight, QColorGroup::ButtonText,
+ QColorGroup::Shadow, QColorGroup::Highlight,
+ QColorGroup::HighlightedText, QColorGroup::Link,
+ QColorGroup::LinkVisited, QColorGroup::NColorRoles };
+ int r(0);
+
+ for(r=0; roles[r]!=QColorGroup::NColorRoles; ++r)
+ newGrp.setColor(roles[r], old.color(roles[r]));
+
+ if(dis)
+ {
+ newGrp.setColor(QColorGroup::ButtonText, disable(act.buttonText(), old.button()));
+ newGrp.setColor(QColorGroup::Text, disable(act.text(), old.background()));
+ }
+
+ return newGrp;
}
static const char * kdeToolbarWidget="kde toolbar widget";
void QtCurveStyle::polish(QWidget *widget)
{
- bool enableFilter(!equal(opts.highlightFactor, 1.0) || opts.coloredMouseOver);
+ bool enableFilter(opts.highlightFactor || opts.coloredMouseOver);
if(::isKhtmlFormWidget(widget))
{
@@ -918,6 +1450,15 @@ void QtCurveStyle::polish(QWidget *widget)
connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(khtmlWidgetDestroyed(QObject *)));
}
+ if(enableFilter && isSpecialHover(widget))
+ connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(hoverWidgetDestroyed(QObject *)));
+
+ if(isWindowDragWidget(widget))
+ widget->installEventFilter(this);
+
+ if(APPEARANCE_STRIPED==opts.bgndAppearance && (::qt_cast<QDialog *>(widget) || ::qt_cast<QMainWindow *>(widget)))
+ setBgndProp(widget, APPEARANCE_STRIPED);
+
if(widget->parentWidget() && ::qt_cast<QScrollView *>(widget) && ::qt_cast<QComboBox *>(widget->parentWidget()))
{
QPalette pal(widget->palette());
@@ -928,12 +1469,12 @@ void QtCurveStyle::polish(QWidget *widget)
#if 0
if(opts.gtkComboMenus)
- act.setColor(QColorGroup::Base, opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]);
+ act.setColor(QColorGroup::Base, USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]);
act.setColor(QColorGroup::Background, opts.gtkComboMenus
- ? opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]
+ ? USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]
: QApplication::palette().active().base());
#endif
- act.setColor(QColorGroup::Foreground, itsBackgroundCols[QT_STD_BORDER]);
+ act.setColor(QColorGroup::Foreground, itsBackgroundCols[STD_BORDER]);
pal.setActive(act);
widget->setPalette(pal);
@@ -962,9 +1503,32 @@ void QtCurveStyle::polish(QWidget *widget)
0==qstrcmp(widget->parentWidget()->className(), "Kontact::MainWindow"))
((QHBox *)widget)->setLineWidth(0);
+ if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::qt_cast<const QPopupMenu *>(widget))
+ widget->installEventFilter(this);
+
+ #if 0
+ if(opts.menubarHiding && ::qt_cast<QMainWindow *>(widget) && static_cast<QMainWindow *>(widget)->menuBar())
+ widget->installEventFilter(this);
+ #endif
+
+ if ((opts.square&SQUARE_SCROLLVIEW) && widget &&
+ (::qt_cast<const QScrollView *>(widget) ||
+ (widget->parentWidget() && ::qt_cast<const QFrame *>(widget) &&
+ widget->parentWidget()->inherits("KateView"))) &&
+ ((QFrame *)widget)->lineWidth()>1)
+ ((QFrame *)widget)->setLineWidth(opts.gtkScrollViews ? 1 : 2);
+ else if(!opts.popupBorder && widget &&
+ (::qt_cast<const QPopupMenu *>(widget) ||
+ (widget->parentWidget() && ::qt_cast<const QListBox *>(widget) &&
+ ::qt_cast<const QComboBox *>(widget->parentWidget()))))
+ ((QFrame *)widget)->setLineWidth(0);
+ else if ((USE_LIGHTER_POPUP_MENU || !IS_FLAT_BGND(opts.menuBgndAppearance)) && !opts.borderMenuitems &&
+ widget && ::qt_cast<const QPopupMenu *>(widget))
+ ((QFrame *)widget)->setLineWidth(1);
+
if (::qt_cast<QRadioButton *>(widget) || ::qt_cast<QCheckBox *>(widget))
{
- bool framelessGroupBoxCheckBox=(opts.framelessGroupBoxes && isCheckBoxOfGroupBox(widget));
+ bool framelessGroupBoxCheckBox=(NO_FRAME(opts.groupBox) && isCheckBoxOfGroupBox(widget));
if(framelessGroupBoxCheckBox || enableFilter)
{
@@ -998,7 +1562,7 @@ void QtCurveStyle::polish(QWidget *widget)
if(enableFilter)
{
widget->installEventFilter(this);
-#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
+#if defined KDE_VERSION && KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
widget->setMouseTracking(true);
#endif
}
@@ -1018,7 +1582,7 @@ void QtCurveStyle::polish(QWidget *widget)
widget->setBackgroundMode(PaletteBackground);
widget->installEventFilter(this);
- if(QTC_DO_EFFECT && onToolBar(widget))
+ if(DO_EFFECT && onToolBar(widget))
widget->setName(kdeToolbarWidget);
if(enableFilter)
@@ -1027,12 +1591,52 @@ void QtCurveStyle::polish(QWidget *widget)
if(((QComboBox *)widget)->listBox())
((QComboBox *)widget)->listBox()->installEventFilter(this);
}
- else if(::qt_cast<QMenuBar *>(widget) || ::qt_cast<QToolBar *>(widget))
+ else if(::qt_cast<QMenuBar *>(widget))
{
if(NoBackground!=widget->backgroundMode())
widget->setBackgroundMode(PaletteBackground);
if(SHADE_NONE!=opts.shadeMenubars)
widget->installEventFilter(this);
+ if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR)
+ emitMenuSize(widget, widget->rect().height());
+ if(SHADE_WINDOW_BORDER==opts.shadeMenubars)
+ {
+ QPalette pal(widget->palette());
+ QColorGroup act(pal.active());
+ QColorGroup inact(pal.inactive());
+
+ getMdiColors(act, true);
+ act.setColor(QColorGroup::Foreground, itsActiveMdiTextColor);
+ inact.setColor(QColorGroup::Foreground, opts.shadeMenubarOnlyWhenActive ? itsMdiTextColor : itsActiveMdiTextColor);
+ pal.setInactive(inact);
+ pal.setActive(act);
+ widget->setPalette(pal);
+ }
+ else if(opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
+ (SHADE_CUSTOM==opts.shadeMenubars && TOO_DARK(itsMenubarCols[ORIGINAL_SHADE])))
+ {
+ QPalette pal(widget->palette());
+ QColorGroup act(pal.active());
+
+ act.setColor(QColorGroup::Foreground, opts.customMenuTextColor
+ ? opts.customMenuNormTextColor
+ : QApplication::palette().active().highlightedText());
+
+ if(!opts.shadeMenubarOnlyWhenActive)
+ {
+ QColorGroup inact(pal.inactive());
+ inact.setColor(QColorGroup::Foreground, act.color(QColorGroup::Foreground));
+ pal.setInactive(inact);
+ }
+
+ pal.setActive(act);
+ widget->setPalette(pal);
+ }
+ }
+ else if(::qt_cast<QToolBar *>(widget))
+ {
+ if(NoBackground!=widget->backgroundMode())
+ widget->setBackgroundMode(PaletteBackground);
}
else if(::qt_cast<QPopupMenu *>(widget))
widget->setBackgroundMode(NoBackground); // PaletteBackground);
@@ -1061,6 +1665,9 @@ void QtCurveStyle::polish(QWidget *widget)
{
widget->setName(kdeToolbarWidget);
widget->setBackgroundMode(NoBackground); // We paint whole background.
+
+ if(!enableFilter)
+ widget->installEventFilter(this);
}
// This bit stolen form polyester...
@@ -1077,7 +1684,7 @@ void QtCurveStyle::polish(QWidget *widget)
::qt_cast<QFrame *>(widget))
((QFrame *)widget)->setLineWidth(0);
}
- else if (widget->inherits("QSplitterHandle") || widget->inherits("QDockWindowHandle"))
+ else if (widget->inherits("QSplitterHandle") || widget->inherits("QDockWindowHandle") || widget->inherits("QDockWindowResizeHandle"))
{
if(enableFilter)
widget->installEventFilter(this);
@@ -1120,18 +1727,16 @@ void QtCurveStyle::polish(QWidget *widget)
}
if(opts.animatedProgress)
- {
- widget->installEventFilter(this);
- itsProgAnimWidgets[widget] = 0;
- connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(progressBarDestroyed(QObject *)));
- if (!itsAnimationTimer->isActive())
- itsAnimationTimer->start(PROGRESS_ANIMATION, false);
- }
+ {
+ widget->installEventFilter(this);
+ itsProgAnimWidgets[widget] = 0;
+ connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(progressBarDestroyed(QObject *)));
+ if (!itsAnimationTimer->isActive())
+ itsAnimationTimer->start(PROGRESS_ANIMATION, false);
+ }
}
-#ifdef QTC_HIGHLIGHT_SCROLVIEWS
- else if(::qt_cast<QScrollView*>(widget))
+ else if(opts.highlightScrollViews && ::qt_cast<QScrollView*>(widget))
widget->installEventFilter(this);
-#endif
else if(!qstrcmp(widget->className(), "KonqFrameStatusBar"))
{
// This disables the white background of the KonquerorFrameStatusBar.
@@ -1145,15 +1750,21 @@ void QtCurveStyle::polish(QWidget *widget)
pal.setColor(QColorGroup::Midlight, pal.active().background());
QApplication::setPalette(pal);
}
- else if(widget->inherits("KTabCtl") || (opts.framelessGroupBoxes && ::qt_cast<QGroupBox *>(widget)))
+ else if(widget->inherits("KTabCtl"))
widget->installEventFilter(this);
+ else if(NO_FRAME(opts.groupBox) && ::qt_cast<QGroupBox *>(widget))
+ {
+ ((QGroupBox *)widget)->setFlat(false);
+ ((QGroupBox *)widget)->setFrameShape(QFrame::NoFrame);
+ }
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
else if(opts.fixParentlessDialogs && ::qt_cast<QDialog *>(widget))
{
QDialog *dlg=(QDialog *)widget;
// The parent->isShown is needed for KWord. It's insert picure file dialog is a child of
// the insert picture dialog - but the file dialog is shown *before* the picture dialog!
- if( (QTC_SKIP_TASKBAR && !dlg->parentWidget()) ||
+ if( (SKIP_TASKBAR && !dlg->parentWidget()) ||
( (!dlg->parentWidget() || !dlg->parentWidget()->isShown())// &&
/*(dlg->isModal() || ::qt_cast<QProgressDialog *>(widget))*/) )
widget->installEventFilter(this);
@@ -1175,8 +1786,36 @@ void QtCurveStyle::polish(QWidget *widget)
(index+17)==(int)cap.length())) )
widget->QWidget::setCaption(cap.left(index));
}
+#endif
+
+ if(APP_SYSTEMSETTINGS==itsThemedApp)
+ {
+ if(widget && widget->parentWidget() && widget->parentWidget()->parentWidget() &&
+ ::qt_cast<QFrame *>(widget) && QFrame::NoFrame!=((QFrame *)widget)->frameShape() &&
+ ::qt_cast<QFrame *>(widget->parentWidget()) &&
+ ::qt_cast<QTabWidget *>(widget->parentWidget()->parentWidget()))
+ ((QFrame *)widget)->setFrameShape(QFrame::NoFrame);
+
+ if(widget->parentWidget() && widget->parentWidget()->parentWidget() &&
+ ::qt_cast<QScrollView *>(widget->parentWidget()->parentWidget()) &&
+ widget->inherits("KCMultiWidget") && widget->parentWidget()->inherits("QViewportWidget"))
+ ((QScrollView *)(widget->parentWidget()->parentWidget()))->setLineWidth(0);
+ }
- KStyle::polish(widget);
+ if(opts.tabBgnd && widget && widget->parentWidget() && ::qt_cast<QWidgetStack *>(widget) &&
+ ::qt_cast<QTabWidget *>(widget->parentWidget()) &&
+ 0==qstrcmp(widget->name(), "tab pages"))
+ {
+ QPalette pal(widget->palette());
+
+ pal.setColor(QColorGroup::Background, shade(pal.active().background(), TO_FACTOR(opts.tabBgnd)));
+ widget->setBackgroundMode(PaletteBackground);
+ widget->setPalette(pal);
+ }
+
+ if(APPEARANCE_STRIPED==opts.bgndAppearance)
+ widget->setBackgroundOrigin(QWidget::WindowOrigin);
+ BASE_STYLE::polish(widget);
}
void QtCurveStyle::unPolish(QWidget *widget)
@@ -1184,6 +1823,17 @@ void QtCurveStyle::unPolish(QWidget *widget)
if(isFormWidget(widget))
itsKhtmlWidgets.remove(widget);
+ if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::qt_cast<const QPopupMenu *>(widget))
+ widget->removeEventFilter(this);
+
+ #if 0
+ if(opts.menubarHiding && ::qt_cast<QMainWindow *>(widget) && static_cast<QMainWindow *>(widget)->menuBar())
+ widget->removeEventFilter(this);
+ #endif
+
+ if(isWindowDragWidget(widget))
+ widget->removeEventFilter(this);
+
if (::qt_cast<QRadioButton *>(widget) || ::qt_cast<QCheckBox *>(widget))
{
#if QT_VERSION >= 0x030200
@@ -1208,7 +1858,7 @@ void QtCurveStyle::unPolish(QWidget *widget)
if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget))
widget->setBackgroundMode(PaletteButton);
widget->removeEventFilter(this);
-#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
+#if defined KDE_VERSION && KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
widget->setMouseTracking(false);
#endif
}
@@ -1232,6 +1882,9 @@ void QtCurveStyle::unPolish(QWidget *widget)
widget->setBackgroundMode(PaletteBackground);
if(SHADE_NONE!=opts.shadeMenubars)
widget->removeEventFilter(this);
+ if(SHADE_WINDOW_BORDER==opts.shadeMenubars || opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars ||
+ SHADE_SELECTED==opts.shadeMenubars || (SHADE_CUSTOM==opts.shadeMenubars &&TOO_DARK(itsMenubarCols[ORIGINAL_SHADE])))
+ widget->setPalette(QApplication::palette());
}
else if (widget->inherits("KToolBarSeparator"))
{
@@ -1252,17 +1905,15 @@ void QtCurveStyle::unPolish(QWidget *widget)
}
else if (::qt_cast<QLineEdit*>(widget) || ::qt_cast<QTextEdit*>(widget))
widget->removeEventFilter(this);
- else if (widget->inherits("QSplitterHandle") || widget->inherits("QDockWindowHandle"))
+ else if (widget->inherits("QSplitterHandle") || widget->inherits("QDockWindowHandle") || widget->inherits("QDockWindowResizeHandle"))
widget->removeEventFilter(this);
else if (::qt_cast<QProgressBar*>(widget))
{
itsProgAnimWidgets.remove(widget);
widget->removeEventFilter(this);
}
-#ifdef QTC_HIGHLIGHT_SCROLVIEWS
- else if(::qt_cast<QScrollView*>(widget))
+ else if(opts.highlightScrollViews && ::qt_cast<QScrollView*>(widget))
widget->removeEventFilter(this);
-#endif
else if(0==qstrcmp(widget->name(), kdeToolbarWidget))
{
widget->removeEventFilter(this);
@@ -1273,12 +1924,14 @@ void QtCurveStyle::unPolish(QWidget *widget)
widget->removeEventFilter(this);
widget->setBackgroundMode(PaletteBackground); // We paint whole background.
}
- else if(widget->inherits("KTabCtl") || (opts.framelessGroupBoxes && ::qt_cast<QGroupBox *>(widget)))
+ else if(widget->inherits("KTabCtl"))
widget->removeEventFilter(this);
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
else if(opts.fixParentlessDialogs && ::qt_cast<QDialog *>(widget))
widget->removeEventFilter(this);
+#endif
- KStyle::unPolish(widget);
+ BASE_STYLE::unPolish(widget);
}
static void sendXEvent(QDialog *dlg, const char *msg)
@@ -1319,14 +1972,23 @@ bool QtCurveStyle::appIsNotEmbedded(QDialog *dlg)
bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
{
if(itsHoverWidget && object==itsHoverWidget && (QEvent::Destroy==event->type() || QEvent::Hide==event->type()))
+ resetHover();
+
+ #if 0
+ // Works for qtconfig, but k3b hangs?
+ if(opts.menubarHiding && QEvent::KeyRelease==event->type() && ::qt_cast<QMainWindow *>(object))
{
- itsOldPos.setX(-1);
- itsOldPos.setY(-1);
- itsHoverWidget=NULL;
- itsIsSpecialHover=false;
- itsHoverSect=QTC_NO_SECT;
- itsHover=HOVER_NONE;
+ QMainWindow *window=static_cast<QMainWindow *>(object);
+
+ if(window->isVisible() && window->menuBar())
+ {
+ QKeyEvent *k=static_cast<QKeyEvent *>(event);
+
+ if(k->state()&Qt::ControlButton && k->state()&Qt::AltButton && Qt::Key_M==k->key())
+ window->menuBar()->setHidden(window->menuBar()->isVisible());
+ }
}
+ #endif
if(object->parent() && 0==qstrcmp(object->name(), kdeToolbarWidget))
{
@@ -1371,11 +2033,11 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
}
if(!::qt_cast<QLineEdit*>(object) && !::qt_cast<QTextEdit*>(object) &&
- !(QTC_DO_EFFECT && ::qt_cast<QComboBox*>(object)))
+ !(DO_EFFECT && ::qt_cast<QComboBox*>(object)))
return false; // Now draw the contents
}
}
- else if (opts.framelessGroupBoxes && QEvent::Move==event->type() && isCheckBoxOfGroupBox(object))
+ else if (NO_FRAME(opts.groupBox) && QEvent::Move==event->type() && isCheckBoxOfGroupBox(object))
{
QCheckBox *cb=static_cast<QCheckBox *>(object);
QRect r(cb->geometry());
@@ -1391,38 +2053,18 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
}
else if (QEvent::Paint==event->type())
{
- if (opts.framelessGroupBoxes && ::qt_cast<QGroupBox *>(object))
+ if(!IS_FLAT_BGND(opts.menuBgndAppearance) && ::qt_cast<QPopupMenu *>(object))
{
- QGroupBox *box=static_cast<QGroupBox*>(object);
-
- if (!box->isCheckable())
- {
- QString title(box->title());
+ QWidget *widget=(QWidget*)object;
+ QPainter painter(widget);
+ QColor col(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : widget->palette().active().background());
- if(title.length())
- {
- int left,
- right,
- top,
- bottom,
- width,
- height;
- QPainter p(box);
- QFontMetrics fm(p.fontMetrics());
- QRect r(box->rect());
- int th(fm.height()+2);
- QFont f(p.font());
-
- r.rect(&left, &top, &width, &height);
- r.coords(&left, &top, &right, &bottom);
- f.setBold(true);
- p.setPen(box->colorGroup().foreground());
- p.setFont(f);
- p.drawText(QRect(left, top, width, th),
- (QApplication::reverseLayout() ? AlignRight : AlignLeft)|AlignVCenter|ShowPrefix|SingleLine, title);
- return true;
- }
- }
+ if(APPEARANCE_STRIPED==opts.menuBgndAppearance)
+ painter.drawTiledPixmap(widget->rect(), *createStripePixmap(col, false));
+ else
+ drawBevelGradientReal(col, &painter, widget->rect(), GT_HORIZ==opts.menuBgndGrad, false,
+ opts.menuBgndAppearance, WIDGET_OTHER);
+ return false;
}
else if (object->inherits("KToolBarSeparator"))
{
@@ -1446,7 +2088,7 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
{
QWidget *widget((QWidget*)object);
QObject *child(object->child("_tabbar"));
- QTabBar *tb(child ? ::qt_cast<QTabBar *>(child) : NULL);
+ QTabBar *tb(child ? ::qt_cast<QTabBar *>(child) : 0L);
QPainter painter(widget);
QRect r(widget->rect());
int tbHeight(tb ? tb->height()-1 : 28);
@@ -1496,7 +2138,7 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
r.setY(r.y()-y_offset);
r.setHeight(parent->rect().height());
- drawMenuOrToolBarBackground(&p, r, parent->colorGroup(), true, true);
+ drawMenuOrToolBarBackground(&p, r, parent->colorGroup());
return true;
}
}
@@ -1505,7 +2147,7 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
// focus highlight
if (::qt_cast<QLineEdit*>(object) || ::qt_cast<QTextEdit*>(object)/* || ::qt_cast<QDateTimeEditBase*>(object)*/)
{
- if((QEvent::FocusIn==event->type() || QEvent::FocusOut==event->type()))
+ if(QEvent::FocusIn==event->type() || QEvent::FocusOut==event->type() || QEvent::Enter==event->type() || QEvent::Leave==event->type())
{
QWidget *widget(static_cast<QWidget*>(object));
@@ -1520,22 +2162,114 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
return false;
}
- if(opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars &&
- ::qt_cast<QMenuBar *>(object))
+ if(::qt_cast<QMenuBar *>(object))
+ {
+ bool useWindowCols=SHADE_WINDOW_BORDER==opts.shadeMenubars;
+
+ if( (useWindowCols || opts.customMenuTextColor || SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
+ SHADE_CUSTOM==opts.shadeMenubars) && QEvent::Paint==event->type())
+ {
+ const QColor &col(((QWidget *)object)->palette().active().color(QColorGroup::Foreground));
+
+ // If we're relouring the menubar text, check to see if menubar palette has changed, if so set back to
+ // our values. This fixes opera - which seems to change the widgets palette after it is polished.
+ if((opts.customMenuTextColor && col!=opts.customMenuNormTextColor) ||
+ ( (SHADE_BLEND_SELECTED==opts.shadeMenubars || SHADE_SELECTED==opts.shadeMenubars ||
+ (SHADE_CUSTOM==opts.shadeMenubars && TOO_DARK(itsMenubarCols[ORIGINAL_SHADE]))) &&
+ col!=QApplication::palette().active().highlightedText()))
+ {
+ QPalette pal(((QWidget *)object)->palette());
+ QColorGroup act(pal.active());
+
+ act.setColor(QColorGroup::Foreground, useWindowCols
+ ? itsActiveMdiTextColor
+ : opts.customMenuTextColor
+ ? opts.customMenuNormTextColor
+ : QApplication::palette().active().highlightedText());
+
+ if(!opts.shadeMenubarOnlyWhenActive || useWindowCols)
+ {
+ QColorGroup inact(pal.inactive());
+ inact.setColor(QColorGroup::Foreground, useWindowCols ? itsMdiTextColor : act.color(QColorGroup::Foreground));
+ pal.setInactive(inact);
+ }
+
+ pal.setActive(act);
+ ((QWidget *)object)->setPalette(pal);
+ }
+ }
+
+ if(opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars)
+ switch(event->type())
+ {
+ case QEvent::WindowActivate:
+ itsActive=true;
+ ((QWidget *)object)->repaint(false);
+ return false;
+ case QEvent::WindowDeactivate:
+ itsActive=false;
+ ((QWidget *)object)->repaint(false);
+ return false;
+ default:
+ break;
+ }
+ if(BLEND_TITLEBAR || opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR)
+ switch(event->type())
+ {
+ case QEvent::Resize:
+ {
+ QResizeEvent *re = static_cast<QResizeEvent *>(event);
+
+ if (re->size().height() != re->oldSize().height())
+ emitMenuSize((QMenuBar *)object, re->size().height());
+ break;
+ }
+ }
+ }
+
+ if(dynamic_cast<QMouseEvent*>(event))
switch(event->type())
{
- case QEvent::WindowActivate:
- itsActive=true;
- ((QWidget *)object)->repaint(false);
- return false;
- case QEvent::WindowDeactivate:
- itsActive=false;
- ((QWidget *)object)->repaint(false);
- return false;
- default:
+ case QEvent::MouseMove: // Only occurs for widgets with mouse tracking enabled
+ if(itsDragWidget)
+ {
+ itsDragWidget->setMouseTracking(itsDragWidgetHadMouseTracking);
+ bool move=isWindowDragWidget(object);
+
+ if(move)
+ triggerWMMove(itsDragWidget, ((QMouseEvent *)event)->globalPos());
+ itsDragWidget = 0L;
+ return move;
+ }
+ case QEvent::MouseButtonPress:
+ {
+ QMouseEvent *mev = (QMouseEvent *)event;
+
+ if(isWindowDragWidget(object, mev->pos()))
+ {
+
+ if(/*Qt::NoModifier==mev->modifiers() && */ Qt::LeftButton==mev->button())
+ {
+ QWidget *wid = static_cast<QWidget*>(object);
+ itsDragWidget=wid;
+ itsDragWidgetHadMouseTracking=itsDragWidget->hasMouseTracking();
+ itsDragWidget->setMouseTracking(true);
+ return false;
+ }
+ }
break;
+ }
+ case QEvent::MouseButtonRelease:
+ if(itsDragWidget)
+ {
+ itsDragWidget->setMouseTracking(itsDragWidgetHadMouseTracking);
+ itsDragWidget = 0L;
+ return false;
+ }
+ break;
}
+#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
if(opts.fixParentlessDialogs && ::qt_cast<QDialog *>(object))
{
QDialog *dlg=(QDialog *)object;
@@ -1543,7 +2277,7 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
switch(event->type())
{
case QEvent::ShowMinimized:
- if(QTC_SKIP_TASKBAR && appIsNotEmbedded(dlg))
+ if(SKIP_TASKBAR && appIsNotEmbedded(dlg))
{
// Ugly hack :-( Cant seem to get KWin to remove the minimize button. So when
// the dialog gets minimized, restore.
@@ -1552,7 +2286,7 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
}
break;
case QEvent::WindowActivate:
- if(QTC_SKIP_TASKBAR && appIsNotEmbedded(dlg))
+ if(SKIP_TASKBAR && appIsNotEmbedded(dlg))
{
// OO.o's filepicker is a spawned process - but is not set transient :-(
// --plus no reliable way of finding which widget to make it transient for...
@@ -1608,6 +2342,7 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
}
return false;
}
+#endif
// Track show events for progress bars
if (opts.animatedProgress && ::qt_cast<QProgressBar*>(object))
@@ -1619,13 +2354,11 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
switch(event->type())
{
-#ifdef QTC_HIGHLIGHT_SCROLVIEWS
case QEvent::FocusIn:
case QEvent::FocusOut:
- if(object->isWidgetType() && ::qt_cast<QScrollView*>(object))
+ if(opts.highlightScrollViews && object->isWidgetType() && ::qt_cast<QScrollView*>(object))
((QWidget *)object)->repaint(false);
break;
-#endif
case QEvent::Hide:
case QEvent::Show:
if(::qt_cast<QListBox *>(object) &&
@@ -1646,7 +2379,7 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
{
if(::qt_cast<QTabBar*>(object) && static_cast<QWidget*>(object)->isEnabled())
{
- itsHoverTab=NULL;
+ itsHoverTab=0L;
itsHoverWidget->repaint(false);
}
else if(!itsHoverWidget->hasMouseTracking() ||
@@ -1657,36 +2390,16 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
}
}
else
- itsHoverWidget=NULL;
-
- if(itsHoverWidget && !itsIsSpecialHover &&
- (
-#if QT_VERSION >= 0x030200
- ::qt_cast<QRadioButton *>(itsHoverWidget) ||
- ::qt_cast<QCheckBox *>(itsHoverWidget) ||
-#endif
- ::qt_cast<QScrollBar *>(itsHoverWidget) ||
-#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
- ::qt_cast<QToolButton *>(itsHoverWidget) ||
-
-#endif
- ::qt_cast<QHeader *>(itsHoverWidget) ||
- ::qt_cast<QSpinWidget *>(itsHoverWidget) ||
- ::qt_cast<QComboBox *>(itsHoverWidget) ||
- ::qt_cast<QTabBar *>(itsHoverWidget)))
+ itsHoverWidget=0L;
+ if(itsHoverWidget && !itsIsSpecialHover && isSpecialHover(itsHoverWidget))
itsIsSpecialHover=true;
}
break;
case QEvent::Leave:
if(itsHoverWidget && object==itsHoverWidget)
{
- itsOldPos.setX(-1);
- itsOldPos.setY(-1);
- itsHoverWidget=NULL;
- itsHoverSect=QTC_NO_SECT;
- itsHover=HOVER_NONE;
- itsHoverTab=NULL;
+ resetHover();
((QWidget *)object)->repaint(false);
}
break;
@@ -1706,7 +2419,7 @@ bool QtCurveStyle::eventFilter(QObject *object, QEvent *event)
break;
}
- return KStyle::eventFilter(object, event);
+ return BASE_STYLE::eventFilter(object, event);
}
void QtCurveStyle::drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &rOrig,
@@ -1719,18 +2432,26 @@ void QtCurveStyle::drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &
br(r);
bool bevelledButton(WIDGET_BUTTON(w) && APPEARANCE_BEVELLED==app),
sunken(flags &(Style_Down|Style_On|Style_Sunken)),
- lightBorder(QTC_DRAW_LIGHT_BORDER(sunken , w, app)),
- doColouredMouseOver(doBorder &&
+ flatWidget(WIDGET_PROGRESSBAR==w && !opts.borderProgress),
+ lightBorder(!flatWidget && DRAW_LIGHT_BORDER(sunken , w, app)),
+ draw3dfull(!flatWidget && !lightBorder && DRAW_3D_FULL_BORDER(sunken, app)),
+ draw3d(!flatWidget && (draw3dfull || (!lightBorder && DRAW_3D_BORDER(sunken, app)))),
+ doColouredMouseOver(!sunken && doBorder &&
opts.coloredMouseOver && flags&Style_MouseOver &&
- (!IS_SLIDER(w) || (WIDGET_SB_SLIDER==w && MO_PLASTIK==opts.coloredMouseOver)) &&
- (flags&QTC_CHECK_BUTTON || flags&QTC_TOGGLE_BUTTON || !sunken)),
+ WIDGET_SPIN!=w && WIDGET_COMBO_BUTTON!=w && WIDGET_SB_BUTTON!=w &&
+ (WIDGET_SB_SLIDER!=w || !opts.colorSliderMouseOver) &&
+ !(flags&DW_CLOSE_BUTTON) &&
+ (opts.coloredTbarMo || !(flags&STD_TOOLBUTTON)) &&
+ (flags&CHECK_BUTTON || flags&TOGGLE_BUTTON || !sunken)),
plastikMouseOver(doColouredMouseOver && MO_PLASTIK==opts.coloredMouseOver),
- colouredMouseOver(doColouredMouseOver && MO_COLORED==opts.coloredMouseOver),
- doEtch(!itsFormMode && doBorder && ETCH_WIDGET(w) && !(flags&QTC_CHECK_BUTTON) &&
- QTC_DO_EFFECT),
+ colouredMouseOver(doColouredMouseOver &&
+ (MO_COLORED==opts.coloredMouseOver || MO_COLORED_THICK==opts.coloredMouseOver ||
+ (MO_GLOW==opts.coloredMouseOver && itsFormMode))),
+ doEtch(!itsFormMode && doBorder && ETCH_WIDGET(w) && !(flags&CHECK_BUTTON) &&
+ DO_EFFECT),
+ glowFocus(doEtch && USE_GLOW_FOCUS(flags&Style_MouseOver) && flags&Style_HasFocus && flags&Style_Enabled),
+ sunkenToggleMo(sunken && !(flags&Style_Down) && flags&(Style_MouseOver|TOGGLE_BUTTON)),
horiz(flags&Style_Horizontal);
- int dark(bevelledButton ? 2 : 4),
- c1(sunken ? dark : 0);
const QColor *cols(custom ? custom : itsBackgroundCols),
*border(colouredMouseOver ? borderColors(flags, cols) : cols);
@@ -1738,26 +2459,44 @@ void QtCurveStyle::drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &
if(doEtch)
{
- r.addCoords(0, 1, 0, -1);
+ r.addCoords(1, 1, -1, -1);
br=r;
}
+ // fill
+ if(br.width()>0 && br.height()>0)
+ {
+ // Adjust paint rect, so that gradient is drawn from the same coords as KDE4 and Gtk2
+ if(WIDGET_PROGRESSBAR==w && opts.stripedProgress)
+ {
+ p->save();
+ p->setClipRegion(p->clipRegion().eor(QRegion(br)));
+ }
+ br.addCoords(1, 1,-1,-1);
+ drawBevelGradient(fill, p, br, horiz, sunken, app, w);
+ br.addCoords(-1, -1, 1, 1);
+ if(WIDGET_PROGRESSBAR==w && opts.stripedProgress)
+ p->restore();
+ }
+
if(!colouredMouseOver && lightBorder)
br.addCoords(1, 1,-1,-1);
- else if(colouredMouseOver || (!IS_GLASS(app) && !sunken && flags&Style_Raised))
+ else if(colouredMouseOver || (draw3d && flags&Style_Raised))
{
+ int dark(/*bevelledButton ? */2/* : 4*/);
+
if(colouredMouseOver)
- p->setPen(border[QTC_MO_STD_LIGHT(w, sunken)]);
+ p->setPen(border[MO_STD_LIGHT(w, sunken)]);
else
- p->setPen(border[c1]);
- if(colouredMouseOver || bevelledButton || APPEARANCE_RAISED==app)
+ p->setPen(border[sunken ? dark : 0]);
+ if(colouredMouseOver || bevelledButton || draw3dfull)
{
//Left & top
p->drawLine(br.x()+1, br.y()+2, br.x()+1, br.y()+br.height()-3);
p->drawLine(br.x()+1, br.y()+1, br.x()+br.width()-2, br.y()+1);
if(colouredMouseOver)
- p->setPen(border[QTC_MO_STD_DARK(w)]);
+ p->setPen(border[MO_STD_DARK(w)]);
else
p->setPen(border[sunken ? 0 : dark]);
//Right & bottom
@@ -1785,7 +2524,7 @@ void QtCurveStyle::drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &
br.addCoords(1,1,-1,-1);
p->drawRect(br);
- if(WIDGET_PROGRESSBAR==w && !IS_GLASS(app))
+ if(IS_CUSTOM(app) || (WIDGET_PROGRESSBAR==w && (!IS_GLASS(app) || opts.fillProgress)))
br.addCoords(1,1,-1,-1);
else if(horiz)
br.addCoords(1,0,-1,-1);
@@ -1794,37 +2533,29 @@ void QtCurveStyle::drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &
}
// fill
- if(br.width()>0 && br.height()>0)
- {
- drawBevelGradient(fill, !sunken, p, br, horiz, getWidgetShade(w, true, sunken, app),
- getWidgetShade(w, false, sunken, app), sunken, app, w);
-
+ if(br.width()>0 && br.height()>0 && (!sunken || sunkenToggleMo))
if(plastikMouseOver)
{
if(WIDGET_SB_SLIDER==w)
{
- int len(QTC_SB_SLIDER_MO_LEN(horiz ? r.width() : r.height())),
- so(lightBorder ? QTC_SLIDER_MO_BORDER : 1),
+ int len(SB_SLIDER_MO_LEN(horiz ? r.width() : r.height())),
+ so(lightBorder ? SLIDER_MO_PLASTIK_BORDER : 1),
eo(len+so),
- col(QTC_SLIDER_MO_SHADE);
+ col(SLIDER_MO_SHADE);
if(horiz)
{
- drawBevelGradient(itsMouseOverCols[col], !sunken, p, QRect(r.x()+so, r.y(), len, r.height()),
- horiz, getWidgetShade(w, true, sunken, app),
- getWidgetShade(w, false, sunken, app), sunken, app, w);
- drawBevelGradient(itsMouseOverCols[col], !sunken, p, QRect(r.x()+r.width()-eo, r.y(), len, r.height()),
- horiz, getWidgetShade(w, true, sunken, app),
- getWidgetShade(w, false, sunken, app), sunken, app, w);
+ drawBevelGradient(itsMouseOverCols[col], p, QRect(r.x()+so, r.y(), len, r.height()),
+ horiz, sunken, app, w);
+ drawBevelGradient(itsMouseOverCols[col], p, QRect(r.x()+r.width()-eo, r.y(), len, r.height()),
+ horiz, sunken, app, w);
}
else
{
- drawBevelGradient(itsMouseOverCols[col], !sunken, p, QRect(r.x(), r.y()+so, r.width(), len),
- horiz, getWidgetShade(w, true, sunken, app),
- getWidgetShade(w, false, sunken, app), sunken, app, w);
- drawBevelGradient(itsMouseOverCols[col], !sunken, p, QRect(r.x(), r.y()+r.height()-eo, r.width(), len),
- horiz, getWidgetShade(w, true, sunken, app),
- getWidgetShade(w, false, sunken, app), sunken, app, w);
+ drawBevelGradient(itsMouseOverCols[col], p, QRect(r.x(), r.y()+so, r.width(), len),
+ horiz, sunken, app, w);
+ drawBevelGradient(itsMouseOverCols[col], p, QRect(r.x(), r.y()+r.height()-eo, r.width(), len),
+ horiz, sunken, app, w);
}
}
else
@@ -1832,7 +2563,7 @@ void QtCurveStyle::drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &
bool horizontal((horiz && WIDGET_SB_BUTTON!=w)|| (!horiz && WIDGET_SB_BUTTON==w)),
thin(WIDGET_SB_BUTTON==w || WIDGET_SPIN==w || ((horiz ? r.height() : r.width())<16));
- p->setPen(itsMouseOverCols[QTC_MO_PLASTIK_DARK(w)]);
+ p->setPen(itsMouseOverCols[MO_PLASTIK_DARK(w)]);
if(horizontal)
{
p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1);
@@ -1845,7 +2576,7 @@ void QtCurveStyle::drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &
}
if(!thin)
{
- p->setPen(itsMouseOverCols[QTC_MO_PLASTIK_LIGHT(w)]);
+ p->setPen(itsMouseOverCols[MO_PLASTIK_LIGHT(w)]);
if(horizontal)
{
p->drawLine(r.x()+1, r.y()+2, r.x()+r.width()-2, r.y()+2);
@@ -1859,42 +2590,128 @@ void QtCurveStyle::drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &
}
}
}
- }
+ else if(colouredMouseOver && 0!=round && FULLLY_ROUNDED)
+ {
+ p->setPen(itsMouseOverCols[MO_STD_LIGHT(w, sunken)]);
+
+ if(round&CORNER_TL)
+ p->drawPoint(br.left(), br.top());
+ if(round&CORNER_BL)
+ p->drawPoint(br.left(), br.bottom());
+ if(round&CORNER_BR)
+ p->drawPoint(br.right(), br.bottom());
+ if(round&CORNER_TR)
+ p->drawPoint(br.right(), br.top());
+ }
if(doBorder)
- drawBorder(bgnd, p, r, cg, flags, round, cols, w, doCorners);
+ {
+ const QColor *borderCols=glowFocus ||
+ (WIDGET_COMBO==w && USE_GLOW_FOCUS(flags&Style_MouseOver) && flags&Style_HasFocus && flags&Style_Enabled)
+ ? itsFocusCols
+ : (WIDGET_COMBO==w || WIDGET_COMBO_BUTTON==w) && cols==itsComboBtnCols
+ ? flags&Style_MouseOver && MO_GLOW==opts.coloredMouseOver && !sunken
+ ? itsMouseOverCols
+ : itsButtonCols
+ : cols;
+
+ if((!sunken || sunkenToggleMo) && flags&Style_Enabled && !glowFocus &&
+ ((((doEtch && WIDGET_OTHER!=w && WIDGET_SLIDER_TROUGH!=w) || WIDGET_COMBO==w || WIDGET_SB_SLIDER==w) &&
+ MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver) ||
+ (WIDGET_DEF_BUTTON==w && IND_GLOW==opts.defBtnIndicator)))
+ drawBorder(bgnd, p, r, cg, flags, round,
+ WIDGET_DEF_BUTTON==w && IND_GLOW==opts.defBtnIndicator &&
+ (!(flags&Style_MouseOver) || !itsMouseOverCols)
+ ? itsDefBtnCols : itsMouseOverCols, w, doCorners);
+ else
+ drawBorder(bgnd, p, r, cg, flags, round,
+ colouredMouseOver && MO_COLORED_THICK==opts.coloredMouseOver ? itsMouseOverCols : borderCols,
+ w, doCorners);
+ }
- if(doEtch)
- drawEtch(p, rOrig, cg, true, true, EFFECT_SHADOW==opts.buttonEffect && WIDGET_BUTTON(w) && !sunken);
+ if(doEtch || glowFocus)
+ if( (!sunken || sunkenToggleMo) &&
+ ((WIDGET_OTHER!=w && WIDGET_SLIDER_TROUGH!=w && MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver) ||
+ glowFocus ||
+ (WIDGET_DEF_BUTTON==w && IND_GLOW==opts.defBtnIndicator)/* ||
+ (flags&Style_HasFocus && FOCUS_FULL==opts.focus)*/ ))
+ drawGlow(p, rOrig, cg, WIDGET_DEF_BUTTON==w && flags&Style_MouseOver ? WIDGET_STD_BUTTON : w,
+ glowFocus ? itsFocusCols : 0);
+ else
+ drawEtch(p, rOrig, cg, EFFECT_SHADOW==opts.buttonEffect && WIDGET_BUTTON(w) && !sunken, ROUNDED_NONE==round);
p->restore();
}
-void QtCurveStyle::drawEtch(QPainter *p, const QRect &r, const QColorGroup &cg, bool top, bool bot, bool raised) const
+void QtCurveStyle::drawGlow(QPainter *p, const QRect &r, const QColorGroup &cg, EWidget w, const QColor *cols) const
{
- if(top && !raised)
+ if(itsMouseOverCols || itsDefBtnCols || cols)
{
- QColor darkCol(shade(cg.background(), QTC_ETCHED_DARK));
-
- p->setPen(darkCol);
- p->drawLine(r.x()+2, r.y(), r.x()+r.width()-3, r.y());
- p->setPen(midColor(darkCol, cg.background()));
- p->drawPoint(r.x()+1, r.y());
- p->drawPoint(r.x()+r.width()-2, r.y());
- p->drawPoint(r.x(), r.y()+1);
- p->drawPoint(r.x()+r.width()-1, r.y()+1);
+ bool def(WIDGET_DEF_BUTTON==w && IND_GLOW==opts.defBtnIndicator),
+ defShade=def && (!itsDefBtnCols ||
+ (itsMouseOverCols && itsDefBtnCols[ORIGINAL_SHADE]==itsMouseOverCols[ORIGINAL_SHADE]));
+ QColor col(cols ? cols[GLOW_MO]
+ : (def && itsDefBtnCols) || !itsMouseOverCols
+ ? itsDefBtnCols[GLOW_DEFBTN] : itsMouseOverCols[GLOW_MO]);
+
+ col=midColorF(cg.background(), col, 1.5-GLOW_ALPHA(defShade));
+ p->setPen(col);
+ if(ROUND_NONE==opts.round)
+ p->drawRect(r);
+ else
+ {
+ p->drawLine(r.x()+2, r.y()+r.height()-1, r.x()+r.width()-3, r.y()+r.height()-1);
+ p->drawLine(r.x()+r.width()-1, r.y()+2, r.x()+r.width()-1, r.y()+r.height()-3);
+ p->drawLine(r.x()+3, r.y(), r.x()+r.width()-4, r.y());
+ p->drawLine(r.x(), r.y()+3, r.x(), r.y()+r.height()-4);
+ //p->setPen(midColor(col, cg.background()));
+ p->drawLine(r.x()+r.width()-1, r.y()+r.height()-3, r.x()+r.width()-3, r.y()+r.height()-1);
+ p->drawLine(r.x(), r.y()+r.height()-3, r.x()+2, r.y()+r.height()-1);
+ p->drawLine(r.x(), r.y()+2, r.x()+2, r.y());
+ p->drawLine(r.x()+r.width()-3, r.y(), r.x()+r.width()-1, r.y()+2);
+ p->setPen(midColor(col, cg.background()));
+ p->drawLine(r.x()+r.width()-1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-1);
+ p->drawLine(r.x(), r.y()+r.height()-2, r.x()+1, r.y()+r.height()-1);
+ p->drawLine(r.x(), r.y()+1, r.x()+1, r.y());
+ p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-1, r.y()+1);
+ }
}
- if(bot)
+}
+
+void QtCurveStyle::drawEtch(QPainter *p, const QRect &r, const QColorGroup &cg, bool raised, bool square) const
+{
+ square=square || ROUND_NONE==opts.round;
+
+ int mod(square ? 0 : 2);
+
{
- QColor col(raised ? shade(cg.background(), QTC_ETCHED_DARK) : itsBackgroundCols[1]);
+ QColor col(raised ? shade(cg.background(), ETCHED_DARK) : itsBackgroundCols[1]);
p->setPen(col);
- p->drawLine(r.x()+2, r.y()+r.height()-1, r.x()+r.width()-3, r.y()+r.height()-1);
- p->setPen(midColor(raised ? col : itsBackgroundCols[0], cg.background()));
- p->drawPoint(r.x()+1, r.y()+r.height()-1);
- p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-1);
- p->drawPoint(r.x(), r.y()+r.height()-2);
- p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-2);
+ p->drawLine(r.x()+mod, r.y()+r.height()-1, r.x()+r.width()-(1+mod), r.y()+r.height()-1);
+ p->drawLine(r.x()+r.width()-1, r.y()+mod, r.x()+r.width()-1, r.y()+r.height()-(1+mod));
+ if(!square)
+ {
+ p->setPen(midColor(raised ? col : itsBackgroundCols[0], cg.background()));
+ p->drawLine(r.x()+r.width()-1, r.y()+r.height()-3, r.x()+r.width()-3, r.y()+r.height()-1);
+ p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+2, r.y()+r.height()-1);
+ p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-1, r.y()+2);
+ }
+ }
+ if(!raised)
+ {
+ QColor darkCol(shade(cg.background(), ETCHED_DARK));
+
+ p->setPen(darkCol);
+ p->drawLine(r.x()+1+mod, r.y(), r.x()+r.width()-(2+mod), r.y());
+ p->drawLine(r.x(), r.y()+1+mod, r.x(), r.y()+r.height()-(2+mod));
+ if(!square)
+ {
+ p->setPen(midColor(darkCol, cg.background()));
+ p->drawLine(r.x(), r.y()+2, r.x()+2, r.y());
+ p->drawLine(r.x()+r.width()-3, r.y(), r.x()+r.width()-2, r.y()+1);
+ p->drawLine(r.x(), r.y()+r.height()-3, r.x()+1, r.y()+r.height()-2);
+ }
}
}
@@ -1907,8 +2724,19 @@ void QtCurveStyle::drawBorder(const QColor &bgnd, QPainter *p, const QRect &r, c
QColor border(flags&Style_ButtonDefault && IND_FONT_COLOR==opts.defBtnIndicator &&
flags&Style_Enabled
? cg.buttonText()
- : cols[!(flags&Style_Enabled) && (WIDGET_BUTTON(w) || WIDGET_SLIDER_TROUGH==w || flags&QTC_CHECK_BUTTON)
- ? QT_DISABLED_BORDER : borderVal]);
+ : cols[WIDGET_PROGRESSBAR==w
+ ? PBAR_BORDER
+ : !(flags&Style_Enabled) && (WIDGET_BUTTON(w) || WIDGET_SLIDER_TROUGH==w ||
+ flags&CHECK_BUTTON)
+ ? DISABLED_BORDER
+ : itsMouseOverCols==cols && IS_SLIDER(w)
+ ? SLIDER_MO_BORDER_VAL
+ : borderVal]);
+ bool hasFocus(cols==itsFocusCols /* CPD USED TO INDICATE FOCUS! */),
+ hasMouseOver(cols==itsMouseOverCols && ENTRY_MO);
+
+ if(WIDGET_TAB_BOT==w || WIDGET_TAB_TOP==w)
+ cols=itsBackgroundCols;
switch(borderProfile)
{
@@ -1916,28 +2744,40 @@ void QtCurveStyle::drawBorder(const QColor &bgnd, QPainter *p, const QRect &r, c
break;
case BORDER_RAISED:
case BORDER_SUNKEN:
- p->setPen(flags&Style_Enabled && (BORDER_RAISED==borderProfile || APPEARANCE_FLAT!=app)
- ? blendBorderColors
- ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile
- ? 0 : QT_FRAME_DARK_SHADOW]) // Was base???
- : cols[BORDER_RAISED==borderProfile ? 0 : QT_FRAME_DARK_SHADOW]
- : cg.background());
+ case BORDER_LIGHT:
+ if(flags&Style_Enabled && (hasMouseOver || hasFocus) && (WIDGET_ENTRY==w || WIDGET_SCROLLVIEW==w || WIDGET_COMBO==w || WIDGET_SPIN==w))
+ p->setPen(midColorF(cg.background(), cols[BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile
+ ? 0 : FRAME_DARK_SHADOW], 1.5-ENTRY_INNER_ALPHA));
+ else
+ p->setPen(flags&Style_Enabled && (BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile || APPEARANCE_FLAT!=app)
+ ? blendBorderColors
+ ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile
+ ? 0 : FRAME_DARK_SHADOW]) // Was base???
+ : cols[BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile ? 0 : FRAME_DARK_SHADOW]
+ : cg.background());
p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2);
p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1);
- p->setPen(flags&Style_Enabled && (BORDER_SUNKEN==borderProfile || APPEARANCE_FLAT!=app)
- ? blendBorderColors
- ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile
- ? QT_FRAME_DARK_SHADOW : 0]) // Was base???
- : cols[BORDER_RAISED==borderProfile ? QT_FRAME_DARK_SHADOW : 0]
- : cg.background());
+ if(!hasFocus && !hasMouseOver && BORDER_LIGHT!=borderProfile)
+ p->setPen(WIDGET_SCROLLVIEW==w
+ ? cg.background()
+ : WIDGET_ENTRY==w
+ ? cg.base()
+ : flags&Style_Enabled && (BORDER_SUNKEN==borderProfile || APPEARANCE_FLAT!=app ||
+ WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w)
+ ? blendBorderColors
+ ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile
+ ? FRAME_DARK_SHADOW : 0]) // Was base???
+ : cols[BORDER_RAISED==borderProfile ? FRAME_DARK_SHADOW : 0]
+ : cg.background());
p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()+r.height()-2);
p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-2);
}
- if(QTC_ROUNDED && ROUNDED_NONE!=round)
+ if(ROUNDED && ROUNDED_NONE!=round)
{
- bool largeArc(ROUND_FULL==opts.round && !(flags&QTC_CHECK_BUTTON) &&
- r.width()>=QTC_MIN_BTN_SIZE && r.height()>=QTC_MIN_BTN_SIZE);
+ bool largeArc(WIDGET_FOCUS!=w && FULLLY_ROUNDED && !(flags&CHECK_BUTTON) &&
+ r.width()>=MIN_ROUND_FULL_SIZE && r.height()>=MIN_ROUND_FULL_SIZE &&
+ !(flags&DW_CLOSE_BUTTON) && (WIDGET_PROGRESSBAR!=w || opts.fillProgress));
p->setPen(border);
if(itsFormMode)
@@ -1982,137 +2822,140 @@ void QtCurveStyle::drawBorder(const QColor &bgnd, QPainter *p, const QRect &r, c
p->drawLine(r.x()+r.width()-1, r.y()+1, r.x()+r.width()-1, r.y()+r.height()-2);
}
- QColor largeArcMid(midColor(border, bgnd)),
- aaColor(midColor(custom ? custom[3] : itsBackgroundCols[3], bgnd));
- QPixmap *pix=itsFormMode ? getPixelPixmap(border) : NULL;
-
- if(round&CORNER_TL)
+ //if(!opts.fillProgress || WIDGET_PROGRESSBAR!=w)
{
- if(largeArc)
+ QColor largeArcMid(midColor(border, bgnd)),
+ aaColor(midColor(custom ? custom[3] : itsBackgroundCols[3], bgnd));
+ QPixmap *pix=itsFormMode ? getPixelPixmap(border) : 0L;
+
+ if(round&CORNER_TL)
{
- p->drawPoint(r.x()+1, r.y()+1);
- if(itsFormMode)
- {
- p->drawPixmap(r.x(), r.y()+1, *pix);
- p->drawPixmap(r.x()+1, r.y(), *pix);
- }
- else
+ if(largeArc)
{
- p->setPen(largeArcMid);
- p->drawLine(r.x(), r.y()+1, r.x()+1, r.y());
+ p->drawPoint(r.x()+1, r.y()+1);
+ if(itsFormMode)
+ {
+ p->drawPixmap(r.x(), r.y()+1, *pix);
+ p->drawPixmap(r.x()+1, r.y(), *pix);
+ }
+ else
+ {
+ p->setPen(largeArcMid);
+ p->drawLine(r.x(), r.y()+1, r.x()+1, r.y());
+ }
}
+ if(doCorners)
+ if(itsFormMode)
+ {
+ if(!largeArc)
+ p->drawPixmap(r.x(), r.y(), *pix);
+ }
+ else
+ {
+ p->setPen(largeArc ? bgnd : aaColor);
+ p->drawPoint(r.x(), r.y());
+ }
}
- if(doCorners)
- if(itsFormMode)
- {
- if(!largeArc)
- p->drawPixmap(r.x(), r.y(), *pix);
- }
- else
- {
- p->setPen(largeArc ? bgnd : aaColor);
- p->drawPoint(r.x(), r.y());
- }
- }
- else
- p->drawPoint(r.x(), r.y());
+ else
+ p->drawPoint(r.x(), r.y());
- p->setPen(border);
- if(round&CORNER_TR)
- {
- if(largeArc)
+ p->setPen(border);
+ if(round&CORNER_TR)
{
- p->drawPoint(r.x()+r.width()-2, r.y()+1);
- if(itsFormMode)
- {
- p->drawPixmap(r.x()+r.width()-2, r.y(), *pix);
- p->drawPixmap(r.x()+r.width()-1, r.y()+1, *pix);
- }
- else
+ if(largeArc)
{
- p->setPen(largeArcMid);
- p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-1, r.y()+1);
+ p->drawPoint(r.x()+r.width()-2, r.y()+1);
+ if(itsFormMode)
+ {
+ p->drawPixmap(r.x()+r.width()-2, r.y(), *pix);
+ p->drawPixmap(r.x()+r.width()-1, r.y()+1, *pix);
+ }
+ else
+ {
+ p->setPen(largeArcMid);
+ p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-1, r.y()+1);
+ }
}
+ if(doCorners)
+ if(itsFormMode)
+ {
+ if(!largeArc)
+ p->drawPixmap(r.x()+r.width()-1, r.y(), *pix);
+ }
+ else
+ {
+ p->setPen(largeArc ? bgnd : aaColor);
+ p->drawPoint(r.x()+r.width()-1, r.y());
+ }
}
- if(doCorners)
- if(itsFormMode)
- {
- if(!largeArc)
- p->drawPixmap(r.x()+r.width()-1, r.y(), *pix);
- }
- else
- {
- p->setPen(largeArc ? bgnd : aaColor);
- p->drawPoint(r.x()+r.width()-1, r.y());
- }
- }
- else
- p->drawPoint(r.x()+r.width()-1, r.y());
+ else
+ p->drawPoint(r.x()+r.width()-1, r.y());
- p->setPen(border);
- if(round&CORNER_BR)
- {
- if(largeArc)
+ p->setPen(border);
+ if(round&CORNER_BR)
{
- p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-2);
- if(itsFormMode)
- {
- p->drawPixmap(r.x()+r.width()-2, r.y()+r.height()-1, *pix);
- p->drawPixmap(r.x()+r.width()-1, r.y()+r.height()-2, *pix);
- }
- else
+ if(largeArc)
{
- p->setPen(largeArcMid);
- p->drawLine(r.x()+r.width()-2, r.y()+r.height()-1, r.x()+r.width()-1,
- r.y()+r.height()-2);
+ p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-2);
+ if(itsFormMode)
+ {
+ p->drawPixmap(r.x()+r.width()-2, r.y()+r.height()-1, *pix);
+ p->drawPixmap(r.x()+r.width()-1, r.y()+r.height()-2, *pix);
+ }
+ else
+ {
+ p->setPen(largeArcMid);
+ p->drawLine(r.x()+r.width()-2, r.y()+r.height()-1, r.x()+r.width()-1,
+ r.y()+r.height()-2);
+ }
}
+ if(doCorners)
+ if(itsFormMode)
+ {
+ if(!largeArc)
+ p->drawPixmap(r.x()+r.width()-1, r.y()+r.height()-1, *pix);
+ }
+ else
+ {
+ p->setPen(largeArc ? bgnd : aaColor);
+ p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1);
+ }
}
- if(doCorners)
- if(itsFormMode)
- {
- if(!largeArc)
- p->drawPixmap(r.x()+r.width()-1, r.y()+r.height()-1, *pix);
- }
- else
- {
- p->setPen(largeArc ? bgnd : aaColor);
- p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1);
- }
- }
- else
- p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1);
+ else
+ p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1);
- p->setPen(border);
- if(round&CORNER_BL)
- {
- if(largeArc)
+ p->setPen(border);
+ if(round&CORNER_BL)
{
- p->drawPoint(r.x()+1, r.y()+r.height()-2);
- if(itsFormMode)
- {
- p->drawPixmap(r.x(), r.y()+r.height()-2, *pix);
- p->drawPixmap(r.x()+1, r.y()+r.height()-1, *pix);
- }
- else
+ if(largeArc)
{
- p->setPen(largeArcMid);
- p->drawLine(r.x(), r.y()+r.height()-2, r.x()+1, r.y()+r.height()-1);
+ p->drawPoint(r.x()+1, r.y()+r.height()-2);
+ if(itsFormMode)
+ {
+ p->drawPixmap(r.x(), r.y()+r.height()-2, *pix);
+ p->drawPixmap(r.x()+1, r.y()+r.height()-1, *pix);
+ }
+ else
+ {
+ p->setPen(largeArcMid);
+ p->drawLine(r.x(), r.y()+r.height()-2, r.x()+1, r.y()+r.height()-1);
+ }
}
+ if(doCorners)
+ if(itsFormMode)
+ {
+ if(!largeArc)
+ p->drawPixmap(r.x(), r.y()+r.height()-1, *pix);
+ }
+ else
+ {
+ p->setPen(largeArc ? bgnd : aaColor);
+ p->drawPoint(r.x(), r.y()+r.height()-1);
+ }
}
- if(doCorners)
- if(itsFormMode)
- {
- if(!largeArc)
- p->drawPixmap(r.x(), r.y()+r.height()-1, *pix);
- }
- else
- {
- p->setPen(largeArc ? bgnd : aaColor);
- p->drawPoint(r.x(), r.y()+r.height()-1);
- }
+ else
+ p->drawPoint(r.x(), r.y()+r.height()-1);
}
- else
- p->drawPoint(r.x(), r.y()+r.height()-1);
}
else
{
@@ -2122,118 +2965,156 @@ void QtCurveStyle::drawBorder(const QColor &bgnd, QPainter *p, const QRect &r, c
}
}
+void QtCurveStyle::drawMdiIcon(QPainter *painter, const QColor &color, const QColor &shadow, const QRect &r, bool sunken, int margin,
+ SubControl button) const
+{
+ if(!sunken)
+ drawWindowIcon(painter, shadow, adjusted(r, 1, 1, 1, 1), sunken, margin, button);
+ drawWindowIcon(painter, color, r, sunken, margin, button);
+}
+
+void QtCurveStyle::drawWindowIcon(QPainter *painter, const QColor &color, const QRect &r, bool sunken, int margin, SubControl button) const
+{
+ QRect rect(r);
+
+ // Icons look best at 22x22...
+ if(rect.height()>22)
+ {
+ int diff=(rect.height()-22)/2;
+ adjust(rect, diff, diff, -diff, -diff);
+ }
+
+ if(sunken)
+ adjust(rect, 1, 1, 1, 1);
+
+ if(margin)
+ adjust(rect, margin, margin, -margin, -margin);
+
+ painter->setPen(color);
+
+ switch(button)
+ {
+ case SC_TitleBarMinButton:
+ painter->drawLine(rect.center().x() - 2, rect.center().y() + 3, rect.center().x() + 3, rect.center().y() + 3);
+ painter->drawLine(rect.center().x() - 2, rect.center().y() + 4, rect.center().x() + 3, rect.center().y() + 4);
+ painter->drawLine(rect.center().x() - 3, rect.center().y() + 3, rect.center().x() - 3, rect.center().y() + 4);
+ painter->drawLine(rect.center().x() + 4, rect.center().y() + 3, rect.center().x() + 4, rect.center().y() + 4);
+ break;
+ case SC_TitleBarMaxButton:
+ painter->drawRect(rect); // adjusted(rect, 0, 0, -1, -1));
+ painter->drawLine(rect.left() + 1, rect.top() + 1, rect.right() - 1, rect.top() + 1);
+ painter->drawPoint(rect.topLeft());
+ painter->drawPoint(rect.topRight());
+ painter->drawPoint(rect.bottomLeft());
+ painter->drawPoint(rect.bottomRight());
+ break;
+ case SC_TitleBarCloseButton:
+ painter->drawLine(rect.left() + 1, rect.top(), rect.right(), rect.bottom() - 1);
+ painter->drawLine(rect.left(), rect.top() + 1, rect.right() - 1, rect.bottom());
+ painter->drawLine(rect.right() - 1, rect.top(), rect.left(), rect.bottom() - 1);
+ painter->drawLine(rect.right(), rect.top() + 1, rect.left() + 1, rect.bottom());
+ painter->drawPoint(rect.topLeft());
+ painter->drawPoint(rect.topRight());
+ painter->drawPoint(rect.bottomLeft());
+ painter->drawPoint(rect.bottomRight());
+ painter->drawLine(rect.left() + 1, rect.top() + 1, rect.right() - 1, rect.bottom() - 1);
+ painter->drawLine(rect.left() + 1, rect.bottom() - 1, rect.right() - 1, rect.top() + 1);
+ break;
+ case SC_TitleBarNormalButton:
+ {
+ QRect r2 = adjusted(rect, 0, 3, -3, 0);
+
+ painter->drawRect(r2); // adjusted(r2, 0, 0, -1, -1));
+ painter->drawLine(r2.left() + 1, r2.top() + 1, r2.right() - 1, r2.top() + 1);
+ painter->drawPoint(r2.topLeft());
+ painter->drawPoint(r2.topRight());
+ painter->drawPoint(r2.bottomLeft());
+ painter->drawPoint(r2.bottomRight());
+
+ QRect backWindowRect(adjusted(rect, 3, 0, 0, -3));
+ QRegion clipRegion(backWindowRect);
+
+ clipRegion -= r2;
+ if(sunken)
+ adjust(backWindowRect, 1, 1, 1, 1);
+ painter->drawRect(backWindowRect); // adjusted(backWindowRect, 0, 0, -1, -1));
+ painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1,
+ backWindowRect.right() - 1, backWindowRect.top() + 1);
+ painter->drawPoint(backWindowRect.topLeft());
+ painter->drawPoint(backWindowRect.topRight());
+ painter->drawPoint(backWindowRect.bottomLeft());
+ painter->drawPoint(backWindowRect.bottomRight());
+ break;
+ }
+ case SC_TitleBarShadeButton:
+ ::drawArrow(painter, rect, color, PE_ArrowUp, opts, true);
+ break;
+ case SC_TitleBarUnshadeButton:
+ ::drawArrow(painter, rect, color, PE_ArrowDown, opts, true);
+ default:
+ break;
+ }
+}
+
void QtCurveStyle::drawEntryField(QPainter *p, const QRect &rx, const QColorGroup &cg,
- SFlags flags, bool highlight, int round, EWidget w) const
+ SFlags flags, EntryColor coloration, int round, EWidget w) const
{
- const QColor *use(highlight ? itsMenuitemCols : buttonColors(cg));
+ const QColor *use(ENTRY_MOUSE_OVER==coloration && itsMouseOverCols
+ ? itsMouseOverCols
+ : ENTRY_FOCUS==coloration && itsFocusCols
+ ? itsFocusCols
+ : backgroundColors(cg));
bool isSpin(WIDGET_SPIN==w),
- doEtch(!itsFormMode && QTC_DO_EFFECT);
+ doEtch(!itsFormMode && opts.etchEntry && (!isSpin || opts.unifySpin) && WIDGET_COMBO!=w && DO_EFFECT),
+ reverse(QApplication::reverseLayout());
+
+ if(WIDGET_SCROLLVIEW!=w && (opts.square&SQUARE_ENTRY))
+ round=ROUNDED_NONE;
QRect r(rx);
if(doEtch)
- r.addCoords(0, 1, 0, -1);
+ r.addCoords(1, 1, -1, -1);
- if(isSpin)
+ if(!itsFormMode)
{
- if(QApplication::reverseLayout())
- r.addCoords(-1, 0, 0, 0);
-
- p->setPen(flags&Style_Enabled ? cg.base() : cg.background());
- p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1);
- p->drawLine(r.x()+r.width()-3, r.y(), r.x()+r.width()-3, r.y()+r.height()-1);
+ p->setPen(cg.background());
+ p->drawRect(rx);
}
- if(!itsFormMode)
- p->fillRect(rx, cg.background());
- p->fillRect(QRect(rx.x()+2, rx.y()+2, rx.x()+rx.width()-3, rx.y()+rx.height()-3),
- flags&Style_Enabled ? cg.base() : cg.background());
+ if(isSpin || WIDGET_ENTRY==w || WIDGET_COMBO==w)
+ {
+ if(reverse && isSpin)
+ r.addCoords(-1, 0, 0, 0);
- p->setPen(APPEARANCE_FLAT!=opts.appearance || highlight
- ? midColor(flags&Style_Enabled ? cg.base() : cg.background(), use[3])
- : cg.base());
- p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2);
- p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-(isSpin ? 0 : 2), r.y()+1);
+ if(isSpin || WIDGET_COMBO==w)
+ p->fillRect(r, flags&Style_Enabled ? cg.base() : cg.background());
+ }
- p->setPen(flags&Style_Enabled ? midColor(cg.base(), use[0]) : cg.background());
- p->drawLine(r.x()+r.width()-(isSpin && highlight ? 3 : 2), r.y()+1,
- r.x()+r.width()-(isSpin && highlight ? 3 : 2), r.y()+r.height()-2);
- p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-(isSpin ? 0 : 2), r.y()+r.height()-2);
+ if(ENTRY_NONE!=coloration && isSpin && !opts.unifySpin)
+ if(reverse)
+ r.addCoords(1, 0, 0, 0);
+ else
+ r.addCoords(0, 0, -1, 0);
- if(highlight && isSpin)
- {
- p->setPen(use[QT_STD_BORDER]);
- p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1);
- }
+ drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal), round, use,
+ WIDGET_SCROLLVIEW==w ? w : WIDGET_ENTRY, true, isSpin && !(flags&Style_Enabled) ? BORDER_FLAT : BORDER_SUNKEN);
- drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal), round, use);
if(doEtch)
{
- r=rx;
+ QRect r(rx);
p->setClipRegion(r);
if(!(round&CORNER_TR) && !(round&CORNER_BR))
r.addCoords(0, 0, 2, 0);
if(!(round&CORNER_TL) && !(round&CORNER_BL))
r.addCoords(-2, 0, 0, 0);
- drawEtch(p, r, cg, true, true, EFFECT_SHADOW==opts.buttonEffect && WIDGET_BUTTON(w) &&
- !(flags &(Style_Down | Style_On | Style_Sunken)));
+ drawEtch(p, r, cg, EFFECT_SHADOW==opts.buttonEffect && WIDGET_BUTTON(w) &&
+ !(flags &(Style_Down | Style_On | Style_Sunken)), ROUNDED_NONE==round);
p->setClipping(false);
}
}
-static void drawArrow(QPainter *p, const QRect &r, const QColor &col, QStyle::PrimitiveElement pe, const Options &opts, bool small=false)
-{
- QPointArray a;
-
- if(small)
- switch(pe)
- {
- case QStyle::PE_ArrowUp:
- a.setPoints(opts.vArrows ? 7 : 3, 2,0, 0,-2, -2,0, -2,1, -1,0, 1,0, 2,1);
- break;
- case QStyle::PE_ArrowDown:
- a.setPoints(opts.vArrows ? 7 : 3, 2,0, 0,2, -2,0, -2,-1, -1,0, 1,0, 2,-1);
- break;
- case QStyle::PE_ArrowRight:
- a.setPoints(opts.vArrows ? 7 : 3, 0,-2, 2,0, 0,2, -1,2, 0,1, 0,-1, -1,-2);
- break;
- case QStyle::PE_ArrowLeft:
- a.setPoints(opts.vArrows ? 7 : 3, 0,-2, -2,0, 0,2, 1,2, 0,1, 0,-1, 1,-2);
- break;
- default:
- return;
- }
- else // Large arrows...
- switch(pe)
- {
- case QStyle::PE_ArrowUp:
- a.setPoints(opts.vArrows ? 6 : 3, 3,1, 0,-2, -3,1, -2, 2, 0,0, 2,2);
- break;
- case QStyle::PE_ArrowDown:
- a.setPoints(opts.vArrows ? 6 : 3, 3,-1, 0,2, -3,-1, -2,-2, 0,0, 2,-2);
- break;
- case QStyle::PE_ArrowRight:
- a.setPoints(opts.vArrows ? 6 : 3, -1,-3, 2,0, -1,3, -2,2, 0,0, -2,-2);
- break;
- case QStyle::PE_ArrowLeft:
- a.setPoints(opts.vArrows ? 6 : 3, 1,-3, -2,0, 1,3, 2,2, 0,0, 2,-2);
- break;
- default:
- return;
- }
-
- if(a.isNull())
- return;
-
- p->save();
- a.translate((r.x()+(r.width()>>1)),(r.y()+(r.height()>>1)));
- p->setBrush(col);
- p->setPen(col);
- p->drawPolygon(a);
- p->restore();
-}
-
void QtCurveStyle::drawArrow(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags,
PrimitiveElement pe, bool small, bool checkActive) const
{
@@ -2243,7 +3124,7 @@ void QtCurveStyle::drawArrow(QPainter *p, const QRect &r, const QColorGroup &cg,
: cg.text()
: cg.mid());
- ::drawArrow(p, r, col, pe, opts, small);
+ ::drawArrow(p, r, p->pen()==QPen::NoPen ? col : p->pen().color(), pe, opts, small);
}
void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &r,
@@ -2262,8 +3143,8 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
if(flags&Style_Down)
flags=((flags|Style_Down)^Style_Down)| Style_Sunken;
flags|=Style_Enabled;
-#if KDE_VERSION >= 0x30200
-#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
+#if defined KDE_VERSION && KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
if(HOVER_KICKER==itsHover && itsHoverWidget) // && itsHoverWidget==p->device())
flags|=Style_MouseOver;
#endif
@@ -2271,15 +3152,14 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
#endif
drawLightBevel(p, r, cg, flags|Style_Horizontal, ROUNDED_ALL,
getFill(flags, use), use, true, false);
-#if KDE_VERSION >= 0x30200
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
itsFormMode=false;
#endif
}
else
{
- bool isFirst(false), isLast(false), isTable(false);
- QHeader *header(p && p->device() ? dynamic_cast<QHeader*>(p->device())
- : NULL);
+ bool isFirst(false), isLast(false), isTable(false), isSort(false);
+ QHeader *header(p && p->device() ? dynamic_cast<QHeader*>(p->device()) : 0L);
if (header)
{
@@ -2294,20 +3174,31 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
isLast=tbl->rowAt(r.y()+header->offset())==(tbl->numRows()-1);
}
else
- isFirst = header->mapToIndex(header->sectionAt(r.x()+header->offset())) == 0;
+ {
+ int index=header->mapToIndex(header->sectionAt(r.x()+header->offset()));
+ isFirst = index == 0;
+ isSort = header->sortIndicatorSection() == index;
+ }
}
else if(0==flags) // Header on popup menu?
- {
+ { QWidget *widget(p && p->device() ? dynamic_cast<QWidget*>(p->device()) : 0L);
+ bool menuTitle(widget && 0==qstrcmp(widget->className(), "KPopupTitle"));
const QColor *use(buttonColors(cg));
-
- drawLightBevel(p, r, cg, flags|Style_Horizontal, ROUNDED_ALL,
- getFill(flags, use), use);
+ QRect r2(r);
+
+ if(menuTitle)
+ r2.addCoords(2, 2, -2, -2);
+ drawLightBevel(p, r2, cg, flags|Style_Horizontal, ROUNDED_ALL, getFill(flags, use), use);
break;
}
+ const QColor *use(flags&Style_Enabled && itsSortedLvColors && isSort
+ ? itsSortedLvColors
+ : opts.lvButton ? buttonColors(cg) : backgroundColors(cg));
+
flags=((flags|Style_Sunken)^Style_Sunken)| Style_Raised;
- if(QTC_NO_SECT!=itsHoverSect && HOVER_HEADER==itsHover && itsHoverWidget)
+ if(NO_SECT!=itsHoverSect && HOVER_HEADER==itsHover && itsHoverWidget)
{
QHeader *hd(::qt_cast<QHeader *>(itsHoverWidget));
@@ -2317,70 +3208,57 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
bool sunken(flags &(Style_Down | Style_On | Style_Sunken));
- drawBevelGradient(getFill(flags, itsBackgroundCols), !sunken, p, r, flags&Style_Horizontal,
- sunken ? SHADE_BEVEL_GRAD_SEL_LIGHT : SHADE_BEVEL_GRAD_LIGHT,
- sunken ? SHADE_BEVEL_GRAD_SEL_DARK : SHADE_BEVEL_GRAD_DARK,
+ drawBevelGradient(getFill(flags, use), p, r, flags&Style_Horizontal,
sunken, opts.lvAppearance, WIDGET_LISTVIEW_HEADER);
if(APPEARANCE_RAISED==opts.lvAppearance)
{
- p->setPen(itsBackgroundCols[4]);
+ p->setPen(use[4]);
if(flags&Style_Horizontal)
p->drawLine(r.x(), r.y()+r.height()-2, r.x()+r.width()-1, r.y()+r.height()-2);
else
p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1);
}
- const QColor *border(borderColors(flags, NULL));
-
if(flags&Style_Horizontal)
{
- if(border)
- {
- p->setPen(border[ORIGINAL_SHADE]);
- p->drawLine(r.x(), r.y()+r.height()-2, r.x()+r.width()-1,
- r.y()+r.height()-2);
- p->setPen(border[QT_STD_BORDER]);
- }
- else
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(use[STD_BORDER]);
p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1);
+ if(itsMouseOverCols && opts.coloredMouseOver && flags&Style_MouseOver)
+ drawHighlight(p, QRect(r.x(), r.y()+r.height()-2, r.width(), 2), cg, true, true);
+
if(!isFirst)
{
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(use[STD_BORDER]);
p->drawLine(r.x(), r.y()+5, r.x(), r.y()+r.height()-6);
- p->setPen(itsBackgroundCols[0]);
+ p->setPen(use[0]);
p->drawLine(r.x()+1, r.y()+5, r.x()+1, r.y()+r.height()-6);
}
}
else
{
- if(border)
- {
- p->setPen(border[ORIGINAL_SHADE]);
- p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1);
- p->setPen(border[QT_STD_BORDER]);
- }
- else
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(use[STD_BORDER]);
p->drawLine(r.x()+r.width()-1, r.y(), r.x()+r.width()-1, r.y()+r.height()-1);
if(!isLast)
{
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(use[STD_BORDER]);
p->drawLine(r.x()+5, r.y()+r.height()-2, r.x()+r.width()-6,
r.y()+r.height()-2);
- p->setPen(itsBackgroundCols[0]);
+ p->setPen(use[0]);
p->drawLine(r.x()+5, r.y()+r.height()-1, r.x()+r.width()-6,
r.y()+r.height()-1);
}
+
+ if(itsMouseOverCols && opts.coloredMouseOver && flags&Style_MouseOver)
+ drawHighlight(p, QRect(r.x(), r.y()+r.height()-3, r.width(), 2), cg, true, true);
}
}
break;
}
case PE_HeaderArrow:
- drawArrow(p, r, cg, flags, flags&Style_Up ? PE_ArrowUp : PE_ArrowDown);
+ ::drawArrow(p, r, MO_ARROW(cg.buttonText()), flags&Style_Up ? PE_ArrowUp : PE_ArrowDown, opts, false);
break;
case PE_ButtonBevel:
flags|=Style_Enabled;
@@ -2388,10 +3266,11 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
case PE_ButtonTool:
case PE_ButtonDropDown:
{
- const QColor *use(buttonColors(cg));
+ const QColor *use((IND_TINT==opts.defBtnIndicator || IND_SELECTED==opts.defBtnIndicator) && flags&Style_Enabled && flags&Style_ButtonDefault
+ ? itsDefBtnCols : buttonColors(cg));
bool glassMod(PE_ButtonTool==pe && IS_GLASS(opts.appearance) &&
IS_GLASS(opts.toolbarAppearance)),
- mdi(!(flags&QTC_CHECK_BUTTON) && (!(flags&QTC_STD_TOOLBUTTON)||flags&QTC_NO_ETCH_BUTTON) &&
+ mdi(!(flags&CHECK_BUTTON) && (!(flags&STD_TOOLBUTTON)||flags&NO_ETCH_BUTTON) &&
PE_ButtonTool==pe && r.width()<=16 && r.height()<=16),
operaMdi(PE_ButtonTool==pe && APP_OPERA==itsThemedApp && r.width()==16 && r.height()==16);
@@ -2399,9 +3278,9 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
if(!(flags&Style_Sunken))
flags|=Style_Raised;
- if(PE_ButtonTool==pe && flags&QTC_VERTICAL_TB_BUTTON)
+ if(PE_ButtonTool==pe && flags&VERTICAL_TB_BUTTON)
{
- flags-=QTC_VERTICAL_TB_BUTTON;
+ flags-=VERTICAL_TB_BUTTON;
if(flags&Style_Horizontal)
flags-=Style_Horizontal;
}
@@ -2410,26 +3289,43 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
itsFormMode=itsFormMode || mdi || operaMdi;
if(mdi || operaMdi)
+ {
flags|=Style_Horizontal;
+ if(!operaMdi)
+ {
+ if(flags<0x14000000 && !(flags&(Style_Down|Style_On|Style_Sunken|Style_MouseOver)))
+ break;
+ if(flags<0x14000000)
+ use=getMdiColors(cg, true);
+ }
+ }
- drawLightBevel(p, r, cg, glassMod ? flags : flags|Style_Horizontal,
-#if KDE_VERSION >= 0x30200
+ drawLightBevel(/*flags&DW_CLOSE_BUTTON
+ ? cg.background().dark(DW_BGND)
+ : */cg.background(),
+ p, r, cg, glassMod ? flags : flags|Style_Horizontal,
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
(APP_KORN==itsThemedApp && itsIsTransKicker && PE_ButtonTool==pe) ||
#endif
operaMdi || mdi
- ? ROUNDED_NONE
- : ROUNDED_ALL,
- getFill(flags, use), use, true, true,
- flags&QTC_NO_ETCH_BUTTON ? WIDGET_NO_ETCH_BTN : WIDGET_STD_BUTTON);
-
- if(IND_COLORED==opts.defBtnIndicator && (flags&Style_ButtonDefault))
+ ? ROUNDED_NONE
+ : ROUNDED_ALL,
+ getFill(flags, use, false,
+ flags&Style_ButtonDefault && flags&Style_Enabled && IND_DARKEN==opts.defBtnIndicator),
+ use, true, true,
+ flags&NO_ETCH_BUTTON
+ ? WIDGET_NO_ETCH_BTN
+ : flags&Style_ButtonDefault && flags&Style_Enabled && IND_COLORED!=opts.defBtnIndicator
+ ? WIDGET_DEF_BUTTON
+ : WIDGET_STD_BUTTON);
+
+ if(IND_COLORED==opts.defBtnIndicator && flags&Style_ButtonDefault && flags&Style_Enabled)
{
- const QColor *cols=itsMouseOverCols && flags&Style_MouseOver ? itsMouseOverCols : itsDefBtnCols;
- QRegion outer(r);
- QRect r2(r);
+ QRegion outer(r);
+ QRect r2(r);
- if(!itsFormMode && QTC_DO_EFFECT)
- r2.addCoords(0, 1, 0, -1);
+ if(!itsFormMode && DO_EFFECT)
+ r2.addCoords(1, 1, -1, -1);
r2.addCoords(COLORED_BORDER_SIZE, COLORED_BORDER_SIZE, -COLORED_BORDER_SIZE,
-COLORED_BORDER_SIZE);
@@ -2439,12 +3335,12 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
p->setClipRegion(outer.eor(inner));
drawLightBevel(p, r, cg, glassMod ? flags : flags|Style_Horizontal,
- flags&QTC_CHECK_BUTTON
-#if KDE_VERSION >= 0x30200
+ flags&CHECK_BUTTON
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
|| (APP_KORN==itsThemedApp && itsIsTransKicker && PE_ButtonTool==pe)
#endif
? ROUNDED_NONE : ROUNDED_ALL,
- cols[QTC_MO_DEF_BTN], cols, true, true,
+ itsDefBtnCols[MO_DEF_BTN], itsDefBtnCols, true, true,
WIDGET_DEF_BUTTON);
p->setClipping(false);
}
@@ -2457,16 +3353,17 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
{
case IND_CORNER:
{
- const QColor *use(buttonColors(cg));
QPointArray points;
bool sunken(flags&Style_Down || flags&Style_Sunken);
- int offset(sunken ? 4 : 3);
+ int offset(sunken ? 5 : 4),
+ etchOffset(DO_EFFECT ? 1 : 0);
+ const QColor *cols(itsFocusCols ? itsFocusCols : itsHighlightCols);
- points.setPoints(3, r.x()+offset, r.y()+offset+1, r.x()+offset+6, r.y()+offset+1,
- r.x()+offset, r.y()+offset+7);
+ points.setPoints(3, r.x()+offset+etchOffset, r.y()+offset+etchOffset, r.x()+offset+6+etchOffset, r.y()+offset+etchOffset,
+ r.x()+offset+etchOffset, r.y()+offset+6+etchOffset);
- p->setBrush(use[sunken ? 0 : 4]);
- p->setPen(use[sunken ? 0 : 4]);
+ p->setBrush(cols[sunken ? 0 : 4]);
+ p->setPen(cols[sunken ? 0 : 4]);
p->drawPolygon(points);
break;
}
@@ -2477,13 +3374,7 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
case PE_CheckMark:
if(flags&Style_On)
{
- QPixmap *pix(getPixmap(flags&Style_Enabled
- ? (flags&Style_Selected && !(flags&QTC_LISTVIEW_ITEM)) ||
- (flags&Style_Active && flags&QTC_MENU_ITEM)
- ? cg.highlightedText()
- : itsCheckRadioCol
- : cg.mid(),
- PIX_CHECK, 1.0));
+ QPixmap *pix(getPixmap(checkRadioCol(flags, cg), PIX_CHECK, 1.0));
p->drawPixmap(r.center().x()-(pix->width()/2), r.center().y()-(pix->height()/2),
*pix);
@@ -2492,11 +3383,7 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
{
int x(r.center().x()), y(r.center().y());
- p->setPen(flags&Style_Enabled
- ? flags&Style_Selected && !(flags&QTC_LISTVIEW_ITEM)
- ? cg.highlightedText()
- : itsCheckRadioCol
- : cg.mid());
+ p->setPen(checkRadioCol(flags, cg));
p->drawLine(x-3, y, x+3, y);
p->drawLine(x-3, y+1, x+3, y+1);
}
@@ -2507,13 +3394,13 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
if(item)
{
- const QColor *bc(borderColors(flags, NULL)),
+ const QColor *bc(borderColors(flags, 0L)),
*btn(buttonColors(cg)),
*use(bc ? bc : btn);
int x(r.x()+1), y(r.y()+2);
p->drawPixmap(x, y, *getPixmap(use[opts.coloredMouseOver && flags&Style_MouseOver
- ? 4 : QT_BORDER(flags&Style_Enabled)],
+ ? 4 : BORDER_VAL(flags&Style_Enabled)],
PIX_RADIO_BORDER, 0.8));
::drawArrow(p, QRect(r.x()-1, r.y()-1, r.width(), r.height()),
use[opts.coloredMouseOver && flags&Style_MouseOver ? 4:5], PE_ArrowDown, opts);
@@ -2547,13 +3434,13 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
}
}
- QRect checkRect(r.x()+1, r.y()+1, QTC_CHECK_SIZE, QTC_CHECK_SIZE);
- drawPrimitive(PE_Indicator, p, checkRect, cg, flags|QTC_LISTVIEW_ITEM);
+ QRect checkRect(r.x()+1, r.y()+1, opts.crSize, opts.crSize);
+ drawPrimitive(PE_Indicator, p, checkRect, cg, flags|LISTVIEW_ITEM);
}
break;
}
case PE_IndicatorMask:
- if(QTC_ROUNDED)
+ if(ROUNDED)
{
p->fillRect(r, color0);
p->fillRect(r.x()+1, r.y(), r.width()-2, r.height(), color1);
@@ -2566,38 +3453,95 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
break;
case PE_Indicator:
{
- bool on(flags&Style_On || !(flags&Style_Off));
+ bool doEtch(DO_EFFECT && !itsFormMode && !(flags&LISTVIEW_ITEM)),
+ on(flags&Style_On || !(flags&Style_Off)),
+ sunken(flags&Style_Down);
+ QRect rect(doEtch ? QRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2) : r);
SFlags sflags(!(flags&Style_Off) ? flags|Style_On : flags);
- if(!itsFormMode && sflags&Style_MouseOver && HOVER_NONE==itsHover)
- sflags-=Style_MouseOver;
+ if(sunken || (!itsFormMode && HOVER_NONE==itsHover))
+ sflags&=~Style_MouseOver;
- const QColor *bc(borderColors(sflags, NULL)),
- *btn(buttonColors(cg)),
+ bool glowFocus(USE_GLOW_FOCUS(flags&Style_MouseOver) && sflags&Style_Enabled && sflags&Style_HasFocus),
+ glow(doEtch && sflags&Style_Enabled && ((MO_GLOW==opts.coloredMouseOver && sflags&Style_MouseOver) || glowFocus));
+ const QColor *bc(glowFocus ? itsFocusCols : borderColors(sflags, 0L)),
+ *btn(checkRadioColors(cg, sflags)),
*use(bc ? bc : btn),
- &bgnd(sflags&Style_Enabled
- ? sflags&Style_MouseOver
- ? use[QTC_CR_MO_FILL]
- : cg.base()
- : cg.background());
+ &bgnd(opts.crButton
+ ? getFill(flags, btn, true)
+ : sflags&Style_Enabled && !sunken
+ ? MO_NONE==opts.coloredMouseOver && !opts.crHighlight && sflags&Style_MouseOver
+ ? use[CR_MO_FILL]
+ : cg.base()
+ : cg.background());
+ EWidget wid=opts.crButton ? WIDGET_STD_BUTTON : WIDGET_TROUGH;
+ EAppearance app=opts.crButton ? opts.appearance : APPEARANCE_INVERTED;
+ bool drawSunken=opts.crButton ? sunken : false,
+ lightBorder=DRAW_LIGHT_BORDER(drawSunken, wid, app),
+ draw3dFull=!lightBorder && DRAW_3D_FULL_BORDER(drawSunken, app),
+ draw3d=draw3dFull || (!lightBorder && DRAW_3D_BORDER(drawSunken, app)),
+ drawLight=opts.crButton && !drawSunken && (lightBorder || draw3d),
+ drawDark=drawLight && draw3dFull && !lightBorder;
if(IS_FLAT(opts.appearance))
- p->fillRect(QRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2), bgnd);
+ p->fillRect(QRect(rect.x()+1, rect.y()+1, rect.width()-2, rect.height()-2), bgnd);
else
- drawBevelGradient(bgnd, false, p, QRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2), true,
- getWidgetShade(WIDGET_TROUGH, true, false, APPEARANCE_GRADIENT),
- getWidgetShade(WIDGET_TROUGH, false, false, APPEARANCE_GRADIENT),
- false, APPEARANCE_GRADIENT, WIDGET_TROUGH);
+ drawBevelGradient(bgnd, p, QRect(rect.x()+1, rect.y()+1, rect.width()-2, rect.height()-2), true,
+ drawSunken, app, wid);
- p->setPen(midColor(sflags&Style_Enabled ? cg.base() : cg.background(), use[3]));
- p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2);
- p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1);
+ if(MO_NONE!=opts.coloredMouseOver && !glow && sflags&Style_MouseOver && sflags&Style_Enabled)
+ {
+ p->setPen(use[CR_MO_FILL]);
+ p->drawRect(QRect(rect.x()+1, rect.y()+1, rect.width()-2, rect.height()-2));
+ // p->drawRect(QRect(rect.x()+2, rect.y()+2, rect.width()-4, rect.height()-4));
+ }
+ else if(!opts.crButton || drawLight)
+ {
+ p->setPen(drawLight ? btn[LIGHT_BORDER(app)] : midColor(sflags&Style_Enabled ? cg.base() : cg.background(), use[3]));
+ if(lightBorder)
+ p->drawRect(QRect(rect.x()+1, rect.y()+1, rect.width()-2, rect.height()-2));
+ else
+ {
+ p->drawLine(rect.x()+1, rect.y()+1, rect.x()+1, rect.y()+rect.height()-2);
+ p->drawLine(rect.x()+1, rect.y()+1, rect.x()+rect.width()-2, rect.y()+1);
+
+ if(drawDark)
+ {
+ p->setPen(btn[2]);
+ p->drawLine(rect.x()+rect.width()-2, rect.y()+1,
+ rect.x()+rect.width()-2, rect.y()+rect.height()-2);
+ p->drawLine(rect.x()+1, rect.y()+rect.height()-2,
+ rect.x()+rect.width()-2, rect.y()+rect.height()-2);
+ }
+ }
+ }
+
+ drawBorder(cg.background(), p, rect, cg, (SFlags)(sflags|Style_Horizontal|CHECK_BUTTON),
+ ROUNDED_ALL, use, WIDGET_OTHER, !(flags&LISTVIEW_ITEM));
- drawBorder(cg.background(), p, r, cg, (SFlags)(sflags|Style_Horizontal|QTC_CHECK_BUTTON),
- ROUNDED_ALL, use, WIDGET_OTHER, !(flags&QTC_LISTVIEW_ITEM));
+ if(doEtch)
+ {
+ QColor topCol(glow
+ ? glowFocus ? itsFocusCols[GLOW_MO] : itsMouseOverCols[GLOW_MO]
+ : shade(cg.background(), ETCHED_DARK)),
+ botCol(glow
+ ? topCol
+ : itsBackgroundCols[1]);
+
+ p->setBrush(Qt::NoBrush);
+ p->setPen(topCol);
+ if(!opts.crButton || EFFECT_SHADOW!=opts.buttonEffect || drawSunken || glow)
+ {
+ p->drawLine(r.x()+1, r.y(), r.x()+r.width()-2, r.y());
+ p->drawLine(r.x(), r.y()+1, r.x(), r.y()+r.height()-2);
+ p->setPen(botCol);
+ }
+ p->drawLine(r.x()+1, r.y()+r.height()-1, r.x()+r.width()-2, r.y()+r.height()-1);
+ p->drawLine(r.x()+r.width()-1, r.y()+1, r.x()+r.width()-1, r.y()+r.height()-2);
+ }
if(on)
- drawPrimitive(PE_CheckMark, p, r, cg, flags);
+ drawPrimitive(PE_CheckMark, p, rect, cg, flags);
break;
}
case PE_CheckListExclusiveIndicator:
@@ -2606,16 +3550,13 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
if(item)
{
- const QColor *bc(borderColors(flags, NULL)),
+ const QColor *bc(borderColors(flags, 0L)),
*btn(buttonColors(cg)),
*use(bc ? bc : btn),
- &on(flags&Style_Enabled
- ? itsCheckRadioCol
- : cg.mid());
-
+ &on(checkRadioCol(flags, cg));
int x(r.x()), y(r.y()+2);
- p->drawPixmap(x, y, *getPixmap(use[opts.coloredMouseOver && flags&Style_MouseOver ? 4 : QT_BORDER(flags&Style_Enabled)],
+ p->drawPixmap(x, y, *getPixmap(use[opts.coloredMouseOver && flags&Style_MouseOver ? 4 : BORDER_VAL(flags&Style_Enabled)],
PIX_RADIO_BORDER, 0.8));
if(flags&Style_On)
@@ -2625,9 +3566,6 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
}
case PE_ExclusiveIndicator:
case PE_ExclusiveIndicatorMask:
- {
- int x(r.x()), y(r.y());
-
if(PE_ExclusiveIndicatorMask==pe)
{
p->fillRect(r, color0);
@@ -2637,6 +3575,11 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
}
else
{
+ bool doEtch(DO_EFFECT && !itsFormMode),
+ sunken(flags&Style_Down);
+ QRect rect(doEtch ? QRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2) : r);
+ int x(rect.x()), y(rect.y());
+
QPointArray clipRegion;
clipRegion.setPoints(8, x, y+8, x, y+4, x+4, y, x+8, y,
@@ -2644,56 +3587,114 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
SFlags sflags(flags);
- if(!itsFormMode && sflags&Style_MouseOver && HOVER_NONE==itsHover)
- sflags-=Style_MouseOver;
-
- const QColor *bc(borderColors(sflags, NULL)),
- *btn(buttonColors(cg)),
+ if(sunken || (!itsFormMode && HOVER_NONE==itsHover))
+ sflags&=~Style_MouseOver;
+
+ bool glowFocus(USE_GLOW_FOCUS(flags&Style_MouseOver) && sflags&Style_Enabled && sflags&Style_HasFocus),
+ glow(doEtch && sflags&Style_Enabled && ((MO_GLOW==opts.coloredMouseOver && sflags&Style_MouseOver) ||
+ glowFocus)),
+ set(sflags&Style_On),
+ coloredMo(MO_NONE!=opts.coloredMouseOver && !glow &&
+ sflags&Style_MouseOver && sflags&Style_Enabled);
+ const QColor *bc(glowFocus ? itsFocusCols : borderColors(sflags, 0L)),
+ *btn(checkRadioColors(cg, sflags)),
*use(bc ? bc : btn);
- const QColor &on(sflags&Style_Enabled
- ? sflags&Style_Selected && !(flags&QTC_LISTVIEW_ITEM)
- ? cg.highlightedText()
- : itsCheckRadioCol
- : cg.mid()),
- &bgnd(sflags&Style_Enabled
- ? sflags&Style_MouseOver
- ? use[QTC_CR_MO_FILL]
- : cg.base()
- : cg.background());
- bool set(sflags&Style_On);
+ const QColor &on(checkRadioCol(flags, cg)),
+ &bgnd(opts.crButton
+ ? getFill(flags, btn, true)
+ : sflags&Style_Enabled && !sunken
+ ? MO_NONE==opts.coloredMouseOver && !opts.crHighlight && sflags&Style_MouseOver
+ ? use[CR_MO_FILL]
+ : cg.base()
+ : cg.background());
+ EWidget wid=opts.crButton ? WIDGET_STD_BUTTON : WIDGET_TROUGH;
+ EAppearance app=opts.crButton ? opts.appearance : APPEARANCE_INVERTED;
+ bool drawSunken=opts.crButton ? sunken : EFFECT_NONE!=opts.buttonEffect,
+ lightBorder=DRAW_LIGHT_BORDER(drawSunken, wid, app),
+ draw3d=!lightBorder &&
+ (DRAW_3D_BORDER(drawSunken, app) || DRAW_3D_FULL_BORDER(drawSunken, app)),
+ drawLight=opts.crButton && !drawSunken && (lightBorder || draw3d),
+ doneShadow=false;
p->save();
- p->fillRect(r, cg.background());
+
+ if(opts.crHighlight && sflags&Style_MouseOver)
+ drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), p, r, true,
+ false, opts.selectionAppearance, WIDGET_SELECTION);
+ else
+ p->fillRect(r, cg.background());
+
+ if(doEtch && !glow && opts.crButton && !drawSunken && EFFECT_SHADOW==opts.buttonEffect)
+ {
+ p->setBrush(Qt::NoBrush);
+ p->setPen(shade(cg.background(), ETCHED_DARK));
+ p->drawArc(QRect(r.x(), r.y(), opts.crSize, opts.crSize), 225*16, 180*16);
+ doneShadow=true;
+ }
p->setClipRegion(QRegion(clipRegion));
if(IS_FLAT(opts.appearance))
- p->fillRect(QRect(x+1, y+1, r.width()-2, r.height()-2), bgnd);
+ p->fillRect(QRect(x+1, y+1, rect.width()-2, rect.height()-2), bgnd);
else
- drawBevelGradient(bgnd, false, p, QRect(x+1, y+1, r.width()-2, r.height()-2), true,
- getWidgetShade(WIDGET_TROUGH, true, false, APPEARANCE_GRADIENT),
- getWidgetShade(WIDGET_TROUGH, false, false, APPEARANCE_GRADIENT),
- false, APPEARANCE_GRADIENT, WIDGET_TROUGH);
+ drawBevelGradient(bgnd, p, QRect(x+1, y+1, rect.width()-2, rect.height()-2), true,
+ drawSunken, app, wid);
+
+ if(coloredMo)
+ {
+ p->setPen(use[CR_MO_FILL]);
+ p->drawArc(QRect(x+1, y+1, opts.crSize-2, opts.crSize-2), 0, 360*16);
+// p->drawArc(QRect(x+2, y+2, opts.crSize-4, opts.crSize-4), 0, 360*16);
+// p->drawArc(QRect(x+3, y+3, opts.crSize-6, opts.crSize-6), 0, 360*16);
+ p->drawPoint(x+2, y+4);
+ p->drawPoint(x+4, y+2);
+ p->drawPoint(x+8, y+2);
+ p->drawPoint(x+10, y+4);
+ p->drawPoint(x+2, y+8);
+ p->drawPoint(x+4, y+10);
+ p->drawPoint(x+8, y+10);
+ p->drawPoint(x+10, y+8);
+ }
p->setClipping(false);
- p->drawPixmap(r.x(), r.y(),
- *getPixmap(use[opts.coloredMouseOver && sflags&Style_MouseOver ? 4 : QT_BORDER(flags&Style_Enabled)],
- PIX_RADIO_BORDER, 0.8));
+ if(doEtch && !doneShadow)
+ {
+ QColor topCol(glow
+ ? glowFocus ? itsFocusCols[GLOW_MO] : itsMouseOverCols[GLOW_MO]
+ : shade(cg.background(), ETCHED_DARK)),
+ botCol(glow
+ ? topCol
+ : itsBackgroundCols[1]);
+
+ p->setBrush(Qt::NoBrush);
+ p->setPen(topCol);
+ if(drawSunken || glow)
+ {
+ p->drawArc(QRect(r.x(), r.y(), opts.crSize, opts.crSize), 45*16, 180*16);
+ p->setPen(botCol);
+ }
+ p->drawArc(QRect(r.x(), r.y(), opts.crSize, opts.crSize), 225*16, 180*16);
+ }
+
+ p->drawPixmap(rect.x(), rect.y(),
+ *getPixmap(use[BORDER_VAL(flags&Style_Enabled)], PIX_RADIO_BORDER, 0.8));
if(QApplication::NormalColor!=QApplication::colorSpec() || itsFormMode)
{
- p->setPen(QPen(use[opts.coloredMouseOver && sflags&Style_MouseOver ? 4 : QT_BORDER(flags&Style_Enabled)], 1));
- p->drawArc(r, 0, 5760);
+ p->setPen(QPen(use[opts.coloredMouseOver && sflags&Style_MouseOver ? 4 : BORDER_VAL(flags&Style_Enabled)], 1));
+ p->drawArc(rect, 0, 5760);
}
if(set)
- p->drawPixmap(r.x(), r.y(), *getPixmap(on, PIX_RADIO_ON, 1.0));
- if(QApplication::NormalColor==QApplication::colorSpec() || itsFormMode)
- p->drawPixmap(r.x(), r.y(), *getPixmap(btn[sflags&Style_MouseOver ? 3 : 4], PIX_RADIO_LIGHT));
+ p->drawPixmap(rect.x(), rect.y(), *getPixmap(on, PIX_RADIO_ON, 1.0));
+ if(!coloredMo && (!opts.crButton || drawLight) && (QApplication::NormalColor==QApplication::colorSpec() || itsFormMode))
+ p->drawPixmap(rect.x(), rect.y(),
+ *getPixmap(btn[drawLight ? LIGHT_BORDER(app)
+ : (sflags&Style_MouseOver ? 3 : 4)],
+ lightBorder ? PIX_RADIO_INNER : PIX_RADIO_LIGHT));
p->restore();
}
break;
- }
case PE_DockWindowSeparator:
{
QRect r2(r);
@@ -2732,12 +3733,21 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
}
}
break;
+ case LINE_1DOT:
+ drawDot(p, r, itsBackgroundCols);
+ break;
default:
case LINE_DOTS:
drawDots(p, r, !(flags & Style_Horizontal), 1, 5, itsBackgroundCols, 0, 5);
}
break;
}
+ case PE_DockWindowResizeHandle:
+ if(flags&Style_Horizontal)
+ flags-=Style_Horizontal;
+ else
+ flags+=Style_Horizontal;
+ // Fall through intentional
case PE_Splitter:
{
if(itsHoverWidget && itsHoverWidget == p->device())
@@ -2746,66 +3756,110 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
const QColor *use(buttonColors(cg));
const QColor *border(borderColors(flags, use));
- p->fillRect(r, QColor(flags&Style_MouseOver
- ? shade(cg.background(), opts.highlightFactor)
- : cg.background()));
+ QColor color(cg.background());
+
+ if(0!=opts.tabBgnd && p->device() && inStackWidget(dynamic_cast<const QWidget *>(p->device())))
+ color=shade(color, TO_FACTOR(opts.tabBgnd));
+
+ if(flags&Style_MouseOver && opts.splitterHighlight)
+ drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.splitterHighlight)), p, r, !(flags&Style_Horizontal),
+ false, opts.selectionAppearance, WIDGET_SELECTION);
+ else
+ p->fillRect(r, color);
+
switch(opts.splitters)
{
+ case LINE_NONE:
+ break;
default:
+ case LINE_1DOT:
+ drawDot(p, r, border);
+ break;
case LINE_DOTS:
drawDots(p, r, flags&Style_Horizontal, NUM_SPLITTER_DASHES, 1, border, 0, 5);
break;
- case LINE_SUNKEN:
- drawLines(p, r, flags&Style_Horizontal, NUM_SPLITTER_DASHES, 1, border, 0, 3);
- break;
case LINE_FLAT:
- drawLines(p, r, flags&Style_Horizontal, NUM_SPLITTER_DASHES, 3, border, 0, 3, 0, false);
- break;
+ case LINE_SUNKEN:
case LINE_DASHES:
- drawLines(p, r, flags&Style_Horizontal, NUM_SPLITTER_DASHES, 1, border, 0, 3, 0);
+ drawLines(p, r, flags&Style_Horizontal, NUM_SPLITTER_DASHES, 3, border, 0, 3, opts.splitters);
}
break;
}
- case PE_DockWindowResizeHandle:
- {
- const QColor *use(backgroundColors(cg));
-
- drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal),
- ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_RAISED, false);
- break;
- }
case PE_GroupBoxFrame:
case PE_PanelGroupBox:
- if (!opts.framelessGroupBoxes)
+ if(FRAME_LINE==opts.groupBox)
+ {
+ QRect r2(r);
+ if(p && p->device() && dynamic_cast<QGroupBox *>(p->device()) &&
+ (!((QGroupBox *)(p->device()))->title().isEmpty() || ((QGroupBox *)(p->device()))->isCheckable()))
+ r2.addCoords(8, 0, -8, 0);
+ p->setPen(backgroundColors(cg)[STD_BORDER]);
+ p->drawLine(r2.x(), r2.y(), r2.x()+r2.width()-1, r2.y());
+ }
+ else if (FRAME_NONE!=opts.groupBox)
if(APP_OPENOFFICE==itsThemedApp || data.lineWidth()>0 || data.isDefault())
{
const QColor *use(backgroundColors(cg));
drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal),
- ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_FLAT);
+ opts.square&SQUARE_FRAME ? ROUNDED_NONE : ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_FLAT);
}
else
QCommonStyle::drawPrimitive(pe, p, r, cg, flags, data);
break;
- case PE_Panel:
case PE_WindowFrame:
+ if(data.lineWidth()>0 || data.isDefault())
+ drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal),
+ ROUNDED_NONE, backgroundColors(cg), WIDGET_MDI_WINDOW, true, BORDER_RAISED, false);
+ break;
+ case PE_Panel:
+ if((APP_KICKER==itsThemedApp && data.isDefault()) ||
+ dynamic_cast<QDockWindow *>(p->device()))
+ break;
+
if(APP_OPENOFFICE==itsThemedApp || data.lineWidth()>0 || data.isDefault())
{
- const QColor *use(
-#ifdef QTC_HIGHLIGHT_SCROLVIEWS
- flags&Style_HasFocus ? itsMenuitemCols :
-#endif
+ const QWidget *widget=p && p->device() ? dynamic_cast<const QWidget *>(p->device()) : 0L;
+ bool sv(widget && ::qt_cast<const QScrollView *>(widget)),
+ square((opts.square&SQUARE_SCROLLVIEW) &&
+ (sv ||
+ (widget && widget->parentWidget() && ::qt_cast<const QFrame *>(widget) &&
+ widget->parentWidget()->inherits("KateView"))));
+ const QColor *use(opts.highlightScrollViews && /*!square &&*/ flags&Style_HasFocus ? itsHighlightCols :
backgroundColors(cg));
- itsFormMode=itsIsTransKicker;
- drawBorder(cg.background(), p, r, cg,
- (SFlags)(flags|Style_Horizontal|Style_Enabled),
- ROUNDED_ALL, use, WIDGET_OTHER, APP_KICKER!=itsThemedApp, itsIsTransKicker
- ? BORDER_FLAT
- : flags&Style_Sunken
- ? BORDER_SUNKEN
- : BORDER_RAISED);
- itsFormMode=false;
+// if(square)
+// {
+// p->setPen(use[STD_BORDER]);
+// p->drawLine(r.bottomLeft(), r.topLeft());
+// p->drawLine(r.topLeft(), r.topRight());
+// if(!opts.gtkScrollViews)
+// p->setPen(use[STD_BORDER_BR]);
+// p->drawLine(r.topRight(), r.bottomRight());
+// p->drawLine(r.bottomRight(), r.bottomLeft());
+// }
+// else
+ {
+ itsFormMode=itsIsTransKicker;
+ if(sv && !opts.highlightScrollViews)
+ flags&=~Style_HasFocus;
+ if(sv && opts.etchEntry && ((QFrame *)widget)->lineWidth()>2)
+ {
+ drawEntryField(p, r, cg, flags, flags&Style_Enabled
+ ? /*flags&Style_MouseOver
+ ? ENTRY_MOUSE_OVER
+ :*/ flags&Style_HasFocus
+ ? ENTRY_FOCUS
+ : ENTRY_NONE
+ : ENTRY_NONE, square ? ROUNDED_NONE : ROUNDED_ALL, WIDGET_SCROLLVIEW);
+ }
+ else
+ drawBorder(cg.background(), p, r, cg,
+ (SFlags)(flags|Style_Horizontal|Style_Enabled),
+ square ? ROUNDED_NONE : ROUNDED_ALL, use, sv ? WIDGET_SCROLLVIEW : WIDGET_OTHER, APP_KICKER!=itsThemedApp,
+ itsIsTransKicker ? BORDER_FLAT : (flags&Style_Sunken ? BORDER_SUNKEN : BORDER_RAISED) );
+ itsFormMode=false;
+ }
}
else
QCommonStyle::drawPrimitive(pe, p, r, cg, flags, data);
@@ -2815,20 +3869,23 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
const QColor *use(backgroundColors(cg));
drawBorder(cg.background(), p, r, cg,
- (SFlags)(flags|Style_Horizontal|Style_Enabled),
- ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_RAISED, false);
+ (SFlags)(flags|Style_Horizontal|Style_Enabled),
+ opts.square&SQUARE_TAB_FRAME ? ROUNDED_NONE : ROUNDED_ALL, use, WIDGET_OTHER, true,
+ opts.borderTab ? BORDER_LIGHT : BORDER_RAISED, false);
break;
}
case PE_PanelPopup:
{
const QColor *use(backgroundColors(cg));
- p->setPen(use[QT_STD_BORDER]);
+ p->setPen(use[STD_BORDER]);
p->setBrush(NoBrush);
p->drawRect(r);
- if(opts.lighterPopupMenuBgnd)
+ if(!IS_FLAT_BGND(opts.menuBgndAppearance))
+ ;
+ else if(USE_LIGHTER_POPUP_MENU)
{
- p->setPen(/*opts.lighterPopupMenuBgnd ? */itsLighterPopupMenuBgndCol/* : cg.background()*/);
+ p->setPen(/*USE_LIGHTER_POPUP_MENU ? */itsLighterPopupMenuBgndCol/* : cg.background()*/);
p->drawRect(QRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2));
}
else
@@ -2836,7 +3893,7 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
p->setPen(use[0]);
p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1);
p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2);
- p->setPen(use[QT_FRAME_DARK_SHADOW]);
+ p->setPen(use[FRAME_DARK_SHADOW]);
p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-2);
p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()+r.height()-2);
}
@@ -2849,7 +3906,7 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
if(data.isDefault() || data.lineWidth()>1)
{
- p->setPen(use[QT_STD_BORDER]);
+ p->setPen(use[STD_BORDER]);
p->setBrush(NoBrush);
p->drawRect(r);
qDrawShadePanel(p, r.x()+1, r.y()+1, r.width()-2, r.height()-2,
@@ -2890,8 +3947,8 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
if(TB_NONE!=opts.toolbarBorders)
{
- const QColor *use=PE_PanelMenuBar==pe && itsActive
- ? itsMenubarCols
+ const QColor *use=PE_PanelMenuBar==pe
+ ? menuColors(cg, itsActive)
: backgroundColors(cg.background());
bool dark(TB_DARK==opts.toolbarBorders || TB_DARK_ALL==opts.toolbarBorders);
@@ -2929,7 +3986,7 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
{
QRect br(r),
ar(r);
- const QColor *use(itsButtonCols); // buttonColors(cg));
+ const QColor *use(flags&Style_Enabled ? itsButtonCols : itsBackgroundCols); // buttonColors(cg));
pe=flags&Style_Horizontal
? PE_ScrollBarAddLine==pe ? PE_ArrowRight : PE_ArrowLeft
@@ -2940,7 +3997,7 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
PE_ArrowDown==pe ? ROUNDED_BOTTOM :
PE_ArrowUp==pe ? ROUNDED_TOP : ROUNDED_NONE;
- if(flags&Style_Down)
+ if(flags&Style_Down && !opts.flatSbarButtons)
ar.addCoords(1, 1, 1, 1);
switch(opts.scrollbarType)
@@ -2954,13 +4011,15 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
{
round=ROUNDED_NONE;
br.addCoords(0, 0, 1, 0);
- ar.addCoords(1, 0, 1, 0);
+ if(opts.flatSbarButtons || !opts.vArrows)
+ ar.addCoords(1, 0, 1, 0);
}
else if(PE_ArrowUp==pe && r.y()>3)
{
round=ROUNDED_NONE;
br.addCoords(0, 0, 0, 1);
- ar.addCoords(0, 1, 0, 1);
+ if(opts.flatSbarButtons || !opts.vArrows)
+ ar.addCoords(0, 1, 0, 1);
}
break;
case SCROLLBAR_NEXT:
@@ -2968,20 +4027,32 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
{
round=ROUNDED_NONE;
br.addCoords(-1, 0, 0, 0);
- ar.addCoords(-1, 0, 0, -1);
+ if(opts.flatSbarButtons || !opts.vArrows)
+ ar.addCoords(-1, 0, 0, -1);
}
else if(PE_ArrowDown==pe)
{
round=ROUNDED_NONE;
br.addCoords(0, -1, 0, 0);
- ar.addCoords(0, -1, 0, -1);
+ if(opts.flatSbarButtons || !opts.vArrows)
+ ar.addCoords(0, -1, 0, -1);
}
break;
}
- drawLightBevel(p, br, cg, flags|Style_Raised,
- round, getFill(flags, use), use, true, true, WIDGET_SB_BUTTON);
+ if(!opts.flatSbarButtons)
+// No need to draw background here - drawn in CC_ScrollBar
+// {
+// if(!IS_FLAT(opts.sbarBgndAppearance) && SCROLLBAR_NONE!=opts.scrollbarType)
+// drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], p, r, flags&Style_Horizontal, false,
+// opts.sbarBgndAppearance, WIDGET_SB_BGND);
+// else
+// p->fillRect(br, itsBackgroundCols[ORIGINAL_SHADE]);
+// }
+// else
+ drawLightBevel(p, br, cg, flags|Style_Raised,
+ round, getFill(flags, use), use, true, true, WIDGET_SB_BUTTON);
- drawPrimitive(pe, p, ar, cg, flags);
+ ::drawArrow(p, ar, MO_ARROW(cg.buttonText()), pe, opts, false);
break;
}
case PE_ScrollBarSlider:
@@ -3013,40 +4084,51 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
{
//p->fillRect(r, Qt::black);
drawMenuItem(p, r, cg, false, ROUNDED_ALL,
- opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol
- : itsBackgroundCols[ORIGINAL_SHADE], itsMenuitemCols);
+ USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol
+ : itsBackgroundCols[ORIGINAL_SHADE], itsHighlightCols);
item->paintContents(p);
break;
}
}
}
#endif
-#ifndef QTC_PLAIN_FOCUS_ONLY
- if(opts.stdFocus)
+ if(FOCUS_STANDARD==opts.focus)
{
-#endif
p->setPen(Qt::black);
p->drawWinFocusRect(r);
-#ifndef QTC_PLAIN_FOCUS_ONLY
}
else
{
//Figuring out in what beast we are painting...
- const QColor *use(backgroundColors(cg));
- QWidget *widget(dynamic_cast<QWidget*>(p->device()));
+ QWidget *widget(dynamic_cast<QWidget*>(p->device()));
+ bool view(widget && (dynamic_cast<QScrollView*>(widget->parent()) ||
+ dynamic_cast<QListBox*>(widget->parent())));
- if(r.width()<4 || r.height()<4 ||
- (widget && (dynamic_cast<QScrollView*>(widget->parent()) ||
- dynamic_cast<QListBox*>(widget->parent()))))
+ if(widget && FOCUS_GLOW==opts.focus &&
+ (dynamic_cast<const QButton *>(widget) || dynamic_cast<const QComboBox *>(widget)))
+ return;
+
+ if(FOCUS_LINE==opts.focus)
+ {
+ p->setPen(view && flags&Style_Selected
+ ? cg.highlightedText()
+ : itsFocusCols[FOCUS_SHADE(flags&Style_Selected)]);
+ p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1);
+ }
+ else if(r.width()<4 || r.height()<4 || view)
{
- p->setPen(use[QT_FOCUS]);
- p->drawRect(r);
+// QRect r2(r);
+ p->setPen(view ? (flags&Style_Selected ? cg.highlightedText() : cg.text())
+ : itsFocusCols[FOCUS_SHADE(flags&Style_Selected)]);
+// if(view)
+// r2.addCoords(0, 0, 0, -2);
+ p->drawRect(r); // r2);
}
else
drawBorder(cg.background(), p, r, cg, Style_Horizontal,
- ROUNDED_ALL, use, WIDGET_OTHER, false, BORDER_FLAT, true, QT_FOCUS);
+ ROUNDED_ALL, itsFocusCols, WIDGET_FOCUS, false, BORDER_FLAT, true,
+ FOCUS_SHADE(flags&Style_Selected));
}
-#endif
break;
case PE_ArrowUp:
case PE_ArrowDown:
@@ -3061,45 +4143,32 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
{
QRect sr(r);
const QColor *use(buttonColors(cg));
- bool reverse(QApplication::reverseLayout()),
- doEtch(!itsFormMode && QTC_DO_EFFECT);
-
- if(doEtch)
- if(PE_SpinWidgetDown==pe || PE_SpinWidgetMinus==pe)
- sr.addCoords(0, 0, 0, -1);
- else
- sr.addCoords(0, 1, 0, 0);
-
- drawLightBevel(p, sr, cg, flags|Style_Horizontal, PE_SpinWidgetDown==pe || PE_SpinWidgetMinus==pe
- ? reverse
- ? ROUNDED_BOTTOMLEFT
- : ROUNDED_BOTTOMRIGHT
- : reverse
- ? ROUNDED_TOPLEFT
- : ROUNDED_TOPRIGHT,
- getFill(flags, use), use, true, true, WIDGET_SPIN);
-
- if(doEtch)
- {
- QRect er(r);
- p->setClipRegion(er);
- if(reverse)
- er.addCoords(0, 0, 2, 0);
- else
- er.addCoords(-2, 0, 0, 0);
- drawEtch(p, er, cg, PE_SpinWidgetUp==pe || PE_SpinWidgetPlus==pe,
- PE_SpinWidgetDown==pe || PE_SpinWidgetMinus==pe);
- p->setClipping(false);
- }
+ bool reverse(QApplication::reverseLayout());
+
+ if((!opts.unifySpinBtns || flags&Style_Sunken) && !opts.unifySpin)
+ drawLightBevel(p, sr, cg, flags|Style_Horizontal, PE_SpinWidgetDown==pe || PE_SpinWidgetMinus==pe
+ ? reverse
+ ? ROUNDED_BOTTOMLEFT
+ : ROUNDED_BOTTOMRIGHT
+ : reverse
+ ? ROUNDED_TOPLEFT
+ : ROUNDED_TOPRIGHT,
+ getFill(flags, use), use, true, true, WIDGET_SPIN);
if(PE_SpinWidgetUp==pe || PE_SpinWidgetDown==pe)
{
sr.setY(sr.y()+(PE_SpinWidgetDown==pe ? -2 : 1));
- if(flags&Style_Sunken)
+ if(opts.unifySpin)
+ {
+ sr.addCoords(reverse ? 1 : -1, 0, reverse ? 1 : -1, 0);
+ if(!opts.vArrows)
+ sr.setY(sr.y()+(PE_SpinWidgetDown==pe ? -2 : 2));
+ }
+ else if(flags&Style_Sunken)
sr.addCoords(1, 1, 1, 1);
- drawArrow(p, sr, cg, flags, PE_SpinWidgetUp==pe ? PE_ArrowUp : PE_ArrowDown, true);
+ ::drawArrow(p, sr, MO_ARROW(cg.buttonText()), PE_SpinWidgetUp==pe ? PE_ArrowUp : PE_ArrowDown, opts, !opts.unifySpin);
}
else
{
@@ -3110,10 +4179,10 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
if(l%2 != 0)
--l;
- if(flags&Style_Sunken)
+ if(flags&Style_Sunken && !opts.unifySpin)
c+=QPoint(1, 1);
- p->setPen(cg.buttonText());
+ p->setPen(MO_ARROW(cg.buttonText()));
p->drawLine(c.x()-l, c.y(), c.x()+l, c.y());
if(PE_SpinWidgetPlus==pe)
p->drawLine(c.x(), c.y()-l, c.x(), c.y()+l);
@@ -3122,20 +4191,37 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
}
case PE_PanelLineEdit:
{
+ const QWidget *widget=p && p->device() ? dynamic_cast<const QWidget *>(p->device()) : 0L;
+ bool scrollView=widget && ::qt_cast<const QScrollView *>(widget);
+
+// if((opts.square&SQUARE_SCROLLVIEW) && scrollView)
+// {
+// const QColor *use(backgroundColors(cg));
+//
+// p->setPen(use[STD_BORDER]);
+// p->drawLine(r.bottomLeft(), r.topLeft());
+// p->drawLine(r.topLeft(), r.topRight());
+// if(!opts.gtkScrollViews)
+// p->setPen(use[STD_BORDER_BR]);
+// p->drawLine(r.topRight(), r.bottomRight());
+// p->drawLine(r.bottomRight(), r.bottomLeft());
+// break;
+// }
+
bool isReadOnly(false),
isEnabled(true);
// panel is highlighted by default if it has focus, but if we have access to the
// widget itself we can try to avoid highlighting in case it's readOnly or disabled.
- if (p->device() && dynamic_cast<QLineEdit*>(p->device()))
+ if (!scrollView && widget && dynamic_cast<const QLineEdit*>(widget))
{
- QLineEdit *lineEdit(dynamic_cast<QLineEdit*>(p->device()));
+ const QLineEdit *lineEdit(dynamic_cast<const QLineEdit*>(widget));
isReadOnly = lineEdit->isReadOnly();
isEnabled = lineEdit->isEnabled();
if(flags&Style_Enabled && isReadOnly)
flags-=Style_Enabled;
}
-
+
// HACK!! (From Plastik)
//
// In this place there is no reliable way to detect if we are in khtml; the
@@ -3145,17 +4231,52 @@ void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &
if (p->device() && dynamic_cast<QPixmap*>(p->device()))
itsFormMode=true;
- drawEntryField(p, r, cg, flags, !isReadOnly && isEnabled && (flags&Style_HasFocus),
- ROUNDED_ALL);
+ if(scrollView && !opts.highlightScrollViews)
+ flags&=~Style_HasFocus;
+
+ QRect r2(r);
+ r2.addCoords(1, 1, -1, -1);
+// p->fillRect(r2, flags&Style_Enabled ? cg.base() : cg.background());
+ drawEntryField(p, r, cg, flags, !isReadOnly && isEnabled
+ ? flags&Style_MouseOver && !scrollView
+ ? ENTRY_MOUSE_OVER
+ : flags&Style_HasFocus
+ ? ENTRY_FOCUS
+ : ENTRY_NONE
+ : ENTRY_NONE,
+ (opts.square&SQUARE_SCROLLVIEW) && scrollView ? ROUNDED_NONE : ROUNDED_ALL,
+ scrollView ? WIDGET_SCROLLVIEW : WIDGET_ENTRY);
itsFormMode=false;
break;
}
case PE_StatusBarSection:
if(opts.drawStatusBarFrames)
- KStyle::drawPrimitive(pe, p, r, cg, flags, data);
+ BASE_STYLE::drawPrimitive(pe, p, r, cg, flags, data);
+ break;
+ case PE_SizeGrip:
+ {
+ QPointArray a;
+
+ if (QApplication::reverseLayout())
+ {
+ a.setPoints(3, 0,0, SIZE_GRIP_SIZE,SIZE_GRIP_SIZE, 0,SIZE_GRIP_SIZE);
+ a.translate(r.x(), r.y()+(r.height()-SIZE_GRIP_SIZE));
+ }
+ else
+ {
+ a.setPoints(3, SIZE_GRIP_SIZE,0, SIZE_GRIP_SIZE,SIZE_GRIP_SIZE, 0,SIZE_GRIP_SIZE);
+ a.translate(r.x()+(r.width()-SIZE_GRIP_SIZE), r.y()+(r.height()-SIZE_GRIP_SIZE));
+ }
+
+ p->save();
+ p->setBrush(itsBackgroundCols[2]);
+ p->setPen(itsBackgroundCols[2]);
+ p->drawPolygon(a);
+ p->restore();
break;
+ }
default:
- KStyle::drawPrimitive(pe, p, r, cg, flags, data);
+ BASE_STYLE::drawPrimitive(pe, p, r, cg, flags, data);
}
}
@@ -3187,42 +4308,66 @@ void QtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, QPainter *p, const Q
{
case KPE_ToolBarHandle:
{
- QRect r2(r);
- r2.addCoords(-1, -1, 2, 2);
- drawMenuOrToolBarBackground(p, r2, cg, false, flags&Style_Horizontal);
+ if(APPEARANCE_STRIPED!=opts.bgndAppearance)
+ {
+ QRect r2(r);
+ r2.addCoords(-1, -1, 2, 2);
+ drawMenuOrToolBarBackground(p, r2, cg, false, flags&Style_Horizontal);
+ }
drawHandleMarkers(p, r, flags, true, handles);
break;
}
case KPE_DockWindowHandle:
{
int x, y, w, h;
+ bool horizontal(flags & Style_Horizontal);
r.rect(&x, &y, &w, &h);
- if ((w <= 2) || (h <= 2))
- p->fillRect(r, cg.background().dark(105));
+
+ if(!IS_FLAT(opts.dwtAppearance))
+ drawBevelGradient(cg.background(), p, r, horizontal, false, opts.dwtAppearance, WIDGET_DOCK_WIDGET_TITLE);
else
+ p->fillRect(r, cg.background()); // .dark(DW_BGND));
+// p->setPen(itsBackgroundCols[STD_BORDER]);
+// if(horizontal)
+// p->drawLine(r.right(), r.top()-1, r.right(), r.bottom());
+// else
+// p->drawLine(r.left(), r.bottom(), r.right(), r.bottom());
+
+ if (w > 2 && h > 2)
{
QWidget *wid(const_cast<QWidget*>(widget));
- bool horizontal(flags & Style_Horizontal);
+ bool hasClose(dynamic_cast<const QDockWindow *>(wid->parentWidget()) &&
+ ((QDockWindow *)(wid->parentWidget()))->area() &&
+ ((QDockWindow *)(wid->parentWidget()))->isCloseEnabled());
QFont fnt(QApplication::font(wid));
QPixmap pix;
QString title(wid->parentWidget()->caption());
QPainter p2;
fnt.setPointSize(fnt.pointSize()-2);
+ if(hasClose)
+ if (horizontal)
+ h-=15;
+ else
+ w-=15;
// Draw the item on an off-screen pixmap to preserve Xft antialiasing for
// vertically oriented handles.
if (horizontal)
- pix.resize(h-2, w-2);
+ pix.resize(h, w);
else
- pix.resize(w-2, h-2);
+ pix.resize(w, h);
p2.begin(&pix);
- p2.fillRect(pix.rect(), cg.background().dark(105));
+ p2.fillRect(pix.rect(), cg.background()); // .dark(DW_BGND));
+ p2.setPen(itsBackgroundCols[STD_BORDER]);
+ p2.drawLine(pix.rect().left(), pix.rect().bottom(), pix.rect().right(), pix.rect().bottom());
p2.setPen(cg.text());
p2.setFont(fnt);
- p2.drawText(pix.rect(), AlignCenter,
+ QRect textRect(pix.rect());
+ textRect.addCoords(2, -3, -2, 0);
+ p2.drawText(textRect, AlignVCenter|(QApplication::reverseLayout() ? AlignRight : AlignLeft),
elliditide(title, QFontMetrics(fnt), pix.width()));
p2.end();
@@ -3232,10 +4377,10 @@ void QtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, QPainter *p, const Q
m.rotate(-90.0);
QPixmap vpix(pix.xForm(m));
- bitBlt(wid, r.x()+1, r.y()+1, &vpix);
+ bitBlt(wid, r.x(), r.y()+(hasClose ? 15 : 0), &vpix);
}
else
- bitBlt(wid, r.x()+1, r.y()+1, &pix);
+ bitBlt(wid, r.x(), r.y(), &pix);
}
break;
}
@@ -3246,16 +4391,16 @@ void QtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, QPainter *p, const Q
drawSliderGroove(p, r, cg, flags, widget);
break;
case KPE_SliderHandle:
- drawSliderHandle(p, r, cg, flags, widget ? ::qt_cast<QSlider *>(widget) : NULL);
+ drawSliderHandle(p, r, cg, flags, widget ? ::qt_cast<QSlider *>(widget) : 0L);
break;
case KPE_ListViewExpander:
{
- QRect ar(r.x()+((r.width()-(QTC_LV_SIZE+4))>>1), r.y()+((r.height()-(QTC_LV_SIZE+4))>>1), QTC_LV_SIZE+4,
- QTC_LV_SIZE+4);
+ QRect ar(r.x()+((r.width()-(LV_SIZE+4))>>1), r.y()+((r.height()-(LV_SIZE+4))>>1), LV_SIZE+4,
+ LV_SIZE+4);
- if(opts.lvLines)
+ if(LV_OLD==opts.lvLines)
{
- int lo(QTC_ROUNDED ? 2 : 0);
+ int lo(ROUNDED ? 2 : 0);
p->setPen(cg.mid());
p->drawLine(ar.x()+lo, ar.y(), (ar.x()+ar.width()-1)-lo, ar.y());
@@ -3265,7 +4410,7 @@ void QtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, QPainter *p, const Q
p->drawLine(ar.x()+ar.width()-1, ar.y()+lo, ar.x()+ar.width()-1,
(ar.y()+ar.height()-1)-lo);
- if(QTC_ROUNDED)
+ if(ROUNDED)
{
p->drawPoint(ar.x()+1, ar.y()+1);
p->drawPoint(ar.x()+1, ar.y()+ar.height()-2);
@@ -3280,11 +4425,11 @@ void QtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, QPainter *p, const Q
}
}
- drawArrow(p, ar, cg, flags|Style_Enabled, flags&Style_On // Collapsed = On
+ ::drawArrow(p, ar, flags&Style_Enabled ? cg.mid() : cg.text(), flags&Style_On // Collapsed = On
? QApplication::reverseLayout()
? PE_ArrowLeft
: PE_ArrowRight
- : PE_ArrowDown);
+ : PE_ArrowDown, opts);
break;
}
case KPE_ListViewBranch:
@@ -3302,7 +4447,7 @@ void QtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, QPainter *p, const Q
}
break;
default:
- KStyle::drawKStylePrimitive(kpe, p, widget, r, cg, flags, opt);
+ BASE_STYLE::drawKStylePrimitive(kpe, p, widget, r, cg, flags, opt);
}
}
@@ -3319,7 +4464,8 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
{
const QTabBar *tb((const QTabBar *)widget);
int tabIndex(tb->indexOf(data.tab()->identifier())),
- dark(APPEARANCE_FLAT==opts.appearance ? ORIGINAL_SHADE : QT_FRAME_DARK_SHADOW);
+ dark(APPEARANCE_FLAT==opts.appearance ? ORIGINAL_SHADE : FRAME_DARK_SHADOW),
+ moOffset(ROUNDED_NONE==opts.round || TAB_MO_TOP!=opts.tabMouseOver ? 1 : opts.round);
bool cornerWidget(false),
bottomCornerWidget(false),
reverse(QApplication::reverseLayout()),
@@ -3331,8 +4477,17 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
active(flags & Style_Selected),
itsHover(itsHoverTab && itsHoverTab->isEnabled() && data.tab()==itsHoverTab &&
!(flags&Style_Selected) &&
- tb->currentTab()!=tabIndex);
+ tb->currentTab()!=tabIndex),
+ glowMo(!active && itsHover && opts.coloredMouseOver && TAB_MO_GLOW==opts.tabMouseOver);
+ int sizeAdjust(!active && TAB_MO_GLOW==opts.tabMouseOver ? 1 : 0);
const QColor &fill(getTabFill(flags&Style_Selected, itsHover, itsBackgroundCols));
+ EBorder borderProfile(active || opts.borderInactiveTab
+ ? opts.borderTab
+ ? BORDER_LIGHT
+ : opts.colorSelTab && active
+ ? BORDER_FLAT
+ : BORDER_RAISED
+ : BORDER_FLAT);
if(reverse)
{
@@ -3356,6 +4511,17 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
QRect tr(r);
bool top(QTabBar::TriangularAbove==tb->shape() || QTabBar::RoundedAbove==tb->shape());
+ if(active && opts.tabBgnd)
+ {
+ QRect rx(tr);
+
+ if(top)
+ rx.addCoords(1, 6, -1, 0);
+ else
+ rx.addCoords(1, 0, -1, -6);
+ p->fillRect(rx, shade(cg.background(), TO_FACTOR(opts.tabBgnd)));
+ }
+
if(!active)
if(top)
tr.addCoords(0, 2, 0, 0);
@@ -3365,60 +4531,68 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
if(!firstTab && top && (APP_TORA==itsThemedApp || (APP_OPENOFFICE==itsThemedApp && !active)))
tr.addCoords(-1, 0, 0, 0);
- p->setClipRect(QRect(tr.x(), top ? tr.y() : tr.y()+2, tr.width(), top ? tr.height()-2 : tr.height()),
+ QRect glowTr(tr);
+
+ if(!active && TAB_MO_GLOW==opts.tabMouseOver)
+ glowTr.addCoords(sizeAdjust, 0, -sizeAdjust, 0);
+
+ p->setClipRect(QRect(tr.x(), top ? tr.y()-sizeAdjust : tr.y()+2, tr.width(), top ? tr.height()-2+(2*sizeAdjust) : tr.height()),
QPainter::CoordPainter);
- if(APPEARANCE_INVERTED==opts.appearance && active)
- p->fillRect(tr, cg.background());
+
+ bool invertedSel=APPEARANCE_INVERTED==opts.appearance && active;
+ QColor col(invertedSel ? cg.background() : fill);
+
+ if(opts.tabBgnd)
+ col=shade(col, TO_FACTOR(opts.tabBgnd));
+
+ if(invertedSel)
+ p->fillRect(glowTr, col);
else
- drawBevelGradient(fill, top, p, tr, true,
- top || (active && opts.colorSelTab) ? SHADE_TAB_SEL_LIGHT
- : SHADE_BOTTOM_TAB_SEL_DARK,
- top || (active && opts.colorSelTab) ? SHADE_TAB_SEL_DARK
- : SHADE_BOTTOM_TAB_SEL_LIGHT,
- active, active ? QTC_SEL_TAB_APP : QTC_NORM_TAB_APP, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT);
-
- drawBorder(cg.background(), p, tr, cg, flags|Style_Horizontal|Style_Enabled,
- active
+ drawBevelGradient(col, p, glowTr, true,
+ active, active ? SEL_TAB_APP : NORM_TAB_APP, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT);
+
+ drawBorder(cg.background(), p, glowTr, cg, flags|Style_Horizontal|Style_Enabled,
+ active || TAB_MO_GLOW==opts.tabMouseOver || opts.roundAllTabs
? (top ? ROUNDED_TOP : ROUNDED_BOTTOM)
: firstTab
? (top ? ROUNDED_TOPLEFT : ROUNDED_BOTTOMLEFT)
: lastTab
? (top ? ROUNDED_TOPRIGHT : ROUNDED_BOTTOMRIGHT)
- : ROUNDED_NONE, NULL, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT, true,
- active && !opts.colorSelTab ? BORDER_RAISED : BORDER_FLAT, false);
+ : ROUNDED_NONE, glowMo ? itsMouseOverCols : 0L, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT, true,
+ borderProfile, false);
+ if(glowMo)
+ {
+ glowTr.addCoords(-1, -1, 1, 1);
+ drawGlow(p, glowTr, cg, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT);
+ }
p->setClipping(false);
if(top)
{
if(active)
{
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(itsBackgroundCols[STD_BORDER]);
p->drawPoint(r.x(), r.y()+r.height()-2);
p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-2);
p->setPen(itsBackgroundCols[0]);
p->drawLine(r.x()+1, r.y()+r.height()-3, r.x()+1, r.y()+r.height()-1);
//p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-1);
- p->setPen(itsBackgroundCols[QT_FRAME_DARK_SHADOW]);
+ p->setPen(itsBackgroundCols[opts.borderTab ? 0 : FRAME_DARK_SHADOW]);
p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-2);
}
else
{
p->setPen(itsBackgroundCols[0]);
p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1);
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(itsBackgroundCols[STD_BORDER]);
p->drawLine(r.x(), r.y()+r.height()-2, r.x()+r.width()-1, r.y()+r.height()-2);
- if(opts.coloredMouseOver && itsHover)
- {
- p->setPen(itsMouseOverCols[ORIGINAL_SHADE]);
- p->drawLine(tr.x()+(firstTab ? opts.round : 1), tr.y()+1,
- tr.x()+tr.width()-((lastTab ? opts.round : 0)+1), tr.y()+1);
-
- p->setPen(itsMouseOverCols[QT_STD_BORDER]);
- p->drawLine(tr.x()+(firstTab ? opts.round : 1), tr.y(),
- tr.x()+tr.width()-((lastTab ? opts.round : 0)+1), tr.y());
- }
+ if(opts.coloredMouseOver && itsHover && TAB_MO_GLOW!=opts.tabMouseOver)
+ drawHighlight(p, QRect(tr.x()+(firstTab ? moOffset : 1),
+ tr.y()+(TAB_MO_TOP==opts.tabMouseOver ? 0 : tr.height()-3),
+ tr.width()-(firstTab || lastTab ? moOffset : 1), 2),
+ cg, true, !TAB_MO_TOP==opts.tabMouseOver);
}
if(((!reverse && firstTab) || (lastTab && reverse)) && !cornerWidget)
@@ -3426,35 +4600,38 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
int x(reverse ? r.x()+r.width()-1 : r.x()),
x2(reverse ? x-1 : x+1);
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(itsBackgroundCols[!active && TAB_MO_GLOW==opts.tabMouseOver && opts.round>ROUND_SLIGHT && !(opts.square&SQUARE_TAB_FRAME)
+ ? ORIGINAL_SHADE : STD_BORDER]);
p->drawLine(x, r.y()+r.height()-1, x, r.height()-2);
if(active)
{
p->setPen(itsBackgroundCols[reverse ? dark : 0]);
- p->drawLine(x2, r.y()+r.height()-1, x2, r.height()-2);
+ p->drawLine(x2, r.y()+r.height()-1, x2, r.y()+r.height()-2);
}
}
if(active && opts.highlightTab)
{
- p->setPen(itsMenuitemCols[0]);
+ p->setPen(itsHighlightCols[0]);
p->drawLine(tr.left(), tr.top()+1, tr.right(), tr.top()+1);
- p->setPen(midColor(fill, itsMenuitemCols[0], IS_FLAT(opts.tabAppearance) ? 1.0 : 1.2));
+ p->setPen(midColor(fill, itsHighlightCols[0])); // , IS_FLAT(opts.activeTabAppearance) ? 1.0 : 1.2));
p->drawLine(tr.left(), tr.top()+2, tr.right(), tr.top()+2);
p->setClipRect(QRect(tr.x(), tr.y(), tr.width(), 3), QPainter::CoordPainter);
drawBorder(cg.background(), p, tr, cg, flags|Style_Horizontal|Style_Enabled,
- ROUNDED_ALL, itsMenuitemCols, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT,
+ ROUNDED_ALL, itsHighlightCols, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT,
true, BORDER_FLAT, false, 3);
p->setClipping(false);
}
// Round top-left corner...
- if(ROUND_FULL==opts.round && APP_TORA!=itsThemedApp && firstTab && !active && !cornerWidget && !reverse) // && !isFirstKTabCtlTab)
+ if(!(opts.square&SQUARE_TAB_FRAME) && FULLLY_ROUNDED && APP_TORA!=itsThemedApp && firstTab && !active && !cornerWidget && !reverse) // && !isFirstKTabCtlTab)
{
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(itsBackgroundCols[STD_BORDER]);
p->drawPoint(r.x()+1, r.y()+r.height()-1);
- p->setPen(midColor(itsBackgroundCols[QT_STD_BORDER], cg.background()));
+ p->setPen(TAB_MO_GLOW==opts.tabMouseOver
+ ? itsBackgroundCols[STD_BORDER]
+ : midColor(itsBackgroundCols[STD_BORDER], cg.background()));
p->drawPoint(r.x()+1, r.y()+r.height()-2);
}
}
@@ -3462,56 +4639,57 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
{
if(active)
{
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(itsBackgroundCols[STD_BORDER]);
p->drawPoint(r.x(), r.y()+1);
p->drawPoint(r.x()+r.width()-1, r.y()+1);
p->setPen(itsBackgroundCols[0]);
p->drawLine(r.x()+1, r.y()+2, r.x()+1, r.y());
- p->setPen(itsBackgroundCols[QT_FRAME_DARK_SHADOW]);
+ p->setPen(itsBackgroundCols[opts.borderTab ? 0 : FRAME_DARK_SHADOW]);
p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y());
p->drawPoint(r.x()+r.width()-1, r.y());
}
else
{
- p->setPen(itsBackgroundCols[dark]);
+ p->setPen(itsBackgroundCols[opts.borderTab ? 0 : dark]);
p->drawLine(r.x(), r.y(), r.x()+r.width()-1, r.y());
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(itsBackgroundCols[STD_BORDER]);
p->drawLine(r.x(), r.y()+1, r.x()+r.width()-1, r.y()+1);
-
- if(opts.coloredMouseOver && itsHover)
- {
- p->setPen(itsMouseOverCols[ORIGINAL_SHADE]);
- p->drawLine(tr.x()+(firstTab ? opts.round : 1), tr.y()+tr.height()-2,
- tr.x()+tr.width()-((lastTab ? opts.round : 0)+1), tr.y()+tr.height()-2);
-
- p->setPen(itsMouseOverCols[3]);
- p->drawLine(tr.x()+(firstTab ? opts.round : 1), tr.y()+tr.height()-1,
- tr.x()+tr.width()-((lastTab ? opts.round : 0)+1), tr.y()+tr.height()-1);
- }
+
+ if(opts.coloredMouseOver && itsHover && TAB_MO_GLOW!=opts.tabMouseOver)
+ drawHighlight(p, QRect(tr.x()+(firstTab ? moOffset : 1),
+ tr.y()+(TAB_MO_TOP==opts.tabMouseOver ? tr.height()-2 : 1),
+ tr.width()-(firstTab || lastTab ? moOffset : 1), 2),
+ cg, true, TAB_MO_TOP==opts.tabMouseOver);
}
+ if(TAB_MO_GLOW==opts.tabMouseOver && opts.round<=ROUND_SLIGHT && !(opts.square&SQUARE_TAB_FRAME) && !reverse && firstTab && !cornerWidget)
+ {
+ p->setPen(itsBackgroundCols[STD_BORDER]);
+ p->drawPoint(r.x(), r.y());
+ }
+
if(active && opts.highlightTab)
{
- p->setPen(itsMenuitemCols[0]);
+ p->setPen(itsHighlightCols[0]);
p->drawLine(tr.left(), tr.bottom()-1, tr.right(), tr.bottom()-1);
- p->setPen(midColor(fill, itsMenuitemCols[0]));
+ p->setPen(midColor(fill, itsHighlightCols[0]));
p->drawLine(tr.left(), tr.bottom()-2, tr.right(), tr.bottom()-2);
p->setClipRect(QRect(tr.x(), tr.y()+r.height()-3, tr.width(), 3), QPainter::CoordPainter);
drawBorder(cg.background(), p, tr, cg, flags|Style_Horizontal|Style_Enabled,
- ROUNDED_ALL, itsMenuitemCols, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT,
+ ROUNDED_ALL, itsHighlightCols, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT,
true, BORDER_FLAT, false, 3);
p->setClipping(false);
}
- if(ROUND_FULL==opts.round && APP_TORA!=itsThemedApp && firstTab && !bottomCornerWidget)// && !isFirstKTabCtlTab)
+ if(!(opts.square&SQUARE_TAB_FRAME) && FULLLY_ROUNDED && APP_TORA!=itsThemedApp && firstTab && !bottomCornerWidget)// && !isFirstKTabCtlTab)
{
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
+ p->setPen(itsBackgroundCols[STD_BORDER]);
p->drawPoint(r.x(), reverse ? r.y()+r.width()-1 : r.y());
// Round bottom-left corner...
if(!active&& !reverse)
{
p->drawPoint(r.x()+1, r.y()-1);
- p->setPen(midColor(itsBackgroundCols[QT_STD_BORDER], cg.background()));
+ p->setPen(midColor(itsBackgroundCols[STD_BORDER], cg.background()));
p->drawPoint(r.x()+1, r.y());
}
}
@@ -3583,7 +4761,7 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
#endif
case CE_PushButtonLabel: // Taken from Highcolor and Plastik...
{
- int x, y, w, h;
+ int x, y, w, h, arrowOffset=DO_EFFECT ? 1 : 0;
r.rect(&x, &y, &w, &h);
@@ -3612,10 +4790,9 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
//the widget
else
{
- drawPrimitive(PE_ArrowDown, p,
- visualRect(QRect((x + w) - (dx + margin), y, dx, h), r), cg,
- flags, data);
- w-=dx;
+ ::drawArrow(p, visualRect(QRect((x + w) - (dx + margin + arrowOffset), y, dx, h), r),
+ MO_ARROW(cg.buttonText()), PE_ArrowDown, opts);
+ w-=(dx+arrowOffset);
}
}
@@ -3656,8 +4833,8 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
}
if (cornArrow) //Draw over the icon
- drawPrimitive(PE_ArrowDown, p, visualRect(QRect(x + w - 6, x + h - 6, 7, 7), r),
- cg, flags, data);
+ ::drawArrow(p, visualRect(QRect(x + w - (6+arrowOffset), y + h - (6+arrowOffset), 7, 7), r),
+ MO_ARROW(cg.buttonText()), PE_ArrowDown, opts);
if(xo && iw)
{
@@ -3674,9 +4851,11 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
// Make the label indicate if the button is a default button or not
int i,
j(opts.embolden && button->isDefault() ? 2 : 1);
- const QColor &textCol(!opts.stdSidebarButtons && button->isFlat() &&
- button->inherits("KMultiTabBarTab") &&
- (button->isOn() || flags&Style_On)
+ bool sidebar(!opts.stdSidebarButtons &&
+ ((button->isFlat() && button->inherits("KMultiTabBarTab")) ||
+ (button->parentWidget() && button->inherits("Ideal::Button") &&
+ button->parentWidget()->inherits("Ideal::ButtonBar"))));
+ const QColor &textCol(sidebar && (button->isOn() || flags&Style_On)
? QApplication::palette().active().highlightedText()
: button->colorGroup().buttonText());
@@ -3686,7 +4865,8 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
button->pixmap(), button->text(), -1, &textCol);
// Draw a focus rect if the button has focus
- if (flags & Style_HasFocus)
+ if (flags&Style_HasFocus && FOCUS_GLOW!=opts.focus &&
+ !(flags&Style_MouseOver && FOCUS_FULL==opts.focus && MO_NONE!=opts.coloredMouseOver))
drawPrimitive(PE_FocusRect, p, visualRect(subRect(SR_PushButtonFocusRect,
widget), widget), cg, flags);
break;
@@ -3701,34 +4881,46 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
int tab(data.tabWidth()),
maxpmw(data.maxIconWidth()),
x, y, w, h;
+ bool reverse(QApplication::reverseLayout());
+ maxpmw=QMAX(maxpmw, constMenuPixmapWidth);
r.rect(&x, &y, &w, &h);
- if((flags & Style_Active)&&(flags & Style_Enabled))
- drawMenuItem(p, r, cg, false, ROUNDED_ALL,
- opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol
- : itsBackgroundCols[ORIGINAL_SHADE], itsMenuitemCols);
- else if(widget->erasePixmap() && !widget->erasePixmap()->isNull())
+ if(widget->erasePixmap() && !widget->erasePixmap()->isNull())
p->drawPixmap(x, y, *widget->erasePixmap(), x, y, w, h);
else
- p->fillRect(r, opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol
- : itsBackgroundCols[ORIGINAL_SHADE]);
+ {
+ if(IS_FLAT_BGND(opts.menuBgndAppearance))
+ p->fillRect(r, USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol
+ : itsBackgroundCols[ORIGINAL_SHADE]);
+
+ if(opts.menuStripe)
+ drawBevelGradient(menuStripeCol(), p,
+ QRect(reverse ? r.right()-maxpmw : r.x(),
+ r.y(), maxpmw, r.height()), false,
+ false, opts.menuStripeAppearance, WIDGET_OTHER);
+ }
+
+ if((flags&Style_Active) && (flags&Style_Enabled))
+ drawMenuItem(p, r, flags, cg, false, ROUNDED_ALL,
+ USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol
+ : itsBackgroundCols[ORIGINAL_SHADE],
+ opts.useHighlightForMenu ? itsHighlightCols : itsBackgroundCols);
if(!mi)
break;
if(mi->isSeparator())
{
- y=r.y()+((r.height()/2)-1);
- p->setPen(itsBackgroundCols[QT_STD_BORDER]);
- p->drawLine(r.x()+4, y, r.x()+r.width()-5, y);
+ y=r.y()+(r.height()>>1);
+ p->setPen(itsBackgroundCols[MENU_SEP_SHADE]);
+ p->drawLine(r.x()+3+(!reverse && opts.menuStripe ? maxpmw : 0), y,
+ r.x()+r.width()-4-(reverse && opts.menuStripe ? maxpmw : 0), y);
// p->setPen(itsBackgroundCols[0]);
// p->drawLine(r.x()+4, y+1, r.x()+r.width()-5, y+1);
break;
}
- maxpmw=QMAX(maxpmw, 16);
-
QRect cr, ir, tr, sr;
// check column
cr.setRect(r.left(), r.top(), maxpmw, r.height());
@@ -3739,8 +4931,6 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
// item column
ir.setCoords(cr.right()+4, r.top(), tr.right()-4, r.bottom());
- bool reverse(QApplication::reverseLayout());
-
if(reverse)
{
cr=visualRect(cr, r);
@@ -3749,7 +4939,7 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
ir=visualRect(ir, r);
}
- if(mi->iconSet())
+ if(mi->iconSet() && opts.menuIcons)
{
// Select the correct icon from the iconset
QIconSet::Mode mode=flags & Style_Active
@@ -3761,7 +4951,7 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
// Then draw a "pressed" background behind the icon
if(popupmenu->isCheckable() && mi->isChecked())
drawLightBevel((flags & Style_Active)&&(flags & Style_Enabled)
- ? itsMenuitemCols[ORIGINAL_SHADE]
+ ? itsHighlightCols[ORIGINAL_SHADE]
: cg.background(), p, QRect(cr.x()+1, cr.y()+2, cr.width()-2, cr.height()-4),
cg, flags|Style_Sunken|Style_Horizontal, ROUNDED_ALL,
getFill(flags|Style_Sunken|Style_Enabled, itsBackgroundCols),
@@ -3776,47 +4966,19 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
}
else if(popupmenu->isCheckable() && mi->isChecked())
drawPrimitive(PE_CheckMark, p, cr, cg,
- (flags &(Style_Enabled|Style_Active))| Style_On|QTC_MENU_ITEM);
+ (flags &(Style_Enabled|(opts.useHighlightForMenu ? Style_Active : 0)))| Style_On|MENU_ITEM);
- QColor textcolor,
- embosscolor;
+ QColor textCol(flags&Style_Enabled
+ ? flags&Style_Active && opts.useHighlightForMenu
+ ? cg.highlightedText()
+ : cg.foreground()
+ : cg.mid());
- if(flags&Style_Active)
- {
- if(!(flags & Style_Enabled))
- {
- textcolor=cg.text();
- embosscolor=cg.light();
- }
- else
- {
- textcolor=cg.highlightedText();
- embosscolor=cg.midlight().light();
- }
- }
- else if(!(flags & Style_Enabled))
- {
- textcolor=cg.text();
- embosscolor=cg.light();
- }
- else
- {
- textcolor=cg.foreground();
- embosscolor=cg.light();
- }
- p->setPen(textcolor);
+ p->setPen(textCol);
if(mi->custom())
{
p->save();
- if(!(flags & Style_Enabled))
- {
- p->setPen(cg.light());
- mi->custom()->paint(p, cg,(flags & Style_Enabled)?(flags & Style_Active): 0,
- flags & Style_Enabled, ir.x()+1, ir.y()+1, ir.width()-1,
- ir.height()-1);
- p->setPen(textcolor);
- }
mi->custom()->paint(p, cg,(flags & Style_Enabled)?(flags & Style_Active): 0,
flags & Style_Enabled, ir.x(), ir.y(), ir.width(), ir.height());
p->restore();
@@ -3830,37 +4992,10 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
// draw accelerator/tab-text
if(t>=0)
- {
- int alignFlag(AlignVCenter | ShowPrefix | DontClip | SingleLine);
-
- alignFlag |=(reverse ? AlignLeft : AlignRight);
-
- if(!(flags & Style_Enabled))
- {
- p->setPen(embosscolor);
- tr.moveBy(1, 1);
- p->drawText(tr, alignFlag, text.mid(t +1));
- tr.moveBy(-1,-1);
- p->setPen(textcolor);
- }
+ p->drawText(tr, AlignVCenter|ShowPrefix|DontClip|SingleLine|(reverse ? AlignLeft : AlignRight),
+ text.mid(t+1));
- p->drawText(tr, alignFlag, text.mid(t +1));
- }
-
- int alignFlag(AlignVCenter | ShowPrefix | DontClip | SingleLine);
-
- alignFlag |=(reverse ? AlignRight : AlignLeft);
-
- if(!(flags & Style_Enabled))
- {
- p->setPen(embosscolor);
- ir.moveBy(1, 1);
- p->drawText(ir, alignFlag, text, t);
- ir.moveBy(-1,-1);
- p->setPen(textcolor);
- }
-
- p->drawText(ir, alignFlag, text, t);
+ p->drawText(ir, AlignVCenter|ShowPrefix|DontClip|SingleLine|(reverse ? AlignRight : AlignLeft), text, t);
}
else if(mi->pixmap())
{
@@ -3876,7 +5011,7 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
}
if(mi->popup())
- drawArrow(p, sr, cg, flags, reverse ? PE_ArrowLeft : PE_ArrowRight, false, true);
+ ::drawArrow(p, sr, textCol, reverse ? PE_ArrowLeft : PE_ArrowRight, opts);
break;
}
case CE_MenuBarItem:
@@ -3897,9 +5032,10 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
}
if(active)
- drawMenuItem(p, r, cg, true, down && opts.roundMbTopOnly ? ROUNDED_TOP : ROUNDED_ALL,
+ drawMenuItem(p, r, flags, cg, true, down && opts.roundMbTopOnly ? ROUNDED_TOP : ROUNDED_ALL,
itsMenubarCols[ORIGINAL_SHADE],
- opts.colorMenubarMouseOver || down ? itsMenuitemCols : itsBackgroundCols);
+ opts.useHighlightForMenu && (opts.colorMenubarMouseOver || down)
+ ? itsHighlightCols : itsBackgroundCols);
if(data.isDefault())
break;
@@ -3911,16 +5047,10 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
mi->pixmap(), QString::null);
else
{
- const QColor *col=(opts.colorMenubarMouseOver && active) || (!opts.colorMenubarMouseOver && down)
- ? opts.customMenuTextColor
- ? &opts.customMenuSelTextColor
- : &cg.highlightedText()
- : itsActive
+ const QColor *col=((opts.colorMenubarMouseOver && active) || (!opts.colorMenubarMouseOver && down))
? opts.customMenuTextColor
- ? &opts.customMenuNormTextColor
- : SHADE_BLEND_SELECTED==opts.shadeMenubars ||
- (SHADE_CUSTOM==opts.shadeMenubars &&
- TOO_DARK(itsMenubarCols[ORIGINAL_SHADE]))
+ ? &opts.customMenuSelTextColor
+ : opts.useHighlightForMenu
? &cg.highlightedText()
: &cg.foreground()
: &cg.foreground();
@@ -3942,25 +5072,49 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
drawMenuOrToolBarBackground(p, r, cg, false, Qt::Horizontal==wind->orientation());
}
else
- KStyle::drawControl(control, p, widget, r, cg, flags, data);
+ BASE_STYLE::drawControl(control, p, widget, r, cg, flags, data);
break;
case CE_ProgressBarGroove:
{
- if(opts.gradientPbGroove)
- drawBevelGradient(flags & Style_Enabled ? cg.base() : cg.background(), false, p, r, true,
- getWidgetShade(WIDGET_TROUGH, true, false, opts.progressAppearance),
- getWidgetShade(WIDGET_TROUGH, false, false, opts.progressAppearance),
- false, APPEARANCE_GRADIENT, WIDGET_TROUGH);
- else
+ QRect rx(r);
+ bool doEtch(DO_EFFECT && opts.borderProgress);
+ QColor col;
+
+ if(doEtch)
+ rx.addCoords(1, 1, -1, -1);
+
+ switch(opts.progressGrooveColor)
{
- p->setBrush(flags & Style_Enabled ? cg.base() : cg.background());
- p->drawRect(r);
+ default:
+ case ECOLOR_BASE:
+ col=cg.base();
+ break;
+ case ECOLOR_BACKGROUND:
+ col=cg.background();
+ break;
+ case ECOLOR_DARK:
+ col=itsBackgroundCols[2];
}
+ drawBevelGradient(col, p, rx, true,
+ false, opts.progressGrooveAppearance, WIDGET_PBAR_TROUGH);
+
const QColor *use(backgroundColors(cg));
- drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal),
- ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_SUNKEN);
+ if(opts.borderProgress)
+ drawBorder(cg.background(), p, rx, cg, (SFlags)(flags|Style_Horizontal),
+ (opts.square&SQUARE_PROGRESS) ? ROUNDED_NONE : ROUNDED_ALL, use, WIDGET_OTHER, true,
+ IS_FLAT(opts.progressGrooveAppearance) && ECOLOR_DARK!=opts.progressGrooveColor ? BORDER_SUNKEN : BORDER_FLAT);
+ else
+ {
+ p->setPen(itsBackgroundCols[STD_BORDER]);
+ p->drawLine(r.topLeft(), r.topRight());
+ p->drawLine(r.bottomLeft(), r.bottomRight());
+ }
+
+ if(doEtch)
+ drawEtch(p, r, cg, false, (opts.square&SQUARE_PROGRESS));
+
break;
}
case CE_ProgressBarContents:
@@ -3970,7 +5124,7 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
if(0==steps)//Busy indicator
{
- static const int barWidth(10);
+ static const int barWidth(PROGRESS_CHUNK_WIDTH*3.4);
int progress(pb->progress() % (2*(r.width()-barWidth)));
@@ -3979,10 +5133,8 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
else if(progress > r.width()-barWidth)
progress = (r.width()-barWidth)-(progress-(r.width()-barWidth));
- p->fillRect(r, flags & Style_Enabled ? cg.base() : cg.background());
- drawLightBevel(cg.background(), p, QRect(r.x()+progress, r.y(), barWidth,
- r.height()), cg, flags, ROUNDED_ALL, itsMenuitemCols[ORIGINAL_SHADE],
- itsMenuitemCols, true, true, WIDGET_PROGRESSBAR);
+ drawProgress(p, QRect(r.x()+progress, r.y(), barWidth, r.height()), cg, flags,
+ (opts.square&SQUARE_PROGRESS) ? ROUNDED_NONE : ROUNDED_ALL, widget);
}
else
{
@@ -3996,24 +5148,71 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
if(QApplication::reverseLayout())
drawProgress(p, QRect(cr.x()+(cr.width()-width), cr.y(), width,
cr.height()), cg, flags,
- width==cr.width() ? ROUNDED_NONE : ROUNDED_LEFT, widget);
+ width==cr.width() || (opts.square&SQUARE_PROGRESS) ? ROUNDED_NONE : ROUNDED_ALL, widget);
else
drawProgress(p, QRect(cr.x(), cr.y(), width, cr.height()), cg, flags,
- width==cr.width() ? ROUNDED_NONE : ROUNDED_RIGHT, widget);
+ width==cr.width() || (opts.square&SQUARE_PROGRESS) ? ROUNDED_NONE : ROUNDED_ALL, widget);
}
}
break;
}
+ case CE_ProgressBarLabel:
+ {
+ const QProgressBar* pb = (const QProgressBar*)widget;
+ QRect cr = subRect(SR_ProgressBarContents, widget);
+ double progress = pb->progress();
+ bool reverse = QApplication::reverseLayout();
+ int steps = pb->totalSteps();
+
+ if (!cr.isValid())
+ return;
+
+ if(opts.boldProgress) // This is the only change fro the KStyle code!
+ {
+ QFont font = p->font();
+ font.setBold(true);
+ p->setFont(font);
+ }
+
+ // Draw label
+ if (progress > 0 || steps == 0)
+ {
+ double pg = (steps == 0) ? 1.0 : progress / steps;
+ int width = QMIN(cr.width(), (int)(pg * cr.width()));
+ QRect crect;
+ if (reverse)
+ crect.setRect(cr.x()+(cr.width()-width), cr.y(), cr.width(), cr.height());
+ else
+ crect.setRect(cr.x()+width, cr.y(), cr.width(), cr.height());
+
+ p->save();
+ p->setPen(pb->isEnabled() ? (reverse ? cg.text() : cg.highlightedText()) : cg.text());
+ p->drawText(r, AlignCenter, pb->progressString());
+ p->setClipRect(crect);
+ p->setPen(reverse ? cg.highlightedText() : cg.text());
+ p->drawText(r, AlignCenter, pb->progressString());
+ p->restore();
+ }
+ else
+ {
+ p->setPen(cg.text());
+ p->drawText(r, AlignCenter, pb->progressString());
+ }
+ break;
+ }
case CE_PushButton:
{
const QPushButton *button(static_cast<const QPushButton *>(widget));
- bool sidebar(button->isFlat() && button->inherits("KMultiTabBarTab"));
+ bool sidebar(!opts.stdSidebarButtons &&
+ ((button->isFlat() && button->inherits("KMultiTabBarTab")) ||
+ (button->parentWidget() && button->inherits("Ideal::Button") &&
+ button->parentWidget()->inherits("Ideal::ButtonBar"))));
- if(!opts.stdSidebarButtons && sidebar)
+ if(sidebar)
{
QRect r2(r);
- flags|=QTC_TOGGLE_BUTTON;
+ flags|=TOGGLE_BUTTON;
if(button->isOn())
flags|=Style_On;
@@ -4066,10 +5265,10 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
flags|=Style_ButtonDefault;
if(button->isToggleButton())
- flags|=QTC_TOGGLE_BUTTON;
+ flags|=TOGGLE_BUTTON;
if(sidebar)
- flags|=QTC_NO_ETCH_BUTTON;
+ flags|=NO_ETCH_BUTTON;
drawPrimitive(PE_ButtonCommand, p, r, cg, flags);
if (button->isDefault() && IND_CORNER==opts.defBtnIndicator)
@@ -4083,13 +5282,91 @@ void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidge
drawPrimitive(PE_Indicator, p, r, cg, flags, data);
itsFormMode = false;
break;
+ case CE_CheckBoxLabel:
+ if(opts.crHighlight || FOCUS_GLOW==opts.focus)
+ {
+ const QCheckBox *checkbox((const QCheckBox *)widget);
+
+ if(flags&Style_MouseOver && opts.crHighlight &&
+#if QT_VERSION >= 0x030200
+ HOVER_CHECK==itsHover && itsHoverWidget && itsHoverWidget==widget &&
+#endif
+ !isFormWidget(widget))
+ {
+#if QT_VERSION >= 0x030200
+ QRect cr(checkbox->rect());
+ QRegion r(QRect(cr.x(), cr.y(), visualRect(subRect(SR_CheckBoxFocusRect, widget),
+ widget).width()+
+ pixelMetric(PM_IndicatorWidth)+4,
+ cr.height()));
+
+#else
+ QRegion r(checkbox->rect());
+#endif
+ r-=visualRect(subRect(SR_CheckBoxIndicator, widget), widget);
+ p->setClipRegion(r);
+ drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), p, checkbox->rect(), true,
+ false, opts.selectionAppearance, WIDGET_SELECTION);
+ p->setClipping(false);
+ }
+ int alignment(QApplication::reverseLayout() ? AlignRight : AlignLeft);
+
+ drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg,
+ flags & Style_Enabled, checkbox->pixmap(), checkbox->text());
+
+ if(checkbox->hasFocus() && FOCUS_GLOW!=opts.focus)
+ drawPrimitive(PE_FocusRect, p, visualRect(subRect(SR_CheckBoxFocusRect, widget),
+ widget), cg, flags);
+ }
+ else
+ BASE_STYLE::drawControl(control, p, widget, r, cg, flags, data);
+ break;
case CE_RadioButton:
itsFormMode=isFormWidget(widget);
drawPrimitive(PE_ExclusiveIndicator, p, r, cg, flags, data);
itsFormMode=false;
break;
+ case CE_RadioButtonLabel:
+ if(opts.crHighlight || FOCUS_GLOW==opts.focus)
+ {
+ const QRadioButton *radiobutton((const QRadioButton *)widget);
+
+ if(flags&Style_MouseOver && opts.crHighlight &&
+#if QT_VERSION >= 0x030200
+ HOVER_RADIO==itsHover && itsHoverWidget && itsHoverWidget==widget &&
+#endif
+ !isFormWidget(widget))
+ {
+#if QT_VERSION >= 0x030200
+ QRect rb(radiobutton->rect());
+ QRegion r(QRect(rb.x(), rb.y(),
+ visualRect(subRect(SR_RadioButtonFocusRect, widget),
+ widget).width()+
+ pixelMetric(PM_ExclusiveIndicatorWidth)+4,
+ rb.height()));
+#else
+ QRegion r(radiobutton->rect());
+#endif
+ r-=visualRect(subRect(SR_RadioButtonIndicator, widget), widget);
+ p->setClipRegion(r);
+ drawBevelGradient(shade(cg.background(), TO_FACTOR(opts.crHighlight)), p, radiobutton->rect(), true,
+ false, opts.selectionAppearance, WIDGET_SELECTION);
+ p->setClipping(false);
+ }
+
+ int alignment(QApplication::reverseLayout() ? AlignRight : AlignLeft);
+
+ drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, flags & Style_Enabled,
+ radiobutton->pixmap(), radiobutton->text());
+
+ if(radiobutton->hasFocus() && FOCUS_GLOW!=opts.focus)
+ drawPrimitive(PE_FocusRect, p, visualRect(subRect(SR_RadioButtonFocusRect,
+ widget), widget), cg, flags);
+ break;
+ }
+ // Fall through intentional!
default:
- KStyle::drawControl(control, p, widget, r, cg, flags, data);
+ BASE_STYLE::drawControl(control, p, widget, r, cg, flags, data);
}
}
@@ -4101,7 +5378,7 @@ void QtCurveStyle::drawControlMask(ControlElement control, QPainter *p, const QW
case CE_PushButton:
case CE_MenuBarItem:
{
- int offset(r.width()<QTC_MIN_BTN_SIZE || r.height()<QTC_MIN_BTN_SIZE ? 1 : 2);
+ int offset(r.width()<MIN_ROUND_FULL_SIZE || r.height()<MIN_ROUND_FULL_SIZE ? 1 : 2);
p->fillRect(r, color0);
p->fillRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2, color1);
@@ -4115,7 +5392,7 @@ void QtCurveStyle::drawControlMask(ControlElement control, QPainter *p, const QW
break;
}
default:
- KStyle::drawControlMask(control, p, widget, r, data);
+ BASE_STYLE::drawControlMask(control, p, widget, r, data);
}
}
@@ -4130,7 +5407,7 @@ void QtCurveStyle::drawComplexControlMask(ComplexControl control, QPainter *p, c
drawControlMask(CE_PushButton, p, widget, r, data);
break;
default:
- KStyle::drawComplexControlMask(control, p, widget, r, data);
+ BASE_STYLE::drawComplexControlMask(control, p, widget, r, data);
}
}
@@ -4143,35 +5420,54 @@ QRect QtCurveStyle::subRect(SubRect subrect, const QWidget *widget)const
{
case SR_PushButtonFocusRect:
{
- int dbw1(pixelMetric(PM_ButtonDefaultIndicator, widget)),
- dbw2(dbw1*2),
- border(3),
- border2=(border*2);
-
- rect.setRect(wrect.x()+border +dbw1, wrect.y()+border +dbw1,
- wrect.width()-border2-dbw2,
- wrect.height()-border2-dbw2);
-
-
- if(!isFormWidget(widget) && QTC_DO_EFFECT)
- rect.addCoords(0, 1, 0, -1);
+ if(FOCUS_FULL==opts.focus)
+ rect=wrect;
+ else
+ {
+ int dbw1(pixelMetric(PM_ButtonDefaultIndicator, widget)),
+ dbw2(dbw1*2),
+ border(3),
+ border2=(border*2);
+
+ rect.setRect(wrect.x()+border +dbw1, wrect.y()+border +dbw1,
+ wrect.width()-border2-dbw2,
+ wrect.height()-border2-dbw2);
+ }
- break;
+ if(!isFormWidget(widget) && DO_EFFECT)
+ rect.addCoords(1, 1, -1, -1);
+ return rect;
}
- case SR_ProgressBarGroove:
- rect=QRect(widget->rect());
- break;
+
case SR_ProgressBarContents:
+ return opts.fillProgress
+ ? DO_EFFECT && opts.borderProgress
+ ? wrect
+ : QRect(wrect.left()-1, wrect.top()-1, wrect.width()+2, wrect.height()+2)
+ : DO_EFFECT && opts.borderProgress
+ ? QRect(wrect.left()+2, wrect.top()+2, wrect.width()-4, wrect.height()-4)
+ : QRect(wrect.left()+1, wrect.top()+1, wrect.width()-2, wrect.height()-2);
case SR_ProgressBarLabel:
- rect=QRect(wrect.left()+2, wrect.top()+2, wrect.width()-4, wrect.height()-4);
- break;
+ case SR_ProgressBarGroove:
+ return wrect;
+ case SR_DockWindowHandleRect:
+ return wrect;
default:
- rect=KStyle::subRect(subrect, widget);
+ return BASE_STYLE::subRect(subrect, widget);
}
return rect;
}
+// This is a hack, as QTitleBar is private!!!
+class QTitleBar : public QWidget
+{
+ public:
+
+ bool isActive() const;
+ QWidget *window() const;
+};
+
void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const QWidget *widget,
const QRect &r, const QColorGroup &cg, SFlags flags,
SCFlags controls, SCFlags active,
@@ -4188,7 +5484,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
QRect button(querySubControlMetrics(control, widget, SC_ToolButton, data)),
menuarea(querySubControlMetrics(control, widget, SC_ToolButtonMenu,
data));
- SFlags bflags(flags|QTC_STD_TOOLBUTTON),
+ SFlags bflags(flags|STD_TOOLBUTTON),
mflags(flags);
if (APP_KORN==itsThemedApp)
@@ -4198,12 +5494,23 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
}
const QToolBar *tb(widget->parentWidget()
- ? ::qt_cast<const QToolBar *>(widget->parentWidget()) : NULL);
+ ? ::qt_cast<const QToolBar *>(widget->parentWidget()) : 0L);
bool onControlButtons(false),
onExtender(!tb &&
widget->parentWidget() &&
widget->parentWidget()->inherits( "QToolBarExtensionWidget") &&
- ::qt_cast<QToolBar *>(widget->parentWidget()->parentWidget()));
+ ::qt_cast<QToolBar *>(widget->parentWidget()->parentWidget())),
+ isDWClose(!tb && !onExtender &&
+ widget->parentWidget() &&
+ widget->parentWidget()->inherits( "QDockWindowHandle"));
+
+ if(isDWClose)
+ {
+ p->fillRect(r, cg.background());//.dark(DW_BGND));
+ if(!(flags&Style_MouseOver) && !(active & SC_ToolButton))
+ break;
+ bflags|=DW_CLOSE_BUTTON;
+ }
if (!tb && !onExtender && widget->parentWidget() &&
!qstrcmp(widget->parentWidget()->name(), "qt_maxcontrols"))
@@ -4221,10 +5528,10 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
if(onControlButtons ||
(toolbutton->parentWidget() && toolbutton->parentWidget()->parentWidget() &&
::qt_cast<const QMenuBar *>(toolbutton->parentWidget()->parentWidget())))
- bflags|=QTC_NO_ETCH_BUTTON;
+ bflags|=NO_ETCH_BUTTON;
// If we're pressed, on, or raised...
-#if KDE_VERSION >= 0x30200
+#if defined QTC_QT_ONLY || !defined KDE_VERSION || KDE_VERSION >= 0x30200
if(bflags &(Style_Down | Style_On | Style_Raised) || onControlButtons)
#else
if(bflags &(Style_Down | Style_On | Style_Raised | Style_MouseOver) ||
@@ -4237,12 +5544,12 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
if(tb)
if(Qt::Vertical==tb->orientation())
- bflags|=QTC_VERTICAL_TB_BUTTON;
+ bflags|=VERTICAL_TB_BUTTON;
else
bflags|=Style_Horizontal;
if(toolbutton->isToggleButton())
- bflags|=QTC_TOGGLE_BUTTON;
+ bflags|=TOGGLE_BUTTON;
drawPrimitive(PE_ButtonTool, p, button, cg, bflags, data);
}
@@ -4255,7 +5562,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
toolbutton->pos());
else if(widget->parent())
{
- QToolBar *tb(NULL);
+ QToolBar *tb(0L);
if(::qt_cast<const QToolBar *>(widget->parent()))
tb=(QToolBar*)widget->parent();
@@ -4286,13 +5593,16 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
{
if(mflags &(Style_Down | Style_On | Style_Raised))
drawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, data);
- drawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, data);
+ ::drawArrow(p, menuarea, MO_ARROW(cg.buttonText()), PE_ArrowDown, opts, true);
}
if(toolbutton->hasFocus() && !toolbutton->focusProxy())
{
QRect fr(toolbutton->rect());
- fr.addCoords(3, 3,-3,-3);
+ if(FOCUS_FULL!=opts.focus)
+ fr.addCoords(2, 2,-2,-2);
+ if(DO_EFFECT)
+ fr.addCoords(1, 1,-1,-1);
drawPrimitive(PE_FocusRect, p, fr, cg);
}
@@ -4301,6 +5611,11 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
}
case CC_ComboBox:
{
+ if(APP_OPENOFFICE==itsThemedApp)
+ flags&=~Style_MouseOver;
+
+ itsFormMode = isFormWidget(widget);
+
const QComboBox *combobox((const QComboBox *)widget);
QRect frame(QStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget,
SC_ComboBoxFrame,
@@ -4315,9 +5630,14 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
bool editable(combobox->editable()),
sunken(combobox->listBox() ? combobox->listBox()->isShown() : false),
reverse(QApplication::reverseLayout());
- SFlags fillFlags(flags);
+ SFlags fillFlags(flags),
+ doEtch(!itsFormMode && DO_EFFECT && (!editable || opts.etchEntry));
- itsFormMode = isFormWidget(widget);
+ if(doEtch)
+ {
+ frame.addCoords(1, 1, -1, -1);
+ field.addCoords(reverse ? -1 : 1, 1, reverse ? -1 : 0, -1);
+ }
if(sunken)
{
@@ -4326,7 +5646,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
fillFlags-=Style_MouseOver;
}
- if(editable ||(!itsFormMode && QTC_DO_EFFECT && qstrcmp(widget->name(), kdeToolbarWidget)))
+ if(editable ||(!itsFormMode && DO_EFFECT && qstrcmp(widget->name(), kdeToolbarWidget)))
{
p->setPen(cg.background());
p->drawRect(r);
@@ -4334,41 +5654,73 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
if(controls&SC_ComboBoxFrame && frame.isValid())
{
- if(editable && HOVER_CB_ARROW!=itsHover && fillFlags&Style_MouseOver)
- fillFlags-=Style_MouseOver;
+ if(editable && opts.unifyCombo)
+ {
+ if(reverse)
+ frame.addCoords(0, 1, 2, -1);
+ else
+ frame.addCoords(-1, 1, -1, -1);
+ p->fillRect(frame, flags&Style_Enabled ? cg.base() : cg.background());
+ }
+ else
+ {
+ const QColor *cols=itsComboBtnCols && editable && flags&Style_Enabled ? itsComboBtnCols : use;
- if(opts.coloredMouseOver && fillFlags&Style_MouseOver && editable && !sunken)
- frame.addCoords(reverse ? 0 : 1, 0, reverse ? 1 : 0, 0);
+ if(editable && HOVER_CB_ARROW!=itsHover)
+ fillFlags&=~Style_MouseOver;
- drawLightBevel(p, frame, cg, fillFlags|Style_Raised|Style_Horizontal,
- controls&SC_ComboBoxEditField && field.isValid() && editable
- ? (reverse ? ROUNDED_LEFT : ROUNDED_RIGHT) : ROUNDED_ALL,
- getFill(fillFlags, use), use, true, true, WIDGET_STD_BUTTON);
- }
+ // if(opts.coloredMouseOver && fillFlags&Style_MouseOver && editable && !sunken)
+ // frame.addCoords(reverse ? 0 : 1, 0, reverse ? 1 : 0, 0);
- if(controls&SC_ComboBoxArrow && arrow.isValid())
- {
- if(sunken)
- arrow.addCoords(1, 1, 1, 1);
- drawPrimitive(PE_ArrowDown, p, arrow, cg, flags & ~Style_MouseOver);
+ drawLightBevel(p, frame, cg, fillFlags|Style_Raised|Style_Horizontal,
+ controls&SC_ComboBoxEditField && field.isValid() && editable
+ ? (reverse ? ROUNDED_LEFT : ROUNDED_RIGHT) : ROUNDED_ALL,
+ getFill(fillFlags, cols, false, (SHADE_DARKEN==opts.comboBtn ||
+ (SHADE_NONE!=opts.comboBtn && !(flags&Style_Enabled))) &&
+ editable),
+ cols, true, true, editable ? WIDGET_COMBO_BUTTON : WIDGET_COMBO);
+ }
}
if(controls&SC_ComboBoxEditField && field.isValid())
{
if(editable)
{
- field.addCoords(-1,-1, 0, 1);
+ if(opts.unifyCombo)
+ {
+ field=r;
+ if(DO_EFFECT)
+ field.addCoords(1, 1, -1, -1);
+ }
+ else
+ field.addCoords(-1,-1, 0, 1);
p->setPen(flags&Style_Enabled ? cg.base() : cg.background());
p->drawRect(field);
- field.addCoords(-2,-2, 2, 2);
- drawEntryField(p, field, cg, fillFlags, flags&Style_Enabled &&
- (flags&Style_HasFocus), reverse ? ROUNDED_RIGHT : ROUNDED_LEFT,
- WIDGET_STD_BUTTON);
+ if(!opts.unifyCombo)
+ field.addCoords(-2,-2, 2, 2);
+ SFlags fieldFlags(flags);
+ if(!opts.unifyCombo && HOVER_CB_ENTRY!=itsHover)
+ fieldFlags&=~Style_MouseOver;
+ drawEntryField(p, field, cg, fillFlags, fieldFlags&Style_Enabled
+ ? fieldFlags&Style_MouseOver
+ ? ENTRY_MOUSE_OVER
+ : fieldFlags&Style_HasFocus
+ ? ENTRY_FOCUS
+ : ENTRY_NONE
+ : ENTRY_NONE,
+ (opts.square&SQUARE_ENTRY)
+ ? ROUNDED_NONE
+ : opts.unifyCombo
+ ? ROUNDED_ALL
+ : reverse
+ ? ROUNDED_RIGHT
+ : ROUNDED_LEFT,
+ WIDGET_COMBO);
}
- else
+ else if(opts.comboSplitter && !(SHADE_DARKEN==opts.comboBtn || itsComboBtnCols))
{
field.addCoords(1, sunken ? 2 : 1, sunken ? 2 : 1, -1);
- p->setPen(use[QT_BORDER(flags&Style_Enabled)]);
+ p->setPen(use[BORDER_VAL(flags&Style_Enabled)]);
p->drawLine(reverse ? field.left()-3 : field.right(), field.top(),
reverse ? field.left()-3 : field.right(), field.bottom());
if(!sunken)
@@ -4379,49 +5731,155 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
}
}
- if((flags & Style_HasFocus) && !editable)
+ if(flags&Style_HasFocus && !editable && FOCUS_GLOW!=opts.focus)
{
- QRect fr(QStyle::visualRect(subRect(SR_ComboBoxFocusRect, widget), widget));
+ QRect fr;
- if(reverse)
- fr.addCoords(3, 0, 0, 0);
+ if(FOCUS_FULL==opts.focus)
+ fr=frame;
+ else if(opts.comboSplitter)
+ {
+ fr=QStyle::visualRect(subRect(SR_ComboBoxFocusRect, widget), widget);
+ if(reverse)
+ fr.addCoords(3, 0, 0, 0);
+ else
+ fr.addCoords(0, 0, -2, 0);
+ if(!itsFormMode && DO_EFFECT)
+ fr.addCoords(1, 1, -1, -1);
+ }
else
- fr.addCoords(0, 0, -2, 0);
+ {
+ fr=frame;
+ fr.addCoords(3, 3, -3, -3);
+ }
+
+ if(!(flags&Style_MouseOver && FOCUS_FULL==opts.focus && MO_NONE!=opts.coloredMouseOver))
+ drawPrimitive(PE_FocusRect, p, fr, cg, flags | Style_FocusAtBorder,
+ QStyleOption(cg.highlight()));
+ }
+ }
- if(!itsFormMode && QTC_DO_EFFECT)
- fr.addCoords(0, 1, 0, -1);
- drawPrimitive(PE_FocusRect, p, fr, cg, flags | Style_FocusAtBorder,
- QStyleOption(cg.highlight()));
+ if(controls&SC_ComboBoxArrow && arrow.isValid())
+ {
+ if(!editable && (SHADE_DARKEN==opts.comboBtn || itsComboBtnCols))
+ {
+ SFlags btnFlags(flags);
+ QRect btn(arrow.x(), frame.y(), arrow.width()+1, frame.height());
+ const QColor *cols=SHADE_DARKEN==opts.comboBtn || !(flags&Style_Enabled) ? use : itsComboBtnCols;
+ if(!sunken)
+ btnFlags|=Style_Raised;
+ p->save();
+ p->setClipRect(btn);
+ if(!opts.comboSplitter)
+ btn.addCoords(reverse ? 0 : -2, 0, reverse ? 2 : 0, 0);
+ if(!DO_EFFECT)
+ btn.addCoords(0, 0, 1, 0);
+ drawLightBevel(p, btn, cg, btnFlags|Style_Horizontal, reverse ? ROUNDED_LEFT : ROUNDED_RIGHT,
+ getFill(btnFlags, cols, false, SHADE_DARKEN==opts.comboBtn ||
+ (SHADE_NONE!=opts.comboBtn && !(flags&Style_Enabled))),
+ cols, true, true, WIDGET_COMBO);
+ p->restore();
}
+
+ SFlags arrowFlags(flags);
+ if(sunken && !opts.unifyCombo)
+ arrow.addCoords(1, 1, 1, 1);
+ if(editable && HOVER_CB_ARROW!=itsHover)
+ arrowFlags&=~Style_MouseOver;
+ ::drawArrow(p, arrow, MO_ARROW_X(arrowFlags, cg.buttonText()), PE_ArrowDown, opts);
+ }
+
+ if(doEtch)
+ {
+ bool glowFocus(USE_GLOW_FOCUS(flags&Style_MouseOver) && flags&Style_HasFocus && flags&Style_Enabled);
+
+ if(!sunken && !editable &&
+ ((MO_GLOW==opts.coloredMouseOver && flags&Style_MouseOver)/* ||
+ (FOCUS_FULL==opts.focus && flags&Style_HasFocus)*/ || glowFocus))
+ drawGlow(p, widget ? widget->rect() : r, cg, WIDGET_COMBO, glowFocus ? itsFocusCols : NULL);
+ else
+ drawEtch(p, widget ? widget->rect() : r, cg,
+ !editable && EFFECT_SHADOW==opts.buttonEffect && !sunken, editable && (opts.square&SQUARE_ENTRY));
}
- p->setPen(flags & Style_Enabled ? cg.buttonText() : cg.mid());
+ p->setPen(cg.buttonText());
itsFormMode = false;
break;
}
case CC_SpinWidget:
{
+ itsFormMode = isFormWidget(widget);
+
const QSpinWidget *spinwidget((const QSpinWidget *)widget);
QRect frame(querySubControlMetrics(CC_SpinWidget, widget, SC_SpinWidgetFrame,
data)),
up(spinwidget->upRect()),
- down(spinwidget->downRect());
+ down(spinwidget->downRect()),
+ all(frame.unite(up).unite(down));
bool hw(itsHoverWidget && itsHoverWidget==spinwidget),
reverse(QApplication::reverseLayout()),
- doFrame((controls&SC_SpinWidgetFrame) && frame.isValid());
+ doFrame((controls&SC_SpinWidgetFrame) && frame.isValid()),
+ doEtch(!itsFormMode && DO_EFFECT && opts.etchEntry);
+
+ if(doEtch)
+ {
+ down.addCoords(reverse ? 1 : 0, 0, reverse ? 0 : -1, -1);
+ up.addCoords(reverse ? 1 : 0, 1, reverse ? 0 : -1, 0);
+ frame.addCoords(reverse ? 0 : 1, 1, reverse ? -1 : 0, -1);
+ }
if(flags&Style_MouseOver)
flags-=Style_MouseOver;
- if(!reverse && doFrame)
+ if(opts.unifySpin)
+ drawEntryField(p, all, cg, flags, spinwidget && flags&Style_Enabled
+ ? flags&Style_MouseOver || hw
+ ? ENTRY_MOUSE_OVER
+ : flags&Style_HasFocus || spinwidget->hasFocus()
+ ? ENTRY_FOCUS
+ : ENTRY_NONE
+ : ENTRY_NONE,
+ ROUNDED_ALL, WIDGET_SPIN);
+ else
{
- itsFormMode = isFormWidget(widget);
- frame.setWidth(frame.width()+1);
+ if(!reverse && doFrame)
+ {
+ frame.setWidth(frame.width()+1);
+
+ drawEntryField(p, frame, cg, flags,
+ spinwidget && flags&Style_Enabled
+ ? flags&Style_MouseOver || hw
+ ? ENTRY_MOUSE_OVER
+ : flags&Style_HasFocus || spinwidget->hasFocus()
+ ? ENTRY_FOCUS
+ : ENTRY_NONE
+ : ENTRY_NONE,
+ ROUNDED_LEFT, WIDGET_SPIN);
+ }
- drawEntryField(p, frame, cg, flags,
- spinwidget ? spinwidget->hasFocus() && (flags&Style_Enabled) : false,
- ROUNDED_LEFT, WIDGET_SPIN);
- itsFormMode=false;
+ if(opts.unifySpinBtns)
+ {
+ QRect btns=up.unite(down);
+ const QColor *use(buttonColors(cg));
+ int btnFlags=flags;
+
+ btnFlags&=~(Style_Sunken|Style_MouseOver);
+ btnFlags|=Style_Horizontal;
+
+ drawLightBevel(p, btns, cg, btnFlags, reverse ? ROUNDED_LEFT : ROUNDED_RIGHT, getFill(btnFlags, use),
+ use, true, true, WIDGET_SPIN);
+ if(hw && (HOVER_SW_DOWN==itsHover || HOVER_SW_UP==itsHover) && flags&Style_Enabled && !(flags&Style_Sunken))
+ {
+ btnFlags|=Style_MouseOver;
+ p->save();
+ p->setClipRect(HOVER_SW_UP==itsHover ? up : down);
+ drawLightBevel(p, btns, cg, btnFlags, reverse ? ROUNDED_LEFT : ROUNDED_RIGHT, getFill(btnFlags, use),
+ use, true, true, WIDGET_SPIN);
+ p->restore();
+ }
+ p->setPen(use[BORDER_VAL(style&Style_Enabled)]);
+ p->drawLine(down.x()+2, down.y(), down.x()+down.width()-3, down.y());
+ }
}
if((controls&SC_SpinWidgetUp) && up.isValid())
@@ -4435,8 +5893,8 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
if(spinwidget->buttonSymbols()==QSpinWidget::PlusMinus)
pe=PE_SpinWidgetPlus;
if(!spinwidget->isUpEnabled())
- upflags^=Style_Enabled;
- drawPrimitive(pe, p, up, cg,
+ upflags&=~Style_Enabled;
+ drawPrimitive(pe, p, up, !(upflags&Style_Enabled) && spinwidget ? spinwidget->palette().disabled() : cg,
upflags |((active==SC_SpinWidgetUp)
? Style_On | Style_Sunken : Style_Raised));
}
@@ -4451,21 +5909,32 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
if(spinwidget->buttonSymbols()==QSpinWidget::PlusMinus)
pe=PE_SpinWidgetMinus;
if(!spinwidget->isDownEnabled())
- downflags^=Style_Enabled;
- drawPrimitive(pe, p, down, cg,
+ downflags&=~Style_Enabled;
+ drawPrimitive(pe, p, down, !(downflags&Style_Enabled) && spinwidget ? spinwidget->palette().disabled() : cg,
downflags |((active==SC_SpinWidgetDown)
? Style_On | Style_Sunken : Style_Raised));
}
- if(reverse && doFrame)
+ if(!opts.unifySpin)
{
- itsFormMode = isFormWidget(widget);
- frame.setWidth(frame.width()+1);
- drawEntryField(p, frame, cg, flags,
- spinwidget ? spinwidget->hasFocus() && (flags&Style_Enabled) : false,
- ROUNDED_RIGHT, WIDGET_SPIN);
- itsFormMode=false;
+ if(reverse && doFrame)
+ {
+ frame.setWidth(frame.width()+1);
+ drawEntryField(p, frame, cg, flags,
+ spinwidget && flags&Style_Enabled
+ ? flags&Style_MouseOver || hw
+ ? ENTRY_MOUSE_OVER
+ : flags&Style_HasFocus || spinwidget->hasFocus()
+ ? ENTRY_FOCUS
+ : ENTRY_NONE
+ : ENTRY_NONE,
+ ROUNDED_RIGHT, WIDGET_SPIN);
+ }
+
+ if(doEtch)
+ drawEtch(p, spinwidget ? spinwidget->rect() : r, cg, false, (opts.square&SQUARE_ENTRY));
}
+ itsFormMode=false;
break;
}
case CC_ScrollBar:
@@ -4478,7 +5947,7 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
atMin(maxed || sb->value()==sb->minValue()),
atMax(maxed || sb->value()==sb->maxValue());
SFlags sflags((horiz ? Style_Horizontal : Style_Default) |
- (maxed ? Style_Default : Style_Enabled));
+ (maxed || !widget->isEnabled() ? Style_Default : Style_Enabled));
QRect subline(querySubControlMetrics(control, widget, SC_ScrollBarSubLine,
data)),
addline(querySubControlMetrics(control, widget, SC_ScrollBarAddLine,
@@ -4526,8 +5995,8 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
sbRect.addCoords(0, 0, -1, 0);
}
-#ifndef QTC_SIMPLE_SCROLLBARS
- if(sbRect.isValid() && SCROLLBAR_NONE==opts.scrollbarType)
+#ifndef SIMPLE_SCROLLBARS
+ if(sbRect.isValid() && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons))
if(horiz)
sbRect.addCoords(0, 0, -1, 0);
else
@@ -4535,40 +6004,98 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
#endif
}
- if (useThreeButtonScrollBar)
+ else if (useThreeButtonScrollBar)
if (horiz)
subline2.moveBy(-addline.width(), 0);
else
subline2.moveBy(0, -addline.height());
+ if(opts.flatSbarButtons)
+ switch(opts.scrollbarType)
+ {
+ case SCROLLBAR_KDE:
+ if(horiz)
+ sbRect.addCoords(subline.width(), 0, -(addline.width()+subline2.width()), 0);
+ else
+ sbRect.addCoords(0, subline.height(), 0, -(addline.height()+subline2.height()));
+ break;
+ case SCROLLBAR_WINDOWS:
+ if(horiz)
+ sbRect.addCoords(subline.width(), 0, -(addline.width()), 0);
+ else
+ sbRect.addCoords(0, subline.height(), 0, -(addline.height()));
+ break;
+ case SCROLLBAR_NEXT:
+ if(horiz)
+ sbRect.addCoords(subline.width()+subline2.width(), 0, 0, 0);
+ else
+ sbRect.addCoords(0, subline.height()+subline2.height(), 0, 0);
+ break;
+ case SCROLLBAR_PLATINUM:
+ if(horiz)
+ sbRect.addCoords(0, 0, -(addline.width()+subline2.width()), 0);
+ else
+ sbRect.addCoords(0, 0, 0, -(addline.height()+subline2.height()));
+ default:
+ break;
+ }
+
// Draw trough...
const QColor *trough(itsBackgroundCols); // backgroundColors(cg));
- bool noButtons(SCROLLBAR_NONE==opts.scrollbarType);
+ bool noButtons((SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) && ROUNDED);
QRect s2(subpage), a2(addpage);
-#ifndef QTC_SIMPLE_SCROLLBARS
+#ifndef SIMPLE_SCROLLBARS
if(noButtons)
{
// Increase clipping to allow trough to "bleed" into slider corners...
- a2.addCoords(-3, -3, 3, 3);
- s2.addCoords(-3, -3, 3, 3);
+ a2.addCoords(-2, -2, 2, 2);
+ s2.addCoords(-2, -2, 2, 2);
}
#endif
+ p->save();
+ if(opts.flatSbarButtons)
+ p->setClipRegion(QRegion(s2)+QRegion(addpage)+QRegion(addline)+QRegion(subline)+QRegion(subline2));
+ else
+ p->setClipRegion(QRegion(s2)+QRegion(addpage));
+
+ if(opts.flatSbarButtons && SCROLLBAR_NONE!=opts.scrollbarType && ROUNDED && !IS_FLAT(opts.sbarBgndAppearance))
+ drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], p, r, flags&Style_Horizontal, false,
+ opts.sbarBgndAppearance, WIDGET_SB_BGND);
+ else if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) && IS_FLAT(opts.sbarBgndAppearance))
+ {
+ QColor color(cg.background());
- p->setClipRegion(QRegion(s2)+QRegion(addpage));
- drawLightBevel(p, sbRect, cg, sflags|Style_Down,
-#ifndef QTC_SIMPLE_SCROLLBARS
- SCROLLBAR_NONE==opts.scrollbarType ? ROUNDED_ALL :
+ if(0!=opts.tabBgnd && inStackWidget(widget))
+ color=shade(color, TO_FACTOR(opts.tabBgnd));
+ p->fillRect(sbRect, cg.background());
+ }
+
+ sflags&=~(Style_Down|Style_On|Style_Sunken);
+
+ if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons))
+ if(horiz)
+ sbRect.addCoords(0, THIN_SBAR_MOD, 0, -THIN_SBAR_MOD);
+ else
+ sbRect.addCoords(THIN_SBAR_MOD, 0, -THIN_SBAR_MOD, 0);
+
+ drawLightBevel(p, sbRect, cg, sflags/*|Style_Down*/,
+#ifndef SIMPLE_SCROLLBARS
+ !(opts.square&SQUARE_SB_SLIDER) && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)
+ ? ROUNDED_ALL :
#endif
ROUNDED_NONE,
- trough[2], trough, true, true, WIDGET_TROUGH);
- p->setClipping(false);
+ trough[2], trough, true, true,
+ opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons)
+ ? WIDGET_SLIDER_TROUGH : WIDGET_TROUGH);
+ p->restore();
if(/*(controls&SC_ScrollBarSubLine) && */subline.isValid())
{
- bool enable=(!maxed && sb->value()!=sb->minValue());
+ bool enable=!atMin;
- drawPrimitive(PE_ScrollBarSubLine, p, subline, cg, sflags |
+ drawPrimitive(PE_ScrollBarSubLine, p, subline, !enable && sb ? sb->palette().disabled() : cg,
+ sflags |
//(enable ? Style_Enabled : Style_Default) |
(enable && hw && HOVER_SB_SUB==itsHover
? Style_MouseOver : Style_Default) |
@@ -4576,16 +6103,21 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
&& SC_ScrollBarSubLine==active ? Style_Down : Style_Default));
if (useThreeButtonScrollBar && subline2.isValid())
- drawPrimitive(PE_ScrollBarSubLine, p, subline2, cg, sflags |
+ {
+ if(IS_FLAT(opts.sbarBgndAppearance))
+ p->fillRect(subline2, cg.background());
+ drawPrimitive(PE_ScrollBarSubLine, p, subline2, !enable && sb ? sb->palette().disabled() : cg,
+ sflags |
//(enable ? Style_Enabled : Style_Default) |
(enable && hw && HOVER_SB_SUB2==itsHover
? Style_MouseOver : Style_Default) |
(enable && (!hw || HOVER_SB_SUB2==itsHover || HOVER_NONE==itsHover)
&& SC_ScrollBarSubLine==active ? Style_Down : Style_Default));
+ }
}
if(/*(controls&SC_ScrollBarAddLine) && */addline.isValid())
{
- bool enable=(!maxed && sb->value()!=sb->maxValue());
+ bool enable=!atMax;
// See KHTML note at top of file
if(itsFormMode && SCROLLBAR_NEXT!=opts.scrollbarType)
@@ -4594,7 +6126,8 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
else
addline.addCoords(0, 0, 0, -1);
- drawPrimitive(PE_ScrollBarAddLine, p, addline, cg, sflags |
+ drawPrimitive(PE_ScrollBarAddLine, p, addline, !enable && sb ? sb->palette().disabled() : cg,
+ sflags |
//(enable ? Style_Enabled : Style_Default) |
(enable && hw && HOVER_SB_ADD==itsHover
? Style_MouseOver : Style_Default) |
@@ -4619,8 +6152,8 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
// region...
if(!(controls&SC_ScrollBarSlider))
p->setClipRegion(QRegion(s2)+QRegion(addpage));
-#ifdef QTC_INCREASE_SB_SLIDER
- else
+#ifdef INCREASE_SB_SLIDER
+ else if(!opts.flatSbarButtons)
{
if(atMax)
switch(opts.scrollbarType)
@@ -4651,6 +6184,14 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
}
#endif
+ if(opts.thinSbarGroove)
+ if(opts.flatSbarButtons && SCROLLBAR_NONE!=opts.scrollbarType && ROUNDED)
+ drawBevelGradient(itsBackgroundCols[ORIGINAL_SHADE], p, slider, flags&Style_Horizontal, false,
+ opts.sbarBgndAppearance, WIDGET_SB_BGND);
+ else if(opts.thinSbarGroove && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons) &&
+ IS_FLAT(opts.sbarBgndAppearance))
+ p->fillRect(slider, cg.background());
+
drawPrimitive(PE_ScrollBarSlider, p, slider, cg, sflags |
//(maxed ? Style_Default : Style_Enabled) |
(!maxed && hw && HOVER_SB_SLIDER==itsHover
@@ -4663,10 +6204,10 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
drawPrimitive(PE_FocusRect, p, QRect(slider.x()+2, slider.y()+2,
slider.width()-5, slider.height()-5), cg, Style_Default);
-#ifndef QTC_SIMPLE_SCROLLBARS
- if(noButtons && (!atMin || !atMax))
+#ifndef SIMPLE_SCROLLBARS
+ if(noButtons && (!atMin || !atMax) && !opts.thinSbarGroove)
{
- p->setPen(backgroundColors(cg)[QT_STD_BORDER]);
+ p->setPen(backgroundColors(cg)[STD_BORDER]);
if(horiz)
{
@@ -4708,8 +6249,8 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
}
}
#endif
- if(!(controls&SC_ScrollBarSlider))
- p->setClipping(false);
+// if(!(controls&SC_ScrollBarSlider))
+// p->setClipping(false);
}
break;
}
@@ -4741,12 +6282,12 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
if((controls & SC_SliderGroove)&& groove.isValid())
drawSliderGroove(paint, groove, cg, flags, widget);
if((controls & SC_SliderHandle)&& handle.isValid())
- drawSliderHandle(paint, handle, cg, flags, widget ? ::qt_cast<QSlider *>(widget) : NULL, tb);
+ drawSliderHandle(paint, handle, cg, flags, widget ? ::qt_cast<QSlider *>(widget) : 0L, tb);
if(controls & SC_SliderTickmarks)
QCommonStyle::drawComplexControl(control, paint, widget, r, cg, flags, SC_SliderTickmarks,
active, data);
- if(flags & Style_HasFocus)
+ if(flags&Style_HasFocus && FOCUS_GLOW!=opts.focus)
drawPrimitive(PE_FocusRect, paint, groove, cg);
if(!tb)
@@ -4756,8 +6297,139 @@ void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const
}
break;
}
+ case CC_TitleBar:
+ {
+ const int buttonMargin(3);
+ const QTitleBar *tb((const QTitleBar *)widget);
+ bool isActive((tb->isActive() && widget->isActiveWindow()) ||
+ (!tb->window() && widget->topLevelWidget()->isActiveWindow()));
+ QColorGroup cgroup(isActive
+ ? widget->palette().active()
+ : widget->palette().inactive());
+ const QColor *cols(getMdiColors(cg, isActive));
+ QColor textCol(isActive ? itsActiveMdiTextColor : itsMdiTextColor),
+ shdCol(shadowColor(textCol)),
+ shadowCol(midColor(cols[ORIGINAL_SHADE], shdCol));
+
+ if (controls&SC_TitleBarLabel)
+ {
+ int alignment=AlignVCenter|SingleLine;
+ bool full=false;
+
+ switch(opts.titlebarAlignment)
+ {
+ default:
+ case ALIGN_LEFT:
+ alignment|=Qt::AlignLeft;
+ break;
+ case ALIGN_CENTER:
+ alignment|=Qt::AlignHCenter;
+ break;
+ case ALIGN_FULL_CENTER:
+ alignment|=Qt::AlignHCenter;
+ full=true;
+ break;
+ case ALIGN_RIGHT:
+ alignment|=Qt::AlignRight;
+ }
+
+ QRect ir(visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarLabel), widget)),
+ textRect(full ? tb->rect().x() : ir.x(), ir.y(), full ? tb->rect().width() : ir.width(), ir.height());
+ EAppearance app=isActive ? opts.titlebarAppearance : opts.inactiveTitlebarAppearance;
+
+ drawBevelGradient(cols[ORIGINAL_SHADE], p, r, true, false, app, WIDGET_MDI_WINDOW);
+ ir.addCoords(2, 0, -4, 0);
+
+ QFontMetrics fm(QFontMetrics(widget->font()));
+ QString titleString(elliditide(widget->caption(), fm, textRect.width()));
+
+ if(full)
+ {
+ int textWidth=fm.boundingRect(titleString).width();
+ if(ir.left()>((textRect.width()-textWidth)>>1))
+ {
+ alignment=Qt::AlignVCenter|Qt::AlignLeft;
+ textRect=ir;
+ full=false;
+ }
+ else if(ir.right()<((textRect.width()+textWidth)>>1))
+ {
+ alignment=Qt::AlignVCenter|Qt::AlignRight;
+ textRect=ir;
+ full=false;
+ }
+ else
+ p->setClipRect(ir);
+ }
+
+ p->setPen(shadowCol);
+ p->drawText(textRect.x()+1, textRect.y()+1, textRect.width(), textRect.height(), alignment, titleString);
+ p->setPen(textCol);
+ p->drawText(textRect.x(), textRect.y(), textRect.width(), textRect.height(), alignment, titleString);
+ if(full)
+ p->setClipping(false);
+
+ //controls-=SC_TitleBarLabel;
+ }
+ QRect ir;
+ bool down(false);
+ QPixmap pm;
+
+ if (controls&SC_TitleBarCloseButton)
+ {
+ ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarCloseButton), widget);
+ down = active & SC_TitleBarCloseButton;
+ drawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised);
+ drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, SC_TitleBarCloseButton);
+ }
+
+ if (tb->window())
+ {
+ if (controls &SC_TitleBarMaxButton)
+ {
+ ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarMaxButton), widget);
+ down = active & SC_TitleBarMaxButton;
+ drawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised);
+ drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, SC_TitleBarMaxButton);
+ }
+
+ if (controls&SC_TitleBarNormalButton || controls&SC_TitleBarMinButton)
+ {
+ ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarMinButton), widget);
+ QStyle::SubControl ctrl = (controls & SC_TitleBarNormalButton ?
+ SC_TitleBarNormalButton :
+ SC_TitleBarMinButton);
+ down = active & ctrl;
+ drawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised);
+ drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, ctrl);
+ }
+
+ if (controls&SC_TitleBarShadeButton)
+ {
+ ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarShadeButton), widget);
+ down = active & SC_TitleBarShadeButton;
+ drawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised);
+ drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, SC_TitleBarShadeButton);
+ }
+ if (controls&SC_TitleBarUnshadeButton)
+ {
+ ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarUnshadeButton), widget);
+ down = active & SC_TitleBarUnshadeButton;
+ drawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised);
+ drawMdiIcon(p, textCol, shadowCol, ir, down, buttonMargin, SC_TitleBarUnshadeButton);
+ }
+ }
+ if (controls&SC_TitleBarSysMenu && tb->icon())
+ {
+ ir = visualRect(querySubControlMetrics(CC_TitleBar, widget, SC_TitleBarSysMenu), widget);
+ down = active & SC_TitleBarSysMenu;
+ drawPrimitive(PE_ButtonTool, p, ir, tb->colorGroup(), down ? Style_Down : Style_Raised);
+ drawItem(p, ir, AlignCenter, tb->colorGroup(), true, tb->icon(), QString::null);
+ }
+ break;
+ }
default:
- KStyle::drawComplexControl(control, p, widget, r, cg, flags, controls, active, data);
+ BASE_STYLE::drawComplexControl(control, p, widget, r, cg, flags, controls, active, data);
}
}
@@ -4779,7 +6451,7 @@ QRect QtCurveStyle::querySubControlMetrics(ComplexControl control, const QWidget
bs.setHeight(widget->height()>>1);
if(bs.height()< 8)
bs.setHeight(8);
- bs.setWidth(15);
+ bs.setWidth(DO_EFFECT ? 16 : 15);
bs=bs.expandedTo(QApplication::globalStrut());
int extra(bs.height()*2==widget->height()? 0 : 1),
@@ -4808,17 +6480,17 @@ QRect QtCurveStyle::querySubControlMetrics(ComplexControl control, const QWidget
}
case CC_ComboBox:
{
- QRect r(KStyle::querySubControlMetrics(control, widget, sc, data));
+ QRect r(BASE_STYLE::querySubControlMetrics(control, widget, sc, data));
if(SC_ComboBoxFrame==sc)
{
const QComboBox *cb(::qt_cast<const QComboBox *>(widget));
if(cb && cb->editable())
- r=QRect((r.x()+r.width()-1)-18, r.y(), 19, r.height());
+ r=QRect(r.x()+r.width()-19, r.y(), 19, r.height());
}
- else if (reverse && SC_ComboBoxEditField==sc)
- r.addCoords(-1, 0, -2, 0);
+ else if (SC_ComboBoxEditField==sc && !DO_EFFECT)
+ r.addCoords(0, 0, -1, 0);
return r;
}
case CC_ScrollBar:
@@ -4965,17 +6637,103 @@ QRect QtCurveStyle::querySubControlMetrics(ComplexControl control, const QWidget
}
return ret;
}
+#ifdef SET_MDI_WINDOW_BUTTON_POSITIONS // TODO
+ case CC_TitleBar:
+ if (widget)
+ {
+ bool isMinimized(tb->titleBarState&Qt::WindowMinimized),
+ isMaximized(tb->titleBarState&Qt::WindowMaximized);
+
+ if( (isMaximized && SC_TitleBarMaxButton==subControl) ||
+ (isMinimized && SC_TitleBarMinButton==subControl) ||
+ (isMinimized && SC_TitleBarShadeButton==subControl) ||
+ (!isMinimized && SC_TitleBarUnshadeButton==subControl))
+ return QRect();
+
+ readMdiPositions();
+
+ const int windowMargin(2);
+ const int controlSize(tb->rect.height() - windowMargin *2);
+
+ QList<int>::ConstIterator it(itsMdiButtons[0].begin()),
+ end(itsMdiButtons[0].end());
+ int sc(SC_TitleBarUnshadeButton==subControl
+ ? SC_TitleBarShadeButton
+ : SC_TitleBarNormalButton==subControl
+ ? isMaximized
+ ? SC_TitleBarMaxButton
+ : SC_TitleBarMinButton
+ : subControl),
+ pos(0),
+ totalLeft(0),
+ totalRight(0);
+ bool rhs(false),
+ found(false);
+
+ for(; it!=end; ++it)
+ if(SC_TitleBarCloseButton==(*it) || WINDOWTITLE_SPACER==(*it) || tb->titleBarFlags&(toHint(*it)))
+ {
+ totalLeft+=WINDOWTITLE_SPACER==(*it) ? controlSize/2 : controlSize;
+ if(*it==sc)
+ found=true;
+ else if(!found)
+ pos+=WINDOWTITLE_SPACER==(*it) ? controlSize/2 : controlSize;
+ }
+
+ if(!found)
+ {
+ pos=0;
+ rhs=true;
+ }
+
+ it=itsMdiButtons[1].begin();
+ end=itsMdiButtons[1].end();
+ for(; it!=end; ++it)
+ if(SC_TitleBarCloseButton==(*it) || WINDOWTITLE_SPACER==(*it) || tb->titleBarFlags&(toHint(*it)))
+ {
+ if(WINDOWTITLE_SPACER!=(*it) || totalRight)
+ totalRight+=WINDOWTITLE_SPACER==(*it) ? controlSize/2 : controlSize;
+ if(rhs)
+ if(*it==sc)
+ {
+ pos+=controlSize;
+ found=true;
+ }
+ else if(found)
+ pos+=WINDOWTITLE_SPACER==(*it) ? controlSize/2 : controlSize;
+ }
+
+ totalLeft+=(windowMargin*(totalLeft ? 2 : 1));
+ totalRight+=(windowMargin*(totalRight ? 2 : 1));
+
+ if(SC_TitleBarLabel==subControl)
+ r.adjust(totalLeft, 0, -totalRight, 0);
+ else if(!found)
+ return QRect();
+ else if(rhs)
+ r.setRect(r.right()-(pos+windowMargin),
+ r.top()+windowMargin,
+ controlSize, controlSize);
+ else
+ r.setRect(r.left()+windowMargin+pos, r.top()+windowMargin,
+ controlSize, controlSize);
+ return visualRect(tb->direction, tb->rect, r);
+ }
+ }
+#endif
default:
break; // Remove compiler warnings...
}
- return KStyle::querySubControlMetrics(control, widget, sc, data);
+ return BASE_STYLE::querySubControlMetrics(control, widget, sc, data);
}
int QtCurveStyle::pixelMetric(PixelMetric metric, const QWidget *widget) const
{
switch(metric)
{
+ case PM_MenuBarFrameWidth:
+ return TB_NONE==opts.toolbarBorders ? 0 : 1;
case PM_MenuButtonIndicator:
return 7;
case PM_ButtonMargin:
@@ -4989,7 +6747,7 @@ int QtCurveStyle::pixelMetric(PixelMetric metric, const QWidget *widget) const
? QTabBar::RoundedAbove==tb->shape() || QTabBar::TriangularAbove==tb->shape()
? 1
: -1
- : KStyle::pixelMetric(metric, widget);
+ : BASE_STYLE::pixelMetric(metric, widget);
}
case PM_TabBarTabShiftHorizontal:
return 0;
@@ -5000,49 +6758,63 @@ int QtCurveStyle::pixelMetric(PixelMetric metric, const QWidget *widget) const
case PM_ButtonDefaultIndicator:
return 0;
case PM_DefaultFrameWidth:
- if(QTC_DO_EFFECT && widget && !isFormWidget(widget) &&
- (::qt_cast<const QLineEdit *>(widget) || ::qt_cast<QDateTimeEditBase*>(widget) ||
- ::qt_cast<QTextEdit*>(widget)))
+ if(APP_KATE==itsThemedApp && widget && widget->parentWidget() && widget->parentWidget()->parentWidget() &&
+ ::qt_cast<const QWidgetStack *>(widget) &&
+ ::qt_cast<const QTabWidget *>(widget->parentWidget()) &&
+ ::qt_cast<const QVBox *>(widget->parentWidget()->parentWidget()))
+ return 0;
+
+ if ((opts.square&SQUARE_SCROLLVIEW) && widget && ::qt_cast<const QScrollView *>(widget))
+ return (opts.gtkScrollViews || opts.thinSbarGroove) && !opts.highlightScrollViews ? 1 : 2;
+
+ if(DO_EFFECT && opts.etchEntry && widget && !isFormWidget(widget) &&
+ (::qt_cast<const QLineEdit *>(widget) || ::qt_cast<const QDateTimeEditBase*>(widget) ||
+ ::qt_cast<const QTextEdit*>(widget) || ::qt_cast<const QScrollView*>(widget)))
return 3;
else
return 2;
case PM_SpinBoxFrameWidth:
- return QTC_DO_EFFECT && !isFormWidget(widget) ? 3 : 2;
+ return DO_EFFECT && !isFormWidget(widget) ? 3 : 2;
case PM_IndicatorWidth:
case PM_IndicatorHeight:
- return QTC_CHECK_SIZE;
+ return DO_EFFECT && widget && !isFormWidget(widget) ? opts.crSize+2 : opts.crSize;
case PM_ExclusiveIndicatorWidth:
case PM_ExclusiveIndicatorHeight:
- return QTC_RADIO_SIZE;
+ return DO_EFFECT && widget && !isFormWidget(widget) ? opts.crSize+2 : opts.crSize;
case PM_TabBarTabOverlap:
- return 1;
+ return TAB_MO_GLOW==opts.tabMouseOver ? 0 : 1;
case PM_ProgressBarChunkWidth:
- return 4;
+ return PROGRESS_CHUNK_WIDTH*3.4;
case PM_DockWindowSeparatorExtent:
return 4;
case PM_DockWindowHandleExtent:
return 10;
case PM_SplitterWidth:
- return 6;
+ return widget && widget->inherits("QDockWindowResizeHandle")
+ ? 9
+ : LINE_1DOT==opts.splitters
+ ? 7
+ : 6;
case PM_ScrollBarSliderMin:
- return 16;
+ return opts.sliderWidth+1;
case PM_SliderThickness:
- return SLIDER_TRIANGULAR==opts.sliderStyle ? 22 : 18;
+ return SLIDER_TRIANGULAR==opts.sliderStyle ? 22 : (SLIDER_SIZE+(ROTATED_SLIDER ? 8 : 3));
case PM_SliderControlThickness:
- return SLIDER_TRIANGULAR==opts.sliderStyle ? 19 : 15; // This equates to 13, as we draw the handle 2 pix smaller for focus rect...
+ return SLIDER_TRIANGULAR==opts.sliderStyle ? 19 : (SLIDER_SIZE+(ROTATED_SLIDER ? 8 : 0)); // This equates to 13, as we draw the handle 2 pix smaller for focus rect...
case PM_SliderLength:
- return SLIDER_TRIANGULAR==opts.sliderStyle ? 11 : 21;
+ return SLIDER_TRIANGULAR==opts.sliderStyle ? 11 : (SLIDER_SIZE+(ROTATED_SLIDER ? -2 : 6));
case PM_ScrollBarExtent:
// See KHTML note at top of file
- return APP_KPRESENTER==itsThemedApp ||
+ return opts.sliderWidth+
+ (APP_KPRESENTER==itsThemedApp ||
((APP_KONQUEROR==itsThemedApp || APP_KONTACT==itsThemedApp) && (!widget || isFormWidget(widget)))
- ? 16 : 15;
+ ? 1 : 0);
case PM_MaximumDragDistance:
return -1;
case PM_TabBarTabVSpace:
return opts.highlightTab ? 11 : 9;
default:
- return KStyle::pixelMetric(metric, widget);
+ return BASE_STYLE::pixelMetric(metric, widget);
}
}
@@ -5053,7 +6825,7 @@ int QtCurveStyle::kPixelMetric(KStylePixelMetric kpm, const QWidget *widget) con
case KPM_MenuItemSeparatorHeight:
return 2;
default:
- return KStyle::kPixelMetric(kpm, widget);
+ return BASE_STYLE::kPixelMetric(kpm, widget);
}
}
@@ -5068,14 +6840,9 @@ QSize QtCurveStyle::sizeFromContents(ContentsType contents, const QWidget *widge
if (button && !button->text().isEmpty())
{
- bool allowEtch(QTC_DO_EFFECT && !isFormWidget(widget));
-
- const int constMinH(allowEtch ? 29 : 27);
-
int margin(2*pixelMetric(PM_ButtonMargin, widget)),
mbi(button->isMenuButton() ? pixelMetric(PM_MenuButtonIndicator, widget) : 0),
- w(contentsSize.width() + margin + mbi + 16),
- h(contentsSize.height() + margin);
+ w(contentsSize.width() + margin + mbi + 16);
// if(button->text()=="...")
// w+=24;
@@ -5090,26 +6857,15 @@ QSize QtCurveStyle::sizeFromContents(ContentsType contents, const QWidget *widge
w=constMinW;
}
- if(allowEtch)
- h+=2;
-
- return QSize(w, h < constMinH ? constMinH : h);
+ return QSize(w, contentsSize.height() + margin+(DO_EFFECT && !isFormWidget(widget) && !opts.thinnerBtns
+ ? 6 : 4));
}
break;
}
case CT_ComboBox:
{
- bool allowEtch(QTC_DO_EFFECT && !isFormWidget(widget));
-
- const int constMinH(allowEtch ? 26 : 24);
-
- QSize sz(KStyle::sizeFromContents(contents, widget, contentsSize, data));
- int h(sz.height());
-
- if(allowEtch)
- h+=2;
-
- return QSize(sz.width(), h<constMinH ? constMinH : h);
+ QSize sz(BASE_STYLE::sizeFromContents(contents, widget, contentsSize, data));
+ return QSize(sz.width(), sz.height()+(DO_EFFECT && !isFormWidget(widget) && !opts.thinnerBtns ? 4 : 2));
}
case CT_PopupMenuItem:
{
@@ -5136,7 +6892,7 @@ QSize QtCurveStyle::sizeFromContents(ContentsType contents, const QWidget *widge
else if (mi->isSeparator())
{
w = 10;
- h = opts.thinnerMenuItems ? 6 : 8;
+ h = 7;
}
else
{
@@ -5155,7 +6911,7 @@ QSize QtCurveStyle::sizeFromContents(ContentsType contents, const QWidget *widge
// check | 4 pixels | item | 8 pixels | accel | 4 pixels | check
// check is at least 16x16
- maxpmw=QMAX(maxpmw, 16);
+ maxpmw=QMAX(maxpmw, constMenuPixmapWidth);
w += (maxpmw * 2) + 8;
if (! mi->text().isNull() && mi->text().find('\t') >= 0)
@@ -5165,7 +6921,7 @@ QSize QtCurveStyle::sizeFromContents(ContentsType contents, const QWidget *widge
}
case CT_SpinBox:
{
- QSize size(KStyle::sizeFromContents(contents, widget, contentsSize, data));
+ QSize size(BASE_STYLE::sizeFromContents(contents, widget, contentsSize, data));
if(!(size.height()%2))
size.setHeight(size.height()+1);
@@ -5182,7 +6938,7 @@ QSize QtCurveStyle::sizeFromContents(ContentsType contents, const QWidget *widge
break; // Remove compiler warnings...
}
- return KStyle::sizeFromContents(contents, widget, contentsSize, data);
+ return BASE_STYLE::sizeFromContents(contents, widget, contentsSize, data);
}
int QtCurveStyle::styleHint(StyleHint stylehint, const QWidget *widget, const QStyleOption &option,
@@ -5190,18 +6946,22 @@ int QtCurveStyle::styleHint(StyleHint stylehint, const QWidget *widget, const QS
{
switch(stylehint)
{
+ case SH_PopupMenu_SubMenuPopupDelay:
+ return opts.menuDelay;
case SH_ScrollView_FrameOnlyAroundContents:
return opts.gtkScrollViews;
case SH_EtchDisabledText:
+ return 0;
case SH_Slider_SnapToValue:
case SH_PrintDialog_RightAlignButtons:
case SH_FontDialog_SelectAssociatedText:
- case SH_MenuBar_AltKeyNavigation:
case SH_PopupMenu_MouseTracking:
case SH_PopupMenu_SpaceActivatesItem:
case SH_ComboBox_ListMouseTracking:
case SH_ScrollBar_MiddleClickAbsolutePosition:
return 1;
+ case SH_MenuBar_AltKeyNavigation:
+ return 0;
case SH_LineEdit_PasswordCharacter:
if(opts.passwordChar)
{
@@ -5221,23 +6981,167 @@ int QtCurveStyle::styleHint(StyleHint stylehint, const QWidget *widget, const QS
return 0;
case SH_MenuBar_MouseTracking:
return opts.menubarMouseOver ? 1 : 0;
+ case SH_TabBar_Alignment:
+ return AlignLeft;
default:
- return KStyle::styleHint(stylehint, widget, option, returnData);
+ return BASE_STYLE::styleHint(stylehint, widget, option, returnData);
+ }
+}
+
+void QtCurveStyle::drawItem(QPainter *p, const QRect &r, int flags, const QColorGroup &cg, bool enabled,
+ const QPixmap *pixmap, const QString &text, int len, const QColor *penColor) const
+{
+ QRect r2(r);
+
+ if((opts.gbLabel&GB_LBL_BOLD) && text.length() && p->device() && dynamic_cast<QGroupBox *>(p->device()))
+ {
+ QGroupBox *box=static_cast<QGroupBox*>(p->device());
+
+ if (!box->isCheckable())
+ {
+ int left,
+ top,
+ width,
+ height;
+ QFontMetrics fm(p->fontMetrics());
+ QRect rb(box->rect());
+ int th(fm.height()+2);
+ QFont f(p->font());
+
+ rb.rect(&left, &top, &width, &height);
+ //rb.coords(&left, &top, &right, &bottom);
+ f.setBold(true);
+ p->setPen(box->colorGroup().foreground());
+ p->setFont(f);
+ p->drawText(QRect(left, top, width, th), (QApplication::reverseLayout()
+ ? AlignRight
+ : AlignLeft)|AlignVCenter|ShowPrefix|SingleLine,
+ text);
+ return;
+ }
+ }
+
+ int x = r.x(),
+ y = r.y(),
+ w = r.width(),
+ h = r.height();
+
+ p->setPen(penColor ? *penColor : cg.foreground());
+ if (pixmap)
+ {
+ QPixmap pm(*pixmap);
+ bool clip = (flags&Qt::DontClip) == 0;
+ if (clip)
+ {
+ if (pm.width() < w && pm.height() < h)
+ clip = false;
+ else
+ {
+ p->save();
+ QRegion cr = QRect(x, y, w, h);
+ if (p->hasClipping())
+ cr &= p->clipRegion(QPainter::CoordPainter);
+ p->setClipRegion(cr);
+ }
+ }
+ if ((flags&Qt::AlignVCenter) == Qt::AlignVCenter)
+ y += h/2 - pm.height()/2;
+ else if ((flags&Qt::AlignBottom) == Qt::AlignBottom)
+ y += h - pm.height();
+ if ((flags&Qt::AlignRight) == Qt::AlignRight)
+ x += w - pm.width();
+ else if ((flags&Qt::AlignHCenter) == Qt::AlignHCenter)
+ x += w/2 - pm.width()/2;
+ else if (((flags&Qt::AlignLeft) != Qt::AlignLeft) && QApplication::reverseLayout()) // AlignAuto && rightToLeft
+ x += w - pm.width();
+
+ if (!enabled)
+ {
+ if (pm.mask()) // pixmap with a mask
+ {
+ if (!pm.selfMask()) // mask is not pixmap itself
+ {
+ QPixmap pmm(*pm.mask());
+ pmm.setMask(*((QBitmap *)&pmm));
+ pm = pmm;
+ }
+ }
+ else if (pm.depth() == 1) // monochrome pixmap, no mask
+ {
+ pm.setMask(*((QBitmap *)&pm));
+#ifndef QT_NO_IMAGE_HEURISTIC_MASK
+ }
+ else // color pixmap, no mask
+ {
+ QString k;
+ k.sprintf("$qt-drawitem-%x", pm.serialNumber());
+ QPixmap *mask = QPixmapCache::find(k);
+ bool del=false;
+ if (!mask)
+ {
+ mask = new QPixmap(pm.createHeuristicMask());
+ mask->setMask(*((QBitmap*)mask));
+ del = !QPixmapCache::insert(k, mask);
+ }
+ pm = *mask;
+ if (del)
+ delete mask;
+#endif
+ }
+ p->setPen(cg.text());
+ }
+ p->drawPixmap(x, y, pm);
+ if (clip)
+ p->restore();
+ }
+ else if (!text.isNull())
+ {
+ if (!enabled)
+ p->setPen(cg.text());
+ p->drawText(x, y, w, h, flags, text, len);
}
}
-void QtCurveStyle::drawMenuItem(QPainter *p, const QRect &r, const QColorGroup &cg,
+void QtCurveStyle::drawMenuItem(QPainter *p, const QRect &r, int flags, const QColorGroup &cg,
bool mbi, int round, const QColor &bgnd, const QColor *cols) const
{
- if(opts.borderMenuitems)
+ int fill=opts.useHighlightForMenu && (!mbi || itsHighlightCols==cols) ? ORIGINAL_SHADE : 4,
+ border=opts.borderMenuitems ? 0 : fill;
+
+ if(itsHighlightCols!=cols && mbi && !((flags&Style_Enabled) && (flags&Style_Active) && (flags&Style_Down)) &&
+ !opts.colorMenubarMouseOver && (opts.borderMenuitems || !IS_FLAT(opts.menuitemAppearance)))
+ fill=ORIGINAL_SHADE;
+
+ if(!mbi && APPEARANCE_FADE==opts.menuitemAppearance)
+ {
+ bool reverse=QApplication::reverseLayout();
+ int roundOffet=ROUNDED ? 1 : 0;
+ QRect main(r.x()+(reverse ? 1+MENUITEM_FADE_SIZE : roundOffet+1), r.y()+roundOffet+1,
+ r.width()-(1+MENUITEM_FADE_SIZE), r.height()-(2+(roundOffet*2))),
+ fade(reverse ? r.x()+1 : r.width()-MENUITEM_FADE_SIZE, r.y()+1, MENUITEM_FADE_SIZE, r.height()-2);
+
+ p->fillRect(main, cols[fill]);
+ if(ROUNDED)
+ {
+ main.addCoords(-1, -1, 1, 1);
+ drawBorder(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE], p, main,
+ cg, Style_Horizontal|Style_Raised, reverse ? ROUNDED_RIGHT : ROUNDED_LEFT,
+ cols, WIDGET_MENU_ITEM, false, BORDER_FLAT, false, fill);
+ }
+
+ QColor bgnd(USE_LIGHTER_POPUP_MENU ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]);
+ drawGradient(reverse ? bgnd : cols[fill], reverse ? cols[fill] : bgnd, p, fade, false);
+ }
+ else if(mbi || opts.borderMenuitems)
{
int flags(Style_Raised);
- bool stdColor(!mbi || SHADE_BLEND_SELECTED!=opts.shadeMenubars);
+ bool stdColor(!mbi || (SHADE_BLEND_SELECTED!=opts.shadeMenubars && SHADE_SELECTED!=opts.shadeMenubars));
+ itsFormMode=true;
flags|=Style_Horizontal;
- if(stdColor)
- drawLightBevel(bgnd, p, r, cg, flags, round, cols[ORIGINAL_SHADE],
+ if(stdColor && opts.borderMenuitems)
+ drawLightBevel(bgnd, p, r, cg, flags, round, cols[fill],
cols, stdColor, !(mbi && IS_GLASS(opts.menubarAppearance)), WIDGET_MENU_ITEM);
else
{
@@ -5246,31 +7150,32 @@ void QtCurveStyle::drawMenuItem(QPainter *p, const QRect &r, const QColorGroup &
fr.addCoords(1, 1, -1, -1);
if(fr.width()>0 && fr.height()>0)
- drawBevelGradient(cols[ORIGINAL_SHADE], true, p, fr, true,
- getWidgetShade(WIDGET_MENU_ITEM, true, false, opts.menuitemAppearance),
- getWidgetShade(WIDGET_MENU_ITEM, false, false, opts.menuitemAppearance),
- false, opts.menuitemAppearance, WIDGET_MENU_ITEM);
- drawBorder(bgnd, p, r, cg, flags, round, cols, WIDGET_OTHER, false, BORDER_FLAT, false, 0);
+ drawBevelGradient(cols[fill], p, fr, true, false, opts.menuitemAppearance, WIDGET_MENU_ITEM);
+ drawBorder(bgnd, p, r, cg, flags, round, cols, WIDGET_OTHER, false, BORDER_FLAT, false, border);
}
+ itsFormMode=false;
}
else
- drawBevelGradient(cols[ORIGINAL_SHADE], true, p, r, true,
- getWidgetShade(WIDGET_MENU_ITEM, true, false, opts.menuitemAppearance),
- getWidgetShade(WIDGET_MENU_ITEM, false, false, opts.menuitemAppearance),
- false, opts.menuitemAppearance, WIDGET_MENU_ITEM);
+ drawBevelGradient(cols[fill], p, r, true, false, opts.menuitemAppearance, WIDGET_MENU_ITEM);
}
-void QtCurveStyle::drawProgress(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags,
+void QtCurveStyle::drawProgress(QPainter *p, const QRect &rx, const QColorGroup &cg, SFlags flags,
int round, const QWidget *widget) const
{
- if(r.width()<1)
+ if(rx.width()<1)
return;
+ QRect r=opts.borderProgress
+ ? QRect(rx.x()+1, rx.y()+1, rx.width()-2, rx.height()-2)
+ : rx;
int minWidth(3);
bool drawFull(r.width()>minWidth),
drawStripe(r.width()>(minWidth*1.5));
QRegion outer(r);
+ if(r.width()<3)
+ r.setWidth(3);
+
if(drawStripe)
{
int animShift=-PROGRESS_CHUNK_WIDTH;
@@ -5317,200 +7222,155 @@ void QtCurveStyle::drawProgress(QPainter *p, const QRect &r, const QColorGroup &
}
}
- if(drawFull)
- {
- flags|=Style_Raised|Style_Horizontal;
+ const QColor *use=flags&Style_Enabled || ECOLOR_BACKGROUND==opts.progressGrooveColor
+ ? itsProgressCols
+ ? itsProgressCols
+ : itsHighlightCols
+ : itsBackgroundCols;
- drawLightBevel(cg.background(), p, r, cg, flags, round, itsMenuitemCols[ORIGINAL_SHADE],
- itsMenuitemCols, true, true, WIDGET_PROGRESSBAR);
+ flags|=Style_Raised|Style_Horizontal;
- if(drawStripe && opts.stripedProgress)
- {
- p->setClipRegion(outer);
- drawLightBevel(cg.background(), p, r, cg, flags, round, itsMenuitemCols[1],
- itsMenuitemCols, true, true, WIDGET_PROGRESSBAR);
- p->setClipping(false);
- }
- }
- else
+ drawLightBevel(cg.background(), p, r, cg, flags, round, use[ORIGINAL_SHADE],
+ use, false, true, WIDGET_PROGRESSBAR);
+
+ if(drawStripe && opts.stripedProgress)
{
- p->setPen(itsMenuitemCols[QT_STD_BORDER]);
- p->setBrush(itsMenuitemCols[ORIGINAL_SHADE]);
- p->drawRect(r);
+ p->setClipRegion(outer);
+ drawLightBevel(cg.background(), p, r, cg, flags, round, use[1],
+ use, false, true, WIDGET_PROGRESSBAR);
+ p->setClipping(false);
}
- if(QTC_ROUNDED && r.width()>2 && ROUNDED_ALL!=round)
+
+ if(opts.borderProgress)
+ drawBorder(cg.background(), p, r, cg, flags, !(opts.square&SQUARE_PROGRESS) && opts.fillProgress ? ROUNDED_ALL : round,
+ use, WIDGET_PROGRESSBAR, false, BORDER_FLAT, false, PBAR_BORDER);
+ else
{
- p->setPen(midColor(cg.background(), itsMenuitemCols[QT_STD_BORDER]));
- if(!(round&CORNER_TL) || !drawFull)
- p->drawPoint(r.x(), r.y());
- if(!(round&CORNER_BL) || !drawFull)
- p->drawPoint(r.x(), r.y()+r.height()-1);
- if(!(round&CORNER_TR) || !drawFull)
- p->drawPoint(r.x()+r.width()-1, r.y());
- if(!(round&CORNER_BR) || !drawFull)
- p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1);
+ r.addCoords(1, 1, -1, -1);
+ p->setPen(use[PBAR_BORDER]);
+ p->drawLine(r.topLeft(), r.topRight());
+ p->drawLine(r.bottomLeft(), r.bottomRight());
}
}
-void QtCurveStyle::drawBevelGradient(const QColor &base, bool increase, QPainter *p,
- const QRect &origRect, bool horiz, double shadeTop,
- double shadeBot, bool sel, EAppearance bevApp, EWidget w) const
+void QtCurveStyle::drawBevelGradient(const QColor &base, QPainter *p, const QRect &origRect, bool horiz, bool sel, EAppearance bevApp, EWidget w) const
{
+ if(IS_FLAT(bevApp) && opts.colorSelTab && sel)
+ bevApp=APPEARANCE_GRADIENT;
+
if(IS_FLAT(bevApp))
p->fillRect(origRect, base);
else
{
- EAppearance app(APPEARANCE_BEVELLED!=bevApp || WIDGET_BUTTON(w) || WIDGET_LISTVIEW_HEADER==w
- ? bevApp
- : APPEARANCE_GRADIENT);
-
- bool selected(opts.colorSelTab && (WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w) ? false : sel);
- QRect r(0, 0, horiz ? QTC_PIXMAP_DIMENSION : origRect.width(),
- horiz ? origRect.height() : QTC_PIXMAP_DIMENSION);
- QString key(createKey(horiz ? r.height() : r.width(), base.rgb(), horiz, increase,
- app2App(app, sel), w, shadeTop, shadeBot));
- QPixmap *pix(itsPixmapCache.find(key));
+ bool tab(WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w),
+ selected(tab ? false : sel);
+ EAppearance app(selected
+ ? opts.sunkenAppearance
+ : WIDGET_LISTVIEW_HEADER==w && APPEARANCE_BEVELLED==bevApp
+ ? APPEARANCE_LV_BEVELLED
+ : APPEARANCE_BEVELLED!=bevApp || WIDGET_BUTTON(w) || WIDGET_LISTVIEW_HEADER==w ||
+ WIDGET_NO_ETCH_BTN==w || WIDGET_MENU_BUTTON==w
+ ? bevApp
+ : APPEARANCE_GRADIENT);
+ QRect r(0, 0, horiz ? PIXMAP_DIMENSION : origRect.width(),
+ horiz ? origRect.height() : PIXMAP_DIMENSION);
+ QString key(createKey(horiz ? r.height() : r.width(), base.rgb(), horiz, app,
+ tab && sel && opts.colorSelTab ? CACHE_COL_SEL_TAB : CACHE_STD));
+ QPixmap *pix(itsPixmapCache.find(key));
+ bool inCache(true);
if(!pix)
{
pix=new QPixmap(r.width(), r.height());
- QPainter pixPainter(pix);
+ QPainter pixPainter(pix);
- if(!selected && (IS_GLASS(app) || APPEARANCE_SPLIT_GRADIENT==app))
- {
- if(WIDGET_TAB_BOT==w)
- {
- double t(shadeTop);
- shadeTop=shadeBot;
- shadeBot=t;
- }
+ drawBevelGradientReal(base, &pixPainter, r, horiz, sel, app, w);
+ pixPainter.end();
+ int cost(pix->width()*pix->height()*(pix->depth()/8));
- double shadeTopA(WIDGET_TAB_BOT==w
- ? 1.0
- : APPEARANCE_SPLIT_GRADIENT==app
- ? shadeTop
- : shadeTop*SHADE_GLASS_TOP_A(app, w)),
- shadeTopB(WIDGET_TAB_BOT==w
- ? 1.0
- : APPEARANCE_SPLIT_GRADIENT==app
- ? shadeTop-((shadeTop-shadeBot)*SPLIT_GRADIENT_FACTOR)
- : shadeTop*SHADE_GLASS_TOP_B(app, w)),
- shadeBotA(WIDGET_TAB_TOP==w
- ? 1.0
- : APPEARANCE_SPLIT_GRADIENT==app
- ? shadeBot+((shadeTop-shadeBot)*SPLIT_GRADIENT_FACTOR)
- : shadeBot*SHADE_GLASS_BOT_A(app)),
- shadeBotB(WIDGET_TAB_TOP==w
- ? 1.0
- : APPEARANCE_SPLIT_GRADIENT==app
- ? shadeBot
- : shadeBot*SHADE_GLASS_BOT_B(app));
-
- QColor topA, topB, botA, botB;
- QRect r1(r), r2(r), r3(r);
-
- shade(base, &topA, shadeTopA);
- shade(base, &topB, shadeTopB);
- shade(base, &botA, shadeBotA);
- shade(base, &botB, shadeBotB);
+ if(cost<itsPixmapCache.maxCost())
+ itsPixmapCache.insert(key, pix, cost);
+ else
+ inCache=false;
+ }
- if(horiz)
- {
- r1.setHeight(r1.height()/2);
- r2.setY(r2.y()+r1.height());
- }
- else
- {
- r1.setWidth(r1.width()/2);
- r2.setX(r2.x()+r1.width());
- }
- drawGradient(topA, topB, increase, &pixPainter, r1, horiz);
- drawGradient(botA, botB, increase, &pixPainter, r2, horiz);
- }
- else if(!selected && APPEARANCE_BEVELLED==app &&
- ((horiz ? r.height()
- : r.width()) > (((WIDGET_BUTTON(w) ? 2 : 1)*BEVEL_BORDER(w))+4)))
- {
- if(WIDGET_LISTVIEW_HEADER==w)
- {
- QColor bot;
- QRect r1(r), r2(r);
+ p->drawTiledPixmap(origRect, *pix);
+ if(!inCache)
+ delete pix;
+ }
+}
- if(horiz)
- {
- r2.setHeight(BEVEL_BORDER(w));
- r1.setHeight(r.height()-r2.height());
- r2.moveTop(r.y()+r1.height());
- }
- else
- {
- r2.setWidth(BEVEL_BORDER(w));
- r1.setWidth(r.width()-r2.width());
- r2.moveLeft(r.x()+r1.width());
- }
- shade(base, &bot, SHADE_BEVEL_BOT(w));
- pixPainter.fillRect(r1, base);
- drawGradient(base, bot, true, &pixPainter, r2, horiz);
- }
- else
- {
- QColor bot, midTop, midBot, top;
- QRect r1(r), r2(r), r3(r);
+void QtCurveStyle::drawBevelGradientReal(const QColor &base, QPainter *p, const QRect &r, bool horiz, bool sel, EAppearance app, EWidget w) const
+{
- if(horiz)
- {
- r1.setHeight(BEVEL_BORDER(w));
- r3.setHeight(BEVEL_BORDER(w));
- r2.setHeight(r.height()-(r1.height()+r3.height()));
- r2.moveTop(r.y()+r1.height());
- r3.moveTop(r.y()+r1.height()+r2.height());
- }
- else
- {
- r1.setWidth(BEVEL_BORDER(w));
- r3.setWidth(BEVEL_BORDER(w));
- r2.setWidth(r.width()-(r1.width()+r3.width()));
- r2.moveLeft(r.x()+r1.width());
- r3.moveLeft(r.x()+r1.width()+r2.width());
- }
+ const Gradient *grad=getGradient(app, &opts);
+ int numStops(grad->stops.size()),
+ lastPos(0),
+ size(horiz ? r.height() : r.width());
+ bool topTab(WIDGET_TAB_TOP==w),
+ botTab(WIDGET_TAB_BOT==w);
+ QColor prev;
- shade(base, &top, SHADE_BEVEL_TOP);
- shade(base, &midTop, SHADE_BEVEL_MID_TOP);
- shade(base, &midBot, SHADE_BEVEL_MID_BOT);
- shade(base, &bot, SHADE_BEVEL_BOT(w));
- drawGradient(top, midTop, true, &pixPainter, r1, horiz);
- drawGradient(midTop, midBot, true, &pixPainter, r2, horiz);
- drawGradient(midBot, bot, true, &pixPainter, r3, horiz);
- }
- }
+ if(botTab)
+ {
+ GradientStopCont::reverse_iterator it(grad->stops.rbegin()),
+ end(grad->stops.rend());
+
+ for(int i=0; it!=end; ++it, ++i)
+ {
+ QColor col;
+ int pos((int)(((1.0-(*it).pos)*size)+0.5));
+
+ if(sel && 0==i)
+ col=base;
else
- {
- QColor top,
- bot,
- baseTopCol(opts.colorSelTab && sel && (WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w)
- ? midColor(base, itsMenuitemCols[0], QTC_COLOR_SEL_TAB_FACTOR) : base);
+ shade(base, &col, opts.invertBotTab ? QMAX(INVERT_SHADE((*it).val), 0.9) : (*it).val);
+
+ if(/*sel && */opts.colorSelTab && i>0)
+ col=tint(col, itsHighlightCols[0], (1.0-(*it).pos)*(0.2+TO_ALPHA(opts.colorSelTab)));
+
+ if(i)
+ drawGradient(prev, col, p,
+ horiz
+ ? QRect(r.x(), lastPos, r.width(), pos-lastPos)
+ : QRect(lastPos, r.y(), pos-lastPos, r.height()),
+ horiz);
+ prev=col;
+ lastPos=pos;
+ }
+ }
+ else
+ {
+ GradientStopCont::const_iterator it(grad->stops.begin()),
+ end(grad->stops.end());
- if(equal(1.0, shadeTop))
- top=baseTopCol;
- else
- shade(baseTopCol, &top, shadeTop);
- if(equal(1.0, shadeBot))
- bot=base;
- else
- shade(base, &bot, shadeBot);
+ for(int i=0; it!=end; ++it, ++i)
+ {
+ QColor col;
+ int pos((int)(((*it).pos*size)+0.5));
- drawGradient(top, bot, sel || APPEARANCE_INVERTED!=app ? increase : !increase,
- &pixPainter, r, horiz);
- }
- pixPainter.end();
- itsPixmapCache.insert(key, pix, pix->width()*pix->height()*(pix->depth()/8));
+ if(/*sel && */topTab && i==numStops-1)
+ col=base;
+ else
+ shade(base, &col, WIDGET_TAB_BOT==w ? QMAX((*it).val, 0.9) : (*it).val);
+
+ if(sel && opts.colorSelTab && topTab && i<numStops-1)
+ col=tint(col, itsHighlightCols[0], (1.0-(*it).pos)*(0.2+TO_ALPHA(opts.colorSelTab)));
+
+ if(i)
+ drawGradient(prev, col, p,
+ horiz
+ ? QRect(r.x(), lastPos, r.width(), pos-lastPos)
+ : QRect(lastPos, r.y(), pos-lastPos, r.height()),
+ horiz);
+ prev=col;
+ lastPos=pos;
}
- p->drawTiledPixmap(origRect, *pix);
}
}
-void QtCurveStyle::drawGradient(const QColor &top, const QColor &bot, bool increase,
+void QtCurveStyle::drawGradient(const QColor &top, const QColor &bot,
QPainter *p, QRect const &r, bool horiz) const
{
if(r.width()>0 && r.height()>0)
@@ -5535,48 +7395,26 @@ void QtCurveStyle::drawGradient(const QColor &top, const QColor &bot, bool incre
dg(((1<<16) * (bot.green() - gTop)) / size),
db(((1<<16) * (bot.blue() - bTop)) / size);
- if(increase)
- if(horiz)
+ if(horiz)
+ {
+ for (i=0; i < size; i++)
{
- for (i=0; i < size; i++)
- {
- p->setPen(QColor(rl>>16, gl>>16, bl>>16));
- p->drawLine(rx, ry+i, rx2, ry+i);
- rl += dr;
- gl += dg;
- bl += db;
- }
+ p->setPen(QColor(rl>>16, gl>>16, bl>>16));
+ p->drawLine(rx, ry+i, rx2, ry+i);
+ rl += dr;
+ gl += dg;
+ bl += db;
}
- else
- for(i=0; i < size; i++)
- {
- p->setPen(QColor(rl>>16, gl>>16, bl>>16));
- p->drawLine(rx+i, ry, rx+i, ry2);
- rl += dr;
- gl += dg;
- bl += db;
- }
+ }
else
- if(horiz)
+ for(i=0; i < size; i++)
{
- for(i=size-1; i>=0; i--)
- {
- p->setPen(QColor(rl>>16, gl>>16, bl>>16));
- p->drawLine(rx, ry+i, rx2, ry+i);
- rl += dr;
- gl += dg;
- bl += db;
- }
+ p->setPen(QColor(rl>>16, gl>>16, bl>>16));
+ p->drawLine(rx+i, ry, rx+i, ry2);
+ rl += dr;
+ gl += dg;
+ bl += db;
}
- else
- for(i=size-1; i>=0; i--)
- {
- p->setPen(QColor(rl>>16, gl>>16, bl>>16));
- p->drawLine(rx+i, ry, rx+i, ry2);
- rl += dr;
- gl += dg;
- bl += db;
- }
}
}
}
@@ -5596,34 +7434,44 @@ void QtCurveStyle::drawSbSliderHandle(QPainter *p, const QRect &orig, const QCol
flags|=Style_Horizontal;
flags|=Style_Raised;
- drawLightBevel(p, r, cg, flags, slider
-#ifndef QTC_SIMPLE_SCROLLBARS
- || SCROLLBAR_NONE==opts.scrollbarType
+ drawLightBevel(p, r, cg, flags, (slider && !(opts.square&SQUARE_SLIDER))
+#ifndef SIMPLE_SCROLLBARS
+ || (!slider && !(opts.square&SQUARE_SB_SLIDER) && (SCROLLBAR_NONE==opts.scrollbarType || opts.flatSbarButtons))
#endif
? ROUNDED_ALL : ROUNDED_NONE,
- getFill(flags, use), use, true, false, WIDGET_SB_SLIDER);
-
- const QColor *markers(/*opts.coloredMouseOver && flags&Style_MouseOver
- ? SHADE_NONE==shade ? itsMouseOverCols : itsBackgroundCols
- : */use);
- if(flags & Style_Horizontal)
- r.setX(r.x()+1);
- else
- r.setY(r.y()+1);
+ getFill(flags, use, false, SHADE_DARKEN==opts.shadeSliders), use, true, false, WIDGET_SB_SLIDER);
if(LINE_NONE!=opts.sliderThumbs && (slider || ((flags & Style_Horizontal && r.width()>=min)|| r.height()>=min)))
+ {
+ const QColor *markers(/*opts.coloredMouseOver && flags&Style_MouseOver
+ ? itsMouseOverCols
+ : */use);
+ bool horiz(flags&Style_Horizontal);
+
+ if(LINE_SUNKEN==opts.sliderThumbs)
+ if(horiz)
+ r.addCoords(0, -1, 0, 0);
+ else
+ r.addCoords(-1, 0, 0, 0);
+ else
+ r.addCoords(horiz ? 1 : 0, horiz ? 0 : 1, 0, 0);
+
switch(opts.sliderThumbs)
{
case LINE_FLAT:
- drawLines(p, r, !(flags & Style_Horizontal), 3, 5, markers, 0, 5, 0, false);
+ drawLines(p, r, !horiz, 3, 5, markers, 0, 5, opts.sliderThumbs);
break;
case LINE_SUNKEN:
- drawLines(p, r, !(flags & Style_Horizontal), 4, 3, markers, 0, 3);
+ drawLines(p, r, !horiz, 4, 3, markers, 0, 3, opts.sliderThumbs);
+ break;
+ case LINE_1DOT:
+ drawDot(p, r, markers);
break;
case LINE_DOTS:
default:
- drawDots(p, r, !(flags & Style_Horizontal), slider ? 3 : 5, slider ? 5 : 2, markers, 0, 5);
+ drawDots(p, r, !horiz, slider ? 3 : 5, slider ? 5 : 2, markers, 0, 5);
}
+ }
}
void QtCurveStyle::drawSliderHandle(QPainter *p, const QRect &r, const QColorGroup &cg,
@@ -5631,24 +7479,29 @@ void QtCurveStyle::drawSliderHandle(QPainter *p, const QRect &r, const QColorGro
{
bool horiz(SLIDER_TRIANGULAR==opts.sliderStyle ? r.height()>r.width() : r.width()>r.height());
- if(SLIDER_TRIANGULAR==opts.sliderStyle || (SLIDER_ROUND==opts.sliderStyle && ROUND_FULL==opts.round))
+ if(SLIDER_TRIANGULAR==opts.sliderStyle || ((SLIDER_ROUND==opts.sliderStyle || SLIDER_ROUND_ROTATED==opts.sliderStyle) && FULLLY_ROUNDED))
{
- const QColor *use(sliderColors(/*cg, */flags));
- const QColor &fill(getFill(flags, use));
+ const QColor *use(sliderColors(/*cg, */flags)),
+ *border(flags&Style_MouseOver && (MO_GLOW==opts.coloredMouseOver ||
+ MO_COLORED==opts.coloredMouseOver)
+ ? itsMouseOverCols : use);
+ const QColor &fill(getFill(flags, use, false, SHADE_DARKEN==opts.shadeSliders));
int x(r.x()),
y(r.y()),
xo(horiz ? 8 : 0),
yo(horiz ? 0 : 8);
PrimitiveElement direction(horiz ? PE_ArrowDown : PE_ArrowRight);
bool drawLight(MO_PLASTIK!=opts.coloredMouseOver || !(flags&Style_MouseOver) ||
- (SLIDER_ROUND==opts.sliderStyle &&
+ ((SLIDER_ROUND==opts.sliderStyle || SLIDER_ROUND_ROTATED)==opts.sliderStyle &&
(SHADE_BLEND_SELECTED==opts.shadeSliders || SHADE_SELECTED==opts.shadeSliders)));
- int size(SLIDER_TRIANGULAR==opts.sliderStyle ? 15 : 13);
+ int size(SLIDER_TRIANGULAR==opts.sliderStyle ? 15 : 13),
+ borderVal(itsMouseOverCols==border ? SLIDER_MO_BORDER_VAL : BORDER_VAL(flags&Style_Enabled));
- if(horiz)
- y++;
- else
- x++;
+ if(SLIDER_ROUND_ROTATED!=opts.sliderStyle)
+ if(horiz)
+ y++;
+ else
+ x++;
QPointArray clipRegion;
@@ -5694,13 +7547,13 @@ void QtCurveStyle::drawSliderHandle(QPainter *p, const QRect &r, const QColorGro
if(!tb)
p->fillRect(QRect(x, y, r.width()-(horiz ? 0 : 2), r.height()-(horiz ? 2 : 0)), cg.background());
p->setClipRegion(QRegion(clipRegion)); // , QPainter::CoordPainter);
- if(IS_FLAT(opts.appearance))
+ if(IS_FLAT(opts.sliderAppearance))
{
p->fillRect(r, fill);
- if(MO_PLASTIK==opts.coloredMouseOver && flags&Style_MouseOver)
+ if(MO_PLASTIK==opts.coloredMouseOver && flags&Style_MouseOver && !opts.colorSliderMouseOver)
{
- int col(QTC_SLIDER_MO_SHADE),
- len(QTC_SLIDER_MO_LEN);
+ int col(SLIDER_MO_SHADE),
+ len(SLIDER_MO_LEN);
if(horiz)
{
@@ -5716,28 +7569,31 @@ void QtCurveStyle::drawSliderHandle(QPainter *p, const QRect &r, const QColorGro
}
else
{
- drawBevelGradient(fill, true, p, QRect(x, y, horiz ? r.width()-1 : size, horiz ? size : r.height()-1),
- horiz, SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK,
- false, opts.sliderAppearance);
+ drawBevelGradient(fill, p, QRect(x, y, horiz ? r.width()-1 : size, horiz ? size : r.height()-1),
+ horiz, false, opts.sliderAppearance);
- if(MO_PLASTIK==opts.coloredMouseOver && flags&Style_MouseOver)
+ if(MO_PLASTIK==opts.coloredMouseOver && flags&Style_MouseOver && !opts.colorSliderMouseOver)
{
- int col(QTC_SLIDER_MO_SHADE),
- len(QTC_SLIDER_MO_LEN);
+ int col(SLIDER_MO_SHADE),
+ len(SLIDER_MO_LEN);
if(horiz)
{
- drawBevelGradient(itsMouseOverCols[col], true, p, QRect(x+1, y+1, len, size-2),
- horiz, SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK, false, opts.sliderAppearance);
- drawBevelGradient(itsMouseOverCols[col], true, p, QRect(x+r.width()-(1+len), y+1, len, size-2),
- horiz,SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK, false, opts.sliderAppearance);
+ drawBevelGradient(itsMouseOverCols[col], p, QRect(x+1, y+1, len, size-2),
+ horiz, false, opts.sliderAppearance);
+ drawBevelGradient(itsMouseOverCols[col], p,
+ QRect(x+r.width()-((SLIDER_ROUND_ROTATED==opts.sliderStyle ? 3 : 1)+len),
+ y+1, len, size-2),
+ horiz, false, opts.sliderAppearance);
}
else
{
- drawBevelGradient(itsMouseOverCols[col], true, p, QRect(x+1, y+1, size-2, len),
- horiz, SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK, false, opts.sliderAppearance);
- drawBevelGradient(itsMouseOverCols[col], true, p, QRect(x+1, y+r.height()-(1+len), size-2, len),
- horiz, SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK, false, opts.sliderAppearance);
+ drawBevelGradient(itsMouseOverCols[col], p, QRect(x+1, y+1, size-2, len),
+ horiz, false, opts.sliderAppearance);
+ drawBevelGradient(itsMouseOverCols[col], p,
+ QRect(x+1, y+r.height()-((SLIDER_ROUND_ROTATED==opts.sliderStyle ? 3 : 1)+len),
+ size-2, len),
+ horiz, false, opts.sliderAppearance);
}
}
}
@@ -5769,20 +7625,20 @@ void QtCurveStyle::drawSliderHandle(QPainter *p, const QRect &r, const QColorGro
light.setPoints(3, x+1, y+8, x+1, y+1, x+9, y+1);
}
- p->setPen(midColor(use[QT_STD_BORDER], cg.background()));
+ p->setPen(midColor(border[borderVal], cg.background()));
p->drawPolygon(aa);
if(drawLight)
{
p->setPen(use[APPEARANCE_DULL_GLASS==opts.sliderAppearance ? 1 : 0]);
p->drawPolyline(light);
}
- p->setPen(use[QT_STD_BORDER]);
+ p->setPen(border[borderVal]);
p->drawPolygon(clipRegion);
}
else
{
p->drawPixmap(x, y,
- *getPixmap(use[opts.coloredMouseOver && flags&Style_MouseOver ? 4 : QT_BORDER(flags&Style_Enabled)],
+ *getPixmap(border[borderVal],
horiz ? PIX_SLIDER : PIX_SLIDER_V, 0.8));
if(drawLight)
p->drawPixmap(x, y, *getPixmap(use[0], horiz ? PIX_SLIDER_LIGHT : PIX_SLIDER_LIGHT_V));
@@ -5793,10 +7649,11 @@ void QtCurveStyle::drawSliderHandle(QPainter *p, const QRect &r, const QColorGro
{
QRect sr(r);
- if(horiz)
- sr.addCoords(0, 1, 0, 0);
- else
- sr.addCoords(1, 0, 0, 0);
+ if(!ROTATED_SLIDER)
+ if(horiz)
+ sr.addCoords(0, 1, 0, 0);
+ else
+ sr.addCoords(1, 0, 0, 0);
drawSbSliderHandle(p, sr, cg, flags|(horiz ? Style_Horizontal : 0), true);
}
@@ -5809,77 +7666,75 @@ void QtCurveStyle::drawSliderGroove(QPainter *p, const QRect &r, const QColorGro
QRect groove(r);
bool horiz(Qt::Horizontal==sliderWidget->orientation()),
reverse(QApplication::reverseLayout());
- const QColor &usedCol=itsSliderCols
- ? itsSliderCols[ORIGINAL_SHADE]
- : itsMouseOverCols
- ? itsMouseOverCols[ORIGINAL_SHADE]
- : itsMenuitemCols[1];
+ flags&=~Style_MouseOver;
if(horiz)
{
int dh=(groove.height()-5)>>1;
groove.addCoords(0, dh, 0, -dh);
flags|=Style_Horizontal;
+
+ if(!itsFormMode && DO_EFFECT)
+ groove.addCoords(0, -1, 0, 1);
}
else
{
int dw=(groove.width()-5)>>1;
groove.addCoords(dw, 0, -dw, 0);
+
+ if(!itsFormMode && DO_EFFECT)
+ groove.addCoords(-1, 0, 1, 0);
}
- drawLightBevel(p, groove, cg, flags|Style_Down, ROUNDED_ALL, itsBackgroundCols[flags&Style_Enabled ? 2 : ORIGINAL_SHADE],
+ drawLightBevel(p, groove, cg, flags, opts.square&SQUARE_SLIDER ? ROUNDED_NONE : ROUNDED_ALL,
+ itsBackgroundCols[flags&Style_Enabled ? 2 : ORIGINAL_SHADE],
itsBackgroundCols, true, true, WIDGET_SLIDER_TROUGH);
- if(opts.fillSlider && sliderWidget->maxValue()!=sliderWidget->minValue() && flags&Style_Enabled)
+ if(opts.fillSlider && (horiz ? sliderWidget->value()>0 : sliderWidget->value()<sliderWidget->maxValue()) &&
+ sliderWidget->maxValue()!=sliderWidget->minValue() && flags&Style_Enabled)
{
- QRect used(groove);
- int pos((int)(((double)(horiz ? groove.width() : groove.height()) /
+ QRect used(groove);
+ int pos((int)(((double)(horiz ? groove.width() : groove.height()) /
(sliderWidget->maxValue()-sliderWidget->minValue())) *
- (sliderWidget->value() - sliderWidget->minValue())));
-
- if(horiz)
+ (sliderWidget->value() - sliderWidget->minValue())));
+ if(pos>0)
{
- pos+=(groove.width()>10 && pos<(groove.width()/2)) ? 3 : 0;
- if(reverse)
- used.addCoords(groove.width()-pos, 0, 0, 0);
+ const QColor *usedCols=itsSliderCols ? itsSliderCols : itsHighlightCols;
+
+ if(horiz)
+ {
+ pos+=(groove.width()>10 && pos<(groove.width()/2)) ? 3 : 0;
+ if(reverse)
+ used.addCoords(groove.width()-pos, 0, 0, 0);
+ else
+ used.addCoords(0, 0, -(groove.width()-pos), 0);
+ }
else
- used.addCoords(0, 0, -(groove.width()-pos), 0);
- }
- else
- {
- pos+=(groove.height()>10 && pos<(groove.height()/2)) ? 3 : 0;
- used.addCoords(0, pos, 0, 0);
+ {
+ pos+=(groove.height()>10 && pos<(groove.height()/2)) ? 3 : 0;
+ used.addCoords(0, pos, 0, 0);
+ }
+ if(used.height()>0 && used.width()>0)
+ drawLightBevel(p, used, cg, flags, opts.square&SQUARE_SLIDER ? ROUNDED_NONE : ROUNDED_ALL,
+ usedCols[ORIGINAL_SHADE], usedCols, true, true, WIDGET_FILLED_SLIDER_TROUGH);
}
- if(used.height()>0 && used.width()>0)
- drawLightBevel(p, used, cg, flags|Style_Down, ROUNDED_ALL, usedCol, NULL,
- true, true, WIDGET_SLIDER_TROUGH);
}
}
void QtCurveStyle::drawMenuOrToolBarBackground(QPainter *p, const QRect &r, const QColorGroup &cg,
bool menu, bool horiz) const
{
+ if(menu && APPEARANCE_STRIPED==opts.bgndAppearance && IS_FLAT(opts.menubarAppearance) && SHADE_NONE==opts.shadeMenubars)
+ return;
+
+ QRect rx(r);
EAppearance app(menu ? opts.menubarAppearance : opts.toolbarAppearance);
- QColor color(menu && itsActive ? itsMenubarCols[ORIGINAL_SHADE] : cg.background());
- double from(0.0), to(0.0);
+ QColor color(menu ? menuColors(cg, itsActive)[ORIGINAL_SHADE] : cg.background());
- switch(app)
- {
- default:
- case APPEARANCE_GRADIENT:
- from=SHADE_MENU_LIGHT;
- to=SHADE_MENU_DARK;
- break;
- case APPEARANCE_FLAT:
- case APPEARANCE_RAISED:
- break;
- case APPEARANCE_SHINY_GLASS:
- case APPEARANCE_DULL_GLASS:
- from=SHADE_BEVEL_GRAD_LIGHT;
- to=SHADE_BEVEL_GRAD_DARK;
- }
+ if(menu && BLEND_TITLEBAR)
+ rx.addCoords(0, -qtcGetWindowBorderSize().titleHeight, 0, 0);
- drawBevelGradient(color, true, p, r, horiz, from, to, false, app);
+ drawBevelGradient(color, p, rx, horiz, false, app);
}
void QtCurveStyle::drawHandleMarkers(QPainter *p, const QRect &r, SFlags flags, bool tb,
@@ -5896,6 +7751,11 @@ void QtCurveStyle::drawHandleMarkers(QPainter *p, const QRect &r, SFlags flags,
switch(handles)
{
+ case LINE_NONE:
+ break;
+ case LINE_1DOT:
+ drawDot(p, r, border);
+ break;
case LINE_DOTS:
drawDots(p, r, !(flags & Style_Horizontal), 2,
APP_KICKER==itsThemedApp ? 1 : tb ? 5 : 3, border,
@@ -5907,37 +7767,53 @@ void QtCurveStyle::drawHandleMarkers(QPainter *p, const QRect &r, SFlags flags,
QRect r1(r.x()+(tb ? 2 : (r.width()-6)/2), r.y(), 3, r.height());
drawLines(p, r1, true, (r.height()-8)/2,
- tb ? 0 : (r.width()-5)/2, border, 0, 5, 0);
+ tb ? 0 : (r.width()-5)/2, border, 0, 5, handles);
}
else
{
QRect r1(r.x(), r.y()+(tb ? 2 : (r.height()-6)/2), r.width(), 3);
drawLines(p, r1, false, (r.width()-8)/2,
- tb ? 0 : (r.height()-5)/2, border, 0, 5, 0);
+ tb ? 0 : (r.height()-5)/2, border, 0, 5, handles);
}
break;
case LINE_FLAT:
drawLines(p, r, !(flags & Style_Horizontal), 2,
APP_KICKER==itsThemedApp ? 1 : tb ? 4 : 2, border,
- APP_KICKER==itsThemedApp ? 1 : tb ? -2 : 0, 4, 0, false);
+ APP_KICKER==itsThemedApp ? 1 : tb ? -2 : 0, 4, handles);
break;
default:
drawLines(p, r, !(flags & Style_Horizontal), 2,
APP_KICKER==itsThemedApp ? 1 : tb ? 4 : 2, border,
- APP_KICKER==itsThemedApp ? 1 : tb ? -2 : 0, 3);
+ APP_KICKER==itsThemedApp ? 1 : tb ? -2 : 0, 3, handles);
}
}
+void QtCurveStyle::drawHighlight(QPainter *p, const QRect &r, const QColorGroup &cg, bool horiz, bool inc) const
+{
+ QColor col1(midColor(cg.background(), itsMouseOverCols[ORIGINAL_SHADE]));
+ QRect r2(r);
+
+ p->setPen(inc ? col1 : itsMouseOverCols[ORIGINAL_SHADE]);
+ p->drawLine(r2.x(), r2.y(), r2.x()+(horiz ? r2.width()-1 : 0), r2.y()+(horiz ? 0 : r2.height()-1));
+ p->setPen(inc ? itsMouseOverCols[ORIGINAL_SHADE] : col1);
+ r2.addCoords(horiz ? 0 : 1, horiz ? 1 : 0, horiz ? 0 : 1, horiz ? 1 : 0);
+ p->drawLine(r2.x(), r2.y(), r2.x()+(horiz ? r2.width()-1 : 0), r2.y()+(horiz ? 0 : r2.height()-1));
+}
+
void QtCurveStyle::shadeColors(const QColor &base, QColor *vals) const
{
- QTC_SHADES
+ SHADES
+
+ bool useCustom(USE_CUSTOM_SHADES(opts));
+ double hl=TO_FACTOR(opts.highlightFactor);
for(int i=0; i<NUM_STD_SHADES; ++i)
- shade(base, &vals[i], QTC_SHADE(opts.contrast, i));
- shade(base, &vals[SHADE_ORIG_HIGHLIGHT], opts.highlightFactor);
- shade(vals[4], &vals[SHADE_4_HIGHLIGHT], opts.highlightFactor);
- shade(vals[2], &vals[SHADE_2_HIGHLIGHT], opts.highlightFactor);
+ shade(base, &vals[i], useCustom ? opts.customShades[i] : SHADE(opts.contrast, i));
+
+ shade(base, &vals[SHADE_ORIG_HIGHLIGHT], hl);
+ shade(vals[4], &vals[SHADE_4_HIGHLIGHT], hl);
+ shade(vals[2], &vals[SHADE_2_HIGHLIGHT], hl);
vals[ORIGINAL_SHADE]=base;
}
@@ -5952,10 +7828,17 @@ const QColor * QtCurveStyle::buttonColors(const QColorGroup &cg) const
return itsButtonCols;
}
+const QColor * QtCurveStyle::checkRadioColors(const QColorGroup &cg, SFlags flags) const
+{
+ return opts.crColor && flags&Style_Enabled && (flags&Style_On || !(flags&Style_Off))
+ ? itsCheckRadioSelCols
+ : buttonColors(cg);
+}
+
const QColor * QtCurveStyle::sliderColors(/*const QColorGroup &cg, */ SFlags flags) const
{
return (flags&Style_Enabled)
- ? SHADE_NONE!=opts.shadeSliders //&& cg.button()==itsButtonCols[ORIGINAL_SHADE]
+ ? SHADE_NONE!=opts.shadeSliders &&itsSliderCols && (!opts.colorSliderMouseOver || flags&Style_MouseOver)
? itsSliderCols
: itsButtonCols // buttonColors(cg)
: itsBackgroundCols;
@@ -5989,7 +7872,7 @@ const QColor * QtCurveStyle::getSidebarButtons() const
else
{
itsSidebarButtonsCols=new QColor [TOTAL_SHADES+1];
- shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]),
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]),
itsSidebarButtonsCols);
}
}
@@ -6004,10 +7887,13 @@ void QtCurveStyle::setMenuColors(const QColorGroup &cg)
case SHADE_NONE:
memcpy(itsMenubarCols, itsBackgroundCols, sizeof(QColor)*(TOTAL_SHADES+1));
break;
- case SHADE_BLEND_SELECTED: // For menubars we dont actually blend...
+ case SHADE_BLEND_SELECTED:
+ shadeColors(midColor(itsHighlightCols[ORIGINAL_SHADE], itsBackgroundCols[ORIGINAL_SHADE]), itsMenubarCols);
+ break;
+ case SHADE_SELECTED:
shadeColors(IS_GLASS(opts.appearance)
- ? shade(itsMenuitemCols[ORIGINAL_SHADE], MENUBAR_GLASS_SELECTED_DARK_FACTOR)
- : itsMenuitemCols[ORIGINAL_SHADE],
+ ? shade(itsHighlightCols[ORIGINAL_SHADE], MENUBAR_GLASS_SELECTED_DARK_FACTOR)
+ : itsHighlightCols[ORIGINAL_SHADE],
itsMenubarCols);
break;
case SHADE_CUSTOM:
@@ -6015,9 +7901,233 @@ void QtCurveStyle::setMenuColors(const QColorGroup &cg)
break;
case SHADE_DARKEN:
shadeColors(shade(cg.background(), MENUBAR_DARK_FACTOR), itsMenubarCols);
+ break;
+ case SHADE_WINDOW_BORDER:
+ break;
+ }
+}
+
+const QColor * QtCurveStyle::menuColors(const QColorGroup &cg, bool active) const
+{
+ return SHADE_WINDOW_BORDER==opts.shadeMenubars
+ ? getMdiColors(cg, active)
+ : SHADE_NONE==opts.shadeMenubars || (opts.shadeMenubarOnlyWhenActive && !active)
+ ? backgroundColors(cg)
+ : itsMenubarCols;
+}
+
+void QtCurveStyle::setDecorationColors(bool init)
+{
+ if(!readKdeGlobals() && !init)
+ return;
+
+ if(opts.coloredMouseOver)
+ {
+ if(!itsMouseOverCols)
+ itsMouseOverCols=new QColor [TOTAL_SHADES+1];
+ shadeColors(kdeSettings.hover, itsMouseOverCols);
+ }
+ shadeColors(kdeSettings.focus, itsFocusCols);
+}
+
+const QColor * QtCurveStyle::getMdiColors(const QColorGroup &cg, bool active) const
+{
+ if(!itsActiveMdiColors)
+ {
+ itsActiveMdiTextColor=cg.text();
+ itsMdiTextColor=cg.text();
+
+ // Try to read kwin's settings...
+ if(useQt3Settings())
+ {
+ QFile f(QDir::homeDirPath()+"/.qt/qtrc");
+
+ if(f.open(IO_ReadOnly))
+ {
+ QTextStream in(&f);
+ bool inPal(false);
+
+ while (!in.atEnd())
+ {
+ QString line(in.readLine());
+
+ if(inPal)
+ {
+ if(!itsActiveMdiColors && 0==line.find("activeBackground=#", false))
+ {
+ QColor col;
+
+ setRgb(&col, line.mid(17).latin1());
+
+ if(col!=itsBackgroundCols[ORIGINAL_SHADE])
+ {
+ itsActiveMdiColors=new QColor [TOTAL_SHADES+1];
+ shadeColors(col, itsActiveMdiColors);
+ }
+ }
+ else if(!itsMdiColors && 0==line.find("inactiveBackground=#", false))
+ {
+ QColor col;
+
+ setRgb(&col, line.mid(19).latin1());
+ if(col!=itsBackgroundCols[ORIGINAL_SHADE])
+ {
+ itsMdiColors=new QColor [TOTAL_SHADES+1];
+ shadeColors(col, itsMdiColors);
+ }
+ }
+ else if(0==line.find("activeForeground=#", false))
+ setRgb(&itsActiveMdiTextColor, line.mid(17).latin1());
+ else if(0==line.find("inactiveForeground=#", false))
+ setRgb(&itsMdiTextColor, line.mid(19).latin1());
+ else if (-1!=line.find('['))
+ break;
+ }
+ else if(0==line.find("[KWinPalette]", false))
+ inPal=true;
+ }
+ f.close();
+ }
+ }
+ else // KDE4
+ {
+ QFile f(kdeHome(false)+"/share/config/kdeglobals");
+
+ if(f.open(IO_ReadOnly))
+ {
+ QTextStream in(&f);
+ bool inPal(false);
+
+ while (!in.atEnd())
+ {
+ QString line(in.readLine());
+
+ if(inPal)
+ {
+ if(!itsActiveMdiColors && 0==line.find("activeBackground=", false))
+ {
+ QColor col;
+
+ setRgb(&col, QStringList::split(",", line.mid(17)));
+
+ if(col!=itsBackgroundCols[ORIGINAL_SHADE])
+ {
+ itsActiveMdiColors=new QColor [TOTAL_SHADES+1];
+ shadeColors(col, itsActiveMdiColors);
+ }
+ }
+ else if(!itsMdiColors && 0==line.find("inactiveBackground=", false))
+ {
+ QColor col;
+
+ setRgb(&col, QStringList::split(",", line.mid(19)));
+ if(col!=itsBackgroundCols[ORIGINAL_SHADE])
+ {
+ itsMdiColors=new QColor [TOTAL_SHADES+1];
+ shadeColors(col, itsMdiColors);
+ }
+ }
+ else if(0==line.find("activeForeground=", false))
+ setRgb(&itsActiveMdiTextColor, QStringList::split(",", line.mid(17)));
+ else if(0==line.find("inactiveForeground=", false))
+ setRgb(&itsMdiTextColor, QStringList::split(",", line.mid(19)));
+ else if (-1!=line.find('['))
+ break;
+ }
+ else if(0==line.find("[WM]", false))
+ inPal=true;
+ }
+ f.close();
+ }
+ }
+
+ if(opts.shadeMenubarOnlyWhenActive && SHADE_WINDOW_BORDER==opts.shadeMenubars &&
+ itsActiveMdiColors[ORIGINAL_SHADE]==itsMdiColors[ORIGINAL_SHADE])
+ opts.shadeMenubarOnlyWhenActive=false;
+
+ if(!itsActiveMdiColors)
+ itsActiveMdiColors=(QColor *)itsBackgroundCols;
+ if(!itsMdiColors)
+ itsMdiColors=(QColor *)itsBackgroundCols;
}
+
+ return active ? itsActiveMdiColors : itsMdiColors;
}
+#ifdef SET_MDI_WINDOW_BUTTON_POSITIONS
+void QtCurveStyle::readMdiPositions() const
+{
+ if(0==itsMdiButtons[0].size() && 0==itsMdiButtons[1].size())
+ {
+ // Set defaults...
+ itsMdiButtons[0].append(SC_TitleBarSysMenu);
+ itsMdiButtons[0].append(SC_TitleBarShadeButton);
+
+ //itsMdiButtons[1].append(SC_TitleBarContextHelpButton);
+ itsMdiButtons[1].append(SC_TitleBarMinButton);
+ itsMdiButtons[1].append(SC_TitleBarMaxButton);
+ itsMdiButtons[1].append(WINDOWTITLE_SPACER);
+ itsMdiButtons[1].append(SC_TitleBarCloseButton);
+
+ // Read in KWin settings...
+ QFile f(kdeHome(useQt3Settings())+"/share/config/kwinrc");
+
+ if(f.open(IO_ReadOnly))
+ {
+ QTextStream in(&f);
+ bool inStyle(false);
+
+ while (!in.atEnd())
+ {
+ QString line(in.readLine());
+
+ if(inStyle)
+ {
+ if(0==line.find("ButtonsOnLeft=", false))
+ {
+ itsMdiButtons[0].clear();
+ parseWindowLine(line.mid(14), itsMdiButtons[0]);
+ }
+ else if(0==line.find("ButtonsOnRight=", false))
+ {
+ itsMdiButtons[1].clear();
+ parseWindowLine(line.mid(15), itsMdiButtons[1]);
+ }
+ else if (-1!=line.find('['))
+ break;
+ }
+ else if(0==line.find("[Style]", false))
+ inStyle=true;
+ }
+ f.close();
+ }
+
+ // Designer uses shade buttons, not min/max - so if we dont have shade in our kwin config. then add this
+ // button near the max button...
+ if(-1==itsMdiButtons[0].findIndex(SC_TitleBarShadeButton) && -1==itsMdiButtons[1].findIndex(SC_TitleBarShadeButton))
+ {
+ int maxPos=itsMdiButtons[0].findIndex(SC_TitleBarMaxButton);
+
+ if(-1==maxPos) // Left doesnt have max button, assume right does and add shade there
+ {
+ int minPos=itsMdiButtons[1].findIndex(SC_TitleBarMinButton);
+ maxPos=itsMdiButtons[1].findIndex(SC_TitleBarMaxButton);
+
+ itsMdiButtons[1].insert(itsMdiButtons[1].find(minPos<maxPos ? (minPos==-1 ? 0 : minPos)
+ : (maxPos==-1 ? 0 : maxPos)), SC_TitleBarShadeButton);
+ }
+ else // Add to left button
+ {
+ int minPos=itsMdiButtons[0].findIndex(SC_TitleBarMinButton);
+
+ itsMdiButtons[1].insert(itsMdiButtons[1].find(minPos>maxPos ? (minPos==-1 ? 0 : minPos)
+ : (maxPos==-1 ? 0 : maxPos)), SC_TitleBarShadeButton);
+ }
+ }
+ }
+}
+#endif
+
bool QtCurveStyle::redrawHoverWidget(const QPoint &pos)
{
if(!itsHoverWidget || !itsHoverWidget->isShown() || !itsHoverWidget->isVisible())
@@ -6101,7 +8211,7 @@ bool QtCurveStyle::redrawHoverWidget(const QPoint &pos)
}
else
{
-#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
+#if defined KDE_VERSION && KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
QToolButton *tb(::qt_cast<QToolButton *>(itsHoverWidget));
if(tb)
@@ -6110,8 +8220,8 @@ bool QtCurveStyle::redrawHoverWidget(const QPoint &pos)
return HOVER_KICKER==itsHover;
}
else
- {
#endif
+ {
QHeader *hd(::qt_cast<QHeader *>(itsHoverWidget));
if(hd)
@@ -6125,9 +8235,9 @@ bool QtCurveStyle::redrawHoverWidget(const QPoint &pos)
bool redraw(false);
itsHover=rect.contains(pos) ? HOVER_HEADER : HOVER_NONE;
- itsHoverSect=QTC_NO_SECT;
+ itsHoverSect=NO_SECT;
- for(s=0; s<hd->count() && (QTC_NO_SECT==itsHoverSect || !redraw); ++s)
+ for(s=0; s<hd->count() && (NO_SECT==itsHoverSect || !redraw); ++s)
{
QRect r(hd->sectionRect(s));
bool hasNew(r.contains(pos));
@@ -6161,12 +8271,13 @@ bool QtCurveStyle::redrawHoverWidget(const QPoint &pos)
else if(down.contains(pos))
itsHover=HOVER_SW_DOWN;
else
- itsHover=HOVER_NONE;
+ itsHover=HOVER_SW_ENTRY;
return (HOVER_SW_UP==itsHover && !up.contains(itsOldPos)) ||
(HOVER_SW_UP!=itsHover && up.contains(itsOldPos)) ||
(HOVER_SW_DOWN==itsHover && !down.contains(itsOldPos)) ||
- (HOVER_SW_DOWN!=itsHover && down.contains(itsOldPos));
+ (HOVER_SW_DOWN!=itsHover && down.contains(itsOldPos)) ||
+ (HOVER_SW_ENTRY==itsHover);
}
else
{
@@ -6202,23 +8313,32 @@ bool QtCurveStyle::redrawHoverWidget(const QPoint &pos)
if(arrow.contains(pos))
itsHover=HOVER_CB_ARROW;
else
- itsHover=HOVER_NONE;
+ {
+ QRect r(cb->rect());
+ if(QApplication::reverseLayout())
+ r.addCoords(6, 0, 0, 0);
+ else
+ r.addCoords(0, 0, -6, 0);
+ if(DO_EFFECT && opts.etchEntry)
+ r.addCoords(1, 0, -1, 0);
+ if(r.contains(pos))
+ itsHover=HOVER_CB_ENTRY;
+ else
+ itsHover=HOVER_NONE;
+ }
}
return (HOVER_CB_ARROW==itsHover && !arrow.contains(itsOldPos)) ||
- (HOVER_CB_ARROW!=itsHover && arrow.contains(itsOldPos));
+ (HOVER_CB_ARROW!=itsHover && arrow.contains(itsOldPos)) ||
+ (HOVER_CB_ENTRY==itsHover);
}
else
return itsOldPos==QPoint(-1, -1);
}
}
-#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500
}
-#endif
-#if KDE_VERSION >= 0x30400
}
-#endif
}
#if QT_VERSION >= 0x030200
}
@@ -6228,19 +8348,19 @@ bool QtCurveStyle::redrawHoverWidget(const QPoint &pos)
return false;
}
-const QColor & QtCurveStyle::getFill(SFlags flags, const QColor *use) const
+const QColor & QtCurveStyle::getFill(SFlags flags, const QColor *use, bool cr, bool darker) const
{
return !(flags&Style_Enabled)
- ? use[ORIGINAL_SHADE]
+ ? use[darker ? 2 : ORIGINAL_SHADE]
: flags&Style_Down
- ? use[4]
+ ? use[darker ? 5 : 4]
: flags&Style_MouseOver
- ? flags&(Style_On | Style_Sunken)
- ? use[SHADE_4_HIGHLIGHT]
- : use[SHADE_ORIG_HIGHLIGHT]
- : flags&(Style_On | Style_Sunken)
- ? use[4]
- : use[ORIGINAL_SHADE];
+ ? !cr && (flags&(Style_On | Style_Sunken))
+ ? use[darker ? 3 : SHADE_4_HIGHLIGHT]
+ : use[darker ? SHADE_2_HIGHLIGHT : SHADE_ORIG_HIGHLIGHT]
+ : !cr && (flags&(Style_On | Style_Sunken))
+ ? use[darker ? 5 : 4]
+ : use[darker ? 2 : ORIGINAL_SHADE];
}
const QColor & QtCurveStyle::getTabFill(bool current, bool highlight, const QColor *use) const
@@ -6252,6 +8372,59 @@ const QColor & QtCurveStyle::getTabFill(bool current, bool highlight, const QCol
: use[2];
}
+const QColor & QtCurveStyle::menuStripeCol() const
+{
+ switch(opts.menuStripe)
+ {
+ default:
+ case SHADE_NONE:
+ return itsBackgroundCols[ORIGINAL_SHADE];
+ case SHADE_CUSTOM:
+ return opts.customMenuStripeColor;
+ case SHADE_BLEND_SELECTED:
+ // Hack! Use opts.customMenuStripeColor to store this setting!
+ if(IS_BLACK(opts.customMenuStripeColor))
+ opts.customMenuStripeColor=midColor(itsHighlightCols[ORIGINAL_SHADE],
+ opts.lighterPopupMenuBgnd<0
+ ? itsLighterPopupMenuBgndCol
+ : itsBackgroundCols[ORIGINAL_SHADE]);
+ return opts.customMenuStripeColor;
+ case SHADE_SELECTED:
+ return itsHighlightCols[MENU_STRIPE_SHADE];
+ case SHADE_DARKEN:
+ return USE_LIGHTER_POPUP_MENU
+ ? itsLighterPopupMenuBgndCol
+ : itsBackgroundCols[MENU_STRIPE_SHADE];
+ }
+}
+
+const QColor & QtCurveStyle::checkRadioCol(SFlags flags, const QColorGroup &cg) const
+{
+ if(flags&MENU_ITEM)
+ return flags&Style_Enabled && flags&Style_Active && opts.useHighlightForMenu
+ ? cg.highlightedText()
+ : cg.foreground();
+
+ return flags&Style_Enabled
+ ? itsCheckRadioCol
+ : opts.crButton
+ ? cg.buttonText()
+ : cg.text();
+}
+
+QColor QtCurveStyle::shade(const QColor &a, float k) const
+{
+ QColor mod;
+
+ ::shade(&opts, a, &mod, k);
+ return mod;
+}
+
+void QtCurveStyle::shade(const color &ca, color *cb, double k) const
+{
+ ::shade(&opts, ca, cb, k);
+}
+
QPixmap * QtCurveStyle::getPixelPixmap(const QColor col) const
{
QRgb rgb(col.rgb());
@@ -6274,6 +8447,68 @@ QPixmap * QtCurveStyle::getPixelPixmap(const QColor col) const
return pix;
}
+QPixmap * QtCurveStyle::createStripePixmap(const QColor &col, bool forWindow) const
+{
+ QRgb rgb(col.rgb());
+ QString key(createKey(rgb, forWindow ? 'S' : 's'));
+
+ QPixmap *pix=itsPixmapCache.find(key);
+
+ if(!pix)
+ {
+ QColor col2(shade(col, BGND_STRIPE_SHADE));
+ int i,
+ adjust=forWindow ? qtcGetWindowBorderSize().titleHeight%4 : 0;
+
+ pix=new QPixmap(64, 64);
+ pix->fill(col.rgb());
+
+ QPainter p;
+ p.begin(pix);
+ p.setPen(QColor((3*col.red()+col2.red())/4,
+ (3*col.green()+col2.green())/4,
+ (3*col.blue()+col2.blue())/4));
+
+ for (i=1; i<68; i+=4)
+ {
+ p.drawLine(0, i-adjust, 63, i-adjust);
+ p.drawLine(0, i+2-adjust, 63, i+2-adjust);
+ }
+ p.setPen(col2);
+ for (i=2; i<67; i+=4)
+ p.drawLine(0, i-adjust, 63, i-adjust);
+ p.end();
+ }
+
+ return pix;
+}
+
+static QImage rotateImage(const QImage &img, double angle=90.0)
+{
+ QWMatrix matrix;
+ matrix.translate(img.width()/2, img.height()/2);
+ matrix.rotate(angle);
+
+ QRect newRect(matrix.mapRect(QRect(0, 0, img.width(), img.height())));
+
+ return img.xForm(QWMatrix(matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(),
+ matrix.dx() - newRect.left(), matrix.dy() - newRect.top()));
+}
+
+static void recolour(QImage &img, const QColor &col, double shade)
+{
+ if (img.depth()<32)
+ img=img.convertDepth(32);
+
+ adjustPix(img.bits(), 4, img.width(), img.height(), img.bytesPerLine(), col.red(), col.green(), col.blue(), shade);
+}
+
+void QtCurveStyle::drawDot(QPainter *p, const QRect &r, const QColor *cols) const
+{
+ QPixmap *pix=getPixmap(cols[STD_BORDER], PIX_DOT, 0.9);
+ p->drawPixmap(r.x()+((r.width()-pix->width())>>1), r.y()+((r.height()-pix->height())>>1), *pix);
+}
+
QPixmap * QtCurveStyle::getPixmap(const QColor col, EPixmap p, double shade) const
{
QRgb rgb(col.rgb());
@@ -6291,11 +8526,14 @@ QPixmap * QtCurveStyle::getPixmap(const QColor col, EPixmap p, double shade) con
case PIX_RADIO_BORDER:
img.loadFromData(qembed_findData("radio_frame.png"));
break;
+ case PIX_RADIO_INNER:
+ img.loadFromData(qembed_findData("radio_inner.png"));
+ break;
case PIX_RADIO_LIGHT:
img.loadFromData(qembed_findData("radio_light.png"));
break;
case PIX_RADIO_ON:
- img.loadFromData(qembed_findData("radio_on.png"));
+ img.loadFromData(qembed_findData(opts.smallRadio ? "radio_on_small.png" : "radio_on.png"));
break;
case PIX_CHECK:
img.loadFromData(qembed_findData(opts.xCheck ? "check_x_on.png" : "check_on.png"));
@@ -6307,18 +8545,24 @@ QPixmap * QtCurveStyle::getPixmap(const QColor col, EPixmap p, double shade) con
img.loadFromData(qembed_findData("slider_light.png"));
break;
case PIX_SLIDER_V:
- img.loadFromData(qembed_findData("slider_v.png"));
+ img.loadFromData(qembed_findData("slider.png"));
+ img=rotateImage(img);
break;
case PIX_SLIDER_LIGHT_V:
- img.loadFromData(qembed_findData("slider_light_v.png"));
+ img.loadFromData(qembed_findData("slider_light.png"));
+ img=rotateImage(img).mirror(true, false);
+ break;
+ case PIX_DOT:
+ img.loadFromData(qembed_findData("dot.png"));
+ break;
+ default:
break;
}
if (img.depth()<32)
img=img.convertDepth(32);
- adjustPix(img.bits(), 4, img.width(), img.height(), img.bytesPerLine(), col.red(),
- col.green(), col.blue(), shade);
+ adjustPix(img.bits(), 4, img.width(), img.height(), img.bytesPerLine(), col.red(), col.green(), col.blue(), shade);
pix->convertFromImage(img);
itsPixmapCache.insert(key, pix, pix->depth()/8);
}
@@ -6331,21 +8575,58 @@ void QtCurveStyle::setSbType()
switch(opts.scrollbarType)
{
case SCROLLBAR_KDE:
- this->setScrollBarType(KStyle::ThreeButtonScrollBar);
+ this->setScrollBarType(BASE_STYLE::ThreeButtonScrollBar);
break;
default:
case SCROLLBAR_WINDOWS:
- this->setScrollBarType(KStyle::WindowsStyleScrollBar);
+ this->setScrollBarType(BASE_STYLE::WindowsStyleScrollBar);
break;
case SCROLLBAR_PLATINUM:
- this->setScrollBarType(KStyle::PlatinumStyleScrollBar);
+ this->setScrollBarType(BASE_STYLE::PlatinumStyleScrollBar);
break;
case SCROLLBAR_NEXT:
- this->setScrollBarType(KStyle::NextStyleScrollBar);
+ this->setScrollBarType(BASE_STYLE::NextStyleScrollBar);
break;
}
}
+void QtCurveStyle::resetHover()
+{
+ itsIsSpecialHover=false;
+ itsOldPos.setX(-1);
+ itsOldPos.setY(-1);
+ itsHoverWidget=0L;
+ itsHoverSect=NO_SECT;
+ itsHover=HOVER_NONE;
+ itsHoverTab=0L;
+}
+
+struct QtcMenuBar : public QMenuBar
+{
+ bool itemUnderPos(const QPoint &pos)
+ {
+ return -1!=itemAtPos(pos);
+ }
+};
+
+bool QtCurveStyle::isWindowDragWidget(QObject *o, const QPoint &pos)
+{
+ return opts.windowDrag &&
+ (//qobject_cast<QDialog*>(o) ||
+ (::qt_cast<QMenuBar*>(o) && (pos.isNull() || !((QtcMenuBar *)o)->itemUnderPos(pos)))
+ //|| qobject_cast<QGroupBox*>(o)
+ //|| (o->inherits("QToolButton") && !static_cast<QWidget*>(o)->isEnabled())
+// || qobject_cast<QToolBar*>(o)
+ //|| qobject_cast<QDockWidget*>(o)
+
+// || ((*appType == Hacks::SMPlayer) && o->inherits(SMPlayerVideoWidget))
+// || ((*appType == Hacks::Dragon) && o->inherits(DragonVideoWidget))
+
+// || o->inherits("QStatusBar")
+// || (o->inherits("QLabel") && o->parent() && o->parent()->inherits("QStatusBar"))
+ );
+}
+
void QtCurveStyle::updateProgressPos()
{
// Taken from lipstik!
@@ -6354,19 +8635,19 @@ void QtCurveStyle::updateProgressPos()
bool visible(false);
for (; it!=end; ++it)
{
- if (!::qt_cast<QProgressBar*>(it.key()))
- continue;
-
QProgressBar *pb(::qt_cast<QProgressBar*>(it.key()));
- if (it.key() -> isEnabled() && pb -> progress()!=pb->totalSteps())
+ if (!pb)
+ continue;
+
+ if(pb->isEnabled() && pb->progress()!=pb->totalSteps())
{
// update animation Offset of the current Widget
it.data() = (it.data() + (QApplication::reverseLayout() ? -1 : 1))
% (PROGRESS_CHUNK_WIDTH*2);
- it.key()->update();
+ pb->update();
}
- if (it.key()->isVisible())
+ if(pb->isVisible())
visible = true;
}
if (!visible)
@@ -6391,4 +8672,10 @@ void QtCurveStyle::khtmlWidgetDestroyed(QObject *o)
itsKhtmlWidgets.remove(static_cast<const QWidget *>(o));
}
+void QtCurveStyle::hoverWidgetDestroyed(QObject *o)
+{
+ if(o==itsHoverWidget)
+ resetHover();
+}
+
#include "qtcurve.moc"