summaryrefslogtreecommitdiffstats
path: root/kstyles
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-01 19:56:15 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-01 19:56:15 +0000
commit102d191fa7d143d634d35ca894945688a196361b (patch)
treee76c3f63d2bcdb67a80957fee6251dff6d32bad5 /kstyles
parentf0b1722fbfca15e4b9c0afec6d0191466b719417 (diff)
downloadtdelibs-102d191fa7d143d634d35ca894945688a196361b.tar.gz
tdelibs-102d191fa7d143d634d35ca894945688a196361b.zip
Add Asteroid widget theme to kdelibs
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1244309 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kstyles')
-rw-r--r--kstyles/CMakeLists.txt1
-rw-r--r--kstyles/Makefile.am2
-rw-r--r--kstyles/asteroid/CMakeLists.txt46
-rw-r--r--kstyles/asteroid/Makefile.am18
-rw-r--r--kstyles/asteroid/asteroid.cpp1679
-rw-r--r--kstyles/asteroid/asteroid.h111
-rw-r--r--kstyles/asteroid/asteroid.themerc8
7 files changed, 1864 insertions, 1 deletions
diff --git a/kstyles/CMakeLists.txt b/kstyles/CMakeLists.txt
index e7881dd04..a0a138422 100644
--- a/kstyles/CMakeLists.txt
+++ b/kstyles/CMakeLists.txt
@@ -10,6 +10,7 @@
#################################################
add_subdirectory( plastik )
+add_subdirectory( asteroid )
add_subdirectory( highcolor )
add_subdirectory( highcontrast )
add_subdirectory( themes )
diff --git a/kstyles/Makefile.am b/kstyles/Makefile.am
index 2bc20749a..48316f8cd 100644
--- a/kstyles/Makefile.am
+++ b/kstyles/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = plastik highcolor highcontrast themes light kthemestyle riscos utils keramik
+SUBDIRS = asteroid plastik highcolor highcontrast themes light kthemestyle riscos utils keramik
#kstyles should not be included in the apidocs
#include $(top_srcdir)/admin/Doxyfile.am
diff --git a/kstyles/asteroid/CMakeLists.txt b/kstyles/asteroid/CMakeLists.txt
new file mode 100644
index 000000000..264a16085
--- /dev/null
+++ b/kstyles/asteroid/CMakeLists.txt
@@ -0,0 +1,46 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_definitions(
+ -DQT_PLUGIN
+)
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/kdecore
+ ${CMAKE_SOURCE_DIR}/kdefx
+ ${CMAKE_SOURCE_DIR}/kdecore
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install( FILES asteroid.themerc DESTINATION ${DATA_INSTALL_DIR}/kstyle/themes )
+
+
+##### asteroid ###################################
+
+set( target asteroid )
+
+set( ${target}_SRCS
+ asteroid.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK kdefx-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
+)
diff --git a/kstyles/asteroid/Makefile.am b/kstyles/asteroid/Makefile.am
new file mode 100644
index 000000000..5ce2bf321
--- /dev/null
+++ b/kstyles/asteroid/Makefile.am
@@ -0,0 +1,18 @@
+# Yaaay poorly-documented hackish magical software!
+# (re: autoconf and automake and friends,
+# not my own software, of course) -clee
+
+AM_CPPFLAGS = -DQT_PLUGIN
+METASOURCES = AUTO
+
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = asteroid.h
+kde_style_LTLIBRARIES = asteroid.la
+
+asteroid_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+asteroid_la_LIBADD = -lkdefx
+asteroid_la_SOURCES = asteroid.cpp
+
+themercdir = $(kde_datadir)/kstyle/themes
+themerc_DATA = asteroid.themerc
diff --git a/kstyles/asteroid/asteroid.cpp b/kstyles/asteroid/asteroid.cpp
new file mode 100644
index 000000000..f7a907d35
--- /dev/null
+++ b/kstyles/asteroid/asteroid.cpp
@@ -0,0 +1,1679 @@
+/*
+ * KDE3 asteroid style (version 1.0)
+ *
+ * Copyright (C) 2003, Chris Lee <clee@kde.org>
+ * Modified by David Chester in 2004 for Munjoy Linux
+ *
+ * See LICENSE for details about copying.
+ */
+
+/* Required. Period. */
+#include <tqstyleplugin.h>
+#include <tqstylefactory.h>
+#include <tqpainter.h>
+#include <tqapplication.h>
+
+#include <tqpopupmenu.h>
+#include <tqmenubar.h>
+#include <tqheader.h>
+#include <tqcombobox.h>
+#include <tqlistbox.h>
+#include <tqslider.h>
+#include <tqpushbutton.h>
+#include <tqprogressbar.h>
+#include <kpixmap.h>
+
+#include <tqbitmap.h>
+#define u_arrow -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2
+#define d_arrow -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1
+#define l_arrow 0,-3, 0,3, -1,-2, -1,2, -2,-1, -2,1, -3,0
+#define r_arrow -2,-3, -2,3, -1,-2, -1,2, 0,-1, 0,1, 1,0
+
+#include "asteroid.h"
+
+/* Hackery to make metasources work */
+#include "asteroid.moc"
+
+/* TQStyleFactory stuff. Required. */
+class AsteroidStylePlugin : public TQStylePlugin
+{
+public:
+ AsteroidStylePlugin() {}
+ ~AsteroidStylePlugin() {}
+
+ TQStringList keys() const {
+ return TQStringList() << "Asteroid";
+ }
+
+ TQStyle *create(const TQString &key) {
+ if (key == "asteroid") {
+ return new AsteroidStyle;
+ }
+ return 0;
+ }
+};
+
+TQ_EXPORT_PLUGIN(AsteroidStylePlugin);
+
+/* Ok, now we get to the good stuff. */
+
+AsteroidStyle::AsteroidStyle() : KStyle(AllowMenuTransparency)
+{
+ if (tqApp->inherits("KApplication")) {
+ connect(tqApp, TQT_SIGNAL(kdisplayPaletteChanged()), TQT_SLOT(paletteChanged()));
+ }
+
+ backwards = TQApplication::reverseLayout();
+}
+
+AsteroidStyle::~AsteroidStyle()
+{
+/* The destructor is empty for now, but any member pointers should
+ * get deleted here. */
+}
+
+void AsteroidStyle::polish(TQWidget *w)
+{
+/* Screwing with the palette is fun! and required in order to make it feel
+ authentic. -clee */
+ TQPalette wp = w->tqpalette();
+ wp.setColor(TQColorGroup::Dark, wp.active().color(TQColorGroup::Button).dark(350));
+ wp.setColor(TQColorGroup::Mid, wp.active().color(TQColorGroup::Button).dark(150));
+ w->setPalette(wp);
+
+ if (w->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
+ w->installEventFilter(this);
+ } else {
+ KStyle::polish(w);
+ }
+}
+
+void AsteroidStyle::unPolish(TQWidget *w)
+{
+ KStyle::unPolish(w);
+}
+
+void AsteroidStyle::renderMenuBlendPixmap(KPixmap &pix,
+ const TQColorGroup &cg,
+ const TQPopupMenu *) const
+{
+ TQPainter p(&pix);
+
+ p.fillRect(0, 0, pix.width(), pix.height(), cg.background());
+}
+
+void AsteroidStyle::drawKStylePrimitive(KStylePrimitive ksp,
+ TQPainter *p,
+ const TQWidget *w,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags sf,
+ const TQStyleOption &o) const
+{
+ switch (ksp) {
+
+ case KPE_SliderGroove: {
+ const TQSlider* slider = (const TQSlider*)w;
+ int x, y, v, h;
+ r.rect(&x, &y, &v, &h);
+ bool horizontal = slider->orientation() ==Qt::Horizontal;
+ int gcenter = (horizontal ? h : v) / 2;
+ int pad = 3;
+
+ /*p->setPen(cg.background());
+ p->setBrush(cg.background());
+ p->drawRect(r);*/
+
+ if (horizontal) {
+ gcenter += y;
+ p->setPen (cg.background().dark());
+ p->drawLine(x+pad, gcenter-1, x+v-pad, gcenter-1);
+ p->drawPoint(x+pad, gcenter);
+ p->setPen (cg.background().light());
+ p->drawLine(x+pad, gcenter+1, x+v-pad, gcenter+1);
+ p->drawLine(x+v-pad, gcenter, x+v-pad, gcenter-1);
+ } else {
+ gcenter += x;
+ p->setPen (cg.background().dark());
+ p->drawLine(gcenter-1, y+pad, gcenter-1, y+h-pad);
+ p->drawPoint(gcenter, y+pad);
+ p->setPen (cg.background().light());
+ p->drawLine(gcenter+1, y+pad, gcenter+1, y+h-pad);
+ p->drawLine(gcenter, y+h-pad, gcenter-1, y+h-pad);
+ }
+ break;
+ }
+
+ case KPE_SliderHandle: {
+
+ const TQSlider* slider = (const TQSlider*)w;
+ int x, y, x2, y2, xmin, xmax, ymin, ymax, v, h;
+ int pcenter, gcenter;
+ r.coords(&xmin, &ymin, &xmax, &ymax);
+ r.rect(&x, &y, &v, &h);
+ bool horizontal = slider->orientation() ==Qt::Horizontal;
+
+ if (horizontal) {
+ gcenter = h / 2;
+ x = v / 5 + xmin;
+ x2 = v * 4 / 5 + xmin;
+ if (((x2 - x) % 2)) x2--;
+ y2 = ymax - (x2 - x - 1) / 2;
+ y = ymax - y2 + ymin;
+ pcenter = (x2 - x) / 2 + x;
+
+ p->setPen(cg.background());
+ p->setBrush(cg.background());
+ TQRect hr(x-1, y, x2-x+2, y2-y);
+ p->drawRect(hr);
+
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2);
+ p->drawLine(x, y2, pcenter-1, ymax);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y+1, x2-1, y2);
+ p->drawLine(x2-1, y2, pcenter, ymax);
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y, x2, y2);
+ p->drawLine(x2, y2, pcenter+1, ymax);
+
+ } else {
+
+ gcenter = v / 2;
+ y = h / 5 + ymin;
+ y2 = h * 4 / 5 + ymin;
+ if (((y2 - y) % 2)) y2--;
+ x2 = xmax - (y2 - y - 1) / 2;
+ x = (xmax-x2) + xmin;
+ pcenter = (y2 - y)/2 + y;
+
+ p->setPen(cg.background());
+ p->setBrush(cg.background());
+ TQRect hr(x, y-1, x2-x, y2-y+2);
+ p->drawRect(hr);
+
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+ p->drawLine(x2, y, xmax, pcenter-1);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2, y2-1, xmax, pcenter);
+
+ p->setPen(cg.dark());
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y2, xmax, pcenter+1);
+
+ }
+
+ break;
+ }
+
+ default: {
+ KStyle::drawKStylePrimitive(ksp, p, w, r, cg, sf, o);
+ }
+ }
+}
+
+
+void AsteroidStyle::tqdrawPrimitive(TQ_PrimitiveElement pe,
+ TQPainter *p,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags sf,
+ const TQStyleOption &o) const
+{
+ int x, y, x2, y2, w, h;
+ r.coords(&x, &y, &x2, &y2);
+ r.rect(&x, &y, &w, &h);
+
+ switch (pe) {
+ /* Primitives to draw are:
+
+ PE_ButtonCommand
+ PE_ButtonDropDown
+
+ PE_DockWindowSeparator
+ PE_DockWindowResizeHandle
+
+ PE_Splitter
+
+ PE_PanelGroupBox
+ PE_PanelTabWidget
+ PE_TabBarBase
+
+ PE_ProgressBarChunk
+ PE_GroupBoxFrame
+ PE_WindowFrame
+ PE_SizeGrip
+
+ PE_CheckMark
+ PE_CheckListController
+ PE_CheckListIndicator
+ PE_CheckListExclusiveIndicator
+
+ PE_ScrollBarFirst
+ PE_ScrollBarLast
+ */
+
+ case PE_FocusRect: {
+ p->drawWinFocusRect(r);
+ break;
+ }
+
+ case PE_HeaderSection:
+ case PE_ButtonBevel: {
+ p->setPen(cg.dark());
+ p->setBrush(cg.background());
+ p->drawRect(r);
+
+ if (sf & Style_On || sf & Style_Down) {
+ p->setPen(cg.mid());
+ p->drawRect(r);
+ p->setPen(cg.buttonText());
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+ }
+
+ break;
+ }
+
+ case PE_ButtonDefault: {
+ p->setPen(cg.shadow());
+ p->drawRect(r);
+ break;
+ }
+
+ case PE_ButtonTool: {
+ p->setPen(sf & Style_On || sf & Style_Down ? cg.mid() : cg.light());
+ p->drawRect(r);
+ p->setPen(sf & Style_On || sf & Style_Down ? cg.light() : cg.mid());
+ p->drawLine(r.bottomRight(), r.topRight());
+ p->drawLine(r.bottomRight(), r.bottomLeft());
+ p->setPen(cg.buttonText());
+ break;
+ }
+
+ case PE_ScrollBarSlider: {
+ if (sf & Style_Enabled) {
+ p->fillRect(r, cg.background());
+
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x2-2, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ } else {
+ p->fillRect(r, cg.background());
+ p->fillRect(r, TQBrush(cg.light(), Dense4Pattern));
+ }
+
+ break;
+ }
+
+ case PE_StatusBarSection: {
+ p->fillRect(r, cg.background());
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+
+ break;
+ }
+
+ case PE_CheckMark: {
+ int x = r.center().x() - 3, y = r.center().y() - 3;
+ const TQCOORD check[] = { x, y + 2, x, y + 4, x + 2, y + 6, x + 6, y + 2, x + 6, y, x + 2, y + 4 };
+ const TQPointArray a(6, check);
+
+ p->setPen(cg.text());
+ p->setBrush(cg.text());
+ p->drawPolygon(a);
+
+ break;
+ }
+
+ case PE_Indicator: {
+ p->setPen(cg.mid());
+ p->setBrush(sf & Style_Down ? cg.background() : cg.base());
+ p->drawRect(r);
+
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+
+ p->setPen(cg.dark());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ break;
+ }
+
+ case PE_IndicatorMask: {
+ p->fillRect (r, color1);
+
+ break;
+ }
+
+
+ case PE_ExclusiveIndicator: {
+ const TQCOORD outside[] = { 1, 9, 1, 8, 0, 7, 0, 4, 1, 3, 1, 2, 2, 1, 3, 1, 4, 0, 7, 0, 8, 1, 9, 1, 10, 2, 10, 3, 11, 4, 11, 7, 10, 8, 10, 9, 9, 10, 8, 10, 7, 11, 4, 11, 3, 10, 2, 10 };
+ const TQCOORD inside[] = { 2, 8, 1, 7, 1, 4, 2, 3, 2, 2, 3, 2, 4, 1, 7, 1, 8, 2, 9, 2, 9, 3, 10, 4, 10, 7, 9, 8, 9, 9, 8, 9, 7, 10, 4, 10, 3, 9, 2, 9 };
+ p->fillRect(r, cg.background());
+ if (sf & Style_Enabled && !(sf & Style_Down)) {
+ p->setPen(TQPen::NoPen);
+ p->setBrush(cg.base());
+ p->drawPolygon(TQPointArray(24, outside));
+ }
+ p->setPen(cg.mid());
+ p->tqdrawPolyline(TQPointArray(24, outside), 0, 12);
+ p->setPen(cg.light());
+ p->tqdrawPolyline(TQPointArray(24, outside), 12, 12);
+ p->setPen(cg.dark());
+ p->tqdrawPolyline(TQPointArray(20, inside), 0, 10);
+ p->setPen(cg.background());
+ p->tqdrawPolyline(TQPointArray(20, inside), 10, 10);
+ break;
+ }
+
+ case PE_ExclusiveIndicatorMask: {
+ const TQCOORD outside[] = { 1, 9, 1, 8, 0, 7, 0, 4, 1, 3, 1, 2, 2, 1, 3, 1, 4, 0, 7, 0, 8, 1, 9, 1, 10, 2, 10, 3, 11, 4, 11, 7, 10, 8, 10, 9, 9, 10, 8, 10, 7, 11, 4, 11, 3, 10, 2, 10 };
+ p->fillRect(r, color0);
+ p->setPen(color1);
+ p->setBrush(color1);
+ p->drawPolygon(TQPointArray(24, outside));
+ break;
+ }
+
+ case PE_WindowFrame:
+ case PE_Panel: {
+ bool sunken = sf & Style_Sunken;
+
+ p->setPen(sunken ? cg.mid() : cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+
+ p->setPen(sunken ? cg.dark() : cg.background());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+
+ p->setPen(sunken ? cg.light() : cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ p->setPen(sunken ? cg.background() : cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+
+ break;
+ }
+
+ case PE_PanelLineEdit: {
+ p->fillRect(r, cg.base());
+
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y);
+
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+
+ p->setPen(cg.dark());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+
+ break;
+ }
+
+ case PE_PanelDockWindow: {
+ p->setPen(cg.mid());
+ p->drawLine(r.bottomLeft(), r.bottomRight());
+ p->setPen(cg.light());
+ p->drawLine(r.topLeft(), r.topRight());
+ break;
+ }
+
+ case PE_PanelMenuBar: {
+ p->setPen(cg.mid());
+ p->drawLine(r.bottomLeft(), r.bottomRight());
+ break;
+ }
+
+ case PE_ScrollBarAddPage:
+ case PE_ScrollBarSubPage: {
+ if (sf & Style_On || sf & Style_Down) {
+ p->fillRect(r, cg.mid().dark());
+ } else {
+ p->fillRect(r, cg.background());
+ }
+ p->fillRect(r, TQBrush(cg.light(), Dense4Pattern));
+ break;
+ }
+
+ case PE_ScrollBarAddLine: {
+ p->fillRect(r, cg.background());
+
+ if (sf & Style_Down) {
+ p->setPen(cg.mid());
+ p->drawRect(r);
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x2-2, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ }
+
+ p->setPen(cg.foreground());
+ if (sf & Style_Enabled) {
+ tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, r, cg, sf);
+ } else {
+ p->setPen(cg.light());
+ tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, TQRect(x+1, y+1, w-1, h-1), cg, sf);
+ tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, r, cg, sf);
+ }
+ break;
+ }
+
+ case PE_ScrollBarSubLine: {
+ p->fillRect(r, cg.background());
+
+ if (sf & Style_Down) {
+ p->setPen(cg.mid());
+ p->drawRect(r);
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x2-2, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ }
+
+ p->setPen(cg.foreground());
+ tqdrawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, r, cg, sf);
+ break;
+ }
+
+ case PE_DockWindowHandle: {
+ p->setPen(cg.light());
+
+ if (sf & Style_Horizontal) {
+ TQRect hr(0, 0, 3, r.height()-6);
+ hr.moveCenter(r.center());
+
+ p->fillRect(r, cg.background());
+ p->drawRect(hr);
+ p->setPen(cg.mid());
+ p->drawLine(hr.bottomRight(), hr.topRight());
+ p->drawLine(hr.bottomRight(), hr.bottomLeft());
+ } else {
+ TQRect hr(0, 0, r.width()-6, 3);
+ hr.moveCenter(r.center());
+
+ p->fillRect(r, cg.background());
+ p->drawRect(hr);
+ p->setPen(cg.mid());
+ p->drawLine(hr.bottomLeft(), hr.bottomRight());
+ p->drawLine(hr.topRight(), hr.bottomRight());
+ }
+
+ break;
+ }
+
+ case PE_Separator:
+ case PE_DockWindowSeparator: {
+ p->fillRect(r, cg.background());
+
+ if (!(sf & Style_Horizontal)) {
+ p->setPen(cg.mid());
+ p->drawLine(x + 2, y , x2 - 2, y);
+ p->setPen(cg.light());
+ p->drawLine(x + 2, y + 1, x2 - 2, y + 1);
+ }
+ else
+ {
+ p->setPen(cg.mid());
+ p->drawLine(x + 2, y + 2, x + 2, y2 - 2);
+ p->setPen(cg.light());
+ p->drawLine(x + 3, y + 2, x + 3, y2 - 2);
+ }
+ break;
+ }
+
+ case PE_DockWindowResizeHandle: {
+ p->fillRect(r, cg.mid());
+ break;
+ }
+
+ case PE_PanelPopup: {
+ p->setPen(cg.background());
+ p->setBrush(cg.background());
+ p->drawRect(r);
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->drawLine(x+1, y+1, x2-1, y+1);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ break;
+ }
+
+
+ case PE_HeaderArrow:
+ case PE_ArrowUp:
+ case PE_ArrowDown:
+ case PE_ArrowLeft:
+ case PE_ArrowRight: {
+ TQPointArray a;
+
+ switch (pe) {
+
+ case PE_ArrowUp: {
+ a.setPoints(7, u_arrow);
+ break;
+ }
+
+ case PE_ArrowDown: {
+ a.setPoints(7, d_arrow);
+ break;
+ }
+
+ case PE_ArrowLeft: {
+ a.setPoints(7, l_arrow);
+ break;
+ }
+
+ case PE_ArrowRight: {
+ a.setPoints(7, r_arrow);
+ break;
+ }
+
+ default: {
+ if (sf & Style_Up) {
+ a.setPoints(7, u_arrow);
+ } else {
+ a.setPoints(7, d_arrow);
+ }
+ }
+ }
+
+ if (p->pen() == Qt::NoPen) {
+ p->setPen(sf & Style_Enabled ? cg.foreground() : cg.light());
+ }
+
+ if (sf & Style_Down) {
+ p->translate(tqpixelMetric(PM_ButtonShiftHorizontal),
+ tqpixelMetric(PM_ButtonShiftVertical));
+ }
+
+ a.translate((x + w/2), (y + (h-1)/2));
+ p->drawLineSegments(a, 0, 3);
+ p->drawPoint(a[6]);
+
+ if (sf & Style_Down) {
+ p->translate(-tqpixelMetric(PM_ButtonShiftHorizontal),
+ -tqpixelMetric(PM_ButtonShiftVertical));
+ }
+
+ break;
+ }
+
+ default: {
+ KStyle::tqdrawPrimitive(pe, p, r, cg, sf, o);
+ }
+ }
+}
+
+void AsteroidStyle::tqdrawControl(TQ_ControlElement ce,
+ TQPainter *p,
+ const TQWidget *w,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags sf,
+ const TQStyleOption &o) const
+{
+ int x, y, x2, y2, sw, sh;
+ r.coords(&x, &y, &x2, &y2);
+ r.rect(&x, &y, &sw, &sh);
+
+ switch (ce) {
+ /* TQ_ControlElements to draw are:
+
+ CE_CheckBoxLabel
+ CE_RadioButtonLabel
+
+ CE_TabBarTab
+ CE_TabBarLabel
+
+ CE_ProgressBarGroove
+ CE_ProgressBarContents
+ CE_ProgressBarLabel
+
+ CE_PopupMenuScroller
+ CE_PopupMenuHorizontalExtra
+ CE_PopupMenuVerticalExtra
+ CE_MenuBarEmptyArea
+ CE_DockWindowEmptyArea
+
+ CE_ToolButtonLabel
+ CE_ToolBoxTab
+
+ */
+ case CE_ProgressBarContents: {
+
+
+ // ### Take into account totalSteps() for busy indicator
+ const TQProgressBar* pb = (const TQProgressBar*)w;
+ TQRect cr = subRect(SR_ProgressBarContents, w);
+ double progress = pb->progress();
+ bool reverse = TQApplication::reverseLayout();
+ int steps = pb->totalSteps();
+
+ if (!cr.isValid())
+ return;
+
+
+ p->setPen(cg.light());
+ p->setBrush(cg.light());
+ p->drawRect(r);
+
+ // Draw progress bar
+ if (progress > 0 || steps == 0) {
+ double pg = (steps == 0) ? 0.1 : progress / steps;
+ int width = TQMIN(cr.width(), (int)(pg * cr.width()));
+ if (steps == 0) { //Busy indicator
+
+ if (width < 1) width = 1; //A busy indicator with width 0 is kind of useless
+
+ int remWidth = cr.width() - width; //Never disappear completely
+ if (remWidth <= 0) remWidth = 1; //Do something non-crashy when too small...
+
+ int pstep = int(progress) % ( 2 * remWidth );
+
+ if ( pstep > remWidth ) {
+ //Bounce about.. We're remWidth + some delta, we want to be remWidth - delta...
+ // - ( (remWidth + some delta) - 2* remWidth ) = - (some deleta - remWidth) = remWidth - some delta..
+ pstep = - (pstep - 2 * remWidth );
+ }
+
+ if (reverse)
+ p->fillRect(cr.x() + cr.width() - width - pstep, cr.y(), width, cr.height(),
+ cg.brush(TQColorGroup::Highlight));
+ else
+ p->fillRect(cr.x() + pstep, cr.y(), width, cr.height(),
+ cg.brush(TQColorGroup::Highlight));
+
+ return;
+ }
+
+
+
+ if (reverse)
+ p->fillRect(cr.x()+(cr.width()-width), cr.y(), width, cr.height(),
+ cg.brush(TQColorGroup::Highlight));
+ else
+ p->fillRect(cr.x(), cr.y(), width, cr.height(),
+ cg.brush(TQColorGroup::Highlight));
+ }
+ break;
+ }
+
+ case CE_CheckBox: {
+ tqdrawPrimitive(PE_Indicator, p, r, cg, sf);
+ if (sf & Style_On) {
+ tqdrawPrimitive(PE_CheckMark, p, r, cg, sf);
+ }
+ break;
+ }
+
+ case CE_RadioButton: {
+ tqdrawPrimitive(PE_ExclusiveIndicator, p, r, cg, sf);
+ if (sf & Style_On) {
+ TQCOORD center[] = { 4, 5, 4, 6, 5, 7, 6, 7, 7, 6, 7, 5, 6, 4, 5, 4 };
+ TQPointArray c(8, center);
+ p->setPen(cg.text());
+ p->setBrush(cg.text());
+ p->drawPolygon(c);
+ }
+ break;
+ }
+
+ case CE_PushButton: {
+ const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w);
+
+ if (pb->isDefault()) {
+ tqdrawPrimitive(PE_ButtonDefault, p, r, cg, sf);
+ tqdrawPrimitive(PE_ButtonBevel, p, TQRect(x+1, y+1, sw-2, sh-2), cg, sf);
+ } else {
+ tqdrawPrimitive(PE_ButtonBevel, p, r, cg, sf);
+ }
+
+ break;
+ }
+
+ case CE_MenuBarItem: {
+ bool active = sf & Style_Active;
+ bool focused = sf & Style_HasFocus;
+ bool down = sf & Style_Down;
+ const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine;
+
+ if (active && focused) {
+ p->setBrush(cg.background());
+ p->setPen(cg.background());
+ p->drawRect(r);
+
+ if (down) {
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ /*p->translate(1, 1);*/
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+ p->setPen(cg.mid());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ }
+ }
+
+ p->setPen(cg.foreground());
+ p->drawText(r, text_flags, o.menuItem()->text());
+
+ /*if (active && focused && down) {
+ p->translate(-1, -1);
+ }*/
+
+ break;
+ }
+
+
+ case CE_PushButtonLabel: {
+ const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w);
+ const bool enabled = sf & Style_Enabled;
+ const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine;
+ int dx = 0;
+
+ if (sf & Style_Down) {
+ p->translate(tqpixelMetric(PM_ButtonShiftHorizontal),
+ tqpixelMetric(PM_ButtonShiftVertical));
+ }
+
+ if (pb->iconSet() && !pb->iconSet()->isNull()) {
+ TQIconSet::Mode mode = enabled ? TQIconSet::Normal : TQIconSet::Disabled;
+ TQPixmap pixmap = pb->iconSet()->pixmap(TQIconSet::Small, mode);
+ TQRect pr(0, 0, pixmap.width(), pixmap.height());
+
+ pr.moveCenter(r.center());
+
+ if (!pb->text().isNull()) {
+ dx = r.height() - pixmap.height();
+ dx = static_cast<int>(dx * 0.5);
+ pr.moveLeft(dx);
+ }
+
+ p->drawPixmap(pr.topLeft(), pixmap);
+ } else if (pb->pixmap() && !pb->text()) {
+ TQRect pr(0, 0, pb->pixmap()->width(), pb->pixmap()->height());
+ pr.moveCenter(r.center());
+ p->drawPixmap(pr.topLeft(), *pb->pixmap());
+ }
+
+ if (!pb->text().isNull()) {
+ p->setPen(enabled ? cg.buttonText() : pb->tqpalette().disabled().buttonText());
+ if (pb->iconSet() && !pb->iconSet()->isNull()) {
+ TQRect tr(p->boundingRect(r, text_flags, pb->text()));
+ tr.moveCenter(r.center());
+ tr.moveBy(dx, 0);
+ p->drawText(tr, text_flags, pb->text());
+ } else {
+ p->drawText(r, text_flags, pb->text());
+ }
+ }
+
+ break;
+ }
+
+ /* Note: This is very poorly documented by TT. I'm disappointed. -clee */
+ case CE_HeaderLabel: {
+ const TQHeader *hw = dynamic_cast<const TQHeader *>(w);
+ int hs = o.headerSection();
+ const int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+
+ TQIconSet *is = hw->iconSet(hs);
+ if (is) {
+ TQPixmap pm = is->pixmap(TQIconSet::Small, sf & Style_Enabled ? TQIconSet::Normal : TQIconSet::Disabled);
+ TQRect pr(0, 0, pm.width(), pm.height());
+ pr.moveCenter(r.center());
+ pr.setLeft(r.center().y() - (pm.height() - 1) / 2);
+ p->drawPixmap(pr.topLeft(), pm);
+ pr = TQRect(pr.width(), r.top(), r.width() - pr.width(), r.height());
+ p->drawText(pr, text_flags, hw->label(hs));
+ } else {
+ p->setPen(cg.buttonText());
+ p->drawText(r, text_flags, hw->label(hs));
+ }
+ break;
+ }
+
+ case CE_PopupMenuItem: {
+ TQMenuItem *mi = o.menuItem();
+
+ if (!mi) {
+ return;
+ }
+
+ const TQPopupMenu *pum = dynamic_cast<const TQPopupMenu *>(w);
+ static const int itemFrame = 2;
+ static const int itemHMargin = 3;
+ static const int itemVMargin = 3;
+ static const int arrowHMargin = 4;
+ static const int rightBorder = 16;
+ const int tab = o.tabWidth();
+
+ int checkcol = TQMAX(o.maxIconWidth(), 12);
+
+ bool active = sf & Style_Active;
+ bool disabled = !mi->isEnabled();
+ bool checkable = pum->isCheckable();
+
+ int xpos = x;
+ int xm = itemFrame + checkcol + itemHMargin;
+
+ if (pum->erasePixmap() && !pum->erasePixmap()->isNull()) {
+ p->drawPixmap(x, y, *pum->erasePixmap(), x, y, sw, sh);
+ } else {
+ p->fillRect(x, y, sw, sh, cg.background());
+ }
+
+ if (mi->widget()) {
+ /* nOOOOOOOOOOOP */
+ } else if (mi->isSeparator()) {
+ p->setPen(cg.mid());
+ p->drawLine(x + 1, y + 3, x2 - 1, y + 3);
+ p->setPen(cg.light());
+ p->drawLine(x + 1, y + 4, x2 - 1, y + 4);
+ return;
+ }
+
+ if (active && !disabled && !mi->isSeparator()) {
+ p->setBrush(cg.highlight());
+ p->fillRect(r, cg.highlight());
+ p->setPen(cg.highlightedText());
+ }
+
+ if (mi->iconSet()) {
+ TQIconSet::Mode mode =
+ disabled ? TQIconSet::Disabled : TQIconSet::Normal;
+ TQPixmap pixmap = mi->iconSet()->pixmap(TQIconSet::Small, mode);
+
+ int pixw = pixmap.width();
+ int pixh = pixmap.height();
+
+ TQRect cr(xpos, y, o.maxIconWidth(), sh);
+ TQRect pmr(0, 0, pixw, pixh);
+ pmr.moveCenter(cr.center());
+
+ if (backwards)
+ pmr = tqvisualRect(pmr, r);
+
+ p->setPen(cg.highlightedText());
+ p->drawPixmap(pmr.topLeft(), pixmap);
+ } else if (checkable) {
+ if (mi->isChecked()) {
+ int xp = xpos;
+
+ SFlags cflags = Style_Default;
+ if (disabled) {
+ cflags |= Style_On;
+ } else {
+ cflags |= Style_Enabled;
+ }
+
+ p->setPen(active ? cg.highlightedText() : cg.buttonText());
+
+ TQRect rr = TQRect(xp, y, checkcol, sh);
+ if (backwards) {
+ rr = tqvisualRect(rr, r);
+ }
+
+ tqdrawPrimitive(PE_CheckMark, p, rr, cg, cflags);
+ }
+ }
+
+ xpos += xm;
+
+ if (mi->custom()) {
+ int m = itemVMargin;
+ p->setPen(cg.foreground());
+ mi->custom()->paint(p, cg, active, !disabled, x+xm, y+m, sw-xm-tab+1, sh-2*m);
+ return;
+ } else {
+ p->setPen(active ? cg.highlightedText() : cg.buttonText());
+ TQString s = mi->text();
+
+ if(!s.isNull()) {
+ int t = s.tqfind('\t');
+ int m = itemVMargin;
+
+ int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+
+ if (active && !disabled) {
+ p->setPen(cg.highlightedText());
+ } else if (disabled) {
+ p->setPen(cg.mid().light(110));
+ } else {
+ p->setPen(cg.text());
+ }
+
+ if (t >= 0) {
+ int xp = x + sw - tab - rightBorder - itemHMargin - itemFrame + 1;
+
+ TQRect rr = TQRect(xp, y+m, tab, sh-(2*m));
+ if (backwards) {
+ rr = tqvisualRect(rr, r);
+ }
+
+ p->drawText(rr, text_flags, s.mid(t+1));
+ s = s.left(t);
+ }
+
+ TQRect rr = TQRect(xpos, y+m, sw-xm-tab+1, sh-(2*m));
+ if (backwards) {
+ rr = tqvisualRect(rr, r);
+ text_flags |= AlignRight;
+ }
+
+ p->drawText(rr, text_flags, s);
+ } else if (mi->pixmap()) {
+ TQPixmap *pixmap = mi->pixmap();
+ if (pixmap->depth() == 1) {
+ p->setBackgroundMode(Qt::OpaqueMode);
+ }
+ p->drawPixmap(xpos, y, *pixmap);
+ if (pixmap->depth() == 1) {
+ p->setBackgroundMode(Qt::TransparentMode);
+ }
+ }
+ }
+
+ if (mi->popup()) {
+ int dim = tqpixelMetric(PM_MenuButtonIndicator);
+
+ xpos = x + sw - arrowHMargin - 2 * itemFrame - dim;
+
+ if (active && !disabled) {
+ p->setPen(cg.highlightedText());
+ } else {
+ p->setPen(cg.text());
+ }
+
+ TQRect rr = TQRect(xpos, y + sh/2 - dim/2, dim, dim);
+ if (backwards)
+ rr = tqvisualRect(rr, r);
+ tqdrawPrimitive((backwards ? PE_ArrowLeft : PE_ArrowRight), p, rr, cg, Style_Enabled);
+ }
+
+ break;
+ }
+
+ default: {
+ KStyle::tqdrawControl(ce, p, w, r, cg, sf, o);
+ }
+ }
+}
+
+void AsteroidStyle::tqdrawControlMask(TQ_ControlElement ce,
+ TQPainter *p,
+ const TQWidget *w,
+ const TQRect &r,
+ const TQStyleOption &o) const
+{
+ switch (ce) {
+ /*
+ TQ_ControlElements to draw are:
+
+ CE_PushButton
+ CE_PushButtonLabel
+
+ CE_CheckBox
+ CE_CheckBoxLabel
+
+ CE_RadioButton
+ CE_RadioButtonLabel
+
+ CE_TabBarTab
+ CE_TabBarLabel
+
+ CE_ProgressBarGroove
+ CE_ProgressBarContents
+ CE_ProgressBarLabel
+
+ CE_PopupMenuScroller
+ CE_PopupMenuHorizontalExtra
+ CE_PopupMenuVerticalExtra
+ CE_PopupMenuItem
+ CE_MenuBarItem
+ CE_MenuBarEmptyArea
+ CE_DockWindowEmptyArea
+
+ CE_ToolButtonLabel
+ CE_ToolBoxTab
+
+ CE_HeaderLabel
+ */
+ default: {
+ KStyle::tqdrawControlMask(ce, p, w, r, o);
+ }
+ }
+}
+
+void AsteroidStyle::tqdrawComplexControl(TQ_ComplexControl cc,
+ TQPainter *p,
+ const TQWidget *w,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags sf,
+ SCFlags sc,
+ SCFlags sa,
+ const TQStyleOption &o) const
+{
+ switch (cc) {
+ /* TQ_ComplexControls available are:
+
+ CC_SpinWidget
+ CC_ScrollBar
+ CC_Slider
+ CC_ToolButton
+ CC_TitleBar
+ CC_ListView
+ */
+ case CC_ComboBox: {
+ int x, y, x2, y2, sw, sh;
+ const TQComboBox *cb = dynamic_cast<const TQComboBox *>(w);
+ r.rect(&x, &y, &sw, &sh);
+ r.coords(&x, &y, &x2, &y2);
+
+ if (sa & Style_Sunken) {
+ sf |= Style_Sunken;
+ }
+
+ static const unsigned char downarrow_bits[] = {
+ 0x7f, 0xbe, 0x9c, 0x08, 0x00, 0x00, 0x00, 0x28,
+ 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0xb8
+ };
+
+ static const unsigned int handle_width = 16;
+ static const unsigned int handle_offset = handle_width + 1;
+
+ TQBitmap downArrow = TQBitmap(7, 4, downarrow_bits, true);
+ downArrow.setMask(downArrow);
+
+ // Draw the frame around the text.
+ p->setPen(cg.mid());
+ p->setBrush(cg.dark());
+ p->drawRect(r);
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x2, y);
+ p->drawLine(x2, y2, x, y2);
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+
+ // Fill in the area behind the text.
+ p->fillRect(querySubControlMetrics(cc, w, SC_ComboBoxEditField), cg.base());
+ p->setBrush(cg.background());
+
+ // Draw the box on the right.
+ TQRect hr(sw - handle_offset-1, y+2, handle_width, sh-4);
+ int hrx, hry, hrx2, hry2;
+ hr.coords(&hrx, &hry, &hrx2, &hry2);
+ if (backwards) { hr = tqvisualRect(hr, r); }
+
+ p->drawRect(hr);
+
+ if (cb->listBox() && cb->listBox()->isVisible()) {
+ p->setPen(cg.mid());
+ p->drawRect(hr);
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(hrx+1, hry+1, hrx2-1, hry+1);
+ p->drawLine(hrx+1, hry+1, hrx+1, hry2-1);
+
+ p->setPen(cg.mid());
+ p->drawLine(hrx2-1, hry2-1, hrx+1, hry2-1);
+ p->drawLine(hrx2-1, hry2-1, hrx2-1, hry+1);
+
+ p->setPen(cg.dark());
+ p->drawLine(hrx2, hry2, hrx, hry2);
+ p->drawLine(hrx2, hry2, hrx2, hry);
+ }
+
+ TQRect cr(sw - handle_offset-1, y+2, handle_width, sh - 4);
+ TQRect pmr(0, 0, 7, 4);
+ pmr.moveCenter(cr.center());
+ if (cb->listBox() && cb->listBox()->isVisible()) {
+ pmr.moveBy(1, 1);
+ }
+
+ if (backwards) { pmr = tqvisualRect(pmr, r); }
+
+ p->setPen(cg.foreground());
+ p->drawPixmap(pmr.topLeft(), downArrow);
+
+ break;
+ }
+
+
+ case CC_Slider: {
+ const TQSlider* slider = (const TQSlider*)w;
+ TQRect groove = querySubControlMetrics(CC_Slider, w, SC_SliderGroove, o);
+ TQRect handle = querySubControlMetrics(CC_Slider, w, SC_SliderHandle, o);
+
+ // Double-buffer slider for no flicker
+ TQPixmap pix(w->size());
+ TQPainter p2;
+ p2.begin(&pix);
+
+ if ( slider->parentWidget() &&
+ slider->parentWidget()->backgroundPixmap() &&
+ !slider->parentWidget()->backgroundPixmap()->isNull() ) {
+ TQPixmap pixmap = *(slider->parentWidget()->backgroundPixmap());
+ p2.drawTiledPixmap(r, pixmap, slider->pos());
+ } else
+ pix.fill(cg.background());
+
+ // Draw slider groove
+ if ((sc & SC_SliderGroove) && groove.isValid()) {
+ drawKStylePrimitive( KPE_SliderGroove, &p2, w, groove, cg, sf, o );
+
+ // Draw the focus rect around the groove
+ if (slider->hasFocus())
+ tqdrawPrimitive(PE_FocusRect, &p2, groove, cg);
+ }
+
+
+ /* Turn these off for now */
+ // Draw the tickmarks
+ /*if (controls & SC_SliderTickmarks)
+ TQCommonStyle::tqdrawComplexControl(control, &p2,
+ r, cg, flags, SC_SliderTickmarks, active, opt);*/
+
+ // Draw the slider handle
+ if ((sc & SC_SliderHandle) && handle.isValid()) {
+ if (sa == SC_SliderHandle)
+ sf |= Style_Active;
+ drawKStylePrimitive( KPE_SliderHandle, &p2, w, handle, cg, sf, o );
+ }
+
+ p2.end();
+ bitBlt((TQWidget*)w, r.x(), r.y(), &pix);
+ break;
+ }
+
+ case CC_SpinWidget: {
+ int x, y, x2, y2, w, h;
+ int aw = 12; // arrow button width
+ r.coords(&x, &y, &x2, &y2);
+ r.rect(&x, &y, &w, &h);
+
+ TQRect arrowup(x2-aw, y+2, aw, h/2-1);
+ TQRect arrowdn(x2-aw, h/2+1, aw, h/2-2);
+
+ // Draw the frame around the text
+ p->setPen(cg.mid());
+ p->setBrush(cg.dark());
+ p->drawRect(r);
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x2, y);
+ p->drawLine(x2, y2, x, y2);
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x2-1, y+2);
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+
+ // Draw the arrow buttons
+ p->drawLine(x2-aw-1, y+2, x2-aw-1, y2-1);
+ tqdrawPrimitive(PE_ButtonBevel, p, arrowup, cg, sf, o);
+ tqdrawPrimitive(PE_ButtonBevel, p, arrowdn, cg, sf, o);
+ tqdrawPrimitive(PE_SpinWidgetUp, p, arrowup, cg, sf, o);
+ tqdrawPrimitive(PE_SpinWidgetDown, p, arrowdn, cg, sf, o);
+
+ break;
+
+ }
+
+
+
+ default: {
+ KStyle::tqdrawComplexControl(cc, p, w, r, cg, sf, sc, sa, o);
+ }
+ }
+}
+
+void AsteroidStyle::tqdrawComplexControlMask(TQ_ComplexControl cc,
+ TQPainter *p,
+ const TQWidget *w,
+ const TQRect &r,
+ const TQStyleOption &o) const
+{
+ switch (cc) {
+ /* TQ_ComplexControls available are:
+
+ CC_SpinWidget
+ CC_ComboBox
+ CC_ScrollBar
+ CC_Slider
+ CC_ToolButton
+ CC_TitleBar
+ CC_ListView
+ */
+ default: {
+ KStyle::tqdrawComplexControlMask(cc, p, w, r, o);
+ }
+ }
+}
+
+int AsteroidStyle::tqpixelMetric(PixelMetric pm, const TQWidget *w) const
+{
+
+ switch (pm) {
+ /* PixelMetrics available are:
+
+ PM_ButtonMargin
+ PM_ButtonDefaultIndicator
+
+ PM_SpinBoxFrameWidth
+ PM_MDIFrameWidth
+ PM_MDIMinimizedWidth
+
+ PM_MaximumDragDistance
+
+ PM_ScrollBarExtent
+ PM_ScrollBarSliderMin
+
+ PM_SliderThickness
+ PM_SliderControlThickness
+ PM_SliderLength
+ PM_SliderTickmarkOffset
+ PM_SliderSpaceAvailable
+
+ PM_DockWindowSeparatorExtent
+ PM_DockWindowHandleExtent
+
+ PM_TabBarTabOverlap
+ PM_TabBarTabHSpace
+ PM_TabBarTabVSpace
+ PM_TabBarBaseHeight
+ PM_TabBarBaseOverlap
+
+ PM_ProgressBarChunkWidth
+
+ PM_SplitterWidth
+
+ PM_TitleBarHeight
+
+ PM_CheckListButtonSize
+ PM_CheckListControllerSize
+
+ PM_PopupMenuFrameHorizontalExtra
+ PM_PopupMenuFrameVerticalExtra
+ PM_PopupMenuScrollerHeight
+
+ PM_HeaderMarkSize
+
+ PM_TabBarTabShiftHorizontal
+ PM_TabBarTabShiftVertical
+ */
+
+ case PM_ExclusiveIndicatorWidth:
+ case PM_ExclusiveIndicatorHeight: {
+ return 12;
+ }
+
+ case PM_IndicatorWidth:
+ case PM_IndicatorHeight: {
+ return 13;
+ }
+
+ case PM_MenuBarFrameWidth: {
+ return 2;
+ }
+
+ case PM_ButtonShiftHorizontal:
+ case PM_ButtonShiftVertical: {
+ return 1;
+ }
+
+ case PM_HeaderGripMargin:
+ case PM_HeaderMargin: {
+ return 3;
+ }
+
+ case PM_DialogButtonsButtonWidth: {
+ return 75;
+ }
+
+ case PM_DialogButtonsButtonHeight: {
+ return 23;
+ }
+
+ case PM_DockWindowSeparatorExtent:
+ case PM_MenuButtonIndicator:
+ case PM_DockWindowFrameWidth:
+ case PM_DialogButtonsSeparator: {
+ return 6;
+ }
+
+ case PM_DefaultFrameWidth: {
+ if (w && w->inherits(TQPOPUPMENU_OBJECT_NAME_STRING)) {
+ return 3;
+ } else {
+ return KStyle::tqpixelMetric(pm, w);
+ }
+ }
+
+ default: {
+ return KStyle::tqpixelMetric(pm, w);
+ }
+ }
+}
+
+TQRect AsteroidStyle::subRect(SubRect sr, const TQWidget *w) const
+{
+ switch (sr) {
+ /* SubRects to calculate are:
+
+ SR_PushButtonContents
+ SR_PushButtonFocusRect
+
+ SR_CheckBoxIndicator
+ SR_CheckBoxContents
+ SR_CheckBoxFocusRect
+
+ SR_RadioButtonIndicator
+ SR_RadioButtonContents
+ SR_RadioButtonFocusRect
+
+ SR_ComboBoxFocusRect
+ SR_SliderFocusRect
+
+ SR_DockWindowHandleRect
+
+ SR_ProgressBarGroove
+ SR_ProgressBarContents
+ SR_ProgressBarLabel
+
+ SR_ToolButtonContents
+ SR_ToolBoxTabContents
+
+ SR_DialogButtonAccept
+ SR_DialogButtonReject
+ SR_DialogButtonApply
+ SR_DialogButtonHelp
+ SR_DialogButtonAll
+ SR_DialogButtonAbort
+ SR_DialogButtonIgnore
+ SR_DialogButtonRetry
+ SR_DialogButtonCustom
+ */
+ default: {
+ return KStyle::subRect(sr, w);
+ }
+ }
+}
+
+TQRect AsteroidStyle::querySubControlMetrics(TQ_ComplexControl cc,
+ const TQWidget *w,
+ SubControl sc,
+ const TQStyleOption &o) const
+{
+ switch (cc) {
+ /* Available SubControls are:
+
+ SC_ScrollBarAddLine
+ SC_ScrollBarSubLine
+ SC_ScrollBarAddPage
+ SC_ScrollBarSubPage
+ SC_ScrollBarFirst
+ SC_ScrollBarLast
+ SC_ScrollBarSlider
+ SC_ScrollBarGroove
+
+ SC_SpinWidgetUp
+ SC_SpinWidgetDown
+ SC_SpinWidgetFrame
+ SC_SpinWidgetEditField
+ SC_SpinWidgetButtonField
+
+ SC_ComboBoxFrame
+ SC_ComboBoxArrow
+ SC_ComboBoxListBoxPopup
+
+ SC_SliderGroove
+ SC_SliderHandle
+ SC_SliderTickmarks
+
+ SC_ToolButton
+ SC_ToolButtonMenu
+
+ SC_TitleBarLabel
+ SC_TitleBarSysMenu
+ SC_TitleBarMinButton
+ SC_TitleBarMaxButton
+ SC_TitleBarCloseButton
+ SC_TitleBarNormalButton
+ SC_TitleBarShadeButton
+ SC_TitleBarUnshadeButton
+
+ SC_ListView
+ SC_ListViewBranch
+ SC_ListViewExpand
+ */
+ case CC_ComboBox: {
+ if (!w) {
+ return TQRect();
+ }
+
+ TQRect r(w->rect());
+
+ switch (sc) {
+ case SC_ComboBoxEditField: {
+ return TQRect(r.x()+2, r.y()+2, r.width()-20, r.height()-4);
+ }
+ default: {
+ return KStyle::querySubControlMetrics(cc, w, sc, o);
+ }
+ }
+
+ break;
+ }
+
+ default: {
+ return KStyle::querySubControlMetrics(cc, w, sc, o);
+ }
+ }
+}
+
+TQSize AsteroidStyle::sizeFromContents(ContentsType ct,
+ const TQWidget *w,
+ const TQSize &s,
+ const TQStyleOption &o) const
+{
+ switch (ct) {
+ /* ContentsType values can be:
+
+ CT_CheckBox
+ CT_RadioButton
+ CT_Splitter
+ CT_DockWindow
+ CT_ProgressBar
+ CT_TabBarTab
+ CT_Slider
+ CT_LineEdit
+ CT_SpinBox
+ CT_SizeGrip
+ CT_TabWidget
+ CT_DialogButtons
+ */
+ case CT_ToolButton: {
+ return TQSize(s.width() + 8, s.height() + 8);
+ }
+
+ case CT_PushButton: {
+ const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w);
+ const TQSize ret = KStyle::tqsizeFromContents(ct, w, s, o);
+ int rw = ret.width(), rh = ret.height();
+ int mw = 75, mh = 23;
+
+ if (pb->iconSet() && !pb->iconSet()->isNull()) {
+ rw += pb->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).width();
+ } else if (pb->pixmap() && !pb->pixmap()->isNull()) {
+ rw += pb->pixmap()->width();
+ }
+
+ return TQSize((rw < mw ? mw : rw), (rh < mh ? mh : rh));
+ }
+
+ case CT_ComboBox: {
+ int padding = (tqpixelMetric(PM_DefaultFrameWidth, w) * 2) + 1;
+ return TQSize(s.width() + 21, s.height() + padding);
+ }
+
+ case CT_MenuBar: {
+ const TQMenuBar *mb = dynamic_cast<const TQMenuBar *>(w);
+ int sh = TQFontInfo(mb->font()).pixelSize() + 4;
+ int sw = 10;
+ return TQSize(sw, sh);
+ }
+
+ case CT_Header: {
+ const TQHeader *hw = dynamic_cast<const TQHeader *>(w);
+ int sh = TQFontInfo(hw->font()).pixelSize() + 8;
+ int sw = 10;
+ return TQSize(sw, sh);
+ }
+
+ case CT_PopupMenuItem: {
+ if (!w || o.isDefault()) {
+ return TQSize(0, 0);
+ }
+
+ int sw = s.width(), sh = s.height();
+ const TQPopupMenu *popup = dynamic_cast<const TQPopupMenu *>(w);
+ TQMenuItem *mi = o.menuItem();
+
+ if (mi->custom()) {
+ sw = mi->custom()->tqsizeHint().width();
+ sh = mi->custom()->tqsizeHint().height();
+ } else if (mi->widget()) {
+ /* This is a do-nothing branch */
+ } else if (mi->isSeparator()) {
+ sw = 0, sh = 9;
+ } else {
+ if (mi->pixmap()) {
+ sh = TQMAX(sh, mi->pixmap()->height() + 2);
+ } else if (mi->iconSet()) {
+ sh = TQMAX(sh, mi->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).height() + 2);
+ }
+
+ sh = TQMAX(sh, w->fontMetrics().height() + 4);
+ }
+
+ if (!mi->text().isNull()) {
+ if ((mi->text().tqfind('\t') >= 0)) {
+ sw += 16;
+ } else if (mi->popup()) {
+ sw += 8;
+ }
+ }
+
+ int miw = o.maxIconWidth();
+ if (miw) {
+ sw += miw;
+ if (popup->isCheckable()) {
+ sw += 20 - miw;
+ }
+ }
+
+ sw += 20;
+
+ return TQSize(sw, sh);
+ }
+
+ default: {
+ return KStyle::tqsizeFromContents(ct, w, s, o);
+ }
+ }
+}
+
+void AsteroidStyle::paletteChanged()
+{
+}
+
+bool AsteroidStyle::eventFilter(TQObject *o, TQEvent *e)
+{
+ /* Win2K has this interesting behaviour where it sets the current
+ default button to whatever pushbutton the user presses the mouse
+ on. I _think_ this emulates that properly. -clee */
+ if (o->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
+ if (e->type() == TQEvent::MouseButtonPress) {
+ TQPushButton *pb = dynamic_cast<TQPushButton *>(o);
+ pb->setDefault(TRUE);
+ }
+ }
+
+ return false;
+}
diff --git a/kstyles/asteroid/asteroid.h b/kstyles/asteroid/asteroid.h
new file mode 100644
index 000000000..5cf1d7ae7
--- /dev/null
+++ b/kstyles/asteroid/asteroid.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2003, Chris Lee <clee@kde.org>
+ *
+ * See LICENSE for details about copyright.
+ */
+
+#ifndef __ASTEROID_H
+#define __ASTEROID_H
+
+#include <kstyle.h>
+
+class AsteroidStyle : public KStyle
+{
+ Q_OBJECT
+ TQ_OBJECT
+public:
+ AsteroidStyle();
+ virtual ~AsteroidStyle();
+
+ void polish(TQWidget *);
+ void unPolish(TQWidget *);
+
+
+ void renderSliderHandle(TQPainter *p,
+ const TQRect &r,
+ const TQColorGroup &g,
+ const bool mouseOver,
+ const bool horizontal,
+ const bool enabled) const;
+
+ void renderMenuBlendPixmap(KPixmap &,
+ const TQColorGroup &,
+ const TQPopupMenu *) const;
+
+ void drawKStylePrimitive(KStylePrimitive,
+ TQPainter *,
+ const TQWidget *,
+ const TQRect &,
+ const TQColorGroup &,
+ SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default) const;
+
+ void tqdrawPrimitive(TQ_PrimitiveElement,
+ TQPainter *,
+ const TQRect &,
+ const TQColorGroup &,
+ SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default) const;
+
+ void tqdrawControl(TQ_ControlElement,
+ TQPainter *,
+ const TQWidget *,
+ const TQRect &,
+ const TQColorGroup &,
+ SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default) const;
+
+ void tqdrawControlMask(TQ_ControlElement,
+ TQPainter *,
+ const TQWidget *,
+ const TQRect &,
+ const TQStyleOption &) const;
+
+ void tqdrawComplexControl(TQ_ComplexControl,
+ TQPainter *,
+ const TQWidget *,
+ const TQRect &,
+ const TQColorGroup &,
+ SFlags = Style_Default,
+ SCFlags controls = SC_All,
+ SCFlags active = SC_None,
+ const TQStyleOption & = TQStyleOption::Default) const;
+
+ void tqdrawComplexControlMask(TQ_ComplexControl,
+ TQPainter *,
+ const TQWidget *,
+ const TQRect &r,
+ const TQStyleOption & = TQStyleOption::Default) const;
+
+ int tqpixelMetric(PixelMetric, const TQWidget * = 0) const;
+
+ int kPixelMetric( KStylePixelMetric kpm, const TQWidget* /* widget */) const;
+
+ TQRect subRect(SubRect, const TQWidget *) const;
+
+ TQRect querySubControlMetrics(TQ_ComplexControl,
+ const TQWidget *,
+ SubControl,
+ const TQStyleOption & = TQStyleOption::Default) const;
+
+ TQSize sizeFromContents(ContentsType,
+ const TQWidget *,
+ const TQSize &,
+ const TQStyleOption &) const;
+
+protected:
+ bool eventFilter(TQObject *, TQEvent *);
+
+protected slots:
+ void paletteChanged();
+
+private:
+ AsteroidStyle(const AsteroidStyle &);
+ AsteroidStyle &operator = (const AsteroidStyle &);
+
+/* Settings not needed yet. */
+// TQSettings *settings;
+ bool backwards;
+};
+
+#endif /* __ASTEROID_H */
diff --git a/kstyles/asteroid/asteroid.themerc b/kstyles/asteroid/asteroid.themerc
new file mode 100644
index 000000000..2679b6818
--- /dev/null
+++ b/kstyles/asteroid/asteroid.themerc
@@ -0,0 +1,8 @@
+[Misc]
+Name=Asteroid style
+Name[en]=Asteroid style
+Comment=Windows 2000 (codename: Asteroid) appearance
+Comment[en]=Windows 2000 (codename: Asteroid) appearance
+
+[KDE]
+WidgetStyle=Asteroid