From d35eedcd87d59e716c6d49bbb6b634ef1a7660c5 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 24 Aug 2024 20:19:50 +0900 Subject: Rename style nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- doc/classchart.doc | 16 +- doc/customstyles.doc | 14 +- doc/dnd.doc | 2 +- doc/editions.doc | 2 +- doc/features.doc | 10 +- doc/html/annotated.html | 20 +- doc/html/appearance.html | 14 +- doc/html/classchart.html | 16 +- doc/html/classes.html | 20 +- doc/html/customstyles.html | 8 +- doc/html/functions.html | 22 +- doc/html/headers.html | 20 +- doc/html/hierarchy.html | 20 +- doc/html/index | 54 +- doc/html/motif-customwidget-example.html | 10 +- doc/html/motif-dialog-example.html | 22 +- doc/html/motif-examples.html | 2 +- doc/html/motif-extension.html | 22 +- doc/html/motif-walkthrough-1.html | 2 +- doc/html/motif-walkthrough-3.html | 10 +- doc/html/motif-walkthrough-4.html | 2 +- doc/html/motif-walkthrough-5.html | 12 +- doc/html/motif-walkthrough-6.html | 4 +- doc/html/motif-walkthrough-7.html | 2 +- doc/html/motif-walkthrough-8.html | 4 +- doc/html/motif-walkthrough-9.html | 4 +- doc/html/ntqapplication.html | 2 +- doc/html/ntqcdestyle.html | 83 - doc/html/ntqcommonstyle.html | 70 - doc/html/ntqmotifplusstyle.html | 71 - doc/html/ntqmotifstyle.html | 93 - doc/html/ntqplatinumstyle.html | 84 - doc/html/ntqsgistyle.html | 77 - doc/html/ntqwindowsstyle.html | 67 - doc/html/progressbar-example.html | 4 +- doc/html/qcdestyle-h.html | 131 -- doc/html/qcdestyle-members.html | 113 - doc/html/qcommonstyle-h.html | 182 -- doc/html/qcommonstyle-members.html | 110 - doc/html/qmacstyle.html | 2 +- doc/html/qmacstyle_mac-h.html | 2 +- doc/html/qmotif-h.html | 112 - doc/html/qmotif-members.html | 108 - doc/html/qmotif.html | 115 - doc/html/qmotifdialog-h.html | 153 -- doc/html/qmotifdialog-members.html | 355 --- doc/html/qmotifdialog.html | 205 -- doc/html/qmotifplusstyle-h.html | 169 -- doc/html/qmotifplusstyle-members.html | 112 - doc/html/qmotifstyle-h.html | 181 -- doc/html/qmotifstyle-members.html | 112 - doc/html/qmotifwidget-h.html | 115 - doc/html/qmotifwidget-members.html | 338 --- doc/html/qmotifwidget.html | 115 - doc/html/qnamespace-h.html | 2 +- doc/html/qplatinumstyle-h.html | 162 -- doc/html/qplatinumstyle-members.html | 112 - doc/html/qsgistyle-h.html | 178 -- doc/html/qsgistyle-members.html | 113 - doc/html/qt.dcf | 126 +- doc/html/qwindowsstyle-h.html | 180 -- doc/html/qwindowsstyle-members.html | 110 - doc/html/themes-example.html | 30 +- doc/html/titleindex | 64 +- doc/html/tqcdestyle-h.html | 131 ++ doc/html/tqcdestyle-members.html | 113 + doc/html/tqcdestyle.html | 83 + doc/html/tqcommonstyle-h.html | 182 ++ doc/html/tqcommonstyle-members.html | 110 + doc/html/tqcommonstyle.html | 70 + doc/html/tqdialog.html | 2 +- doc/html/tqeventloop.html | 2 +- doc/html/tqmotif-h.html | 112 + doc/html/tqmotif-members.html | 108 + doc/html/tqmotif.html | 115 + doc/html/tqmotifdialog-h.html | 153 ++ doc/html/tqmotifdialog-members.html | 355 +++ doc/html/tqmotifdialog.html | 205 ++ doc/html/tqmotifplusstyle-h.html | 169 ++ doc/html/tqmotifplusstyle-members.html | 112 + doc/html/tqmotifplusstyle.html | 71 + doc/html/tqmotifstyle-h.html | 181 ++ doc/html/tqmotifstyle-members.html | 112 + doc/html/tqmotifstyle.html | 93 + doc/html/tqmotifwidget-h.html | 115 + doc/html/tqmotifwidget-members.html | 338 +++ doc/html/tqmotifwidget.html | 115 + doc/html/tqplatinumstyle-h.html | 162 ++ doc/html/tqplatinumstyle-members.html | 112 + doc/html/tqplatinumstyle.html | 84 + doc/html/tqsgistyle-h.html | 178 ++ doc/html/tqsgistyle-members.html | 113 + doc/html/tqsgistyle.html | 77 + doc/html/tqstyle.html | 2 +- doc/html/tqwidget.html | 2 +- doc/html/tqwindowsstyle-h.html | 180 ++ doc/html/tqwindowsstyle-members.html | 110 + doc/html/tqwindowsstyle.html | 67 + doc/html/whatsthis | 20 +- doc/indices.doc | 8 +- doc/man/man3/tqapplication.3qt | 2 +- doc/man/man3/tqcdestyle.3qt | 24 +- doc/man/man3/tqcommonstyle.3qt | 18 +- doc/man/man3/tqdialog.3qt | 2 +- doc/man/man3/tqeventloop.3qt | 2 +- doc/man/man3/tqmacstyle.3qt | 2 +- doc/man/man3/tqmotif.3qt | 36 +- doc/man/man3/tqmotifdialog.3qt | 90 +- doc/man/man3/tqmotifplusstyle.3qt | 18 +- doc/man/man3/tqmotifstyle.3qt | 24 +- doc/man/man3/tqmotifwidget.3qt | 34 +- doc/man/man3/tqplatinumstyle.3qt | 22 +- doc/man/man3/tqsgistyle.3qt | 24 +- doc/man/man3/tqstyle.3qt | 2 +- doc/man/man3/tqtextcodec.3qt | 2 +- doc/man/man3/tqwidget.3qt | 2 +- doc/man/man3/tqwindowsstyle.3qt | 20 +- doc/modules.doc | 2 +- examples/progressbar/progressbar.cpp | 2 +- examples/themes/main.cpp | 2 +- examples/themes/metal.h | 2 +- examples/themes/wood.h | 2 +- include/ntqcdestyle.h | 1 - include/ntqcommonstyle.h | 1 - include/ntqcompactstyle.h | 1 - include/ntqinterlacestyle.h | 1 - include/ntqmotifplusstyle.h | 1 - include/ntqmotifstyle.h | 1 - include/ntqplatinumstyle.h | 1 - include/ntqsgistyle.h | 1 - include/ntqwindowsstyle.h | 1 - include/tqcdestyle.h | 1 + include/tqcommonstyle.h | 1 + include/tqcompactstyle.h | 1 + include/tqinterlacestyle.h | 1 + include/tqmotifplusstyle.h | 1 + include/tqmotifstyle.h | 1 + include/tqplatinumstyle.h | 1 + include/tqsgistyle.h | 1 + include/tqwindowsstyle.h | 1 + plugins/src/styles/cde/cde.pro | 10 +- plugins/src/styles/cde/main.cpp | 2 +- plugins/src/styles/compact/compact.pro | 10 +- plugins/src/styles/compact/main.cpp | 2 +- plugins/src/styles/motif/main.cpp | 2 +- plugins/src/styles/motif/motif.pro | 6 +- plugins/src/styles/motifplus/main.cpp | 2 +- plugins/src/styles/motifplus/motifplus.pro | 10 +- plugins/src/styles/platinum/main.cpp | 2 +- plugins/src/styles/platinum/platinum.pro | 10 +- plugins/src/styles/sgi/main.cpp | 2 +- plugins/src/styles/sgi/sgi.pro | 10 +- plugins/src/styles/windows/main.cpp | 2 +- plugins/src/styles/windows/windows.pro | 6 +- src/kernel/ntqnamespace.h | 2 +- src/kernel/ntqt.h | 20 +- src/kernel/qmotifdnd_x11.cpp | 978 -------- src/kernel/qt_kernel.pri | 2 +- src/kernel/tqcolor_p.h | 2 +- src/kernel/tqmotifdnd_x11.cpp | 978 ++++++++ src/kernel/tqobject.cpp | 2 +- src/styles/ntqcdestyle.h | 90 - src/styles/ntqcommonstyle.h | 164 -- src/styles/ntqcompactstyle.h | 86 - src/styles/ntqinterlacestyle.h | 107 - src/styles/ntqmotifplusstyle.h | 131 -- src/styles/ntqmotifstyle.h | 146 -- src/styles/ntqplatinumstyle.h | 125 - src/styles/ntqsgistyle.h | 144 -- src/styles/ntqwindowsstyle.h | 148 -- src/styles/qcdestyle.cpp | 371 --- src/styles/qcommonstyle.cpp | 3381 ---------------------------- src/styles/qcompactstyle.cpp | 395 ---- src/styles/qinterlacestyle.cpp | 805 ------- src/styles/qmotifplusstyle.cpp | 1629 -------------- src/styles/qmotifstyle.cpp | 2416 -------------------- src/styles/qplatinumstyle.cpp | 1552 ------------- src/styles/qsgistyle.cpp | 1538 ------------- src/styles/qt_styles.pri | 40 +- src/styles/qwindowsstyle.cpp | 2058 ----------------- src/styles/tqcdestyle.cpp | 371 +++ src/styles/tqcdestyle.h | 90 + src/styles/tqcommonstyle.cpp | 3381 ++++++++++++++++++++++++++++ src/styles/tqcommonstyle.h | 164 ++ src/styles/tqcompactstyle.cpp | 395 ++++ src/styles/tqcompactstyle.h | 86 + src/styles/tqinterlacestyle.cpp | 805 +++++++ src/styles/tqinterlacestyle.h | 107 + src/styles/tqmotifplusstyle.cpp | 1629 ++++++++++++++ src/styles/tqmotifplusstyle.h | 131 ++ src/styles/tqmotifstyle.cpp | 2416 ++++++++++++++++++++ src/styles/tqmotifstyle.h | 146 ++ src/styles/tqplatinumstyle.cpp | 1552 +++++++++++++ src/styles/tqplatinumstyle.h | 125 + src/styles/tqsgistyle.cpp | 1538 +++++++++++++ src/styles/tqsgistyle.h | 144 ++ src/styles/tqstylefactory.cpp | 16 +- src/styles/tqwindowsstyle.cpp | 2058 +++++++++++++++++ src/styles/tqwindowsstyle.h | 148 ++ tools/designer/designer/propertyeditor.cpp | 2 +- 200 files changed, 20948 insertions(+), 20948 deletions(-) delete mode 100644 doc/html/ntqcdestyle.html delete mode 100644 doc/html/ntqcommonstyle.html delete mode 100644 doc/html/ntqmotifplusstyle.html delete mode 100644 doc/html/ntqmotifstyle.html delete mode 100644 doc/html/ntqplatinumstyle.html delete mode 100644 doc/html/ntqsgistyle.html delete mode 100644 doc/html/ntqwindowsstyle.html delete mode 100644 doc/html/qcdestyle-h.html delete mode 100644 doc/html/qcdestyle-members.html delete mode 100644 doc/html/qcommonstyle-h.html delete mode 100644 doc/html/qcommonstyle-members.html delete mode 100644 doc/html/qmotif-h.html delete mode 100644 doc/html/qmotif-members.html delete mode 100644 doc/html/qmotif.html delete mode 100644 doc/html/qmotifdialog-h.html delete mode 100644 doc/html/qmotifdialog-members.html delete mode 100644 doc/html/qmotifdialog.html delete mode 100644 doc/html/qmotifplusstyle-h.html delete mode 100644 doc/html/qmotifplusstyle-members.html delete mode 100644 doc/html/qmotifstyle-h.html delete mode 100644 doc/html/qmotifstyle-members.html delete mode 100644 doc/html/qmotifwidget-h.html delete mode 100644 doc/html/qmotifwidget-members.html delete mode 100644 doc/html/qmotifwidget.html delete mode 100644 doc/html/qplatinumstyle-h.html delete mode 100644 doc/html/qplatinumstyle-members.html delete mode 100644 doc/html/qsgistyle-h.html delete mode 100644 doc/html/qsgistyle-members.html delete mode 100644 doc/html/qwindowsstyle-h.html delete mode 100644 doc/html/qwindowsstyle-members.html create mode 100644 doc/html/tqcdestyle-h.html create mode 100644 doc/html/tqcdestyle-members.html create mode 100644 doc/html/tqcdestyle.html create mode 100644 doc/html/tqcommonstyle-h.html create mode 100644 doc/html/tqcommonstyle-members.html create mode 100644 doc/html/tqcommonstyle.html create mode 100644 doc/html/tqmotif-h.html create mode 100644 doc/html/tqmotif-members.html create mode 100644 doc/html/tqmotif.html create mode 100644 doc/html/tqmotifdialog-h.html create mode 100644 doc/html/tqmotifdialog-members.html create mode 100644 doc/html/tqmotifdialog.html create mode 100644 doc/html/tqmotifplusstyle-h.html create mode 100644 doc/html/tqmotifplusstyle-members.html create mode 100644 doc/html/tqmotifplusstyle.html create mode 100644 doc/html/tqmotifstyle-h.html create mode 100644 doc/html/tqmotifstyle-members.html create mode 100644 doc/html/tqmotifstyle.html create mode 100644 doc/html/tqmotifwidget-h.html create mode 100644 doc/html/tqmotifwidget-members.html create mode 100644 doc/html/tqmotifwidget.html create mode 100644 doc/html/tqplatinumstyle-h.html create mode 100644 doc/html/tqplatinumstyle-members.html create mode 100644 doc/html/tqplatinumstyle.html create mode 100644 doc/html/tqsgistyle-h.html create mode 100644 doc/html/tqsgistyle-members.html create mode 100644 doc/html/tqsgistyle.html create mode 100644 doc/html/tqwindowsstyle-h.html create mode 100644 doc/html/tqwindowsstyle-members.html create mode 100644 doc/html/tqwindowsstyle.html delete mode 120000 include/ntqcdestyle.h delete mode 120000 include/ntqcommonstyle.h delete mode 120000 include/ntqcompactstyle.h delete mode 120000 include/ntqinterlacestyle.h delete mode 120000 include/ntqmotifplusstyle.h delete mode 120000 include/ntqmotifstyle.h delete mode 120000 include/ntqplatinumstyle.h delete mode 120000 include/ntqsgistyle.h delete mode 120000 include/ntqwindowsstyle.h create mode 120000 include/tqcdestyle.h create mode 120000 include/tqcommonstyle.h create mode 120000 include/tqcompactstyle.h create mode 120000 include/tqinterlacestyle.h create mode 120000 include/tqmotifplusstyle.h create mode 120000 include/tqmotifstyle.h create mode 120000 include/tqplatinumstyle.h create mode 120000 include/tqsgistyle.h create mode 120000 include/tqwindowsstyle.h delete mode 100644 src/kernel/qmotifdnd_x11.cpp create mode 100644 src/kernel/tqmotifdnd_x11.cpp delete mode 100644 src/styles/ntqcdestyle.h delete mode 100644 src/styles/ntqcommonstyle.h delete mode 100644 src/styles/ntqcompactstyle.h delete mode 100644 src/styles/ntqinterlacestyle.h delete mode 100644 src/styles/ntqmotifplusstyle.h delete mode 100644 src/styles/ntqmotifstyle.h delete mode 100644 src/styles/ntqplatinumstyle.h delete mode 100644 src/styles/ntqsgistyle.h delete mode 100644 src/styles/ntqwindowsstyle.h delete mode 100644 src/styles/qcdestyle.cpp delete mode 100644 src/styles/qcommonstyle.cpp delete mode 100644 src/styles/qcompactstyle.cpp delete mode 100644 src/styles/qinterlacestyle.cpp delete mode 100644 src/styles/qmotifplusstyle.cpp delete mode 100644 src/styles/qmotifstyle.cpp delete mode 100644 src/styles/qplatinumstyle.cpp delete mode 100644 src/styles/qsgistyle.cpp delete mode 100644 src/styles/qwindowsstyle.cpp create mode 100644 src/styles/tqcdestyle.cpp create mode 100644 src/styles/tqcdestyle.h create mode 100644 src/styles/tqcommonstyle.cpp create mode 100644 src/styles/tqcommonstyle.h create mode 100644 src/styles/tqcompactstyle.cpp create mode 100644 src/styles/tqcompactstyle.h create mode 100644 src/styles/tqinterlacestyle.cpp create mode 100644 src/styles/tqinterlacestyle.h create mode 100644 src/styles/tqmotifplusstyle.cpp create mode 100644 src/styles/tqmotifplusstyle.h create mode 100644 src/styles/tqmotifstyle.cpp create mode 100644 src/styles/tqmotifstyle.h create mode 100644 src/styles/tqplatinumstyle.cpp create mode 100644 src/styles/tqplatinumstyle.h create mode 100644 src/styles/tqsgistyle.cpp create mode 100644 src/styles/tqsgistyle.h create mode 100644 src/styles/tqwindowsstyle.cpp create mode 100644 src/styles/tqwindowsstyle.h diff --git a/doc/classchart.doc b/doc/classchart.doc index 888486461..6e6451339 100644 --- a/doc/classchart.doc +++ b/doc/classchart.doc @@ -62,13 +62,13 @@ - - + + - - - - + + + + @@ -92,8 +92,8 @@ - - + + diff --git a/doc/customstyles.doc b/doc/customstyles.doc index 8fceeeca4..fb6e49382 100644 --- a/doc/customstyles.doc +++ b/doc/customstyles.doc @@ -64,11 +64,11 @@ applications. The first step is to pick one of the base styles provided with TQt to build your custom style from. The choice will depend on what look and feel you are trying to achieve. We recommend that you choose from the -QWindowsStyle derived classes or the QMotifStyle derived classes. +TQWindowsStyle derived classes or the TQMotifStyle derived classes. These are the two base look and feel classes in the TQt style engine. -Inheriting directly from QCommonStyle is also an option if you want to +Inheriting directly from TQCommonStyle is also an option if you want to start almost from scratch when implementing your style. In this simple -example we will inherit from QWindowsStyle. +example we will inherit from TQWindowsStyle. \section2 2. Re-implement the necessary functions in your derived class. @@ -77,15 +77,15 @@ must re-implement the functions that are used to draw those parts of the interface. If you take a look at the \l{TQStyle} documentation, you will find a list of the different primitives, controls and complex controls. In this example we will first change the look of the -standard arrows that are used in the QWindowsStyle. The arrows are +standard arrows that are used in the TQWindowsStyle. The arrows are PrimitiveElements that are drawn by the drawPrimitive() function, so we need to re-implement that function. We need the following class declaration: \code -#include +#include -class CustomStyle : public QWindowsStyle { +class CustomStyle : public TQWindowsStyle { TQ_OBJECT public: CustomStyle(); @@ -179,7 +179,7 @@ void CustomStyle::drawPrimitive( PrimitiveElement pe, p->drawPolygon( pa ); } else { // let the base style handle the other primitives - QWindowsStyle::drawPrimitive( pe, p, r, cg, flags, data ); + TQWindowsStyle::drawPrimitive( pe, p, r, cg, flags, data ); } } \endcode diff --git a/doc/dnd.doc b/doc/dnd.doc index a7105e0f7..0b7dae8b1 100644 --- a/doc/dnd.doc +++ b/doc/dnd.doc @@ -380,4 +380,4 @@ provided "as is" without express or implied warranty. Modifications Copyright 1999 Matt Koss, under the same license as above. -*/ // NOTE: That notice is from qmotifdnd_x11.cpp. +*/ // NOTE: That notice is from tqmotifdnd_x11.cpp. diff --git a/doc/editions.doc b/doc/editions.doc index 0ed203a92..61c546d18 100644 --- a/doc/editions.doc +++ b/doc/editions.doc @@ -119,7 +119,7 @@ Editions. X - QMotif extension
+ TQMotif extension
Motif co-existence and migration support.
diff --git a/doc/features.doc b/doc/features.doc index a72abbe92..903ce8a1d 100644 --- a/doc/features.doc +++ b/doc/features.doc @@ -185,21 +185,21 @@ The available options are: \header \i31 GUI Styles \row \i TQT_NO_STYLE_WINDOWS - \i Microsoft Windows style (\l QWindowsStyle) + \i Microsoft Windows style (\l TQWindowsStyle) \i TQT_NO_WIDGETS \row \i TQT_NO_STYLE_MOTIF - \i OSF Motif style (\l QMotifStyle) + \i OSF Motif style (\l TQMotifStyle) \i TQT_NO_WIDGETS \row \i TQT_NO_STYLE_CDE - \i Open Group CDE style (\l QCDEStyle) + \i Open Group CDE style (\l TQCDEStyle) \i TQT_NO_STYLE_MOTIF \row \i TQT_NO_STYLE_AQUA \i MacOS X style (\l QAquaStyle) \row \i TQT_NO_STYLE_PLATINUM - \i MacOS 9 style (\l QPlatinumStyle) + \i MacOS 9 style (\l TQPlatinumStyle) \i TQT_NO_WIDGETS \row \i TQT_NO_STYLE_SGI - \i SGI style (\l QSGIStyle) + \i SGI style (\l TQSGIStyle) \i TQT_NO_STYLE_MOTIF \header \i31 Dialogs diff --git a/doc/html/annotated.html b/doc/html/annotated.html index 5bf99834b..abf9e6945 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -58,7 +58,7 @@ body { background: #ffffff; color: black; } TQButtonThe abstract base class of button widgets, providing functionality common to buttons TQButtonGroupOrganizes TQButton widgets in a group TQByteArrayArray of bytes -TQCDEStyleCDE look and feel +TQCDEStyleCDE look and feel TQCStringAbstraction of the classic C zero-terminated char array (char *) TQCacheTemplate class that provides a cache based on TQString keys TQCacheIteratorIterator for TQCache collections @@ -90,7 +90,7 @@ body { background: #ffffff; color: black; } TQColorGroupGroup of widget colors TQComboBoxCombined button and popup list TQComboTableItemMeans of using comboboxes in TQTables -TQCommonStyleEncapsulates the common Look and Feel of a GUI +TQCommonStyleEncapsulates the common Look and Feel of a GUI TQConstStringString objects using constant Unicode data TQContextMenuEventParameters that describe a context menu event TQCursorMouse cursor with an arbitrary shape @@ -240,11 +240,11 @@ body { background: #ffffff; color: black; } TQMetaPropertyStores meta data about a property TQMimeSourceAbstraction of objects which provide formatted data of a certain MIME type TQMimeSourceFactoryExtensible provider of mime-typed data -TQMotifThe basis of the Motif Extension -TQMotifDialogThe TQDialog API for Motif-based dialogs -TQMotifPlusStyleMore sophisticated Motif-ish look and feel -TQMotifStyleMotif look and feel -TQMotifWidgetThe TQWidget API for Xt/Motif widgets +TQMotifThe basis of the Motif Extension +TQMotifDialogThe TQDialog API for Motif-based dialogs +TQMotifPlusStyleMore sophisticated Motif-ish look and feel +TQMotifStyleMotif look and feel +TQMotifWidgetThe TQWidget API for Xt/Motif widgets TQMouseEventParameters that describe a mouse event TQMoveEventEvent parameters for move events TQMovieIncremental loading of animations or images, signalling as it progresses @@ -271,7 +271,7 @@ body { background: #ffffff; color: black; } TQPicturePaint device that records and replays TQPainter commands TQPixmapOff-screen, pixel-based paint device TQPixmapCacheApplication-global cache for pixmaps -TQPlatinumStyleMac/Platinum look and feel +TQPlatinumStyleMac/Platinum look and feel TQPointDefines a point in the plane TQPointArrayArray of points TQPopupMenuPopup menu widget @@ -295,7 +295,7 @@ body { background: #ffffff; color: black; } TQRegExpValidatorUsed to check a string against a regular expression TQRegionClip region for a painter TQResizeEventEvent parameters for resize events -TQSGIStyleSGI/Irix look and feel +TQSGIStyleSGI/Irix look and feel TQScrollBarVertical or horizontal scroll bar TQScrollViewScrolling area with on-demand scroll bars TQSemaphoreRobust integer semaphore @@ -408,7 +408,7 @@ body { background: #ffffff; color: black; } TQWidgetPluginAbstract base for custom TQWidget plugins TQWidgetStackStack of widgets of which only the top widget is user-visible TQWindowsMimeMaps open-standard MIME to Window Clipboard formats -TQWindowsStyleMicrosoft Windows-like look and feel +TQWindowsStyleMicrosoft Windows-like look and feel TQWizardFramework for wizard dialogs TQWorkspaceWorkspace window that can contain decorated windows, e.g. for MDI TQXmlAttributesXML attributes diff --git a/doc/html/appearance.html b/doc/html/appearance.html index 3e647285e..985be4ad7 100644 --- a/doc/html/appearance.html +++ b/doc/html/appearance.html @@ -38,10 +38,10 @@ style.

TQBoxLayoutLines up child widgets horizontally or vertically
TQButtonGroupOrganizes TQButton widgets in a group -
TQCDEStyleCDE look and feel +
TQCDEStyleCDE look and feel
TQColorColors based on RGB or HSV values
TQColorGroupGroup of widget colors -
TQCommonStyleEncapsulates the common Look and Feel of a GUI +
TQCommonStyleEncapsulates the common Look and Feel of a GUI
TQCursorMouse cursor with an arbitrary shape
TQFontFont used for drawing text
TQGLayoutIteratorAbstract base class of internal layout iterators @@ -56,11 +56,11 @@ style.
TQLayoutItemAbstract item that a TQLayout manipulates
TQLayoutIteratorIterators over TQLayoutItem
TQMacStyleImplements an Appearance Manager style -
TQMotifPlusStyleMore sophisticated Motif-ish look and feel -
TQMotifStyleMotif look and feel +
TQMotifPlusStyleMore sophisticated Motif-ish look and feel +
TQMotifStyleMotif look and feel
TQPaletteColor groups for each widget state -
TQPlatinumStyleMac/Platinum look and feel -
TQSGIStyleSGI/Irix look and feel +
TQPlatinumStyleMac/Platinum look and feel +
TQSGIStyleSGI/Irix look and feel
TQSizeGripCorner-grip for resizing a top-level window
TQSizePolicyLayout attribute describing horizontal and vertical resizing policy
TQSpacerItemBlank space in a layout @@ -71,7 +71,7 @@ style.
TQVButtonGroupOrganizes TQButton widgets in a vertical column
TQVGroupBoxOrganizes a group of widgets in a vertical column
TQWidgetItemLayout item that represents a widget -
TQWindowsStyleMicrosoft Windows-like look and feel +
TQWindowsStyleMicrosoft Windows-like look and feel


diff --git a/doc/html/classchart.html b/doc/html/classchart.html index 97c7531f4..7fee244f9 100644 --- a/doc/html/classchart.html +++ b/doc/html/classchart.html @@ -52,13 +52,13 @@ body { background: #ffffff; color: black; } - - + + - - - - + + + + @@ -82,8 +82,8 @@ body { background: #ffffff; color: black; } - - + + diff --git a/doc/html/classes.html b/doc/html/classes.html index eb3293d3b..b5854f15a 100644 --- a/doc/html/classes.html +++ b/doc/html/classes.html @@ -55,7 +55,7 @@ classes, see TQt's Main Classes. TQIconViewItem -TQPlatinumStyle +TQPlatinumStyle TQTabDialog @@ -407,7 +407,7 @@ classes, see TQt's Main Classes. TQListBoxText -TQSGIStyle +TQSGIStyle TQUrlInfo @@ -566,7 +566,7 @@ classes, see TQt's Main Classes. TQWaitCondition -TQCDEStyle +TQCDEStyle TQFontMetrics @@ -625,7 +625,7 @@ classes, see TQt's Main Classes. TQGbkCodec -TQMotif +TQMotif * TQSqlDatabase @@ -636,7 +636,7 @@ classes, see TQt's Main Classes. -TQMotifDialog +TQMotifDialog * TQSqlDriver @@ -647,7 +647,7 @@ classes, see TQt's Main Classes. -TQMotifPlusStyle +TQMotifPlusStyle TQSqlDriverPlugin @@ -658,18 +658,18 @@ classes, see TQt's Main Classes. TQGL -TQMotifStyle +TQMotifStyle TQSqlEditorFactory -TQWindowsStyle +TQWindowsStyle TQColor TQGLayoutIterator -TQMotifWidget +TQMotifWidget * TQSqlError @@ -730,7 +730,7 @@ classes, see TQt's Main Classes. -TQCommonStyle +TQCommonStyle TQGridLayout diff --git a/doc/html/customstyles.html b/doc/html/customstyles.html index da5f4d49b..9bca441c7 100644 --- a/doc/html/customstyles.html +++ b/doc/html/customstyles.html @@ -54,9 +54,9 @@ applications.

The first step is to pick one of the base styles provided with TQt to build your custom style from. The choice will depend on what look and feel you are trying to achieve. We recommend that you choose from the -TQWindowsStyle derived classes or the TQMotifStyle derived classes. +TQWindowsStyle derived classes or the TQMotifStyle derived classes. These are the two base look and feel classes in the TQt style engine. -Inheriting directly from TQCommonStyle is also an option if you want to +Inheriting directly from TQCommonStyle is also an option if you want to start almost from scratch when implementing your style. In this simple example we will inherit from TQWindowsStyle.

2. Re-implement the necessary functions in your derived class. @@ -71,9 +71,9 @@ PrimitiveElements that are drawn by the drawPrimitive() function, so we need to re-implement that function. We need the following class declaration:

-#include <ntqwindowsstyle.h>
+#include <tqwindowsstyle.h>
 
-class CustomStyle : public TQWindowsStyle {
+class CustomStyle : public TQWindowsStyle {
     TQ_OBJECT
 public:
     CustomStyle();
diff --git a/doc/html/functions.html b/doc/html/functions.html
index 10b8d1e63..891be771c 100644
--- a/doc/html/functions.html
+++ b/doc/html/functions.html
@@ -56,7 +56,7 @@ abort:
  TQAction TQButton TQCheckBox TQMenuData TQPopupMenu TQPushButton TQRadioButton
  • accept: TQCloseEvent TQContextMenuEvent TQDialog TQDragMoveEvent TQDropEvent TQIMEvent TQIconDragEvent TQKeyEvent TQMouseEvent TQSocketDevice TQTabletEvent TQWheelEvent
  • acceptAction: TQDropEvent
  • acceptCallback: - TQMotifDialog
  • acceptDrop: + TQMotifDialog
  • acceptDrop: TQIconViewItem TQListViewItem
  • acceptDrops: TQWidget
  • accum: TQGLFormat
  • action: @@ -155,7 +155,7 @@ abort: TQCString TQIconDrag TQPtrList TQSqlCursor TQSqlIndex TQSqlRecord TQString TQTextEdit TQValueList TQValueVector TQXmlAttributes
  • appendChild: TQDomNode
  • appendData: TQDomCharacterData
  • applicationContext: - TQMotif
  • applicationDirPath: + TQMotif
  • applicationDirPath: TQApplication
  • applicationFilePath: TQApplication
  • applyButtonPressed: TQTabDialog
  • appropriate: @@ -706,7 +706,7 @@ dark: TQDial
  • dialPressed: TQDial
  • dialReleased: TQDial
  • dialog: - TQMotifDialog
  • digitValue: + TQMotifDialog
  • digitValue: TQChar
  • dimensionChange: TQGridView
  • dir: TQFileDialog TQFileInfo
  • dirEntered: @@ -793,7 +793,7 @@ dark: TQPainter
  • drawPrimitive: TQStyle
  • drawRect: TQPainter
  • drawRiffles: - TQPlatinumStyle
  • drawRoundRect: + TQPlatinumStyle
  • drawRoundRect: TQPainter
  • drawRubber: TQIconView
  • drawShape: TQCanvasEllipse TQCanvasPolygon TQCanvasPolygonalItem TQCanvasRectangle
  • drawText: @@ -1664,12 +1664,12 @@ m11: TQImage
  • mirrored: TQChar
  • mirroredChar: TQChar
  • mixedColor: - TQPlatinumStyle
  • mkdir: + TQPlatinumStyle
  • mkdir: TQDir TQFtp TQUrlOperator
  • mode: TQFileDialog TQIODevice TQLCDNumber TQNPInstance TQSqlCursor
  • modificationChanged: TQTextEdit
  • month: TQDate
  • motifWidget: - TQMotifWidget
  • mouseButtonClicked: + TQMotifWidget
  • mouseButtonClicked: TQIconView TQListBox TQListView
  • mouseButtonPressed: TQIconView TQListBox TQListView
  • mouseDoubleClickEvent: TQWidget
  • mouseGrabber: @@ -2110,7 +2110,7 @@ rBottom: TQSqlDatabase
  • rehighlight: TQSyntaxHighlighter
  • reject: TQDialog
  • rejectCallback: - TQMotifDialog
  • release: + TQMotifDialog
  • release: TQSessionManager
  • releaseKeyboard: TQWidget
  • releaseMouse: TQWidget
  • released: @@ -2967,7 +2967,7 @@ sRect: TQWidget
  • setUris: TQUriDrag
  • setUrl: TQFileDialog TQNetworkProtocol
  • setUseHighlightColors: - TQMotifStyle
  • setUser: + TQMotifStyle
  • setUser: TQUrl
  • setUserName: TQSqlDatabase
  • setUsesBigPixmap: TQToolButton
  • setUsesBigPixmaps: @@ -3027,7 +3027,7 @@ sRect: TQColorGroup
  • shape: TQCursor TQTabBar
  • shear: TQPainter TQWMatrix
  • shell: - TQMotifDialog
  • shortDayName: + TQMotifDialog
  • shortDayName: TQDate
  • shortMonthName: TQDate
  • shortcutKey: TQAccel
  • show: @@ -3396,7 +3396,7 @@ ucs2: TQUriDrag
  • uriToUnicodeUri: TQUriDrag
  • url: TQFileDialog TQNPStream TQNetworkProtocol
  • useHighlightColors: - TQMotifStyle
  • user: + TQMotifStyle
  • user: TQUrl
  • userAgent: TQNPInstance
  • userName: TQSqlDatabase
  • uses3D: @@ -3518,7 +3518,7 @@ x: TQPaintDevice
  • x11DefaultVisual: TQPaintDevice
  • x11Depth: TQPaintDevice
  • x11Display: - TQMotif TQPaintDevice
  • x11Event: + TQMotif TQPaintDevice
  • x11Event: TQMotifWidget TQWidget TQXtWidget
  • x11EventFilter: TQApplication
  • x11ProcessEvent: TQApplication
  • x11Screen: diff --git a/doc/html/headers.html b/doc/html/headers.html index b00023e89..c64251c6a 100644 --- a/doc/html/headers.html +++ b/doc/html/headers.html @@ -53,13 +53,13 @@ body { background: #ffffff; color: black; }
  • tqbuttongroup.h
  • tqcache.h
  • tqcanvas.h -
  • ntqcdestyle.h +
  • tqcdestyle.h
  • tqcheckbox.h
  • tqclipboard.h
  • tqcolor.h
  • tqcolordialog.h
  • tqcombobox.h -
  • ntqcommonstyle.h +
  • tqcommonstyle.h
  • tqcstring.h
  • ntqcursor.h
  • tqdatabrowser.h @@ -140,11 +140,11 @@ body { background: #ffffff; color: black; }
  • ntqmessagebox.h
  • ntqmetaobject.h
  • tqmime.h -
  • qmotif.h -
  • qmotifdialog.h -
  • ntqmotifplusstyle.h -
  • ntqmotifstyle.h -
  • qmotifwidget.h +
  • tqmotif.h +
  • tqmotifdialog.h +
  • tqmotifplusstyle.h +
  • tqmotifstyle.h +
  • tqmotifwidget.h
  • tqmovie.h
  • tqmultilineedit.h
  • tqmutex.h @@ -163,7 +163,7 @@ body { background: #ffffff; color: black; }
  • tqpicture.h
  • tqpixmap.h
  • tqpixmapcache.h -
  • ntqplatinumstyle.h +
  • tqplatinumstyle.h
  • tqpngio.h
  • tqpoint.h
  • tqpointarray.h @@ -191,7 +191,7 @@ body { background: #ffffff; color: black; }
  • tqserversocket.h
  • tqsessionmanager.h
  • tqsettings.h -
  • ntqsgistyle.h +
  • tqsgistyle.h
  • tqsignal.h
  • tqsignalmapper.h
  • tqsimplerichtext.h @@ -269,7 +269,7 @@ body { background: #ffffff; color: black; }
  • tqwidgetplugin.h
  • tqwidgetstack.h
  • ntqwindowdefs.h -
  • ntqwindowsstyle.h +
  • tqwindowsstyle.h
  • tqwizard.h
  • tqwmatrix.h
  • tqworkspace.h diff --git a/doc/html/hierarchy.html b/doc/html/hierarchy.html index cb948aacf..1743966bb 100644 --- a/doc/html/hierarchy.html +++ b/doc/html/hierarchy.html @@ -325,7 +325,7 @@ classes in the TQt API.
  • TQEventLoop
  • TQFileIconProvider
  • TQLayout @@ -359,18 +359,18 @@ classes in the TQt API.
  • TQSqlForm
  • TQStyle @@ -413,7 +413,7 @@ classes in the TQt API.
  • TQFontDialog
  • TQInputDialog
  • TQMessageBox -
  • TQMotifDialog +
  • TQMotifDialog
  • TQProgressDialog
  • TQTabDialog
  • TQWizard @@ -471,7 +471,7 @@ classes in the TQt API.
  • TQGLWidget
  • TQHeader
  • TQMainWindow -
  • TQMotifWidget +
  • TQMotifWidget
  • TQNPWidget
  • TQScrollBar
  • TQSizeGrip diff --git a/doc/html/index b/doc/html/index index c228bece8..7904d6053 100644 --- a/doc/html/index +++ b/doc/html/index @@ -530,8 +530,8 @@ "TQButtonGroup::setExclusive" tqbuttongroup.html#setExclusive "TQButtonGroup::setRadioButtonExclusive" tqbuttongroup.html#setRadioButtonExclusive "TQByteArray" tqbytearray.html -"QCDEStyle" ntqcdestyle.html -"QCDEStyle::~QCDEStyle" ntqcdestyle.html#~QCDEStyle +"TQCDEStyle" tqcdestyle.html +"TQCDEStyle::~TQCDEStyle" tqcdestyle.html#~TQCDEStyle "TQCString" tqcstring.html "TQCString::append" tqcstring.html#append "TQCString::contains" tqcstring.html#contains @@ -1020,7 +1020,7 @@ "TQComboTableItem::setStringList" tqcombotableitem.html#setStringList "TQComboTableItem::text" tqcombotableitem.html#text "TQComboTableItem::~TQComboTableItem" tqcombotableitem.html#~TQComboTableItem -"QCommonStyle" ntqcommonstyle.html +"TQCommonStyle" tqcommonstyle.html "QComponentFactory::createInstance" qcomponentfactory.html#createInstance "QComponentFactory::registerComponent" qcomponentfactory.html#registerComponent "QComponentFactory::registerServer" qcomponentfactory.html#registerServer @@ -4041,23 +4041,23 @@ "TQMimeSourceFactory::setText" tqmimesourcefactory.html#setText "TQMimeSourceFactory::takeDefaultFactory" tqmimesourcefactory.html#takeDefaultFactory "TQMimeSourceFactory::~TQMimeSourceFactory" tqmimesourcefactory.html#~TQMimeSourceFactory -"QMotif" qmotif.html -"QMotif::applicationContext" qmotif.html#applicationContext -"QMotif::x11Display" qmotif.html#x11Display -"QMotif::~QMotif" qmotif.html#~QMotif -"QMotifDialog" qmotifdialog.html -"QMotifDialog::acceptCallback" qmotifdialog.html#acceptCallback -"QMotifDialog::dialog" qmotifdialog.html#dialog -"QMotifDialog::rejectCallback" qmotifdialog.html#rejectCallback -"QMotifDialog::shell" qmotifdialog.html#shell -"QMotifDialog::~QMotifDialog" qmotifdialog.html#~QMotifDialog -"QMotifPlusStyle" ntqmotifplusstyle.html -"QMotifStyle" ntqmotifstyle.html -"QMotifStyle::setUseHighlightColors" ntqmotifstyle.html#setUseHighlightColors -"QMotifStyle::useHighlightColors" ntqmotifstyle.html#useHighlightColors -"QMotifWidget" qmotifwidget.html -"QMotifWidget::motifWidget" qmotifwidget.html#motifWidget -"QMotifWidget::~QMotifWidget" qmotifwidget.html#~QMotifWidget +"TQMotif" tqmotif.html +"TQMotif::applicationContext" tqmotif.html#applicationContext +"TQMotif::x11Display" tqmotif.html#x11Display +"TQMotif::~TQMotif" tqmotif.html#~TQMotif +"TQMotifDialog" tqmotifdialog.html +"TQMotifDialog::acceptCallback" tqmotifdialog.html#acceptCallback +"TQMotifDialog::dialog" tqmotifdialog.html#dialog +"TQMotifDialog::rejectCallback" tqmotifdialog.html#rejectCallback +"TQMotifDialog::shell" tqmotifdialog.html#shell +"TQMotifDialog::~TQMotifDialog" tqmotifdialog.html#~TQMotifDialog +"TQMotifPlusStyle" tqmotifplusstyle.html +"TQMotifStyle" tqmotifstyle.html +"TQMotifStyle::setUseHighlightColors" tqmotifstyle.html#setUseHighlightColors +"TQMotifStyle::useHighlightColors" tqmotifstyle.html#useHighlightColors +"TQMotifWidget" tqmotifwidget.html +"TQMotifWidget::motifWidget" tqmotifwidget.html#motifWidget +"TQMotifWidget::~TQMotifWidget" tqmotifwidget.html#~TQMotifWidget "QMouseEvent" qmouseevent.html "QMouseEvent::accept" qmouseevent.html#accept "QMouseEvent::button" qmouseevent.html#button @@ -4538,9 +4538,9 @@ "TQPixmapCache::insert" tqpixmapcache.html#insert "TQPixmapCache::remove" tqpixmapcache.html#remove "TQPixmapCache::setCacheLimit" tqpixmapcache.html#setCacheLimit -"QPlatinumStyle" ntqplatinumstyle.html -"QPlatinumStyle::drawRiffles" ntqplatinumstyle.html#drawRiffles -"QPlatinumStyle::mixedColor" ntqplatinumstyle.html#mixedColor +"TQPlatinumStyle" tqplatinumstyle.html +"TQPlatinumStyle::drawRiffles" tqplatinumstyle.html#drawRiffles +"TQPlatinumStyle::mixedColor" tqplatinumstyle.html#mixedColor "QPluginManager::queryInterface" qpluginmanager.html#queryInterface "TQPoint" tqpoint.html "TQPoint::isNull" tqpoint.html#isNull @@ -5061,8 +5061,8 @@ "QResizeEvent" qresizeevent.html "QResizeEvent::oldSize" qresizeevent.html#oldSize "QResizeEvent::size" qresizeevent.html#size -"QSGIStyle" ntqsgistyle.html -"QSGIStyle::~QSGIStyle" ntqsgistyle.html#~QSGIStyle +"TQSGIStyle" tqsgistyle.html +"TQSGIStyle::~TQSGIStyle" tqsgistyle.html#~TQSGIStyle "TQScrollBar" tqscrollbar.html "TQScrollBar::doAutoRepeat" tqscrollbar.html#doAutoRepeat "TQScrollBar::draggingSlider" tqscrollbar.html#draggingSlider @@ -7613,7 +7613,7 @@ "TQWindowsMime::initialize" tqwindowsmime.html#initialize "TQWindowsMime::mimeFor" tqwindowsmime.html#mimeFor "TQWindowsMime::~TQWindowsMime" tqwindowsmime.html#~TQWindowsMime -"QWindowsStyle" ntqwindowsstyle.html +"TQWindowsStyle" tqwindowsstyle.html "TQWizard" tqwizard.html "TQWizard::addPage" tqwizard.html#addPage "TQWizard::appropriate" tqwizard.html#appropriate @@ -7894,7 +7894,7 @@ "Tutorial #2" tutorial2.html "User Interface Compiler (uic)" uic.html "Using Custom TQDialogs" motif-walkthrough-4.html -"Using Existing Dialogs with QMotifDialog" motif-walkthrough-5.html +"Using Existing Dialogs with TQMotifDialog" motif-walkthrough-5.html "Using TQt Main Window Classes" motif-walkthrough-6.html "Using TQt Standard Dialogs" motif-walkthrough-3.html "Using menus" menu-example.html diff --git a/doc/html/motif-customwidget-example.html b/doc/html/motif-customwidget-example.html index 858741b36..613b03302 100644 --- a/doc/html/motif-customwidget-example.html +++ b/doc/html/motif-customwidget-example.html @@ -50,7 +50,7 @@ public: MainWindow(); private: - TQMotifWidget *customwidget; + TQMotifWidget *customwidget; }; #endif // MAINWINDOW_H @@ -61,14 +61,14 @@ private:

    #include "mainwindow.h"
     
     #include <ntqapplication.h>
    -#include <qmotif.h>
    +#include <tqmotif.h>
     
     
     int main( int argc, char **argv )
     {
         XtSetLanguageProc( NULL, NULL, NULL );
     
    -    TQMotif integrator( "customwidget" );
    +    TQMotif integrator( "customwidget" );
         TQApplication app( argc, argv );
     
         MainWindow mainwindow;
    @@ -86,7 +86,7 @@ int main( int argc, char **argv )
     #include <tqpopupmenu.h>
     #include <tqstatusbar.h>
     
    -#include <qmotifwidget.h>
    +#include <tqmotifwidget.h>
     
     #include <Xm/Form.h>
     #include <Xm/PushB.h>
    @@ -103,7 +103,7 @@ int main( int argc, char **argv )
         statusBar()->message( tr("This is a TQMainWindow with an XmText widget.") );
     
         customwidget =
    -        new TQMotifWidget( this, xmFormWidgetClass, NULL, 0, "form" );
    +        new TQMotifWidget( this, xmFormWidgetClass, NULL, 0, "form" );
     
         XmString str;
         Arg args[6];
    diff --git a/doc/html/motif-dialog-example.html b/doc/html/motif-dialog-example.html
    index 8a72d6847..470b1a0da 100644
    --- a/doc/html/motif-dialog-example.html
    +++ b/doc/html/motif-dialog-example.html
    @@ -39,10 +39,10 @@ body { background: #ffffff; color: black; }
     

    #ifndef MAINWINDOW_H
     #define MAINWINDOW_H
     
    -#include <qmotifwidget.h>
    +#include <tqmotifwidget.h>
     
     
    -class MainWindow : public TQMotifWidget
    +class MainWindow : public TQMotifWidget
     {
     public:
         MainWindow();
    @@ -57,7 +57,7 @@ public:
     


    Implementation:

    #include <ntqapplication.h>
    -#include <qmotif.h>
    +#include <tqmotif.h>
     
     #include "mainwindow.h"
     
    @@ -66,7 +66,7 @@ int main( int argc, char **argv )
     {
         XtSetLanguageProc( NULL, NULL, NULL );
     
    -    TQMotif integrator( "dialog" );
    +    TQMotif integrator( "dialog" );
         TQApplication app( argc, argv );
     
         MainWindow *mainwindow = new MainWindow;
    @@ -114,9 +114,9 @@ static void quitCallback( Widget, XtPointer client_data, XtPointer )
     
     
     MainWindow::MainWindow()
    -    : TQMotifWidget( 0, xmMainWindowWidgetClass, NULL, 0, "mainwindow" )
    +    : TQMotifWidget( 0, xmMainWindowWidgetClass, NULL, 0, "mainwindow" )
     {
    -    Widget menubar = XmCreateMenuBar( motifWidget(), "menubar", NULL, 0 );
    +    Widget menubar = XmCreateMenuBar( motifWidget(), "menubar", NULL, 0 );
         Widget filemenu = XmCreatePulldownMenu( menubar, "filemenu", NULL, 0 );
         Widget item;
     
    @@ -154,14 +154,14 @@ static void quitCallback( Widget, XtPointer client_data, XtPointer )
         Arg args[2];
         XtSetArg( args[0], XmNeditMode, XmMULTI_LINE_EDIT );
         Widget texteditor =
    -        XmCreateScrolledText( motifWidget(), "texteditor",
    +        XmCreateScrolledText( motifWidget(), "texteditor",
                                   args, 1 );
     
         XtManageChild( menubar );
         XtManageChild( texteditor );
     
         // pick a nice default size
    -    XtVaSetValues( motifWidget(),
    +    XtVaSetValues( motifWidget(),
                        XmNwidth, 400,
                        XmNheight, 300,
                        NULL );
    @@ -172,10 +172,10 @@ static void quitCallback( Widget, XtPointer client_data, XtPointer )
     
     void MainWindow::showMotifDialog()
     {
    -    TQMotifDialog dialog( this, "custom dialog", TRUE );
    +    TQMotifDialog dialog( this, "custom dialog", TRUE );
         dialog.setCaption( tr("Custom Motif Dialog") );
     
    -    Widget form = XmCreateForm( dialog.shell(), "custom motif dialog", NULL, 0 );
    +    Widget form = XmCreateForm( dialog.shell(), "custom motif dialog", NULL, 0 );
     
         XmString str;
         Arg args[9];
    @@ -220,7 +220,7 @@ void MainWindow::showMotifDialog()
     void MainWindow::showTQtDialog()
     {
         // custom TQt-based dialog using a Motif-based parent
    -    CustomDialog customdialog( motifWidget(), "custom dialog", TRUE );
    +    CustomDialog customdialog( motifWidget(), "custom dialog", TRUE );
         customdialog.exec();
     }
     
    diff --git a/doc/html/motif-examples.html b/doc/html/motif-examples.html index 4304eb4be..9ce8ed6bb 100644 --- a/doc/html/motif-examples.html +++ b/doc/html/motif-examples.html @@ -32,7 +32,7 @@ body { background: #ffffff; color: black; }

    TQMotif Support Extension

    -

    The following example programs illustrate the use of the TQMotif Extension +

    The following example programs illustrate the use of the TQMotif Extension assisting in the migration process of old Xt and Motif based code to the more comfortable TQt toolkit.

    For more information see the TQMotif diff --git a/doc/html/motif-extension.html b/doc/html/motif-extension.html index 5d7e1bf9d..86e53c7d1 100644 --- a/doc/html/motif-extension.html +++ b/doc/html/motif-extension.html @@ -44,9 +44,9 @@ replaces the older Xt/Motif Support Extension included with earlier versions of TQt.

    The TQt Motif Extension consists of the following classes:

      -
    • TQMotif - Provides the basis of the TQt Motif Extension. -
    • TQMotifWidget - Provides the TQWidget API for Motif widgets. -
    • TQMotifDialog - Provides the TQDialog API for Motif dialogs. +
    • TQMotif - Provides the basis of the TQt Motif Extension. +
    • TQMotifWidget - Provides the TQWidget API for Motif widgets. +
    • TQMotifDialog - Provides the TQDialog API for Motif dialogs.
    • TQXtWidget - The Xt/Motif integration widget from the previous Xt/Motif extension. This class is unsupported and has many known problems and limitations. It is provided only to keep existing source @@ -63,7 +63,7 @@ complete migration of a Motif based program to the TQt toolkit.
  • Incorrect CDE Color Scheme

    -

    TQMotifWidget and TQMotifDialog will use the same Visual, Colormap +

    TQMotifWidget and TQMotifDialog will use the same Visual, Colormap and color depth that TQApplication uses. When using CDE, the color scheme may be incorrect when using a Visual, Colormap and color depth that is not the default. To work around this problem, add the @@ -87,9 +87,9 @@ For example: ... // TQMotif* headers next - #include <qmotif.h> - #include <qmotifdialog.h> - #include <qmotifwidget.h> + #include <tqmotif.h> + #include <tqmotifdialog.h> + #include <tqmotifwidget.h> // Xt/Motif and X11 headers last #include <X11/Xlib.h> @@ -100,19 +100,19 @@ For example:

    Multiple Screen Support

    -

    TQMotifWidget can be used together with TQDesktopWidget to create +

    TQMotifWidget can be used together with TQDesktopWidget to create top-level windows on multiple screens. A common mistake is to create a TQMotifWidget on a non-default screen while the Xt/Motif widgets are created on the default screen. The solution is to specify the screen to both TQMotifWidget and the Xt/Motif child. For example:

    -    Display *dpy = TQMotif::x11Display();
    +    Display *dpy = TQMotif::x11Display();
         Arg args[1];
     
         // make sure both TQMotifWidget and the XmMainWindow are on screen 1
         XtSetArg(args[0], XtNscreen, ScreenOfDisplay(dpy, 1));
    -    TQMotifWidget *toplevel =
    -        new TQMotifWidget(TQApplication::desktop()->screen(1),
    +    TQMotifWidget *toplevel =
    +        new TQMotifWidget(TQApplication::desktop()->screen(1),
                              xmMainWindowWidgetClass, args, 1, "mainwindow");
     
    diff --git a/doc/html/motif-walkthrough-1.html b/doc/html/motif-walkthrough-1.html index 59bf202aa..5f7a2fa17 100644 --- a/doc/html/motif-walkthrough-1.html +++ b/doc/html/motif-walkthrough-1.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } [ Home ] [ Next: Preparing to Migrate the User Interface ] -

    Starting with TQMotif and TQApplication +

    Starting with TQMotif and TQApplication

    To be able to use TQt, we need to create a TQApplication object. The TQApplication class controls all the event delivery and display diff --git a/doc/html/motif-walkthrough-3.html b/doc/html/motif-walkthrough-3.html index 2ad589fc4..d579c8618 100644 --- a/doc/html/motif-walkthrough-3.html +++ b/doc/html/motif-walkthrough-3.html @@ -48,7 +48,7 @@ provide useful static convenience functions.

    Each of these functions takes a TQWidget *parent argument. If we pass zero as the parent argument, then we will have dialogs that are centered on the screen, instead of being centered over our main -window. We can have TQMotifWidget create our XmMainWindow, and we +window. We can have TQMotifWidget create our XmMainWindow, and we can then use this class as the parent for both Motif dialogs and TQt dialogs.

    We need to include the appropriate headers for TQMotifWidget and @@ -57,9 +57,9 @@ dialogs.

    
     

    Next, we make a few modifications to how the application is -initialized. We could initialize Xt/Motif and create the XtAppContext ourselves, but TQMotif can do this for us. +initialized. We could initialize Xt/Motif and create the XtAppContext ourselves, but TQMotif can do this for us. We also let TQApplication open the connection to the X server. Next, -we create a TQMotifWidget, passing xmMainWindowWidgetClass as the widgetclass argument. We can now use the TQMotifWidget::motifWidget() +we create a TQMotifWidget, passing xmMainWindowWidgetClass as the widgetclass argument. We can now use the TQMotifWidget::motifWidget() function to access the Motif widget. The shell widget is created automatically by TQMotifWidget. We use XtParent() to access it. The top-level window is now a TQMotifWidget, which means we can use it @@ -79,7 +79,7 @@ and Save() functions.

    
     

    We also change the arguments to the callbacks. We pass the top-level -TQMotifWidget as the client_data to these functions, since we will +TQMotifWidget as the client_data to these functions, since we will be using it as the parent for the TQFileDialog.

    
     

    @@ -123,7 +123,7 @@ the correct symbols for these functions.
     

    At this point in the code, the page should be deleted. The code to do this is in the DoDeletePage() function. We move the contents of DoDeletePage() to this point and remove the DoDeletePage() function completely. -

    Next, we change todo.cpp to pass the top-level TQMotifWidget as the +

    Next, we change todo.cpp to pass the top-level TQMotifWidget as the client_data tot he DeletePage() function.

    diff --git a/doc/html/motif-walkthrough-4.html b/doc/html/motif-walkthrough-4.html index 90099c4c0..f58108711 100644 --- a/doc/html/motif-walkthrough-4.html +++ b/doc/html/motif-walkthrough-4.html @@ -56,7 +56,7 @@ to the .pro file, and regenerate the Makefile. The uicuic is invoked automatically from makefiles generated from .pro files.) -

    We need to pass the top-level TQMotifWidget as the client_data +

    We need to pass the top-level TQMotifWidget as the client_data argument to the EditPage function, which we will use as the parent for our new PageEditDialog. We do this the same way as we have done for the Open and Save As dialogs in todo.cpp. diff --git a/doc/html/motif-walkthrough-5.html b/doc/html/motif-walkthrough-5.html index d6ad1178e..31b1aebf9 100644 --- a/doc/html/motif-walkthrough-5.html +++ b/doc/html/motif-walkthrough-5.html @@ -41,7 +41,7 @@ have converted the View widget. The Print dialog will be removed once we have finished our migration, since we will use TQPrinter instead. Based on this information, we decide that it is not worth replacing the Print dialog with a custom TQDialog replacement. -Instead, we will keep the Motif based dialog and use TQMotifDialog to +Instead, we will keep the Motif based dialog and use TQMotifDialog to integrate the dialog with the application.

    Modality Requirements

    @@ -74,7 +74,7 @@ function:

    
     

    Integrating the Print Dialog

    -

    Now that the Print dialog has the appropriate accept and reject callbacks, we can use TQMotifDialog. First we need to include +

    Now that the Print dialog has the appropriate accept and reject callbacks, we can use TQMotifDialog. First we need to include the TQMotifDialog header in todo.cpp.

    @@ -82,19 +82,19 @@ the TQMotifDialog header in todo.cpp.

    We add a ShowPrintDialog() function which will create and execute the print dialog.

    
    -

    We change the Print menu item callback to call the new ShowPrintDialog() function. We pass the top-level TQMotifWidget, which +

    We change the Print menu item callback to call the new ShowPrintDialog() function. We pass the top-level TQMotifWidget, which we will use as the parent for the dialog.

    
     

    The ShowPrintDialog() function creates the Print dialog and executes it. We use the XmdNprintCallback callback to accept the dialog and the XmNcancelCallback callback to reject the dialog. We -can do this easily by using the TQMotifDialog::acceptCallback() and -TQMotifDialog::rejectCallback() functions, respectively. We also +can do this easily by using the TQMotifDialog::acceptCallback() and +TQMotifDialog::rejectCallback() functions, respectively. We also ensure that the print callback continues to call the Print() function as before.

    
     

    After we build the project, the application runs and operates as expected. There is no visual or behavioral difference, even though -the Print dialog is using TQMotifDialog. +the Print dialog is using TQMotifDialog.

    [ Previous: Using Custom TQDialogs ] [ Home ] [ Next: Using TQt Main Window Classes ] diff --git a/doc/html/motif-walkthrough-6.html b/doc/html/motif-walkthrough-6.html index 3de6da150..ba890fa91 100644 --- a/doc/html/motif-walkthrough-6.html +++ b/doc/html/motif-walkthrough-6.html @@ -53,7 +53,7 @@ is then compiled and linked into our application. add the implementation for our Main Window to this skeleton implementation.

    We begin by adding the necessary includes for TQApplication -and TQMotifWidget. +and TQMotifWidget.

    
    @@ -103,7 +103,7 @@ needed.
     

    The QuitAppl() and manageCB() callbacks are not needed any more, so we remove them. We do not need the global shell variable either. We remove it and all references to it in the New(), Save() and Open() callbacks. -

    In main(), we make the large changes. First, we use our new MainWindow instead of TQMotifWidget with XmMainWindow. +

    In main(), we make the large changes. First, we use our new MainWindow instead of TQMotifWidget with XmMainWindow.

    
    diff --git a/doc/html/motif-walkthrough-7.html b/doc/html/motif-walkthrough-7.html
    index 0aa2840ea..7a3912fed 100644
    --- a/doc/html/motif-walkthrough-7.html
    +++ b/doc/html/motif-walkthrough-7.html
    @@ -176,7 +176,7 @@ provides the TQMIN() and TQMAX() macros which we will use.
     

    Earlier modifications caused the fallback_resources array to become redundant, so we remove it.

    In the near future, our program will not use Motif any more, and we -will no longer need to use TQMotif. To prepare for this, we remove the +will no longer need to use TQMotif. To prepare for this, we remove the resources and optionDesc arrays and create the TQMotif instance with just the APP_CLASS argument.

    The #include statements in the source files are mostly incorrect diff --git a/doc/html/motif-walkthrough-8.html b/doc/html/motif-walkthrough-8.html index fbfa2eb89..82e95a073 100644 --- a/doc/html/motif-walkthrough-8.html +++ b/doc/html/motif-walkthrough-8.html @@ -182,14 +182,14 @@ it from our project file and regenerate our Makefile.

    Now that we have implemented our new View widget, we need to remove the old Motif based view widget from todo.cpp. -

    Since we will not be using any Motif widgets, we remove all Motif #include statements, including qmotifwidget.h. +

    Since we will not be using any Motif widgets, we remove all Motif #include statements, including tqmotifwidget.h.

    
     

    We also remove the forward declarations of the ReadDB() function and the notebook, textw and labelw global variables.

    
    -

    Next, we remove the center widget, which uses TQMotifWidget. The Main Window widget and View widget are contained entirely in our +

    Next, we remove the center widget, which uses TQMotifWidget. The Main Window widget and View widget are contained entirely in our MainWindow class, so no extra initialization is needed after creating the mainwindow widget.

    
    diff --git a/doc/html/motif-walkthrough-9.html b/doc/html/motif-walkthrough-9.html
    index b9a912013..8d21cd1c4 100644
    --- a/doc/html/motif-walkthrough-9.html
    +++ b/doc/html/motif-walkthrough-9.html
    @@ -81,8 +81,8 @@ finish removing the dependencies on Xt and Motif.
     keywords from the Xt library.  C++ has these built into the language,
     so we use bool and false instead.
     

    The last modification needed to completely remove Xt and Motif from -our application is to stop using the TQMotif class. We remove the -qmotif.h #include statement from todo.cpp, and remove the +our application is to stop using the TQMotif class. We remove the +tqmotif.h #include statement from todo.cpp, and remove the instantiation from the main() function.

    After doing this, we can remove the -lXm and -lqmotif from the LIBS variable in our project file. Our project file also contains diff --git a/doc/html/ntqapplication.html b/doc/html/ntqapplication.html index c82746efa..51edb764d 100644 --- a/doc/html/ntqapplication.html +++ b/doc/html/ntqapplication.html @@ -1501,7 +1501,7 @@ object is transferred to TQApplication, so TQApplication will delete the style object on application exit or when a new style is set.

    Example usage:

    -    TQApplication::setStyle( new TQWindowsStyle );
    +    TQApplication::setStyle( new TQWindowsStyle );
       

    When switching application styles, the color palette is set back to diff --git a/doc/html/ntqcdestyle.html b/doc/html/ntqcdestyle.html deleted file mode 100644 index 9a4f50fbe..000000000 --- a/doc/html/ntqcdestyle.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - -TQCDEStyle Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQCDEStyle Class Reference

    - -

    The TQCDEStyle class provides a CDE look and feel. -More... -

    #include <ntqcdestyle.h> -

    Inherits TQMotifStyle. -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - -The TQCDEStyle class provides a CDE look and feel. -

    -

    This style provides a slightly improved Motif look similar to some -versions of the Common Desktop Environment (CDE). The main -differences are thinner frames and more modern radio buttons and -checkboxes. Together with a dark background and a bright -text/foreground color, the style looks quite attractive (at least -for Motif fans). -

    Note that the functions provided by TQCDEStyle are -reimplementations of TQStyle functions; see TQStyle for their -documentation. -

    See also Widget Appearance and Style. - -


    Member Function Documentation

    -

    TQCDEStyle::TQCDEStyle ( bool useHighlightCols = FALSE ) -

    -Constructs a TQCDEStyle. -

    If useHighlightCols is FALSE (the default), then the style will -polish the application's color palette to emulate the Motif way of -highlighting, which is a simple inversion between the base and the -text color. - -

    TQCDEStyle::~TQCDEStyle () [virtual] -

    -Destroys the style. - - -

    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqcommonstyle.html b/doc/html/ntqcommonstyle.html deleted file mode 100644 index 35445ecb2..000000000 --- a/doc/html/ntqcommonstyle.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - -TQCommonStyle Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQCommonStyle Class Reference

    - -

    The TQCommonStyle class encapsulates the common Look and Feel of a GUI. -More... -

    #include <ntqcommonstyle.h> -

    Inherits TQStyle. -

    Inherited by TQMotifStyle and TQWindowsStyle. -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - -The TQCommonStyle class encapsulates the common Look and Feel of a GUI. -

    -

    This abstract class implements some of the widget's look and feel -that is common to all GUI styles provided and shipped as part of -TQt. -

    All the functions are documented in TQStyle. -

    See also Widget Appearance and Style. - -


    Member Function Documentation

    -

    TQCommonStyle::TQCommonStyle () -

    -Constructs a TQCommonStyle. - - -

    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqmotifplusstyle.html b/doc/html/ntqmotifplusstyle.html deleted file mode 100644 index 437bf1bd8..000000000 --- a/doc/html/ntqmotifplusstyle.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - -TQMotifPlusStyle Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQMotifPlusStyle Class Reference

    - -

    The TQMotifPlusStyle class provides a more sophisticated Motif-ish look and feel. -More... -

    #include <ntqmotifplusstyle.h> -

    Inherits TQMotifStyle. -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - -The TQMotifPlusStyle class provides a more sophisticated Motif-ish look and feel. -

    -

    This class implements a Motif-ish look and feel with the more -sophisticated bevelling as used by the GIMP Toolkit (GTK+) for -Unix/X11. -

    See also Widget Appearance and Style. - -


    Member Function Documentation

    -

    TQMotifPlusStyle::TQMotifPlusStyle ( bool hoveringHighlight = TRUE ) -

    -Constructs a TQMotifPlusStyle -

    If hoveringHighlight is TRUE (the default), then the style will -not highlight push buttons, checkboxes, radiobuttons, comboboxes, -scrollbars or sliders. - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqmotifstyle.html b/doc/html/ntqmotifstyle.html deleted file mode 100644 index 85858c784..000000000 --- a/doc/html/ntqmotifstyle.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - -TQMotifStyle Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQMotifStyle Class Reference

    - -

    The TQMotifStyle class provides Motif look and feel. -More... -

    #include <ntqmotifstyle.h> -

    Inherits TQCommonStyle. -

    Inherited by TQCDEStyle, TQMotifPlusStyle, and TQSGIStyle. -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - -The TQMotifStyle class provides Motif look and feel. -

    -

    This class implements the Motif look and feel. It closely -resembles the original Motif look as defined by the Open Group, -but with some minor improvements. The Motif style is TQt's default -GUI style on UNIX platforms. -

    See also Widget Appearance and Style. - -


    Member Function Documentation

    -

    TQMotifStyle::TQMotifStyle ( bool useHighlightCols = FALSE ) -

    -Constructs a TQMotifStyle. -

    If useHighlightCols is FALSE (the default), the style will -polish the application's color palette to emulate the Motif way of -highlighting, which is a simple inversion between the base and the -text color. - -

    void TQMotifStyle::setUseHighlightColors ( bool arg ) -

    -If arg is FALSE, the style will polish the application's color -palette to emulate the Motif way of highlighting, which is a -simple inversion between the base and the text color. -

    The effect will show up the next time an application palette is -set via TQApplication::setPalette(). The current color palette of -the application remains unchanged. -

    See also TQStyle::polish(). - -

    bool TQMotifStyle::useHighlightColors () const -

    -Returns TRUE if the style treats the highlight colors of the -palette in a Motif-like manner, which is a simple inversion -between the base and the text color; otherwise returns FALSE. The -default is FALSE. - - -

    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqplatinumstyle.html b/doc/html/ntqplatinumstyle.html deleted file mode 100644 index 4f841d313..000000000 --- a/doc/html/ntqplatinumstyle.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - -TQPlatinumStyle Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQPlatinumStyle Class Reference

    - -

    The TQPlatinumStyle class provides Mac/Platinum look and feel. -More... -

    #include <ntqplatinumstyle.h> -

    Inherits TQWindowsStyle. -

    List of all member functions. -

    Public Members

    - -

    Protected Members

    -
      -
    • TQColor mixedColor ( const TQColor & c1, const TQColor & c2 ) const
    • -
    • void drawRiffles ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool horizontal ) const
    • -
    -

    Detailed Description

    - - -The TQPlatinumStyle class provides Mac/Platinum look and feel. -

    -

    This class implements the Platinum look and feel. It's an -experimental class that tries to resemble a Macinosh-like GUI -style with the TQStyle system. The emulation is currently far from -perfect. -

    See also TQAquaStyle and Widget Appearance and Style. - -


    Member Function Documentation

    -

    TQPlatinumStyle::TQPlatinumStyle () -

    -Constructs a TQPlatinumStyle - -

    void TQPlatinumStyle::drawRiffles ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool horizontal ) const [protected] -

    -Draws the nifty Macintosh decoration used on sliders using painter -p and colorgroup g. x, y, w, h and horizontal -specify the geometry and orientation of the riffles. - -

    TQColor TQPlatinumStyle::mixedColor ( const TQColor & c1, const TQColor & c2 ) const [protected] -

    -Mixes two colors c1 and c2 to a new color. - - -

    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqsgistyle.html b/doc/html/ntqsgistyle.html deleted file mode 100644 index 6e87b625e..000000000 --- a/doc/html/ntqsgistyle.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - -TQSGIStyle Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQSGIStyle Class Reference

    - -

    The TQSGIStyle class provides SGI/Irix look and feel. -More... -

    #include <ntqsgistyle.h> -

    Inherits TQMotifStyle. -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - -The TQSGIStyle class provides SGI/Irix look and feel. -

    -

    This class implements the SGI look and feel. It resembles the -SGI/Irix Motif GUI style as closely as TQStyle allows. -

    See also Widget Appearance and Style. - -


    Member Function Documentation

    -

    TQSGIStyle::TQSGIStyle ( bool useHighlightCols = FALSE ) -

    -Constructs a TQSGIStyle. -

    If useHighlightCols is FALSE (default value), the style will -polish the application's color palette to emulate the Motif way of -highlighting, which is a simple inversion between the base and the -text color. -

    See also TQMotifStyle::useHighlightColors(). - -

    TQSGIStyle::~TQSGIStyle () [virtual] -

    -Destroys the style. - - -

    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/ntqwindowsstyle.html b/doc/html/ntqwindowsstyle.html deleted file mode 100644 index ae88c0e0c..000000000 --- a/doc/html/ntqwindowsstyle.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - -TQWindowsStyle Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQWindowsStyle Class Reference

    - -

    The TQWindowsStyle class provides a Microsoft Windows-like look and feel. -More... -

    #include <ntqwindowsstyle.h> -

    Inherits TQCommonStyle. -

    Inherited by TQMacStyle and TQPlatinumStyle. -

    List of all member functions. -

    Public Members

    - -

    Detailed Description

    - - -The TQWindowsStyle class provides a Microsoft Windows-like look and feel. -

    -

    This style is TQt's default GUI style on Windows. -

    See also Widget Appearance and Style. - -


    Member Function Documentation

    -

    TQWindowsStyle::TQWindowsStyle () -

    -Constructs a TQWindowsStyle - - -

    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/progressbar-example.html b/doc/html/progressbar-example.html index 5b40c64ff..ea9af3c72 100644 --- a/doc/html/progressbar-example.html +++ b/doc/html/progressbar-example.html @@ -98,7 +98,7 @@ protected slots: #include <tqprogressbar.h> #include <tqlayout.h> -#include <ntqmotifstyle.h> +#include <tqmotifstyle.h> /* * Constructor @@ -137,7 +137,7 @@ protected slots: // Create the progressbar progress = new TQProgressBar( 100, this ); - // progress->setStyle( new TQMotifStyle() ); + // progress->setStyle( new TQMotifStyle() ); toplayout->addMultiCellWidget( progress, 1, 1, 0, 1 ); // connect the clicked() SIGNALs of the pushbuttons to SLOTs diff --git a/doc/html/qcdestyle-h.html b/doc/html/qcdestyle-h.html deleted file mode 100644 index 5bb262696..000000000 --- a/doc/html/qcdestyle-h.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - -ntqcdestyle.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqcdestyle.h

    - -

    This is the verbatim text of the ntqcdestyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqcdestyle.h   3.3.8   edited Jan 11 14:46 $
    -**
    -** Definition of the CDE-like style class
    -**
    -** Created : 990513
    -**
    -** Copyright (C) 1999-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the widgets module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial licenses may use this file in accordance with the TQt
    -** Commercial License Agreement provided with the Software.
    -**
    -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -
    -#ifndef TQCDESTYLE_H
    -#define TQCDESTYLE_H
    -
    -#ifndef QT_H
    -#include "ntqmotifstyle.h"
    -#endif // QT_H
    -
    -#if !defined(TQT_NO_STYLE_CDE) || defined(QT_PLUGIN)
    -
    -#if defined(QT_PLUGIN)
    -#define Q_EXPORT_STYLE_CDE
    -#else
    -#define Q_EXPORT_STYLE_CDE TQ_EXPORT
    -#endif
    -
    -class Q_EXPORT_STYLE_CDE TQCDEStyle : public TQMotifStyle
    -{
    -    TQ_OBJECT
    -public:
    -
    -    TQCDEStyle( bool useHighlightCols = FALSE );
    -    virtual ~TQCDEStyle();
    -
    -    int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const;
    -
    -    void drawControl( ControlElement element,
    -		      TQPainter *p,
    -		      const TQWidget *widget,
    -		      const TQRect &r,
    -		      const TQColorGroup &cg,
    -		      SFlags how = Style_Default,
    -		      const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -    void drawPrimitive( PrimitiveElement pe,
    -			TQPainter *p,
    -			const TQRect &r,
    -			const TQColorGroup &cg,
    -			SFlags flags = Style_Default,
    -			const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -};
    -
    -#endif // TQT_NO_STYLE_CDE
    -
    -#endif // TQCDESTYLE_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qcdestyle-members.html b/doc/html/qcdestyle-members.html deleted file mode 100644 index 1ef8aeb2f..000000000 --- a/doc/html/qcdestyle-members.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -TQCDEStyle Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQCDEStyle

    - -

    This is the complete list of member functions for -TQCDEStyle, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qcommonstyle-h.html b/doc/html/qcommonstyle-h.html deleted file mode 100644 index 137b7b160..000000000 --- a/doc/html/qcommonstyle-h.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - -ntqcommonstyle.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqcommonstyle.h

    - -

    This is the verbatim text of the ntqcommonstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqcommonstyle.h   3.3.8   edited Jan 11 14:38 $
    -**
    -** Definition of TQCommonStyle class
    -**
    -** Created : 980616
    -**
    -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the widgets module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial licenses may use this file in accordance with the TQt
    -** Commercial License Agreement provided with the Software.
    -**
    -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
    -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -#ifndef TQCOMMONSTYLE_H
    -#define TQCOMMONSTYLE_H
    -
    -#ifndef QT_H
    -#include "tqstyle.h"
    -#endif // QT_H
    -
    -#ifndef TQT_NO_STYLE
    -
    -class TQ_EXPORT TQCommonStyle: public TQStyle
    -{
    -    TQ_OBJECT
    -
    -public:
    -    TQCommonStyle();
    -    ~TQCommonStyle();
    -
    -    void drawPrimitive( PrimitiveElement pe,
    -			TQPainter *p,
    -			const TQRect &r,
    -			const TQColorGroup &cg,
    -			SFlags flags = Style_Default,
    -			const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -    void drawControl( ControlElement element,
    -		      TQPainter *p,
    -		      const TQWidget *widget,
    -		      const TQRect &r,
    -		      const TQColorGroup &cg,
    -		      SFlags how = Style_Default,
    -		      const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -    void drawControlMask( ControlElement element,
    -			  TQPainter *p,
    -			  const TQWidget *widget,
    -			  const TQRect &r,
    -			  const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -    TQRect subRect( SubRect r, const TQWidget *widget ) const;
    -
    -    void drawComplexControl( ComplexControl control,
    -			     TQPainter *p,
    -			     const TQWidget *widget,
    -			     const TQRect &r,
    -			     const TQColorGroup &cg,
    -			     SFlags how = Style_Default,
    -#ifdef Q_QDOC
    -			     SCFlags sub = SC_All,
    -#else
    -			     SCFlags sub = (uint)SC_All,
    -#endif
    -			     SCFlags subActive = SC_None,
    -			     const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -    void drawComplexControlMask( ComplexControl control,
    -				 TQPainter *p,
    -				 const TQWidget *widget,
    -				 const TQRect &r,
    -				 const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -    TQRect querySubControlMetrics( ComplexControl control,
    -				  const TQWidget *widget,
    -				  SubControl sc,
    -				  const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -    SubControl querySubControl( ComplexControl control,
    -				const TQWidget *widget,
    -				const TQPoint &pos,
    -				const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -    int pixelMetric( PixelMetric m, const TQWidget *widget = 0 ) const;
    -
    -    TQSize sizeFromContents( ContentsType s,
    -			    const TQWidget *widget,
    -			    const TQSize &contentsSize,
    -			    const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -    int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption &, TQStyleHintReturn *) const;
    -
    -    TQPixmap stylePixmap( StylePixmap sp,
    -			 const TQWidget *widget = 0,
    -			 const TQStyleOption& = TQStyleOption::Default ) const;
    -
    -
    -private:
    -    // Disabled copy constructor and operator=
    -#if defined(TQ_DISABLE_COPY)
    -    TQCommonStyle( const TQCommonStyle & );
    -    TQCommonStyle &operator=( const TQCommonStyle & );
    -#endif
    -};
    -
    -
    -
    -#endif // TQT_NO_STYLE
    -
    -#endif // TQCOMMONSTYLE_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qcommonstyle-members.html b/doc/html/qcommonstyle-members.html deleted file mode 100644 index 7f4b908a7..000000000 --- a/doc/html/qcommonstyle-members.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - -TQCommonStyle Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQCommonStyle

    - -

    This is the complete list of member functions for -TQCommonStyle, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qmacstyle.html b/doc/html/qmacstyle.html index 5d6170355..97ff9dea4 100644 --- a/doc/html/qmacstyle.html +++ b/doc/html/qmacstyle.html @@ -34,7 +34,7 @@ body { background: #ffffff; color: black; }

    The TQMacStyle class implements an Appearance Manager style. More...

    #include <qmacstyle_mac.h> -

    Inherits TQWindowsStyle. +

    Inherits TQWindowsStyle.

    List of all member functions.

    Public Members

      diff --git a/doc/html/qmacstyle_mac-h.html b/doc/html/qmacstyle_mac-h.html index c795d9e14..360748b22 100644 --- a/doc/html/qmacstyle_mac-h.html +++ b/doc/html/qmacstyle_mac-h.html @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; } #define TQMACSTYLE_MAC_H #ifndef QT_H -#include "ntqwindowsstyle.h" +#include "tqwindowsstyle.h" #endif // QT_H #if defined( TQ_WS_MAC ) && !defined( TQT_NO_STYLE_MAC ) diff --git a/doc/html/qmotif-h.html b/doc/html/qmotif-h.html deleted file mode 100644 index e4fdca761..000000000 --- a/doc/html/qmotif-h.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - -qmotif.h Include File - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      qmotif.h

      - -

      This is the verbatim text of the qmotif.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


      -
      -/****************************************************************************
      -** $Id: qt/qmotif.h   3.3.8   edited Jan 11 14:37 $
      -**
      -** Definition of TQt extension classes for Xt/Motif support.
      -**
      -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
      -**
      -** This file is part of the TQt extension for Xt/Motif support.
      -**
      -** Licensees holding valid TQt Enterprise Edition licenses for X11 may use
      -** this file in accordance with the TQt Commercial License Agreement provided
      -** with the Software.
      -**
      -** This file is not available for use under any other license without
      -** express written permission from the copyright holder.
      -**
      -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
      -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
      -**
      -** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
      -**   information about TQt Commercial License Agreements.
      -**
      -** Contact info@trolltech.com if any conditions of this licensing are
      -** not clear to you.
      -**
      -**********************************************************************/
      -
      -#ifndef TQMOTIF_H
      -#define TQMOTIF_H
      -
      -#include <tqeventloop.h>
      -
      -#include <X11/Intrinsic.h>
      -
      -class TQMotifPrivate;
      -
      -class TQMotif : public TQEventLoop
      -{
      -    TQ_OBJECT
      -
      -public:
      -    TQMotif( const char *applicationClass, XtAppContext context = NULL, XrmOptionDescRec *options = 0, int numOptions = 0);
      -    ~TQMotif();
      -
      -    XtAppContext applicationContext() const;
      -
      -    void registerSocketNotifier( TQSocketNotifier * );
      -    void unregisterSocketNotifier( TQSocketNotifier * );
      -    void wakeUp();
      -
      -    static void registerWidget( TQWidget* );
      -    static void unregisterWidget( TQWidget* );
      -    static bool redeliverEvent( XEvent *event );
      -
      -    static Display *x11Display();
      -    static XEvent* lastEvent();
      -
      -protected:
      -    bool processEvents( ProcessEventsFlags flags );
      -
      -private:
      -    void appStartingUp();
      -    void appClosingDown();
      -    TQMotifPrivate *d;
      -};
      -
      -#endif // TQMOTIF_H
      -
      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotif-members.html b/doc/html/qmotif-members.html deleted file mode 100644 index 2c9854166..000000000 --- a/doc/html/qmotif-members.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - -TQMotif Member List - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      Complete Member List for TQMotif

      - -

      This is the complete list of member functions for -TQMotif, including inherited members. - -

      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotif.html b/doc/html/qmotif.html deleted file mode 100644 index 0234253ee..000000000 --- a/doc/html/qmotif.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -TQMotif Class - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      TQMotif Class Reference

      - -

      The TQMotif class provides the basis of the Motif Extension. -More... -

      This class is part of the TQt Motif Extension. -

      #include <qmotif.h> -

      Inherits TQEventLoop. -

      List of all member functions. -

      Public Members

      -
        -
      • TQMotif ( const char * applicationClass, XtAppContext context = NULL, XrmOptionDescRec * options = 0, int numOptions = 0 )
      • -
      • ~TQMotif ()
      • -
      • XtAppContext applicationContext () const
      • -
      -

      Static Public Members

      - -

      Detailed Description

      -

      This class is defined in the TQt Motif Extension, which can be found in the qt/extensions directory. It is not included in the main TQt API. -

      - -The TQMotif class provides the basis of the Motif Extension. - -

      -

      TQMotif only provides a few public functions, but it is at the -heart of the integration. TQMotif is responsible for initializing -the Xt toolkit and the Xt application context. It does not open a -connection to the X server, that is done by TQApplication. -

      The only member function in TQMotif that depends on an X server -connection is TQMotif::initialize(). TQMotif must be created before -TQApplication. -

      Example usage of TQMotif and TQApplication: -

      -    static char *resources[] = {
      -        ...
      -    };
      -
      -    int main(int argc, char **argv)
      -    {
      -        TQMotif integrator( "AppClass" );
      -        XtAppSetFallbackResources( integrator.applicationContext(),
      -                                   resources );
      -        TQApplication app( argc, argv );
      -
      -        ...
      -
      -        return app.exec();
      -    }
      -    
      - - -

      Member Function Documentation

      -

      TQMotif::TQMotif ( const char * applicationClass, XtAppContext context = NULL, XrmOptionDescRec * options = 0, int numOptions = 0 ) -

      -Creates TQMotif, which allows TQt and Xt/Motif integration. -

      If context is 0, TQMotif creates a default application context -itself. The context is accessible through applicationContext(). -

      All arguments passed to this function (applicationClass, options and numOptions) are used to call XtDisplayInitialize() -after TQApplication has been constructed. - -

      TQMotif::~TQMotif () -

      -Destroys TQMotif. - -

      XtAppContext TQMotif::applicationContext () const -

      -Returns the application context. - -

      Display * TQMotif::x11Display () [static] -

      -Returns the X11 display connection used by the TQt Motif Extension. - - -

      -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifdialog-h.html b/doc/html/qmotifdialog-h.html deleted file mode 100644 index 18c5a45af..000000000 --- a/doc/html/qmotifdialog-h.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - -qmotifdialog.h Include File - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      qmotifdialog.h

      - -

      This is the verbatim text of the qmotifdialog.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


      -
      -/****************************************************************************
      -** $Id: qt/qmotifdialog.h   3.3.8   edited Jan 11 14:37 $
      -**
      -** Definition of TQt extension classes for Xt/Motif support.
      -**
      -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
      -**
      -** This file is part of the TQt extension for Xt/Motif support.
      -**
      -** Licensees holding valid TQt Enterprise Edition licenses for X11 may use
      -** this file in accordance with the TQt Commercial License Agreement provided
      -** with the Software.
      -**
      -** This file is not available for use under any other license without
      -** express written permission from the copyright holder.
      -**
      -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
      -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
      -**
      -** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
      -**   information about TQt Commercial License Agreements.
      -**
      -** Contact info@trolltech.com if any conditions of this licensing are
      -** not clear to you.
      -**
      -**********************************************************************/
      -
      -#ifndef TQMOTIFDIALOG_H
      -#define TQMOTIFDIALOG_H
      -
      -#include <tqdialog.h>
      -
      -#include <X11/Intrinsic.h>
      -#include <Xm/Xm.h>
      -
      -class TQMotifWidget;
      -class TQMotifDialogPrivate;
      -
      -class TQMotifDialog : public TQDialog
      -{
      -    TQ_OBJECT
      -
      -public:
      -    // obsolete
      -    enum DialogType {
      -	Prompt,
      -	Selection,
      -	Command,
      -	FileSelection,
      -	Template,
      -	Error,
      -	Information,
      -	Message,
      -	Question,
      -	Warning,
      -	Working
      -    };
      -    // obsolete
      -    TQMotifDialog( DialogType dialogtype,
      -		  Widget parent, ArgList args = NULL, Cardinal argcount = 0,
      -		  const char *name = 0, bool modal = FALSE, WFlags flags = 0 );
      -    // obsolete
      -    TQMotifDialog( Widget parent, ArgList args = NULL, Cardinal argcount = 0,
      -		  const char *name = 0, bool modal = FALSE, WFlags flags = 0 );
      -
      -    TQMotifDialog( Widget parent, const char *name = 0,
      -		  bool modal = FALSE, WFlags flags = 0 );
      -    TQMotifDialog( TQWidget *parent, const char *name = 0,
      -		  bool modal = FALSE, WFlags flags = 0 );
      -
      -    virtual ~TQMotifDialog();
      -
      -    Widget shell() const;
      -    Widget dialog() const;
      -
      -    void show();
      -    void hide();
      -
      -    static void acceptCallback( Widget, XtPointer, XtPointer );
      -    static void rejectCallback( Widget, XtPointer, XtPointer );
      -
      -public slots:
      -    void accept();
      -    void reject();
      -
      -protected:
      -    bool event( TQEvent * );
      -
      -#if !defined(Q_NO_USING_KEYWORD)
      -    using TQObject::insertChild;
      -#endif
      -
      -private:
      -    TQMotifDialogPrivate *d;
      -
      -    void init( Widget parent = NULL, ArgList args = NULL, Cardinal argcount = 0);
      -
      -    void realize( Widget w );
      -    void insertChild( Widget w );
      -    void deleteChild( Widget w );
      -
      -    friend void qmotif_dialog_realize( Widget, XtValueMask *, XSetWindowAttributes *);
      -    friend void qmotif_dialog_insert_child( Widget );
      -    friend void qmotif_dialog_delete_child( Widget );
      -    friend void qmotif_dialog_change_managed( Widget );
      -};
      -
      -#endif // TQMOTIFDIALOG_H
      -
      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifdialog-members.html b/doc/html/qmotifdialog-members.html deleted file mode 100644 index 85ea8d7a1..000000000 --- a/doc/html/qmotifdialog-members.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - -TQMotifDialog Member List - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      Complete Member List for TQMotifDialog

      - -

      This is the complete list of member functions for -TQMotifDialog, including inherited members. - -

      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifdialog.html b/doc/html/qmotifdialog.html deleted file mode 100644 index f0cbd8595..000000000 --- a/doc/html/qmotifdialog.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - -TQMotifDialog Class - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      TQMotifDialog Class Reference

      - -

      The TQMotifDialog class provides the TQDialog API for Motif-based dialogs. -More... -

      This class is part of the TQt Motif Extension. -

      #include <qmotifdialog.h> -

      Inherits TQDialog. -

      List of all member functions. -

      Public Members

      -
        -
      • enum DialogType { Prompt, Selection, Command, FileSelection, Template, Error, Information, Message, Question, Warning, Working }  (obsolete)
      • -
      • TQMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )  (obsolete)
      • -
      • TQMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )  (obsolete)
      • -
      • TQMotifDialog ( Widget parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )
      • -
      • TQMotifDialog ( TQWidget * parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )
      • -
      • virtual ~TQMotifDialog ()
      • -
      • Widget shell () const
      • -
      • Widget dialog () const
      • -
      -

      Static Public Members

      - -

      Detailed Description

      -

      This class is defined in the TQt Motif Extension, which can be found in the qt/extensions directory. It is not included in the main TQt API. -

      - -The TQMotifDialog class provides the TQDialog API for Motif-based dialogs. - -

      -

      TQMotifDialog provides two separate modes of operation. The -application programmer can use TQMotifDialog with an existing -Motif-based dialog and a TQWidget parent, or the application -programmer can use TQMotifDialog with a custom TQt-based dialog and -a Motif-based parent. Modality continues to work as expected. -

      Motif-based dialogs must have a Shell widget parent with a -single child, due to requirements of the Motif toolkit. The Shell widget, which is a special subclass of XmDialogShell, is -created during construction. It can be accessed using the shell() -member function. -

      The single child of the Shell can be accessed using the -dialog() member function after it has been created. -

      The acceptCallback() and rejectCallback() functions provide a -convenient way to call TQDialog::accept() and TQDialog::reject() -through callbacks. A pointer to the TQMotifDialog should be passed -as the client_data argument to the callback. -

      The API and behavior TQMotifDialog is identical to that of TQDialog -when using a custom TQt-based dialog with a Motif-based parent. -The only difference is that a Motif-based parent argument is -passed to the constructor, instead of a TQWidget parent. - -


      Member Type Documentation

      -

      TQMotifDialog::DialogType

      This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

      -

      This enum lists the predefined Motif dialog types. -

        -
      • TQMotifDialog::Prompt -
      • TQMotifDialog::Selection -
      • TQMotifDialog::Command -
      • TQMotifDialog::FileSelection -
      • TQMotifDialog::Template -
      • TQMotifDialog::Error -
      • TQMotifDialog::Information -
      • TQMotifDialog::Message -
      • TQMotifDialog::Question -
      • TQMotifDialog::Warning -
      • TQMotifDialog::Working -
      -

      Member Function Documentation

      -

      TQMotifDialog::TQMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) -

      This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

      Creates a TQMotifDialog using one of the predefined Motif dialog -types. The name, modal and flags arguments are passed to -the TQDialog constructor. -

      This constructor creates a Shell widget, which is a special -subclass of XmDialogShell. The parent, args and argcount -arguments are passed to XtCreatePopupShell() when creating the -subclass. You can access the Shell widget with the shell() member -function. -

      This constructor also creates the dialog widget with the Shell -widget as its parent. The type of the dialog created is specified -by the dialogtype argument. See the DialogType enum for a list -of available dialog types. You can access the dialog widget with -the dialog() member function. -

      Warning: TQMotifDialog takes ownership of the child widget and -destroys it during destruction. You should not destroy the dialog -widget yourself. -

      See also DialogType, shell(), and dialog(). - -

      TQMotifDialog::TQMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) -

      This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. -

      Creates a TQMotifDialog which allows the application programmer to -use the Motif-based parent for a custom TQDialog. The name, -modal and flags arguments are passed to the TQDialog -constructor. -

      This constructor creates a Shell widget, which is a special -subclass of XmDialogShell. The args and argcount arguments -are passed to XtCreatePopupShell() when creating the subclass. -You can access the Shell widget with the shell() member function. -

      The dialog widget is not created by the constructor. You must -create the dialog widget as a child of the the widget returned by -shell(). You can access the child widget with the dialog() member -function. -

      A dialog widget is not created by this constructor. Instead, you -should create the dialog widget as a child of this -dialog. TQMotifDialog will take ownership of your custom dialog, -and you can access it with the dialog() member function. -

      Warning: TQMotifDialog takes ownership of the child widget and -destroys it during destruction. You should not destroy the dialog -widget yourself. -

      See also shell() and dialog(). - -

      TQMotifDialog::TQMotifDialog ( Widget parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) -

      -Creates a TQMotifDialog which allows the application programmer to -use the Motif-based parent for a custom TQDialog. The name, -modal and flags arguments are passed to the TQDialog -constructor. -

      This constructor creates a Shell widget, which is a special -subclass of XmDialogShell. You can access the Shell widget -with the shell() member function. -

      See also shell(). - -

      TQMotifDialog::TQMotifDialog ( TQWidget * parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) -

      -Creates a TQMotifDialog which allows the application programmer to -use a TQWidget parent for an existing Motif-based dialog. The parent, name, modal and flags arguments are passed to the -TQDialog constructor. -

      This constructor creates a Shell widget, which is a special -subclass of XmDialogShell. You can access the Shell widget -with the shell() member functon. -

      A dialog widget is not created by this constructor. Instead, you -should create the dialog widget as a child of this -dialog. TQMotifDialog will take ownership of your custom dialog, -and you can access it with the dialog() member function. -

      Warning: TQMotifDialog takes ownership of the child widget and -destroys it during destruction. You should not destroy the dialog -widget yourself. -

      See also shell() and dialog(). - -

      TQMotifDialog::~TQMotifDialog () [virtual] -

      -Destroys the TQDialog, dialog widget and Shell widget. - -

      void TQMotifDialog::acceptCallback ( Widget, XtPointer client_data, XtPointer ) [static] -

      -Convenient Xt/Motif callback to accept the TQMotifDialog. -

      The data is passed in client_data. - -

      Widget TQMotifDialog::dialog () const -

      -Returns the Motif widget embedded in this dialog. - -

      void TQMotifDialog::rejectCallback ( Widget, XtPointer client_data, XtPointer ) [static] -

      -Convenient Xt/Motif callback to reject the TQMotifDialog. -

      The data is passed in client_data. - -

      Widget TQMotifDialog::shell () const -

      -Returns the Shell widget embedded in this dialog. - -

      Example: dialog/mainwindow.cpp. - -


      -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifplusstyle-h.html b/doc/html/qmotifplusstyle-h.html deleted file mode 100644 index ed53cdebe..000000000 --- a/doc/html/qmotifplusstyle-h.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - -ntqmotifplusstyle.h Include File - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      ntqmotifplusstyle.h

      - -

      This is the verbatim text of the ntqmotifplusstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


      -
      -/****************************************************************************
      -** $Id: qt/ntqmotifplusstyle.h   3.3.8   edited Jan 11 14:46 $
      -**
      -** Definition of TQMotifPlusStyle class
      -**
      -** Created : 000727
      -**
      -** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
      -**
      -** This file is part of the widgets module of the TQt GUI Toolkit.
      -**
      -** This file may be used under the terms of the GNU General Public
      -** License versions 2.0 or 3.0 as published by the Free Software
      -** Foundation and appearing in the file LICENSE.GPL included in the
      -** packaging of this file. Alternatively you may (at your option) use any
      -** later version of the GNU General Public License if such license has
      -** been publicly approved by Trolltech ASA (or its successors, if any)
      -** and the KDE Free TQt Foundation.
      -**
      -** Please review the following information to ensure GNU General
      -** Public Licensing requirements will be met:
      -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
      -** If you are unsure which license is appropriate for your use, please
      -** review the following information:
      -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
      -** or contact the sales department at sales@trolltech.com.
      -**
      -** This file may be used under the terms of the Q Public License as
      -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
      -** included in the packaging of this file.  Licensees holding valid TQt
      -** Commercial licenses may use this file in accordance with the TQt
      -** Commercial License Agreement provided with the Software.
      -**
      -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
      -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
      -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
      -** herein.
      -**
      -**********************************************************************/
      -
      -#ifndef TQMOTIFPLUSSTYLE_H
      -#define TQMOTIFPLUSSTYLE_H
      -
      -
      -#ifndef QT_H
      -#include "ntqmotifstyle.h"
      -#endif // QT_H
      -
      -#if !defined(TQT_NO_STYLE_MOTIFPLUS) || defined(QT_PLUGIN)
      -
      -#if defined(QT_PLUGIN)
      -#define Q_EXPORT_STYLE_MOTIFPLUS
      -#else
      -#define Q_EXPORT_STYLE_MOTIFPLUS TQ_EXPORT
      -#endif
      -
      -class Q_EXPORT_STYLE_MOTIFPLUS TQMotifPlusStyle : public TQMotifStyle
      -{
      -    TQ_OBJECT
      -
      -public:
      -    TQMotifPlusStyle(bool hoveringHighlight = TRUE);
      -    virtual ~TQMotifPlusStyle();
      -
      -    void polish(TQPalette &pal);
      -    void polish(TQWidget *widget);
      -    void unPolish(TQWidget*widget);
      -
      -    void polish(TQApplication *app);
      -    void unPolish(TQApplication *app);
      -
      -    void drawPrimitive( PrimitiveElement pe,
      -			TQPainter *p,
      -			const TQRect &r,
      -			const TQColorGroup &cg,
      -			SFlags flags = Style_Default,
      -			const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    void drawControl( ControlElement element,
      -		      TQPainter *p,
      -		      const TQWidget *widget,
      -		      const TQRect &r,
      -		      const TQColorGroup &cg,
      -		      SFlags how = Style_Default,
      -		      const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    TQRect subRect(SubRect r, const TQWidget *widget) const;
      -
      -    void drawComplexControl(ComplexControl control,
      -			    TQPainter *p,
      -			    const TQWidget *widget,
      -			    const TQRect &r,
      -			    const TQColorGroup &cg,
      -			    SFlags how = Style_Default,
      -#ifdef Q_QDOC
      -			    SCFlags controls = SC_All,
      -#else
      -			    SCFlags controls = (uint)SC_All,
      -#endif
      -			    SCFlags active = SC_None,
      -			    const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    TQRect querySubControlMetrics(ComplexControl control,
      -				 const TQWidget *widget,
      -				 SubControl subcontrol,
      -				 const TQStyleOption& = TQStyleOption::Default) const;
      -
      -    int pixelMetric(PixelMetric metric, const TQWidget *widget = 0) const;
      -
      -    int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption & = TQStyleOption::Default,
      -		  TQStyleHintReturn* = 0) const;
      -
      -protected:
      -    bool eventFilter(TQObject *, TQEvent *);
      -
      -
      -private:
      -    bool useHoveringHighlight;
      -};
      -
      -
      -#endif // TQT_NO_STYLE_MOTIFPLUS
      -
      -#endif // TQMOTIFPLUSSTYLE_H
      -
      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifplusstyle-members.html b/doc/html/qmotifplusstyle-members.html deleted file mode 100644 index fa4a02924..000000000 --- a/doc/html/qmotifplusstyle-members.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - -TQMotifPlusStyle Member List - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      Complete Member List for TQMotifPlusStyle

      - -

      This is the complete list of member functions for -TQMotifPlusStyle, including inherited members. - -

      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifstyle-h.html b/doc/html/qmotifstyle-h.html deleted file mode 100644 index 91df3fa15..000000000 --- a/doc/html/qmotifstyle-h.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - -ntqmotifstyle.h Include File - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      ntqmotifstyle.h

      - -

      This is the verbatim text of the ntqmotifstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


      -
      -/****************************************************************************
      -** $Id: qt/ntqmotifstyle.h   3.3.8   edited Jan 11 14:46 $
      -**
      -** Definition of Motif-like style class
      -**
      -** Created : 981231
      -**
      -** Copyright (C) 1998-2007 Trolltech ASA.  All rights reserved.
      -**
      -** This file is part of the widgets module of the TQt GUI Toolkit.
      -**
      -** This file may be used under the terms of the GNU General Public
      -** License versions 2.0 or 3.0 as published by the Free Software
      -** Foundation and appearing in the file LICENSE.GPL included in the
      -** packaging of this file. Alternatively you may (at your option) use any
      -** later version of the GNU General Public License if such license has
      -** been publicly approved by Trolltech ASA (or its successors, if any)
      -** and the KDE Free TQt Foundation.
      -**
      -** Please review the following information to ensure GNU General
      -** Public Licensing requirements will be met:
      -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
      -** If you are unsure which license is appropriate for your use, please
      -** review the following information:
      -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
      -** or contact the sales department at sales@trolltech.com.
      -**
      -** This file may be used under the terms of the Q Public License as
      -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
      -** included in the packaging of this file.  Licensees holding valid TQt
      -** Commercial licenses may use this file in accordance with the TQt
      -** Commercial License Agreement provided with the Software.
      -**
      -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
      -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
      -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
      -** herein.
      -**
      -**********************************************************************/
      -
      -#ifndef TQMOTIFSTYLE_H
      -#define TQMOTIFSTYLE_H
      -
      -#ifndef QT_H
      -#include "ntqcommonstyle.h"
      -#endif // QT_H
      -
      -#if !defined(TQT_NO_STYLE_MOTIF) || defined(QT_PLUGIN)
      -
      -class TQPalette;
      -
      -#if defined(QT_PLUGIN)
      -#define Q_EXPORT_STYLE_MOTIF
      -#else
      -#define Q_EXPORT_STYLE_MOTIF TQ_EXPORT
      -#endif
      -
      -
      -class Q_EXPORT_STYLE_MOTIF TQMotifStyle : public TQCommonStyle
      -{
      -    TQ_OBJECT
      -public:
      -    TQMotifStyle( bool useHighlightCols=FALSE );
      -    virtual ~TQMotifStyle();
      -
      -    void setUseHighlightColors( bool );
      -    bool useHighlightColors() const;
      -
      -    void polish( TQPalette& );
      -    void polish( TQWidget* );
      -    void polish( TQApplication* );
      -
      -    void polishPopupMenu( TQPopupMenu* );
      -
      -    // new style API
      -    void drawPrimitive( PrimitiveElement pe,
      -			TQPainter *p,
      -			const TQRect &r,
      -			const TQColorGroup &cg,
      -			SFlags flags = Style_Default,
      -			const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    void drawControl( ControlElement element,
      -		      TQPainter *p,
      -		      const TQWidget *widget,
      -		      const TQRect &r,
      -		      const TQColorGroup &cg,
      -		      SFlags how = Style_Default,
      -		      const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    void drawComplexControl( ComplexControl control,
      -			     TQPainter *p,
      -			     const TQWidget* widget,
      -			     const TQRect& r,
      -			     const TQColorGroup& cg,
      -			     SFlags how = Style_Default,
      -#ifdef Q_QDOC
      -			     SCFlags sub = SC_All,
      -#else
      -			     SCFlags sub = (uint)SC_All,
      -#endif
      -			     SCFlags subActive = SC_None,
      -			     const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    TQRect querySubControlMetrics( ComplexControl control,
      -				  const TQWidget *widget,
      -				  SubControl sc,
      -				  const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const;
      -
      -    TQSize sizeFromContents( ContentsType contents,
      -			    const TQWidget *widget,
      -			    const TQSize &contentsSize,
      -			    const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    TQRect subRect( SubRect r, const TQWidget *widget ) const;
      -
      -    TQPixmap stylePixmap(StylePixmap, const TQWidget * = 0, const TQStyleOption& = TQStyleOption::Default) const;
      -
      -    int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption & = TQStyleOption::Default,
      -		  TQStyleHintReturn* = 0) const;
      -
      -private:
      -    bool highlightCols;
      -
      -    // Disabled copy constructor and operator=
      -#if defined(TQ_DISABLE_COPY)
      -    TQMotifStyle( const TQMotifStyle & );
      -    TQMotifStyle& operator=( const TQMotifStyle & );
      -#endif
      -};
      -
      -#endif // TQT_NO_STYLE_MOTIF
      -
      -#endif // TQMOTIFSTYLE_H
      -
      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifstyle-members.html b/doc/html/qmotifstyle-members.html deleted file mode 100644 index 1defbe61c..000000000 --- a/doc/html/qmotifstyle-members.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - -TQMotifStyle Member List - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      Complete Member List for TQMotifStyle

      - -

      This is the complete list of member functions for -TQMotifStyle, including inherited members. - -

      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifwidget-h.html b/doc/html/qmotifwidget-h.html deleted file mode 100644 index aae36c2f3..000000000 --- a/doc/html/qmotifwidget-h.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -qmotifwidget.h Include File - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      qmotifwidget.h

      - -

      This is the verbatim text of the qmotifwidget.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


      -
      -/****************************************************************************
      -** $Id: qt/qmotifwidget.h   3.3.8   edited Jan 11 14:37 $
      -**
      -** Definition of TQt extension classes for Xt/Motif support.
      -**
      -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
      -**
      -** This file is part of the TQt extension for Xt/Motif support.
      -**
      -** Licensees holding valid TQt Enterprise Edition licenses for X11 may use
      -** this file in accordance with the TQt Commercial License Agreement provided
      -** with the Software.
      -**
      -** This file is not available for use under any other license without
      -** express written permission from the copyright holder.
      -**
      -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
      -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
      -**
      -** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
      -**   information about TQt Commercial License Agreements.
      -**
      -** Contact info@trolltech.com if any conditions of this licensing are
      -** not clear to you.
      -**
      -**********************************************************************/
      -
      -#ifndef TQMOTIFWIDGET_H
      -#define TQMOTIFWIDGET_H
      -
      -#include <tqwidget.h>
      -
      -#include <X11/Intrinsic.h>
      -
      -class TQMotifWidgetPrivate;
      -class TQKeyEvent;
      -
      -class TQMotifWidget : public TQWidget
      -{
      -    TQ_OBJECT
      -
      -public:
      -    TQMotifWidget( TQWidget *, WidgetClass, ArgList = NULL, Cardinal = 0,
      -                  const char * = 0, WFlags = 0 );
      -    virtual ~TQMotifWidget();
      -
      -    Widget motifWidget() const;
      -
      -    void show();
      -    void hide();
      -
      -protected:
      -    bool event( TQEvent * );
      -    bool eventFilter( TQObject *object, TQEvent *event );
      -    bool x11Event(XEvent *event);
      -
      -private:
      -    TQMotifWidgetPrivate *d;
      -
      -    void realize( Widget );
      -
      -    friend void qmotif_widget_shell_destroy(Widget w);
      -    friend void qmotif_widget_shell_realize( Widget, XtValueMask *,
      -                                             XSetWindowAttributes *);
      -    friend void qmotif_widget_shell_change_managed( Widget );
      -    static bool dispatchTQEvent( TQEvent*, TQWidget*);
      -    friend class TQMotifDialog;
      -};
      -
      -#endif // TQMOTIFWIDGET_H
      -
      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifwidget-members.html b/doc/html/qmotifwidget-members.html deleted file mode 100644 index 67e37e7a9..000000000 --- a/doc/html/qmotifwidget-members.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - -TQMotifWidget Member List - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      Complete Member List for TQMotifWidget

      - -

      This is the complete list of member functions for -TQMotifWidget, including inherited members. - -

      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qmotifwidget.html b/doc/html/qmotifwidget.html deleted file mode 100644 index 95687254c..000000000 --- a/doc/html/qmotifwidget.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -TQMotifWidget Class - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      TQMotifWidget Class Reference

      - -

      The TQMotifWidget class provides the TQWidget API for Xt/Motif widgets. -More... -

      This class is part of the TQt Motif Extension. -

      #include <qmotifwidget.h> -

      Inherits TQWidget. -

      List of all member functions. -

      Public Members

      -
        -
      • TQMotifWidget ( TQWidget * parent, WidgetClass widgetclass, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, WFlags flags = 0 )
      • -
      • virtual ~TQMotifWidget ()
      • -
      • Widget motifWidget () const
      • -
      -

      Protected Members

      -
        -
      • virtual bool x11Event ( XEvent * event )
      • -
      -

      Detailed Description

      -

      This class is defined in the TQt Motif Extension, which can be found in the qt/extensions directory. It is not included in the main TQt API. -

      - -The TQMotifWidget class provides the TQWidget API for Xt/Motif widgets. - -

      -

      TQMotifWidget exists to provide a TQWidget that can act as a parent -for any Xt/Motif widget. Since the TQMotifWidget is a proper -TQWidget, it can be used as a top-level widget (e.g. 0 parent) or -as a child of any other TQWidget. Note: Since TQMotifWidget acts as -a parent for Xt/Motif widgets, you should not create TQWidgets with -a TQMotifWidget parent. -

      An Xt/Motif widget with a top-level TQMotifWidget parent can begin -using the standard TQt dialogs and custom TQDialogs while keeping -the main Xt/Motif interface of the application. Using a -TQMotifWidget as the parent for the various TQDialogs will ensure -that modality and stacking works properly throughout the entire -application. -

      Applications moving to TQt may have custom Xt/Motif widgets that -will take time to rewrite with TQt. Such applications can use -these custom widgets as TQMotifWidget with TQWidget parents. This -allows the application's interface to be replaced gradually. -

      Warning: TQMotifWidget uses the X11 window ID of the Motif widget -directly, instead of creating its own. Because ot this, -TQWidget::reparent() will not work. This includes the functions -TQWidget::showFullScreen() and TQWidget::showNormal(), which use -TQWidget::reparent(). - -


      Member Function Documentation

      -

      TQMotifWidget::TQMotifWidget ( TQWidget * parent, WidgetClass widgetclass, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, WFlags flags = 0 ) -

      -Creates a TQMotifWidget of the given widgetclass as a child of -parent, with the name name and widget flags flags. -

      The args and argcount arguments are passed on to -XtCreateWidget. -

      The motifWidget() function returns the resulting Xt/Motif widget. -This widget can be used as a parent for any other Xt/Motif widget. -

      If parent is a TQMotifWidget, the Xt/Motif widget is created as -a child of the parent's motifWidget(). If \ parent is 0 or a -normal TQWidget, the Xt/Motif widget is created as a child of a -special TopLevelShell widget. Xt/Motif widgets can use this -special TopLevelShell parent as the parent for existing -Xt/Motif dialogs or TQMotifDialogs. - -

      TQMotifWidget::~TQMotifWidget () [virtual] -

      -Destroys the TQMotifWidget. The special TopLevelShell is also -destroyed, if it was created during construction. - -

      Widget TQMotifWidget::motifWidget () const -

      -Returns the embedded Xt/Motif widget. If a Shell widget was -created by the constructor, you can access it with XtParent(). - - -

      -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qnamespace-h.html b/doc/html/qnamespace-h.html index 25bc8b5ce..99550d231 100644 --- a/doc/html/qnamespace-h.html +++ b/doc/html/qnamespace-h.html @@ -663,7 +663,7 @@ public: Key_unknown = 0xffff }; - // documented in qcommonstyle.cpp + // documented in tqcommonstyle.cpp enum ArrowType { UpArrow, DownArrow, diff --git a/doc/html/qplatinumstyle-h.html b/doc/html/qplatinumstyle-h.html deleted file mode 100644 index 012aeb73e..000000000 --- a/doc/html/qplatinumstyle-h.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - -ntqplatinumstyle.h Include File - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      ntqplatinumstyle.h

      - -

      This is the verbatim text of the ntqplatinumstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


      -
      -/****************************************************************************
      -** $Id: qt/ntqplatinumstyle.h   3.3.8   edited Jan 11 14:46 $
      -**
      -** Definition of Platinum-like style class
      -**
      -** Created : 981231
      -**
      -** Copyright (C) 1998-2007 Trolltech ASA.  All rights reserved.
      -**
      -** This file is part of the widgets module of the TQt GUI Toolkit.
      -**
      -** This file may be used under the terms of the GNU General Public
      -** License versions 2.0 or 3.0 as published by the Free Software
      -** Foundation and appearing in the file LICENSE.GPL included in the
      -** packaging of this file. Alternatively you may (at your option) use any
      -** later version of the GNU General Public License if such license has
      -** been publicly approved by Trolltech ASA (or its successors, if any)
      -** and the KDE Free TQt Foundation.
      -**
      -** Please review the following information to ensure GNU General
      -** Public Licensing requirements will be met:
      -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
      -** If you are unsure which license is appropriate for your use, please
      -** review the following information:
      -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
      -** or contact the sales department at sales@trolltech.com.
      -**
      -** This file may be used under the terms of the Q Public License as
      -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
      -** included in the packaging of this file.  Licensees holding valid TQt
      -** Commercial licenses may use this file in accordance with the TQt
      -** Commercial License Agreement provided with the Software.
      -**
      -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
      -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
      -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
      -** herein.
      -**
      -**********************************************************************/
      -
      -#ifndef TQPLATINUMSTYLE_H
      -#define TQPLATINUMSTYLE_H
      -
      -#ifndef QT_H
      -#include "ntqwindowsstyle.h"
      -#endif // QT_H
      -
      -#if !defined(TQT_NO_STYLE_PLATINUM) || defined(QT_PLUGIN)
      -
      -class TQPalette;
      -
      -#if defined(QT_PLUGIN)
      -#define Q_EXPORT_STYLE_PLATINUM
      -#else
      -#define Q_EXPORT_STYLE_PLATINUM TQ_EXPORT
      -#endif
      -
      -class Q_EXPORT_STYLE_PLATINUM TQPlatinumStyle : public TQWindowsStyle
      -{
      -    TQ_OBJECT
      -public:
      -    TQPlatinumStyle();
      -    virtual ~TQPlatinumStyle();
      -
      -    // new Style Stuff
      -    void drawPrimitive( PrimitiveElement pe,
      -			TQPainter *p,
      -			const TQRect &r,
      -			const TQColorGroup &cg,
      -			SFlags flags = Style_Default,
      -			const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    void drawControl( ControlElement element,
      -		      TQPainter *p,
      -		      const TQWidget *widget,
      -		      const TQRect &r,
      -		      const TQColorGroup &cg,
      -		      SFlags how = Style_Default,
      -		      const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    void drawComplexControl( ComplexControl control,
      -			     TQPainter *p,
      -			     const TQWidget *widget,
      -			     const TQRect &r,
      -			     const TQColorGroup &cg,
      -			     SFlags how = Style_Default,
      -#ifdef Q_QDOC
      -			     SCFlags sub = SC_All,
      -#else
      -			     SCFlags sub = (uint)SC_All,
      -#endif
      -			     SCFlags subActive = SC_None,
      -			     const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    TQRect querySubControlMetrics( ComplexControl control,
      -				  const TQWidget *widget,
      -				  SubControl sc,
      -				  const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const;
      -
      -    TQRect subRect( SubRect r, const TQWidget *widget ) const;
      -
      -protected:
      -     TQColor mixedColor(const TQColor &, const TQColor &) const;
      -    void drawRiffles( TQPainter* p,  int x, int y, int w, int h,
      -		      const TQColorGroup &g, bool horizontal ) const;
      -private:	// Disabled copy constructor and operator=
      -#if defined(TQ_DISABLE_COPY)
      -    TQPlatinumStyle( const TQPlatinumStyle & );
      -    TQPlatinumStyle& operator=( const TQPlatinumStyle & );
      -#endif
      -};
      -
      -#endif // TQT_NO_STYLE_PLATINUM
      -
      -#endif // TQPLATINUMSTYLE_H
      -
      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qplatinumstyle-members.html b/doc/html/qplatinumstyle-members.html deleted file mode 100644 index 4a3685ca1..000000000 --- a/doc/html/qplatinumstyle-members.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - -TQPlatinumStyle Member List - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      Complete Member List for TQPlatinumStyle

      - -

      This is the complete list of member functions for -TQPlatinumStyle, including inherited members. - -

      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qsgistyle-h.html b/doc/html/qsgistyle-h.html deleted file mode 100644 index 0104b7641..000000000 --- a/doc/html/qsgistyle-h.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - -ntqsgistyle.h Include File - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      ntqsgistyle.h

      - -

      This is the verbatim text of the ntqsgistyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


      -
      -/****************************************************************************
      -** $Id: qt/ntqsgistyle.h   3.3.8   edited Jan 11 14:46 $
      -**
      -** Definition of SGI-like style class
      -**
      -** Created : 981231
      -**
      -** Copyright (C) 1998-2007 Trolltech ASA.  All rights reserved.
      -**
      -** This file is part of the widgets module of the TQt GUI Toolkit.
      -**
      -** This file may be used under the terms of the GNU General Public
      -** License versions 2.0 or 3.0 as published by the Free Software
      -** Foundation and appearing in the file LICENSE.GPL included in the
      -** packaging of this file. Alternatively you may (at your option) use any
      -** later version of the GNU General Public License if such license has
      -** been publicly approved by Trolltech ASA (or its successors, if any)
      -** and the KDE Free TQt Foundation.
      -**
      -** Please review the following information to ensure GNU General
      -** Public Licensing requirements will be met:
      -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
      -** If you are unsure which license is appropriate for your use, please
      -** review the following information:
      -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
      -** or contact the sales department at sales@trolltech.com.
      -**
      -** This file may be used under the terms of the Q Public License as
      -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
      -** included in the packaging of this file.  Licensees holding valid TQt
      -** Commercial licenses may use this file in accordance with the TQt
      -** Commercial License Agreement provided with the Software.
      -**
      -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
      -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
      -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
      -** herein.
      -**
      -**********************************************************************/
      -
      -#ifndef TQSGISTYLE_H
      -#define TQSGISTYLE_H
      -
      -#ifndef QT_H
      -#include "ntqmotifstyle.h"
      -#include "ntqguardedptr.h"
      -#include "tqwidget.h"
      -#endif // QT_H
      -
      -#if !defined(TQT_NO_STYLE_SGI) || defined(QT_PLUGIN)
      -
      -#if defined(QT_PLUGIN)
      -#define Q_EXPORT_STYLE_SGI
      -#else
      -#define Q_EXPORT_STYLE_SGI TQ_EXPORT
      -#endif
      -
      -class TQSGIStylePrivate;
      -
      -class Q_EXPORT_STYLE_SGI TQSGIStyle: public TQMotifStyle
      -{
      -    TQ_OBJECT
      -public:
      -    TQSGIStyle( bool useHighlightCols = FALSE );
      -    virtual ~TQSGIStyle();
      -
      -#if !defined(Q_NO_USING_KEYWORD)
      -    using TQMotifStyle::polish;
      -#endif
      -    void polish( TQWidget* );
      -    void unPolish( TQWidget* );
      -    void polish( TQApplication* );
      -    void unPolish( TQApplication* );
      -
      -    void drawPrimitive( PrimitiveElement pe,
      -			TQPainter *p,
      -			const TQRect &r,
      -			const TQColorGroup &cg,
      -			SFlags flags = Style_Default,
      -			const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    void drawControl( ControlElement element,
      -		      TQPainter *p,
      -		      const TQWidget *widget,
      -		      const TQRect &r,
      -		      const TQColorGroup &cg,
      -		      SFlags how = Style_Default,
      -		      const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    void drawComplexControl( ComplexControl control,
      -			     TQPainter *p,
      -			     const TQWidget* widget,
      -			     const TQRect& r,
      -			     const TQColorGroup& cg,
      -			     SFlags how = Style_Default,
      -#ifdef Q_QDOC
      -			     SCFlags sub = SC_All,
      -#else
      -			     SCFlags sub = (uint)SC_All,
      -#endif
      -			     SCFlags subActive = SC_None,
      -			     const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const;
      -
      -    TQSize sizeFromContents( ContentsType contents,
      -			    const TQWidget *widget,
      -			    const TQSize &contentsSize,
      -			    const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    TQRect subRect( SubRect r, const TQWidget *widget ) const;
      -    TQRect querySubControlMetrics( ComplexControl control,
      -				  const TQWidget *widget,
      -				  SubControl sc,
      -				  const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -protected:
      -    bool eventFilter( TQObject*, TQEvent*);
      -
      -private:
      -    TQSGIStylePrivate *d;
      -
      -    uint isApplicationStyle :1;
      -#if defined(TQ_DISABLE_COPY)
      -    TQSGIStyle( const TQSGIStyle & );
      -    TQSGIStyle& operator=( const TQSGIStyle & );
      -#endif
      -
      -};
      -
      -#endif // TQT_NO_STYLE_SGI
      -
      -#endif // TQSGISTYLE_H
      -
      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qsgistyle-members.html b/doc/html/qsgistyle-members.html deleted file mode 100644 index d20d96ee9..000000000 --- a/doc/html/qsgistyle-members.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -TQSGIStyle Member List - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      Complete Member List for TQSGIStyle

      - -

      This is the complete list of member functions for -TQSGIStyle, including inherited members. - -

      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qt.dcf b/doc/html/qt.dcf index 6fdbfe1bf..a7059ee45 100644 --- a/doc/html/qt.dcf +++ b/doc/html/qt.dcf @@ -819,11 +819,11 @@
      -
      - QCDEStyle - ~QCDEStyle -
      -
      +
      + TQCDEStyle + ~TQCDEStyle +
      +
      TQChar @@ -1124,10 +1124,10 @@
      -
      - QCommonStyle -
      -
      +
      + TQCommonStyle +
      +
      TQConstString @@ -4701,42 +4701,42 @@
      -
      - QMotif - applicationContext - x11Display - ~QMotif -
      -
      -
      -
      - QMotifDialog - acceptCallback - dialog - rejectCallback - shell - ~QMotifDialog -
      -
      -
      -
      - QMotifPlusStyle -
      -
      -
      -
      - QMotifStyle - setUseHighlightColors - useHighlightColors -
      -
      -
      -
      - QMotifWidget - motifWidget - ~QMotifWidget -
      -
      +
      + TQMotif + applicationContext + x11Display + ~TQMotif +
      +
      +
      +
      + TQMotifDialog + acceptCallback + dialog + rejectCallback + shell + ~TQMotifDialog +
      +
      +
      +
      + TQMotifPlusStyle +
      +
      +
      +
      + TQMotifStyle + setUseHighlightColors + useHighlightColors +
      +
      +
      +
      + TQMotifWidget + motifWidget + ~TQMotifWidget +
      +
      QMouseEvent @@ -5335,12 +5335,12 @@
      -
      - QPlatinumStyle - drawRiffles - mixedColor -
      -
      +
      + TQPlatinumStyle + drawRiffles + mixedColor +
      +
      TQPNGImagePacker @@ -6173,11 +6173,11 @@
      -
      - QSGIStyle - ~QSGIStyle -
      -
      +
      + TQSGIStyle + ~TQSGIStyle +
      +
      QShowEvent @@ -8978,10 +8978,10 @@
      -
      - QWindowsStyle -
      -
      +
      + TQWindowsStyle +
      +
      TQWizard @@ -9665,7 +9665,7 @@
      QMag
      -
      +
      motif-examples
      @@ -9950,8 +9950,8 @@
      Using Custom TQDialogs
      -
      - Using Existing Dialogs with QMotifDialog +
      + Using Existing Dialogs with TQMotifDialog
      Using menus diff --git a/doc/html/qwindowsstyle-h.html b/doc/html/qwindowsstyle-h.html deleted file mode 100644 index 17961081b..000000000 --- a/doc/html/qwindowsstyle-h.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - -ntqwindowsstyle.h Include File - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      ntqwindowsstyle.h

      - -

      This is the verbatim text of the ntqwindowsstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


      -
      -/****************************************************************************
      -** $Id: qt/ntqwindowsstyle.h   3.3.8   edited Jan 11 14:38 $
      -**
      -** Definition of Windows-like style class
      -**
      -** Created : 981231
      -**
      -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
      -**
      -** This file is part of the widgets module of the TQt GUI Toolkit.
      -**
      -** This file may be used under the terms of the GNU General Public
      -** License versions 2.0 or 3.0 as published by the Free Software
      -** Foundation and appearing in the file LICENSE.GPL included in the
      -** packaging of this file. Alternatively you may (at your option) use any
      -** later version of the GNU General Public License if such license has
      -** been publicly approved by Trolltech ASA (or its successors, if any)
      -** and the KDE Free TQt Foundation.
      -**
      -** Please review the following information to ensure GNU General
      -** Public Licensing requirements will be met:
      -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
      -** If you are unsure which license is appropriate for your use, please
      -** review the following information:
      -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
      -** or contact the sales department at sales@trolltech.com.
      -**
      -** This file may be used under the terms of the Q Public License as
      -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
      -** included in the packaging of this file.  Licensees holding valid TQt
      -** Commercial licenses may use this file in accordance with the TQt
      -** Commercial License Agreement provided with the Software.
      -**
      -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
      -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
      -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
      -** herein.
      -**
      -**********************************************************************/
      -
      -#ifndef TQWINDOWSSTYLE_H
      -#define TQWINDOWSSTYLE_H
      -
      -#ifndef QT_H
      -#include "ntqcommonstyle.h"
      -#endif // QT_H
      -
      -#if !defined(TQT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
      -
      -#if defined(QT_PLUGIN)
      -#define Q_EXPORT_STYLE_WINDOWS
      -#else
      -#define Q_EXPORT_STYLE_WINDOWS TQ_EXPORT
      -#endif
      -
      -
      -class Q_EXPORT_STYLE_WINDOWS TQWindowsStyle : public TQCommonStyle
      -{
      -    TQ_OBJECT
      -public:
      -    TQWindowsStyle();
      -    ~TQWindowsStyle();
      -
      -    void polish(TQApplication*);
      -    void unPolish(TQApplication*);
      -
      -    void polish(TQWidget*);
      -    void unPolish(TQWidget*);
      -
      -    void polish( TQPalette & );
      -
      -    virtual void polishPopupMenu( TQPopupMenu* );
      -
      -    // new stuff
      -    void drawPrimitive( PrimitiveElement pe,
      -			TQPainter *p,
      -			const TQRect &r,
      -			const TQColorGroup &cg,
      -			SFlags flags = Style_Default,
      -			const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    void drawControl( ControlElement element,
      -		      TQPainter *p,
      -		      const TQWidget *widget,
      -		      const TQRect &r,
      -		      const TQColorGroup &cg,
      -		      SFlags flags = Style_Default,
      -		      const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    void drawComplexControl( ComplexControl control,
      -			     TQPainter* p,
      -			     const TQWidget* widget,
      -			     const TQRect& r,
      -			     const TQColorGroup& cg,
      -			     SFlags flags = Style_Default,
      -#ifdef Q_QDOC
      -			     SCFlags sub = SC_All,
      -#else
      -			     SCFlags sub = (uint)SC_All,
      -#endif
      -			     SCFlags subActive = SC_None,
      -			     const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    int pixelMetric( PixelMetric metric,
      -		     const TQWidget *widget = 0 ) const;
      -
      -    TQSize sizeFromContents( ContentsType contents,
      -			    const TQWidget *widget,
      -			    const TQSize &contentsSize,
      -			    const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption & = TQStyleOption::Default,
      -		  TQStyleHintReturn* = 0) const;
      -
      -    TQPixmap stylePixmap( StylePixmap stylepixmap,
      -			 const TQWidget *widget = 0,
      -			 const TQStyleOption& = TQStyleOption::Default ) const;
      -
      -    TQRect subRect( SubRect r, const TQWidget *widget ) const;
      -
      -
      -private:
      -    class Private;
      -    Private *d;
      -
      -    // Disabled copy constructor and operator=
      -#if defined(TQ_DISABLE_COPY)
      -    TQWindowsStyle( const TQWindowsStyle & );
      -    TQWindowsStyle& operator=( const TQWindowsStyle & );
      -#endif
      -};
      -
      -#endif // TQT_NO_STYLE_WINDOWS
      -
      -#endif // TQWINDOWSSTYLE_H
      -
      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/qwindowsstyle-members.html b/doc/html/qwindowsstyle-members.html deleted file mode 100644 index d037f5e77..000000000 --- a/doc/html/qwindowsstyle-members.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - -TQWindowsStyle Member List - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      Complete Member List for TQWindowsStyle

      - -

      This is the complete list of member functions for -TQWindowsStyle, including inherited members. - -

      - -


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/themes-example.html b/doc/html/themes-example.html index a65dd25ca..545404813 100644 --- a/doc/html/themes-example.html +++ b/doc/html/themes-example.html @@ -61,10 +61,10 @@ during runtime using the pulldown menu. #ifndef TQT_NO_STYLE_WINDOWS -#include <ntqwindowsstyle.h> +#include <tqwindowsstyle.h> -class NorwegianWoodStyle : public TQWindowsStyle +class NorwegianWoodStyle : public TQWindowsStyle { public: NorwegianWoodStyle(); @@ -899,7 +899,7 @@ static int get_combo_extra_width( int h, int *return_awh = 0 ); enum { PointUp, PointDown, PointLeft, PointRight }; -NorwegianWoodStyle::NorwegianWoodStyle() : TQWindowsStyle() +NorwegianWoodStyle::NorwegianWoodStyle() : TQWindowsStyle() { } @@ -1118,7 +1118,7 @@ void NorwegianWoodStyle::unPolish( TQWindowsStyle::drawPrimitive( pe, p, r, cg, flags, opt ); + TQWindowsStyle::drawPrimitive( pe, p, r, cg, flags, opt ); break; } } @@ -1229,7 +1229,7 @@ void NorwegianWoodStyle::unPolish( TQWindowsStyle::drawControl( element, p, widget, r, cg, how, opt ); + TQWindowsStyle::drawControl( element, p, widget, r, cg, how, opt ); break; } } @@ -1250,7 +1250,7 @@ void NorwegianWoodStyle::unPolish( TQWindowsStyle::drawControlMask( element, p, widget, r, opt ); + TQWindowsStyle::drawControlMask( element, p, widget, r, opt ); break; } } @@ -1302,7 +1302,7 @@ void NorwegianWoodStyle::unPolish( TQWindowsStyle::drawComplexControl( cc, p, widget, r, cg, how, + TQWindowsStyle::drawComplexControl( cc, p, widget, r, cg, how, sub, subActive, opt ); break; } @@ -1324,7 +1324,7 @@ void NorwegianWoodStyle::unPolish( TQWindowsStyle::drawComplexControlMask( control, p, widget, r, opt ); + TQWindowsStyle::drawComplexControlMask( control, p, widget, r, opt ); break; } } @@ -1575,10 +1575,10 @@ void NorwegianWoodStyle::drawSemicircleButton( ntqwindowsstyle.h> +#include <tqwindowsstyle.h> -class MetalStyle : public TQWindowsStyle +class MetalStyle : public TQWindowsStyle { public: MetalStyle(); @@ -1669,7 +1669,7 @@ private: -MetalStyle::MetalStyle() : TQWindowsStyle() { } +MetalStyle::MetalStyle() : TQWindowsStyle() { } /*! Reimplementation from TQStyle @@ -1818,7 +1818,7 @@ void MetalStyle::unPolish( TQWindowsStyle::drawPrimitive( pe, p, r, cg, flags, opt ); + TQWindowsStyle::drawPrimitive( pe, p, r, cg, flags, opt ); break; } } @@ -1922,7 +1922,7 @@ void MetalStyle::unPolish( TQWindowsStyle::drawControl( element, p, widget, r, cg, how, opt ); + TQWindowsStyle::drawControl( element, p, widget, r, cg, how, opt ); break; } } @@ -1970,7 +1970,7 @@ void MetalStyle::unPolish( TQWindowsStyle::drawComplexControl( cc, p, widget, r, cg, how, sub, subActive, + TQWindowsStyle::drawComplexControl( cc, p, widget, r, cg, how, sub, subActive, opt ); break; } @@ -2344,7 +2344,7 @@ void Themes::aboutTQt() *****************************************************************************/ #include <ntqapplication.h> -#include <ntqwindowsstyle.h> +#include <tqwindowsstyle.h> #include "themes.h" #include "metal.h" diff --git a/doc/html/titleindex b/doc/html/titleindex index 81b75c506..cc490b64c 100644 --- a/doc/html/titleindex +++ b/doc/html/titleindex @@ -182,8 +182,8 @@ TQButtonGroup Class | tqbuttongroup.html TQButtonGroup Member List | tqbuttongroup-members.html TQByteArray Class | tqbytearray.html TQByteArray Member List | tqbytearray-members.html -QCDEStyle Class | ntqcdestyle.html -QCDEStyle Member List | qcdestyle-members.html +TQCDEStyle Class | tqcdestyle.html +TQCDEStyle Member List | tqcdestyle-members.html TQCString Class | tqcstring.html TQCString Member List | tqcstring-members.html TQCache Class | tqcache.html @@ -246,8 +246,8 @@ TQComboBox Class | tqcombobox.html TQComboBox Member List | tqcombobox-members.html TQComboTableItem Class | tqcombotableitem.html TQComboTableItem Member List | tqcombotableitem-members.html -QCommonStyle Class | ntqcommonstyle.html -QCommonStyle Member List | qcommonstyle-members.html +TQCommonStyle Class | tqcommonstyle.html +TQCommonStyle Member List | tqcommonstyle-members.html TQConstString Class | tqconststring.html TQConstString Member List | tqconststring-members.html QContextMenuEvent Class | qcontextmenuevent.html @@ -560,17 +560,17 @@ TQMimeSource Class | tqmimesource.html TQMimeSource Member List | tqmimesource-members.html TQMimeSourceFactory Class | tqmimesourcefactory.html TQMimeSourceFactory Member List | tqmimesourcefactory-members.html -QMotif Class | qmotif.html -QMotif Member List | qmotif-members.html -QMotif Support Extension | motif-examples.html -QMotifDialog Class | qmotifdialog.html -QMotifDialog Member List | qmotifdialog-members.html -QMotifPlusStyle Class | ntqmotifplusstyle.html -QMotifPlusStyle Member List | qmotifplusstyle-members.html -QMotifStyle Class | ntqmotifstyle.html -QMotifStyle Member List | qmotifstyle-members.html -QMotifWidget Class | qmotifwidget.html -QMotifWidget Member List | qmotifwidget-members.html +TQMotif Class | tqmotif.html +TQMotif Member List | tqmotif-members.html +TQMotif Support Extension | motif-examples.html +TQMotifDialog Class | tqmotifdialog.html +TQMotifDialog Member List | tqmotifdialog-members.html +TQMotifPlusStyle Class | tqmotifplusstyle.html +TQMotifPlusStyle Member List | tqmotifplusstyle-members.html +TQMotifStyle Class | tqmotifstyle.html +TQMotifStyle Member List | tqmotifstyle-members.html +TQMotifWidget Class | tqmotifwidget.html +TQMotifWidget Member List | tqmotifwidget-members.html QMouseEvent Class | qmouseevent.html QMouseEvent Member List | qmouseevent-members.html QMoveEvent Class | qmoveevent.html @@ -625,8 +625,8 @@ TQPixmap Class | tqpixmap.html TQPixmap Member List | tqpixmap-members.html TQPixmapCache Class | tqpixmapcache.html TQPixmapCache Member List | tqpixmapcache-members.html -QPlatinumStyle Class | ntqplatinumstyle.html -QPlatinumStyle Member List | qplatinumstyle-members.html +TQPlatinumStyle Class | tqplatinumstyle.html +TQPlatinumStyle Member List | tqplatinumstyle-members.html TQPoint Class | tqpoint.html TQPoint Member List | tqpoint-members.html TQPointArray Class | tqpointarray.html @@ -674,8 +674,8 @@ TQRegion Class | tqregion.html TQRegion Member List | tqregion-members.html QResizeEvent Class | qresizeevent.html QResizeEvent Member List | qresizeevent-members.html -QSGIStyle Class | ntqsgistyle.html -QSGIStyle Member List | qsgistyle-members.html +TQSGIStyle Class | tqsgistyle.html +TQSGIStyle Member List | tqsgistyle-members.html TQScrollBar Class | tqscrollbar.html TQScrollBar Member List | tqscrollbar-members.html TQScrollView Class | tqscrollview.html @@ -902,8 +902,8 @@ TQWidgetStack Class | tqwidgetstack.html TQWidgetStack Member List | tqwidgetstack-members.html TQWindowsMime Class | tqwindowsmime.html TQWindowsMime Member List | tqwindowsmime-members.html -QWindowsStyle Class | ntqwindowsstyle.html -QWindowsStyle Member List | qwindowsstyle-members.html +TQWindowsStyle Class | tqwindowsstyle.html +TQWindowsStyle Member List | tqwindowsstyle-members.html TQWizard Class | tqwizard.html TQWizard Member List | tqwizard-members.html TQWorkspace Class | tqworkspace.html @@ -1033,7 +1033,7 @@ Trivial Example | trivial-nsplugin-example.html Tutorial #2 | tutorial2.html User Interface Compiler (uic) | uic.html Using Custom TQDialogs | motif-walkthrough-4.html -Using Existing Dialogs with QMotifDialog | motif-walkthrough-5.html +Using Existing Dialogs with TQMotifDialog | motif-walkthrough-5.html Using TQt Main Window Classes | motif-walkthrough-6.html Using TQt Standard Dialogs | motif-walkthrough-3.html Using menus | menu-example.html @@ -1089,13 +1089,13 @@ tqbutton.h Include File | tqbutton-h.html tqbuttongroup.h Include File | tqbuttongroup-h.html tqcache.h Include File | tqcache-h.html tqcanvas.h Include File | tqcanvas-h.html -ntqcdestyle.h Include File | qcdestyle-h.html +tqcdestyle.h Include File | tqcdestyle-h.html tqcheckbox.h Include File | tqcheckbox-h.html tqclipboard.h Include File | tqclipboard-h.html tqcolor.h Include File | tqcolor-h.html tqcolordialog.h Include File | tqcolordialog-h.html tqcombobox.h Include File | tqcombobox-h.html -ntqcommonstyle.h Include File | qcommonstyle-h.html +tqcommonstyle.h Include File | tqcommonstyle-h.html tqcstring.h Include File | tqcstring-h.html ntqcursor.h Include File | qcursor-h.html tqdatabrowser.h Include File | tqdatabrowser-h.html @@ -1175,11 +1175,11 @@ tqmenudata.h Include File | tqmenudata-h.html ntqmessagebox.h Include File | qmessagebox-h.html ntqmetaobject.h Include File | qmetaobject-h.html tqmime.h Include File | tqmime-h.html -qmotif.h Include File | qmotif-h.html -qmotifdialog.h Include File | qmotifdialog-h.html -ntqmotifplusstyle.h Include File | qmotifplusstyle-h.html -ntqmotifstyle.h Include File | qmotifstyle-h.html -qmotifwidget.h Include File | qmotifwidget-h.html +tqmotif.h Include File | tqmotif-h.html +tqmotifdialog.h Include File | tqmotifdialog-h.html +tqmotifplusstyle.h Include File | tqmotifplusstyle-h.html +tqmotifstyle.h Include File | tqmotifstyle-h.html +tqmotifwidget.h Include File | tqmotifwidget-h.html tqmovie.h Include File | tqmovie-h.html tqmultilineedit.h Include File | tqmultilineedit-h.html tqmutex.h Include File | tqmutex-h.html @@ -1199,7 +1199,7 @@ tqpen.h Include File | tqpen-h.html tqpicture.h Include File | tqpicture-h.html tqpixmap.h Include File | tqpixmap-h.html tqpixmapcache.h Include File | tqpixmapcache-h.html -ntqplatinumstyle.h Include File | qplatinumstyle-h.html +tqplatinumstyle.h Include File | tqplatinumstyle-h.html tqpngio.h Include File | tqpngio-h.html tqpoint.h Include File | tqpoint-h.html tqpointarray.h Include File | tqpointarray-h.html @@ -1227,7 +1227,7 @@ tqsemaphore.h Include File | tqsemaphore-h.html tqserversocket.h Include File | tqserversocket-h.html tqsessionmanager.h Include File | tqsessionmanager-h.html tqsettings.h Include File | tqsettings-h.html -ntqsgistyle.h Include File | qsgistyle-h.html +tqsgistyle.h Include File | tqsgistyle-h.html tqsignal.h Include File | tqsignal-h.html tqsignalmapper.h Include File | tqsignalmapper-h.html tqsimplerichtext.h Include File | tqsimplerichtext-h.html @@ -1305,7 +1305,7 @@ tqwidgetfactory.h Include File | tqwidgetfactory-h.html tqwidgetplugin.h Include File | tqwidgetplugin-h.html tqwidgetstack.h Include File | tqwidgetstack-h.html ntqwindowdefs.h Include File | qwindowdefs-h.html -ntqwindowsstyle.h Include File | qwindowsstyle-h.html +tqwindowsstyle.h Include File | tqwindowsstyle-h.html tqwizard.h Include File | tqwizard-h.html tqwmatrix.h Include File | tqwmatrix-h.html tqworkspace.h Include File | tqworkspace-h.html diff --git a/doc/html/tqcdestyle-h.html b/doc/html/tqcdestyle-h.html new file mode 100644 index 000000000..3e8308c40 --- /dev/null +++ b/doc/html/tqcdestyle-h.html @@ -0,0 +1,131 @@ + + + + + +tqcdestyle.h Include File + + + + + + + +
      + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

      tqcdestyle.h

      + +

      This is the verbatim text of the tqcdestyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


      +
      +/****************************************************************************
      +** $Id: qt/tqcdestyle.h   3.3.8   edited Jan 11 14:46 $
      +**
      +** Definition of the CDE-like style class
      +**
      +** Created : 990513
      +**
      +** Copyright (C) 1999-2007 Trolltech ASA.  All rights reserved.
      +**
      +** This file is part of the widgets module of the TQt GUI Toolkit.
      +**
      +** This file may be used under the terms of the GNU General Public
      +** License versions 2.0 or 3.0 as published by the Free Software
      +** Foundation and appearing in the file LICENSE.GPL included in the
      +** packaging of this file. Alternatively you may (at your option) use any
      +** later version of the GNU General Public License if such license has
      +** been publicly approved by Trolltech ASA (or its successors, if any)
      +** and the KDE Free TQt Foundation.
      +**
      +** Please review the following information to ensure GNU General
      +** Public Licensing requirements will be met:
      +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
      +** If you are unsure which license is appropriate for your use, please
      +** review the following information:
      +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
      +** or contact the sales department at sales@trolltech.com.
      +**
      +** This file may be used under the terms of the Q Public License as
      +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
      +** included in the packaging of this file.  Licensees holding valid TQt
      +** Commercial licenses may use this file in accordance with the TQt
      +** Commercial License Agreement provided with the Software.
      +**
      +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
      +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
      +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
      +** herein.
      +**
      +**********************************************************************/
      +
      +
      +#ifndef TQCDESTYLE_H
      +#define TQCDESTYLE_H
      +
      +#ifndef QT_H
      +#include "tqmotifstyle.h"
      +#endif // QT_H
      +
      +#if !defined(TQT_NO_STYLE_CDE) || defined(QT_PLUGIN)
      +
      +#if defined(QT_PLUGIN)
      +#define Q_EXPORT_STYLE_CDE
      +#else
      +#define Q_EXPORT_STYLE_CDE TQ_EXPORT
      +#endif
      +
      +class Q_EXPORT_STYLE_CDE TQCDEStyle : public TQMotifStyle
      +{
      +    TQ_OBJECT
      +public:
      +
      +    TQCDEStyle( bool useHighlightCols = FALSE );
      +    virtual ~TQCDEStyle();
      +
      +    int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const;
      +
      +    void drawControl( ControlElement element,
      +		      TQPainter *p,
      +		      const TQWidget *widget,
      +		      const TQRect &r,
      +		      const TQColorGroup &cg,
      +		      SFlags how = Style_Default,
      +		      const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +    void drawPrimitive( PrimitiveElement pe,
      +			TQPainter *p,
      +			const TQRect &r,
      +			const TQColorGroup &cg,
      +			SFlags flags = Style_Default,
      +			const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +};
      +
      +#endif // TQT_NO_STYLE_CDE
      +
      +#endif // TQCDESTYLE_H
      +
      + +


      + +
      Copyright © 2007 +TrolltechTrademarks +
      TQt 3.3.8
      +
      + diff --git a/doc/html/tqcdestyle-members.html b/doc/html/tqcdestyle-members.html new file mode 100644 index 000000000..fd454e099 --- /dev/null +++ b/doc/html/tqcdestyle-members.html @@ -0,0 +1,113 @@ + + + + + +TQCDEStyle Member List + + + + + + + +
      + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

      Complete Member List for TQCDEStyle

      + +

      This is the complete list of member functions for +TQCDEStyle, including inherited members. + +

      + +


      + +
      Copyright © 2007 +TrolltechTrademarks +
      TQt 3.3.8
      +
      + diff --git a/doc/html/tqcdestyle.html b/doc/html/tqcdestyle.html new file mode 100644 index 000000000..5db7db604 --- /dev/null +++ b/doc/html/tqcdestyle.html @@ -0,0 +1,83 @@ + + + + + +TQCDEStyle Class + + + + + + + +
      + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

      TQCDEStyle Class Reference

      + +

      The TQCDEStyle class provides a CDE look and feel. +More... +

      #include <tqcdestyle.h> +

      Inherits TQMotifStyle. +

      List of all member functions. +

      Public Members

      + +

      Detailed Description

      + + +The TQCDEStyle class provides a CDE look and feel. +

      +

      This style provides a slightly improved Motif look similar to some +versions of the Common Desktop Environment (CDE). The main +differences are thinner frames and more modern radio buttons and +checkboxes. Together with a dark background and a bright +text/foreground color, the style looks quite attractive (at least +for Motif fans). +

      Note that the functions provided by TQCDEStyle are +reimplementations of TQStyle functions; see TQStyle for their +documentation. +

      See also Widget Appearance and Style. + +


      Member Function Documentation

      +

      TQCDEStyle::TQCDEStyle ( bool useHighlightCols = FALSE ) +

      +Constructs a TQCDEStyle. +

      If useHighlightCols is FALSE (the default), then the style will +polish the application's color palette to emulate the Motif way of +highlighting, which is a simple inversion between the base and the +text color. + +

      TQCDEStyle::~TQCDEStyle () [virtual] +

      +Destroys the style. + + +

      +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


      + +
      Copyright © 2007 +TrolltechTrademarks +
      TQt 3.3.8
      +
      + diff --git a/doc/html/tqcommonstyle-h.html b/doc/html/tqcommonstyle-h.html new file mode 100644 index 000000000..5f0f6caf0 --- /dev/null +++ b/doc/html/tqcommonstyle-h.html @@ -0,0 +1,182 @@ + + + + + +tqcommonstyle.h Include File + + + + + + + +
      + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

      tqcommonstyle.h

      + +

      This is the verbatim text of the tqcommonstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


      +
      +/****************************************************************************
      +** $Id: qt/tqcommonstyle.h   3.3.8   edited Jan 11 14:38 $
      +**
      +** Definition of TQCommonStyle class
      +**
      +** Created : 980616
      +**
      +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
      +**
      +** This file is part of the widgets module of the TQt GUI Toolkit.
      +**
      +** This file may be used under the terms of the GNU General Public
      +** License versions 2.0 or 3.0 as published by the Free Software
      +** Foundation and appearing in the file LICENSE.GPL included in the
      +** packaging of this file. Alternatively you may (at your option) use any
      +** later version of the GNU General Public License if such license has
      +** been publicly approved by Trolltech ASA (or its successors, if any)
      +** and the KDE Free TQt Foundation.
      +**
      +** Please review the following information to ensure GNU General
      +** Public Licensing requirements will be met:
      +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
      +** If you are unsure which license is appropriate for your use, please
      +** review the following information:
      +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
      +** or contact the sales department at sales@trolltech.com.
      +**
      +** This file may be used under the terms of the Q Public License as
      +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
      +** included in the packaging of this file.  Licensees holding valid TQt
      +** Commercial licenses may use this file in accordance with the TQt
      +** Commercial License Agreement provided with the Software.
      +**
      +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
      +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
      +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
      +** herein.
      +**
      +**********************************************************************/
      +
      +#ifndef TQCOMMONSTYLE_H
      +#define TQCOMMONSTYLE_H
      +
      +#ifndef QT_H
      +#include "tqstyle.h"
      +#endif // QT_H
      +
      +#ifndef TQT_NO_STYLE
      +
      +class TQ_EXPORT TQCommonStyle: public TQStyle
      +{
      +    TQ_OBJECT
      +
      +public:
      +    TQCommonStyle();
      +    ~TQCommonStyle();
      +
      +    void drawPrimitive( PrimitiveElement pe,
      +			TQPainter *p,
      +			const TQRect &r,
      +			const TQColorGroup &cg,
      +			SFlags flags = Style_Default,
      +			const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +    void drawControl( ControlElement element,
      +		      TQPainter *p,
      +		      const TQWidget *widget,
      +		      const TQRect &r,
      +		      const TQColorGroup &cg,
      +		      SFlags how = Style_Default,
      +		      const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +    void drawControlMask( ControlElement element,
      +			  TQPainter *p,
      +			  const TQWidget *widget,
      +			  const TQRect &r,
      +			  const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +    TQRect subRect( SubRect r, const TQWidget *widget ) const;
      +
      +    void drawComplexControl( ComplexControl control,
      +			     TQPainter *p,
      +			     const TQWidget *widget,
      +			     const TQRect &r,
      +			     const TQColorGroup &cg,
      +			     SFlags how = Style_Default,
      +#ifdef Q_QDOC
      +			     SCFlags sub = SC_All,
      +#else
      +			     SCFlags sub = (uint)SC_All,
      +#endif
      +			     SCFlags subActive = SC_None,
      +			     const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +    void drawComplexControlMask( ComplexControl control,
      +				 TQPainter *p,
      +				 const TQWidget *widget,
      +				 const TQRect &r,
      +				 const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +    TQRect querySubControlMetrics( ComplexControl control,
      +				  const TQWidget *widget,
      +				  SubControl sc,
      +				  const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +    SubControl querySubControl( ComplexControl control,
      +				const TQWidget *widget,
      +				const TQPoint &pos,
      +				const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +    int pixelMetric( PixelMetric m, const TQWidget *widget = 0 ) const;
      +
      +    TQSize sizeFromContents( ContentsType s,
      +			    const TQWidget *widget,
      +			    const TQSize &contentsSize,
      +			    const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +    int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption &, TQStyleHintReturn *) const;
      +
      +    TQPixmap stylePixmap( StylePixmap sp,
      +			 const TQWidget *widget = 0,
      +			 const TQStyleOption& = TQStyleOption::Default ) const;
      +
      +
      +private:
      +    // Disabled copy constructor and operator=
      +#if defined(TQ_DISABLE_COPY)
      +    TQCommonStyle( const TQCommonStyle & );
      +    TQCommonStyle &operator=( const TQCommonStyle & );
      +#endif
      +};
      +
      +
      +
      +#endif // TQT_NO_STYLE
      +
      +#endif // TQCOMMONSTYLE_H
      +
      + +


      + +
      Copyright © 2007 +TrolltechTrademarks +
      TQt 3.3.8
      +
      + diff --git a/doc/html/tqcommonstyle-members.html b/doc/html/tqcommonstyle-members.html new file mode 100644 index 000000000..4409f80af --- /dev/null +++ b/doc/html/tqcommonstyle-members.html @@ -0,0 +1,110 @@ + + + + + +TQCommonStyle Member List + + + + + + + +
      + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

      Complete Member List for TQCommonStyle

      + +

      This is the complete list of member functions for +TQCommonStyle, including inherited members. + +

      + +


      + +
      Copyright © 2007 +TrolltechTrademarks +
      TQt 3.3.8
      +
      + diff --git a/doc/html/tqcommonstyle.html b/doc/html/tqcommonstyle.html new file mode 100644 index 000000000..812a8462a --- /dev/null +++ b/doc/html/tqcommonstyle.html @@ -0,0 +1,70 @@ + + + + + +TQCommonStyle Class + + + + + + + +
      + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

      TQCommonStyle Class Reference

      + +

      The TQCommonStyle class encapsulates the common Look and Feel of a GUI. +More... +

      #include <tqcommonstyle.h> +

      Inherits TQStyle. +

      Inherited by TQMotifStyle and TQWindowsStyle. +

      List of all member functions. +

      Public Members

      + +

      Detailed Description

      + + +The TQCommonStyle class encapsulates the common Look and Feel of a GUI. +

      +

      This abstract class implements some of the widget's look and feel +that is common to all GUI styles provided and shipped as part of +TQt. +

      All the functions are documented in TQStyle. +

      See also Widget Appearance and Style. + +


      Member Function Documentation

      +

      TQCommonStyle::TQCommonStyle () +

      +Constructs a TQCommonStyle. + + +

      +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


      + +
      Copyright © 2007 +TrolltechTrademarks +
      TQt 3.3.8
      +
      + diff --git a/doc/html/tqdialog.html b/doc/html/tqdialog.html index 91a26d6b2..4aedd0233 100644 --- a/doc/html/tqdialog.html +++ b/doc/html/tqdialog.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

      #include <tqdialog.h>

      Inherits TQWidget. -

      Inherited by TQColorDialog, TQErrorMessage, TQFileDialog, TQFontDialog, TQInputDialog, TQMessageBox, TQMotifDialog, TQProgressDialog, TQTabDialog, and TQWizard. +

      Inherited by TQColorDialog, TQErrorMessage, TQFileDialog, TQFontDialog, TQInputDialog, TQMessageBox, TQMotifDialog, TQProgressDialog, TQTabDialog, and TQWizard.

      List of all member functions.

      Public Members

        diff --git a/doc/html/tqeventloop.html b/doc/html/tqeventloop.html index e2373c53e..29cbf66a0 100644 --- a/doc/html/tqeventloop.html +++ b/doc/html/tqeventloop.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

        #include <tqeventloop.h>

        Inherits TQObject. -

        Inherited by TQMotif. +

        Inherited by TQMotif.

        List of all member functions.

        Public Members

          diff --git a/doc/html/tqmotif-h.html b/doc/html/tqmotif-h.html new file mode 100644 index 000000000..7c8ab65ef --- /dev/null +++ b/doc/html/tqmotif-h.html @@ -0,0 +1,112 @@ + + + + + +tqmotif.h Include File + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          tqmotif.h

          + +

          This is the verbatim text of the tqmotif.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


          +
          +/****************************************************************************
          +** $Id: qt/tqmotif.h   3.3.8   edited Jan 11 14:37 $
          +**
          +** Definition of TQt extension classes for Xt/Motif support.
          +**
          +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
          +**
          +** This file is part of the TQt extension for Xt/Motif support.
          +**
          +** Licensees holding valid TQt Enterprise Edition licenses for X11 may use
          +** this file in accordance with the TQt Commercial License Agreement provided
          +** with the Software.
          +**
          +** This file is not available for use under any other license without
          +** express written permission from the copyright holder.
          +**
          +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
          +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
          +**
          +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
          +**   information about TQt Commercial License Agreements.
          +**
          +** Contact info@trolltech.com if any conditions of this licensing are
          +** not clear to you.
          +**
          +**********************************************************************/
          +
          +#ifndef TQMOTIF_H
          +#define TQMOTIF_H
          +
          +#include <tqeventloop.h>
          +
          +#include <X11/Intrinsic.h>
          +
          +class TQMotifPrivate;
          +
          +class TQMotif : public TQEventLoop
          +{
          +    TQ_OBJECT
          +
          +public:
          +    TQMotif( const char *applicationClass, XtAppContext context = NULL, XrmOptionDescRec *options = 0, int numOptions = 0);
          +    ~TQMotif();
          +
          +    XtAppContext applicationContext() const;
          +
          +    void registerSocketNotifier( TQSocketNotifier * );
          +    void unregisterSocketNotifier( TQSocketNotifier * );
          +    void wakeUp();
          +
          +    static void registerWidget( TQWidget* );
          +    static void unregisterWidget( TQWidget* );
          +    static bool redeliverEvent( XEvent *event );
          +
          +    static Display *x11Display();
          +    static XEvent* lastEvent();
          +
          +protected:
          +    bool processEvents( ProcessEventsFlags flags );
          +
          +private:
          +    void appStartingUp();
          +    void appClosingDown();
          +    TQMotifPrivate *d;
          +};
          +
          +#endif // TQMOTIF_H
          +
          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotif-members.html b/doc/html/tqmotif-members.html new file mode 100644 index 000000000..23d5c57fd --- /dev/null +++ b/doc/html/tqmotif-members.html @@ -0,0 +1,108 @@ + + + + + +TQMotif Member List + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          Complete Member List for TQMotif

          + +

          This is the complete list of member functions for +TQMotif, including inherited members. + +

          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotif.html b/doc/html/tqmotif.html new file mode 100644 index 000000000..0edb91e3b --- /dev/null +++ b/doc/html/tqmotif.html @@ -0,0 +1,115 @@ + + + + + +TQMotif Class + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          TQMotif Class Reference

          + +

          The TQMotif class provides the basis of the Motif Extension. +More... +

          This class is part of the TQt Motif Extension. +

          #include <tqmotif.h> +

          Inherits TQEventLoop. +

          List of all member functions. +

          Public Members

          +
            +
          • TQMotif ( const char * applicationClass, XtAppContext context = NULL, XrmOptionDescRec * options = 0, int numOptions = 0 )
          • +
          • ~TQMotif ()
          • +
          • XtAppContext applicationContext () const
          • +
          +

          Static Public Members

          + +

          Detailed Description

          +

          This class is defined in the TQt Motif Extension, which can be found in the qt/extensions directory. It is not included in the main TQt API. +

          + +The TQMotif class provides the basis of the Motif Extension. + +

          +

          TQMotif only provides a few public functions, but it is at the +heart of the integration. TQMotif is responsible for initializing +the Xt toolkit and the Xt application context. It does not open a +connection to the X server, that is done by TQApplication. +

          The only member function in TQMotif that depends on an X server +connection is TQMotif::initialize(). TQMotif must be created before +TQApplication. +

          Example usage of TQMotif and TQApplication: +

          +    static char *resources[] = {
          +        ...
          +    };
          +
          +    int main(int argc, char **argv)
          +    {
          +        TQMotif integrator( "AppClass" );
          +        XtAppSetFallbackResources( integrator.applicationContext(),
          +                                   resources );
          +        TQApplication app( argc, argv );
          +
          +        ...
          +
          +        return app.exec();
          +    }
          +    
          + + +

          Member Function Documentation

          +

          TQMotif::TQMotif ( const char * applicationClass, XtAppContext context = NULL, XrmOptionDescRec * options = 0, int numOptions = 0 ) +

          +Creates TQMotif, which allows TQt and Xt/Motif integration. +

          If context is 0, TQMotif creates a default application context +itself. The context is accessible through applicationContext(). +

          All arguments passed to this function (applicationClass, options and numOptions) are used to call XtDisplayInitialize() +after TQApplication has been constructed. + +

          TQMotif::~TQMotif () +

          +Destroys TQMotif. + +

          XtAppContext TQMotif::applicationContext () const +

          +Returns the application context. + +

          Display * TQMotif::x11Display () [static] +

          +Returns the X11 display connection used by the TQt Motif Extension. + + +

          +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifdialog-h.html b/doc/html/tqmotifdialog-h.html new file mode 100644 index 000000000..81ce20873 --- /dev/null +++ b/doc/html/tqmotifdialog-h.html @@ -0,0 +1,153 @@ + + + + + +tqmotifdialog.h Include File + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          tqmotifdialog.h

          + +

          This is the verbatim text of the tqmotifdialog.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


          +
          +/****************************************************************************
          +** $Id: qt/tqmotifdialog.h   3.3.8   edited Jan 11 14:37 $
          +**
          +** Definition of TQt extension classes for Xt/Motif support.
          +**
          +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
          +**
          +** This file is part of the TQt extension for Xt/Motif support.
          +**
          +** Licensees holding valid TQt Enterprise Edition licenses for X11 may use
          +** this file in accordance with the TQt Commercial License Agreement provided
          +** with the Software.
          +**
          +** This file is not available for use under any other license without
          +** express written permission from the copyright holder.
          +**
          +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
          +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
          +**
          +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
          +**   information about TQt Commercial License Agreements.
          +**
          +** Contact info@trolltech.com if any conditions of this licensing are
          +** not clear to you.
          +**
          +**********************************************************************/
          +
          +#ifndef TQMOTIFDIALOG_H
          +#define TQMOTIFDIALOG_H
          +
          +#include <tqdialog.h>
          +
          +#include <X11/Intrinsic.h>
          +#include <Xm/Xm.h>
          +
          +class TQMotifWidget;
          +class TQMotifDialogPrivate;
          +
          +class TQMotifDialog : public TQDialog
          +{
          +    TQ_OBJECT
          +
          +public:
          +    // obsolete
          +    enum DialogType {
          +	Prompt,
          +	Selection,
          +	Command,
          +	FileSelection,
          +	Template,
          +	Error,
          +	Information,
          +	Message,
          +	Question,
          +	Warning,
          +	Working
          +    };
          +    // obsolete
          +    TQMotifDialog( DialogType dialogtype,
          +		  Widget parent, ArgList args = NULL, Cardinal argcount = 0,
          +		  const char *name = 0, bool modal = FALSE, WFlags flags = 0 );
          +    // obsolete
          +    TQMotifDialog( Widget parent, ArgList args = NULL, Cardinal argcount = 0,
          +		  const char *name = 0, bool modal = FALSE, WFlags flags = 0 );
          +
          +    TQMotifDialog( Widget parent, const char *name = 0,
          +		  bool modal = FALSE, WFlags flags = 0 );
          +    TQMotifDialog( TQWidget *parent, const char *name = 0,
          +		  bool modal = FALSE, WFlags flags = 0 );
          +
          +    virtual ~TQMotifDialog();
          +
          +    Widget shell() const;
          +    Widget dialog() const;
          +
          +    void show();
          +    void hide();
          +
          +    static void acceptCallback( Widget, XtPointer, XtPointer );
          +    static void rejectCallback( Widget, XtPointer, XtPointer );
          +
          +public slots:
          +    void accept();
          +    void reject();
          +
          +protected:
          +    bool event( TQEvent * );
          +
          +#if !defined(Q_NO_USING_KEYWORD)
          +    using TQObject::insertChild;
          +#endif
          +
          +private:
          +    TQMotifDialogPrivate *d;
          +
          +    void init( Widget parent = NULL, ArgList args = NULL, Cardinal argcount = 0);
          +
          +    void realize( Widget w );
          +    void insertChild( Widget w );
          +    void deleteChild( Widget w );
          +
          +    friend void qmotif_dialog_realize( Widget, XtValueMask *, XSetWindowAttributes *);
          +    friend void qmotif_dialog_insert_child( Widget );
          +    friend void qmotif_dialog_delete_child( Widget );
          +    friend void qmotif_dialog_change_managed( Widget );
          +};
          +
          +#endif // TQMOTIFDIALOG_H
          +
          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifdialog-members.html b/doc/html/tqmotifdialog-members.html new file mode 100644 index 000000000..35c070627 --- /dev/null +++ b/doc/html/tqmotifdialog-members.html @@ -0,0 +1,355 @@ + + + + + +TQMotifDialog Member List + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          Complete Member List for TQMotifDialog

          + +

          This is the complete list of member functions for +TQMotifDialog, including inherited members. + +

          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifdialog.html b/doc/html/tqmotifdialog.html new file mode 100644 index 000000000..998143e9c --- /dev/null +++ b/doc/html/tqmotifdialog.html @@ -0,0 +1,205 @@ + + + + + +TQMotifDialog Class + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          TQMotifDialog Class Reference

          + +

          The TQMotifDialog class provides the TQDialog API for Motif-based dialogs. +More... +

          This class is part of the TQt Motif Extension. +

          #include <tqmotifdialog.h> +

          Inherits TQDialog. +

          List of all member functions. +

          Public Members

          +
            +
          • enum DialogType { Prompt, Selection, Command, FileSelection, Template, Error, Information, Message, Question, Warning, Working }  (obsolete)
          • +
          • TQMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )  (obsolete)
          • +
          • TQMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )  (obsolete)
          • +
          • TQMotifDialog ( Widget parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )
          • +
          • TQMotifDialog ( TQWidget * parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )
          • +
          • virtual ~TQMotifDialog ()
          • +
          • Widget shell () const
          • +
          • Widget dialog () const
          • +
          +

          Static Public Members

          + +

          Detailed Description

          +

          This class is defined in the TQt Motif Extension, which can be found in the qt/extensions directory. It is not included in the main TQt API. +

          + +The TQMotifDialog class provides the TQDialog API for Motif-based dialogs. + +

          +

          TQMotifDialog provides two separate modes of operation. The +application programmer can use TQMotifDialog with an existing +Motif-based dialog and a TQWidget parent, or the application +programmer can use TQMotifDialog with a custom TQt-based dialog and +a Motif-based parent. Modality continues to work as expected. +

          Motif-based dialogs must have a Shell widget parent with a +single child, due to requirements of the Motif toolkit. The Shell widget, which is a special subclass of XmDialogShell, is +created during construction. It can be accessed using the shell() +member function. +

          The single child of the Shell can be accessed using the +dialog() member function after it has been created. +

          The acceptCallback() and rejectCallback() functions provide a +convenient way to call TQDialog::accept() and TQDialog::reject() +through callbacks. A pointer to the TQMotifDialog should be passed +as the client_data argument to the callback. +

          The API and behavior TQMotifDialog is identical to that of TQDialog +when using a custom TQt-based dialog with a Motif-based parent. +The only difference is that a Motif-based parent argument is +passed to the constructor, instead of a TQWidget parent. + +


          Member Type Documentation

          +

          TQMotifDialog::DialogType

          This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

          +

          This enum lists the predefined Motif dialog types. +

            +
          • TQMotifDialog::Prompt +
          • TQMotifDialog::Selection +
          • TQMotifDialog::Command +
          • TQMotifDialog::FileSelection +
          • TQMotifDialog::Template +
          • TQMotifDialog::Error +
          • TQMotifDialog::Information +
          • TQMotifDialog::Message +
          • TQMotifDialog::Question +
          • TQMotifDialog::Warning +
          • TQMotifDialog::Working +
          +

          Member Function Documentation

          +

          TQMotifDialog::TQMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) +

          This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

          Creates a TQMotifDialog using one of the predefined Motif dialog +types. The name, modal and flags arguments are passed to +the TQDialog constructor. +

          This constructor creates a Shell widget, which is a special +subclass of XmDialogShell. The parent, args and argcount +arguments are passed to XtCreatePopupShell() when creating the +subclass. You can access the Shell widget with the shell() member +function. +

          This constructor also creates the dialog widget with the Shell +widget as its parent. The type of the dialog created is specified +by the dialogtype argument. See the DialogType enum for a list +of available dialog types. You can access the dialog widget with +the dialog() member function. +

          Warning: TQMotifDialog takes ownership of the child widget and +destroys it during destruction. You should not destroy the dialog +widget yourself. +

          See also DialogType, shell(), and dialog(). + +

          TQMotifDialog::TQMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) +

          This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

          Creates a TQMotifDialog which allows the application programmer to +use the Motif-based parent for a custom TQDialog. The name, +modal and flags arguments are passed to the TQDialog +constructor. +

          This constructor creates a Shell widget, which is a special +subclass of XmDialogShell. The args and argcount arguments +are passed to XtCreatePopupShell() when creating the subclass. +You can access the Shell widget with the shell() member function. +

          The dialog widget is not created by the constructor. You must +create the dialog widget as a child of the the widget returned by +shell(). You can access the child widget with the dialog() member +function. +

          A dialog widget is not created by this constructor. Instead, you +should create the dialog widget as a child of this +dialog. TQMotifDialog will take ownership of your custom dialog, +and you can access it with the dialog() member function. +

          Warning: TQMotifDialog takes ownership of the child widget and +destroys it during destruction. You should not destroy the dialog +widget yourself. +

          See also shell() and dialog(). + +

          TQMotifDialog::TQMotifDialog ( Widget parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) +

          +Creates a TQMotifDialog which allows the application programmer to +use the Motif-based parent for a custom TQDialog. The name, +modal and flags arguments are passed to the TQDialog +constructor. +

          This constructor creates a Shell widget, which is a special +subclass of XmDialogShell. You can access the Shell widget +with the shell() member function. +

          See also shell(). + +

          TQMotifDialog::TQMotifDialog ( TQWidget * parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) +

          +Creates a TQMotifDialog which allows the application programmer to +use a TQWidget parent for an existing Motif-based dialog. The parent, name, modal and flags arguments are passed to the +TQDialog constructor. +

          This constructor creates a Shell widget, which is a special +subclass of XmDialogShell. You can access the Shell widget +with the shell() member functon. +

          A dialog widget is not created by this constructor. Instead, you +should create the dialog widget as a child of this +dialog. TQMotifDialog will take ownership of your custom dialog, +and you can access it with the dialog() member function. +

          Warning: TQMotifDialog takes ownership of the child widget and +destroys it during destruction. You should not destroy the dialog +widget yourself. +

          See also shell() and dialog(). + +

          TQMotifDialog::~TQMotifDialog () [virtual] +

          +Destroys the TQDialog, dialog widget and Shell widget. + +

          void TQMotifDialog::acceptCallback ( Widget, XtPointer client_data, XtPointer ) [static] +

          +Convenient Xt/Motif callback to accept the TQMotifDialog. +

          The data is passed in client_data. + +

          Widget TQMotifDialog::dialog () const +

          +Returns the Motif widget embedded in this dialog. + +

          void TQMotifDialog::rejectCallback ( Widget, XtPointer client_data, XtPointer ) [static] +

          +Convenient Xt/Motif callback to reject the TQMotifDialog. +

          The data is passed in client_data. + +

          Widget TQMotifDialog::shell () const +

          +Returns the Shell widget embedded in this dialog. + +

          Example: dialog/mainwindow.cpp. + +


          +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifplusstyle-h.html b/doc/html/tqmotifplusstyle-h.html new file mode 100644 index 000000000..72ccc2489 --- /dev/null +++ b/doc/html/tqmotifplusstyle-h.html @@ -0,0 +1,169 @@ + + + + + +tqmotifplusstyle.h Include File + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          tqmotifplusstyle.h

          + +

          This is the verbatim text of the tqmotifplusstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


          +
          +/****************************************************************************
          +** $Id: qt/tqmotifplusstyle.h   3.3.8   edited Jan 11 14:46 $
          +**
          +** Definition of TQMotifPlusStyle class
          +**
          +** Created : 000727
          +**
          +** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
          +**
          +** This file is part of the widgets module of the TQt GUI Toolkit.
          +**
          +** This file may be used under the terms of the GNU General Public
          +** License versions 2.0 or 3.0 as published by the Free Software
          +** Foundation and appearing in the file LICENSE.GPL included in the
          +** packaging of this file. Alternatively you may (at your option) use any
          +** later version of the GNU General Public License if such license has
          +** been publicly approved by Trolltech ASA (or its successors, if any)
          +** and the KDE Free TQt Foundation.
          +**
          +** Please review the following information to ensure GNU General
          +** Public Licensing requirements will be met:
          +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
          +** If you are unsure which license is appropriate for your use, please
          +** review the following information:
          +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
          +** or contact the sales department at sales@trolltech.com.
          +**
          +** This file may be used under the terms of the Q Public License as
          +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
          +** included in the packaging of this file.  Licensees holding valid TQt
          +** Commercial licenses may use this file in accordance with the TQt
          +** Commercial License Agreement provided with the Software.
          +**
          +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
          +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
          +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
          +** herein.
          +**
          +**********************************************************************/
          +
          +#ifndef TQMOTIFPLUSSTYLE_H
          +#define TQMOTIFPLUSSTYLE_H
          +
          +
          +#ifndef QT_H
          +#include "tqmotifstyle.h"
          +#endif // QT_H
          +
          +#if !defined(TQT_NO_STYLE_MOTIFPLUS) || defined(QT_PLUGIN)
          +
          +#if defined(QT_PLUGIN)
          +#define Q_EXPORT_STYLE_MOTIFPLUS
          +#else
          +#define Q_EXPORT_STYLE_MOTIFPLUS TQ_EXPORT
          +#endif
          +
          +class Q_EXPORT_STYLE_MOTIFPLUS TQMotifPlusStyle : public TQMotifStyle
          +{
          +    TQ_OBJECT
          +
          +public:
          +    TQMotifPlusStyle(bool hoveringHighlight = TRUE);
          +    virtual ~TQMotifPlusStyle();
          +
          +    void polish(TQPalette &pal);
          +    void polish(TQWidget *widget);
          +    void unPolish(TQWidget*widget);
          +
          +    void polish(TQApplication *app);
          +    void unPolish(TQApplication *app);
          +
          +    void drawPrimitive( PrimitiveElement pe,
          +			TQPainter *p,
          +			const TQRect &r,
          +			const TQColorGroup &cg,
          +			SFlags flags = Style_Default,
          +			const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    void drawControl( ControlElement element,
          +		      TQPainter *p,
          +		      const TQWidget *widget,
          +		      const TQRect &r,
          +		      const TQColorGroup &cg,
          +		      SFlags how = Style_Default,
          +		      const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    TQRect subRect(SubRect r, const TQWidget *widget) const;
          +
          +    void drawComplexControl(ComplexControl control,
          +			    TQPainter *p,
          +			    const TQWidget *widget,
          +			    const TQRect &r,
          +			    const TQColorGroup &cg,
          +			    SFlags how = Style_Default,
          +#ifdef Q_QDOC
          +			    SCFlags controls = SC_All,
          +#else
          +			    SCFlags controls = (uint)SC_All,
          +#endif
          +			    SCFlags active = SC_None,
          +			    const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    TQRect querySubControlMetrics(ComplexControl control,
          +				 const TQWidget *widget,
          +				 SubControl subcontrol,
          +				 const TQStyleOption& = TQStyleOption::Default) const;
          +
          +    int pixelMetric(PixelMetric metric, const TQWidget *widget = 0) const;
          +
          +    int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption & = TQStyleOption::Default,
          +		  TQStyleHintReturn* = 0) const;
          +
          +protected:
          +    bool eventFilter(TQObject *, TQEvent *);
          +
          +
          +private:
          +    bool useHoveringHighlight;
          +};
          +
          +
          +#endif // TQT_NO_STYLE_MOTIFPLUS
          +
          +#endif // TQMOTIFPLUSSTYLE_H
          +
          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifplusstyle-members.html b/doc/html/tqmotifplusstyle-members.html new file mode 100644 index 000000000..6e49fedc9 --- /dev/null +++ b/doc/html/tqmotifplusstyle-members.html @@ -0,0 +1,112 @@ + + + + + +TQMotifPlusStyle Member List + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          Complete Member List for TQMotifPlusStyle

          + +

          This is the complete list of member functions for +TQMotifPlusStyle, including inherited members. + +

          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifplusstyle.html b/doc/html/tqmotifplusstyle.html new file mode 100644 index 000000000..e265a92a9 --- /dev/null +++ b/doc/html/tqmotifplusstyle.html @@ -0,0 +1,71 @@ + + + + + +TQMotifPlusStyle Class + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          TQMotifPlusStyle Class Reference

          + +

          The TQMotifPlusStyle class provides a more sophisticated Motif-ish look and feel. +More... +

          #include <tqmotifplusstyle.h> +

          Inherits TQMotifStyle. +

          List of all member functions. +

          Public Members

          + +

          Detailed Description

          + + +The TQMotifPlusStyle class provides a more sophisticated Motif-ish look and feel. +

          +

          This class implements a Motif-ish look and feel with the more +sophisticated bevelling as used by the GIMP Toolkit (GTK+) for +Unix/X11. +

          See also Widget Appearance and Style. + +


          Member Function Documentation

          +

          TQMotifPlusStyle::TQMotifPlusStyle ( bool hoveringHighlight = TRUE ) +

          +Constructs a TQMotifPlusStyle +

          If hoveringHighlight is TRUE (the default), then the style will +not highlight push buttons, checkboxes, radiobuttons, comboboxes, +scrollbars or sliders. + + +


          +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifstyle-h.html b/doc/html/tqmotifstyle-h.html new file mode 100644 index 000000000..1f405ee55 --- /dev/null +++ b/doc/html/tqmotifstyle-h.html @@ -0,0 +1,181 @@ + + + + + +tqmotifstyle.h Include File + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          tqmotifstyle.h

          + +

          This is the verbatim text of the tqmotifstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


          +
          +/****************************************************************************
          +** $Id: qt/tqmotifstyle.h   3.3.8   edited Jan 11 14:46 $
          +**
          +** Definition of Motif-like style class
          +**
          +** Created : 981231
          +**
          +** Copyright (C) 1998-2007 Trolltech ASA.  All rights reserved.
          +**
          +** This file is part of the widgets module of the TQt GUI Toolkit.
          +**
          +** This file may be used under the terms of the GNU General Public
          +** License versions 2.0 or 3.0 as published by the Free Software
          +** Foundation and appearing in the file LICENSE.GPL included in the
          +** packaging of this file. Alternatively you may (at your option) use any
          +** later version of the GNU General Public License if such license has
          +** been publicly approved by Trolltech ASA (or its successors, if any)
          +** and the KDE Free TQt Foundation.
          +**
          +** Please review the following information to ensure GNU General
          +** Public Licensing requirements will be met:
          +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
          +** If you are unsure which license is appropriate for your use, please
          +** review the following information:
          +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
          +** or contact the sales department at sales@trolltech.com.
          +**
          +** This file may be used under the terms of the Q Public License as
          +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
          +** included in the packaging of this file.  Licensees holding valid TQt
          +** Commercial licenses may use this file in accordance with the TQt
          +** Commercial License Agreement provided with the Software.
          +**
          +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
          +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
          +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
          +** herein.
          +**
          +**********************************************************************/
          +
          +#ifndef TQMOTIFSTYLE_H
          +#define TQMOTIFSTYLE_H
          +
          +#ifndef QT_H
          +#include "tqcommonstyle.h"
          +#endif // QT_H
          +
          +#if !defined(TQT_NO_STYLE_MOTIF) || defined(QT_PLUGIN)
          +
          +class TQPalette;
          +
          +#if defined(QT_PLUGIN)
          +#define Q_EXPORT_STYLE_MOTIF
          +#else
          +#define Q_EXPORT_STYLE_MOTIF TQ_EXPORT
          +#endif
          +
          +
          +class Q_EXPORT_STYLE_MOTIF TQMotifStyle : public TQCommonStyle
          +{
          +    TQ_OBJECT
          +public:
          +    TQMotifStyle( bool useHighlightCols=FALSE );
          +    virtual ~TQMotifStyle();
          +
          +    void setUseHighlightColors( bool );
          +    bool useHighlightColors() const;
          +
          +    void polish( TQPalette& );
          +    void polish( TQWidget* );
          +    void polish( TQApplication* );
          +
          +    void polishPopupMenu( TQPopupMenu* );
          +
          +    // new style API
          +    void drawPrimitive( PrimitiveElement pe,
          +			TQPainter *p,
          +			const TQRect &r,
          +			const TQColorGroup &cg,
          +			SFlags flags = Style_Default,
          +			const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    void drawControl( ControlElement element,
          +		      TQPainter *p,
          +		      const TQWidget *widget,
          +		      const TQRect &r,
          +		      const TQColorGroup &cg,
          +		      SFlags how = Style_Default,
          +		      const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    void drawComplexControl( ComplexControl control,
          +			     TQPainter *p,
          +			     const TQWidget* widget,
          +			     const TQRect& r,
          +			     const TQColorGroup& cg,
          +			     SFlags how = Style_Default,
          +#ifdef Q_QDOC
          +			     SCFlags sub = SC_All,
          +#else
          +			     SCFlags sub = (uint)SC_All,
          +#endif
          +			     SCFlags subActive = SC_None,
          +			     const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    TQRect querySubControlMetrics( ComplexControl control,
          +				  const TQWidget *widget,
          +				  SubControl sc,
          +				  const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const;
          +
          +    TQSize sizeFromContents( ContentsType contents,
          +			    const TQWidget *widget,
          +			    const TQSize &contentsSize,
          +			    const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    TQRect subRect( SubRect r, const TQWidget *widget ) const;
          +
          +    TQPixmap stylePixmap(StylePixmap, const TQWidget * = 0, const TQStyleOption& = TQStyleOption::Default) const;
          +
          +    int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption & = TQStyleOption::Default,
          +		  TQStyleHintReturn* = 0) const;
          +
          +private:
          +    bool highlightCols;
          +
          +    // Disabled copy constructor and operator=
          +#if defined(TQ_DISABLE_COPY)
          +    TQMotifStyle( const TQMotifStyle & );
          +    TQMotifStyle& operator=( const TQMotifStyle & );
          +#endif
          +};
          +
          +#endif // TQT_NO_STYLE_MOTIF
          +
          +#endif // TQMOTIFSTYLE_H
          +
          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifstyle-members.html b/doc/html/tqmotifstyle-members.html new file mode 100644 index 000000000..67ee0d5cf --- /dev/null +++ b/doc/html/tqmotifstyle-members.html @@ -0,0 +1,112 @@ + + + + + +TQMotifStyle Member List + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          Complete Member List for TQMotifStyle

          + +

          This is the complete list of member functions for +TQMotifStyle, including inherited members. + +

          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifstyle.html b/doc/html/tqmotifstyle.html new file mode 100644 index 000000000..b5a202d14 --- /dev/null +++ b/doc/html/tqmotifstyle.html @@ -0,0 +1,93 @@ + + + + + +TQMotifStyle Class + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          TQMotifStyle Class Reference

          + +

          The TQMotifStyle class provides Motif look and feel. +More... +

          #include <tqmotifstyle.h> +

          Inherits TQCommonStyle. +

          Inherited by TQCDEStyle, TQMotifPlusStyle, and TQSGIStyle. +

          List of all member functions. +

          Public Members

          + +

          Detailed Description

          + + +The TQMotifStyle class provides Motif look and feel. +

          +

          This class implements the Motif look and feel. It closely +resembles the original Motif look as defined by the Open Group, +but with some minor improvements. The Motif style is TQt's default +GUI style on UNIX platforms. +

          See also Widget Appearance and Style. + +


          Member Function Documentation

          +

          TQMotifStyle::TQMotifStyle ( bool useHighlightCols = FALSE ) +

          +Constructs a TQMotifStyle. +

          If useHighlightCols is FALSE (the default), the style will +polish the application's color palette to emulate the Motif way of +highlighting, which is a simple inversion between the base and the +text color. + +

          void TQMotifStyle::setUseHighlightColors ( bool arg ) +

          +If arg is FALSE, the style will polish the application's color +palette to emulate the Motif way of highlighting, which is a +simple inversion between the base and the text color. +

          The effect will show up the next time an application palette is +set via TQApplication::setPalette(). The current color palette of +the application remains unchanged. +

          See also TQStyle::polish(). + +

          bool TQMotifStyle::useHighlightColors () const +

          +Returns TRUE if the style treats the highlight colors of the +palette in a Motif-like manner, which is a simple inversion +between the base and the text color; otherwise returns FALSE. The +default is FALSE. + + +

          +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifwidget-h.html b/doc/html/tqmotifwidget-h.html new file mode 100644 index 000000000..3fbdc61e7 --- /dev/null +++ b/doc/html/tqmotifwidget-h.html @@ -0,0 +1,115 @@ + + + + + +tqmotifwidget.h Include File + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          tqmotifwidget.h

          + +

          This is the verbatim text of the tqmotifwidget.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


          +
          +/****************************************************************************
          +** $Id: qt/tqmotifwidget.h   3.3.8   edited Jan 11 14:37 $
          +**
          +** Definition of TQt extension classes for Xt/Motif support.
          +**
          +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
          +**
          +** This file is part of the TQt extension for Xt/Motif support.
          +**
          +** Licensees holding valid TQt Enterprise Edition licenses for X11 may use
          +** this file in accordance with the TQt Commercial License Agreement provided
          +** with the Software.
          +**
          +** This file is not available for use under any other license without
          +** express written permission from the copyright holder.
          +**
          +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
          +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
          +**
          +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
          +**   information about TQt Commercial License Agreements.
          +**
          +** Contact info@trolltech.com if any conditions of this licensing are
          +** not clear to you.
          +**
          +**********************************************************************/
          +
          +#ifndef TQMOTIFWIDGET_H
          +#define TQMOTIFWIDGET_H
          +
          +#include <tqwidget.h>
          +
          +#include <X11/Intrinsic.h>
          +
          +class TQMotifWidgetPrivate;
          +class TQKeyEvent;
          +
          +class TQMotifWidget : public TQWidget
          +{
          +    TQ_OBJECT
          +
          +public:
          +    TQMotifWidget( TQWidget *, WidgetClass, ArgList = NULL, Cardinal = 0,
          +                  const char * = 0, WFlags = 0 );
          +    virtual ~TQMotifWidget();
          +
          +    Widget motifWidget() const;
          +
          +    void show();
          +    void hide();
          +
          +protected:
          +    bool event( TQEvent * );
          +    bool eventFilter( TQObject *object, TQEvent *event );
          +    bool x11Event(XEvent *event);
          +
          +private:
          +    TQMotifWidgetPrivate *d;
          +
          +    void realize( Widget );
          +
          +    friend void qmotif_widget_shell_destroy(Widget w);
          +    friend void qmotif_widget_shell_realize( Widget, XtValueMask *,
          +                                             XSetWindowAttributes *);
          +    friend void qmotif_widget_shell_change_managed( Widget );
          +    static bool dispatchTQEvent( TQEvent*, TQWidget*);
          +    friend class TQMotifDialog;
          +};
          +
          +#endif // TQMOTIFWIDGET_H
          +
          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifwidget-members.html b/doc/html/tqmotifwidget-members.html new file mode 100644 index 000000000..42a3618e4 --- /dev/null +++ b/doc/html/tqmotifwidget-members.html @@ -0,0 +1,338 @@ + + + + + +TQMotifWidget Member List + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          Complete Member List for TQMotifWidget

          + +

          This is the complete list of member functions for +TQMotifWidget, including inherited members. + +

          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqmotifwidget.html b/doc/html/tqmotifwidget.html new file mode 100644 index 000000000..c13d9bb36 --- /dev/null +++ b/doc/html/tqmotifwidget.html @@ -0,0 +1,115 @@ + + + + + +TQMotifWidget Class + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          TQMotifWidget Class Reference

          + +

          The TQMotifWidget class provides the TQWidget API for Xt/Motif widgets. +More... +

          This class is part of the TQt Motif Extension. +

          #include <tqmotifwidget.h> +

          Inherits TQWidget. +

          List of all member functions. +

          Public Members

          +
            +
          • TQMotifWidget ( TQWidget * parent, WidgetClass widgetclass, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, WFlags flags = 0 )
          • +
          • virtual ~TQMotifWidget ()
          • +
          • Widget motifWidget () const
          • +
          +

          Protected Members

          +
            +
          • virtual bool x11Event ( XEvent * event )
          • +
          +

          Detailed Description

          +

          This class is defined in the TQt Motif Extension, which can be found in the qt/extensions directory. It is not included in the main TQt API. +

          + +The TQMotifWidget class provides the TQWidget API for Xt/Motif widgets. + +

          +

          TQMotifWidget exists to provide a TQWidget that can act as a parent +for any Xt/Motif widget. Since the TQMotifWidget is a proper +TQWidget, it can be used as a top-level widget (e.g. 0 parent) or +as a child of any other TQWidget. Note: Since TQMotifWidget acts as +a parent for Xt/Motif widgets, you should not create TQWidgets with +a TQMotifWidget parent. +

          An Xt/Motif widget with a top-level TQMotifWidget parent can begin +using the standard TQt dialogs and custom TQDialogs while keeping +the main Xt/Motif interface of the application. Using a +TQMotifWidget as the parent for the various TQDialogs will ensure +that modality and stacking works properly throughout the entire +application. +

          Applications moving to TQt may have custom Xt/Motif widgets that +will take time to rewrite with TQt. Such applications can use +these custom widgets as TQMotifWidget with TQWidget parents. This +allows the application's interface to be replaced gradually. +

          Warning: TQMotifWidget uses the X11 window ID of the Motif widget +directly, instead of creating its own. Because ot this, +TQWidget::reparent() will not work. This includes the functions +TQWidget::showFullScreen() and TQWidget::showNormal(), which use +TQWidget::reparent(). + +


          Member Function Documentation

          +

          TQMotifWidget::TQMotifWidget ( TQWidget * parent, WidgetClass widgetclass, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, WFlags flags = 0 ) +

          +Creates a TQMotifWidget of the given widgetclass as a child of +parent, with the name name and widget flags flags. +

          The args and argcount arguments are passed on to +XtCreateWidget. +

          The motifWidget() function returns the resulting Xt/Motif widget. +This widget can be used as a parent for any other Xt/Motif widget. +

          If parent is a TQMotifWidget, the Xt/Motif widget is created as +a child of the parent's motifWidget(). If \ parent is 0 or a +normal TQWidget, the Xt/Motif widget is created as a child of a +special TopLevelShell widget. Xt/Motif widgets can use this +special TopLevelShell parent as the parent for existing +Xt/Motif dialogs or TQMotifDialogs. + +

          TQMotifWidget::~TQMotifWidget () [virtual] +

          +Destroys the TQMotifWidget. The special TopLevelShell is also +destroyed, if it was created during construction. + +

          Widget TQMotifWidget::motifWidget () const +

          +Returns the embedded Xt/Motif widget. If a Shell widget was +created by the constructor, you can access it with XtParent(). + + +

          +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqplatinumstyle-h.html b/doc/html/tqplatinumstyle-h.html new file mode 100644 index 000000000..a947a8ae0 --- /dev/null +++ b/doc/html/tqplatinumstyle-h.html @@ -0,0 +1,162 @@ + + + + + +tqplatinumstyle.h Include File + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          tqplatinumstyle.h

          + +

          This is the verbatim text of the tqplatinumstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


          +
          +/****************************************************************************
          +** $Id: qt/tqplatinumstyle.h   3.3.8   edited Jan 11 14:46 $
          +**
          +** Definition of Platinum-like style class
          +**
          +** Created : 981231
          +**
          +** Copyright (C) 1998-2007 Trolltech ASA.  All rights reserved.
          +**
          +** This file is part of the widgets module of the TQt GUI Toolkit.
          +**
          +** This file may be used under the terms of the GNU General Public
          +** License versions 2.0 or 3.0 as published by the Free Software
          +** Foundation and appearing in the file LICENSE.GPL included in the
          +** packaging of this file. Alternatively you may (at your option) use any
          +** later version of the GNU General Public License if such license has
          +** been publicly approved by Trolltech ASA (or its successors, if any)
          +** and the KDE Free TQt Foundation.
          +**
          +** Please review the following information to ensure GNU General
          +** Public Licensing requirements will be met:
          +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
          +** If you are unsure which license is appropriate for your use, please
          +** review the following information:
          +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
          +** or contact the sales department at sales@trolltech.com.
          +**
          +** This file may be used under the terms of the Q Public License as
          +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
          +** included in the packaging of this file.  Licensees holding valid TQt
          +** Commercial licenses may use this file in accordance with the TQt
          +** Commercial License Agreement provided with the Software.
          +**
          +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
          +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
          +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
          +** herein.
          +**
          +**********************************************************************/
          +
          +#ifndef TQPLATINUMSTYLE_H
          +#define TQPLATINUMSTYLE_H
          +
          +#ifndef QT_H
          +#include "tqwindowsstyle.h"
          +#endif // QT_H
          +
          +#if !defined(TQT_NO_STYLE_PLATINUM) || defined(QT_PLUGIN)
          +
          +class TQPalette;
          +
          +#if defined(QT_PLUGIN)
          +#define Q_EXPORT_STYLE_PLATINUM
          +#else
          +#define Q_EXPORT_STYLE_PLATINUM TQ_EXPORT
          +#endif
          +
          +class Q_EXPORT_STYLE_PLATINUM TQPlatinumStyle : public TQWindowsStyle
          +{
          +    TQ_OBJECT
          +public:
          +    TQPlatinumStyle();
          +    virtual ~TQPlatinumStyle();
          +
          +    // new Style Stuff
          +    void drawPrimitive( PrimitiveElement pe,
          +			TQPainter *p,
          +			const TQRect &r,
          +			const TQColorGroup &cg,
          +			SFlags flags = Style_Default,
          +			const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    void drawControl( ControlElement element,
          +		      TQPainter *p,
          +		      const TQWidget *widget,
          +		      const TQRect &r,
          +		      const TQColorGroup &cg,
          +		      SFlags how = Style_Default,
          +		      const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    void drawComplexControl( ComplexControl control,
          +			     TQPainter *p,
          +			     const TQWidget *widget,
          +			     const TQRect &r,
          +			     const TQColorGroup &cg,
          +			     SFlags how = Style_Default,
          +#ifdef Q_QDOC
          +			     SCFlags sub = SC_All,
          +#else
          +			     SCFlags sub = (uint)SC_All,
          +#endif
          +			     SCFlags subActive = SC_None,
          +			     const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    TQRect querySubControlMetrics( ComplexControl control,
          +				  const TQWidget *widget,
          +				  SubControl sc,
          +				  const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const;
          +
          +    TQRect subRect( SubRect r, const TQWidget *widget ) const;
          +
          +protected:
          +     TQColor mixedColor(const TQColor &, const TQColor &) const;
          +    void drawRiffles( TQPainter* p,  int x, int y, int w, int h,
          +		      const TQColorGroup &g, bool horizontal ) const;
          +private:	// Disabled copy constructor and operator=
          +#if defined(TQ_DISABLE_COPY)
          +    TQPlatinumStyle( const TQPlatinumStyle & );
          +    TQPlatinumStyle& operator=( const TQPlatinumStyle & );
          +#endif
          +};
          +
          +#endif // TQT_NO_STYLE_PLATINUM
          +
          +#endif // TQPLATINUMSTYLE_H
          +
          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqplatinumstyle-members.html b/doc/html/tqplatinumstyle-members.html new file mode 100644 index 000000000..0149bef80 --- /dev/null +++ b/doc/html/tqplatinumstyle-members.html @@ -0,0 +1,112 @@ + + + + + +TQPlatinumStyle Member List + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          Complete Member List for TQPlatinumStyle

          + +

          This is the complete list of member functions for +TQPlatinumStyle, including inherited members. + +

          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqplatinumstyle.html b/doc/html/tqplatinumstyle.html new file mode 100644 index 000000000..81be7498b --- /dev/null +++ b/doc/html/tqplatinumstyle.html @@ -0,0 +1,84 @@ + + + + + +TQPlatinumStyle Class + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          TQPlatinumStyle Class Reference

          + +

          The TQPlatinumStyle class provides Mac/Platinum look and feel. +More... +

          #include <tqplatinumstyle.h> +

          Inherits TQWindowsStyle. +

          List of all member functions. +

          Public Members

          + +

          Protected Members

          +
            +
          • TQColor mixedColor ( const TQColor & c1, const TQColor & c2 ) const
          • +
          • void drawRiffles ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool horizontal ) const
          • +
          +

          Detailed Description

          + + +The TQPlatinumStyle class provides Mac/Platinum look and feel. +

          +

          This class implements the Platinum look and feel. It's an +experimental class that tries to resemble a Macinosh-like GUI +style with the TQStyle system. The emulation is currently far from +perfect. +

          See also TQAquaStyle and Widget Appearance and Style. + +


          Member Function Documentation

          +

          TQPlatinumStyle::TQPlatinumStyle () +

          +Constructs a TQPlatinumStyle + +

          void TQPlatinumStyle::drawRiffles ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool horizontal ) const [protected] +

          +Draws the nifty Macintosh decoration used on sliders using painter +p and colorgroup g. x, y, w, h and horizontal +specify the geometry and orientation of the riffles. + +

          TQColor TQPlatinumStyle::mixedColor ( const TQColor & c1, const TQColor & c2 ) const [protected] +

          +Mixes two colors c1 and c2 to a new color. + + +

          +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqsgistyle-h.html b/doc/html/tqsgistyle-h.html new file mode 100644 index 000000000..a5e1dc9fc --- /dev/null +++ b/doc/html/tqsgistyle-h.html @@ -0,0 +1,178 @@ + + + + + +tqsgistyle.h Include File + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          tqsgistyle.h

          + +

          This is the verbatim text of the tqsgistyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


          +
          +/****************************************************************************
          +** $Id: qt/tqsgistyle.h   3.3.8   edited Jan 11 14:46 $
          +**
          +** Definition of SGI-like style class
          +**
          +** Created : 981231
          +**
          +** Copyright (C) 1998-2007 Trolltech ASA.  All rights reserved.
          +**
          +** This file is part of the widgets module of the TQt GUI Toolkit.
          +**
          +** This file may be used under the terms of the GNU General Public
          +** License versions 2.0 or 3.0 as published by the Free Software
          +** Foundation and appearing in the file LICENSE.GPL included in the
          +** packaging of this file. Alternatively you may (at your option) use any
          +** later version of the GNU General Public License if such license has
          +** been publicly approved by Trolltech ASA (or its successors, if any)
          +** and the KDE Free TQt Foundation.
          +**
          +** Please review the following information to ensure GNU General
          +** Public Licensing requirements will be met:
          +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
          +** If you are unsure which license is appropriate for your use, please
          +** review the following information:
          +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
          +** or contact the sales department at sales@trolltech.com.
          +**
          +** This file may be used under the terms of the Q Public License as
          +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
          +** included in the packaging of this file.  Licensees holding valid TQt
          +** Commercial licenses may use this file in accordance with the TQt
          +** Commercial License Agreement provided with the Software.
          +**
          +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
          +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
          +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
          +** herein.
          +**
          +**********************************************************************/
          +
          +#ifndef TQSGISTYLE_H
          +#define TQSGISTYLE_H
          +
          +#ifndef QT_H
          +#include "tqmotifstyle.h"
          +#include "ntqguardedptr.h"
          +#include "tqwidget.h"
          +#endif // QT_H
          +
          +#if !defined(TQT_NO_STYLE_SGI) || defined(QT_PLUGIN)
          +
          +#if defined(QT_PLUGIN)
          +#define Q_EXPORT_STYLE_SGI
          +#else
          +#define Q_EXPORT_STYLE_SGI TQ_EXPORT
          +#endif
          +
          +class TQSGIStylePrivate;
          +
          +class Q_EXPORT_STYLE_SGI TQSGIStyle: public TQMotifStyle
          +{
          +    TQ_OBJECT
          +public:
          +    TQSGIStyle( bool useHighlightCols = FALSE );
          +    virtual ~TQSGIStyle();
          +
          +#if !defined(Q_NO_USING_KEYWORD)
          +    using TQMotifStyle::polish;
          +#endif
          +    void polish( TQWidget* );
          +    void unPolish( TQWidget* );
          +    void polish( TQApplication* );
          +    void unPolish( TQApplication* );
          +
          +    void drawPrimitive( PrimitiveElement pe,
          +			TQPainter *p,
          +			const TQRect &r,
          +			const TQColorGroup &cg,
          +			SFlags flags = Style_Default,
          +			const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    void drawControl( ControlElement element,
          +		      TQPainter *p,
          +		      const TQWidget *widget,
          +		      const TQRect &r,
          +		      const TQColorGroup &cg,
          +		      SFlags how = Style_Default,
          +		      const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    void drawComplexControl( ComplexControl control,
          +			     TQPainter *p,
          +			     const TQWidget* widget,
          +			     const TQRect& r,
          +			     const TQColorGroup& cg,
          +			     SFlags how = Style_Default,
          +#ifdef Q_QDOC
          +			     SCFlags sub = SC_All,
          +#else
          +			     SCFlags sub = (uint)SC_All,
          +#endif
          +			     SCFlags subActive = SC_None,
          +			     const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const;
          +
          +    TQSize sizeFromContents( ContentsType contents,
          +			    const TQWidget *widget,
          +			    const TQSize &contentsSize,
          +			    const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +    TQRect subRect( SubRect r, const TQWidget *widget ) const;
          +    TQRect querySubControlMetrics( ComplexControl control,
          +				  const TQWidget *widget,
          +				  SubControl sc,
          +				  const TQStyleOption& = TQStyleOption::Default ) const;
          +
          +protected:
          +    bool eventFilter( TQObject*, TQEvent*);
          +
          +private:
          +    TQSGIStylePrivate *d;
          +
          +    uint isApplicationStyle :1;
          +#if defined(TQ_DISABLE_COPY)
          +    TQSGIStyle( const TQSGIStyle & );
          +    TQSGIStyle& operator=( const TQSGIStyle & );
          +#endif
          +
          +};
          +
          +#endif // TQT_NO_STYLE_SGI
          +
          +#endif // TQSGISTYLE_H
          +
          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqsgistyle-members.html b/doc/html/tqsgistyle-members.html new file mode 100644 index 000000000..19e5abdc4 --- /dev/null +++ b/doc/html/tqsgistyle-members.html @@ -0,0 +1,113 @@ + + + + + +TQSGIStyle Member List + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          Complete Member List for TQSGIStyle

          + +

          This is the complete list of member functions for +TQSGIStyle, including inherited members. + +

          + +


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqsgistyle.html b/doc/html/tqsgistyle.html new file mode 100644 index 000000000..ca88af11c --- /dev/null +++ b/doc/html/tqsgistyle.html @@ -0,0 +1,77 @@ + + + + + +TQSGIStyle Class + + + + + + + +
          + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

          TQSGIStyle Class Reference

          + +

          The TQSGIStyle class provides SGI/Irix look and feel. +More... +

          #include <tqsgistyle.h> +

          Inherits TQMotifStyle. +

          List of all member functions. +

          Public Members

          + +

          Detailed Description

          + + +The TQSGIStyle class provides SGI/Irix look and feel. +

          +

          This class implements the SGI look and feel. It resembles the +SGI/Irix Motif GUI style as closely as TQStyle allows. +

          See also Widget Appearance and Style. + +


          Member Function Documentation

          +

          TQSGIStyle::TQSGIStyle ( bool useHighlightCols = FALSE ) +

          +Constructs a TQSGIStyle. +

          If useHighlightCols is FALSE (default value), the style will +polish the application's color palette to emulate the Motif way of +highlighting, which is a simple inversion between the base and the +text color. +

          See also TQMotifStyle::useHighlightColors(). + +

          TQSGIStyle::~TQSGIStyle () [virtual] +

          +Destroys the style. + + +

          +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


          + +
          Copyright © 2007 +TrolltechTrademarks +
          TQt 3.3.8
          +
          + diff --git a/doc/html/tqstyle.html b/doc/html/tqstyle.html index 9da4a6452..7c614a2ec 100644 --- a/doc/html/tqstyle.html +++ b/doc/html/tqstyle.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

          #include <tqstyle.h>

          Inherits TQObject. -

          Inherited by TQCommonStyle. +

          Inherited by TQCommonStyle.

          List of all member functions.

          Public Members

            diff --git a/doc/html/tqwidget.html b/doc/html/tqwidget.html index 458802461..223017419 100644 --- a/doc/html/tqwidget.html +++ b/doc/html/tqwidget.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } More...

            #include <tqwidget.h>

            Inherits TQObject and TQPaintDevice. --

            Inherited by TQButton, TQFrame, TQDialog, TQComboBox, TQDataBrowser, TQDataView, TQDateTimeEditBase, TQDateTimeEdit, TQDesktopWidget, TQDial, TQDockArea, TQGLWidget, TQHeader, TQMainWindow, TQMotifWidget, TQNPWidget, TQScrollBar, TQSizeGrip, TQSlider, TQSpinBox, TQSplashScreen, TQStatusBar, TQTabBar, TQTabWidget, TQWorkspace, and TQXtWidget. +-

            Inherited by TQButton, TQFrame, TQDialog, TQComboBox, TQDataBrowser, TQDataView, TQDateTimeEditBase, TQDateTimeEdit, TQDesktopWidget, TQDial, TQDockArea, TQGLWidget, TQHeader, TQMainWindow, TQMotifWidget, TQNPWidget, TQScrollBar, TQSizeGrip, TQSlider, TQSpinBox, TQSplashScreen, TQStatusBar, TQTabBar, TQTabWidget, TQWorkspace, and TQXtWidget.

            List of all member functions.

            Public Members

              diff --git a/doc/html/tqwindowsstyle-h.html b/doc/html/tqwindowsstyle-h.html new file mode 100644 index 000000000..83e96ecdc --- /dev/null +++ b/doc/html/tqwindowsstyle-h.html @@ -0,0 +1,180 @@ + + + + + +tqwindowsstyle.h Include File + + + + + + + +
              + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

              tqwindowsstyle.h

              + +

              This is the verbatim text of the tqwindowsstyle.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


              +
              +/****************************************************************************
              +** $Id: qt/tqwindowsstyle.h   3.3.8   edited Jan 11 14:38 $
              +**
              +** Definition of Windows-like style class
              +**
              +** Created : 981231
              +**
              +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
              +**
              +** This file is part of the widgets module of the TQt GUI Toolkit.
              +**
              +** This file may be used under the terms of the GNU General Public
              +** License versions 2.0 or 3.0 as published by the Free Software
              +** Foundation and appearing in the file LICENSE.GPL included in the
              +** packaging of this file. Alternatively you may (at your option) use any
              +** later version of the GNU General Public License if such license has
              +** been publicly approved by Trolltech ASA (or its successors, if any)
              +** and the KDE Free TQt Foundation.
              +**
              +** Please review the following information to ensure GNU General
              +** Public Licensing requirements will be met:
              +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
              +** If you are unsure which license is appropriate for your use, please
              +** review the following information:
              +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
              +** or contact the sales department at sales@trolltech.com.
              +**
              +** This file may be used under the terms of the Q Public License as
              +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
              +** included in the packaging of this file.  Licensees holding valid TQt
              +** Commercial licenses may use this file in accordance with the TQt
              +** Commercial License Agreement provided with the Software.
              +**
              +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
              +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
              +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
              +** herein.
              +**
              +**********************************************************************/
              +
              +#ifndef TQWINDOWSSTYLE_H
              +#define TQWINDOWSSTYLE_H
              +
              +#ifndef QT_H
              +#include "tqcommonstyle.h"
              +#endif // QT_H
              +
              +#if !defined(TQT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
              +
              +#if defined(QT_PLUGIN)
              +#define Q_EXPORT_STYLE_WINDOWS
              +#else
              +#define Q_EXPORT_STYLE_WINDOWS TQ_EXPORT
              +#endif
              +
              +
              +class Q_EXPORT_STYLE_WINDOWS TQWindowsStyle : public TQCommonStyle
              +{
              +    TQ_OBJECT
              +public:
              +    TQWindowsStyle();
              +    ~TQWindowsStyle();
              +
              +    void polish(TQApplication*);
              +    void unPolish(TQApplication*);
              +
              +    void polish(TQWidget*);
              +    void unPolish(TQWidget*);
              +
              +    void polish( TQPalette & );
              +
              +    virtual void polishPopupMenu( TQPopupMenu* );
              +
              +    // new stuff
              +    void drawPrimitive( PrimitiveElement pe,
              +			TQPainter *p,
              +			const TQRect &r,
              +			const TQColorGroup &cg,
              +			SFlags flags = Style_Default,
              +			const TQStyleOption& = TQStyleOption::Default ) const;
              +
              +    void drawControl( ControlElement element,
              +		      TQPainter *p,
              +		      const TQWidget *widget,
              +		      const TQRect &r,
              +		      const TQColorGroup &cg,
              +		      SFlags flags = Style_Default,
              +		      const TQStyleOption& = TQStyleOption::Default ) const;
              +
              +    void drawComplexControl( ComplexControl control,
              +			     TQPainter* p,
              +			     const TQWidget* widget,
              +			     const TQRect& r,
              +			     const TQColorGroup& cg,
              +			     SFlags flags = Style_Default,
              +#ifdef Q_QDOC
              +			     SCFlags sub = SC_All,
              +#else
              +			     SCFlags sub = (uint)SC_All,
              +#endif
              +			     SCFlags subActive = SC_None,
              +			     const TQStyleOption& = TQStyleOption::Default ) const;
              +
              +    int pixelMetric( PixelMetric metric,
              +		     const TQWidget *widget = 0 ) const;
              +
              +    TQSize sizeFromContents( ContentsType contents,
              +			    const TQWidget *widget,
              +			    const TQSize &contentsSize,
              +			    const TQStyleOption& = TQStyleOption::Default ) const;
              +
              +    int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption & = TQStyleOption::Default,
              +		  TQStyleHintReturn* = 0) const;
              +
              +    TQPixmap stylePixmap( StylePixmap stylepixmap,
              +			 const TQWidget *widget = 0,
              +			 const TQStyleOption& = TQStyleOption::Default ) const;
              +
              +    TQRect subRect( SubRect r, const TQWidget *widget ) const;
              +
              +
              +private:
              +    class Private;
              +    Private *d;
              +
              +    // Disabled copy constructor and operator=
              +#if defined(TQ_DISABLE_COPY)
              +    TQWindowsStyle( const TQWindowsStyle & );
              +    TQWindowsStyle& operator=( const TQWindowsStyle & );
              +#endif
              +};
              +
              +#endif // TQT_NO_STYLE_WINDOWS
              +
              +#endif // TQWINDOWSSTYLE_H
              +
              + +


              + +
              Copyright © 2007 +TrolltechTrademarks +
              TQt 3.3.8
              +
              + diff --git a/doc/html/tqwindowsstyle-members.html b/doc/html/tqwindowsstyle-members.html new file mode 100644 index 000000000..82ec3670f --- /dev/null +++ b/doc/html/tqwindowsstyle-members.html @@ -0,0 +1,110 @@ + + + + + +TQWindowsStyle Member List + + + + + + + +
              + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

              Complete Member List for TQWindowsStyle

              + +

              This is the complete list of member functions for +TQWindowsStyle, including inherited members. + +

              + +


              + +
              Copyright © 2007 +TrolltechTrademarks +
              TQt 3.3.8
              +
              + diff --git a/doc/html/tqwindowsstyle.html b/doc/html/tqwindowsstyle.html new file mode 100644 index 000000000..71ca04226 --- /dev/null +++ b/doc/html/tqwindowsstyle.html @@ -0,0 +1,67 @@ + + + + + +TQWindowsStyle Class + + + + + + + +
              + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

              TQWindowsStyle Class Reference

              + +

              The TQWindowsStyle class provides a Microsoft Windows-like look and feel. +More... +

              #include <tqwindowsstyle.h> +

              Inherits TQCommonStyle. +

              Inherited by TQMacStyle and TQPlatinumStyle. +

              List of all member functions. +

              Public Members

              + +

              Detailed Description

              + + +The TQWindowsStyle class provides a Microsoft Windows-like look and feel. +

              +

              This style is TQt's default GUI style on Windows. +

              See also Widget Appearance and Style. + +


              Member Function Documentation

              +

              TQWindowsStyle::TQWindowsStyle () +

              +Constructs a TQWindowsStyle + + +

              +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


              + +
              Copyright © 2007 +TrolltechTrademarks +
              TQt 3.3.8
              +
              + diff --git a/doc/html/whatsthis b/doc/html/whatsthis index 31ca760c2..f4ab3aa47 100644 --- a/doc/html/whatsthis +++ b/doc/html/whatsthis @@ -43,7 +43,7 @@ Browsing and editing of SQL tables and views. | TQSqlCursor Browsing of general SQL SELECT statements. | TQSqlSelectCursor Buffered TCP connection. | TQSocket Bundles signals from identifiable senders. | TQSignalMapper -CDE look and feel. | QCDEStyle +CDE look and feel. | TQCDEStyle Can be used to send signals for classes that don't inherit TQObject. | TQSignal Checkable list view items. | TQCheckListItem Checkbox with a text label. | TQCheckBox @@ -113,7 +113,7 @@ Encapsulates a drag item. | TQIconDragItem Encapsulates a key sequence as used by accelerators. | QKeySequence Encapsulates a set of database field meta data. | TQSqlRecordInfo Encapsulates an OpenGL rendering context. | TQGLContext -Encapsulates the common Look and Feel of a GUI. | QCommonStyle +Encapsulates the common Look and Feel of a GUI. | TQCommonStyle Encapsulation of a set of text styles. | TQStyleSheetItem Enums and static functions relating to accessibility. | QAccessible Error message display dialog. | QErrorMessage @@ -211,7 +211,7 @@ List of TQCanvasItems. | TQCanvasItemList List of TQDomNode objects. | TQDomNodeList List of selectable, read-only items. | TQListBox List of strings. | TQStringList -Mac/Platinum look and feel. | QPlatinumStyle +Mac/Platinum look and feel. | TQPlatinumStyle Main application window, with a menu bar, dock windows (e.g. for toolbars), and a status bar. | TQMainWindow Maintains the list of widgets in the focus chain. | QFocusData Manages and lays out QDockWindows. | QDockArea @@ -224,11 +224,11 @@ Means of executing and manipulating SQL statements. | TQSqlQuery Means of using TQt Assistant as an application's help tool. | QAssistantClient Means of using comboboxes in TQTables. | TQComboTableItem Meta information about TQt objects. | QMetaObject -Microsoft Windows-like look and feel. | QWindowsStyle +Microsoft Windows-like look and feel. | TQWindowsStyle Modal dialog with a short message, an icon, and some buttons. | QMessageBox Monochrome (1-bit depth) pixmaps. | TQBitmap -More sophisticated Motif-ish look and feel. | QMotifPlusStyle -Motif look and feel. | QMotifStyle +More sophisticated Motif-ish look and feel. | TQMotifPlusStyle +Motif look and feel. | TQMotifStyle Mouse cursor with an arbitrary shape. | QCursor Movable panel containing widgets such as tool buttons. | TQToolBar Multi-bezier splines on a TQCanvas. | TQCanvasSpline @@ -288,7 +288,7 @@ Response header information for HTTP. | TQHttpResponseHeader Rich text browser with hypertext navigation. | TQTextBrowser Robust integer semaphore. | TQSemaphore Rounded range control (like a speedometer or potentiometer). | TQDial -SGI/Irix look and feel. | QSGIStyle +SGI/Irix look and feel. | TQSGIStyle SQL database error information. | TQSqlError Scrolling area with on-demand scroll bars. | TQScrollView Serialization of binary data to a TQIODevice. | TQDataStream @@ -335,8 +335,8 @@ Template class which ensures that implicitly shared and explicitly shared classe Template collection class that provides a vector (array). | TQPtrVector Text object on a TQCanvas. | TQCanvasText Text or image display. | TQLabel -The TQDialog API for Motif-based dialogs. | QMotifDialog -The TQWidget API for Xt/Motif widgets. | QMotifWidget +The TQDialog API for Motif-based dialogs. | TQMotifDialog +The TQWidget API for Xt/Motif widgets. | TQMotifWidget The XML handler classes with information about the parsing position within a file. | TQXmlLocator The abstract base class of button widgets, providing functionality common to buttons. | TQButton The base class for all the nodes in a DOM tree. | TQDomNode @@ -350,7 +350,7 @@ The base class of geometry managers. | TQLayout The base class of most pointer-based TQt collections. | TQPtrCollection The base class of objects that can be painted. | TQPaintDevice The base class of widgets that can have a frame. | TQFrame -The basis of the Motif Extension. | QMotif +The basis of the Motif Extension. | TQMotif The cell content for TQTable cells. | TQTableItem The display format of an OpenGL rendering context. | TQGLFormat The input data for the TQXmlReader subclasses. | TQXmlInputSource diff --git a/doc/indices.doc b/doc/indices.doc index 18323a33a..7ce11484d 100644 --- a/doc/indices.doc +++ b/doc/indices.doc @@ -358,7 +358,7 @@ in a line-by-line coverage please refer to the tutorials \section1 TQt Extensions: Assorted Examples \list -\i \link motif-examples.html QMotif support extension \endlink +\i \link motif-examples.html TQMotif support extension \endlink \omit \i \link xt-motif-examples.html Xt/Motif support extension \endlink \endomit \i \link nsplugin-examples.html Qt-based plugins for web browsers \endlink \endlist @@ -452,13 +452,13 @@ For more information see the \link netscape-plugin.html Plugin Howto \endlink. /*! \defgroup motif-examples -\title QMotif Support Extension +\title TQMotif Support Extension -The following example programs illustrate the use of the QMotif Extension +The following example programs illustrate the use of the TQMotif Extension assisting in the migration process of old Xt and Motif based code to the more comfortable TQt toolkit. -For more information see the \link motif-extension.html QMotif +For more information see the \link motif-extension.html TQMotif Support Extension documentation. \endlink */ diff --git a/doc/man/man3/tqapplication.3qt b/doc/man/man3/tqapplication.3qt index e5d3b9a54..0559b88e2 100644 --- a/doc/man/man3/tqapplication.3qt +++ b/doc/man/man3/tqapplication.3qt @@ -1431,7 +1431,7 @@ Example usage: .PP .nf .br - QApplication::setStyle( new QWindowsStyle ); + QApplication::setStyle( new TQWindowsStyle ); .br .fi .PP diff --git a/doc/man/man3/tqcdestyle.3qt b/doc/man/man3/tqcdestyle.3qt index c101317ab..217a2edce 100644 --- a/doc/man/man3/tqcdestyle.3qt +++ b/doc/man/man3/tqcdestyle.3qt @@ -1,5 +1,5 @@ '\" t -.TH QCDEStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQCDEStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,39 +7,39 @@ .ad l .nh .SH NAME -QCDEStyle \- CDE look and feel +TQCDEStyle \- CDE look and feel .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP -Inherits QMotifStyle. +Inherits TQMotifStyle. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQCDEStyle\fR ( bool useHighlightCols = FALSE )" +.BI "\fBTQCDEStyle\fR ( bool useHighlightCols = FALSE )" .br .ti -1c -.BI "virtual \fB~QCDEStyle\fR ()" +.BI "virtual \fB~TQCDEStyle\fR ()" .br .in -1c .SH DESCRIPTION -The QCDEStyle class provides a CDE look and feel. +The TQCDEStyle class provides a CDE look and feel. .PP This style provides a slightly improved Motif look similar to some versions of the Common Desktop Environment (CDE). The main differences are thinner frames and more modern radio buttons and checkboxes. Together with a dark background and a bright text/foreground color, the style looks quite attractive (at least for Motif fans). .PP -Note that the functions provided by QCDEStyle are reimplementations of TQStyle functions; see TQStyle for their documentation. +Note that the functions provided by TQCDEStyle are reimplementations of TQStyle functions; see TQStyle for their documentation. .PP See also Widget Appearance and Style. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QCDEStyle::QCDEStyle ( bool useHighlightCols = FALSE )" -Constructs a QCDEStyle. +.SH "TQCDEStyle::TQCDEStyle ( bool useHighlightCols = FALSE )" +Constructs a TQCDEStyle. .PP If \fIuseHighlightCols\fR is FALSE (the default), then the style will polish the application's color palette to emulate the Motif way of highlighting, which is a simple inversion between the base and the text color. -.SH "QCDEStyle::~QCDEStyle ()\fC [virtual]\fR" +.SH "TQCDEStyle::~TQCDEStyle ()\fC [virtual]\fR" Destroys the style. .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqcdestyle.html +.BR http://doc.trolltech.com/tqcdestyle.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqcommonstyle.3qt b/doc/man/man3/tqcommonstyle.3qt index ad8f79e7c..445511dc6 100644 --- a/doc/man/man3/tqcommonstyle.3qt +++ b/doc/man/man3/tqcommonstyle.3qt @@ -1,5 +1,5 @@ '\" t -.TH QCommonStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQCommonStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,22 +7,22 @@ .ad l .nh .SH NAME -QCommonStyle \- Encapsulates the common Look and Feel of a GUI +TQCommonStyle \- Encapsulates the common Look and Feel of a GUI .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits TQStyle. .PP -Inherited by QMotifStyle and QWindowsStyle. +Inherited by TQMotifStyle and TQWindowsStyle. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQCommonStyle\fR ()" +.BI "\fBTQCommonStyle\fR ()" .br .in -1c .SH DESCRIPTION -The QCommonStyle class encapsulates the common Look and Feel of a GUI. +The TQCommonStyle class encapsulates the common Look and Feel of a GUI. .PP This abstract class implements some of the widget's look and feel that is common to all GUI styles provided and shipped as part of Qt. .PP @@ -30,11 +30,11 @@ All the functions are documented in TQStyle. .PP See also Widget Appearance and Style. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QCommonStyle::QCommonStyle ()" -Constructs a QCommonStyle. +.SH "TQCommonStyle::TQCommonStyle ()" +Constructs a TQCommonStyle. .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqcommonstyle.html +.BR http://doc.trolltech.com/tqcommonstyle.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqdialog.3qt b/doc/man/man3/tqdialog.3qt index 651b632ef..60fedb6dc 100644 --- a/doc/man/man3/tqdialog.3qt +++ b/doc/man/man3/tqdialog.3qt @@ -13,7 +13,7 @@ TQDialog \- The base class of dialog windows .PP Inherits TQWidget. .PP -Inherited by TQColorDialog, QErrorMessage, TQFileDialog, TQFontDialog, QInputDialog, QMessageBox, QMotifDialog, TQProgressDialog, TQTabDialog, and TQWizard. +Inherited by TQColorDialog, QErrorMessage, TQFileDialog, TQFontDialog, QInputDialog, QMessageBox, TQMotifDialog, TQProgressDialog, TQTabDialog, and TQWizard. .PP .SS "Public Members" .in +1c diff --git a/doc/man/man3/tqeventloop.3qt b/doc/man/man3/tqeventloop.3qt index ca4a66705..cedefb413 100644 --- a/doc/man/man3/tqeventloop.3qt +++ b/doc/man/man3/tqeventloop.3qt @@ -13,7 +13,7 @@ TQEventLoop \- Manages the event queue .PP Inherits TQObject. .PP -Inherited by QMotif. +Inherited by TQMotif. .PP .SS "Public Members" .in +1c diff --git a/doc/man/man3/tqmacstyle.3qt b/doc/man/man3/tqmacstyle.3qt index ed3993aa0..e1978ffe2 100644 --- a/doc/man/man3/tqmacstyle.3qt +++ b/doc/man/man3/tqmacstyle.3qt @@ -11,7 +11,7 @@ QMacStyle \- Implements an Appearance Manager style .SH SYNOPSIS \fC#include \fR .PP -Inherits QWindowsStyle. +Inherits TQWindowsStyle. .PP .SS "Public Members" .in +1c diff --git a/doc/man/man3/tqmotif.3qt b/doc/man/man3/tqmotif.3qt index 14202919b..670531e1b 100644 --- a/doc/man/man3/tqmotif.3qt +++ b/doc/man/man3/tqmotif.3qt @@ -1,5 +1,5 @@ '\" t -.TH QMotif 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQMotif 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,21 +7,21 @@ .ad l .nh .SH NAME -QMotif \- The basis of the +TQMotif \- The basis of the .SH SYNOPSIS This class is part of the \fBQt Motif Extension\fR. .PP -\fC#include \fR +\fC#include \fR .PP Inherits TQEventLoop. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQMotif\fR ( const char * applicationClass, XtAppContext context = NULL, XrmOptionDescRec * options = 0, int numOptions = 0 )" +.BI "\fBTQMotif\fR ( const char * applicationClass, XtAppContext context = NULL, XrmOptionDescRec * options = 0, int numOptions = 0 )" .br .ti -1c -.BI "\fB~QMotif\fR ()" +.BI "\fB~TQMotif\fR ()" .br .ti -1c .BI "XtAppContext \fBapplicationContext\fR () const" @@ -36,13 +36,13 @@ Inherits TQEventLoop. .SH DESCRIPTION This class is defined in the \fBQt Motif Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main TQt API. .PP -The QMotif class provides the basis of the Motif Extension. +The TQMotif class provides the basis of the Motif Extension. .PP -QMotif only provides a few public functions, but it is at the heart of the integration. QMotif is responsible for initializing the Xt toolkit and the Xt application context. It does not open a connection to the X server, that is done by QApplication. +TQMotif only provides a few public functions, but it is at the heart of the integration. TQMotif is responsible for initializing the Xt toolkit and the Xt application context. It does not open a connection to the X server, that is done by QApplication. .PP -The only member function in QMotif that depends on an X server connection is QMotif::initialize(). QMotif must be created before QApplication. +The only member function in TQMotif that depends on an X server connection is TQMotif::initialize(). TQMotif must be created before QApplication. .PP -Example usage of QMotif and QApplication: +Example usage of TQMotif and QApplication: .PP .nf .br @@ -57,7 +57,7 @@ Example usage of QMotif and QApplication: .br { .br - QMotif integrator( "AppClass" ); + TQMotif integrator( "AppClass" ); .br XtAppSetFallbackResources( integrator.applicationContext(), .br @@ -75,21 +75,21 @@ Example usage of QMotif and QApplication: .br .fi .SH MEMBER FUNCTION DOCUMENTATION -.SH "QMotif::QMotif ( const char * applicationClass, XtAppContext context = NULL, XrmOptionDescRec * options = 0, int numOptions = 0 )" -Creates QMotif, which allows TQt and Xt/Motif integration. +.SH "TQMotif::TQMotif ( const char * applicationClass, XtAppContext context = NULL, XrmOptionDescRec * options = 0, int numOptions = 0 )" +Creates TQMotif, which allows TQt and Xt/Motif integration. .PP -If \fIcontext\fR is 0, QMotif creates a default application context itself. The context is accessible through applicationContext(). +If \fIcontext\fR is 0, TQMotif creates a default application context itself. The context is accessible through applicationContext(). .PP All arguments passed to this function (\fIapplicationClass\fR, \fIoptions\fR and \fInumOptions\fR) are used to call XtDisplayInitialize() after QApplication has been constructed. -.SH "QMotif::~QMotif ()" -Destroys QMotif. -.SH "XtAppContext QMotif::applicationContext () const" +.SH "TQMotif::~TQMotif ()" +Destroys TQMotif. +.SH "XtAppContext TQMotif::applicationContext () const" Returns the application context. -.SH "Display * QMotif::x11Display ()\fC [static]\fR" +.SH "Display * TQMotif::x11Display ()\fC [static]\fR" Returns the X11 display connection used by the TQt Motif Extension. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qmotif.html +.BR http://doc.trolltech.com/tqmotif.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqmotifdialog.3qt b/doc/man/man3/tqmotifdialog.3qt index cb2ad0816..6589a3c89 100644 --- a/doc/man/man3/tqmotifdialog.3qt +++ b/doc/man/man3/tqmotifdialog.3qt @@ -1,5 +1,5 @@ '\" t -.TH QMotifDialog 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQMotifDialog 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,11 +7,11 @@ .ad l .nh .SH NAME -QMotifDialog \- The TQDialog API for Motif-based dialogs +TQMotifDialog \- The TQDialog API for Motif-based dialogs .SH SYNOPSIS This class is part of the \fBQt Motif Extension\fR. .PP -\fC#include \fR +\fC#include \fR .PP Inherits TQDialog. .PP @@ -21,19 +21,19 @@ Inherits TQDialog. .BI "enum DialogType { Prompt, Selection, Command, FileSelection, Template, Error, Information, Message, Question, Warning, Working } \fI(obsolete)\fR" .br .ti -1c -.BI "QMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) \fI(obsolete)\fR" +.BI "TQMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) \fI(obsolete)\fR" .br .ti -1c -.BI "QMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) \fI(obsolete)\fR" +.BI "TQMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 ) \fI(obsolete)\fR" .br .ti -1c -.BI "\fBQMotifDialog\fR ( Widget parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" +.BI "\fBTQMotifDialog\fR ( Widget parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" .br .ti -1c -.BI "\fBQMotifDialog\fR ( TQWidget * parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" +.BI "\fBTQMotifDialog\fR ( TQWidget * parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" .br .ti -1c -.BI "virtual \fB~QMotifDialog\fR ()" +.BI "virtual \fB~TQMotifDialog\fR ()" .br .ti -1c .BI "Widget \fBshell\fR () const" @@ -54,106 +54,106 @@ Inherits TQDialog. .SH DESCRIPTION This class is defined in the \fBQt Motif Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main TQt API. .PP -The QMotifDialog class provides the TQDialog API for Motif-based dialogs. +The TQMotifDialog class provides the TQDialog API for Motif-based dialogs. .PP -QMotifDialog provides two separate modes of operation. The application programmer can use QMotifDialog with an existing Motif-based dialog and a TQWidget parent, or the application programmer can use QMotifDialog with a custom Qt-based dialog and a Motif-based parent. Modality continues to work as expected. +TQMotifDialog provides two separate modes of operation. The application programmer can use TQMotifDialog with an existing Motif-based dialog and a TQWidget parent, or the application programmer can use TQMotifDialog with a custom Qt-based dialog and a Motif-based parent. Modality continues to work as expected. .PP Motif-based dialogs must have a \fCShell\fR widget parent with a single child, due to requirements of the Motif toolkit. The \fCShell\fR widget, which is a special subclass of \fCXmDialogShell\fR, is created during construction. It can be accessed using the shell() member function. .PP The single child of the \fCShell\fR can be accessed using the dialog() member function \fIafter\fR it has been created. .PP -The acceptCallback() and rejectCallback() functions provide a convenient way to call TQDialog::accept() and TQDialog::reject() through callbacks. A pointer to the QMotifDialog should be passed as the \fCclient_data\fR argument to the callback. +The acceptCallback() and rejectCallback() functions provide a convenient way to call TQDialog::accept() and TQDialog::reject() through callbacks. A pointer to the TQMotifDialog should be passed as the \fCclient_data\fR argument to the callback. .PP -The API and behavior QMotifDialog is identical to that of TQDialog when using a custom Qt-based dialog with a Motif-based parent. The only difference is that a Motif-based \fIparent\fR argument is passed to the constructor, instead of a TQWidget parent. +The API and behavior TQMotifDialog is identical to that of TQDialog when using a custom Qt-based dialog with a Motif-based parent. The only difference is that a Motif-based \fIparent\fR argument is passed to the constructor, instead of a TQWidget parent. .SS "Member Type Documentation" -.SH "QMotifDialog::DialogType" +.SH "TQMotifDialog::DialogType" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP This enum lists the predefined Motif dialog types. .TP -\fCQMotifDialog::Prompt\fR +\fCTQMotifDialog::Prompt\fR .TP -\fCQMotifDialog::Selection\fR +\fCTQMotifDialog::Selection\fR .TP -\fCQMotifDialog::Command\fR +\fCTQMotifDialog::Command\fR .TP -\fCQMotifDialog::FileSelection\fR +\fCTQMotifDialog::FileSelection\fR .TP -\fCQMotifDialog::Template\fR +\fCTQMotifDialog::Template\fR .TP -\fCQMotifDialog::Error\fR +\fCTQMotifDialog::Error\fR .TP -\fCQMotifDialog::Information\fR +\fCTQMotifDialog::Information\fR .TP -\fCQMotifDialog::Message\fR +\fCTQMotifDialog::Message\fR .TP -\fCQMotifDialog::Question\fR +\fCTQMotifDialog::Question\fR .TP -\fCQMotifDialog::Warning\fR +\fCTQMotifDialog::Warning\fR .TP -\fCQMotifDialog::Working\fR +\fCTQMotifDialog::Working\fR .SH MEMBER FUNCTION DOCUMENTATION -.SH "QMotifDialog::QMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" +.SH "TQMotifDialog::TQMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP -Creates a QMotifDialog using one of the predefined Motif dialog types. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. +Creates a TQMotifDialog using one of the predefined Motif dialog types. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. .PP This constructor creates a Shell widget, which is a special subclass of XmDialogShell. The \fIparent\fR, \fIargs\fR and \fIargcount\fR arguments are passed to XtCreatePopupShell() when creating the subclass. You can access the Shell widget with the shell() member function. .PP This constructor also creates the dialog widget with the Shell widget as its parent. The type of the dialog created is specified by the \fIdialogtype\fR argument. See the DialogType enum for a list of available dialog types. You can access the dialog widget with the dialog() member function. .PP -\fBWarning:\fR QMotifDialog takes ownership of the child widget and destroys it during destruction. You should not destroy the dialog widget yourself. +\fBWarning:\fR TQMotifDialog takes ownership of the child widget and destroys it during destruction. You should not destroy the dialog widget yourself. .PP See also DialogType, shell(), and dialog(). -.SH "QMotifDialog::QMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" +.SH "TQMotifDialog::TQMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP -Creates a QMotifDialog which allows the application programmer to use the Motif-based \fIparent\fR for a custom TQDialog. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. +Creates a TQMotifDialog which allows the application programmer to use the Motif-based \fIparent\fR for a custom TQDialog. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. .PP This constructor creates a Shell widget, which is a special subclass of XmDialogShell. The \fIargs\fR and \fIargcount\fR arguments are passed to XtCreatePopupShell() when creating the subclass. You can access the Shell widget with the shell() member function. .PP The dialog widget is not created by the constructor. You must create the dialog widget as a child of the the widget returned by shell(). You can access the child widget with the dialog() member function. .PP -A dialog widget is not created by this constructor. Instead, you should create the dialog widget as a child of this dialog. QMotifDialog will take ownership of your custom dialog, and you can access it with the dialog() member function. +A dialog widget is not created by this constructor. Instead, you should create the dialog widget as a child of this dialog. TQMotifDialog will take ownership of your custom dialog, and you can access it with the dialog() member function. .PP -\fBWarning:\fR QMotifDialog takes ownership of the child widget and destroys it during destruction. You should not destroy the dialog widget yourself. +\fBWarning:\fR TQMotifDialog takes ownership of the child widget and destroys it during destruction. You should not destroy the dialog widget yourself. .PP See also shell() and dialog(). -.SH "QMotifDialog::QMotifDialog ( Widget parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" -Creates a QMotifDialog which allows the application programmer to use the Motif-based \fIparent\fR for a custom TQDialog. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. +.SH "TQMotifDialog::TQMotifDialog ( Widget parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" +Creates a TQMotifDialog which allows the application programmer to use the Motif-based \fIparent\fR for a custom TQDialog. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. .PP This constructor creates a \fCShell\fR widget, which is a special subclass of \fCXmDialogShell\fR. You can access the \fCShell\fR widget with the shell() member function. .PP See also shell(). -.SH "QMotifDialog::QMotifDialog ( TQWidget * parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" -Creates a QMotifDialog which allows the application programmer to use a TQWidget parent for an existing Motif-based dialog. The \fIparent\fR, \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. +.SH "TQMotifDialog::TQMotifDialog ( TQWidget * parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" +Creates a TQMotifDialog which allows the application programmer to use a TQWidget parent for an existing Motif-based dialog. The \fIparent\fR, \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. .PP This constructor creates a \fCShell\fR widget, which is a special subclass of \fCXmDialogShell\fR. You can access the \fCShell\fR widget with the shell() member functon. .PP -A dialog widget is not created by this constructor. Instead, you should create the dialog widget as a child of this dialog. QMotifDialog will take ownership of your custom dialog, and you can access it with the dialog() member function. +A dialog widget is not created by this constructor. Instead, you should create the dialog widget as a child of this dialog. TQMotifDialog will take ownership of your custom dialog, and you can access it with the dialog() member function. .PP -\fBWarning:\fR QMotifDialog takes ownership of the child widget and destroys it during destruction. You should not destroy the dialog widget yourself. +\fBWarning:\fR TQMotifDialog takes ownership of the child widget and destroys it during destruction. You should not destroy the dialog widget yourself. .PP See also shell() and dialog(). -.SH "QMotifDialog::~QMotifDialog ()\fC [virtual]\fR" +.SH "TQMotifDialog::~TQMotifDialog ()\fC [virtual]\fR" Destroys the TQDialog, dialog widget and \fCShell\fR widget. -.SH "void QMotifDialog::acceptCallback ( Widget, XtPointer client_data, XtPointer )\fC [static]\fR" -Convenient Xt/Motif callback to accept the QMotifDialog. +.SH "void TQMotifDialog::acceptCallback ( Widget, XtPointer client_data, XtPointer )\fC [static]\fR" +Convenient Xt/Motif callback to accept the TQMotifDialog. .PP The data is passed in \fIclient_data\fR. -.SH "Widget QMotifDialog::dialog () const" +.SH "Widget TQMotifDialog::dialog () const" Returns the Motif widget embedded in this dialog. -.SH "void QMotifDialog::rejectCallback ( Widget, XtPointer client_data, XtPointer )\fC [static]\fR" -Convenient Xt/Motif callback to reject the QMotifDialog. +.SH "void TQMotifDialog::rejectCallback ( Widget, XtPointer client_data, XtPointer )\fC [static]\fR" +Convenient Xt/Motif callback to reject the TQMotifDialog. .PP The data is passed in \fIclient_data\fR. -.SH "Widget QMotifDialog::shell () const" +.SH "Widget TQMotifDialog::shell () const" Returns the \fCShell\fR widget embedded in this dialog. .PP Example: dialog/mainwindow.cpp. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qmotifdialog.html +.BR http://doc.trolltech.com/tqmotifdialog.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqmotifplusstyle.3qt b/doc/man/man3/tqmotifplusstyle.3qt index 4c1276cc9..9f377df26 100644 --- a/doc/man/man3/tqmotifplusstyle.3qt +++ b/doc/man/man3/tqmotifplusstyle.3qt @@ -1,5 +1,5 @@ '\" t -.TH QMotifPlusStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQMotifPlusStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,34 +7,34 @@ .ad l .nh .SH NAME -QMotifPlusStyle \- More sophisticated Motif-ish look and feel +TQMotifPlusStyle \- More sophisticated Motif-ish look and feel .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP -Inherits QMotifStyle. +Inherits TQMotifStyle. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQMotifPlusStyle\fR ( bool hoveringHighlight = TRUE )" +.BI "\fBTQMotifPlusStyle\fR ( bool hoveringHighlight = TRUE )" .br .in -1c .SH DESCRIPTION -The QMotifPlusStyle class provides a more sophisticated Motif-ish look and feel. +The TQMotifPlusStyle class provides a more sophisticated Motif-ish look and feel. .PP This class implements a Motif-ish look and feel with the more sophisticated bevelling as used by the GIMP Toolkit (GTK+) for Unix/X11. .PP See also Widget Appearance and Style. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QMotifPlusStyle::QMotifPlusStyle ( bool hoveringHighlight = TRUE )" -Constructs a QMotifPlusStyle +.SH "TQMotifPlusStyle::TQMotifPlusStyle ( bool hoveringHighlight = TRUE )" +Constructs a TQMotifPlusStyle .PP If \fIhoveringHighlight\fR is TRUE (the default), then the style will not highlight push buttons, checkboxes, radiobuttons, comboboxes, scrollbars or sliders. .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqmotifplusstyle.html +.BR http://doc.trolltech.com/tqmotifplusstyle.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqmotifstyle.3qt b/doc/man/man3/tqmotifstyle.3qt index 3204a3e07..a78bf7295 100644 --- a/doc/man/man3/tqmotifstyle.3qt +++ b/doc/man/man3/tqmotifstyle.3qt @@ -1,5 +1,5 @@ '\" t -.TH QMotifStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQMotifStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,18 +7,18 @@ .ad l .nh .SH NAME -QMotifStyle \- Motif look and feel +TQMotifStyle \- Motif look and feel .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP -Inherits QCommonStyle. +Inherits TQCommonStyle. .PP -Inherited by QCDEStyle, QMotifPlusStyle, and QSGIStyle. +Inherited by TQCDEStyle, TQMotifPlusStyle, and TQSGIStyle. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQMotifStyle\fR ( bool useHighlightCols = FALSE )" +.BI "\fBTQMotifStyle\fR ( bool useHighlightCols = FALSE )" .br .ti -1c .BI "void \fBsetUseHighlightColors\fR ( bool arg )" @@ -28,30 +28,30 @@ Inherited by QCDEStyle, QMotifPlusStyle, and QSGIStyle. .br .in -1c .SH DESCRIPTION -The QMotifStyle class provides Motif look and feel. +The TQMotifStyle class provides Motif look and feel. .PP This class implements the Motif look and feel. It closely resembles the original Motif look as defined by the Open Group, but with some minor improvements. The Motif style is Qt's default GUI style on UNIX platforms. .PP See also Widget Appearance and Style. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QMotifStyle::QMotifStyle ( bool useHighlightCols = FALSE )" -Constructs a QMotifStyle. +.SH "TQMotifStyle::TQMotifStyle ( bool useHighlightCols = FALSE )" +Constructs a TQMotifStyle. .PP If \fIuseHighlightCols\fR is FALSE (the default), the style will polish the application's color palette to emulate the Motif way of highlighting, which is a simple inversion between the base and the text color. -.SH "void QMotifStyle::setUseHighlightColors ( bool arg )" +.SH "void TQMotifStyle::setUseHighlightColors ( bool arg )" If \fIarg\fR is FALSE, the style will polish the application's color palette to emulate the Motif way of highlighting, which is a simple inversion between the base and the text color. .PP The effect will show up the next time an application palette is set via QApplication::setPalette(). The current color palette of the application remains unchanged. .PP See also TQStyle::polish(). -.SH "bool QMotifStyle::useHighlightColors () const" +.SH "bool TQMotifStyle::useHighlightColors () const" Returns TRUE if the style treats the highlight colors of the palette in a Motif-like manner, which is a simple inversion between the base and the text color; otherwise returns FALSE. The default is FALSE. .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqmotifstyle.html +.BR http://doc.trolltech.com/tqmotifstyle.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqmotifwidget.3qt b/doc/man/man3/tqmotifwidget.3qt index 623544351..3b12c0a42 100644 --- a/doc/man/man3/tqmotifwidget.3qt +++ b/doc/man/man3/tqmotifwidget.3qt @@ -1,5 +1,5 @@ '\" t -.TH QMotifWidget 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQMotifWidget 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,21 +7,21 @@ .ad l .nh .SH NAME -QMotifWidget \- The TQWidget API for Xt/Motif widgets +TQMotifWidget \- The TQWidget API for Xt/Motif widgets .SH SYNOPSIS This class is part of the \fBQt Motif Extension\fR. .PP -\fC#include \fR +\fC#include \fR .PP Inherits TQWidget. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQMotifWidget\fR ( TQWidget * parent, WidgetClass widgetclass, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, WFlags flags = 0 )" +.BI "\fBTQMotifWidget\fR ( TQWidget * parent, WidgetClass widgetclass, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, WFlags flags = 0 )" .br .ti -1c -.BI "virtual \fB~QMotifWidget\fR ()" +.BI "virtual \fB~TQMotifWidget\fR ()" .br .ti -1c .BI "Widget \fBmotifWidget\fR () const" @@ -36,32 +36,32 @@ Inherits TQWidget. .SH DESCRIPTION This class is defined in the \fBQt Motif Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main TQt API. .PP -The QMotifWidget class provides the TQWidget API for Xt/Motif widgets. +The TQMotifWidget class provides the TQWidget API for Xt/Motif widgets. .PP -QMotifWidget exists to provide a TQWidget that can act as a parent for any Xt/Motif widget. Since the QMotifWidget is a proper TQWidget, it can be used as a top-level widget (e.g. 0 parent) or as a child of any other TQWidget. Note: Since QMotifWidget acts as a parent for Xt/Motif widgets, you should not create TQWidgets with a QMotifWidget parent. +TQMotifWidget exists to provide a TQWidget that can act as a parent for any Xt/Motif widget. Since the TQMotifWidget is a proper TQWidget, it can be used as a top-level widget (e.g. 0 parent) or as a child of any other TQWidget. Note: Since TQMotifWidget acts as a parent for Xt/Motif widgets, you should not create TQWidgets with a TQMotifWidget parent. .PP -An Xt/Motif widget with a top-level QMotifWidget parent can begin using the standard TQt dialogs and custom TQDialogs while keeping the main Xt/Motif interface of the application. Using a QMotifWidget as the parent for the various TQDialogs will ensure that modality and stacking works properly throughout the entire application. +An Xt/Motif widget with a top-level TQMotifWidget parent can begin using the standard TQt dialogs and custom TQDialogs while keeping the main Xt/Motif interface of the application. Using a TQMotifWidget as the parent for the various TQDialogs will ensure that modality and stacking works properly throughout the entire application. .PP -Applications moving to TQt may have custom Xt/Motif widgets that will take time to rewrite with Qt. Such applications can use these custom widgets as QMotifWidget with TQWidget parents. This allows the application's interface to be replaced gradually. +Applications moving to TQt may have custom Xt/Motif widgets that will take time to rewrite with Qt. Such applications can use these custom widgets as TQMotifWidget with TQWidget parents. This allows the application's interface to be replaced gradually. .PP -\fBWarning:\fR QMotifWidget uses the X11 window ID of the Motif widget directly, instead of creating its own. Because ot this, TQWidget::reparent() will not work. This includes the functions TQWidget::showFullScreen() and TQWidget::showNormal(), which use TQWidget::reparent(). +\fBWarning:\fR TQMotifWidget uses the X11 window ID of the Motif widget directly, instead of creating its own. Because ot this, TQWidget::reparent() will not work. This includes the functions TQWidget::showFullScreen() and TQWidget::showNormal(), which use TQWidget::reparent(). .SH MEMBER FUNCTION DOCUMENTATION -.SH "QMotifWidget::QMotifWidget ( TQWidget * parent, WidgetClass widgetclass, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, WFlags flags = 0 )" -Creates a QMotifWidget of the given \fIwidgetclass\fR as a child of \fIparent\fR, with the name \fIname\fR and widget flags \fIflags\fR. +.SH "TQMotifWidget::TQMotifWidget ( TQWidget * parent, WidgetClass widgetclass, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, WFlags flags = 0 )" +Creates a TQMotifWidget of the given \fIwidgetclass\fR as a child of \fIparent\fR, with the name \fIname\fR and widget flags \fIflags\fR. .PP The \fIargs\fR and \fIargcount\fR arguments are passed on to XtCreateWidget. .PP The motifWidget() function returns the resulting Xt/Motif widget. This widget can be used as a parent for any other Xt/Motif widget. .PP -If \fIparent\fR is a QMotifWidget, the Xt/Motif widget is created as a child of the parent's motifWidget(). If \ parent is 0 or a normal TQWidget, the Xt/Motif widget is created as a child of a special TopLevelShell widget. Xt/Motif widgets can use this special TopLevelShell parent as the parent for existing Xt/Motif dialogs or QMotifDialogs. -.SH "QMotifWidget::~QMotifWidget ()\fC [virtual]\fR" -Destroys the QMotifWidget. The special TopLevelShell is also destroyed, if it was created during construction. -.SH "Widget QMotifWidget::motifWidget () const" +If \fIparent\fR is a TQMotifWidget, the Xt/Motif widget is created as a child of the parent's motifWidget(). If \ parent is 0 or a normal TQWidget, the Xt/Motif widget is created as a child of a special TopLevelShell widget. Xt/Motif widgets can use this special TopLevelShell parent as the parent for existing Xt/Motif dialogs or TQMotifDialogs. +.SH "TQMotifWidget::~TQMotifWidget ()\fC [virtual]\fR" +Destroys the TQMotifWidget. The special TopLevelShell is also destroyed, if it was created during construction. +.SH "Widget TQMotifWidget::motifWidget () const" Returns the embedded Xt/Motif widget. If a Shell widget was created by the constructor, you can access it with XtParent(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/qmotifwidget.html +.BR http://doc.trolltech.com/tqmotifwidget.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqplatinumstyle.3qt b/doc/man/man3/tqplatinumstyle.3qt index 1c364ee9e..174d42833 100644 --- a/doc/man/man3/tqplatinumstyle.3qt +++ b/doc/man/man3/tqplatinumstyle.3qt @@ -1,5 +1,5 @@ '\" t -.TH QPlatinumStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQPlatinumStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,16 +7,16 @@ .ad l .nh .SH NAME -QPlatinumStyle \- Mac/Platinum look and feel +TQPlatinumStyle \- Mac/Platinum look and feel .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP -Inherits QWindowsStyle. +Inherits TQWindowsStyle. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQPlatinumStyle\fR ()" +.BI "\fBTQPlatinumStyle\fR ()" .br .in -1c .SS "Protected Members" @@ -29,21 +29,21 @@ Inherits QWindowsStyle. .br .in -1c .SH DESCRIPTION -The QPlatinumStyle class provides Mac/Platinum look and feel. +The TQPlatinumStyle class provides Mac/Platinum look and feel. .PP This class implements the Platinum look and feel. It's an experimental class that tries to resemble a Macinosh-like GUI style with the TQStyle system. The emulation is currently far from perfect. .PP See also QAquaStyle and Widget Appearance and Style. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QPlatinumStyle::QPlatinumStyle ()" -Constructs a QPlatinumStyle -.SH "void QPlatinumStyle::drawRiffles ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool horizontal ) const\fC [protected]\fR" +.SH "TQPlatinumStyle::TQPlatinumStyle ()" +Constructs a TQPlatinumStyle +.SH "void TQPlatinumStyle::drawRiffles ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool horizontal ) const\fC [protected]\fR" Draws the nifty Macintosh decoration used on sliders using painter \fIp\fR and colorgroup \fIg\fR. \fIx\fR, \fIy\fR, \fIw\fR, \fIh\fR and \fIhorizontal\fR specify the geometry and orientation of the riffles. -.SH "TQColor QPlatinumStyle::mixedColor ( const TQColor & c1, const TQColor & c2 ) const\fC [protected]\fR" +.SH "TQColor TQPlatinumStyle::mixedColor ( const TQColor & c1, const TQColor & c2 ) const\fC [protected]\fR" Mixes two colors \fIc1\fR and \fIc2\fR to a new color. .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqplatinumstyle.html +.BR http://doc.trolltech.com/tqplatinumstyle.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqsgistyle.3qt b/doc/man/man3/tqsgistyle.3qt index aa0b419c9..127b70cb4 100644 --- a/doc/man/man3/tqsgistyle.3qt +++ b/doc/man/man3/tqsgistyle.3qt @@ -1,5 +1,5 @@ '\" t -.TH QSGIStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQSGIStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,39 +7,39 @@ .ad l .nh .SH NAME -QSGIStyle \- SGI/Irix look and feel +TQSGIStyle \- SGI/Irix look and feel .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP -Inherits QMotifStyle. +Inherits TQMotifStyle. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQSGIStyle\fR ( bool useHighlightCols = FALSE )" +.BI "\fBTQSGIStyle\fR ( bool useHighlightCols = FALSE )" .br .ti -1c -.BI "virtual \fB~QSGIStyle\fR ()" +.BI "virtual \fB~TQSGIStyle\fR ()" .br .in -1c .SH DESCRIPTION -The QSGIStyle class provides SGI/Irix look and feel. +The TQSGIStyle class provides SGI/Irix look and feel. .PP This class implements the SGI look and feel. It resembles the SGI/Irix Motif GUI style as closely as TQStyle allows. .PP See also Widget Appearance and Style. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QSGIStyle::QSGIStyle ( bool useHighlightCols = FALSE )" -Constructs a QSGIStyle. +.SH "TQSGIStyle::TQSGIStyle ( bool useHighlightCols = FALSE )" +Constructs a TQSGIStyle. .PP If \fIuseHighlightCols\fR is FALSE (default value), the style will polish the application's color palette to emulate the Motif way of highlighting, which is a simple inversion between the base and the text color. .PP -See also QMotifStyle::useHighlightColors(). -.SH "QSGIStyle::~QSGIStyle ()\fC [virtual]\fR" +See also TQMotifStyle::useHighlightColors(). +.SH "TQSGIStyle::~TQSGIStyle ()\fC [virtual]\fR" Destroys the style. .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqsgistyle.html +.BR http://doc.trolltech.com/tqsgistyle.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqstyle.3qt b/doc/man/man3/tqstyle.3qt index 95c90888b..e4d83d431 100644 --- a/doc/man/man3/tqstyle.3qt +++ b/doc/man/man3/tqstyle.3qt @@ -13,7 +13,7 @@ TQStyle \- The look and feel of a GUI .PP Inherits TQObject. .PP -Inherited by QCommonStyle. +Inherited by TQCommonStyle. .PP .SS "Public Members" .in +1c diff --git a/doc/man/man3/tqtextcodec.3qt b/doc/man/man3/tqtextcodec.3qt index ff7036b22..f7f9950e4 100644 --- a/doc/man/man3/tqtextcodec.3qt +++ b/doc/man/man3/tqtextcodec.3qt @@ -344,7 +344,7 @@ Finally, you must implement: .fi Gives a value indicating how likely it is that \fIlen\fR characters from \fIchars\fR are in the encoding. .PP -A good model for this function is the QWindowsLocalCodec::heuristicContentMatch function found in the TQt sources. +A good model for this function is the TQWindowsLocalCodec::heuristicContentMatch function found in the TQt sources. .PP A TQTextCodec subclass might have improved performance if you also re-implement: .PP diff --git a/doc/man/man3/tqwidget.3qt b/doc/man/man3/tqwidget.3qt index de57a0406..346dd3b2c 100644 --- a/doc/man/man3/tqwidget.3qt +++ b/doc/man/man3/tqwidget.3qt @@ -13,7 +13,7 @@ TQWidget \- The base class of all user interface objects .PP Inherits TQObject and TQPaintDevice. .PP -Inherited by TQButton, TQFrame, TQDialog, TQComboBox, TQDataBrowser, TQDataView, TQDateTimeEditBase, TQDateTimeEdit, TQDesktopWidget, TQDial, QDockArea, TQGLWidget, TQHeader, TQMainWindow, QMotifWidget, QNPWidget, TQScrollBar, TQSizeGrip, TQSlider, TQSpinBox, QSplashScreen, TQStatusBar, TQTabBar, TQTabWidget, TQWorkspace, and QXtWidget. +Inherited by TQButton, TQFrame, TQDialog, TQComboBox, TQDataBrowser, TQDataView, TQDateTimeEditBase, TQDateTimeEdit, TQDesktopWidget, TQDial, QDockArea, TQGLWidget, TQHeader, TQMainWindow, TQMotifWidget, QNPWidget, TQScrollBar, TQSizeGrip, TQSlider, TQSpinBox, QSplashScreen, TQStatusBar, TQTabBar, TQTabWidget, TQWorkspace, and QXtWidget. .PP .SS "Public Members" .in +1c diff --git a/doc/man/man3/tqwindowsstyle.3qt b/doc/man/man3/tqwindowsstyle.3qt index 2fa5fc419..c12d822f8 100644 --- a/doc/man/man3/tqwindowsstyle.3qt +++ b/doc/man/man3/tqwindowsstyle.3qt @@ -1,5 +1,5 @@ '\" t -.TH QWindowsStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQWindowsStyle 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,32 +7,32 @@ .ad l .nh .SH NAME -QWindowsStyle \- Microsoft Windows-like look and feel +TQWindowsStyle \- Microsoft Windows-like look and feel .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP -Inherits QCommonStyle. +Inherits TQCommonStyle. .PP -Inherited by QMacStyle and QPlatinumStyle. +Inherited by QMacStyle and TQPlatinumStyle. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQWindowsStyle\fR ()" +.BI "\fBTQWindowsStyle\fR ()" .br .in -1c .SH DESCRIPTION -The QWindowsStyle class provides a Microsoft Windows-like look and feel. +The TQWindowsStyle class provides a Microsoft Windows-like look and feel. .PP This style is Qt's default GUI style on Windows. .PP See also Widget Appearance and Style. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QWindowsStyle::QWindowsStyle ()" -Constructs a QWindowsStyle +.SH "TQWindowsStyle::TQWindowsStyle ()" +Constructs a TQWindowsStyle .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqwindowsstyle.html +.BR http://doc.trolltech.com/tqwindowsstyle.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/modules.doc b/doc/modules.doc index 942b9f5cf..4a8536411 100644 --- a/doc/modules.doc +++ b/doc/modules.doc @@ -60,7 +60,7 @@ with each Edition. \i \link table.html Table Module\endlink \i \link workspace.html Workspace (MDI) Module\endlink \i \link xml.html XML Module\endlink -\i \link motif-extension.html QMotif Extension\endlink +\i \link motif-extension.html TQMotif Extension\endlink \i \link netscape-plugin.html Netscape Plugin Extension\endlink \endlist diff --git a/examples/progressbar/progressbar.cpp b/examples/progressbar/progressbar.cpp index 0969f8101..a513c5248 100644 --- a/examples/progressbar/progressbar.cpp +++ b/examples/progressbar/progressbar.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include /* * Constructor diff --git a/examples/themes/main.cpp b/examples/themes/main.cpp index a560b5f70..74ea035a7 100644 --- a/examples/themes/main.cpp +++ b/examples/themes/main.cpp @@ -8,7 +8,7 @@ *****************************************************************************/ #include -#include +#include #include "themes.h" #include "metal.h" diff --git a/examples/themes/metal.h b/examples/themes/metal.h index b37999c0c..0941840d6 100644 --- a/examples/themes/metal.h +++ b/examples/themes/metal.h @@ -19,7 +19,7 @@ #ifndef TQT_NO_STYLE_WINDOWS -#include +#include class MetalStyle : public TQWindowsStyle diff --git a/examples/themes/wood.h b/examples/themes/wood.h index 869c89b2b..6fd769a26 100644 --- a/examples/themes/wood.h +++ b/examples/themes/wood.h @@ -19,7 +19,7 @@ #ifndef TQT_NO_STYLE_WINDOWS -#include +#include class NorwegianWoodStyle : public TQWindowsStyle diff --git a/include/ntqcdestyle.h b/include/ntqcdestyle.h deleted file mode 120000 index bc833ecb1..000000000 --- a/include/ntqcdestyle.h +++ /dev/null @@ -1 +0,0 @@ -../src/styles/ntqcdestyle.h \ No newline at end of file diff --git a/include/ntqcommonstyle.h b/include/ntqcommonstyle.h deleted file mode 120000 index 16dfb1eee..000000000 --- a/include/ntqcommonstyle.h +++ /dev/null @@ -1 +0,0 @@ -../src/styles/ntqcommonstyle.h \ No newline at end of file diff --git a/include/ntqcompactstyle.h b/include/ntqcompactstyle.h deleted file mode 120000 index 3c60dd250..000000000 --- a/include/ntqcompactstyle.h +++ /dev/null @@ -1 +0,0 @@ -../src/styles/ntqcompactstyle.h \ No newline at end of file diff --git a/include/ntqinterlacestyle.h b/include/ntqinterlacestyle.h deleted file mode 120000 index 624749831..000000000 --- a/include/ntqinterlacestyle.h +++ /dev/null @@ -1 +0,0 @@ -../src/styles/ntqinterlacestyle.h \ No newline at end of file diff --git a/include/ntqmotifplusstyle.h b/include/ntqmotifplusstyle.h deleted file mode 120000 index 82812f2be..000000000 --- a/include/ntqmotifplusstyle.h +++ /dev/null @@ -1 +0,0 @@ -../src/styles/ntqmotifplusstyle.h \ No newline at end of file diff --git a/include/ntqmotifstyle.h b/include/ntqmotifstyle.h deleted file mode 120000 index 3db8280f1..000000000 --- a/include/ntqmotifstyle.h +++ /dev/null @@ -1 +0,0 @@ -../src/styles/ntqmotifstyle.h \ No newline at end of file diff --git a/include/ntqplatinumstyle.h b/include/ntqplatinumstyle.h deleted file mode 120000 index 01143415e..000000000 --- a/include/ntqplatinumstyle.h +++ /dev/null @@ -1 +0,0 @@ -../src/styles/ntqplatinumstyle.h \ No newline at end of file diff --git a/include/ntqsgistyle.h b/include/ntqsgistyle.h deleted file mode 120000 index 59b1d463e..000000000 --- a/include/ntqsgistyle.h +++ /dev/null @@ -1 +0,0 @@ -../src/styles/ntqsgistyle.h \ No newline at end of file diff --git a/include/ntqwindowsstyle.h b/include/ntqwindowsstyle.h deleted file mode 120000 index 2356f9f1a..000000000 --- a/include/ntqwindowsstyle.h +++ /dev/null @@ -1 +0,0 @@ -../src/styles/ntqwindowsstyle.h \ No newline at end of file diff --git a/include/tqcdestyle.h b/include/tqcdestyle.h new file mode 120000 index 000000000..c28eadf87 --- /dev/null +++ b/include/tqcdestyle.h @@ -0,0 +1 @@ +../src/styles/tqcdestyle.h \ No newline at end of file diff --git a/include/tqcommonstyle.h b/include/tqcommonstyle.h new file mode 120000 index 000000000..7fc4ed277 --- /dev/null +++ b/include/tqcommonstyle.h @@ -0,0 +1 @@ +../src/styles/tqcommonstyle.h \ No newline at end of file diff --git a/include/tqcompactstyle.h b/include/tqcompactstyle.h new file mode 120000 index 000000000..a6426a988 --- /dev/null +++ b/include/tqcompactstyle.h @@ -0,0 +1 @@ +../src/styles/tqcompactstyle.h \ No newline at end of file diff --git a/include/tqinterlacestyle.h b/include/tqinterlacestyle.h new file mode 120000 index 000000000..e954cd84f --- /dev/null +++ b/include/tqinterlacestyle.h @@ -0,0 +1 @@ +../src/styles/tqinterlacestyle.h \ No newline at end of file diff --git a/include/tqmotifplusstyle.h b/include/tqmotifplusstyle.h new file mode 120000 index 000000000..6209223e4 --- /dev/null +++ b/include/tqmotifplusstyle.h @@ -0,0 +1 @@ +../src/styles/tqmotifplusstyle.h \ No newline at end of file diff --git a/include/tqmotifstyle.h b/include/tqmotifstyle.h new file mode 120000 index 000000000..65784c4d5 --- /dev/null +++ b/include/tqmotifstyle.h @@ -0,0 +1 @@ +../src/styles/tqmotifstyle.h \ No newline at end of file diff --git a/include/tqplatinumstyle.h b/include/tqplatinumstyle.h new file mode 120000 index 000000000..60b7a99c0 --- /dev/null +++ b/include/tqplatinumstyle.h @@ -0,0 +1 @@ +../src/styles/tqplatinumstyle.h \ No newline at end of file diff --git a/include/tqsgistyle.h b/include/tqsgistyle.h new file mode 120000 index 000000000..769d10e31 --- /dev/null +++ b/include/tqsgistyle.h @@ -0,0 +1 @@ +../src/styles/tqsgistyle.h \ No newline at end of file diff --git a/include/tqwindowsstyle.h b/include/tqwindowsstyle.h new file mode 120000 index 000000000..0738267a2 --- /dev/null +++ b/include/tqwindowsstyle.h @@ -0,0 +1 @@ +../src/styles/tqwindowsstyle.h \ No newline at end of file diff --git a/plugins/src/styles/cde/cde.pro b/plugins/src/styles/cde/cde.pro index 999b35c0c..3d785cb55 100644 --- a/plugins/src/styles/cde/cde.pro +++ b/plugins/src/styles/cde/cde.pro @@ -1,16 +1,16 @@ TEMPLATE = lib -TARGET = qcdestyle +TARGET = tqcdestyle CONFIG += qt warn_off release plugin DESTDIR = ../../../styles -HEADERS = ../../../../include/ntqcdestyle.h +HEADERS = ../../../../include/tqcdestyle.h SOURCES = main.cpp \ - ../../../../src/styles/qcdestyle.cpp + ../../../../src/styles/tqcdestyle.cpp !contains(styles, motif) { - HEADERS += ../../../../include/ntqmotifstyle.h - SOURCES += ../../../../src/styles/qmotifstyle.cpp + HEADERS += ../../../../include/tqmotifstyle.h + SOURCES += ../../../../src/styles/tqmotifstyle.cpp } unix:OBJECTS_DIR = .obj diff --git a/plugins/src/styles/cde/main.cpp b/plugins/src/styles/cde/main.cpp index 23dbb3a39..a079a82df 100644 --- a/plugins/src/styles/cde/main.cpp +++ b/plugins/src/styles/cde/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include class CDEStyle : public TQStylePlugin { diff --git a/plugins/src/styles/compact/compact.pro b/plugins/src/styles/compact/compact.pro index 1dff0374a..6c398f0c8 100644 --- a/plugins/src/styles/compact/compact.pro +++ b/plugins/src/styles/compact/compact.pro @@ -1,17 +1,17 @@ TEMPLATE = lib -TARGET = qcompactstyle +TARGET = tqcompactstyle CONFIG += qt warn_off release plugin DESTDIR = ../../../styles -HEADERS = ../../../../include/ntqcompactstyle.h +HEADERS = ../../../../include/tqcompactstyle.h SOURCES = main.cpp \ - ../../../../src/styles/qcompactstyle.cpp + ../../../../src/styles/tqcompactstyle.cpp !contains(styles, windows) { - HEADERS += ../../../../include/ntqwindowsstyle.h - SOURCES += ../../../../src/styles/qwindowsstyle.cpp + HEADERS += ../../../../include/tqwindowsstyle.h + SOURCES += ../../../../src/styles/tqwindowsstyle.cpp } unix:OBJECTS_DIR = .obj diff --git a/plugins/src/styles/compact/main.cpp b/plugins/src/styles/compact/main.cpp index f2b89ddc3..8d6358917 100644 --- a/plugins/src/styles/compact/main.cpp +++ b/plugins/src/styles/compact/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include class CompactStyle : public TQStylePlugin { diff --git a/plugins/src/styles/motif/main.cpp b/plugins/src/styles/motif/main.cpp index 84c20d79f..73e25e64a 100644 --- a/plugins/src/styles/motif/main.cpp +++ b/plugins/src/styles/motif/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include class MotifStyle : public TQStylePlugin { diff --git a/plugins/src/styles/motif/motif.pro b/plugins/src/styles/motif/motif.pro index 61f228c1c..2ee355b11 100644 --- a/plugins/src/styles/motif/motif.pro +++ b/plugins/src/styles/motif/motif.pro @@ -1,12 +1,12 @@ TEMPLATE = lib -TARGET = qmotifstyle +TARGET = tqmotifstyle CONFIG += qt warn_off release plugin DESTDIR = ../../../styles -HEADERS = ../../../../include/ntqmotifstyle.h +HEADERS = ../../../../include/tqmotifstyle.h SOURCES = main.cpp \ - ../../../../src/styles/qmotifstyle.cpp + ../../../../src/styles/tqmotifstyle.cpp unix:OBJECTS_DIR = .obj win32:OBJECTS_DIR = obj diff --git a/plugins/src/styles/motifplus/main.cpp b/plugins/src/styles/motifplus/main.cpp index 205a240a6..60b1e5395 100644 --- a/plugins/src/styles/motifplus/main.cpp +++ b/plugins/src/styles/motifplus/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include class MotifPlusStyle : public TQStylePlugin { diff --git a/plugins/src/styles/motifplus/motifplus.pro b/plugins/src/styles/motifplus/motifplus.pro index 0f1ca9be5..1e7151195 100644 --- a/plugins/src/styles/motifplus/motifplus.pro +++ b/plugins/src/styles/motifplus/motifplus.pro @@ -1,16 +1,16 @@ TEMPLATE = lib -TARGET = qmotifplusstyle +TARGET = tqmotifplusstyle CONFIG += qt warn_off release plugin DESTDIR = ../../../styles -HEADERS = ../../../../include/ntqmotifplusstyle.h +HEADERS = ../../../../include/tqmotifplusstyle.h SOURCES = main.cpp \ - ../../../../src/styles/qmotifplusstyle.cpp + ../../../../src/styles/tqmotifplusstyle.cpp !contains(styles, motif) { - HEADERS += ../../../../include/ntqmotifstyle.h - SOURCES += ../../../../src/styles/qmotifstyle.cpp + HEADERS += ../../../../include/tqmotifstyle.h + SOURCES += ../../../../src/styles/tqmotifstyle.cpp } unix:OBJECTS_DIR = .obj diff --git a/plugins/src/styles/platinum/main.cpp b/plugins/src/styles/platinum/main.cpp index 9fc536703..aaf168968 100644 --- a/plugins/src/styles/platinum/main.cpp +++ b/plugins/src/styles/platinum/main.cpp @@ -1,4 +1,4 @@ -#include +#include #include class PlatinumStyle : public TQStylePlugin diff --git a/plugins/src/styles/platinum/platinum.pro b/plugins/src/styles/platinum/platinum.pro index 8ddff3cc4..9091307c7 100644 --- a/plugins/src/styles/platinum/platinum.pro +++ b/plugins/src/styles/platinum/platinum.pro @@ -1,16 +1,16 @@ TEMPLATE = lib -TARGET = qplatinumstyle +TARGET = tqplatinumstyle CONFIG += qt warn_off release plugin DESTDIR = ../../../styles -HEADERS = ../../../../include/ntqplatinumstyle.h +HEADERS = ../../../../include/tqplatinumstyle.h SOURCES = main.cpp \ - ../../../../src/styles/qplatinumstyle.cpp + ../../../../src/styles/tqplatinumstyle.cpp !contains(styles, windows) { - HEADERS += ../../../../include/ntqwindowsstyle.h - SOURCES += ../../../../src/styles/qwindowsstyle.cpp + HEADERS += ../../../../include/tqwindowsstyle.h + SOURCES += ../../../../src/styles/tqwindowsstyle.cpp } unix:OBJECTS_DIR = .obj diff --git a/plugins/src/styles/sgi/main.cpp b/plugins/src/styles/sgi/main.cpp index f88dfa56b..9e4331f82 100644 --- a/plugins/src/styles/sgi/main.cpp +++ b/plugins/src/styles/sgi/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include class SGIStyle : public TQStylePlugin { diff --git a/plugins/src/styles/sgi/sgi.pro b/plugins/src/styles/sgi/sgi.pro index ce7776d18..1d83eacf1 100644 --- a/plugins/src/styles/sgi/sgi.pro +++ b/plugins/src/styles/sgi/sgi.pro @@ -1,16 +1,16 @@ TEMPLATE = lib -TARGET = qsgistyle +TARGET = tqsgistyle CONFIG += qt warn_off release plugin DESTDIR = ../../../styles -HEADERS = ../../../../include/ntqsgistyle.h +HEADERS = ../../../../include/tqsgistyle.h SOURCES = main.cpp \ - ../../../../src/styles/qsgistyle.cpp + ../../../../src/styles/tqsgistyle.cpp !contains(styles, motif) { - HEADERS += ../../../../include/ntqmotifstyle.h - SOURCES += ../../../../src/styles/qmotifstyle.cpp + HEADERS += ../../../../include/tqmotifstyle.h + SOURCES += ../../../../src/styles/tqmotifstyle.cpp } unix:OBJECTS_DIR = .obj diff --git a/plugins/src/styles/windows/main.cpp b/plugins/src/styles/windows/main.cpp index 98d8480db..efb82e432 100644 --- a/plugins/src/styles/windows/main.cpp +++ b/plugins/src/styles/windows/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include class WindowsStyle : public TQStylePlugin { diff --git a/plugins/src/styles/windows/windows.pro b/plugins/src/styles/windows/windows.pro index c1a3732c6..b827c5a5c 100644 --- a/plugins/src/styles/windows/windows.pro +++ b/plugins/src/styles/windows/windows.pro @@ -1,12 +1,12 @@ TEMPLATE = lib -TARGET = qwindowsstyle +TARGET = tqwindowsstyle CONFIG += qt warn_off release plugin DESTDIR = ../../../styles -HEADERS = ../../../../include/ntqwindowsstyle.h +HEADERS = ../../../../include/tqwindowsstyle.h SOURCES = main.cpp \ - ../../../../src/styles/qwindowsstyle.cpp + ../../../../src/styles/tqwindowsstyle.cpp unix:OBJECTS_DIR = .obj win32:OBJECTS_DIR = obj diff --git a/src/kernel/ntqnamespace.h b/src/kernel/ntqnamespace.h index d40ec2e74..dd2cdedab 100644 --- a/src/kernel/ntqnamespace.h +++ b/src/kernel/ntqnamespace.h @@ -738,7 +738,7 @@ public: Key_unknown = 0xffff }; - // documented in qcommonstyle.cpp + // documented in tqcommonstyle.cpp enum ArrowType { UpArrow, DownArrow, diff --git a/src/kernel/ntqt.h b/src/kernel/ntqt.h index f72ec4e66..875323a6d 100644 --- a/src/kernel/ntqt.h +++ b/src/kernel/ntqt.h @@ -82,7 +82,7 @@ #include "tqdialog.h" #include #include "ntqdockwindow.h" -#include "ntqcommonstyle.h" +#include "tqcommonstyle.h" #include "tqnetworkprotocol.h" #include #include @@ -110,7 +110,7 @@ #include "tqlineedit.h" #include #include "tqintdict.h" -#include "ntqmotifstyle.h" +#include "tqmotifstyle.h" #include "tqpicture.h" #include #include @@ -124,7 +124,7 @@ #include "tqscrollbar.h" #include "tqscrollview.h" #include "tqdir.h" -#include "ntqwindowsstyle.h" +#include "tqwindowsstyle.h" #include "ntqconnection.h" #include "tqbitmap.h" #include "ntqvariant.h" @@ -132,8 +132,8 @@ #include #include "ntqmetaobject.h" #include "tqheader.h" -#include -#include +#include +#include #include #include "tqptrvector.h" #include "tqmutex.h" @@ -153,7 +153,7 @@ #include "tqdragobject.h" #include #include -#include +#include #include #include #include @@ -183,7 +183,7 @@ #include "tqsocketdevice.h" #include #include -#include +#include #include #include "tqtimer.h" #include @@ -221,7 +221,7 @@ #include #include "tqtranslator.h" #include -#include +#include #include #include #include "tqtextedit.h" @@ -265,7 +265,7 @@ #include #include #include -#include +#include #include #include #include @@ -317,7 +317,7 @@ #endif // TQ_WS_MAC #ifdef TQ_WS_WIN -#include +#include #endif #ifdef TQ_WS_WCE diff --git a/src/kernel/qmotifdnd_x11.cpp b/src/kernel/qmotifdnd_x11.cpp deleted file mode 100644 index 8bd2d8b8f..000000000 --- a/src/kernel/qmotifdnd_x11.cpp +++ /dev/null @@ -1,978 +0,0 @@ -/**************************************************************************** -** -** Implementation of Motif Dynamic Drag and Drop class -** -** Created : 950419 -** -** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -/* The following copyright notice pertains to the code as contributed -to Trolltech, not to Trolltech's modifications. It is replicated -in doc/dnd.doc, where the documentation system can see it. */ - -/* Copyright 1996 Daniel Dardailler. - - Permission to use, copy, modify, distribute, and sell this software - for any purpose is hereby granted without fee, provided that the above - copyright notice appear in all copies and that both that copyright - notice and this permission notice appear in supporting documentation, - and that the name of Daniel Dardailler not be used in advertising or - publicity pertaining to distribution of the software without specific, - written prior permission. Daniel Dardailler makes no representations - about the suitability of this software for any purpose. It is - provided "as is" without express or implied warranty. - - Modifications Copyright 1999 Matt Koss, under the same license as - above. -************************************************************/ - -/***********************************************************/ -/* Motif Drag&Drop Dynamic Protocol messaging API code */ -/* Only requires Xlib layer - not MT safe */ -/* Author: Daniel Dardailler, daniel@x.org */ -/* Adapted by : Matt Koss, koss@napri.sk */ -/* Further adaptions by : Trolltech ASA */ -/***********************************************************/ - -#include "qplatformdefs.h" - -#include "ntqapplication.h" - -#ifndef TQT_NO_DRAGANDDROP - -#include "tqwidget.h" -#include "qt_x11_p.h" - -#include - - -static Atom atom_message_type, atom_receiver_info, atom_src_property_type; -static Atom atom_motif_window, atom_target_list ; - -static bool in_drop_site = FALSE; -static Window cur_window = 0; -static TQWidget *drop_widget = 0L; - -static Atom Dnd_transfer_success, Dnd_transfer_failure; - -static Atom Dnd_selection; -static Time Dnd_selection_time; - -static Atom * src_targets ; -static ushort num_src_targets ; - -extern bool qt_motifdnd_active; - -// this stuff is copied from tqclipboard_x11.cpp - -extern bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, - XEvent *event, int timeout ); -extern bool qt_xclb_read_property( Display *dpy, Window win, Atom property, - bool deleteProperty, - TQByteArray *buffer, int *size, Atom *type, - int *format, bool nullterm ); - -extern Atom* qt_xdnd_str_to_atom( const char *mimeType ); -extern const char* qt_xdnd_atom_to_str( Atom ); - - -// Motif definitions -#define DndVersion 1 -#define DndRevision 0 -#define DndIncludeVersion (DndVersion * 10 + DndRevision) - -/* The following values are used in the DndData structure */ - -/* protocol style */ -#define DND_DRAG_NONE 0 -#define DND_DRAG_DROP_ONLY 1 -#define DND_DRAG_DYNAMIC 5 - -/* message type */ -#define DND_TOP_LEVEL_ENTER 0 -#define DND_TOP_LEVEL_LEAVE 1 -#define DND_DRAG_MOTION 2 -#define DND_DROP_SITE_ENTER 3 -#define DND_DROP_SITE_LEAVE 4 -#define DND_DROP_START 5 -#define DND_OPERATION_CHANGED 8 - -/* operation(s) */ -#define DND_NOOP 0L -#define DND_MOVE (1L << 0) -#define DND_COPY (1L << 1) -#define DND_LINK (1L << 2) - -/* status */ -#define DND_NO_DROP_SITE 1 -#define DND_INVALID_DROP_SITE 2 -#define DND_VALID_DROP_SITE 3 - -/* completion */ -#define DND_DROP 0 -#define DND_DROP_HELP 1 -#define DND_DROP_CANCEL 2 - -#define BYTE unsigned char -#define CARD32 unsigned int -#define CARD16 unsigned short -#define INT16 signed short - -/* Client side structure used in the API */ -typedef struct { - unsigned char reason; /* message type: DND_TOP_LEVEL_ENTER, etc */ - Time time ; - unsigned char operation; - unsigned char operations; - unsigned char status; - unsigned char completion; - short x ; - short y ; - Window src_window ; - Atom property ; -} DndData ; - - -typedef struct _DndSrcProp { - BYTE byte_order ; - BYTE protocol_version ; - CARD16 target_index ; - CARD32 selection ; -} DndSrcProp ; - -typedef struct _DndReceiverProp { - BYTE byte_order ; - BYTE protocol_version ; - BYTE protocol_style ; - BYTE pad1; - CARD32 proxy_window; - CARD16 num_drop_sites ; - CARD16 pad2; - CARD32 total_size; -} DndReceiverProp ; - -/* need to use some union hack since window and property are in - different order depending on the message ... */ -typedef struct _DndTop { - CARD32 src_window; - CARD32 property; -} DndTop ; - -typedef struct _DndPot { - INT16 x; - INT16 y; - CARD32 property; - CARD32 src_window; -} DndPot ; - -typedef struct _DndMessage { - BYTE reason; - BYTE byte_order; - CARD16 flags; - CARD32 time; - union { - DndTop top ; - DndPot pot ; - } data ; -} DndMessage ; - -typedef struct { - BYTE byte_order; - BYTE protocol_version; - CARD16 num_target_lists; - CARD32 data_size; - /* then come series of CARD16,CARD32,CARD32,CARD32... */ -} DndTargets; - - -/* protocol version */ -#define DND_PROTOCOL_VERSION 0 - - -#define DND_EVENT_TYPE_MASK ((BYTE)0x80) -#define DND_EVENT_TYPE_SHIFT 7 -#define DND_CLEAR_EVENT_TYPE ((BYTE)0x7F) - -/* message_type is data[0] of the client_message - this return 1 (receiver bit up) or 0 (initiator) */ -#define DND_GET_EVENT_TYPE(message_type) \ -((char) (((message_type) & DND_EVENT_TYPE_MASK) >> DND_EVENT_TYPE_SHIFT)) - -/* event_type can be 0 (initiator) or 1 (receiver) */ -#define DND_SET_EVENT_TYPE(event_type) \ -(((BYTE)(event_type) << DND_EVENT_TYPE_SHIFT) & DND_EVENT_TYPE_MASK) - - -#define DND_OPERATION_MASK ((CARD16) 0x000F) -#define DND_OPERATION_SHIFT 0 -#define DND_STATUS_MASK ((CARD16) 0x00F0) -#define DND_STATUS_SHIFT 4 -#define DND_OPERATIONS_MASK ((CARD16) 0x0F00) -#define DND_OPERATIONS_SHIFT 8 -#define DND_COMPLETION_MASK ((CARD16) 0xF000) -#define DND_COMPLETION_SHIFT 12 - -#define DND_GET_OPERATION(flags) \ -((unsigned char) \ -(((flags) & DND_OPERATION_MASK) >> DND_OPERATION_SHIFT)) - -#define DND_SET_OPERATION(operation) \ -(((CARD16)(operation) << DND_OPERATION_SHIFT)\ -& DND_OPERATION_MASK) - -#define DND_GET_STATUS(flags) \ -((unsigned char) \ -(((flags) & DND_STATUS_MASK) >> DND_STATUS_SHIFT)) - -#define DND_SET_STATUS(status) \ -(((CARD16)(status) << DND_STATUS_SHIFT)\ -& DND_STATUS_MASK) - -#define DND_GET_OPERATIONS(flags) \ -((unsigned char) \ -(((flags) & DND_OPERATIONS_MASK) >> DND_OPERATIONS_SHIFT)) - -#define DND_SET_OPERATIONS(operation) \ -(((CARD16)(operation) << DND_OPERATIONS_SHIFT)\ -& DND_OPERATIONS_MASK) - -#define DND_GET_COMPLETION(flags) \ -((unsigned char) \ -(((flags) & DND_COMPLETION_MASK) >> DND_COMPLETION_SHIFT)) - -#define DND_SET_COMPLETION(completion) \ -(((CARD16)(completion) << DND_COMPLETION_SHIFT)\ -& DND_COMPLETION_MASK) - - -#define SWAP4BYTES(l) {\ -struct { unsigned t :32;} bit32;\ -char n, *tp = (char *) &bit32;\ -bit32.t = l;\ -n = tp[0]; tp[0] = tp[3]; tp[3] = n;\ -n = tp[1]; tp[1] = tp[2]; tp[2] = n;\ -l = bit32.t;\ -} - -#define SWAP2BYTES(s) {\ -struct { unsigned t :16; } bit16;\ -char n, *tp = (char *) &bit16;\ -bit16.t = s;\ -n = tp[0]; tp[0] = tp[1]; tp[1] = n;\ -s = bit16.t;\ -} - - -/** Private extern functions */ - -static unsigned char DndByteOrder (); - - -/***** Targets/Index stuff */ - -typedef struct { - int num_targets; - Atom *targets; -} DndTargetsTableEntryRec, * DndTargetsTableEntry; - -typedef struct { - int num_entries; - DndTargetsTableEntry entries; -} DndTargetsTableRec, * DndTargetsTable; - - -static int _DndIndexToTargets(Display * display, - int index, - Atom ** targets); - -extern void qt_x11_intern_atom( const char *, Atom * ); - -///////////////////////////////////////////////////////////////// - -void qt_x11_motifdnd_init() -{ - /* Init atoms used in the com */ - - qt_x11_intern_atom( "_MOTIF_DRAG_AND_DROP_MESSAGE", &atom_message_type ); - qt_x11_intern_atom( "_MOTIF_DRAG_INITIATOR_INFO", &atom_src_property_type ); - qt_x11_intern_atom( "_MOTIF_DRAG_RECEIVER_INFO", &atom_receiver_info ); - qt_x11_intern_atom( "_MOTIF_DRAG_WINDOW", &atom_motif_window ); - qt_x11_intern_atom( "_MOTIF_DRAG_TARGETS", &atom_target_list ); - - qt_x11_intern_atom( "XmTRANSFER_SUCCESS", &Dnd_transfer_success ); - qt_x11_intern_atom( "XmTRANSFER_FAILURE", &Dnd_transfer_failure ); - - char my_dnd_selection_name[30]; // 11-digit number should be enough - sprintf(my_dnd_selection_name, "_MY_DND_SELECTION_%d", (int)getpid()); - qt_x11_intern_atom( my_dnd_selection_name, &Dnd_selection ); -} - -static unsigned char DndByteOrder () -{ - static unsigned char byte_order = 0; - - if (!byte_order) { - unsigned int endian = 1; - byte_order = (*((char *)&endian))?'l':'B'; - } - return byte_order ; -} - - - -static void DndReadSourceProperty(Display * dpy, - Window window, Atom dnd_selection, - Atom ** targets, unsigned short * num_targets) -{ - DndSrcProp * src_prop = 0; - Atom type ; - int format ; - unsigned long bytesafter, lengthRtn; - - if ((XGetWindowProperty (dpy, window, dnd_selection, 0L, 100000L, - False, atom_src_property_type, &type, - &format, &lengthRtn, &bytesafter, - (unsigned char **) &src_prop) != Success) - || (type == None)) { - *num_targets = 0; - return ; - } - - if (src_prop->byte_order != DndByteOrder()) { - SWAP2BYTES(src_prop->target_index); - SWAP4BYTES(src_prop->selection); - } - - *num_targets = _DndIndexToTargets(dpy, src_prop->target_index, targets); - - XFree((char*)src_prop); -} - - -/* Position the _MOTIF_DRAG_RECEIVER_INFO property on the dropsite window. - Called by the receiver of the drop to indicate the - supported protocol style : dynamic, drop_only or none */ -static void DndWriteReceiverProperty(Display * dpy, Window window, - unsigned char protocol_style) -{ - DndReceiverProp receiver_prop = {}; - - receiver_prop.byte_order = DndByteOrder() ; - receiver_prop.protocol_version = DND_PROTOCOL_VERSION; - receiver_prop.protocol_style = protocol_style ; - receiver_prop.proxy_window = None ; - receiver_prop.num_drop_sites = 0 ; - receiver_prop.total_size = sizeof(DndReceiverProp); - - /* write the buffer to the property */ - XChangeProperty (dpy, window, atom_receiver_info, atom_receiver_info, - 8, PropModeReplace, - (unsigned char *)&receiver_prop, - sizeof(DndReceiverProp)); -} - - -/* protocol style equiv (preregister stuff really) */ -#define DND_DRAG_DROP_ONLY_EQUIV 3 -#define DND_DRAG_DYNAMIC_EQUIV1 2 -#define DND_DRAG_DYNAMIC_EQUIV2 4 - - -/* Produce a client message to be sent by the caller */ -static void DndFillClientMessage(Display * dpy, Window window, - XClientMessageEvent *cm, - DndData * dnd_data, - char receiver) -{ - DndMessage * dnd_message = (DndMessage*)&cm->data.b[0] ; - - cm->display = dpy; - cm->type = ClientMessage; - cm->serial = LastKnownRequestProcessed(dpy); - cm->send_event = True; - cm->window = window; - cm->format = 8; - cm->message_type = atom_message_type ;/* _MOTIF_DRAG_AND_DROP_MESSAGE */ - - dnd_message->reason = dnd_data->reason | DND_SET_EVENT_TYPE(receiver); - - dnd_message->byte_order = DndByteOrder(); - - /* we're filling in flags with more stuff that necessary, - depending on the reason, but it doesn't matter */ - dnd_message->flags = 0 ; - dnd_message->flags |= DND_SET_STATUS(dnd_data->status) ; - dnd_message->flags |= DND_SET_OPERATION(dnd_data->operation) ; - dnd_message->flags |= DND_SET_OPERATIONS(dnd_data->operations) ; - dnd_message->flags |= DND_SET_COMPLETION(dnd_data->completion) ; - - dnd_message->time = dnd_data->time ; - - switch(dnd_data->reason) { - case DND_DROP_SITE_LEAVE: break ; - case DND_TOP_LEVEL_ENTER: - case DND_TOP_LEVEL_LEAVE: - dnd_message->data.top.src_window = dnd_data->src_window ; - dnd_message->data.top.property = dnd_data->property ; - break ; /* cannot fall thru since the byte layout is different in - both set of messages, see top and pot union stuff */ - - case DND_DRAG_MOTION: - case DND_OPERATION_CHANGED: - case DND_DROP_SITE_ENTER: - case DND_DROP_START: - dnd_message->data.pot.x = dnd_data->x ; /* mouse position */ - dnd_message->data.pot.y = dnd_data->y ; - dnd_message->data.pot.src_window = dnd_data->src_window ; - dnd_message->data.pot.property = dnd_data->property ; - break ; - default: - break ; - } - -} - -static Bool DndParseClientMessage(XClientMessageEvent *cm, DndData * dnd_data, - char * receiver) -{ - DndMessage * dnd_message = (DndMessage*)&cm->data.b[0] ; - - if (cm->message_type != atom_message_type) { - return False ; - } - - if (dnd_message->byte_order != DndByteOrder()) { - SWAP2BYTES(dnd_message->flags); - SWAP4BYTES(dnd_message->time); - } /* do the rest in the switch */ - - dnd_data->reason = dnd_message->reason ; - if (DND_GET_EVENT_TYPE(dnd_data->reason)) - *receiver = 1 ; - else - *receiver = 0 ; - dnd_data->reason &= DND_CLEAR_EVENT_TYPE ; - - dnd_data->time = dnd_message->time ; - - /* we're reading in more stuff that necessary. but who cares */ - dnd_data->status = DND_GET_STATUS(dnd_message->flags) ; - dnd_data->operation = DND_GET_OPERATION(dnd_message->flags) ; - dnd_data->operations = DND_GET_OPERATIONS(dnd_message->flags) ; - dnd_data->completion = DND_GET_COMPLETION(dnd_message->flags) ; - - switch(dnd_data->reason) { - case DND_TOP_LEVEL_ENTER: - case DND_TOP_LEVEL_LEAVE: - if (dnd_message->byte_order != DndByteOrder()) { - SWAP4BYTES(dnd_message->data.top.src_window); - SWAP4BYTES(dnd_message->data.top.property); - } - dnd_data->src_window = dnd_message->data.top.src_window ; - dnd_data->property = dnd_message->data.top.property ; - break ; /* cannot fall thru, see above comment in write msg */ - - case DND_DRAG_MOTION: - case DND_OPERATION_CHANGED: - case DND_DROP_SITE_ENTER: - case DND_DROP_START: - if (dnd_message->byte_order != DndByteOrder()) { - SWAP2BYTES(dnd_message->data.pot.x); - SWAP2BYTES(dnd_message->data.pot.y); - SWAP4BYTES(dnd_message->data.pot.property); - SWAP4BYTES(dnd_message->data.pot.src_window); - } - dnd_data->x = dnd_message->data.pot.x ; - dnd_data->y = dnd_message->data.pot.y ; - dnd_data->property = dnd_message->data.pot.property ; - dnd_data->src_window = dnd_message->data.pot.src_window ; - break ; - - case DND_DROP_SITE_LEAVE: - break; - default: - break ; - } - - return True ; -} - - -static Window MotifWindow(Display *display ) -{ - Atom type; - int format; - unsigned long size; - unsigned long bytes_after; - Window *property = 0; - Window motif_window ; - - /* this version does no caching, so it's slow: round trip each time */ - - if ((XGetWindowProperty (display, DefaultRootWindow(display), - atom_motif_window, - 0L, 100000L, False, AnyPropertyType, - &type, &format, &size, &bytes_after, - (unsigned char **) &property) == Success) && - (type != None)) { - motif_window = *property; - } else { - XSetWindowAttributes sAttributes; - - /* really, this should be done on a separate connection, - with XSetCloseDownMode (RetainPermanent), so that - others don't have to recreate it; hopefully, some real - Motif application will be around to do it */ - - sAttributes.override_redirect = True; - sAttributes.event_mask = PropertyChangeMask; - motif_window = XCreateWindow (display, - DefaultRootWindow (display), - -170, -560, 1, 1, 0, 0, - InputOnly, CopyFromParent, - (CWOverrideRedirect |CWEventMask), - &sAttributes); - XMapWindow (display, motif_window); - } - - if (property) { - XFree ((char *)property); - } - - return (motif_window); -} - - -static DndTargetsTable TargetsTable(Display *display) -{ - Atom type; - int format; - unsigned long size; - unsigned long bytes_after; - Window motif_window = MotifWindow(display) ; - DndTargets * target_prop; - DndTargetsTable targets_table ; - int i,j ; - char * target_data ; - - /* this version does no caching, so it's slow: round trip each time */ - /* ideally, register for property notify on this target_list - atom and update when necessary only */ - - if ((XGetWindowProperty (display, motif_window, - atom_target_list, 0L, 100000L, - False, atom_target_list, - &type, &format, &size, &bytes_after, - (unsigned char **) &target_prop) != Success) || - type == None) { - tqWarning("TQMotifDND: cannot get property on motif window"); - return 0; - } - - if (target_prop->protocol_version != DND_PROTOCOL_VERSION) { - tqWarning("TQMotifDND: protocol mismatch"); - } - - if (target_prop->byte_order != DndByteOrder()) { - /* need to swap num_target_lists and size */ - SWAP2BYTES(target_prop->num_target_lists); - SWAP4BYTES(target_prop->data_size); - } - - /* now parse DndTarget prop data in a TargetsTable */ - - targets_table = (DndTargetsTable)malloc(sizeof(DndTargetsTableRec)); - targets_table->num_entries = target_prop->num_target_lists ; - targets_table->entries = (DndTargetsTableEntry) - malloc(sizeof(DndTargetsTableEntryRec) * target_prop->num_target_lists); - - target_data = (char*)target_prop + sizeof(*target_prop) ; - - for (i = 0 ; i < targets_table->num_entries; i++) { - CARD16 num_targets ; - CARD32 atom ; - - memcpy(&num_targets, target_data, 2); - target_data += 2; - - /* potential swap needed here */ - if (target_prop->byte_order != DndByteOrder()) - SWAP2BYTES(num_targets); - - targets_table->entries[i].num_targets = num_targets ; - targets_table->entries[i].targets = (Atom *) - malloc(sizeof(Atom) * targets_table->entries[i].num_targets); - - - for (j = 0; j < num_targets; j++) { - memcpy(&atom, target_data, 4 ); - target_data += 4; - - /* another potential swap needed here */ - if (target_prop->byte_order != DndByteOrder()) - SWAP4BYTES(atom); - - targets_table->entries[i].targets[j] = (Atom) atom ; - } - } - - if (target_prop) { - XFree((char *)target_prop); - } - - return targets_table ; -} - - -static int _DndIndexToTargets(Display * display, - int index, - Atom ** targets) -{ - DndTargetsTable targets_table; - int i ; - - /* again, slow: no caching here, alloc/free each time */ - - if (!(targets_table = TargetsTable (display)) || - (index >= targets_table->num_entries)) { - return -1; - } - - /* transfer the correct target list index */ - *targets = (Atom*)malloc(sizeof(Atom)*targets_table-> - entries[index].num_targets); - memcpy((char*)*targets, - (char*)targets_table->entries[index].targets, - sizeof(Atom)*targets_table->entries[index].num_targets); - - /* free the target table and its guts */ - for (i=0 ; i < targets_table->num_entries; i++) - XFree((char*)targets_table->entries[i].targets); - - int tmp = targets_table->entries[index].num_targets; - XFree((char*)targets_table); - - return tmp; // targets_table->entries[index].num_targets; -} - - -const char *qt_motifdnd_format( int n ) -{ - if ( ! qt_motifdnd_active ) - return 0; // should not happen - - if ( n == 0 ) - return "text/plain"; - if ( n == 1 ) - return "text/uri-list"; - n -= 2; - - if ( n >= num_src_targets ) - return 0; - - Atom target = src_targets[n]; - - // duplicated from tqclipboard_x11.cpp - not the best solution - static Atom xa_utf8_string = *qt_xdnd_str_to_atom( "UTF8_STRING" ); - static Atom xa_text = *qt_xdnd_str_to_atom( "TEXT" ); - static Atom xa_compound_text = *qt_xdnd_str_to_atom( "COMPOUND_TEXT" ); - - if ( target == XA_STRING ) - return "text/plain;charset=ISO-8859-1"; - if ( target == xa_utf8_string ) - return "text/plain;charset=UTF-8"; - if ( target == xa_text || - target == xa_compound_text ) - return "text/plain"; - - return qt_xdnd_atom_to_str( target ); -} - - -TQByteArray qt_motifdnd_obtain_data( const char *mimeType ) -{ - TQByteArray result; - - // try to convert the selection to the requested property - // tqDebug( "trying to convert to '%s'", mimeType ); - - int n=0; - const char* f; - do { - f = qt_motifdnd_format( n ); - if ( !f ) - return result; - n++; - } while( tqstricmp( mimeType, f ) ); - - // found one - Atom conversion_type; - - if ( tqstrnicmp( f, "text/", 5 ) == 0 ) { - // always convert text to XA_STRING for compatibility with - // prior TQt versions - conversion_type = XA_STRING; - } else { - conversion_type = *qt_xdnd_str_to_atom( f ); - // tqDebug( "found format '%s' 0x%lx '%s'", f, conversion_type, - // qt_xdnd_atom_to_str( conversion_type ) ); - } - - if ( XGetSelectionOwner( tqt_xdisplay(), - Dnd_selection ) == None ) { - return result; // should never happen? - } - - TQWidget* tw = drop_widget; - if ( drop_widget->isDesktop() ) { - tw = new TQWidget; - } - - // convert selection to the appropriate type - XConvertSelection (tqt_xdisplay(), Dnd_selection, conversion_type, - Dnd_selection, tw->winId(), Dnd_selection_time); - - XFlush( tqt_xdisplay() ); - - XEvent xevent; - bool got=qt_xclb_wait_for_event( tqt_xdisplay(), - tw->winId(), - SelectionNotify, &xevent, 5000); - if ( got ) { - Atom type; - - if ( qt_xclb_read_property( tqt_xdisplay(), - tw->winId(), - Dnd_selection, TRUE, - &result, 0, &type, 0, TRUE ) ) { - } - } - - // we have to convert selection in order to indicate success to the initiator - XConvertSelection (tqt_xdisplay(), Dnd_selection, Dnd_transfer_success, - Dnd_selection, tw->winId(), Dnd_selection_time); - - // wait again for SelectionNotify event - qt_xclb_wait_for_event( tqt_xdisplay(), - tw->winId(), - SelectionNotify, &xevent, 5000); - - if ( drop_widget->isDesktop() ) { - delete tw; - } - - return result; -} - - -void qt_motifdnd_enable( TQWidget *widget, bool ) -{ - DndWriteReceiverProperty( widget->x11Display(), widget->winId(), - DND_DRAG_DYNAMIC); -} - - -void qt_motifdnd_handle_msg( TQWidget * /* w */ , const XEvent * xe, bool /* passive */ ) -{ - - XEvent event = *xe; - XClientMessageEvent cm ; - DndData dnd_data ; - char receiver ; - - if (!(DndParseClientMessage ((XClientMessageEvent*)&event, - &dnd_data, &receiver))) { - return; - } - - switch ( dnd_data.reason ) { - - case DND_DRAG_MOTION: - - { - /* check if in drop site, and depending on the state, - send a drop site enter or drop site leave or echo */ - - TQPoint p( dnd_data.x, dnd_data.y ); - TQWidget *c = TQApplication::widgetAt( p, TRUE ); - if (c) - p = c->mapFromGlobal(p); - - while ( c && !c->acceptDrops() && !c->isTopLevel() ) { - p = c->mapToParent( p ); - c = c->parentWidget(); - } - - TQDragMoveEvent me( p ); - TQDropEvent::Action accepted_action = TQDropEvent::Copy; - me.setAction(accepted_action); - - if ( c != 0L && c->acceptDrops() ) { - - if ( drop_widget != 0L && drop_widget->acceptDrops() && - drop_widget != c ) { - TQDragLeaveEvent e; - TQApplication::sendEvent( drop_widget, &e ); - TQDragEnterEvent de( p ); - TQApplication::sendEvent( c, &de ); - } - - drop_widget = c; - - if (!in_drop_site) { - in_drop_site = True ; - - dnd_data.reason = DND_DROP_SITE_ENTER ; - dnd_data.time = CurrentTime ; - dnd_data.operation = DND_MOVE|DND_COPY; - dnd_data.operations = DND_MOVE|DND_COPY; - - DndFillClientMessage (event.xclient.display, - cur_window, - &cm, &dnd_data, 0); - - XSendEvent(event.xbutton.display, - cur_window, False, 0, - (XEvent *)&cm) ; - - TQDragEnterEvent de( p ); - TQApplication::sendEvent( drop_widget, &de ); - if ( de.isAccepted() ) { - me.accept( de.answerRect() ); - } else { - me.ignore( de.answerRect() ); - } - - } else { - dnd_data.reason = DND_DRAG_MOTION ; - dnd_data.time = CurrentTime ; - dnd_data.operation = DND_MOVE|DND_COPY; - dnd_data.operations = DND_MOVE|DND_COPY; - - DndFillClientMessage (event.xclient.display, - cur_window, - &cm, &dnd_data, 0); - - XSendEvent(event.xbutton.display, - cur_window, False, 0, - (XEvent *)&cm) ; - - TQApplication::sendEvent( drop_widget, &me ); - } - } else { - if (in_drop_site) { - in_drop_site = False ; - - dnd_data.reason = DND_DROP_SITE_LEAVE ; - dnd_data.time = CurrentTime ; - - DndFillClientMessage (event.xclient.display, - cur_window, - &cm, &dnd_data, 0); - - XSendEvent(event.xbutton.display, - cur_window, False, 0, - (XEvent *)&cm) ; - - TQDragLeaveEvent e; - TQApplication::sendEvent( drop_widget, &e ); - } - } - } - break; - - case DND_TOP_LEVEL_ENTER: - - /* get the size of our drop site for later use */ - - cur_window = dnd_data.src_window ; - qt_motifdnd_active = TRUE; - - /* no answer needed, just read source property */ - DndReadSourceProperty (event.xclient.display, - cur_window, - dnd_data.property, - &src_targets, &num_src_targets); - break; - - case DND_TOP_LEVEL_LEAVE: - /* no need to do anything */ - break; - - case DND_OPERATION_CHANGED: - /* need to echo */ - break; - - case DND_DROP_START: - if (!in_drop_site) { - // we have to convert selection in order to indicate failure to the initiator - XConvertSelection (tqt_xdisplay(), dnd_data.property, Dnd_transfer_failure, - dnd_data.property, cur_window, dnd_data.time); - TQDragLeaveEvent e; - TQApplication::sendEvent( drop_widget, &e ); - drop_widget = 0; - return; - } - - /* need to echo and then request a convert */ - dnd_data.reason = DND_DROP_START ; - - DndFillClientMessage (event.xclient.display, - drop_widget->winId(), - &cm, &dnd_data, 0); - - XSendEvent(event.xbutton.display, - cur_window, False, 0, - (XEvent *)&cm) ; - - // store selection and its time - Dnd_selection = dnd_data.property; - Dnd_selection_time = dnd_data.time; - - TQPoint p( dnd_data.x, dnd_data.y ); - TQDropEvent de( drop_widget->mapFromGlobal(p) ); - de.setAction( TQDropEvent::Copy ); - TQApplication::sendEvent( drop_widget, &de ); - - if (in_drop_site) - in_drop_site = False ; - - drop_widget = 0; - cur_window = 0; - break; - } // end of switch ( dnd_data.reason ) -} - -#endif // TQT_NO_DRAGANDDROP diff --git a/src/kernel/qt_kernel.pri b/src/kernel/qt_kernel.pri index 279ac107b..bd93c7c29 100644 --- a/src/kernel/qt_kernel.pri +++ b/src/kernel/qt_kernel.pri @@ -142,7 +142,7 @@ kernel { $$KERNEL_CPP/tqfont_x11.cpp \ $$KERNEL_CPP/qinputcontext.cpp \ $$KERNEL_CPP/qinputcontext_x11.cpp \ - $$KERNEL_CPP/qmotifdnd_x11.cpp \ + $$KERNEL_CPP/tqmotifdnd_x11.cpp \ $$KERNEL_CPP/tqpixmap_x11.cpp \ $$KERNEL_CPP/tqpaintdevice_x11.cpp \ $$KERNEL_CPP/tqpainter_x11.cpp \ diff --git a/src/kernel/tqcolor_p.h b/src/kernel/tqcolor_p.h index d85cbf362..136c3e741 100644 --- a/src/kernel/tqcolor_p.h +++ b/src/kernel/tqcolor_p.h @@ -49,7 +49,7 @@ // // This file is not part of the TQt API. It exists for the convenience // of tqmenudata.cpp, tqmenubar.cpp, tqmenubar.cpp, tqpopupmenu.cpp, -// qmotifstyle.cpp and qwindowssstyle.cpp. This header file may change +// tqmotifstyle.cpp and tqwindowssstyle.cpp. This header file may change // from version to version without notice, or even be removed. // // We mean it. diff --git a/src/kernel/tqmotifdnd_x11.cpp b/src/kernel/tqmotifdnd_x11.cpp new file mode 100644 index 000000000..8bd2d8b8f --- /dev/null +++ b/src/kernel/tqmotifdnd_x11.cpp @@ -0,0 +1,978 @@ +/**************************************************************************** +** +** Implementation of Motif Dynamic Drag and Drop class +** +** Created : 950419 +** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +/* The following copyright notice pertains to the code as contributed +to Trolltech, not to Trolltech's modifications. It is replicated +in doc/dnd.doc, where the documentation system can see it. */ + +/* Copyright 1996 Daniel Dardailler. + + Permission to use, copy, modify, distribute, and sell this software + for any purpose is hereby granted without fee, provided that the above + copyright notice appear in all copies and that both that copyright + notice and this permission notice appear in supporting documentation, + and that the name of Daniel Dardailler not be used in advertising or + publicity pertaining to distribution of the software without specific, + written prior permission. Daniel Dardailler makes no representations + about the suitability of this software for any purpose. It is + provided "as is" without express or implied warranty. + + Modifications Copyright 1999 Matt Koss, under the same license as + above. +************************************************************/ + +/***********************************************************/ +/* Motif Drag&Drop Dynamic Protocol messaging API code */ +/* Only requires Xlib layer - not MT safe */ +/* Author: Daniel Dardailler, daniel@x.org */ +/* Adapted by : Matt Koss, koss@napri.sk */ +/* Further adaptions by : Trolltech ASA */ +/***********************************************************/ + +#include "qplatformdefs.h" + +#include "ntqapplication.h" + +#ifndef TQT_NO_DRAGANDDROP + +#include "tqwidget.h" +#include "qt_x11_p.h" + +#include + + +static Atom atom_message_type, atom_receiver_info, atom_src_property_type; +static Atom atom_motif_window, atom_target_list ; + +static bool in_drop_site = FALSE; +static Window cur_window = 0; +static TQWidget *drop_widget = 0L; + +static Atom Dnd_transfer_success, Dnd_transfer_failure; + +static Atom Dnd_selection; +static Time Dnd_selection_time; + +static Atom * src_targets ; +static ushort num_src_targets ; + +extern bool qt_motifdnd_active; + +// this stuff is copied from tqclipboard_x11.cpp + +extern bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, + XEvent *event, int timeout ); +extern bool qt_xclb_read_property( Display *dpy, Window win, Atom property, + bool deleteProperty, + TQByteArray *buffer, int *size, Atom *type, + int *format, bool nullterm ); + +extern Atom* qt_xdnd_str_to_atom( const char *mimeType ); +extern const char* qt_xdnd_atom_to_str( Atom ); + + +// Motif definitions +#define DndVersion 1 +#define DndRevision 0 +#define DndIncludeVersion (DndVersion * 10 + DndRevision) + +/* The following values are used in the DndData structure */ + +/* protocol style */ +#define DND_DRAG_NONE 0 +#define DND_DRAG_DROP_ONLY 1 +#define DND_DRAG_DYNAMIC 5 + +/* message type */ +#define DND_TOP_LEVEL_ENTER 0 +#define DND_TOP_LEVEL_LEAVE 1 +#define DND_DRAG_MOTION 2 +#define DND_DROP_SITE_ENTER 3 +#define DND_DROP_SITE_LEAVE 4 +#define DND_DROP_START 5 +#define DND_OPERATION_CHANGED 8 + +/* operation(s) */ +#define DND_NOOP 0L +#define DND_MOVE (1L << 0) +#define DND_COPY (1L << 1) +#define DND_LINK (1L << 2) + +/* status */ +#define DND_NO_DROP_SITE 1 +#define DND_INVALID_DROP_SITE 2 +#define DND_VALID_DROP_SITE 3 + +/* completion */ +#define DND_DROP 0 +#define DND_DROP_HELP 1 +#define DND_DROP_CANCEL 2 + +#define BYTE unsigned char +#define CARD32 unsigned int +#define CARD16 unsigned short +#define INT16 signed short + +/* Client side structure used in the API */ +typedef struct { + unsigned char reason; /* message type: DND_TOP_LEVEL_ENTER, etc */ + Time time ; + unsigned char operation; + unsigned char operations; + unsigned char status; + unsigned char completion; + short x ; + short y ; + Window src_window ; + Atom property ; +} DndData ; + + +typedef struct _DndSrcProp { + BYTE byte_order ; + BYTE protocol_version ; + CARD16 target_index ; + CARD32 selection ; +} DndSrcProp ; + +typedef struct _DndReceiverProp { + BYTE byte_order ; + BYTE protocol_version ; + BYTE protocol_style ; + BYTE pad1; + CARD32 proxy_window; + CARD16 num_drop_sites ; + CARD16 pad2; + CARD32 total_size; +} DndReceiverProp ; + +/* need to use some union hack since window and property are in + different order depending on the message ... */ +typedef struct _DndTop { + CARD32 src_window; + CARD32 property; +} DndTop ; + +typedef struct _DndPot { + INT16 x; + INT16 y; + CARD32 property; + CARD32 src_window; +} DndPot ; + +typedef struct _DndMessage { + BYTE reason; + BYTE byte_order; + CARD16 flags; + CARD32 time; + union { + DndTop top ; + DndPot pot ; + } data ; +} DndMessage ; + +typedef struct { + BYTE byte_order; + BYTE protocol_version; + CARD16 num_target_lists; + CARD32 data_size; + /* then come series of CARD16,CARD32,CARD32,CARD32... */ +} DndTargets; + + +/* protocol version */ +#define DND_PROTOCOL_VERSION 0 + + +#define DND_EVENT_TYPE_MASK ((BYTE)0x80) +#define DND_EVENT_TYPE_SHIFT 7 +#define DND_CLEAR_EVENT_TYPE ((BYTE)0x7F) + +/* message_type is data[0] of the client_message + this return 1 (receiver bit up) or 0 (initiator) */ +#define DND_GET_EVENT_TYPE(message_type) \ +((char) (((message_type) & DND_EVENT_TYPE_MASK) >> DND_EVENT_TYPE_SHIFT)) + +/* event_type can be 0 (initiator) or 1 (receiver) */ +#define DND_SET_EVENT_TYPE(event_type) \ +(((BYTE)(event_type) << DND_EVENT_TYPE_SHIFT) & DND_EVENT_TYPE_MASK) + + +#define DND_OPERATION_MASK ((CARD16) 0x000F) +#define DND_OPERATION_SHIFT 0 +#define DND_STATUS_MASK ((CARD16) 0x00F0) +#define DND_STATUS_SHIFT 4 +#define DND_OPERATIONS_MASK ((CARD16) 0x0F00) +#define DND_OPERATIONS_SHIFT 8 +#define DND_COMPLETION_MASK ((CARD16) 0xF000) +#define DND_COMPLETION_SHIFT 12 + +#define DND_GET_OPERATION(flags) \ +((unsigned char) \ +(((flags) & DND_OPERATION_MASK) >> DND_OPERATION_SHIFT)) + +#define DND_SET_OPERATION(operation) \ +(((CARD16)(operation) << DND_OPERATION_SHIFT)\ +& DND_OPERATION_MASK) + +#define DND_GET_STATUS(flags) \ +((unsigned char) \ +(((flags) & DND_STATUS_MASK) >> DND_STATUS_SHIFT)) + +#define DND_SET_STATUS(status) \ +(((CARD16)(status) << DND_STATUS_SHIFT)\ +& DND_STATUS_MASK) + +#define DND_GET_OPERATIONS(flags) \ +((unsigned char) \ +(((flags) & DND_OPERATIONS_MASK) >> DND_OPERATIONS_SHIFT)) + +#define DND_SET_OPERATIONS(operation) \ +(((CARD16)(operation) << DND_OPERATIONS_SHIFT)\ +& DND_OPERATIONS_MASK) + +#define DND_GET_COMPLETION(flags) \ +((unsigned char) \ +(((flags) & DND_COMPLETION_MASK) >> DND_COMPLETION_SHIFT)) + +#define DND_SET_COMPLETION(completion) \ +(((CARD16)(completion) << DND_COMPLETION_SHIFT)\ +& DND_COMPLETION_MASK) + + +#define SWAP4BYTES(l) {\ +struct { unsigned t :32;} bit32;\ +char n, *tp = (char *) &bit32;\ +bit32.t = l;\ +n = tp[0]; tp[0] = tp[3]; tp[3] = n;\ +n = tp[1]; tp[1] = tp[2]; tp[2] = n;\ +l = bit32.t;\ +} + +#define SWAP2BYTES(s) {\ +struct { unsigned t :16; } bit16;\ +char n, *tp = (char *) &bit16;\ +bit16.t = s;\ +n = tp[0]; tp[0] = tp[1]; tp[1] = n;\ +s = bit16.t;\ +} + + +/** Private extern functions */ + +static unsigned char DndByteOrder (); + + +/***** Targets/Index stuff */ + +typedef struct { + int num_targets; + Atom *targets; +} DndTargetsTableEntryRec, * DndTargetsTableEntry; + +typedef struct { + int num_entries; + DndTargetsTableEntry entries; +} DndTargetsTableRec, * DndTargetsTable; + + +static int _DndIndexToTargets(Display * display, + int index, + Atom ** targets); + +extern void qt_x11_intern_atom( const char *, Atom * ); + +///////////////////////////////////////////////////////////////// + +void qt_x11_motifdnd_init() +{ + /* Init atoms used in the com */ + + qt_x11_intern_atom( "_MOTIF_DRAG_AND_DROP_MESSAGE", &atom_message_type ); + qt_x11_intern_atom( "_MOTIF_DRAG_INITIATOR_INFO", &atom_src_property_type ); + qt_x11_intern_atom( "_MOTIF_DRAG_RECEIVER_INFO", &atom_receiver_info ); + qt_x11_intern_atom( "_MOTIF_DRAG_WINDOW", &atom_motif_window ); + qt_x11_intern_atom( "_MOTIF_DRAG_TARGETS", &atom_target_list ); + + qt_x11_intern_atom( "XmTRANSFER_SUCCESS", &Dnd_transfer_success ); + qt_x11_intern_atom( "XmTRANSFER_FAILURE", &Dnd_transfer_failure ); + + char my_dnd_selection_name[30]; // 11-digit number should be enough + sprintf(my_dnd_selection_name, "_MY_DND_SELECTION_%d", (int)getpid()); + qt_x11_intern_atom( my_dnd_selection_name, &Dnd_selection ); +} + +static unsigned char DndByteOrder () +{ + static unsigned char byte_order = 0; + + if (!byte_order) { + unsigned int endian = 1; + byte_order = (*((char *)&endian))?'l':'B'; + } + return byte_order ; +} + + + +static void DndReadSourceProperty(Display * dpy, + Window window, Atom dnd_selection, + Atom ** targets, unsigned short * num_targets) +{ + DndSrcProp * src_prop = 0; + Atom type ; + int format ; + unsigned long bytesafter, lengthRtn; + + if ((XGetWindowProperty (dpy, window, dnd_selection, 0L, 100000L, + False, atom_src_property_type, &type, + &format, &lengthRtn, &bytesafter, + (unsigned char **) &src_prop) != Success) + || (type == None)) { + *num_targets = 0; + return ; + } + + if (src_prop->byte_order != DndByteOrder()) { + SWAP2BYTES(src_prop->target_index); + SWAP4BYTES(src_prop->selection); + } + + *num_targets = _DndIndexToTargets(dpy, src_prop->target_index, targets); + + XFree((char*)src_prop); +} + + +/* Position the _MOTIF_DRAG_RECEIVER_INFO property on the dropsite window. + Called by the receiver of the drop to indicate the + supported protocol style : dynamic, drop_only or none */ +static void DndWriteReceiverProperty(Display * dpy, Window window, + unsigned char protocol_style) +{ + DndReceiverProp receiver_prop = {}; + + receiver_prop.byte_order = DndByteOrder() ; + receiver_prop.protocol_version = DND_PROTOCOL_VERSION; + receiver_prop.protocol_style = protocol_style ; + receiver_prop.proxy_window = None ; + receiver_prop.num_drop_sites = 0 ; + receiver_prop.total_size = sizeof(DndReceiverProp); + + /* write the buffer to the property */ + XChangeProperty (dpy, window, atom_receiver_info, atom_receiver_info, + 8, PropModeReplace, + (unsigned char *)&receiver_prop, + sizeof(DndReceiverProp)); +} + + +/* protocol style equiv (preregister stuff really) */ +#define DND_DRAG_DROP_ONLY_EQUIV 3 +#define DND_DRAG_DYNAMIC_EQUIV1 2 +#define DND_DRAG_DYNAMIC_EQUIV2 4 + + +/* Produce a client message to be sent by the caller */ +static void DndFillClientMessage(Display * dpy, Window window, + XClientMessageEvent *cm, + DndData * dnd_data, + char receiver) +{ + DndMessage * dnd_message = (DndMessage*)&cm->data.b[0] ; + + cm->display = dpy; + cm->type = ClientMessage; + cm->serial = LastKnownRequestProcessed(dpy); + cm->send_event = True; + cm->window = window; + cm->format = 8; + cm->message_type = atom_message_type ;/* _MOTIF_DRAG_AND_DROP_MESSAGE */ + + dnd_message->reason = dnd_data->reason | DND_SET_EVENT_TYPE(receiver); + + dnd_message->byte_order = DndByteOrder(); + + /* we're filling in flags with more stuff that necessary, + depending on the reason, but it doesn't matter */ + dnd_message->flags = 0 ; + dnd_message->flags |= DND_SET_STATUS(dnd_data->status) ; + dnd_message->flags |= DND_SET_OPERATION(dnd_data->operation) ; + dnd_message->flags |= DND_SET_OPERATIONS(dnd_data->operations) ; + dnd_message->flags |= DND_SET_COMPLETION(dnd_data->completion) ; + + dnd_message->time = dnd_data->time ; + + switch(dnd_data->reason) { + case DND_DROP_SITE_LEAVE: break ; + case DND_TOP_LEVEL_ENTER: + case DND_TOP_LEVEL_LEAVE: + dnd_message->data.top.src_window = dnd_data->src_window ; + dnd_message->data.top.property = dnd_data->property ; + break ; /* cannot fall thru since the byte layout is different in + both set of messages, see top and pot union stuff */ + + case DND_DRAG_MOTION: + case DND_OPERATION_CHANGED: + case DND_DROP_SITE_ENTER: + case DND_DROP_START: + dnd_message->data.pot.x = dnd_data->x ; /* mouse position */ + dnd_message->data.pot.y = dnd_data->y ; + dnd_message->data.pot.src_window = dnd_data->src_window ; + dnd_message->data.pot.property = dnd_data->property ; + break ; + default: + break ; + } + +} + +static Bool DndParseClientMessage(XClientMessageEvent *cm, DndData * dnd_data, + char * receiver) +{ + DndMessage * dnd_message = (DndMessage*)&cm->data.b[0] ; + + if (cm->message_type != atom_message_type) { + return False ; + } + + if (dnd_message->byte_order != DndByteOrder()) { + SWAP2BYTES(dnd_message->flags); + SWAP4BYTES(dnd_message->time); + } /* do the rest in the switch */ + + dnd_data->reason = dnd_message->reason ; + if (DND_GET_EVENT_TYPE(dnd_data->reason)) + *receiver = 1 ; + else + *receiver = 0 ; + dnd_data->reason &= DND_CLEAR_EVENT_TYPE ; + + dnd_data->time = dnd_message->time ; + + /* we're reading in more stuff that necessary. but who cares */ + dnd_data->status = DND_GET_STATUS(dnd_message->flags) ; + dnd_data->operation = DND_GET_OPERATION(dnd_message->flags) ; + dnd_data->operations = DND_GET_OPERATIONS(dnd_message->flags) ; + dnd_data->completion = DND_GET_COMPLETION(dnd_message->flags) ; + + switch(dnd_data->reason) { + case DND_TOP_LEVEL_ENTER: + case DND_TOP_LEVEL_LEAVE: + if (dnd_message->byte_order != DndByteOrder()) { + SWAP4BYTES(dnd_message->data.top.src_window); + SWAP4BYTES(dnd_message->data.top.property); + } + dnd_data->src_window = dnd_message->data.top.src_window ; + dnd_data->property = dnd_message->data.top.property ; + break ; /* cannot fall thru, see above comment in write msg */ + + case DND_DRAG_MOTION: + case DND_OPERATION_CHANGED: + case DND_DROP_SITE_ENTER: + case DND_DROP_START: + if (dnd_message->byte_order != DndByteOrder()) { + SWAP2BYTES(dnd_message->data.pot.x); + SWAP2BYTES(dnd_message->data.pot.y); + SWAP4BYTES(dnd_message->data.pot.property); + SWAP4BYTES(dnd_message->data.pot.src_window); + } + dnd_data->x = dnd_message->data.pot.x ; + dnd_data->y = dnd_message->data.pot.y ; + dnd_data->property = dnd_message->data.pot.property ; + dnd_data->src_window = dnd_message->data.pot.src_window ; + break ; + + case DND_DROP_SITE_LEAVE: + break; + default: + break ; + } + + return True ; +} + + +static Window MotifWindow(Display *display ) +{ + Atom type; + int format; + unsigned long size; + unsigned long bytes_after; + Window *property = 0; + Window motif_window ; + + /* this version does no caching, so it's slow: round trip each time */ + + if ((XGetWindowProperty (display, DefaultRootWindow(display), + atom_motif_window, + 0L, 100000L, False, AnyPropertyType, + &type, &format, &size, &bytes_after, + (unsigned char **) &property) == Success) && + (type != None)) { + motif_window = *property; + } else { + XSetWindowAttributes sAttributes; + + /* really, this should be done on a separate connection, + with XSetCloseDownMode (RetainPermanent), so that + others don't have to recreate it; hopefully, some real + Motif application will be around to do it */ + + sAttributes.override_redirect = True; + sAttributes.event_mask = PropertyChangeMask; + motif_window = XCreateWindow (display, + DefaultRootWindow (display), + -170, -560, 1, 1, 0, 0, + InputOnly, CopyFromParent, + (CWOverrideRedirect |CWEventMask), + &sAttributes); + XMapWindow (display, motif_window); + } + + if (property) { + XFree ((char *)property); + } + + return (motif_window); +} + + +static DndTargetsTable TargetsTable(Display *display) +{ + Atom type; + int format; + unsigned long size; + unsigned long bytes_after; + Window motif_window = MotifWindow(display) ; + DndTargets * target_prop; + DndTargetsTable targets_table ; + int i,j ; + char * target_data ; + + /* this version does no caching, so it's slow: round trip each time */ + /* ideally, register for property notify on this target_list + atom and update when necessary only */ + + if ((XGetWindowProperty (display, motif_window, + atom_target_list, 0L, 100000L, + False, atom_target_list, + &type, &format, &size, &bytes_after, + (unsigned char **) &target_prop) != Success) || + type == None) { + tqWarning("TQMotifDND: cannot get property on motif window"); + return 0; + } + + if (target_prop->protocol_version != DND_PROTOCOL_VERSION) { + tqWarning("TQMotifDND: protocol mismatch"); + } + + if (target_prop->byte_order != DndByteOrder()) { + /* need to swap num_target_lists and size */ + SWAP2BYTES(target_prop->num_target_lists); + SWAP4BYTES(target_prop->data_size); + } + + /* now parse DndTarget prop data in a TargetsTable */ + + targets_table = (DndTargetsTable)malloc(sizeof(DndTargetsTableRec)); + targets_table->num_entries = target_prop->num_target_lists ; + targets_table->entries = (DndTargetsTableEntry) + malloc(sizeof(DndTargetsTableEntryRec) * target_prop->num_target_lists); + + target_data = (char*)target_prop + sizeof(*target_prop) ; + + for (i = 0 ; i < targets_table->num_entries; i++) { + CARD16 num_targets ; + CARD32 atom ; + + memcpy(&num_targets, target_data, 2); + target_data += 2; + + /* potential swap needed here */ + if (target_prop->byte_order != DndByteOrder()) + SWAP2BYTES(num_targets); + + targets_table->entries[i].num_targets = num_targets ; + targets_table->entries[i].targets = (Atom *) + malloc(sizeof(Atom) * targets_table->entries[i].num_targets); + + + for (j = 0; j < num_targets; j++) { + memcpy(&atom, target_data, 4 ); + target_data += 4; + + /* another potential swap needed here */ + if (target_prop->byte_order != DndByteOrder()) + SWAP4BYTES(atom); + + targets_table->entries[i].targets[j] = (Atom) atom ; + } + } + + if (target_prop) { + XFree((char *)target_prop); + } + + return targets_table ; +} + + +static int _DndIndexToTargets(Display * display, + int index, + Atom ** targets) +{ + DndTargetsTable targets_table; + int i ; + + /* again, slow: no caching here, alloc/free each time */ + + if (!(targets_table = TargetsTable (display)) || + (index >= targets_table->num_entries)) { + return -1; + } + + /* transfer the correct target list index */ + *targets = (Atom*)malloc(sizeof(Atom)*targets_table-> + entries[index].num_targets); + memcpy((char*)*targets, + (char*)targets_table->entries[index].targets, + sizeof(Atom)*targets_table->entries[index].num_targets); + + /* free the target table and its guts */ + for (i=0 ; i < targets_table->num_entries; i++) + XFree((char*)targets_table->entries[i].targets); + + int tmp = targets_table->entries[index].num_targets; + XFree((char*)targets_table); + + return tmp; // targets_table->entries[index].num_targets; +} + + +const char *qt_motifdnd_format( int n ) +{ + if ( ! qt_motifdnd_active ) + return 0; // should not happen + + if ( n == 0 ) + return "text/plain"; + if ( n == 1 ) + return "text/uri-list"; + n -= 2; + + if ( n >= num_src_targets ) + return 0; + + Atom target = src_targets[n]; + + // duplicated from tqclipboard_x11.cpp - not the best solution + static Atom xa_utf8_string = *qt_xdnd_str_to_atom( "UTF8_STRING" ); + static Atom xa_text = *qt_xdnd_str_to_atom( "TEXT" ); + static Atom xa_compound_text = *qt_xdnd_str_to_atom( "COMPOUND_TEXT" ); + + if ( target == XA_STRING ) + return "text/plain;charset=ISO-8859-1"; + if ( target == xa_utf8_string ) + return "text/plain;charset=UTF-8"; + if ( target == xa_text || + target == xa_compound_text ) + return "text/plain"; + + return qt_xdnd_atom_to_str( target ); +} + + +TQByteArray qt_motifdnd_obtain_data( const char *mimeType ) +{ + TQByteArray result; + + // try to convert the selection to the requested property + // tqDebug( "trying to convert to '%s'", mimeType ); + + int n=0; + const char* f; + do { + f = qt_motifdnd_format( n ); + if ( !f ) + return result; + n++; + } while( tqstricmp( mimeType, f ) ); + + // found one + Atom conversion_type; + + if ( tqstrnicmp( f, "text/", 5 ) == 0 ) { + // always convert text to XA_STRING for compatibility with + // prior TQt versions + conversion_type = XA_STRING; + } else { + conversion_type = *qt_xdnd_str_to_atom( f ); + // tqDebug( "found format '%s' 0x%lx '%s'", f, conversion_type, + // qt_xdnd_atom_to_str( conversion_type ) ); + } + + if ( XGetSelectionOwner( tqt_xdisplay(), + Dnd_selection ) == None ) { + return result; // should never happen? + } + + TQWidget* tw = drop_widget; + if ( drop_widget->isDesktop() ) { + tw = new TQWidget; + } + + // convert selection to the appropriate type + XConvertSelection (tqt_xdisplay(), Dnd_selection, conversion_type, + Dnd_selection, tw->winId(), Dnd_selection_time); + + XFlush( tqt_xdisplay() ); + + XEvent xevent; + bool got=qt_xclb_wait_for_event( tqt_xdisplay(), + tw->winId(), + SelectionNotify, &xevent, 5000); + if ( got ) { + Atom type; + + if ( qt_xclb_read_property( tqt_xdisplay(), + tw->winId(), + Dnd_selection, TRUE, + &result, 0, &type, 0, TRUE ) ) { + } + } + + // we have to convert selection in order to indicate success to the initiator + XConvertSelection (tqt_xdisplay(), Dnd_selection, Dnd_transfer_success, + Dnd_selection, tw->winId(), Dnd_selection_time); + + // wait again for SelectionNotify event + qt_xclb_wait_for_event( tqt_xdisplay(), + tw->winId(), + SelectionNotify, &xevent, 5000); + + if ( drop_widget->isDesktop() ) { + delete tw; + } + + return result; +} + + +void qt_motifdnd_enable( TQWidget *widget, bool ) +{ + DndWriteReceiverProperty( widget->x11Display(), widget->winId(), + DND_DRAG_DYNAMIC); +} + + +void qt_motifdnd_handle_msg( TQWidget * /* w */ , const XEvent * xe, bool /* passive */ ) +{ + + XEvent event = *xe; + XClientMessageEvent cm ; + DndData dnd_data ; + char receiver ; + + if (!(DndParseClientMessage ((XClientMessageEvent*)&event, + &dnd_data, &receiver))) { + return; + } + + switch ( dnd_data.reason ) { + + case DND_DRAG_MOTION: + + { + /* check if in drop site, and depending on the state, + send a drop site enter or drop site leave or echo */ + + TQPoint p( dnd_data.x, dnd_data.y ); + TQWidget *c = TQApplication::widgetAt( p, TRUE ); + if (c) + p = c->mapFromGlobal(p); + + while ( c && !c->acceptDrops() && !c->isTopLevel() ) { + p = c->mapToParent( p ); + c = c->parentWidget(); + } + + TQDragMoveEvent me( p ); + TQDropEvent::Action accepted_action = TQDropEvent::Copy; + me.setAction(accepted_action); + + if ( c != 0L && c->acceptDrops() ) { + + if ( drop_widget != 0L && drop_widget->acceptDrops() && + drop_widget != c ) { + TQDragLeaveEvent e; + TQApplication::sendEvent( drop_widget, &e ); + TQDragEnterEvent de( p ); + TQApplication::sendEvent( c, &de ); + } + + drop_widget = c; + + if (!in_drop_site) { + in_drop_site = True ; + + dnd_data.reason = DND_DROP_SITE_ENTER ; + dnd_data.time = CurrentTime ; + dnd_data.operation = DND_MOVE|DND_COPY; + dnd_data.operations = DND_MOVE|DND_COPY; + + DndFillClientMessage (event.xclient.display, + cur_window, + &cm, &dnd_data, 0); + + XSendEvent(event.xbutton.display, + cur_window, False, 0, + (XEvent *)&cm) ; + + TQDragEnterEvent de( p ); + TQApplication::sendEvent( drop_widget, &de ); + if ( de.isAccepted() ) { + me.accept( de.answerRect() ); + } else { + me.ignore( de.answerRect() ); + } + + } else { + dnd_data.reason = DND_DRAG_MOTION ; + dnd_data.time = CurrentTime ; + dnd_data.operation = DND_MOVE|DND_COPY; + dnd_data.operations = DND_MOVE|DND_COPY; + + DndFillClientMessage (event.xclient.display, + cur_window, + &cm, &dnd_data, 0); + + XSendEvent(event.xbutton.display, + cur_window, False, 0, + (XEvent *)&cm) ; + + TQApplication::sendEvent( drop_widget, &me ); + } + } else { + if (in_drop_site) { + in_drop_site = False ; + + dnd_data.reason = DND_DROP_SITE_LEAVE ; + dnd_data.time = CurrentTime ; + + DndFillClientMessage (event.xclient.display, + cur_window, + &cm, &dnd_data, 0); + + XSendEvent(event.xbutton.display, + cur_window, False, 0, + (XEvent *)&cm) ; + + TQDragLeaveEvent e; + TQApplication::sendEvent( drop_widget, &e ); + } + } + } + break; + + case DND_TOP_LEVEL_ENTER: + + /* get the size of our drop site for later use */ + + cur_window = dnd_data.src_window ; + qt_motifdnd_active = TRUE; + + /* no answer needed, just read source property */ + DndReadSourceProperty (event.xclient.display, + cur_window, + dnd_data.property, + &src_targets, &num_src_targets); + break; + + case DND_TOP_LEVEL_LEAVE: + /* no need to do anything */ + break; + + case DND_OPERATION_CHANGED: + /* need to echo */ + break; + + case DND_DROP_START: + if (!in_drop_site) { + // we have to convert selection in order to indicate failure to the initiator + XConvertSelection (tqt_xdisplay(), dnd_data.property, Dnd_transfer_failure, + dnd_data.property, cur_window, dnd_data.time); + TQDragLeaveEvent e; + TQApplication::sendEvent( drop_widget, &e ); + drop_widget = 0; + return; + } + + /* need to echo and then request a convert */ + dnd_data.reason = DND_DROP_START ; + + DndFillClientMessage (event.xclient.display, + drop_widget->winId(), + &cm, &dnd_data, 0); + + XSendEvent(event.xbutton.display, + cur_window, False, 0, + (XEvent *)&cm) ; + + // store selection and its time + Dnd_selection = dnd_data.property; + Dnd_selection_time = dnd_data.time; + + TQPoint p( dnd_data.x, dnd_data.y ); + TQDropEvent de( drop_widget->mapFromGlobal(p) ); + de.setAction( TQDropEvent::Copy ); + TQApplication::sendEvent( drop_widget, &de ); + + if (in_drop_site) + in_drop_site = False ; + + drop_widget = 0; + cur_window = 0; + break; + } // end of switch ( dnd_data.reason ) +} + +#endif // TQT_NO_DRAGANDDROP diff --git a/src/kernel/tqobject.cpp b/src/kernel/tqobject.cpp index cfb026fbf..756117fff 100644 --- a/src/kernel/tqobject.cpp +++ b/src/kernel/tqobject.cpp @@ -61,7 +61,7 @@ #include #include -// Keep in sync with duplicate definition in qcommonstyle.cpp +// Keep in sync with duplicate definition in tqcommonstyle.cpp class TQStyleControlElementDataPrivate { public: bool isTQPushButton; diff --git a/src/styles/ntqcdestyle.h b/src/styles/ntqcdestyle.h deleted file mode 100644 index a0f02be28..000000000 --- a/src/styles/ntqcdestyle.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Definition of the CDE-like style class -** -** Created : 990513 -** -** Copyright (C) 1999-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - - -#ifndef TQCDESTYLE_H -#define TQCDESTYLE_H - -#ifndef QT_H -#include "ntqmotifstyle.h" -#endif // QT_H - -#if !defined(TQT_NO_STYLE_CDE) || defined(QT_PLUGIN) - -#if defined(QT_PLUGIN) -#define Q_EXPORT_STYLE_CDE -#else -#define Q_EXPORT_STYLE_CDE TQ_EXPORT -#endif - -class Q_EXPORT_STYLE_CDE TQCDEStyle : public TQMotifStyle -{ - TQ_OBJECT -public: - - TQCDEStyle( bool useHighlightCols = FALSE ); - virtual ~TQCDEStyle(); - - int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; - - void drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how = Style_Default, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - void drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; - -}; - -#endif // TQT_NO_STYLE_CDE - -#endif // TQCDESTYLE_H diff --git a/src/styles/ntqcommonstyle.h b/src/styles/ntqcommonstyle.h deleted file mode 100644 index 705177d71..000000000 --- a/src/styles/ntqcommonstyle.h +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** -** Definition of TQCommonStyle class -** -** Created : 980616 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQCOMMONSTYLE_H -#define TQCOMMONSTYLE_H - -#ifndef QT_H -#include "tqstyle.h" -#endif // QT_H - -#ifndef TQT_NO_STYLE - -class TQ_EXPORT TQCommonStyle: public TQStyle -{ - TQ_OBJECT - -public: - TQCommonStyle(); - ~TQCommonStyle(); - - // New API - void drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; - - // New API - void drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how = Style_Default, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - // New API - void drawControlMask( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - // New API - TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const; - - // New API - void drawComplexControl( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how = Style_Default, -#ifdef Q_QDOC - SCFlags sub = SC_All, -#else - SCFlags sub = (uint)SC_All, -#endif - SCFlags subActive = SC_None, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - // New API - void drawComplexControlMask( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - const ControlElementFlags elementFlags, - const TQRect &r, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - // New API - TQRect querySubControlMetrics( ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sc, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - // New API - SubControl querySubControl( ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQPoint &pos, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - // New API - int pixelMetric( PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; - - // New API - TQSize sizeFromContents( ContentsType s, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQSize &contentsSize, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - // New API - int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget * w) const; - - // New API - TQPixmap stylePixmap( StylePixmap sp, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - -private: - // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQCommonStyle( const TQCommonStyle & ); - TQCommonStyle &operator=( const TQCommonStyle & ); -#endif -}; - -#endif // TQT_NO_STYLE - -#endif // TQCOMMONSTYLE_H diff --git a/src/styles/ntqcompactstyle.h b/src/styles/ntqcompactstyle.h deleted file mode 100644 index b022002c5..000000000 --- a/src/styles/ntqcompactstyle.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Definition of compact style class, good for small displays -** -** Created : 000623 -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQCOMPACTSTYLE_H -#define TQCOMPACTSTYLE_H - -#ifndef QT_H -#include "ntqwindowsstyle.h" -#endif // QT_H - -#if !defined(TQT_NO_STYLE_COMPACT) || defined(QT_PLUGIN) - -#if defined(QT_PLUGIN) -#define Q_EXPORT_STYLE_COMPACT -#else -#define Q_EXPORT_STYLE_COMPACT TQ_EXPORT -#endif - -class Q_EXPORT_STYLE_COMPACT TQCompactStyle : public TQWindowsStyle -{ -public: - TQCompactStyle(); - - int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ); - - void drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; - - void drawControl( ControlElement element, TQPainter *p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, - const TQColorGroup &cg, SFlags how = Style_Default, const TQStyleOption& = TQStyleOption::Default, const TQWidget *w = 0 ); - - int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget *) const; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQCompactStyle( const TQCompactStyle & ); - TQCompactStyle& operator=( const TQCompactStyle & ); -#endif -}; - -#endif // TQT_NO_STYLE_WINDOWS - -#endif // TQCOMPACTSTYLE_H diff --git a/src/styles/ntqinterlacestyle.h b/src/styles/ntqinterlacestyle.h deleted file mode 100644 index c2d22bf8e..000000000 --- a/src/styles/ntqinterlacestyle.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQInterlaceStyle widget class -** -** Created : 010122 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#if 0 // ###### not ported to new API yet -#ifndef TQINTERLACESTYLE_H -#define TQINTERLACESTYLE_H - -#ifndef QT_H -#include "ntqmotifstyle.h" -#endif // QT_H - -#if !defined(TQT_NO_STYLE_INTERLACE) || defined(QT_PLUGIN) - -#include "tqpalette.h" - -class TQ_EXPORT TQInterlaceStyle : public TQMotifStyle -{ -public: - TQInterlaceStyle(); - void polish( TQApplication*); - void unPolish( TQApplication*); - void polish( TQWidget* ); - void unPolish( TQWidget* ); - - int defaultFrameWidth() const; - TQRect pushButtonContentsRect( TQPushButton *btn ); - - void drawFocusRect ( TQPainter *, const TQRect &, const TQColorGroup &, const TQColor * bg = 0, bool = FALSE ); - void drawButton( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &g, bool sunken = FALSE, - const TQBrush *fill = 0 ); - void drawButtonMask ( TQPainter * p, int x, int y, int w, int h ); - void drawBevelButton( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &g, bool sunken = FALSE, - const TQBrush *fill = 0 ); - - void drawPushButton( TQPushButton* btn, TQPainter *p); - TQSize indicatorSize () const; - void drawIndicator ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, int state, bool down = FALSE, bool enabled = TRUE ); - void drawIndicatorMask( TQPainter *p, int x, int y, int w, int h, int ); - TQSize exclusiveIndicatorSize () const; - void drawExclusiveIndicator( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool on, bool down = FALSE, bool enabled = TRUE ); - void drawExclusiveIndicatorMask( TQPainter * p, int x, int y, int w, int h, bool ); - TQRect comboButtonRect ( int x, int y, int w, int h ); - void drawComboButton( TQPainter *p, int x, int y, int w, int h, const TQColorGroup &g, bool sunken, bool editable, bool enabled, const TQBrush *fb ); - void drawPushButtonLabel( TQPushButton* btn, TQPainter *p); - void drawPanel( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &, bool sunken, - int lineWidth, const TQBrush *fill ); - - void scrollBarMetrics( const TQScrollBar* sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim ); - void drawScrollBarControls( TQPainter* p, const TQScrollBar* sb, int sliderStart, uint controls, uint activeControl ); - void drawSlider( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, Orientation, bool tickAbove, bool tickBelow ); - void drawSliderGroove( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, TQCOORD c, Orientation ); - int splitterWidth() const; - void drawSplitter( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &g, Orientation orient); - - int buttonDefaultIndicatorWidth() const; - int setSliderThickness() const; - TQSize scrollBarExtent() const; - -private: - TQPalette oldPalette; -}; - -#endif // TQT_NO_STYLE_INTERLACE - -#endif -#endif diff --git a/src/styles/ntqmotifplusstyle.h b/src/styles/ntqmotifplusstyle.h deleted file mode 100644 index bb590fc9d..000000000 --- a/src/styles/ntqmotifplusstyle.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Definition of TQMotifPlusStyle class -** -** Created : 000727 -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQMOTIFPLUSSTYLE_H -#define TQMOTIFPLUSSTYLE_H - - -#ifndef QT_H -#include "ntqmotifstyle.h" -#endif // QT_H - -#if !defined(TQT_NO_STYLE_MOTIFPLUS) || defined(QT_PLUGIN) - -#if defined(QT_PLUGIN) -#define Q_EXPORT_STYLE_MOTIFPLUS -#else -#define Q_EXPORT_STYLE_MOTIFPLUS TQ_EXPORT -#endif - -class Q_EXPORT_STYLE_MOTIFPLUS TQMotifPlusStyle : public TQMotifStyle -{ - TQ_OBJECT - -public: - TQMotifPlusStyle(bool hoveringHighlight = TRUE); - virtual ~TQMotifPlusStyle(); - - void polish(TQPalette &pal); - void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); - void unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); - - void applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); - void applicationUnPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); - - void drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; - - void drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how = Style_Default, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - TQRect subRect(SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const; - - void drawComplexControl(ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how = Style_Default, -#ifdef Q_QDOC - SCFlags controls = SC_All, -#else - SCFlags controls = (uint)SC_All, -#endif - SCFlags active = SC_None, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - TQRect querySubControlMetrics(ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl subcontrol, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0) const; - - int pixelMetric(PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0) const; - - int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn* = 0, const TQWidget * = 0) const; - - bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); - - -private: - bool useHoveringHighlight; -}; - - -#endif // TQT_NO_STYLE_MOTIFPLUS - -#endif // TQMOTIFPLUSSTYLE_H diff --git a/src/styles/ntqmotifstyle.h b/src/styles/ntqmotifstyle.h deleted file mode 100644 index b2501e483..000000000 --- a/src/styles/ntqmotifstyle.h +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Definition of Motif-like style class -** -** Created : 981231 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQMOTIFSTYLE_H -#define TQMOTIFSTYLE_H - -#ifndef QT_H -#include "ntqcommonstyle.h" -#endif // QT_H - -#if !defined(TQT_NO_STYLE_MOTIF) || defined(QT_PLUGIN) - -class TQPalette; - -#if defined(QT_PLUGIN) -#define Q_EXPORT_STYLE_MOTIF -#else -#define Q_EXPORT_STYLE_MOTIF TQ_EXPORT -#endif - - -class Q_EXPORT_STYLE_MOTIF TQMotifStyle : public TQCommonStyle -{ - TQ_OBJECT -public: - TQMotifStyle( bool useHighlightCols=FALSE ); - virtual ~TQMotifStyle(); - - void setUseHighlightColors( bool ); - bool useHighlightColors() const; - - void polish( TQPalette& ); - void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - - void polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - - // new style API - void drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; - - void drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how = Style_Default, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - void drawComplexControl( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect& r, - const TQColorGroup& cg, - SFlags how = Style_Default, -#ifdef Q_QDOC - SCFlags sub = SC_All, -#else - SCFlags sub = (uint)SC_All, -#endif - SCFlags subActive = SC_None, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget* widget = 0 ) const; - - TQRect querySubControlMetrics( ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sc, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; - - TQSize sizeFromContents( ContentsType contents, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQSize &contentsSize, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const; - - TQPixmap stylePixmap(StylePixmap, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption& = TQStyleOption::Default, const TQWidget * = 0) const; - - int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn* = 0, const TQWidget * = 0) const; - -private: - bool highlightCols; - - // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQMotifStyle( const TQMotifStyle & ); - TQMotifStyle& operator=( const TQMotifStyle & ); -#endif -}; - -#endif // TQT_NO_STYLE_MOTIF - -#endif // TQMOTIFSTYLE_H diff --git a/src/styles/ntqplatinumstyle.h b/src/styles/ntqplatinumstyle.h deleted file mode 100644 index 54d0a94dd..000000000 --- a/src/styles/ntqplatinumstyle.h +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Definition of Platinum-like style class -** -** Created : 981231 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQPLATINUMSTYLE_H -#define TQPLATINUMSTYLE_H - -#ifndef QT_H -#include "ntqwindowsstyle.h" -#endif // QT_H - -#if !defined(TQT_NO_STYLE_PLATINUM) || defined(QT_PLUGIN) - -class TQPalette; - -#if defined(QT_PLUGIN) -#define Q_EXPORT_STYLE_PLATINUM -#else -#define Q_EXPORT_STYLE_PLATINUM TQ_EXPORT -#endif - -class Q_EXPORT_STYLE_PLATINUM TQPlatinumStyle : public TQWindowsStyle -{ - TQ_OBJECT -public: - TQPlatinumStyle(); - virtual ~TQPlatinumStyle(); - - // new Style Stuff - void drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; - - void drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how = Style_Default, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - void drawComplexControl( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how = Style_Default, -#ifdef Q_QDOC - SCFlags sub = SC_All, -#else - SCFlags sub = (uint)SC_All, -#endif - SCFlags subActive = SC_None, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - TQRect querySubControlMetrics( ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sc, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; - - TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const; - -protected: - TQColor mixedColor(const TQColor &, const TQColor &) const; - void drawRiffles( TQPainter* p, int x, int y, int w, int h, - const TQColorGroup &g, bool horizontal ) const; -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQPlatinumStyle( const TQPlatinumStyle & ); - TQPlatinumStyle& operator=( const TQPlatinumStyle & ); -#endif -}; - -#endif // TQT_NO_STYLE_PLATINUM - -#endif // TQPLATINUMSTYLE_H diff --git a/src/styles/ntqsgistyle.h b/src/styles/ntqsgistyle.h deleted file mode 100644 index df0b5b47b..000000000 --- a/src/styles/ntqsgistyle.h +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Definition of SGI-like style class -** -** Created : 981231 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSGISTYLE_H -#define TQSGISTYLE_H - -#ifndef QT_H -#include "ntqmotifstyle.h" -#include "ntqguardedptr.h" -#include "tqwidget.h" -#endif // QT_H - -#if !defined(TQT_NO_STYLE_SGI) || defined(QT_PLUGIN) - -#if defined(QT_PLUGIN) -#define Q_EXPORT_STYLE_SGI -#else -#define Q_EXPORT_STYLE_SGI TQ_EXPORT -#endif - -class TQSGIStylePrivate; - -class Q_EXPORT_STYLE_SGI TQSGIStyle: public TQMotifStyle -{ - TQ_OBJECT -public: - TQSGIStyle( bool useHighlightCols = FALSE ); - virtual ~TQSGIStyle(); - -#if !defined(Q_NO_USING_KEYWORD) - using TQMotifStyle::polish; -#endif - void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - void applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - - void drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; - - void drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how = Style_Default, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - void drawComplexControl( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect& r, - const TQColorGroup& cg, - SFlags how = Style_Default, -#ifdef Q_QDOC - SCFlags sub = SC_All, -#else - SCFlags sub = (uint)SC_All, -#endif - SCFlags subActive = SC_None, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget* widget = 0 ) const; - - int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; - - TQSize sizeFromContents( ContentsType contents, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQSize &contentsSize, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const; - TQRect querySubControlMetrics( ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sc, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget *) const; - - bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); - -private: - TQSGIStylePrivate *d; - - uint isApplicationStyle :1; -#if defined(TQ_DISABLE_COPY) - TQSGIStyle( const TQSGIStyle & ); - TQSGIStyle& operator=( const TQSGIStyle & ); -#endif - -}; - -#endif // TQT_NO_STYLE_SGI - -#endif // TQSGISTYLE_H diff --git a/src/styles/ntqwindowsstyle.h b/src/styles/ntqwindowsstyle.h deleted file mode 100644 index d7df8b98d..000000000 --- a/src/styles/ntqwindowsstyle.h +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Definition of Windows-like style class -** -** Created : 981231 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQWINDOWSSTYLE_H -#define TQWINDOWSSTYLE_H - -#ifndef QT_H -#include "ntqcommonstyle.h" -#endif // QT_H - -#if !defined(TQT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) - -#if defined(QT_PLUGIN) -#define Q_EXPORT_STYLE_WINDOWS -#else -#define Q_EXPORT_STYLE_WINDOWS TQ_EXPORT -#endif - - -class Q_EXPORT_STYLE_WINDOWS TQWindowsStyle : public TQCommonStyle -{ - TQ_OBJECT -public: - TQWindowsStyle(); - ~TQWindowsStyle(); - - void applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); - void applicationUnPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); - - void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); - void unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); - - void polish( TQPalette & ); - - virtual void polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - - // new stuff - void drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; - - void drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - void drawComplexControl( ComplexControl control, - TQPainter* p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect& r, - const TQColorGroup& cg, - SFlags flags = Style_Default, -#ifdef Q_QDOC - SCFlags sub = SC_All, -#else - SCFlags sub = (uint)SC_All, -#endif - SCFlags subActive = SC_None, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget* widget = 0 ) const; - - int pixelMetric( PixelMetric metric, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQWidget *widget = 0 ) const; - - TQSize sizeFromContents( ContentsType contents, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQSize &contentsSize, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn* = 0, const TQWidget* = 0) const; - - TQPixmap stylePixmap( StylePixmap stylepixmap, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption& = TQStyleOption::Default, - const TQWidget *widget = 0 ) const; - - TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const; - - bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); - -private: - class Private; - Private *d; - - // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQWindowsStyle( const TQWindowsStyle & ); - TQWindowsStyle& operator=( const TQWindowsStyle & ); -#endif -}; - -#endif // TQT_NO_STYLE_WINDOWS - -#endif // TQWINDOWSSTYLE_H diff --git a/src/styles/qcdestyle.cpp b/src/styles/qcdestyle.cpp deleted file mode 100644 index 27388d3f6..000000000 --- a/src/styles/qcdestyle.cpp +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** -** -** Implementation of CDE-like style class -** -** Created : 981231 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqcdestyle.h" - -#if !defined(TQT_NO_STYLE_CDE) || defined(QT_PLUGIN) - -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqbutton.h" -#include - -/*! - \class TQCDEStyle ntqcdestyle.h - \brief The TQCDEStyle class provides a CDE look and feel. - - \ingroup appearance - - This style provides a slightly improved Motif look similar to some - versions of the Common Desktop Environment (CDE). The main - differences are thinner frames and more modern radio buttons and - checkboxes. Together with a dark background and a bright - text/foreground color, the style looks quite attractive (at least - for Motif fans). - - Note that the functions provided by TQCDEStyle are - reimplementations of TQStyle functions; see TQStyle for their - documentation. -*/ - -/*! - Constructs a TQCDEStyle. - - If \a useHighlightCols is FALSE (the default), then the style will - polish the application's color palette to emulate the Motif way of - highlighting, which is a simple inversion between the base and the - text color. -*/ -TQCDEStyle::TQCDEStyle( bool useHighlightCols ) : TQMotifStyle( useHighlightCols ) -{ -} - -/*! - Destroys the style. -*/ -TQCDEStyle::~TQCDEStyle() -{ -} - - -/*!\reimp -*/ -int TQCDEStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const -{ - int ret; - - switch( metric ) { - case PM_DefaultFrameWidth: - ret = 1; - break ; - case PM_MenuBarFrameWidth: - ret = 1; - break; - case PM_ScrollBarExtent: - ret = 13; - break; - default: - ret = TQMotifStyle::pixelMetric( metric, ceData, elementFlags, widget ); - break; - } - return ret; -} - -/*! \reimp -*/ -void TQCDEStyle::drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - - switch( element ) { - case CE_MenuBarItem: - { - if ( how & Style_Active ) // active item - qDrawShadePanel( p, r, cg, TRUE, 1, - &cg.brush( TQColorGroup::Button ) ); - else // other item - p->fillRect( r, cg.brush( TQColorGroup::Button ) ); - TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget ); - break; - } - default: - TQMotifStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget ); - break; - } - - -} - -/*! \reimp -*/ -void TQCDEStyle::drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt ) const -{ - switch( pe ) { - case PE_Indicator: { -#ifndef TQT_NO_BUTTON - bool down = flags & Style_Down; - bool on = flags & Style_On; - bool showUp = !( down ^ on ); - TQBrush fill = showUp || flags & Style_NoChange ? cg.brush( TQColorGroup::Button ) : cg.brush( TQColorGroup::Mid ); - qDrawShadePanel( p, r, cg, !showUp, pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ), &cg.brush( TQColorGroup::Button ) ); - - if ( !( flags & Style_Off ) ) { - TQPointArray a( 7 * 2 ); - int i, xx, yy; - xx = r.x() + 3; - yy = r.y() + 5; - for ( i = 0; i < 3; i++ ) { - a.setPoint( 2 * i, xx, yy ); - a.setPoint( 2 * i + 1, xx, yy + 2 ); - xx++; yy++; - } - yy -= 2; - for ( i = 3; i < 7; i++ ) { - a.setPoint( 2 * i, xx, yy ); - a.setPoint( 2 * i + 1, xx, yy + 2 ); - xx++; yy--; - } - if ( flags & Style_NoChange ) - p->setPen( cg.dark() ); - else - p->setPen( cg.foreground() ); - p->drawLineSegments( a ); - } -#endif - } - break; - case PE_ExclusiveIndicator: - { -#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2) - static const TQCOORD pts1[] = { // up left lines - 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; - static const TQCOORD pts4[] = { // bottom right lines - 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, - 11,4, 10,3, 10,2 }; - static const TQCOORD pts5[] = { // inner fill - 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; - bool down = flags & Style_Down; - bool on = flags & Style_On; - p->eraseRect( r ); - TQPointArray a( TQCOORDARRLEN(pts1), pts1 ); - a.translate( r.x(), r.y() ); - p->setPen( ( down || on ) ? cg.dark() : cg.light() ); - p->drawPolyline( a ); - a.setPoints( TQCOORDARRLEN(pts4), pts4 ); - a.translate( r.x(), r.y() ); - p->setPen( ( down || on ) ? cg.light() : cg.dark() ); - p->drawPolyline( a ); - a.setPoints( TQCOORDARRLEN(pts5), pts5 ); - a.translate( r.x(), r.y() ); - TQColor fillColor = on ? cg.dark() : cg.background(); - p->setPen( fillColor ); - p->setBrush( on ? cg.brush( TQColorGroup::Dark ) : - cg.brush( TQColorGroup::Background ) ); - p->drawPolygon( a ); - break; - } - - case PE_ExclusiveIndicatorMask: - { - static const TQCOORD pts1[] = { - // up left lines - 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1, - // bottom right lines - 10,2, 10,3, 11,4, 11,7, 10,8, 10,9, 9,10, 8,10, 7,11, 4,11, 3,10, 2,10 - }; - TQPointArray a(TQCOORDARRLEN(pts1), pts1); - a.translate(r.x(), r.y()); - p->setPen(color1); - p->setBrush(color1); - p->drawPolygon(a); - break; - } - case PE_ArrowUp: - case PE_ArrowDown: - case PE_ArrowRight: - case PE_ArrowLeft: { - TQRect rect = r; - TQPointArray bFill; // fill polygon - TQPointArray bTop; // top shadow. - TQPointArray bBot; // bottom shadow. - TQPointArray bLeft; // left shadow. - TQWMatrix matrix; // xform matrix - bool vertical = pe == PE_ArrowUp || pe == PE_ArrowDown; - bool horizontal = !vertical; - int dim = rect.width() < rect.height() ? rect.width() : rect.height(); - int colspec = 0x0000; // color specification array - - if ( dim < 2 ) // too small arrow - return; - - // adjust size and center (to fix rotation below) - if ( rect.width() > dim ) { - rect.setX( rect.x() + ( ( rect.width() - dim ) / 2 ) ); - rect.setWidth( dim ); - } - if ( rect.height() > dim ) { - rect.setY( rect.y() + ( ( rect.height() - dim ) / 2 ) ); - rect.setHeight( dim ); - } - - if ( dim > 3 ) { - bFill.resize( dim & 1 ? 3 : 4 ); - bTop.resize( 2 ); - bBot.resize( 2 ); - bLeft.resize( 2 ); - bLeft.putPoints( 0, 2, 0, 0, 0, dim-1 ); - bTop.putPoints( 0, 2, 1, 0, dim-1, dim/2 ); - bBot.putPoints( 0, 2, 1, dim-1, dim-1, dim/2 ); - - if ( dim > 6 ) { // dim>6: must fill interior - bFill.putPoints( 0, 2, 1, dim-1, 1, 1 ); - if ( dim & 1 ) // if size is an odd number - bFill.setPoint( 2, dim - 2, dim / 2 ); - else - bFill.putPoints( 2, 2, dim-2, dim/2-1, dim-2, dim/2 ); - } - } else { - if ( dim == 3 ) { // 3x3 arrow pattern - bLeft.setPoints( 4, 0,0, 0,2, 1,1, 1,1 ); - bTop .setPoints( 2, 1,0, 1,0 ); - bBot .setPoints( 2, 1,2, 2,1 ); - } else { // 2x2 arrow pattern - bLeft.setPoints( 2, 0,0, 0,1 ); - bTop .setPoints( 2, 1,0, 1,0 ); - bBot .setPoints( 2, 1,1, 1,1 ); - } - } - - if ( pe == PE_ArrowUp || pe == PE_ArrowLeft ) { - matrix.translate( rect.x(), rect.y() ); - if ( vertical ) { - matrix.translate( 0, rect.height() - 1 ); - matrix.rotate( -90 ); - } else { - matrix.translate( rect.width() - 1, rect.height() - 1 ); - matrix.rotate( 180 ); - } - if ( flags & Style_Down ) - colspec = horizontal ? 0x2334 : 0x2343; - else - colspec = horizontal ? 0x1443 : 0x1434; - } else if ( pe == PE_ArrowDown || pe == PE_ArrowRight ) { - matrix.translate( rect.x(), rect.y() ); - if ( vertical ) { - matrix.translate( rect.width()-1, 0 ); - matrix.rotate( 90 ); - } - if ( flags & Style_Down ) - colspec = horizontal ? 0x2443 : 0x2434; - else - colspec = horizontal ? 0x1334 : 0x1343; - } - - TQColor *cols[5]; - if ( flags & Style_Enabled ) { - cols[0] = 0; - cols[1] = (TQColor *)&cg.button(); - cols[2] = (TQColor *)&cg.mid(); - cols[3] = (TQColor *)&cg.light(); - cols[4] = (TQColor *)&cg.dark(); - } else { - cols[0] = 0; - cols[1] = (TQColor *)&cg.button(); - cols[2] = (TQColor *)&cg.button(); - cols[3] = (TQColor *)&cg.button(); - cols[4] = (TQColor *)&cg.button(); - } - -#define CMID *cols[ (colspec>>12) & 0xf ] -#define CLEFT *cols[ (colspec>>8) & 0xf ] -#define CTOP *cols[ (colspec>>4) & 0xf ] -#define CBOT *cols[ colspec & 0xf ] - - TQPen savePen = p->pen(); // save current pen - TQBrush saveBrush = p->brush(); // save current brush - TQWMatrix wxm = p->worldMatrix(); - TQPen pen( NoPen ); - TQBrush brush = cg.brush( flags & Style_Enabled ? TQColorGroup::Button : - TQColorGroup::Mid ); - - p->setPen( pen ); - p->setBrush( brush ); - p->setWorldMatrix( matrix, TRUE ); // set transformation matrix - p->drawPolygon( bFill ); // fill arrow - p->setBrush( NoBrush ); // don't fill - - p->setPen( CLEFT ); - p->drawLineSegments( bLeft ); - p->setPen( CBOT ); - p->drawLineSegments( bBot ); - p->setPen( CTOP ); - p->drawLineSegments( bTop ); - - p->setWorldMatrix( wxm ); - p->setBrush( saveBrush ); // restore brush - p->setPen( savePen ); // restore pen - -#undef CMID -#undef CLEFT -#undef CTOP -#undef CBOT - - } - break; - default: - TQMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); - } -} - -#endif diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp deleted file mode 100644 index da39e602c..000000000 --- a/src/styles/qcommonstyle.cpp +++ /dev/null @@ -1,3381 +0,0 @@ -/**************************************************************************** -** -** Implementation of the TQCommonStyle class -** -** Created : 981231 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqcommonstyle.h" - -#ifndef TQT_NO_STYLE - -#include "tqmutex.h" -#include "tqmenubar.h" -#include "ntqapplication.h" -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqpixmap.h" -#include "tqpushbutton.h" -#include "tqtabbar.h" -#include "tqtabwidget.h" -#include "tqlineedit.h" -#include "tqscrollbar.h" -#include "tqtoolbutton.h" -#include "tqtoolbar.h" -#include "tqcombobox.h" -#include "ntqdockarea.h" -#include "tqheader.h" -#include "tqspinbox.h" -#include "ntqrangecontrol.h" -#include "tqgroupbox.h" -#include "tqslider.h" -#include "tqlistview.h" -#include "tqcheckbox.h" -#include "tqradiobutton.h" -#include "tqbitmap.h" -#include "tqprogressbar.h" -#include "tqlistbox.h" -#include "private/tqdialogbuttons_p.h" -#include -#include -#include "../widgets/qtitlebar_p.h" -#include - -/*! - \class TQCommonStyle ntqcommonstyle.h - \brief The TQCommonStyle class encapsulates the common Look and Feel of a GUI. - - \ingroup appearance - - This abstract class implements some of the widget's look and feel - that is common to all GUI styles provided and shipped as part of - TQt. - - All the functions are documented in \l TQStyle. -*/ - -/*! - \enum TQt::ArrowType - - \value UpArrow - \value DownArrow - \value LeftArrow - \value RightArrow - -*/ - -// the active painter, if any... this is used as an optimzation to -// avoid creating a painter if we have an active one (since -// TQStyle::itemRect() needs a painter to operate correctly -static TQPainter *activePainter = 0; - -/*! - Constructs a TQCommonStyle. -*/ -TQCommonStyle::TQCommonStyle() : TQStyle() -{ - activePainter = 0; -} - -/*! \reimp */ -TQCommonStyle::~TQCommonStyle() -{ - activePainter = 0; -} - - -static const char * const check_list_controller_xpm[] = { -"16 16 4 1", -" c None", -". c #000000000000", -"X c #FFFFFFFF0000", -"o c #C71BC30BC71B", -" ", -" ", -" .......... ", -" .XXXXXXXX. ", -" .XXXXXXXX.oo ", -" .XXXXXXXX.oo ", -" .XXXXXXXX.oo ", -" .XXXXXXXX.oo ", -" .XXXXXXXX.oo ", -" .XXXXXXXX.oo ", -" .XXXXXXXX.oo ", -" ..........oo ", -" oooooooooo ", -" oooooooooo ", -" ", -" "}; - -// Increase speed by avoiding constant allocation/deallocation of commonly used strings -static TQString TQPushButton_static_string("TQPushButton"); -static TQString TQToolButton_static_string("TQToolButton"); -static TQString TQButton_static_string("TQButton"); -static TQString TQTabBar_static_string("TQTabBar"); -static TQString TQTitleBar_static_string("TQTitleBar"); -static TQString TQToolBox_static_string("TQToolBox"); -static TQString TQToolBar_static_string("TQToolBar"); -static TQString TQProgressBar_static_string("TQProgressBar"); -static TQString TQPopupMenu_static_string("TQPopupMenu"); -static TQString TQComboBox_static_string("TQComboBox"); -static TQString TQCheckBox_static_string("TQCheckBox"); -static TQString TQRadioButton_static_string("TQRadioButton"); -static TQString TQHeader_static_string("TQHeader"); -static TQString TQScrollBar_static_string("TQScrollBar"); -static TQString TQSlider_static_string("TQSlider"); -static TQString TQDialogButtons_static_string("TQDialogButtons"); -static TQString TQSpinWidget_static_string("TQSpinWidget"); -static TQString TQListView_static_string("TQListView"); -static TQString TQDockWindow_static_string("TQDockWindow"); -static TQString TQTabWidget_static_string("TQTabWidget"); -static TQString TQFrame_static_string("TQFrame"); -static TQString TQWidget_static_string("TQWidget"); - -static TQStyleControlElementData* TQStyleControlElementData_null = NULL; -static void tqt_style_control_element_data_null_cleanup() { - delete TQStyleControlElementData_null; - TQStyleControlElementData_null =0; -} - -#include - -// Keep in sync with duplicate definition in tqobject.cpp -class TQStyleControlElementDataPrivate { - public: - bool isTQPushButton; - bool isTQToolButton; - bool isTQButton; - bool isTQTabBar; - bool isTQTitleBar; - bool isTQToolBox; - bool isTQToolBar; - bool isTQProgressBar; - bool isTQPopupMenu; - bool isTQComboBox; - bool isTQCheckBox; - bool isTQRadioButton; - bool isTQHeader; - bool isTQScrollBar; - bool isTQSlider; - bool isTQDialogButtons; - bool isTQSpinWidget; - bool isTQListView; - bool isTQDockWindow; - bool isTQTabWidget; - bool isTQFrame; - bool isTQWidget; -}; - -TQStringList getObjectTypeListForObject(const TQObject* object) { - TQStringList objectTypes; - - if (object) { - TQMetaObject* objectMetaObject = object->metaObject(); - const char* name; - - while (objectMetaObject) { - name = objectMetaObject->className(); - objectTypes.append(TQString(name)); - objectMetaObject = objectMetaObject->superClass(); - } - } - - return objectTypes; -} - -void determineObjectTypes(const TQObject* object, TQStyleControlElementData &ceData, TQStyleControlElementDataPrivate* ceDataPrivate) { - ceData.widgetObjectTypes = getObjectTypeListForObject(object); - - // Increase speed on repeated calls by checking object types here and caching them - ceDataPrivate->isTQPushButton = ceData.widgetObjectTypes.containsYesNo(TQPushButton_static_string); - ceDataPrivate->isTQToolButton = ceData.widgetObjectTypes.containsYesNo(TQToolButton_static_string); - ceDataPrivate->isTQButton = ceData.widgetObjectTypes.containsYesNo(TQButton_static_string); - ceDataPrivate->isTQTabBar = ceData.widgetObjectTypes.containsYesNo(TQTabBar_static_string); - ceDataPrivate->isTQTitleBar = ceData.widgetObjectTypes.containsYesNo(TQTitleBar_static_string); - ceDataPrivate->isTQToolBox = ceData.widgetObjectTypes.containsYesNo(TQToolBox_static_string); - ceDataPrivate->isTQToolBar = ceData.widgetObjectTypes.containsYesNo(TQToolBar_static_string); - ceDataPrivate->isTQProgressBar = ceData.widgetObjectTypes.containsYesNo(TQProgressBar_static_string); - ceDataPrivate->isTQPopupMenu = ceData.widgetObjectTypes.containsYesNo(TQPopupMenu_static_string); - ceDataPrivate->isTQComboBox = ceData.widgetObjectTypes.containsYesNo(TQComboBox_static_string); - ceDataPrivate->isTQCheckBox = ceData.widgetObjectTypes.containsYesNo(TQCheckBox_static_string); - ceDataPrivate->isTQRadioButton = ceData.widgetObjectTypes.containsYesNo(TQRadioButton_static_string); - ceDataPrivate->isTQHeader = ceData.widgetObjectTypes.containsYesNo(TQHeader_static_string); - ceDataPrivate->isTQScrollBar = ceData.widgetObjectTypes.containsYesNo(TQScrollBar_static_string); - ceDataPrivate->isTQSlider = ceData.widgetObjectTypes.containsYesNo(TQSlider_static_string); - ceDataPrivate->isTQDialogButtons = ceData.widgetObjectTypes.containsYesNo(TQDialogButtons_static_string); - ceDataPrivate->isTQSpinWidget = ceData.widgetObjectTypes.containsYesNo(TQSpinWidget_static_string); - ceDataPrivate->isTQListView = ceData.widgetObjectTypes.containsYesNo(TQListView_static_string); - ceDataPrivate->isTQDockWindow = ceData.widgetObjectTypes.containsYesNo(TQDockWindow_static_string); - ceDataPrivate->isTQTabWidget = ceData.widgetObjectTypes.containsYesNo(TQTabWidget_static_string); - ceDataPrivate->isTQFrame = ceData.widgetObjectTypes.containsYesNo(TQFrame_static_string); - ceDataPrivate->isTQWidget = ceData.widgetObjectTypes.containsYesNo(TQWidget_static_string); -} - -void updateObjectTypeListIfNeeded(const TQObject* object) { - TQStyleControlElementData &ceData = *(const_cast(object)->controlElementDataObject()); - TQStyleControlElementDataPrivate* ceDataPrivate = const_cast(object)->controlElementDataPrivateObject(); - - // This is much faster than (ceData.widgetObjectTypes[0] != TQString(object->metaObject()->className())) due to TQString constructor/destructor overhead - // Casting to const also increases speed by preventing unneeded calls to detach() - if ((ceData.widgetObjectTypes.isEmpty()) || (strcmp(const_cast(ceData.widgetObjectTypes)[0].ascii(), object->metaObject()->className()) != 0)) { - determineObjectTypes(object, ceData, ceDataPrivate); - } -} - -TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, const TQStyleOption& opt, bool populateReliantFields) { - TQStyle::ControlElementFlags cef = TQStyle::CEF_None; - - if (object) { - TQStyleControlElementDataPrivate* ceDataPrivate = const_cast(object)->controlElementDataPrivateObject(); - updateObjectTypeListIfNeeded(object); - - if (ceDataPrivate->isTQPushButton) { - const TQPushButton *button = static_cast(object); - if (button) { - if (button->isDefault()) cef = cef | TQStyle::CEF_IsDefault; - if (button->autoDefault()) cef = cef | TQStyle::CEF_AutoDefault; - if (button->isMenuButton()) cef = cef | TQStyle::CEF_IsMenuWidget; - if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState; - if (button->isFlat()) cef = cef | TQStyle::CEF_IsFlat; - } - } - if (ceDataPrivate->isTQToolButton) { - const TQToolButton *button = static_cast(object); - if (button) { - if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState; - if (button->usesTextLabel()) cef = cef | TQStyle::CEF_UsesTextLabel; - if (button->usesBigPixmap()) cef = cef | TQStyle::CEF_UsesBigPixmap; - if (button->popup()) cef = cef | TQStyle::CEF_HasPopupMenu; - } - } - if (ceDataPrivate->isTQButton) { - const TQButton *button = static_cast(object); - if (button) { - if (button->isDown()) cef = cef | TQStyle::CEF_IsDown; - if (button->isOn()) cef = cef | TQStyle::CEF_IsOn; - if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState; - } - } - if (ceDataPrivate->isTQTabBar) { - const TQTabBar *tb = static_cast(object); - TQTab * t = opt.tab(); - if ((t) && (tb)) { - if (t->identifier() == tb->currentTab()) cef = cef | TQStyle::CEF_IsActive; - } - } - if (ceDataPrivate->isTQTitleBar) { - const TQTitleBar *tb = static_cast(object); - if (tb) { - if (tb->isActive()) cef = cef | TQStyle::CEF_IsActive; - } - } - if (ceDataPrivate->isTQToolBox) { - const TQToolBox *tb = static_cast(object); - if (tb) { - if (!tb->currentItem()) cef = cef | TQStyle::CEF_IsContainerEmpty; - } - } - if (ceDataPrivate->isTQProgressBar) { - const TQProgressBar *pb = static_cast(object); - if (pb) { - if (pb->centerIndicator()) cef = cef | TQStyle::CEF_CenterIndicator; - if (pb->indicatorFollowsStyle()) cef = cef | TQStyle::CEF_IndicatorFollowsStyle; - } - } - if (ceDataPrivate->isTQPopupMenu) { - const TQPopupMenu *pm = static_cast(object); - if (pm) { - if (pm->isCheckable()) cef = cef | TQStyle::CEF_IsCheckable; - } - } - if (ceDataPrivate->isTQComboBox) { - const TQComboBox *cb = static_cast(object); - if (cb) { - if (cb->editable()) cef = cef | TQStyle::CEF_IsEditable; - } - } - // Generic flags - if (ceDataPrivate->isTQWidget) { - const TQWidget* widget = static_cast(object); - if (widget) { - if (widget->isEnabled()) cef = cef | TQStyle::CEF_IsEnabled; - if (widget->parentWidget()) cef = cef | TQStyle::CEF_HasParentWidget; - if (widget->focusProxy()) cef = cef | TQStyle::CEF_HasFocusProxy; - if (widget->hasFocus()) cef = cef | TQStyle::CEF_HasFocus; - if (widget->hasMouse()) cef = cef | TQStyle::CEF_HasMouse; - if (populateReliantFields) { - if (widget->isActiveWindow()) cef = cef | TQStyle::CEF_IsActiveWindow; - if (widget->isTopLevel()) cef = cef | TQStyle::CEF_IsTopLevel; - if (widget->isVisible()) cef = cef | TQStyle::CEF_IsVisible; - if (widget->isShown()) cef = cef | TQStyle::CEF_IsShown; - } - } - } - } - else { - cef = cef | TQStyle::CEF_UseGenericParameters; - } - - return cef; -} - -const TQStyleControlElementData &populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields) { - return populateControlElementDataFromWidget(widget, opt, populateReliantFields, false); -} - -const TQStyleControlElementData &populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields, bool populateMinimumNumberOfFields) { - if (widget) { - TQStyleControlElementData &ceData = *(const_cast(widget)->controlElementDataObject()); - TQStyleControlElementDataPrivate* ceDataPrivate = const_cast(widget)->controlElementDataPrivateObject(); - - ceData.isNull = false; - updateObjectTypeListIfNeeded(widget); - - ceData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; - if (!populateMinimumNumberOfFields) { - const TQPixmap* erasePixmap = widget->backgroundPixmap(); - if (erasePixmap) { - ceData.bgPixmap = *erasePixmap; - } - if (populateReliantFields) { - ceData.bgBrush = widget->backgroundBrush(); - ceData.windowState = (TQt::WindowState)(widget->windowState()); - } - } - ceData.wflags = widget->getWFlags(); - if (!populateMinimumNumberOfFields) { - ceData.bgColor = widget->eraseColor(); - ceData.bgOffset = widget->backgroundOffset(); - ceData.backgroundMode = widget->backgroundMode(); - if (populateReliantFields) { - ceData.fgColor = widget->foregroundColor(); - ceData.colorGroup = widget->colorGroup(); - ceData.paletteBgColor = widget->paletteBackgroundColor(); - } - ceData.geometry = widget->geometry(); - ceData.rect = widget->rect(); - ceData.pos = widget->pos(); - const TQPixmap* icon = widget->icon(); - if (icon) { - ceData.icon = *icon; - } - ceData.palette = widget->palette(); - ceData.font = widget->font(); - } - ceData.name = widget->name(); - ceData.caption = widget->caption(); - if (!populateMinimumNumberOfFields) { - if (ceDataPrivate->isTQPushButton) { - const TQPushButton *button = static_cast(widget); - if (button) { - TQIconSet* iconSet = 0; - const TQPixmap* fgPixmap = 0; - iconSet = button->iconSet(); - fgPixmap = button->pixmap(); - if (iconSet) { - ceData.iconSet = *iconSet; - } - else { - ceData.iconSet = TQIconSet(); - } - if (fgPixmap) { - ceData.fgPixmap = *fgPixmap; - } - } - } - if (ceDataPrivate->isTQToolButton) { - const TQToolButton *button = static_cast(widget); - if (button) { - const TQPixmap* fgPixmap = 0; - ceData.iconSet = button->iconSet(); - fgPixmap = button->pixmap(); - if (fgPixmap) { - ceData.fgPixmap = *fgPixmap; - } - ceData.textLabel = button->textLabel(); - ceData.toolButtonTextPosition = button->textPosition(); - ceData.popupDelay = button->popupDelay(); - } - } - if (ceDataPrivate->isTQCheckBox) { - const TQCheckBox *button = static_cast(widget); - if (button) { - const TQPixmap* fgPixmap = 0; - fgPixmap = button->pixmap(); - if (fgPixmap) { - ceData.fgPixmap = *fgPixmap; - } - } - } - if (ceDataPrivate->isTQRadioButton) { - const TQRadioButton *button = static_cast(widget); - if (button) { - const TQPixmap* fgPixmap = 0; - fgPixmap = button->pixmap(); - if (fgPixmap) { - ceData.fgPixmap = *fgPixmap; - } - } - } - if (ceDataPrivate->isTQButton) { - const TQButton *button = static_cast(widget); - if (button) { - ceData.text = button->text(); - const TQPixmap* paletteBgPixmap = 0; - paletteBgPixmap = button->paletteBackgroundPixmap(); - if (paletteBgPixmap) { - ceData.paletteBgPixmap = *paletteBgPixmap; - } - } - } - if (ceDataPrivate->isTQTabBar) { - const TQTabBar *tb = static_cast(widget); - if (tb) { - ceData.tabBarData.tabCount = tb->count(); - ceData.tabBarData.currentTabIndex = tb->currentTab(); - ceData.tabBarData.shape = tb->shape(); - ceData.tabBarData.identIndexMap.clear(); - const TQTab* currentTab; - for (int i=0; icount(); ++i) { - currentTab = tb->tabAt(i); - if (currentTab) { - ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier()); - } - } - if ( tb->parent() ) { - updateObjectTypeListIfNeeded(tb->parent()); - if ((const_cast(tb->parent())->controlElementDataPrivateObject())->isTQTabWidget) { - const TQTabWidget *tw = static_cast(tb->parent()); - TQWidget *cw; - cw = tw->cornerWidget(TQt::TopLeft); - if (cw) { - updateObjectTypeListIfNeeded(cw); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].geometry = cw->geometry(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].rect = cw->rect(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].pos = cw->pos(); - } - cw = tw->cornerWidget(TQt::TopRight); - if (cw) { - updateObjectTypeListIfNeeded(cw); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].geometry = cw->geometry(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].rect = cw->rect(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].pos = cw->pos(); - } - cw = tw->cornerWidget(TQt::BottomLeft); - if (cw) { - updateObjectTypeListIfNeeded(cw); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].geometry = cw->geometry(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].rect = cw->rect(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].pos = cw->pos(); - } - cw = tw->cornerWidget(TQt::BottomRight); - if (cw) { - updateObjectTypeListIfNeeded(cw); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].geometry = cw->geometry(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].rect = cw->rect(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].pos = cw->pos(); - } - } - } - } - } - if (ceDataPrivate->isTQToolBox) { - const TQToolBox *tb = static_cast(widget); - if (tb) { - const TQWidget* currentItem = tb->currentItem(); - if (currentItem) { - ceData.activeItemPaletteBgColor = currentItem->paletteBackgroundColor(); - } - } - } - if (ceDataPrivate->isTQProgressBar) { - const TQProgressBar *pb = static_cast(widget); - if (pb) { - ceData.currentStep = pb->progress(); - ceData.totalSteps = pb->totalSteps(); - ceData.progressText = pb->progressString(); - ceData.percentageVisible = pb->percentageVisible(); - ceData.orientation = pb->orientation(); - } - } - if (ceDataPrivate->isTQHeader) { - const TQHeader *header = static_cast(widget); - if (header) { - int section = opt.headerSection(); - TQIconSet* iconSet = 0; - iconSet = header->iconSet(section); - ceData.textLabel = header->label(section); - if (iconSet) { - ceData.iconSet = *iconSet; - } - else { - ceData.iconSet = TQIconSet(); - } - } - } - // Complex Controls - if (ceDataPrivate->isTQScrollBar) { - const TQScrollBar *sb = static_cast(widget); - if (sb) { - ceData.orientation = sb->orientation(); - ceData.minSteps = sb->minValue(); - ceData.maxSteps = sb->maxValue(); - ceData.currentStep = sb->value(); - ceData.startStep = sb->sliderStart(); - ceData.lineStep = sb->lineStep(); - ceData.pageStep = sb->pageStep(); - if (populateReliantFields) { - ceData.sliderRect = sb->sliderRect(); - } - } - } - if (ceDataPrivate->isTQSlider) { - const TQSlider *sl = static_cast(widget); - if (sl) { - ceData.orientation = sl->orientation(); - ceData.minSteps = sl->minValue(); - ceData.maxSteps = sl->maxValue(); - ceData.tickMarkSetting = sl->tickmarks(); - ceData.tickInterval = sl->tickInterval(); - ceData.currentStep = sl->value(); - ceData.startStep = sl->sliderStart(); - ceData.lineStep = sl->lineStep(); - ceData.pageStep = sl->pageStep(); - if (populateReliantFields) { - ceData.sliderRect = sl->sliderRect(); - } - } - } - if (ceDataPrivate->isTQDialogButtons) { - const TQDialogButtons *dlgbtns = static_cast(widget); - if (dlgbtns) { - ceData.orientation = dlgbtns->orientation(); - ceData.dlgVisibleButtons = dlgbtns->visibleButtons(); - TQDialogButtons::Button btns[] = { TQDialogButtons::All, TQDialogButtons::Reject, TQDialogButtons::Accept, TQDialogButtons::Apply, TQDialogButtons::Retry, TQDialogButtons::Ignore, TQDialogButtons::Abort, TQDialogButtons::Help }; - for(unsigned int i = 0; i < (sizeof(btns)/sizeof(btns[0])); i++) { - if (ceData.dlgVisibleButtons & btns[i]) { - ceData.dlgVisibleSizeHints[btns[i]] = dlgbtns->sizeHint(btns[i]); - } - } - - } - } - if (ceDataPrivate->isTQTitleBar) { - const TQTitleBar *tb = static_cast(widget); - if (tb) { - ceData.titleBarData.hasWindow = !!(tb->window()); - if (populateReliantFields) { - if (ceData.titleBarData.hasWindow) { - ceData.titleBarData.windowState = (TQt::WindowState)(tb->window()->windowState()); - } - ceData.titleBarData.usesActiveColor = tb->usesActiveColor(); - } - ceData.titleBarData.visibleText = tb->visibleText(); - } - } - if (ceDataPrivate->isTQSpinWidget) { - const TQSpinWidget *sw = static_cast(widget); - if (sw) { - ceData.spinWidgetData.buttonSymbols = sw->buttonSymbols(); - ceData.spinWidgetData.upRect = sw->upRect(); - ceData.spinWidgetData.downRect = sw->downRect(); - ceData.spinWidgetData.upEnabled = sw->isUpEnabled(); - ceData.spinWidgetData.downEnabled = sw->isDownEnabled(); - } - } - if (ceDataPrivate->isTQListView) { - const TQListView *lv = static_cast(widget); - if (lv) { - ceData.listViewData.rootDecorated = lv->rootIsDecorated(); - ceData.listViewData.itemMargin = lv->itemMargin(); - TQWidget* viewport = lv->viewport(); - if (viewport) { - updateObjectTypeListIfNeeded(viewport); - ceData.viewportData.widgetObjectTypes = (const_cast(viewport)->controlElementDataObject())->widgetObjectTypes; - ceData.viewportData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; - const TQPixmap* erasePixmap = viewport->backgroundPixmap(); - if (erasePixmap) { - ceData.viewportData.bgPixmap = *erasePixmap; - } - if (populateReliantFields) { - ceData.viewportData.bgBrush = viewport->backgroundBrush(); - } - if (populateReliantFields) { - ceData.viewportData.windowState = (TQt::WindowState)(widget->windowState()); - } - ceData.viewportData.wflags = viewport->getWFlags(); - ceData.viewportData.bgColor = viewport->eraseColor(); - ceData.viewportData.bgOffset = viewport->backgroundOffset(); - ceData.viewportData.backgroundMode = viewport->backgroundMode(); - if (populateReliantFields) { - ceData.viewportData.fgColor = viewport->foregroundColor(); - ceData.viewportData.colorGroup = viewport->colorGroup(); - ceData.viewportData.paletteBgColor = viewport->paletteBackgroundColor(); - } - ceData.viewportData.geometry = viewport->geometry(); - ceData.viewportData.rect = viewport->rect(); - ceData.viewportData.pos = viewport->pos(); - const TQPixmap* icon = viewport->icon(); - if (icon) { - ceData.viewportData.icon = *icon; - } - ceData.viewportData.palette = viewport->palette(); - ceData.viewportData.font = viewport->font(); - ceData.viewportData.name = viewport->name(); - ceData.viewportData.caption = viewport->caption(); - } - } - } - if (ceDataPrivate->isTQComboBox) { - const TQComboBox *cb = static_cast(widget); - if (cb) { - const TQLineEdit* lineEdit = cb->lineEdit(); - if (lineEdit) { - ceData.comboBoxLineEditFlags = getControlElementFlagsForObject(lineEdit, TQStyleOption::Default); - } - const TQListBox* listBox = cb->listBox(); - if (listBox) { - ceData.comboBoxListBoxFlags = getControlElementFlagsForObject(listBox, TQStyleOption::Default); - } - } - } - if (ceDataPrivate->isTQFrame) { - const TQFrame *frame = static_cast(widget); - if (frame) { - ceData.frameStyle = frame->frameStyle(); - } - } - - const TQWidget* parentWidget = widget->parentWidget(); - if (parentWidget) { - updateObjectTypeListIfNeeded(parentWidget); - ceData.parentWidgetData.widgetObjectTypes = (const_cast(parentWidget)->controlElementDataObject())->widgetObjectTypes; - TQStyleControlElementDataPrivate* parentWidgetCEDataPrivate = const_cast(parentWidget)->controlElementDataPrivateObject(); - ceData.parentWidgetData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; - const TQPixmap* erasePixmap = parentWidget->backgroundPixmap(); - if (erasePixmap) { - ceData.parentWidgetData.bgPixmap = *erasePixmap; - } - if (populateReliantFields) { - ceData.parentWidgetData.bgBrush = parentWidget->backgroundBrush(); - } - if (populateReliantFields) { - ceData.parentWidgetData.windowState = (TQt::WindowState)(widget->windowState()); - } - ceData.parentWidgetData.wflags = parentWidget->getWFlags(); - ceData.parentWidgetData.bgColor = parentWidget->eraseColor(); - ceData.parentWidgetData.bgOffset = parentWidget->backgroundOffset(); - ceData.parentWidgetData.backgroundMode = parentWidget->backgroundMode(); - if (populateReliantFields) { - ceData.parentWidgetData.fgColor = parentWidget->foregroundColor(); - ceData.parentWidgetData.colorGroup = parentWidget->colorGroup(); - ceData.parentWidgetData.paletteBgColor = parentWidget->paletteBackgroundColor(); - } - ceData.parentWidgetData.geometry = parentWidget->geometry(); - ceData.parentWidgetData.rect = parentWidget->rect(); - ceData.parentWidgetData.pos = parentWidget->pos(); - const TQPixmap* icon = parentWidget->icon(); - if (icon) { - ceData.parentWidgetData.icon = *icon; - } - ceData.parentWidgetData.palette = parentWidget->palette(); - ceData.parentWidgetData.font = parentWidget->font(); - ceData.parentWidgetData.name = parentWidget->name(); - ceData.parentWidgetData.caption = parentWidget->caption(); - - if (parentWidgetCEDataPrivate->isTQDockWindow) { - const TQDockWindow * dw = static_cast(parentWidget); - if (dw->area()) { - ceData.dwData.hasDockArea = true; - ceData.dwData.areaOrientation = dw->area()->orientation(); - } - else { - ceData.dwData.hasDockArea = false; - } - ceData.dwData.closeEnabled = dw->isCloseEnabled(); - } - if (parentWidgetCEDataPrivate->isTQToolBar) { - const TQToolBar * toolbar = static_cast(parentWidget); - ceData.toolBarData.orientation = toolbar->orientation(); - } - ceData.parentWidgetFlags = getControlElementFlagsForObject(parentWidget, TQStyleOption::Default, populateReliantFields); - } - const TQWidget* topLevelWidget = widget->topLevelWidget(); - if (topLevelWidget) { - updateObjectTypeListIfNeeded(topLevelWidget); - ceData.topLevelWidgetData.widgetObjectTypes = (const_cast(topLevelWidget)->controlElementDataObject())->widgetObjectTypes; - TQStyleControlElementDataPrivate* topLevelWidgetCEDataPrivate = const_cast(topLevelWidget)->controlElementDataPrivateObject(); - ceData.topLevelWidgetData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; - const TQPixmap* erasePixmap = topLevelWidget->backgroundPixmap(); - if (erasePixmap) { - ceData.topLevelWidgetData.bgPixmap = *erasePixmap; - } - if (populateReliantFields) { - ceData.topLevelWidgetData.bgBrush = topLevelWidget->backgroundBrush(); - } - if (populateReliantFields) { - ceData.topLevelWidgetData.windowState = (TQt::WindowState)(widget->windowState()); - } - ceData.topLevelWidgetData.wflags = topLevelWidget->getWFlags(); - ceData.topLevelWidgetData.bgColor = topLevelWidget->eraseColor(); - ceData.topLevelWidgetData.bgOffset = topLevelWidget->backgroundOffset(); - ceData.topLevelWidgetData.backgroundMode = topLevelWidget->backgroundMode(); - if (populateReliantFields) { - ceData.topLevelWidgetData.fgColor = topLevelWidget->foregroundColor(); - ceData.topLevelWidgetData.colorGroup = topLevelWidget->colorGroup(); - ceData.topLevelWidgetData.paletteBgColor = topLevelWidget->paletteBackgroundColor(); - } - ceData.topLevelWidgetData.geometry = topLevelWidget->geometry(); - ceData.topLevelWidgetData.rect = topLevelWidget->rect(); - ceData.topLevelWidgetData.pos = topLevelWidget->pos(); - const TQPixmap* icon = topLevelWidget->icon(); - if (icon) { - ceData.topLevelWidgetData.icon = *icon; - } - ceData.topLevelWidgetData.palette = topLevelWidget->palette(); - ceData.topLevelWidgetData.font = topLevelWidget->font(); - ceData.topLevelWidgetData.name = topLevelWidget->name(); - ceData.topLevelWidgetData.caption = topLevelWidget->caption(); - - if (topLevelWidgetCEDataPrivate->isTQDockWindow) { - const TQDockWindow * dw = static_cast(topLevelWidget); - if (dw->area()) { - ceData.dwData.hasDockArea = true; - ceData.dwData.areaOrientation = dw->area()->orientation(); - } - else { - ceData.dwData.hasDockArea = false; - } - ceData.dwData.closeEnabled = dw->isCloseEnabled(); - } - if (topLevelWidgetCEDataPrivate->isTQToolBar) { - const TQToolBar * toolbar = static_cast(topLevelWidget); - ceData.toolBarData.orientation = toolbar->orientation(); - } - ceData.topLevelWidgetFlags = getControlElementFlagsForObject(topLevelWidget, TQStyleOption::Default, populateReliantFields); - } - - TQCheckListItem *item = opt.checkListItem(); - if (item) { - ceData.checkListItemData.dataValid = true; - ceData.checkListItemData.enabled = item->isEnabled(); - ceData.checkListItemData.hasParent = ( item->parent() && (item->parent()->rtti() == 1) && (((TQCheckListItem*) item->parent())->type() == TQCheckListItem::Controller) ); - ceData.checkListItemData.height = item->height(); - } - else { - ceData.checkListItemData.dataValid = false; - } - } - - return ceData; - } - else { - if (!TQStyleControlElementData_null) { - TQStyleControlElementData_null = new TQStyleControlElementData(); - tqAddPostRoutine(tqt_style_control_element_data_null_cleanup); - } - TQStyleControlElementData &ceData = *TQStyleControlElementData_null; - return ceData; - } -} - -const TQStyleControlElementData &populateControlElementDataFromApplication(const TQApplication* app, const TQStyleOption&, bool) { - TQStyleControlElementData &ceData = *(const_cast(app)->controlElementDataObject()); - - if (app) { - updateObjectTypeListIfNeeded(app); - ceData.widgetObjectTypes = (const_cast(app)->controlElementDataObject())->widgetObjectTypes; - ceData.palette = app->palette(); - ceData.font = app->font(); - } - - return ceData; -} - -/*! \reimp */ -void TQCommonStyle::drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt ) const -{ - activePainter = p; - - switch (pe) { -#ifndef TQT_NO_LISTVIEW - case PE_CheckListController: { - p->drawPixmap(r, TQPixmap((const char **)check_list_controller_xpm)); - break; } - case PE_CheckListExclusiveIndicator: { - if(!ceData.checkListItemData.dataValid) - return; - int x = r.x(), y = r.y(); -#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2) - static const TQCOORD pts1[] = { // dark lines - 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; - static const TQCOORD pts2[] = { // black lines - 2,8, 1,7, 1,4, 2,3, 2,2, 3,2, 4,1, 7,1, 8,2, 9,2 }; - static const TQCOORD pts3[] = { // background lines - 2,9, 3,9, 4,10, 7,10, 8,9, 9,9, 9,8, 10,7, 10,4, 9,3 }; - static const TQCOORD pts4[] = { // white lines - 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, - 11,4, 10,3, 10,2 }; - // static const TQCOORD pts5[] = { // inner fill - // 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; - //TQPointArray a; - // p->eraseRect( x, y, w, h ); - - if ( flags & Style_Enabled ) - p->setPen( cg.text() ); - else - p->setPen( TQPen( ceData.palette.color( TQPalette::Disabled, TQColorGroup::Text ) ) ); - TQPointArray a( TQCOORDARRLEN(pts1), pts1 ); - a.translate( x, y ); - //p->setPen( cg.dark() ); - p->drawPolyline( a ); - a.setPoints( TQCOORDARRLEN(pts2), pts2 ); - a.translate( x, y ); - p->drawPolyline( a ); - a.setPoints( TQCOORDARRLEN(pts3), pts3 ); - a.translate( x, y ); - // p->setPen( black ); - p->drawPolyline( a ); - a.setPoints( TQCOORDARRLEN(pts4), pts4 ); - a.translate( x, y ); - // p->setPen( blue ); - p->drawPolyline( a ); - // a.setPoints( TQCOORDARRLEN(pts5), pts5 ); - // a.translate( x, y ); - // TQColor fillColor = isDown() ? g.background() : g.base(); - // p->setPen( fillColor ); - // p->setBrush( fillColor ); - // p->drawPolygon( a ); - if ( flags & Style_On ) { - p->setPen( NoPen ); - p->setBrush( cg.text() ); - p->drawRect( x+5, y+4, 2, 4 ); - p->drawRect( x+4, y+5, 4, 2 ); - } - break; } - case PE_CheckListIndicator: { - if(!ceData.checkListItemData.dataValid) - return; - int x = r.x(), y = r.y(), w = r.width(), h = r.width(), marg = ceData.listViewData.itemMargin; - - if ( flags & Style_Enabled ) - p->setPen( TQPen( cg.text(), 2 ) ); - else - p->setPen( TQPen( ceData.palette.color( TQPalette::Disabled, TQColorGroup::Text ), - 2 ) ); - if ( flags & Style_Selected && !ceData.listViewData.rootDecorated && !ceData.checkListItemData.hasParent ) { - p->fillRect( 0, 0, x + marg + w + 4, ceData.checkListItemData.height, - cg.brush( TQColorGroup::Highlight ) ); - if ( ceData.checkListItemData.enabled ) - p->setPen( TQPen( cg.highlightedText(), 2 ) ); - } - - if ( flags & Style_NoChange ) - p->setBrush( cg.brush( TQColorGroup::Button ) ); - p->drawRect( x+marg, y+2, w-4, h-4 ); - ///////////////////// - x++; - y++; - if ( ( flags & Style_On) || ( flags & Style_NoChange ) ) { - TQPointArray a( 7*2 ); - int i, xx = x+1+marg, yy=y+5; - for ( i=0; i<3; i++ ) { - a.setPoint( 2*i, xx, yy ); - a.setPoint( 2*i+1, xx, yy+2 ); - xx++; yy++; - } - yy -= 2; - for ( i=3; i<7; i++ ) { - a.setPoint( 2*i, xx, yy ); - a.setPoint( 2*i+1, xx, yy+2 ); - xx++; yy--; - } - p->drawLineSegments( a ); - } - break; } -#endif - case PE_HeaderArrow: - p->save(); - if ( flags & Style_Down ) { - TQPointArray pa( 3 ); - p->setPen( cg.light() ); - p->drawLine( r.x() + r.width(), r.y(), r.x() + r.width() / 2, r.height() ); - p->setPen( cg.dark() ); - pa.setPoint( 0, r.x() + r.width() / 2, r.height() ); - pa.setPoint( 1, r.x(), r.y() ); - pa.setPoint( 2, r.x() + r.width(), r.y() ); - p->drawPolyline( pa ); - } else { - TQPointArray pa( 3 ); - p->setPen( cg.light() ); - pa.setPoint( 0, r.x(), r.height() ); - pa.setPoint( 1, r.x() + r.width(), r.height() ); - pa.setPoint( 2, r.x() + r.width() / 2, r.y() ); - p->drawPolyline( pa ); - p->setPen( cg.dark() ); - p->drawLine( r.x(), r.height(), r.x() + r.width() / 2, r.y() ); - } - p->restore(); - break; - - case PE_StatusBarSection: - qDrawShadeRect( p, r, cg, TRUE, 1, 0, 0 ); - break; - - case PE_ButtonCommand: - case PE_ButtonBevel: - case PE_ButtonTool: - case PE_ButtonDropDown: - case PE_HeaderSection: - case PE_HeaderSectionMenu: - qDrawShadePanel(p, r, cg, flags & (Style_Sunken | Style_Down | Style_On) , 1, - &cg.brush(TQColorGroup::Button)); - break; - - case PE_Separator: - qDrawShadeLine( p, r.left(), r.top(), r.right(), r.bottom(), cg, - flags & Style_Sunken, 1, 0); - break; - - case PE_FocusRect: { - const TQColor *bg = 0; - - if (!opt.isDefault()) - bg = &opt.color(); - - TQPen oldPen = p->pen(); - - if (bg) { - int h, s, v; - bg->hsv(&h, &s, &v); - if (v >= 128) - p->setPen(TQt::black); - else - p->setPen(TQt::white); - } else - p->setPen(cg.foreground()); - - if (flags & Style_FocusAtBorder) - p->drawRect(TQRect(r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2)); - else - p->drawRect(r); - - p->setPen(oldPen); - break; } - - case PE_SpinWidgetPlus: - case PE_SpinWidgetMinus: { - p->save(); - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, 0 ); - TQRect br; - br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, - r.height() - fw*2 ); - - p->fillRect( br, cg.brush( TQColorGroup::Button ) ); - p->setPen( cg.buttonText() ); - p->setBrush( cg.buttonText() ); - - int length; - int x = r.x(), y = r.y(), w = r.width(), h = r.height(); - if ( w <= 8 || h <= 6 ) - length = TQMIN( w-2, h-2 ); - else - length = TQMIN( 2*w / 3, 2*h / 3 ); - - if ( !(length & 1) ) - length -=1; - int xmarg = ( w - length ) / 2; - int ymarg = ( h - length ) / 2; - - p->drawLine( x + xmarg, ( y + h / 2 - 1 ), - x + xmarg + length - 1, ( y + h / 2 - 1 ) ); - if ( pe == PE_SpinWidgetPlus ) - p->drawLine( ( x+w / 2 ) - 1, y + ymarg, - ( x+w / 2 ) - 1, y + ymarg + length - 1 ); - p->restore(); - break; } - - case PE_SpinWidgetUp: - case PE_SpinWidgetDown: { - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, 0 ); - TQRect br; - br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, - r.height() - fw*2 ); - p->fillRect( br, cg.brush( TQColorGroup::Button ) ); - int x = r.x(), y = r.y(), w = r.width(), h = r.height(); - int sw = w-4; - if ( sw < 3 ) - break; - else if ( !(sw & 1) ) - sw--; - sw -= ( sw / 7 ) * 2; // Empty border - int sh = sw/2 + 2; // Must have empty row at foot of arrow - - int sx = x + w / 2 - sw / 2 - 1; - int sy = y + h / 2 - sh / 2 - 1; - - TQPointArray a; - if ( pe == PE_SpinWidgetDown ) - a.setPoints( 3, 0, 1, sw-1, 1, sh-2, sh-1 ); - else - a.setPoints( 3, 0, sh-1, sw-1, sh-1, sh-2, 1 ); - int bsx = 0; - int bsy = 0; - if ( flags & Style_Sunken ) { - bsx = pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags); - bsy = pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags); - } - p->save(); - p->translate( sx + bsx, sy + bsy ); - p->setPen( cg.buttonText() ); - p->setBrush( cg.buttonText() ); - p->drawPolygon( a ); - p->restore(); - break; } - - case PE_Indicator: { - if (flags & Style_NoChange) { - p->setPen(cg.foreground()); - p->fillRect(r, cg.brush(TQColorGroup::Button)); - p->drawRect(r); - p->drawLine(r.topLeft(), r.bottomRight()); - } else - qDrawShadePanel(p, r.x(), r.y(), r.width(), r.height(), - cg, flags & (Style_Sunken | Style_On), 1, - &cg.brush(TQColorGroup::Button)); - break; } - - case PE_IndicatorMask: { - p->fillRect(r, color1); - break; } - - case PE_ExclusiveIndicator: { - TQRect ir = r; - p->setPen(cg.dark()); - p->drawArc(r, 0, 5760); - - if (flags & (Style_Sunken | Style_On)) { - ir.addCoords(2, 2, -2, -2); - p->setBrush(cg.foreground()); - p->drawEllipse(ir); - } - - break; } - - case PE_ExclusiveIndicatorMask: { - p->setPen(color1); - p->setBrush(color1); - p->drawEllipse(r); - break; } - - case PE_DockWindowHandle: { - bool highlight = flags & Style_On; - - p->save(); - p->translate( r.x(), r.y() ); - if ( flags & Style_Horizontal ) { - int x = r.width() / 3; - if ( r.height() > 4 ) { - qDrawShadePanel( p, x, 2, 3, r.height() - 4, - cg, highlight, 1, 0 ); - qDrawShadePanel( p, x+3, 2, 3, r.height() - 4, - cg, highlight, 1, 0 ); - } - } else { - if ( r.width() > 4 ) { - int y = r.height() / 3; - qDrawShadePanel( p, 2, y, r.width() - 4, 3, - cg, highlight, 1, 0 ); - qDrawShadePanel( p, 2, y+3, r.width() - 4, 3, - cg, highlight, 1, 0 ); - } - } - p->restore(); - break; - } - - case PE_DockWindowSeparator: { - TQPoint p1, p2; - if ( flags & Style_Horizontal ) { - p1 = TQPoint( r.width()/2, 0 ); - p2 = TQPoint( p1.x(), r.height() ); - } else { - p1 = TQPoint( 0, r.height()/2 ); - p2 = TQPoint( r.width(), p1.y() ); - } - qDrawShadeLine( p, p1, p2, cg, 1, 1, 0 ); - break; } - - case PE_Panel: - case PE_PanelPopup: { - int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) - : opt.lineWidth(); - - qDrawShadePanel(p, r, cg, (flags & Style_Sunken), lw); - break; } - - case PE_PanelDockWindow: { - int lw = opt.isDefault() ? pixelMetric(PM_DockWindowFrameWidth, ceData, elementFlags) - : opt.lineWidth(); - - qDrawShadePanel(p, r, cg, FALSE, lw); - break; } - - case PE_PanelMenuBar: { - int lw = opt.isDefault() ? pixelMetric(PM_MenuBarFrameWidth, ceData, elementFlags) - : opt.lineWidth(); - - qDrawShadePanel(p, r, cg, FALSE, lw, &cg.brush(TQColorGroup::Button)); - break; } - - case PE_SizeGrip: { - p->save(); - - int x, y, w, h; - r.rect(&x, &y, &w, &h); - - int sw = TQMIN( h,w ); - if ( h > w ) - p->translate( 0, h - w ); - else - p->translate( w - h, 0 ); - - int sx = x; - int sy = y; - int s = sw / 3; - - if ( TQApplication::reverseLayout() ) { - sx = x + sw; - for ( int i = 0; i < 4; ++i ) { - p->setPen( TQPen( cg.light(), 1 ) ); - p->drawLine( x, sy - 1 , sx + 1, sw ); - p->setPen( TQPen( cg.dark(), 1 ) ); - p->drawLine( x, sy, sx, sw ); - p->setPen( TQPen( cg.dark(), 1 ) ); - p->drawLine( x, sy + 1, sx - 1, sw ); - sx -= s; - sy += s; - } - } else { - for ( int i = 0; i < 4; ++i ) { - p->setPen( TQPen( cg.light(), 1 ) ); - p->drawLine( sx-1, sw, sw, sy-1 ); - p->setPen( TQPen( cg.dark(), 1 ) ); - p->drawLine( sx, sw, sw, sy ); - p->setPen( TQPen( cg.dark(), 1 ) ); - p->drawLine( sx+1, sw, sw, sy+1 ); - sx += s; - sy += s; - } - } - - p->restore(); - break; } - - case PE_CheckMark: { - const int markW = r.width() > 7 ? 7 : r.width(); - const int markH = markW; - int posX = r.x() + ( r.width() - markW )/2 + 1; - int posY = r.y() + ( r.height() - markH )/2; - - // Could do with some optimizing/caching... - TQPointArray a( markH*2 ); - int i, xx, yy; - xx = posX; - yy = 3 + posY; - for ( i=0; isetPen( cg.highlightedText() ); - TQPoint offset(1,1); - for ( pnt = 0; pnt < (int)a.size(); pnt++ ) - a[pnt] += offset; - p->drawLineSegments( a ); - for ( pnt = 0; pnt < (int)a.size(); pnt++ ) - a[pnt] -= offset; - } - p->setPen( cg.text() ); - p->drawLineSegments( a ); - break; } - - case PE_PanelGroupBox: //We really do not need PE_GroupBoxFrame anymore, nasty holdover ### - drawPrimitive( PE_GroupBoxFrame, p, ceData, elementFlags, r, cg, flags, opt ); - break; - case PE_GroupBoxFrame: { -#ifndef TQT_NO_FRAME - if ( opt.isDefault() ) - break; - int lwidth = opt.lineWidth(), mlwidth = opt.midLineWidth(); - if ( flags & (Style_Sunken|Style_Raised)) - qDrawShadeRect( p, r.x(), r.y(), r.width(), r.height(), cg, flags & Style_Sunken, lwidth, mlwidth ); - else - qDrawPlainRect( p, r.x(), r.y(), r.width(), r.height(), cg.foreground(), lwidth ); -#endif - break; } - - case PE_ProgressBarChunk: - p->fillRect( r.x(), r.y() + 3, r.width() -2, r.height() - 6, - cg.brush(TQColorGroup::Highlight)); - break; - - case PE_PanelLineEdit: - case PE_PanelTabWidget: - case PE_WindowFrame: - drawPrimitive( PE_Panel, p, ceData, elementFlags, r, cg, flags, opt ); - break; - - case PE_RubberBand: - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, r, cg, flags, opt); - break; - default: - break; - } - - activePainter = 0; -} - -void qt_style_erase_region(TQPainter* p, const TQRegion& region, const TQStyleControlElementData &ceData) { - TQRegion reg = region; - - TQPoint offset = ceData.bgOffset; - int ox = offset.x(); - int oy = offset.y(); - - TQRegion origcr = p->clipRegion(); - p->setClipRegion(region); - if (!ceData.bgPixmap.isNull()) { - p->drawTiledPixmap(0, 0, ceData.geometry.width(), ceData.geometry.height(), ceData.bgPixmap, ox, oy); - } - else { - p->fillRect(ceData.rect, ceData.bgColor); - } - p->setClipRegion(origcr); - return; -} - -/*! \reimp */ -void TQCommonStyle::drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - activePainter = p; - - switch (element) { - case CE_MenuBarEmptyArea: { - TQRegion reg; - if(p->hasClipping()) //ick - reg = p->clipRegion(); - else - reg = r; - qt_style_erase_region(p, reg, ceData); - break; } - case CE_PushButton: - { -#ifndef TQT_NO_PUSHBUTTON - TQRect br = r; - int dbi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); - - if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { - if (elementFlags & CEF_IsDefault) { - drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, br, cg, flags); - } - - br.setCoords(br.left() + dbi, - br.top() + dbi, - br.right() - dbi, - br.bottom() - dbi); - } - - p->save(); - p->setBrushOrigin( -ceData.bgOffset.x(), - -ceData.bgOffset.y() ); - drawPrimitive(PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags); - p->restore(); -#endif - break; - } - - case CE_PushButtonLabel: - { -#ifndef TQT_NO_PUSHBUTTON - TQRect ir = r; - - if ((elementFlags & CEF_IsDown) || (elementFlags & CEF_IsOn)) { - flags |= Style_Sunken; - ir.moveBy(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), - pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget)); - } - - if (elementFlags & CEF_IsMenuWidget) { - int mbi = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags, widget); - TQRect ar(ir.right() - mbi, ir.y() + 2, mbi - 4, ir.height() - 4); - drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags, opt); - ir.setWidth(ir.width() - mbi); - } - - int tf=AlignVCenter | ShowPrefix; - if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) - tf |= NoAccel; - -#ifndef TQT_NO_ICONSET - if ( !ceData.iconSet.isNull() ) { - TQIconSet::Mode mode = - (elementFlags & CEF_IsEnabled) ? TQIconSet::Normal : TQIconSet::Disabled; - if ( mode == TQIconSet::Normal && (elementFlags & CEF_HasFocus) ) - mode = TQIconSet::Active; - - TQIconSet::State state = TQIconSet::Off; - if ( (elementFlags & CEF_BiState) && (elementFlags & CEF_IsOn) ) - state = TQIconSet::On; - - TQPixmap pixmap = ceData.iconSet.pixmap( TQIconSet::Small, mode, state ); - int pixw = pixmap.width(); - int pixh = pixmap.height(); - - //Center the icon if there is neither text nor pixmap - if ( ceData.text.isEmpty() && ceData.fgPixmap.isNull() ) - p->drawPixmap( ir.x() + ir.width() / 2 - pixw / 2, ir.y() + ir.height() / 2 - pixh / 2, pixmap ); - else - p->drawPixmap( ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2, pixmap ); - - ir.moveBy(pixw + 4, 0); - ir.setWidth(ir.width() - (pixw + 4)); - // left-align text if there is - if (!ceData.text.isEmpty()) - tf |= AlignLeft; - else if (!ceData.fgPixmap.isNull()) - tf |= AlignHCenter; - } else -#endif //TQT_NO_ICONSET - tf |= AlignHCenter; - drawItem(p, ir, tf, cg, - flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, - ceData.text.length(), &(cg.buttonText()) ); - - if (flags & Style_HasFocus) - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), - cg, flags); -#endif - break; - } - - case CE_CheckBox: - drawPrimitive(PE_Indicator, p, ceData, elementFlags, r, cg, flags, opt); - break; - - case CE_CheckBoxLabel: - { -#ifndef TQT_NO_CHECKBOX - int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; - if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) - alignment |= NoAccel; - - drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, - flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text); - - if (flags & Style_HasFocus) { - TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags); - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); - } -#endif - break; - } - - case CE_RadioButton: - drawPrimitive(PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, flags, opt); - break; - - case CE_RadioButtonLabel: - { -#ifndef TQT_NO_RADIOBUTTON - int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; - if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) - alignment |= NoAccel; - drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, - flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text); - - if (flags & Style_HasFocus) { - TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags); - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); - } -#endif - break; - } - -#ifndef TQT_NO_TABBAR - case CE_TabBarTab: - { - if ( ceData.tabBarData.shape == TQTabBar::TriangularAbove || - ceData.tabBarData.shape == TQTabBar::TriangularBelow ) { - // triangular, above or below - int y; - int x; - TQPointArray a( 10 ); - a.setPoint( 0, 0, -1 ); - a.setPoint( 1, 0, 0 ); - y = r.height()-2; - x = y/3; - a.setPoint( 2, x++, y-1 ); - a.setPoint( 3, x++, y ); - a.setPoint( 3, x++, y++ ); - a.setPoint( 4, x, y ); - - int i; - int right = r.width() - 1; - for ( i = 0; i < 5; i++ ) - a.setPoint( 9-i, right - a.point( i ).x(), a.point( i ).y() ); - - if ( ceData.tabBarData.shape == TQTabBar::TriangularAbove ) - for ( i = 0; i < 10; i++ ) - a.setPoint( i, a.point(i).x(), - r.height() - 1 - a.point( i ).y() ); - - a.translate( r.left(), r.top() ); - - if ( flags & Style_Selected ) - p->setBrush( cg.base() ); - else - p->setBrush( cg.background() ); - p->setPen( cg.foreground() ); - p->drawPolygon( a ); - p->setBrush( NoBrush ); - } - break; - } - - case CE_TabBarLabel: - { - if ( opt.isDefault() ) - break; - - TQTab * t = opt.tab(); - - TQRect tr = r; - if (elementFlags & CEF_IsActive) - tr.setBottom( tr.bottom() - - pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, widget ) ); - - int alignment = AlignCenter | ShowPrefix; - if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) - alignment |= NoAccel; - drawItem( p, tr, alignment, cg, - flags & Style_Enabled, 0, t->text() ); - - if ( (flags & Style_HasFocus) && !t->text().isEmpty() ) - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, r, cg ); - break; - } -#endif // TQT_NO_TABBAR -#ifndef TQT_NO_TOOLBOX - case CE_ToolBoxTab: - { - int d = 20 + r.height() - 3; - TQPointArray a( 7 ); - a.setPoint( 0, -1, r.height() + 1 ); - a.setPoint( 1, -1, 1 ); - a.setPoint( 2, r.width() - d, 1 ); - a.setPoint( 3, r.width() - 20, r.height() - 2 ); - a.setPoint( 4, r.width() - 1, r.height() - 2 ); - a.setPoint( 5, r.width() - 1, r.height() + 1 ); - a.setPoint( 6, -1, r.height() + 1 ); - - if ( flags & Style_Selected && !(elementFlags & CEF_IsContainerEmpty) ) - p->setBrush( ceData.activeItemPaletteBgColor ); - else - p->setBrush( cg.brush(TQColorGroup::Background) ); - - p->setPen( cg.mid().dark( 150 ) ); - p->drawPolygon( a ); - p->setPen( cg.light() ); - p->drawLine( 0, 2, r.width() - d, 2 ); - p->drawLine( r.width() - d - 1, 2, r.width() - 21, r.height() - 1 ); - p->drawLine( r.width() - 20, r.height() - 1, r.width(), r.height() - 1 ); - p->setBrush( NoBrush ); - break; - } -#endif // TQT_NO_TOOLBOX - case CE_ProgressBarGroove: - qDrawShadePanel(p, r, cg, TRUE, 1, &cg.brush(TQColorGroup::Background)); - break; - -#ifndef TQT_NO_PROGRESSBAR - case CE_ProgressBarContents: - { - // Correct the highlight color if same as background, - // or else we cannot see the progress... - TQColorGroup cgh = cg; - if ( cgh.highlight() == cgh.background() ) - cgh.setColor( TQColorGroup::Highlight, ceData.palette.active().highlight() ); - bool reverse = TQApplication::reverseLayout(); - int fw = 2; - int w = r.width() - 2*fw; - if ( !ceData.totalSteps ) { - // draw busy indicator - int x = ceData.currentStep % (w * 2); - if (x > w) - x = 2 * w - x; - x = reverse ? r.right() - x : x + r.x(); - p->setPen( TQPen(cgh.highlight(), 4) ); - p->drawLine(x, r.y() + 1, x, r.height() - fw); - } else { - const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, ceData, elementFlags, widget); - int u; - if ( unit_width > 1 ) - u = (r.width()+unit_width/3) / unit_width; - else - u = w / unit_width; - int p_v = ceData.currentStep; - int t_s = ceData.totalSteps ? ceData.totalSteps : 1; - - if ( u > 0 && p_v >= INT_MAX / u && t_s >= u ) { - // scale down to something usable. - p_v /= u; - t_s /= u; - } - - // nu < tnu, if last chunk is only a partial chunk - int tnu, nu; - tnu = nu = p_v * u / t_s; - - if (nu * unit_width > w) - nu--; - - // Draw nu units out of a possible u of unit_width - // width, each a rectangle bordered by background - // color, all in a sunken panel with a percentage text - // display at the end. - int x = 0; - int x0 = reverse ? r.right() - ((unit_width > 1) ? - unit_width : fw) : r.x() + fw; - for (int i=0; i= ceData.totalSteps ) - pcolor = &penColor; - drawItem(p, r, AlignCenter | SingleLine, cg, flags & Style_Enabled, 0, - ceData.progressText, -1, pcolor ); - } - break; -#endif // TQT_NO_PROGRESSBAR - - case CE_MenuBarItem: - { -#ifndef TQT_NO_MENUDATA - if (opt.isDefault()) - break; - - TQMenuItem *mi = opt.menuItem(); - int alignment = AlignCenter|ShowPrefix|DontClip|SingleLine; - if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) - alignment |= NoAccel; - drawItem( p, r, alignment, cg, - flags & Style_Enabled, mi->pixmap(), mi->text(), -1, - &cg.buttonText() ); -#endif - break; - } - -#ifndef TQT_NO_TOOLBUTTON - case CE_ToolButtonLabel: - { - TQRect rect = r; - TQt::ArrowType arrowType = opt.isDefault() - ? TQt::DownArrow : opt.arrowType(); - - int shiftX = 0; - int shiftY = 0; - if (flags & (Style_Down | Style_On)) { - shiftX = pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget); - shiftY = pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget); - } - - if (!opt.isDefault()) { - PrimitiveElement pe; - switch (arrowType) { - case TQt::LeftArrow: pe = PE_ArrowLeft; break; - case TQt::RightArrow: pe = PE_ArrowRight; break; - case TQt::UpArrow: pe = PE_ArrowUp; break; - default: - case TQt::DownArrow: pe = PE_ArrowDown; break; - } - - rect.moveBy(shiftX, shiftY); - drawPrimitive(pe, p, ceData, elementFlags, rect, cg, flags, opt); - } else { - TQColor btext = ceData.fgColor; - - if (ceData.iconSet.isNull() && - ! ceData.text.isNull() && - ! (elementFlags & CEF_UsesTextLabel)) { - int alignment = AlignCenter | ShowPrefix; - if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) - alignment |= NoAccel; - - rect.moveBy(shiftX, shiftY); - drawItem(p, rect, alignment, cg, - flags & Style_Enabled, 0, ceData.text, - ceData.text.length(), &btext); - } else { - TQPixmap pm; - TQIconSet::Size size = - (elementFlags & CEF_UsesBigPixmap) ? TQIconSet::Large : TQIconSet::Small; - TQIconSet::State state = - (elementFlags & CEF_IsOn) ? TQIconSet::On : TQIconSet::Off; - TQIconSet::Mode mode; - if (! (elementFlags & CEF_IsEnabled)) - mode = TQIconSet::Disabled; - else if (flags & (Style_Down | Style_On) || - ((flags & Style_Raised) && (flags & Style_AutoRaise))) - mode = TQIconSet::Active; - else - mode = TQIconSet::Normal; - pm = ceData.iconSet.pixmap( size, mode, state ); - - if (elementFlags & CEF_UsesTextLabel) { - p->setFont( ceData.font ); - TQRect pr = rect, tr = rect; - int alignment = ShowPrefix; - if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) - alignment |= NoAccel; - - if ( ceData.toolButtonTextPosition == TQToolButton::Under ) { - int fh = p->fontMetrics().height(); - pr.addCoords( 0, 1, 0, -fh-3 ); - tr.addCoords( 0, pr.bottom(), 0, -3 ); - pr.moveBy(shiftX, shiftY); - drawItem( p, pr, AlignCenter, cg, TRUE, &pm, TQString::null ); - alignment |= AlignCenter; - } else { - pr.setWidth( pm.width() + 8 ); - tr.addCoords( pr.right(), 0, 0, 0 ); - pr.moveBy(shiftX, shiftY); - - drawItem( p, pr, AlignCenter, cg, TRUE, &pm, TQString::null ); - alignment |= AlignLeft | AlignVCenter; - } - - tr.moveBy(shiftX, shiftY); - drawItem( p, tr, alignment, cg, - flags & Style_Enabled, 0, ceData.textLabel, - ceData.textLabel.length(), &btext); - } else { - rect.moveBy(shiftX, shiftY); - drawItem( p, rect, AlignCenter, cg, TRUE, &pm, TQString::null ); - } - } - } - - break; - } -#endif // TQT_NO_TOOLBUTTON -#ifndef TQT_NO_HEADER - case CE_HeaderLabel: - { - TQRect rect = r; - - const TQIconSet* icon = &ceData.iconSet; - if ( icon ) { - TQPixmap pixmap = icon->pixmap( TQIconSet::Small, - flags & Style_Enabled ? - TQIconSet::Normal : TQIconSet::Disabled ); - int pixw = pixmap.width(); - int pixh = pixmap.height(); - // "pixh - 1" because of tricky integer division - - TQRect pixRect = rect; - pixRect.setY( rect.center().y() - (pixh - 1) / 2 ); - drawItem ( p, pixRect, AlignVCenter, cg, flags & Style_Enabled, - &pixmap, TQString::null ); - if (TQApplication::reverseLayout()) - rect.setRight(rect.right() - pixw - 2); - else - rect.setLeft(rect.left() + pixw + 2); - } - - if (rect.isValid()) - drawItem ( p, rect, AlignVCenter, cg, flags & Style_Enabled, - 0, ceData.textLabel, -1, &(cg.buttonText()) ); - } -#endif // TQT_NO_HEADER - default: - break; - } - - activePainter = 0; -} - -/*! \reimp */ -void TQCommonStyle::drawControlMask( ControlElement control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - Q_UNUSED(ceData); - Q_UNUSED(elementFlags); - Q_UNUSED(widget); - - activePainter = p; - - TQColorGroup cg(color1,color1,color1,color1,color1,color1,color1,color1,color0); - - switch (control) { - case CE_PushButton: - drawPrimitive(PE_ButtonCommand, p, ceData, elementFlags, r, cg, Style_Default, opt); - break; - - case CE_CheckBox: - drawPrimitive(PE_IndicatorMask, p, ceData, elementFlags, r, cg, Style_Default, opt); - break; - - case CE_RadioButton: - drawPrimitive(PE_ExclusiveIndicatorMask, p, ceData, elementFlags, r, cg, Style_Default, opt); - break; - - default: - p->fillRect(r, color1); - break; - } - - activePainter = 0; -} - -/*! \reimp */ -TQRect TQCommonStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const -{ - TQRect rect, wrect(ceData.rect); - - switch (r) { -#ifndef TQT_NO_DIALOGBUTTONS - case SR_DialogButtonAbort: - case SR_DialogButtonRetry: - case SR_DialogButtonIgnore: - case SR_DialogButtonAccept: - case SR_DialogButtonReject: - case SR_DialogButtonApply: - case SR_DialogButtonHelp: - case SR_DialogButtonAll: - case SR_DialogButtonCustom: { - TQDialogButtons::Button srch = TQDialogButtons::None; - if(r == SR_DialogButtonAccept) - srch = TQDialogButtons::Accept; - else if(r == SR_DialogButtonReject) - srch = TQDialogButtons::Reject; - else if(r == SR_DialogButtonAll) - srch = TQDialogButtons::All; - else if(r == SR_DialogButtonApply) - srch = TQDialogButtons::Apply; - else if(r == SR_DialogButtonHelp) - srch = TQDialogButtons::Help; - else if(r == SR_DialogButtonRetry) - srch = TQDialogButtons::Retry; - else if(r == SR_DialogButtonIgnore) - srch = TQDialogButtons::Ignore; - else if(r == SR_DialogButtonAbort) - srch = TQDialogButtons::Abort; - - const int bwidth = pixelMetric(PM_DialogButtonsButtonWidth, ceData, elementFlags, widget), - bheight = pixelMetric(PM_DialogButtonsButtonHeight, ceData, elementFlags, widget), - bspace = pixelMetric(PM_DialogButtonsSeparator, ceData, elementFlags, widget), - fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget); - int start = fw; - if(ceData.orientation == Horizontal) - start = wrect.right() - fw; - TQDialogButtons::Button btns[] = { TQDialogButtons::All, TQDialogButtons::Reject, TQDialogButtons::Accept, //reverse order (right to left) - TQDialogButtons::Apply, TQDialogButtons::Retry, TQDialogButtons::Ignore, TQDialogButtons::Abort, - TQDialogButtons::Help }; - for(unsigned int i = 0, cnt = 0; i < (sizeof(btns)/sizeof(btns[0])); i++) { - if (ceData.dlgVisibleButtons & btns[i]) { - TQSize szH = ceData.dlgVisibleSizeHints[btns[i]]; - int mwidth = TQMAX(bwidth, szH.width()), mheight = TQMAX(bheight, szH.height()); - if(ceData.orientation == Horizontal) { - start -= mwidth; - if(cnt) - start -= bspace; - } else if(cnt) { - start += mheight; - start += bspace; - } - cnt++; - if(btns[i] == srch) { - if(ceData.orientation == Horizontal) - return TQRect(start, wrect.bottom() - fw - mheight, mwidth, mheight); - else - return TQRect(fw, start, mwidth, mheight); - } - } - } - if(r == SR_DialogButtonCustom) { - if(ceData.orientation == Horizontal) - return TQRect(fw, fw, start - fw - bspace, wrect.height() - (fw*2)); - else - return TQRect(fw, start, wrect.width() - (fw*2), wrect.height() - start - (fw*2)); - } - return TQRect(); } -#endif //TQT_NO_DIALOGBUTTONS - case SR_PushButtonContents: - { -#ifndef TQT_NO_PUSHBUTTON - int dx1, dx2; - - dx1 = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget); - if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) - dx1 += pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); - dx2 = dx1 * 2; - - rect.setRect(wrect.x() + dx1, - wrect.y() + dx1, - wrect.width() - dx2, - wrect.height() - dx2); -#endif - break; - } - - case SR_PushButtonFocusRect: - { -#ifndef TQT_NO_PUSHBUTTON - int dbw1 = 0, dbw2 = 0; - if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { - dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); - dbw2 = dbw1 * 2; - } - - int dfw1 = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2, - dfw2 = dfw1 * 2; - - rect.setRect(wrect.x() + dfw1 + dbw1, - wrect.y() + dfw1 + dbw1, - wrect.width() - dfw2 - dbw2, - wrect.height() - dfw2 - dbw2); -#endif - break; - } - - case SR_CheckBoxIndicator: - { - int h = pixelMetric( PM_IndicatorHeight, ceData, elementFlags, widget ); - rect.setRect(0, ( wrect.height() - h ) / 2, - pixelMetric( PM_IndicatorWidth, ceData, elementFlags, widget ), h ); - break; - } - - case SR_CheckBoxContents: - { -#ifndef TQT_NO_CHECKBOX - TQRect ir = subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget); - rect.setRect(ir.right() + 6, wrect.y(), - wrect.width() - ir.width() - 6, wrect.height()); -#endif - break; - } - - case SR_CheckBoxFocusRect: - { -#ifndef TQT_NO_CHECKBOX - if ( ceData.fgPixmap.isNull() && ceData.text.isEmpty() ) { - rect = subRect( SR_CheckBoxIndicator, ceData, elementFlags, widget ); - rect.addCoords( 1, 1, -1, -1 ); - break; - } - TQRect cr = subRect(SR_CheckBoxContents, ceData, elementFlags, widget); - - // don't create a painter if we have an active one - TQPainter *p = 0; - if (! activePainter) - p = new TQPainter(widget); - rect = itemRect((activePainter ? activePainter : p), - cr, AlignLeft | AlignVCenter | ShowPrefix, - (elementFlags & CEF_IsEnabled), - (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, - ceData.text); - - delete p; - - rect.addCoords( -3, -2, 3, 2 ); - rect = rect.intersect(wrect); -#endif - break; - } - - case SR_RadioButtonIndicator: - { - int h = pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags, widget ); - rect.setRect(0, ( wrect.height() - h ) / 2, - pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags, widget ), h ); - break; - } - - case SR_RadioButtonContents: - { - TQRect ir = subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget); - rect.setRect(ir.right() + 6, wrect.y(), - wrect.width() - ir.width() - 6, wrect.height()); - break; - } - - case SR_RadioButtonFocusRect: - { -#ifndef TQT_NO_RADIOBUTTON - if ( ceData.fgPixmap.isNull() && ceData.text.isEmpty() ) { - rect = subRect( SR_RadioButtonIndicator, ceData, elementFlags, widget ); - rect.addCoords( 1, 1, -1, -1 ); - break; - } - TQRect cr = subRect(SR_RadioButtonContents, ceData, elementFlags, widget); - - // don't create a painter if we have an active one - TQPainter *p = 0; - if (! activePainter) - p = new TQPainter(widget); - rect = itemRect((activePainter ? activePainter : p), - cr, AlignLeft | AlignVCenter | ShowPrefix, - (elementFlags & CEF_IsEnabled), - (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, - ceData.text); - delete p; - - rect.addCoords( -3, -2, 3, 2 ); - rect = rect.intersect(wrect); -#endif - break; - } - - case SR_ComboBoxFocusRect: - rect.setRect(3, 3, ceData.rect.width()-6-16, ceData.rect.height()-6); - break; - -#ifndef TQT_NO_SLIDER - case SR_SliderFocusRect: - { - int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); - - if ( ceData.orientation == Horizontal ) - rect.setRect( 0, tickOffset-1, ceData.rect.width(), thickness+2 ); - else - rect.setRect( tickOffset-1, 0, thickness+2, ceData.rect.height() ); - rect = rect.intersect( ceData.rect ); // ## is this really necessary? - break; - } -#endif // TQT_NO_SLIDER - -#ifndef TQT_NO_MAINWINDOW - case SR_DockWindowHandleRect: - { - if (!(elementFlags & CEF_HasParentWidget)) - break; - - if ( !ceData.dwData.hasDockArea || !ceData.dwData.closeEnabled ) - rect.setRect( 0, 0, ceData.rect.width(), ceData.rect.height() ); - else { - if ( ceData.dwData.areaOrientation == Horizontal ) - rect.setRect(0, 15, ceData.rect.width(), ceData.rect.height() - 15); - else - rect.setRect(0, 1, ceData.rect.width() - 15, ceData.rect.height() - 1); - } - break; - } -#endif // TQT_NO_MAINWINDOW - - case SR_ProgressBarGroove: - case SR_ProgressBarContents: - { -#ifndef TQT_NO_PROGRESSBAR - TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) : - TQApplication::fontMetrics() ) ); - int textw = 0; - if (ceData.percentageVisible) - textw = fm.width("100%") + 6; - - if ((elementFlags & CEF_IndicatorFollowsStyle) || - ! (elementFlags & CEF_CenterIndicator)) - rect.setCoords(wrect.left(), wrect.top(), - wrect.right() - textw, wrect.bottom()); - else - rect = wrect; -#endif - break; - } - - case SR_ProgressBarLabel: - { -#ifndef TQT_NO_PROGRESSBAR - TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) : - TQApplication::fontMetrics() ) ); - int textw = 0; - if (ceData.percentageVisible) - textw = fm.width("100%") + 6; - - if ((elementFlags & CEF_IndicatorFollowsStyle) || - ! (elementFlags & CEF_CenterIndicator)) - rect.setCoords(wrect.right() - textw, wrect.top(), - wrect.right(), wrect.bottom()); - else - rect = wrect; -#endif - break; - } - - case SR_ToolButtonContents: - rect = querySubControlMetrics(CC_ToolButton, ceData, elementFlags, SC_ToolButton, TQStyleOption::Default, widget); - break; - - case SR_ToolBoxTabContents: - rect = wrect; - rect.addCoords( 0, 0, -30, 0 ); - break; - - default: - rect = wrect; - break; - } - - return rect; -} - -#ifndef TQT_NO_RANGECONTROL -/* - I really need this and I don't want to expose it in TQRangeControl.. -*/ -static int qPositionFromValue( const TQStyleControlElementData &ceData, int logical_val, - int span ) -{ - if ( span <= 0 || logical_val < ceData.minSteps || - ceData.maxSteps <= ceData.minSteps ) - return 0; - if ( logical_val > ceData.maxSteps ) - return span; - - uint range = ceData.maxSteps - ceData.minSteps; - uint p = logical_val - ceData.minSteps; - - if ( range > (uint)INT_MAX/4096 ) { - const int scale = 4096*2; - return ( (p/scale) * span ) / (range/scale); - // ### the above line is probably not 100% correct - // ### but fixing it isn't worth the extreme pain... - } else if ( range > (uint)span ) { - return (2*p*span + range) / (2*range); - } else { - uint div = span / range; - uint mod = span % range; - return p*div + (2*p*mod + range) / (2*range); - } - //equiv. to (p*span)/range + 0.5 - // no overflow because of this implicit assumption: - // span <= 4096 -} -#endif // TQT_NO_RANGECONTROL - -/*! \reimp */ -void TQCommonStyle::drawComplexControl( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - SCFlags controls, - SCFlags active, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - activePainter = p; - - switch (control) { -#ifndef TQT_NO_SCROLLBAR - case CC_ScrollBar: - { - TQRect addline, subline, addpage, subpage, slider, first, last; - bool maxedOut = (ceData.minSteps == ceData.maxSteps); - - subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget); - addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget); - subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget); - addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget); - slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget); - first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget); - last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget); - - if ((controls & SC_ScrollBarSubLine) && subline.isValid()) - drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarSubLine) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : 0)); - if ((controls & SC_ScrollBarAddLine) && addline.isValid()) - drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarAddLine) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : 0)); - if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) - drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarSubPage) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : 0)); - if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) - drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarAddPage) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : 0)); - if ((controls & SC_ScrollBarFirst) && first.isValid()) - drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarFirst) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : 0)); - if ((controls & SC_ScrollBarLast) && last.isValid()) - drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarLast) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : 0)); - if ((controls & SC_ScrollBarSlider) && slider.isValid()) { - drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarSlider) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : 0)); - - // ### perhaps this should not be able to accept focus if maxedOut? - if (elementFlags & CEF_HasFocus) { - TQRect fr(slider.x() + 2, slider.y() + 2, - slider.width() - 5, slider.height() - 5); - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default); - } - } - - break; - } -#endif // TQT_NO_SCROLLBAR - -#ifndef TQT_NO_TOOLBUTTON - case CC_ToolButton: - { - TQColorGroup c = cg; - if ( ceData.backgroundMode != PaletteButton ) - c.setBrush( TQColorGroup::Button, - ceData.bgColor ); - TQRect button, menuarea; - button = visualRect( querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget), ceData, elementFlags ); - menuarea = visualRect( querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget), ceData, elementFlags ); - - SFlags bflags = flags, - mflags = flags; - - if (active & SC_ToolButton) - bflags |= Style_Down; - if (active & SC_ToolButtonMenu) - mflags |= Style_Down; - - if (controls & SC_ToolButton) { - if (bflags & (Style_Down | Style_On | Style_Raised)) { - drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, c, bflags, opt); - } else if ( (elementFlags & CEF_HasParentWidget) && - ! ceData.parentWidgetData.bgPixmap.isNull() ) { - TQPixmap pixmap = - ceData.parentWidgetData.bgPixmap; - - p->drawTiledPixmap( r, pixmap, ceData.pos ); - } - } - - if (controls & SC_ToolButtonMenu) { - if (mflags & (Style_Down | Style_On | Style_Raised)) - drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, c, mflags, opt); - drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, c, mflags, opt); - } - - if ((elementFlags & CEF_HasFocus) && !(elementFlags & CEF_HasFocusProxy)) { - TQRect fr = ceData.rect; - fr.addCoords(3, 3, -3, -3); - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, c); - } - - break; - } -#endif // TQT_NO_TOOLBUTTON - -#ifndef TQT_NO_TITLEBAR - case CC_TitleBar: - { - if ( controls & SC_TitleBarLabel ) { - TQColorGroup cgroup = (ceData.titleBarData.usesActiveColor) ? - ceData.palette.active() : ceData.palette.inactive(); - - TQColor left = cgroup.highlight(); - TQColor right = cgroup.base(); - - if ( left != right ) { - double rS = left.red(); - double gS = left.green(); - double bS = left.blue(); - - const double rD = double(right.red() - rS) / ceData.rect.width(); - const double gD = double(right.green() - gS) / ceData.rect.width(); - const double bD = double(right.blue() - bS) / ceData.rect.width(); - - const int w = ceData.rect.width(); - for ( int sx = 0; sx < w; sx++ ) { - rS+=rD; - gS+=gD; - bS+=bD; - p->setPen( TQColor( (int)rS, (int)gS, (int)bS ) ); - p->drawLine( sx, 0, sx, ceData.rect.height() ); - } - } else { - p->fillRect( ceData.rect, left ); - } - - TQRect ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarLabel, TQStyleOption::Default, widget ), ceData, elementFlags ); - - p->setPen( cgroup.highlightedText() ); - p->drawText(ir.x()+2, ir.y(), ir.width()-2, ir.height(), - AlignAuto | AlignVCenter | SingleLine, ceData.titleBarData.visibleText ); - } - - TQRect ir; - bool down = FALSE; - TQPixmap pm; - - if ( controls & SC_TitleBarCloseButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarCloseButton, TQStyleOption::Default, widget ), ceData, elementFlags ); - down = active & SC_TitleBarCloseButton; - if ( widget->testWFlags( WStyle_Tool ) -#ifndef TQT_NO_MAINWINDOW - || ::tqt_cast(widget) -#endif - ) - pm = stylePixmap(SP_DockWindowCloseButton, ceData, elementFlags, TQStyleOption::Default, widget); - else - pm = stylePixmap(SP_TitleBarCloseButton, ceData, elementFlags, TQStyleOption::Default, widget); - drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, - down ? Style_Down : Style_Raised); - - p->save(); - if( down ) - p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), - pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); - drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); - p->restore(); - } - - if ( ceData.titleBarData.hasWindow ) { - if ( controls & SC_TitleBarMaxButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarMaxButton, TQStyleOption::Default, widget ), ceData, elementFlags ); - - down = active & SC_TitleBarMaxButton; - pm = TQPixmap(stylePixmap(SP_TitleBarMaxButton, ceData, elementFlags, TQStyleOption::Default, widget)); - drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, - down ? Style_Down : Style_Raised); - - p->save(); - if( down ) - p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), - pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); - drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); - p->restore(); - } - - if ( controls & SC_TitleBarNormalButton || controls & SC_TitleBarMinButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarMinButton, TQStyleOption::Default, widget ), ceData, elementFlags ); - TQStyle::SubControl ctrl = (controls & SC_TitleBarNormalButton ? - SC_TitleBarNormalButton : - SC_TitleBarMinButton); - TQStyle::StylePixmap spixmap = (controls & SC_TitleBarNormalButton ? - SP_TitleBarNormalButton : - SP_TitleBarMinButton); - down = active & ctrl; - pm = TQPixmap(stylePixmap(spixmap, ceData, elementFlags, TQStyleOption::Default, widget)); - drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, - down ? Style_Down : Style_Raised); - - p->save(); - if( down ) - p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), - pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); - drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); - p->restore(); - } - - if ( controls & SC_TitleBarShadeButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarShadeButton, TQStyleOption::Default, widget ), ceData, elementFlags ); - - down = active & SC_TitleBarShadeButton; - pm = TQPixmap(stylePixmap(SP_TitleBarShadeButton, ceData, elementFlags, TQStyleOption::Default, widget)); - drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, - down ? Style_Down : Style_Raised); - p->save(); - if( down ) - p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), - pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); - drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); - p->restore(); - } - - if ( controls & SC_TitleBarUnshadeButton ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarUnshadeButton, TQStyleOption::Default, widget ), ceData, elementFlags ); - - down = active & SC_TitleBarUnshadeButton; - pm = TQPixmap(stylePixmap(SP_TitleBarUnshadeButton, ceData, elementFlags, TQStyleOption::Default, widget)); - drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, - down ? Style_Down : Style_Raised); - p->save(); - if( down ) - p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), - pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); - drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); - p->restore(); - } - } -#ifndef TQT_NO_WIDGET_TOPEXTRA - if ( controls & SC_TitleBarSysMenu ) { - if ( !ceData.icon.isNull() ) { - ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarSysMenu, TQStyleOption::Default, widget ), ceData, elementFlags ); - drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, (ceData.icon.isNull())?NULL:&ceData.icon, TQString::null ); - } - } -#endif - break; - } -#endif //TQT_NO_TITLEBAR - - case CC_SpinWidget: { -#ifndef TQT_NO_SPINWIDGET - SFlags flags; - PrimitiveElement pe; - - if ( controls & SC_SpinWidgetFrame ) - qDrawWinPanel( p, r, cg, TRUE ); //cstyle == Sunken ); - - if ( controls & SC_SpinWidgetUp ) { - flags = Style_Default | Style_Enabled; - if (active == SC_SpinWidgetUp ) { - flags |= Style_On; - flags |= Style_Sunken; - } else - flags |= Style_Raised; - if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus ) - pe = PE_SpinWidgetPlus; - else - pe = PE_SpinWidgetUp; - - TQRect re = ceData.spinWidgetData.upRect; - TQColorGroup ucg = ceData.spinWidgetData.upEnabled ? cg : ceData.palette.disabled(); - drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, re, ucg, flags); - drawPrimitive(pe, p, ceData, elementFlags, re, ucg, flags); - } - - if ( controls & SC_SpinWidgetDown ) { - flags = Style_Default | Style_Enabled; - if (active == SC_SpinWidgetDown ) { - flags |= Style_On; - flags |= Style_Sunken; - } else - flags |= Style_Raised; - if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus ) - pe = PE_SpinWidgetMinus; - else - pe = PE_SpinWidgetDown; - - TQRect re = ceData.spinWidgetData.downRect; - TQColorGroup dcg = ceData.spinWidgetData.downEnabled ? cg : ceData.palette.disabled(); - drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, re, dcg, flags); - drawPrimitive(pe, p, ceData, elementFlags, re, dcg, flags); - } -#endif - break; } - -#ifndef TQT_NO_SLIDER - case CC_Slider: - switch ( controls ) { - case SC_SliderTickmarks: { - int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); - int ticks = ceData.tickMarkSetting; - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); - int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); - int available = pixelMetric( PM_SliderSpaceAvailable, ceData, elementFlags, widget ); - int interval = ceData.tickInterval; - - if ( interval <= 0 ) { - interval = ceData.lineStep; - if ( qPositionFromValue( ceData, interval, available ) - - qPositionFromValue( ceData, 0, available ) < 3 ) - interval = ceData.pageStep; - } - - int fudge = len / 2; - int pos; - - if ( ticks & TQSlider::Above ) { - p->setPen( cg.foreground() ); - int v = ceData.minSteps; - if ( !interval ) - interval = 1; - while ( v <= ceData.maxSteps + 1 ) { - pos = qPositionFromValue( ceData, v, available ) + fudge; - if ( ceData.orientation == Horizontal ) - p->drawLine( pos, 0, pos, tickOffset-2 ); - else - p->drawLine( 0, pos, tickOffset-2, pos ); - v += interval; - } - } - - if ( ticks & TQSlider::Below ) { - p->setPen( cg.foreground() ); - int v = ceData.minSteps; - if ( !interval ) - interval = 1; - while ( v <= ceData.maxSteps + 1 ) { - pos = qPositionFromValue( ceData, v, available ) + fudge; - if ( ceData.orientation == Horizontal ) - p->drawLine( pos, tickOffset+thickness+1, pos, - tickOffset+thickness+1 + available-2 ); - else - p->drawLine( tickOffset+thickness+1, pos, - tickOffset+thickness+1 + available-2, - pos ); - v += interval; - } - - } - - break; } - } - break; -#endif // TQT_NO_SLIDER -#ifndef TQT_NO_LISTVIEW - case CC_ListView: - if ( controls & SC_ListView ) { - p->fillRect( r, ceData.viewportData.bgBrush ); - } - break; -#endif //TQT_NO_LISTVIEW - default: - break; - } - - activePainter = 0; -} - -/*! \reimp */ -void TQCommonStyle::drawComplexControlMask( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - const ControlElementFlags elementFlags, - const TQRect &r, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - Q_UNUSED(control); - Q_UNUSED(ceData); - Q_UNUSED(elementFlags); - Q_UNUSED(widget); - Q_UNUSED(opt); - - p->fillRect(r, color1); -} - -/*! \reimp */ -TQRect TQCommonStyle::querySubControlMetrics( ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sc, - const TQStyleOption &opt, - const TQWidget *widget ) const -{ - switch ( control ) { - case CC_SpinWidget: { - int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, widget); - TQSize bs; - bs.setHeight( ceData.rect.height()/2 - fw ); - if ( bs.height() < 8 ) - bs.setHeight( 8 ); - bs.setWidth( TQMIN( bs.height() * 8 / 5, ceData.rect.width() / 4 ) ); // 1.6 -approximate golden mean - bs = bs.expandedTo( TQApplication::globalStrut() ); - int y = fw; - int x, lx, rx; - x = ceData.rect.width() - y - bs.width(); - lx = fw; - rx = x - fw; - switch ( sc ) { - case SC_SpinWidgetUp: - return TQRect(x, y, bs.width(), bs.height()); - case SC_SpinWidgetDown: - return TQRect(x, y + bs.height(), bs.width(), bs.height()); - case SC_SpinWidgetButtonField: - return TQRect(x, y, bs.width(), ceData.rect.height() - 2*fw); - case SC_SpinWidgetEditField: - return TQRect(lx, fw, rx, ceData.rect.height() - 2*fw); - case SC_SpinWidgetFrame: - return ceData.rect; - default: - break; - } - break; } - - case CC_ComboBox: { - int x = 0, y = 0, wi = ceData.rect.width(), he = ceData.rect.height(); - int xpos = x; - xpos += wi - 2 - 16; - - switch ( sc ) { - case SC_ComboBoxFrame: - return ceData.rect; - case SC_ComboBoxArrow: - return TQRect(xpos, y+2, 16, he-4); - case SC_ComboBoxEditField: - return TQRect(x+3, y+3, wi-6-16, he-6); - case SC_ComboBoxListBoxPopup: - return opt.rect(); - default: - break; - } - break; } - -#ifndef TQT_NO_SCROLLBAR - case CC_ScrollBar: { - int sliderstart = 0; - int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); - int maxlen = ((ceData.orientation == TQt::Horizontal) ? - ceData.rect.width() : ceData.rect.height()) - (sbextent * 2); - int sliderlen; - - sliderstart = ceData.startStep; - - // calculate slider length - if (ceData.maxSteps != ceData.minSteps) { - uint range = ceData.maxSteps - ceData.minSteps; - sliderlen = (TQ_LLONG(ceData.pageStep) * maxlen) / (range + ceData.pageStep); - - int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget ); - if ( sliderlen < slidermin || range > INT_MAX / 2 ) - sliderlen = slidermin; - if ( sliderlen > maxlen ) - sliderlen = maxlen; - } else - sliderlen = maxlen; - - switch (sc) { - case SC_ScrollBarSubLine: // top/left button - if (ceData.orientation == TQt::Horizontal) { - int buttonWidth = TQMIN(ceData.rect.width()/2, sbextent); - return TQRect( 0, 0, buttonWidth, sbextent ); - } else { - int buttonHeight = TQMIN(ceData.rect.height()/2, sbextent); - return TQRect( 0, 0, sbextent, buttonHeight ); - } - - case SC_ScrollBarAddLine: // bottom/right button - if (ceData.orientation == TQt::Horizontal) { - int buttonWidth = TQMIN(ceData.rect.width()/2, sbextent); - return TQRect( ceData.rect.width() - buttonWidth, 0, buttonWidth, sbextent ); - } else { - int buttonHeight = TQMIN(ceData.rect.height()/2, sbextent); - return TQRect( 0, ceData.rect.height() - buttonHeight, sbextent, buttonHeight ); - } - - case SC_ScrollBarSubPage: // between top/left button and slider - if (ceData.orientation == TQt::Horizontal) - return TQRect(sbextent, 0, sliderstart - sbextent, sbextent); - return TQRect(0, sbextent, sbextent, sliderstart - sbextent); - - case SC_ScrollBarAddPage: // between bottom/right button and slider - if (ceData.orientation == TQt::Horizontal) - return TQRect(sliderstart + sliderlen, 0, - maxlen - sliderstart - sliderlen + sbextent, sbextent); - return TQRect(0, sliderstart + sliderlen, - sbextent, maxlen - sliderstart - sliderlen + sbextent); - - case SC_ScrollBarGroove: - if (ceData.orientation == TQt::Horizontal) - return TQRect(sbextent, 0, ceData.rect.width() - sbextent * 2, - ceData.rect.height()); - return TQRect(0, sbextent, ceData.rect.width(), - ceData.rect.height() - sbextent * 2); - - case SC_ScrollBarSlider: - if (ceData.orientation == TQt::Horizontal) - return TQRect(sliderstart, 0, sliderlen, sbextent); - return TQRect(0, sliderstart, sbextent, sliderlen); - - default: break; - } - - break; } -#endif // TQT_NO_SCROLLBAR - -#ifndef TQT_NO_SLIDER - case CC_Slider: { - int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); - - switch ( sc ) { - case SC_SliderHandle: { - int sliderPos = 0; - int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); - - sliderPos = ceData.startStep; - - if ( ceData.orientation == Horizontal ) - return TQRect( sliderPos, tickOffset, len, thickness ); - return TQRect( tickOffset, sliderPos, thickness, len ); } - case SC_SliderGroove: { - if ( ceData.orientation == Horizontal ) - return TQRect( 0, tickOffset, ceData.rect.width(), thickness ); - return TQRect( tickOffset, 0, thickness, ceData.rect.height() ); } - - default: - break; - } - break; } -#endif // TQT_NO_SLIDER - -#if !defined(TQT_NO_TOOLBUTTON) && !defined(TQT_NO_POPUPMENU) - case CC_ToolButton: { - int mbi = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags, widget); - - TQRect rect = ceData.rect; - switch (sc) { - case SC_ToolButton: - if ((elementFlags & CEF_HasPopupMenu) && ! ceData.popupDelay) - rect.addCoords(0, 0, -mbi, 0); - return rect; - - case SC_ToolButtonMenu: - if ((elementFlags & CEF_HasPopupMenu) && ! ceData.popupDelay) - rect.addCoords(rect.width() - mbi, 0, 0, 0); - return rect; - - default: break; - } - break; - } -#endif // TQT_NO_TOOLBUTTON && TQT_NO_POPUPMENU - -#ifndef TQT_NO_TITLEBAR - case CC_TitleBar: { - const int controlTop = 2; - const int controlHeight = ceData.rect.height() - controlTop * 2; - - switch (sc) { - case SC_TitleBarLabel: { - TQRect ir( 0, 0, ceData.rect.width(), ceData.rect.height() ); - if ( ceData.wflags & WStyle_Tool ) { - if ( ceData.wflags & WStyle_SysMenu ) - ir.addCoords( 0, 0, -controlHeight-3, 0 ); - if ( ceData.wflags & WStyle_MinMax ) - ir.addCoords( 0, 0, -controlHeight-2, 0 ); - } else { - if ( ceData.wflags & WStyle_SysMenu ) - ir.addCoords( controlHeight+3, 0, -controlHeight-3, 0 ); - if ( ceData.wflags & WStyle_Minimize ) - ir.addCoords( 0, 0, -controlHeight-2, 0 ); - if ( ceData.wflags & WStyle_Maximize ) - ir.addCoords( 0, 0, -controlHeight-2, 0 ); - } - return ir; } - - case SC_TitleBarCloseButton: - return TQRect( ceData.rect.width() - ( controlHeight + controlTop ), - controlTop, controlHeight, controlHeight ); - - case SC_TitleBarMaxButton: - case SC_TitleBarShadeButton: - case SC_TitleBarUnshadeButton: - return TQRect( ceData.rect.width() - ( ( controlHeight + controlTop ) * 2 ), - controlTop, controlHeight, controlHeight ); - - case SC_TitleBarMinButton: - case SC_TitleBarNormalButton: { - int offset = controlHeight + controlTop; - if ( !( ceData.wflags & WStyle_Maximize ) ) - offset *= 2; - else - offset *= 3; - return TQRect( ceData.rect.width() - offset, controlTop, controlHeight, controlHeight ); - } - - case SC_TitleBarSysMenu: - return TQRect( 3, controlTop, controlHeight, controlHeight); - - default: break; - } - break; } -#endif //TQT_NO_TITLEBAR - - default: - break; - } - return TQRect(); -} - -/*! \reimp */ -TQStyle::SubControl TQCommonStyle::querySubControl(ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQPoint &pos, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - SubControl ret = SC_None; - - switch (control) { -#ifndef TQT_NO_LISTVIEW - case CC_ListView: - { - if(pos.x() >= 0 && pos.x() < - opt.listViewItem()->listView()->treeStepSize()) - ret = SC_ListViewExpand; - break; - } -#endif -#ifndef TQT_NO_SCROLLBAR - case CC_ScrollBar: - { - TQRect r; - uint ctrl = SC_ScrollBarAddLine; - - // we can do this because subcontrols were designed to be masks as well... - while (ret == SC_None && ctrl <= SC_ScrollBarGroove) { - r = querySubControlMetrics(control, ceData, elementFlags, - (TQStyle::SubControl) ctrl, opt, widget); - if (r.isValid() && r.contains(pos)) - ret = (TQStyle::SubControl) ctrl; - - ctrl <<= 1; - } - - break; - } -#endif - case CC_TitleBar: - { -#ifndef TQT_NO_TITLEBAR - TQRect r; - uint ctrl = SC_TitleBarLabel; - - // we can do this because subcontrols were designed to be masks as well... - while (ret == SC_None && ctrl <= SC_TitleBarUnshadeButton) { - r = visualRect( querySubControlMetrics( control, ceData, elementFlags, (TQStyle::SubControl) ctrl, opt, widget ), ceData, elementFlags ); - if (r.isValid() && r.contains(pos)) - ret = (TQStyle::SubControl) ctrl; - - ctrl <<= 1; - } - if ( ceData.titleBarData.hasWindow ) { - if ( ceData.wflags & WStyle_Tool ) { - if ( ret == SC_TitleBarMinButton || ret == SC_TitleBarMaxButton ) { - if ( ceData.titleBarData.windowState & WindowMinimized ) - ret = SC_TitleBarUnshadeButton; - else - ret = SC_TitleBarShadeButton; - } - } else if ( ret == SC_TitleBarMinButton && (ceData.titleBarData.windowState & WindowMinimized) ) { - ret = TQStyle::SC_TitleBarNormalButton; - } - } -#endif - break; - } - - default: - break; - } - - return ret; -} - -/*! \reimp */ -int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const -{ - int ret; - - switch (m) { - case PM_DialogButtonsSeparator: - ret = 5; - break; - case PM_DialogButtonsButtonWidth: - ret = 70; - break; - case PM_DialogButtonsButtonHeight: - ret = 30; - break; - case PM_CheckListControllerSize: - case PM_CheckListButtonSize: - ret = 16; - break; - case PM_TitleBarHeight: { - if ( !(elementFlags & CEF_UseGenericParameters) ) { - if ( ceData.wflags & WStyle_Tool ) { - ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 16 ); -#ifndef TQT_NO_MAINWINDOW - } else if ( ceData.widgetObjectTypes.containsYesNo(TQDockWindow_static_string) ) { - ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 13 ); -#endif - } else { - ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 18 ); - } - } - else { - ret = 0; - } - break; } - case PM_ScrollBarSliderMin: - ret = 9; - break; - - case PM_ButtonMargin: - ret = 6; - break; - - case PM_ButtonDefaultIndicator: - ret = 0; - break; - - case PM_MenuButtonIndicator: - if ( elementFlags & CEF_UseGenericParameters ) - ret = 12; - else - ret = TQMAX(12, (ceData.rect.height() - 4) / 3); - break; - - case PM_ButtonShiftHorizontal: - case PM_ButtonShiftVertical: - ret = 0; - break; - - case PM_SpinBoxFrameWidth: - case PM_DefaultFrameWidth: - ret = 2; - break; - - case PM_MDIFrameWidth: - ret = 2; - break; - - case PM_MDIMinimizedWidth: - ret = 196; - break; - -#ifndef TQT_NO_SCROLLBAR - case PM_ScrollBarExtent: - if ( elementFlags & CEF_UseGenericParameters ) { - ret = 16; - } else { - int s = ceData.orientation == TQt::Horizontal ? - TQApplication::globalStrut().height() - : TQApplication::globalStrut().width(); - ret = TQMAX( 16, s ); - } - break; -#endif - case PM_MaximumDragDistance: - ret = -1; - break; - -#ifndef TQT_NO_SLIDER - case PM_SliderThickness: - ret = 16; - break; - - case PM_SliderTickmarkOffset: - { - if ( elementFlags & CEF_UseGenericParameters ) { - ret = 0; - break; - } - - int space = (ceData.orientation == Horizontal) ? ceData.rect.height() : - ceData.rect.width(); - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); - int ticks = ceData.tickMarkSetting; - - if ( ticks == TQSlider::Both ) { - ret = (space - thickness) / 2; - } - else if ( ticks == TQSlider::Above ) { - ret = space - thickness; - } - else { - ret = 0; - } - break; - } - - case PM_SliderSpaceAvailable: - { - if ( ceData.orientation == Horizontal ) - ret = ceData.rect.width() - pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); - else - ret = ceData.rect.height() - pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); - break; - } -#endif // TQT_NO_SLIDER - - case PM_DockWindowSeparatorExtent: - ret = 6; - break; - - case PM_DockWindowHandleExtent: - ret = 8; - break; - - case PM_DockWindowFrameWidth: - ret = 1; - break; - - case PM_MenuBarFrameWidth: - ret = 2; - break; - - case PM_MenuBarItemSpacing: - case PM_ToolBarItemSpacing: - ret = 0; - break; - - case PM_TabBarTabOverlap: - ret = 3; - break; - - case PM_TabBarBaseHeight: - ret = 0; - break; - - case PM_TabBarBaseOverlap: - ret = 0; - break; - - case PM_TabBarTabHSpace: - ret = 24; - break; - - case PM_TabBarTabShiftHorizontal: - case PM_TabBarTabShiftVertical: - ret = 2; - break; - -#ifndef TQT_NO_TABBAR - case PM_TabBarTabVSpace: - { - if ( ceData.widgetObjectTypes.containsYesNo(TQTabBar_static_string) && ( ceData.tabBarData.shape == TQTabBar::RoundedAbove || - ceData.tabBarData.shape == TQTabBar::RoundedBelow ) ) - ret = 10; - else - ret = 0; - break; - } -#endif - - case PM_ProgressBarChunkWidth: - ret = 9; - break; - - case PM_IndicatorWidth: - ret = 13; - break; - - case PM_IndicatorHeight: - ret = 13; - break; - - case PM_ExclusiveIndicatorWidth: - ret = 12; - break; - - case PM_ExclusiveIndicatorHeight: - ret = 12; - break; - - case PM_PopupMenuFrameHorizontalExtra: - case PM_PopupMenuFrameVerticalExtra: - ret = 0; - break; - - case PM_HeaderMargin: - ret = 4; - break; - case PM_HeaderMarkSize: - ret = 32; - break; - case PM_HeaderGripMargin: - ret = 4; - break; - case PM_TabBarScrollButtonWidth: - ret = 16; - break; - case PM_ArrowSize: - ret = 7; - break; - default: - ret = 0; - break; - } - - return ret; -} - -/*! \reimp */ -TQSize TQCommonStyle::sizeFromContents(ContentsType contents, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQSize &contentsSize, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - TQSize sz(contentsSize); - - switch (contents) { -#ifndef TQT_NO_DIALOGBUTTONS - case CT_DialogButtons: { - int w = contentsSize.width(), h = contentsSize.height(); - const int bwidth = pixelMetric(PM_DialogButtonsButtonWidth, ceData, elementFlags, widget), - bspace = pixelMetric(PM_DialogButtonsSeparator, ceData, elementFlags, widget), - bheight = pixelMetric(PM_DialogButtonsButtonHeight, ceData, elementFlags, widget); - if(ceData.orientation == Horizontal) { - if(!w) - w = bwidth; - } else { - if(!h) - h = bheight; - } - TQDialogButtons::Button btns[] = { TQDialogButtons::All, TQDialogButtons::Reject, TQDialogButtons::Accept, //reverse order (right to left) - TQDialogButtons::Apply, TQDialogButtons::Retry, TQDialogButtons::Ignore, TQDialogButtons::Abort, - TQDialogButtons::Help }; - for(unsigned int i = 0, cnt = 0; i < (sizeof(btns)/sizeof(btns[0])); i++) { - if (ceData.dlgVisibleButtons & btns[i]) { - TQSize szH = ceData.dlgVisibleSizeHints[btns[i]]; - int mwidth = TQMAX(bwidth, szH.width()), mheight = TQMAX(bheight, szH.height()); - if(ceData.orientation == Horizontal) - h = TQMAX(h, mheight); - else - w = TQMAX(w, mwidth); - - if(cnt) - w += bspace; - cnt++; - if(ceData.orientation == Horizontal) - w += mwidth; - else - h += mheight; - } - } - const int fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2; - sz = TQSize(w + fw, h + fw); - break; } -#endif //TQT_NO_DIALOGBUTTONS - case CT_PushButton: - { -#ifndef TQT_NO_PUSHBUTTON - int w = contentsSize.width(), - h = contentsSize.height(), - bm = pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget), - fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2; - - w += bm + fw; - h += bm + fw; - - if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { - int dbw = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget) * 2; - w += dbw; - h += dbw; - } - - sz = TQSize(w, h); -#endif - break; - } - - case CT_CheckBox: - { -#ifndef TQT_NO_CHECKBOX - TQRect irect = subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget); - int h = pixelMetric( PM_IndicatorHeight, ceData, elementFlags, widget ); - int margins = (ceData.fgPixmap.isNull() && ceData.text.isEmpty()) ? 0 : 10; - sz += TQSize(irect.right() + margins, 4 ); - sz.setHeight( TQMAX( sz.height(), h ) ); -#endif - break; - } - - case CT_RadioButton: - { -#ifndef TQT_NO_RADIOBUTTON - TQRect irect = subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget); - int h = pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags, widget ); - int margins = (ceData.fgPixmap.isNull() && ceData.text.isEmpty()) ? 0 : 10; - sz += TQSize(irect.right() + margins, 4 ); - sz.setHeight( TQMAX( sz.height(), h ) ); -#endif - break; - } - - case CT_ToolButton: - { - sz = TQSize(sz.width() + 6, sz.height() + 5); - break; - } - - case CT_ComboBox: - { - int dfw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2; - sz = TQSize(sz.width() + dfw + 21, sz.height() + dfw ); - break; - } - - case CT_PopupMenuItem: - { -#ifndef TQT_NO_POPUPMENU - if (opt.isDefault()) - break; - - bool checkable = (elementFlags & CEF_IsCheckable); - TQMenuItem *mi = opt.menuItem(); - int maxpmw = opt.maxIconWidth(); - int w = sz.width(), h = sz.height(); - - if (mi->custom()) { - w = mi->custom()->sizeHint().width(); - h = mi->custom()->sizeHint().height(); - if (! mi->custom()->fullSpan()) - h += 8; - } else if ( mi->widget() ) { - } else if (mi->isSeparator()) { - w = 10; - h = 2; - } else { - if (mi->pixmap()) - h = TQMAX(h, mi->pixmap()->height() + 4); - else - h = TQMAX(h, TQFontMetrics(ceData.font).height() + 8); - - if (mi->iconSet() != 0) - h = TQMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, - TQIconSet::Normal).height() + 4); - } - - if (! mi->text().isNull()) { - if (mi->text().find('\t') >= 0) - w += 12; - } - - if (maxpmw) - w += maxpmw + 6; - if (checkable && maxpmw < 20) - w += 20 - maxpmw; - if (checkable || maxpmw > 0) - w += 2; - w += 12; - - sz = TQSize(w, h); -#endif - break; - } - - case CT_LineEdit: - case CT_Header: - case CT_Slider: - case CT_ProgressBar: - // just return the contentsSize for now - // fall through intended - - default: - break; - } - - return sz; -} - -/*! \reimp */ -int TQCommonStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget * w) const -{ - Q_UNUSED(w); - - int ret; - - switch (sh) { -#ifndef TQT_NO_DIALOGBUTTONS - case SH_DialogButtons_DefaultButton: - ret = TQDialogButtons::Accept; - break; -#endif - case SH_GroupBox_TextLabelVerticalAlignment: - ret = TQt::AlignVCenter; - break; - - case SH_GroupBox_TextLabelColor: - ret = (int) ( (!(elementFlags & CEF_UseGenericParameters)) ? ceData.fgColor.rgb() : 0 ); - break; - - case SH_ListViewExpand_SelectMouseType: - case SH_TabBar_SelectMouseType: - ret = TQEvent::MouseButtonPress; - break; - - case SH_GUIStyle: - ret = WindowsStyle; - break; - - case SH_ScrollBar_BackgroundMode: - ret = TQWidget::PaletteBackground; - break; - - case SH_TabBar_Alignment: - case SH_Header_ArrowAlignment: - ret = TQt::AlignLeft; - break; - - case SH_PopupMenu_SubMenuPopupDelay: - ret = 256; - break; - - case SH_ProgressDialog_TextLabelAlignment: - ret = TQt::AlignCenter; - break; - - case SH_BlinkCursorWhenTextSelected: - ret = 1; - break; - - case SH_Table_GridLineColor: - ret = -1; - break; - - case SH_LineEdit_PasswordCharacter: - ret = '*'; - break; - - case SH_ToolBox_SelectedPageTitleBold: - ret = 1; - break; - - case SH_UnderlineAccelerator: - ret = 1; - break; - - case SH_ToolButton_Uses3D: - ret = 1; - break; - - case SH_HideUnderlineAcceleratorWhenAltUp: - ret = 0; - break; - - case SH_PopupMenu_SubMenuArrowColorActiveEnabled: - case SH_PopupMenu_SubMenuArrowColorActiveDisabled: - case SH_PopupMenu_SubMenuArrowColorInactiveEnabled: - case SH_PopupMenu_SubMenuArrowColorInactiveDisabled: - ret = -1; - break; - - default: - ret = 0; - break; - } - - return ret; -} - -/*! \reimp */ -TQPixmap TQCommonStyle::stylePixmap(StylePixmap, const TQStyleControlElementData&, ControlElementFlags, const TQStyleOption&, const TQWidget *) const -{ - return TQPixmap(); -} - -#endif // TQT_NO_STYLE diff --git a/src/styles/qcompactstyle.cpp b/src/styles/qcompactstyle.cpp deleted file mode 100644 index f2e9b1fc7..000000000 --- a/src/styles/qcompactstyle.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/**************************************************************************** -** -** Implementation of compact style class -** -** Created : 006231 -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqcompactstyle.h" - -#if !defined(TQT_NO_STYLE_COMPACT) || defined(QT_PLUGIN) - -#include "tqfontmetrics.h" -#include "tqpalette.h" -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqmenudata.h" -#include "tqpopupmenu.h" - -TQCompactStyle::TQCompactStyle() -: TQWindowsStyle() -{ -} - -/*! \reimp */ -int TQCompactStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) -{ - int ret; - switch ( metric ) { - case PM_ButtonMargin: - ret = 2; - break; - // tws - I added this in to stop this "Windows Scroll behaivor." Remove it - // if you don't want it. - case PM_MaximumDragDistance: - ret = -1; - break; - case PM_MenuIndicatorFrameHBorder: - case PM_MenuIndicatorFrameVBorder: - case PM_MenuIconIndicatorFrameHBorder: - case PM_MenuIconIndicatorFrameVBorder: - ret = 0; - break; - default: - ret = TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget ); - break; - } - return ret; -} - -static const int motifItemFrame = 0; // menu item frame width -static const int motifSepHeight = 2; // separator item height -static const int motifItemHMargin = 1; // menu item hor text margin -static const int motifItemVMargin = 2; // menu item ver text margin -static const int motifArrowHMargin = 0; // arrow horizontal margin -static const int motifTabSpacing = 4; // space between text and tab -static const int motifCheckMarkHMargin = 1; // horiz. margins of check mark -static const int windowsRightBorder = 8; // right border on windows -static const int windowsCheckMarkWidth = 2; // checkmarks width on windows - -#if 0 -static int extraPopupMenuItemWidth( bool checkable, int maxpmw, TQMenuItem* mi, const TQFontMetrics& /*fm*/ ) -{ - int w = 2*motifItemHMargin + 2*motifItemFrame; // a little bit of border can never harm - - if ( mi->isSeparator() ) - return 10; // arbitrary - else if ( mi->pixmap() ) - w += mi->pixmap()->width(); // pixmap only - - if ( !mi->text().isNull() ) { - if ( mi->text().find('\t') >= 0 ) // string contains tab - w += motifTabSpacing; - } - - if ( maxpmw ) { // we have iconsets - w += maxpmw; - w += 6; // add a little extra border around the iconset - } - - if ( checkable && maxpmw < windowsCheckMarkWidth ) { - w += windowsCheckMarkWidth - maxpmw; // space for the checkmarks - } - - if ( maxpmw > 0 || checkable ) // we have a check-column ( iconsets or checkmarks) - w += motifCheckMarkHMargin; // add space to separate the columns - - w += windowsRightBorder; // windows has a strange wide border on the right side - - return w; -} - -static int popupMenuItemHeight( bool /*checkable*/, TQMenuItem* mi, const TQFontMetrics& fm ) -{ - int h = 0; - if ( mi->isSeparator() ) // separator height - h = motifSepHeight; - else if ( mi->pixmap() ) // pixmap height - h = mi->pixmap()->height() + 2*motifItemFrame; - else // text height - h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; - - if ( !mi->isSeparator() && mi->iconSet() != 0 ) { - h = TQMAX( h, mi->iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).height() + 2*motifItemFrame ); - } - if ( mi->custom() ) - h = TQMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; - return h; -} -#endif - -void drawPopupMenuItem( TQPainter*, bool, - int, int, TQMenuItem*, - const TQPalette&, bool, - bool, - int, int, int, int) -{ - -} - -/*! \reimp */ -void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, - const TQColorGroup &g, SFlags flags, const TQStyleOption& opt, const TQWidget *widget ) -{ - switch ( element ) { - case CE_PopupMenuItem: - { - if ( (elementFlags & CEF_UseGenericParameters) || opt.isDefault()) - break; - - TQMenuItem *mi = opt.menuItem(); - if ( !mi ) - break; - - int tab = opt.tabWidth(); - int maxpmw = opt.maxIconWidth(); - bool dis = !(flags & Style_Enabled); - bool checkable = (elementFlags & CEF_IsCheckable); - bool act = flags & Style_Active; - int x, y, w, h; - r.rect( &x, &y, &w, &h ); - - TQColorGroup itemg = g; - - if ( checkable ) - maxpmw = TQMAX( maxpmw, 8 ); // space for the checkmarks - - int checkcol = maxpmw; - - if ( mi && mi->isSeparator() ) { // draw separator - p->setPen( g.dark() ); - p->drawLine( x, y, x+w, y ); - p->setPen( g.light() ); - p->drawLine( x, y+1, x+w, y+1 ); - return; - } - - TQBrush fill = act? g.brush( TQColorGroup::Highlight ) : - g.brush( TQColorGroup::Button ); - p->fillRect( x, y, w, h, fill); - - if ( !mi ) - return; - - if ( mi->isChecked() ) { - drawPrimitive( PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, itemg, flags, opt ); - } else if ( !act ) { - p->fillRect(x, y, checkcol , h, - g.brush( TQColorGroup::Button )); - } - - if ( mi->iconSet() ) { // draw iconset - TQIconSet::Mode mode = dis ? TQIconSet::Disabled : TQIconSet::Normal; - if (act && !dis ) - mode = TQIconSet::Active; - TQPixmap pixmap; - if ( checkable && mi->isChecked() ) - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); - else - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); - int pixw = pixmap.width(); - int pixh = pixmap.height(); - if ( act && !dis ) { - if ( !mi->isChecked() ) - drawPrimitive( PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, itemg, flags, opt ); - } - TQRect cr( x, y, checkcol, h ); - TQRect pmr( 0, 0, pixw, pixh ); - pmr.moveCenter( cr.center() ); - p->setPen( itemg.text() ); - p->drawPixmap( pmr.topLeft(), pixmap ); - - TQBrush fill = act? g.brush( TQColorGroup::Highlight ) : - g.brush( TQColorGroup::Button ); - p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill); - } else if ( checkable ) { // just "checking"... - if ( mi->isChecked() ) { - drawPrimitive( PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, itemg, flags, opt ); - } - } - - p->setPen( act ? g.highlightedText() : g.buttonText() ); - - TQColor discol; - if ( dis ) { - discol = itemg.text(); - p->setPen( discol ); - } - - int xm = motifItemFrame + checkcol + motifItemHMargin; - - if ( mi->custom() ) { - int m = motifItemVMargin; - p->save(); - if ( dis && !act ) { - p->setPen( g.light() ); - mi->custom()->paint( p, itemg, act, !dis, - x+xm+1, y+m+1, w-xm-tab+1, h-2*m ); - p->setPen( discol ); - } - mi->custom()->paint( p, itemg, act, !dis, - x+xm, y+m, w-xm-tab+1, h-2*m ); - p->restore(); - } - TQString s = mi->text(); - if ( !s.isNull() ) { // draw text - int t = s.find( '\t' ); - int m = motifItemVMargin; - const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; - if ( t >= 0 ) { // draw tab text - if ( dis && !act ) { - p->setPen( g.light() ); - p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1, - y+m+1, tab, h-2*m, text_flags, s.mid( t+1 )); - p->setPen( discol ); - } - p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame, - y+m, tab, h-2*m, text_flags, s.mid( t+1 ) ); - s = s.left( t ); - } - if ( dis && !act ) { - p->setPen( g.light() ); - p->drawText( x+xm+1, y+m+1, w-xm+1, h-2*m, text_flags, s, t ); - p->setPen( discol ); - } - p->drawText( x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t ); - } else if ( mi->pixmap() ) { // draw pixmap - TQPixmap *pixmap = mi->pixmap(); - if ( pixmap->depth() == 1 ) - p->setBackgroundMode( OpaqueMode ); - p->drawPixmap( x+xm, y+motifItemFrame, *pixmap ); - if ( pixmap->depth() == 1 ) - p->setBackgroundMode( TransparentMode ); - } - if ( mi->popup() ) { // draw sub menu arrow - int dim = (h-2*motifItemFrame) / 2; - if ( act ) { - if ( !dis ) - discol = white; - TQColorGroup g2( discol, g.highlight(), - white, white, - dis ? discol : white, - discol, white ); - drawPrimitive(PE_ArrowRight, p, ceData, elementFlags, TQRect(x+w - motifArrowHMargin - motifItemFrame - dim, y + h / 2 - dim / 2, dim, dim), - g2, Style_Enabled); - } else { - drawPrimitive(PE_ArrowRight, p, ceData, elementFlags, TQRect(x+w - motifArrowHMargin - motifItemFrame - dim, y + h / 2 - dim / 2, dim, dim), - g, !dis ? Style_Enabled : Style_Default); - } - } - } - break; - - default: - TQWindowsStyle::drawControl( element, p, ceData, elementFlags, r, g, flags, opt, widget ); - break; - } -} - -/*! \reimp */ -void TQCompactStyle::drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt ) const -{ - bool dis = !(flags & Style_Enabled); - bool act = flags & Style_Active; - - int x, y, w, h; - r.rect( &x, &y, &w, &h ); - - switch (pe) { - case PE_MenuItemIndicatorFrame: - { - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - if ( act && !dis ) { - qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); - } else { - qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) ); - } - } - break; - case PE_MenuItemIndicatorIconFrame: - { - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - qDrawShadePanel( p, x, y, checkcol, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) ); - } - break; - case PE_MenuItemIndicatorCheck: - { - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - int mw = checkcol + motifItemFrame; - int mh = h - 2*motifItemFrame; - - SFlags cflags = Style_Default; - if (! dis) { - cflags |= Style_Enabled; - } - if (act) { - cflags |= Style_On; - } - - drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect(x + motifItemFrame + 2, y + motifItemFrame, mw, mh), cg, cflags, opt ); - } - break; - default: - break; - } -} - -/*! \reimp */ -int TQCompactStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const -{ - int ret; - - switch (sh) { - case SH_MenuIndicatorColumnWidth: - { - int maxpmw = opt.maxIconWidth(); - bool checkable = (elementFlags & CEF_IsCheckable); - - if ( checkable ) - maxpmw = TQMAX( maxpmw, 8 ); // space for the checkmarks - - ret = maxpmw; - } - break; - default: - ret = TQWindowsStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); - break; - } - - return ret; -} - -#endif diff --git a/src/styles/qinterlacestyle.cpp b/src/styles/qinterlacestyle.cpp deleted file mode 100644 index 11bc57366..000000000 --- a/src/styles/qinterlacestyle.cpp +++ /dev/null @@ -1,805 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQInterlaceStyle class -** -** Created : 010122 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#if 0 // ###### not ported to new API yet - -#include "ntqinterlacestyle.h" - -#if !defined(TQT_NO_STYLE_INTERLACE) || defined(QT_PLUGIN) - -#include "ntqapplication.h" -#include "tqpainter.h" -#include "ntqdrawutil.h" // for now -#include "tqpalette.h" // for now -#include "tqwidget.h" -#include "tqlabel.h" -#include "tqpushbutton.h" -#include "tqwidget.h" -#include "ntqrangecontrol.h" -#include "tqscrollbar.h" -#include "tqlistbox.h" - -#include - -/*! - \class TQInterlaceStyle ntqinterlacestyle.h - \brief The TQInterlaceStyle class provides a Look and Feel suitable for interlaced displays. - \ingroup appearance - - This class implements a look and feel that reduces flicker as much as - possible on interlaced displays (i.e. television). It is an experimental - style. In addition to using this style you will need to select a font - that does not flicker. -*/ - -/*! - Constructs a TQInterlaceStyle -*/ -TQInterlaceStyle::TQInterlaceStyle() : TQMotifStyle() -{ - setUseHighlightColors( TRUE ); -} - -/*! \reimp -*/ -int TQInterlaceStyle::buttonDefaultIndicatorWidth() const -{ - return 0; -} - -/*! \reimp -*/ -int TQInterlaceStyle::setSliderThickness() const -{ - return 18; -} - -/*! \reimp -*/ -TQSize TQInterlaceStyle::scrollBarExtent() const -{ - return TQSize( 18, 18 ); -} - -/*! \reimp -*/ -int TQInterlaceStyle::defaultFrameWidth() const -{ - return 2; -} - -/*! - \reimp - */ -void TQInterlaceStyle::polish( TQApplication *app) -{ - oldPalette = app->palette(); -#if 0 - TQColor bg( 128, 64, 128 ); - TQColor btn( 255, 145, 0 ); - TQColor mid = bg.dark( 120 ); - TQColor low = mid.dark( 120 ); - TQColor fg( white ); -#else - TQColor bg( 224, 224, 224 ); - TQColor btn = bg.dark( 105 ); - TQColor mid = bg.dark( 120 ); - TQColor low = mid.dark( 120 ); - TQColor fg( black ); -#endif - - TQColorGroup cg( fg, btn, low, low, mid, black, black, white, bg ); - cg.setColor( TQColorGroup::Highlight, TQColor( 255, 255, 192 ) ); - cg.setColor( TQColorGroup::HighlightedText, black ); - - TQColorGroup dcg( cg ); - dcg.setColor( TQColorGroup::ButtonText, low ); - dcg.setColor( TQColorGroup::Text, low ); - - app->setPalette( TQPalette( cg, dcg, cg ), TRUE ); -} - -/*! - \reimp - */ -void TQInterlaceStyle::unPolish( TQApplication *app) -{ - app->setPalette(oldPalette, TRUE); -} - -/*! - \reimp - */ -void TQInterlaceStyle::polish( TQWidget* w) -{ - - // the polish function sets some widgets to transparent mode and - // some to translate background mode in order to get the full - // benefit from the nice pixmaps in the color group. - - if ( w->inherits("TQLCDNumber") ){ - return; - } - - if ( !w->isTopLevel() ) { - if ( w->inherits("TQGroupBox") - || w->inherits("TQTabWidget") - || w->inherits("TQPushButton") ) { - w->setAutoMask( TRUE ); - return; - } - if (w->inherits("TQLabel") - || w->inherits("TQSlider") - || w->inherits("TQButton") - || w->inherits("TQProgressBar") - ){ - w->setBackgroundOrigin( TQWidget::ParentOrigin ); - } - } - - if ( w->inherits( "TQFrame" ) ) { - TQFrame *f = (TQFrame *)w; - switch ( f->frameShape() ) { - case TQFrame::WinPanel: - f->setFrameShape( TQFrame::StyledPanel ); - - case TQFrame::Panel: - case TQFrame::Box: - case TQFrame::StyledPanel: - case TQFrame::PopupPanel: - if ( f->frameWidth() == 1 ) - f->setLineWidth( 2 ); - break; - default: - break; - } - } - - if ( w->inherits( "TQListBox" ) ) { - // the list box in combos has an ugly border otherwise - TQFrame *f = (TQFrame *)w; - if ( f->frameShadow() == TQFrame::Plain ) { - f->setFrameShadow( TQFrame::Raised ); - f->setLineWidth( 1 ); - } - } -} - -/*! - \reimp -*/ -void TQInterlaceStyle::unPolish( TQWidget* w) -{ - - // the polish function sets some widgets to transparent mode and - // some to translate background mode in order to get the full - // benefit from the nice pixmaps in the color group. - - if ( w->inherits("TQLCDNumber") ){ - return; - } - - if ( !w->isTopLevel() ) { - if ( w->inherits("TQGroupBox") - || w->inherits("TQTabWidget") - || w->inherits("TQPushButton" ) ) { - w->setAutoMask( FALSE ); - return; - } - if (w->inherits("TQLabel") - || w->inherits("TQSlider") - || w->inherits("TQButton") - || w->inherits("TQProgressBar") - ){ - w->setBackgroundOrigin( TQWidget::WidgetOrigin ); - } - } - -} - -/*! - \reimp -*/ -TQRect TQInterlaceStyle::pushButtonContentsRect( TQPushButton *btn ) -{ - int fw = 0; - if ( btn->isDefault() || btn->autoDefault() ) - fw = buttonDefaultIndicatorWidth(); - - return buttonRect( fw+5, fw, btn->width()-2*fw-10, btn->height()-2*fw ); -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawFocusRect ( TQPainter *p, const TQRect &/*r*/, const TQColorGroup &g, const TQColor * bg, bool /*atBorder*/ ) -{ - if (bg ) { - int h,s,v; - bg->hsv(&h,&s,&v); - if (v >= 128) - p->setPen( TQt::black ); - else - p->setPen( TQt::white ); - } - else - p->setPen( g.foreground() ); -/* - p->setBrush( NoBrush ); - if ( atBorder ) { - p->drawRect( TQRect( r.x()+1, r.y()+2, r.width()-2, r.height()-4 ) ); - p->drawRect( TQRect( r.x()+2, r.y()+1, r.width()-4, r.height()-2 ) ); - } else { - p->drawRect( TQRect( r.x(), r.y()+1, r.width(), r.height()-2 ) ); - p->drawRect( TQRect( r.x()+1, r.y(), r.width()-2, r.height() ) ); - } -*/ -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawButton( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &g, bool /* sunken */, - const TQBrush *fill ) -{ - const int lineWidth = 2; - - p->setBrush( g.brush( TQColorGroup::Dark ) ); - p->setPen( NoPen ); - p->drawRect( x+1, y+1, 2, 2 ); - p->drawRect( x+w-3, y+1, 2, 2 ); - p->drawRect( x+1, y+h-3, 2, 2 ); - p->drawRect( x+w-3, y+h-3, 2, 2 ); - - p->drawRect( x+2, y, w-4, 2 ); - p->drawRect( x+2, y+h-lineWidth, w-4, lineWidth ); - p->drawRect( x, y+2, lineWidth, h-4 ); - p->drawRect( x+w-lineWidth, y+2, lineWidth, h-4 ); - - if ( fill ) { - x += 2; - y += 2; - w -= 4; - h -= 4; - p->setBrush( *fill ); - p->setPen( NoPen ); - p->drawRect( x+1, y, w-2, 1 ); - p->drawRect( x, y+1, w, h-2 ); - p->drawRect( x+1, y+h-1, w-2, 1 ); - } -} - -/*! \reimp */ -void TQInterlaceStyle::drawButtonMask( TQPainter * p, int x, int y, int w, int h ) -{ - TQBrush fill( color1 ); - TQColorGroup cg; - cg.setBrush( TQColorGroup::Dark, color1 ); - drawButton( p, x, y, w, h, cg, FALSE, &fill ); -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawBevelButton( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &g, bool sunken, const TQBrush* fill ) -{ - TQInterlaceStyle::drawButton(p, x, y, w, h, g, sunken, fill); -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawPushButton( TQPushButton* btn, TQPainter *p) -{ - TQColorGroup g = btn->colorGroup(); - int x1, y1, x2, y2; - - btn->rect().coords( &x1, &y1, &x2, &y2 ); // get coordinates - - TQBrush fill( g.button() ); - if ( btn->isDown() || btn->isOn() ) - fill = g.mid(); - - if ( btn->hasFocus() ) - g.setBrush( TQColorGroup::Dark, black ); - drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, FALSE, &fill ); - - if ( btn->isMenuButton() ) { - int dx = (y1-y2-4)/3; - drawArrow( p, DownArrow, FALSE, - x2 - dx, dx, y1, y2 - y1, - g, btn->isEnabled() ); - } - - if ( p->brush().style() != NoBrush ) - p->setBrush( NoBrush ); -} - -/*! - \reimp -*/ -TQSize TQInterlaceStyle::indicatorSize () const -{ - return TQSize(13,13); -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawIndicator( TQPainter * p, int x, int y, int w, int h, const TQColorGroup &g, int s, bool down, bool enabled ) -{ - p->fillRect( x, y, w, h, g.brush( TQColorGroup::Background ) ); - TQBrush fill; - if ( s == TQButton::NoChange ) { - TQBrush b = p->brush(); - TQColor c = p->backgroundColor(); - p->setBackgroundMode( TransparentMode ); - p->setBackgroundColor( green ); - fill = TQBrush(g.base(), Dense4Pattern); - p->setBackgroundColor( c ); - p->setBrush( b ); - } else if ( down ) - fill = g.brush( TQColorGroup::Button ); - else - fill = g.brush( enabled ? TQColorGroup::Base : TQColorGroup::Background ); - - drawButton( p, x, y, w, h, g, FALSE, &fill ); - - if ( s != TQButton::Off ) { - TQPointArray a( 7*2 ); - int i, xx, yy; - xx = x+3; - yy = y+5; - for ( i=0; i<3; i++ ) { - a.setPoint( 2*i, xx, yy ); - a.setPoint( 2*i+1, xx, yy+2 ); - xx++; yy++; - } - yy -= 2; - for ( i=3; i<7; i++ ) { - a.setPoint( 2*i, xx, yy ); - a.setPoint( 2*i+1, xx, yy+2 ); - xx++; yy--; - } - if ( s == TQButton::NoChange ) { - p->setPen( g.dark() ); - } else { - p->setPen( g.text() ); - } - p->drawLineSegments( a ); - } -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawIndicatorMask( TQPainter *p, int x, int y, int w, int h, int ) -{ - drawButtonMask( p, x, y, w, h ); -} - -/*! - \reimp -*/ -TQSize TQInterlaceStyle::exclusiveIndicatorSize() const -{ - return TQSize(13,13); -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawExclusiveIndicator( TQPainter *p, int x, int y, int w, int h, const TQColorGroup &g, bool on, bool down, bool enabled ) -{ - p->fillRect( x, y, w, h, g.brush( TQColorGroup::Background ) ); - p->setBrush( g.dark() ); - p->setPen( TQPen( NoPen ) ); - p->drawEllipse( x, y, w, h ); - - x += 2; - y += 2; - w -= 4; - h -= 4; - TQColor fillColor = ( down || !enabled ) ? g.button() : g.base(); - p->setBrush( fillColor ); - p->drawEllipse( x, y, w, h ); - - if ( on ) { - p->setBrush( g.text() ); - p->drawEllipse( x+2, y+2, w-4, h-4 ); - } -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawExclusiveIndicatorMask( TQPainter *p, int x, int y, int w, int h, bool ) -{ - p->setBrush( color1 ); - p->setPen( TQPen( NoPen ) ); - p->drawEllipse( x, y, w, h ); -} - -static int get_combo_extra_width( int h, int *return_awh=0 ) -{ - int awh; - if ( h < 8 ) { - awh = 6; - } else if ( h < 14 ) { - awh = h - 2; - } else { - awh = h/2; - } - if ( return_awh ) - *return_awh = awh; - return awh*3/2; -} - -/*! - \reimp -*/ -TQRect TQInterlaceStyle::comboButtonRect ( int x, int y, int w, int h ) -{ - TQRect r = buttonRect( x, y, w, h ); - int ew = get_combo_extra_width( r.height() ); - return TQRect(r.x(), r.y(), r.width()-ew, r.height()); -} - -static void get_combo_parameters( const TQRect &r, - int &ew, int &awh, int &ax, - int &ay, int &sh, int &dh, - int &sy ) -{ - ew = get_combo_extra_width( r.height(), &awh ); - - sh = (awh+3)/4; - if ( sh < 3 ) - sh = 3; - dh = sh/2 + 1; - - ay = r.y() + (r.height()-awh-sh-dh)/2; - if ( ay < 0 ) { - //panic mode - ay = 0; - sy = r.height(); - } else { - sy = ay+awh+dh; - } - ax = r.x() + r.width() - ew +(ew-awh)/2; -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawComboButton( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &g, - bool /* sunken */, - bool /*editable*/, - bool /*enabled */, - const TQBrush *fb ) -{ - TQBrush fill = fb ? *fb : g.brush( TQColorGroup::Button ); - - int awh, ax, ay, sh, sy, dh, ew; - get_combo_parameters( buttonRect(x,y,w,h), ew, awh, ax, ay, sh, dh, sy ); - - drawButton( p, x, y, w, h, g, FALSE, &fill ); - - qDrawArrow( p, DownArrow, MotifStyle, FALSE, ax, ay, awh, awh, g, TRUE ); - - p->setPen( g.dark() ); - p->drawRect( ax+1, sy+1, awh-1, sh-1 ); -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawPushButtonLabel( TQPushButton* btn, TQPainter *p) -{ - TQRect r = btn->rect(); - int x, y, w, h; - r.rect( &x, &y, &w, &h ); - - int x1, y1, x2, y2; - btn->rect().coords( &x1, &y1, &x2, &y2 ); // get coordinates - int dx = 0; - int dy = 0; - if ( btn->isMenuButton() ) - dx = (y2-y1) / 3; - if ( btn->isOn() || btn->isDown() ) { -// dx--; -// dy--; - } - if ( dx || dy ) - p->translate( dx, dy ); - - x += 2; y += 2; w -= 4; h -= 4; - TQColorGroup g = btn->colorGroup(); - const TQColor *col = &btn->colorGroup().buttonText(); - if ( (btn->isDown() || btn->isOn()) ) - col = &btn->colorGroup().brightText(); - else if ( !btn->isEnabled() ) - col = &btn->colorGroup().dark(); - drawItem( p, x, y, w, h, - AlignCenter|ShowPrefix, - g, btn->isEnabled(), - btn->pixmap(), btn->text(), -1, col ); - - if ( dx || dy ) - p->translate( -dx, -dy ); -} - -#define HORIZONTAL (sb->orientation() == TQScrollBar::Horizontal) -#define VERTICAL !HORIZONTAL -#define MOTIF_BORDER defaultFrameWidth() -#define SLIDER_MIN 9 // ### motif says 6 but that's too small - - -/*! \reimp */ - -void TQInterlaceStyle::scrollBarMetrics( const TQScrollBar* sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim ) -{ - int maxLength; - int b = MOTIF_BORDER; - int length = HORIZONTAL ? sb->width() : sb->height(); - int extent = HORIZONTAL ? sb->height() : sb->width(); - - if ( length > ( extent - b*2 - 1 )*2 + b*2 ) - buttonDim = extent - b*2; - else - buttonDim = ( length - b*2 )/2 - 1; - - sliderMin = b + buttonDim; - maxLength = length - b*2 - buttonDim*2; - - if ( sb->maxValue() == sb->minValue() ) { - sliderLength = maxLength; - } else { - uint range = sb->maxValue()-sb->minValue(); - sliderLength = (sb->pageStep()*maxLength)/ - (range + sb->pageStep()); - if ( sliderLength < SLIDER_MIN || range > INT_MAX/2 ) - sliderLength = SLIDER_MIN; - if ( sliderLength > maxLength ) - sliderLength = maxLength; - } - sliderMax = sliderMin + maxLength - sliderLength; - -} - - -/*! \reimp */ - -void TQInterlaceStyle::drawScrollBarControls( TQPainter* p, const TQScrollBar* sb, - int sliderStart, uint controls, - uint activeControl ) -{ -#define ADD_LINE_ACTIVE ( activeControl == AddLine ) -#define SUB_LINE_ACTIVE ( activeControl == SubLine ) - TQColorGroup g = sb->colorGroup(); - - int sliderMin, sliderMax, sliderLength, buttonDim; - scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); - - TQBrush fill = g.brush( TQColorGroup::Mid ); - if (sb->backgroundPixmap() ){ - fill = TQBrush( g.mid(), *sb->backgroundPixmap() ); - } - - if ( controls == (AddLine | SubLine | AddPage | SubPage | Slider | First | Last ) ) - drawPanel( p, 0, 0, sb->width(), sb->height(), g, FALSE, 2, &fill ); - - if (sliderStart > sliderMax) { // sanity check - sliderStart = sliderMax; - } - - int b = MOTIF_BORDER; - int dimB = buttonDim; - TQRect addB; - TQRect subB; - TQRect addPageR; - TQRect subPageR; - TQRect sliderR; - int addX, addY, subX, subY; - int length = HORIZONTAL ? sb->width() : sb->height(); - int extent = HORIZONTAL ? sb->height() : sb->width(); - - if ( HORIZONTAL ) { - subY = addY = ( extent - dimB ) / 2; - subX = b; - addX = length - dimB - b; - } else { - subX = addX = ( extent - dimB ) / 2; - subY = b; - addY = length - dimB - b; - } - - subB.setRect( subX,subY,dimB,dimB ); - addB.setRect( addX,addY,dimB,dimB ); - - int sliderEnd = sliderStart + sliderLength; - int sliderW = extent - b*2; - if ( HORIZONTAL ) { - subPageR.setRect( subB.right() + 1, b, - sliderStart - subB.right() , sliderW ); - addPageR.setRect( sliderEnd-1, b, addX - sliderEnd+1, sliderW ); - sliderR .setRect( sliderStart, b, sliderLength, sliderW ); - } else { - subPageR.setRect( b, subB.bottom()+1, sliderW, - sliderStart - subB.bottom() ); - addPageR.setRect( b, sliderEnd-1, sliderW, addY - sliderEnd + 1); - sliderR .setRect( b, sliderStart, sliderW, sliderLength ); - } - - if ( controls & AddLine ) - drawArrow( p, VERTICAL ? DownArrow : RightArrow, - ADD_LINE_ACTIVE, addB.x(), addB.y(), - addB.width(), addB.height(), g, TRUE ); - if ( controls & SubLine ) - drawArrow( p, VERTICAL ? UpArrow : LeftArrow, - SUB_LINE_ACTIVE, subB.x(), subB.y(), - subB.width(), subB.height(), g, TRUE ); - - if ( controls & SubPage ) - p->fillRect( subPageR, fill ); - - if ( controls & AddPage ) - p->fillRect( addPageR, fill ); - - if ( controls & Slider ) { - TQPoint bo = p->brushOrigin(); - p->setBrushOrigin(sliderR.topLeft()); - if ( sliderR.isValid() ) - drawButton( p, sliderR.x(), sliderR.y(), - sliderR.width(), sliderR.height(), g, - FALSE, &g.brush( TQColorGroup::Button ) ); - p->setBrushOrigin(bo); - } - -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawSlider ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, Orientation orient, bool, bool) -{ - p->fillRect( x, y, w, h, g.brush( TQColorGroup::Background ) ); - drawButton( p, x, y, w, h, g, FALSE, &g.brush( TQColorGroup::Button ) ); - if ( orient == Horizontal ) { - TQCOORD mid = x + w / 2; - qDrawShadeLine( p, mid, y , mid, y + h - 2, g, TRUE, 1); - } else { - TQCOORD mid = y +h / 2; - qDrawShadeLine( p, x, mid, x + w - 2, mid, g, TRUE, 1); - } -} - - -/*! - \reimp -*/ -void TQInterlaceStyle::drawSliderGroove ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, TQCOORD , Orientation o) -{ - p->setBrush( g.brush( TQColorGroup::Dark ) ); - p->setPen( NoPen ); - - if ( o == Horizontal ) - drawButton( p, x, y+h/2-3, w, 6, g, FALSE, &g.brush( TQColorGroup::Mid ) ); - else - drawButton( p, x+w/2-3, y, 6, h, g, FALSE, &g.brush( TQColorGroup::Mid ) ); -} - - -/*! - \reimp -*/ -int TQInterlaceStyle::splitterWidth() const -{ - return TQMAX( 12, TQApplication::globalStrut().width() ); -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawSplitter( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &g, Orientation orient) -{ - const int motifOffset = 12; - int sw = splitterWidth(); - if ( orient == Horizontal ) { - TQCOORD xPos = x + w/2; - TQCOORD kPos = motifOffset; - TQCOORD kSize = sw - 4; - - qDrawShadeLine( p, xPos, kPos + kSize - 1 , - xPos, h, g ); - drawPanel( p, xPos-sw/2+2, kPos, - kSize, kSize, g, FALSE, 2, - &g.brush( TQColorGroup::Button )); - qDrawShadeLine( p, xPos, 0, xPos, kPos, g ); - } else { - TQCOORD yPos = y + h/2; - TQCOORD kPos = w - motifOffset - sw; - TQCOORD kSize = sw - 4; - - qDrawShadeLine( p, 0, yPos, kPos, yPos, g ); - drawPanel( p, kPos, yPos-sw/2+2, - kSize, kSize, g, FALSE, 2, - &g.brush( TQColorGroup::Button )); - qDrawShadeLine( p, kPos + kSize -1, yPos, - w, yPos, g ); - } - -} - -/*! - \reimp -*/ -void TQInterlaceStyle::drawPanel( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &g, bool /*sunken*/, - int lineWidth, const TQBrush *fill ) -{ - if ( lineWidth < 2 ) - lineWidth = 2; - - p->setBrush( g.brush( TQColorGroup::Dark ) ); - p->setPen( NoPen ); - - p->drawRect( x, y, w, lineWidth ); - p->drawRect( x, y+h-lineWidth, w, lineWidth ); - p->drawRect( x, y, lineWidth, h ); - p->drawRect( x+w-lineWidth, y, lineWidth, h ); - - if ( fill ) { - x += lineWidth; - y += lineWidth; - w -= 2*lineWidth; - h -= 2*lineWidth; - p->setBrush( *fill ); - p->setPen( NoPen ); - p->drawRect( x, y, w, h ); - } -} - -#endif // TQT_NO_STYLE_INTERLACE - -#endif diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp deleted file mode 100644 index 3e4a63010..000000000 --- a/src/styles/qmotifplusstyle.cpp +++ /dev/null @@ -1,1629 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQMotifPlusStyle class -** -** Created : 000727 -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqmotifplusstyle.h" - -#if !defined(TQT_NO_STYLE_MOTIFPLUS) || defined(QT_PLUGIN) - -#include "tqmenubar.h" -#include "ntqapplication.h" -#include "tqpainter.h" -#include "tqpalette.h" -#include "tqframe.h" -#include "tqpushbutton.h" -#include "tqcheckbox.h" -#include "tqradiobutton.h" -#include "tqcombobox.h" -#include "tqlineedit.h" -#include "tqspinbox.h" -#include "tqslider.h" -#include "ntqdrawutil.h" -#include "tqscrollbar.h" -#include "tqtabbar.h" -#include "tqtoolbar.h" -#include "ntqguardedptr.h" -#include "tqlayout.h" - - -struct TQMotifPlusStylePrivate -{ - TQMotifPlusStylePrivate() - : hovering(FALSE), sliderActive(FALSE), mousePressed(FALSE), - scrollbarElement(0), lastElement(0), ref(1) - { ; } - - bool hovering, sliderActive, mousePressed; - int scrollbarElement, lastElement, ref; - TQPoint mousePos; -}; - -static TQMotifPlusStylePrivate * singleton = 0; - - -static void drawMotifPlusShade(TQPainter *p, - const TQRect &r, - const TQColorGroup &g, - bool sunken, bool mouseover, - const TQBrush *fill = 0) -{ - TQPen oldpen = p->pen(); - TQPointArray a(4); - TQColor button = - mouseover ? g.midlight() : g.button(); - TQBrush brush = - mouseover ? g.brush(TQColorGroup::Midlight) : g.brush(TQColorGroup::Button); - int x, y, w, h; - - r.rect(&x, &y, &w, &h); - - if (sunken) p->setPen(g.dark()); else p->setPen(g.light()); - a.setPoint(0, x, y + h - 1); - a.setPoint(1, x, y); - a.setPoint(2, x, y); - a.setPoint(3, x + w - 1, y); - p->drawLineSegments(a); - - if (sunken) p->setPen(TQt::black); else p->setPen(button); - a.setPoint(0, x + 1, y + h - 2); - a.setPoint(1, x + 1, y + 1); - a.setPoint(2, x + 1, y + 1); - a.setPoint(3, x + w - 2, y + 1); - p->drawLineSegments(a); - - if (sunken) p->setPen(button); else p->setPen(g.dark()); - a.setPoint(0, x + 2, y + h - 2); - a.setPoint(1, x + w - 2, y + h - 2); - a.setPoint(2, x + w - 2, y + h - 2); - a.setPoint(3, x + w - 2, y + 2); - p->drawLineSegments(a); - - if (sunken) p->setPen(g.light()); else p->setPen(TQt::black); - a.setPoint(0, x + 1, y + h - 1); - a.setPoint(1, x + w - 1, y + h - 1); - a.setPoint(2, x + w - 1, y + h - 1); - a.setPoint(3, x + w - 1, y); - p->drawLineSegments(a); - - if (fill) - p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); - else - p->fillRect(x + 2, y + 2, w - 4, h - 4, brush); - - p->setPen(oldpen); -} - - -/*! - \class TQMotifPlusStyle ntqmotifplusstyle.h - \brief The TQMotifPlusStyle class provides a more sophisticated Motif-ish look and feel. - - \ingroup appearance - - This class implements a Motif-ish look and feel with the more - sophisticated bevelling as used by the GIMP Toolkit (GTK+) for - Unix/X11. -*/ - -/*! - Constructs a TQMotifPlusStyle - - If \a hoveringHighlight is TRUE (the default), then the style will - not highlight push buttons, checkboxes, radiobuttons, comboboxes, - scrollbars or sliders. -*/ -TQMotifPlusStyle::TQMotifPlusStyle(bool hoveringHighlight) : TQMotifStyle(TRUE) -{ - if ( !singleton ) - singleton = new TQMotifPlusStylePrivate; - else - singleton->ref++; - - useHoveringHighlight = hoveringHighlight; -} - -/*! \reimp */ -TQMotifPlusStyle::~TQMotifPlusStyle() -{ - if ( singleton && singleton->ref-- <= 0) { - delete singleton; - singleton = 0; - } -} - - -/*! \reimp */ -void TQMotifPlusStyle::polish(TQPalette &) -{ -} - - -/*! \reimp */ -void TQMotifPlusStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) -{ - if (ceData.widgetObjectTypes.contains("TQWidget")) { -#ifndef TQT_NO_FRAME - if ((ceData.widgetObjectTypes.contains("TQFrame")) && (ceData.frameStyle == TQFrame::Panel)) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::WinPanel)); - } -#endif - -#ifndef TQT_NO_MENUBAR - if ((ceData.widgetObjectTypes.contains("TQMenuBar")) && (ceData.frameStyle != TQFrame::NoFrame)) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::StyledPanel | TQFrame::Raised)); - } -#endif - -#ifndef TQT_NO_TOOLBAR - if (ceData.widgetObjectTypes.contains("TQToolBar")) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetLayoutMargin, TQStyleWidgetActionRequestData(2)); - } -#endif - } - if (useHoveringHighlight) { - if ((ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQComboBox"))) { - installObjectEventHandler(ceData, elementFlags, ptr, this); - } - - if ((ceData.widgetObjectTypes.contains("TQScrollBar")) || (ceData.widgetObjectTypes.contains("TQSlider"))) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_EnableMouseTracking); - installObjectEventHandler(ceData, elementFlags, ptr, this); - } - } - - TQMotifStyle::polish(ceData, elementFlags, ptr); -} - - -/*! \reimp */ -void TQMotifPlusStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) -{ - removeObjectEventHandler(ceData, elementFlags, ptr, this); - TQMotifStyle::unPolish(ceData, elementFlags, ptr); -} - - -/*! \reimp */ -void TQMotifPlusStyle::applicationPolish(const TQStyleControlElementData&, ControlElementFlags, void *) -{ -} - - -/*! \reimp */ -void TQMotifPlusStyle::applicationUnPolish(const TQStyleControlElementData&, ControlElementFlags, void *) -{ -} - - -/*! \reimp */ -int TQMotifPlusStyle::pixelMetric(PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const -{ - int ret; - - switch (metric) { - case PM_ScrollBarExtent: - ret = 15; - break; - - case PM_ButtonDefaultIndicator: - ret = 5; - break; - - case PM_ButtonMargin: - ret = 4; - break; - - case PM_SliderThickness: - ret = 15; - break; - - case PM_IndicatorWidth: - case PM_IndicatorHeight: - ret = 10; - break; - - case PM_ExclusiveIndicatorWidth: - case PM_ExclusiveIndicatorHeight: - ret = 11; - break; - - case PM_MenuIndicatorFrameHBorder: - case PM_MenuIndicatorFrameVBorder: - case PM_MenuIconIndicatorFrameHBorder: - case PM_MenuIconIndicatorFrameVBorder: - ret = 2; - break; - - default: - ret = TQMotifStyle::pixelMetric(metric, ceData, elementFlags, widget); - break; - } - - return ret; -} - - -/*! \reimp */ -void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt ) const -{ - bool dis = ! (flags & Style_Enabled); - bool act = flags & Style_Active; - - switch (pe) { - case PE_HeaderSection: - - case PE_ButtonCommand: - case PE_ButtonBevel: - case PE_ButtonTool: - if (flags & (Style_Down | Style_On | Style_Raised | Style_Sunken)) - drawMotifPlusShade( p, r, cg, bool(flags & (Style_Down | Style_On)), - bool(flags & Style_MouseOver)); - else if (flags & Style_MouseOver) - p->fillRect(r, cg.brush(TQColorGroup::Midlight)); - else - p->fillRect(r, cg.brush(TQColorGroup::Button)); - break; - - case PE_Panel: - case PE_PanelPopup: - case PE_PanelMenuBar: - case PE_PanelDockWindow: - if ( opt.lineWidth() ) - drawMotifPlusShade( p, r, cg, (flags & Style_Sunken), (flags & Style_MouseOver)); - else if ( flags & Style_MouseOver ) - p->fillRect(r, cg.brush(TQColorGroup::Midlight)); - else - p->fillRect(r, cg.brush(TQColorGroup::Button)); - break; - - case PE_SpinWidgetUp: - drawPrimitive(PE_ArrowUp, p, ceData, elementFlags, r, cg, flags, opt); - break; - - case PE_SpinWidgetDown: - drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, r, cg, flags, opt); - break; - - case PE_Indicator: - { - TQBrush fill; - if (flags & Style_On) - fill = cg.brush(TQColorGroup::Mid); - else if (flags & Style_MouseOver) - fill = cg.brush(TQColorGroup::Midlight); - else - fill = cg.brush(TQColorGroup::Button); - - if (flags & Style_NoChange) { - qDrawPlainRect(p, r, cg.text(), 1, &fill); - p->drawLine(r.topRight(), r.bottomLeft()); - } else - drawMotifPlusShade(p, r, cg, (flags & Style_On), - (flags & Style_MouseOver), &fill); - break; - } - - case PE_ExclusiveIndicator: - { - TQPen oldpen = p->pen(); - TQPointArray thick(8); - TQPointArray thin(4); - TQColor button = ((flags & Style_MouseOver) ? cg.midlight() : cg.button()); - TQBrush brush = ((flags & Style_MouseOver) ? - cg.brush(TQColorGroup::Midlight) : - cg.brush(TQColorGroup::Button)); - int x, y, w, h; - r.rect(&x, &y, &w, &h); - - p->fillRect(x, y, w, h, brush); - - - if (flags & Style_On) { - thick.setPoint(0, x, y + (h / 2)); - thick.setPoint(1, x + (w / 2), y); - thick.setPoint(2, x + 1, y + (h / 2)); - thick.setPoint(3, x + (w / 2), y + 1); - thick.setPoint(4, x + (w / 2), y); - thick.setPoint(5, x + w - 1, y + (h / 2)); - thick.setPoint(6, x + (w / 2), y + 1); - thick.setPoint(7, x + w - 2, y + (h / 2)); - p->setPen(cg.dark()); - p->drawLineSegments(thick); - - thick.setPoint(0, x + 1, y + (h / 2) + 1); - thick.setPoint(1, x + (w / 2), y + h - 1); - thick.setPoint(2, x + 2, y + (h / 2) + 1); - thick.setPoint(3, x + (w / 2), y + h - 2); - thick.setPoint(4, x + (w / 2), y + h - 1); - thick.setPoint(5, x + w - 2, y + (h / 2) + 1); - thick.setPoint(6, x + (w / 2), y + h - 2); - thick.setPoint(7, x + w - 3, y + (h / 2) + 1); - p->setPen(cg.light()); - p->drawLineSegments(thick); - - thin.setPoint(0, x + 2, y + (h / 2)); - thin.setPoint(1, x + (w / 2), y + 2); - thin.setPoint(2, x + (w / 2), y + 2); - thin.setPoint(3, x + w - 3, y + (h / 2)); - p->setPen(TQt::black); - p->drawLineSegments(thin); - - thin.setPoint(0, x + 3, y + (h / 2) + 1); - thin.setPoint(1, x + (w / 2), y + h - 3); - thin.setPoint(2, x + (w / 2), y + h - 3); - thin.setPoint(3, x + w - 4, y + (h / 2) + 1); - p->setPen(cg.mid()); - p->drawLineSegments(thin); - } else { - thick.setPoint(0, x, y + (h / 2)); - thick.setPoint(1, x + (w / 2), y); - thick.setPoint(2, x + 1, y + (h / 2)); - thick.setPoint(3, x + (w / 2), y + 1); - thick.setPoint(4, x + (w / 2), y); - thick.setPoint(5, x + w - 1, y + (h / 2)); - thick.setPoint(6, x + (w / 2), y + 1); - thick.setPoint(7, x + w - 2, y + (h / 2)); - p->setPen(cg.light()); - p->drawLineSegments(thick); - - thick.setPoint(0, x + 2, y + (h / 2) + 1); - thick.setPoint(1, x + (w / 2), y + h - 2); - thick.setPoint(2, x + 3, y + (h / 2) + 1); - thick.setPoint(3, x + (w / 2), y + h - 3); - thick.setPoint(4, x + (w / 2), y + h - 2); - thick.setPoint(5, x + w - 3, y + (h / 2) + 1); - thick.setPoint(6, x + (w / 2), y + h - 3); - thick.setPoint(7, x + w - 4, y + (h / 2) + 1); - p->setPen(cg.dark()); - p->drawLineSegments(thick); - - thin.setPoint(0, x + 2, y + (h / 2)); - thin.setPoint(1, x + (w / 2), y + 2); - thin.setPoint(2, x + (w / 2), y + 2); - thin.setPoint(3, x + w - 3, y + (h / 2)); - p->setPen(button); - p->drawLineSegments(thin); - - thin.setPoint(0, x + 1, y + (h / 2) + 1); - thin.setPoint(1, x + (w / 2), y + h - 1); - thin.setPoint(2, x + (w / 2), y + h - 1); - thin.setPoint(3, x + w - 2, y + (h / 2) + 1); - p->setPen(TQt::black); - p->drawLineSegments(thin); - } - - p->setPen(oldpen); - break; - } - - - - case PE_ArrowDown: - case PE_ArrowLeft: - case PE_ArrowRight: - case PE_ArrowUp: - { - TQPen oldpen = p->pen(); - TQBrush oldbrush = p->brush(); - TQPointArray poly(3); - TQColor button = (flags & Style_MouseOver) ? cg.midlight() : cg.button(); - bool down = (flags & Style_Down); - int x, y, w, h; - r.rect(&x, &y, &w, &h); - - p->save(); - p->setBrush(button); - - switch (pe) { - case PE_ArrowUp: - { - poly.setPoint(0, x + (w / 2), y ); - poly.setPoint(1, x, y + h - 1); - poly.setPoint(2, x + w - 1, y + h - 1); - p->drawPolygon(poly); - - if (down) - p->setPen(button); - else - p->setPen(cg.dark()); - p->drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2); - - if (down) - p->setPen(cg.light()); - else - p->setPen(black); - p->drawLine(x, y + h - 1, x + w - 1, y + h - 1); - - if (down) - p->setPen(button); - else - p->setPen(cg.dark()); - p->drawLine(x + w - 2, y + h - 1, x + (w / 2), y + 1); - - if (down) - p->setPen(cg.light()); - else - p->setPen(black); - p->drawLine(x + w - 1, y + h - 1, x + (w / 2), y); - - if (down) - p->setPen(black); - else - p->setPen(button); - p->drawLine(x + (w / 2), y + 1, x + 1, y + h - 1); - - if (down) - p->setPen(cg.dark()); - else - p->setPen(cg.light()); - p->drawLine(x + (w / 2), y, x, y + h - 1); - break; - } - - case PE_ArrowDown: - { - poly.setPoint(0, x + w - 1, y); - poly.setPoint(1, x, y); - poly.setPoint(2, x + (w / 2), y + h - 1); - p->drawPolygon(poly); - - if (down) - p->setPen(black); - else - p->setPen(button); - p->drawLine(x + w - 2, y + 1, x + 1, y + 1); - - if (down) - p->setPen(cg.dark()); - else - p->setPen(cg.light()); - p->drawLine(x + w - 1, y, x, y); - - if (down) - p->setPen(black); - else - p->setPen(button); - p->drawLine(x + 1, y, x + (w / 2), y + h - 2); - - if (down) - p->setPen(cg.dark()); - else - p->setPen(cg.light()); - p->drawLine(x, y, x + (w / 2), y + h - 1); - - if (down) - p->setPen(button); - else - p->setPen(cg.dark()); - p->drawLine(x + (w / 2), y + h - 2, x + w - 2, y); - - if (down) - p->setPen(cg.light()); - else - p->setPen(black); - p->drawLine(x + (w / 2), y + h - 1, x + w - 1, y); - break; - } - - case PE_ArrowLeft: - { - poly.setPoint(0, x, y + (h / 2)); - poly.setPoint(1, x + w - 1, y + h - 1); - poly.setPoint(2, x + w - 1, y); - p->drawPolygon(poly); - - if (down) - p->setPen(button); - else - p->setPen(cg.dark()); - p->drawLine(x + 1, y + (h / 2), x + w - 1, y + h - 1); - - if (down) - p->setPen(cg.light()); - else - p->setPen(black); - p->drawLine(x, y + (h / 2), x + w - 1, y + h - 1); - - if (down) - p->setPen(button); - else - p->setPen(cg.dark()); - p->drawLine(x + w - 2, y + h - 1, x + w - 2, y + 1); - - if (down) - p->setPen(cg.light()); - else - p->setPen(black); - p->drawLine(x + w - 1, y + h - 1, x + w - 1, y); - - if (down) - p->setPen(black); - else - p->setPen(button); - p->drawLine(x + w - 1, y + 1, x + 1, y + (h / 2)); - - if (down) - p->setPen(cg.dark()); - else - p->setPen(cg.light()); - p->drawLine(x + w - 1, y, x, y + (h / 2)); - break; - } - - case PE_ArrowRight: - { - poly.setPoint(0, x + w - 1, y + (h / 2)); - poly.setPoint(1, x, y); - poly.setPoint(2, x, y + h - 1); - p->drawPolygon(poly); - - if (down) - p->setPen(black); - else - p->setPen(button); - p->drawLine( x + w - 1, y + (h / 2), x + 1, y + 1); - - if (down) - p->setPen(cg.dark()); - else - p->setPen(cg.light()); - p->drawLine(x + w - 1, y + (h / 2), x, y); - - if (down) - p->setPen(black); - else - p->setPen(button); - p->drawLine(x + 1, y + 1, x + 1, y + h - 2); - - if (down) - p->setPen(cg.dark()); - else - p->setPen(cg.light()); - p->drawLine(x, y, x, y + h - 1); - - if (down) - p->setPen(button); - else - p->setPen(cg.dark()); - p->drawLine(x + 1, y + h - 2, x + w - 1, y + (h / 2)); - - if (down) - p->setPen(cg.light()); - else - p->setPen(black); - p->drawLine(x, y + h - 1, x + w - 1, y + (h / 2)); - break; - } - - default: - break; - } - - p->restore(); - p->setBrush(oldbrush); - p->setPen(oldpen); - break; - } - - case PE_PanelScrollBar: - { - drawMotifPlusShade(p, r, cg, TRUE, FALSE, &cg.brush(TQColorGroup::Mid)); - break; - } - - case PE_MenuItemIndicatorFrame: - { - // Draw nothing - break; - } - case PE_MenuItemIndicatorIconFrame: - { - int x, y, w, h; - r.rect(&x, &y, &w, &h); - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - TQRect vrect = visualRect( TQRect( x+2, y+2, checkcol, h-2 ), r ); - - qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) ); - break; - } - - case PE_MenuItemIndicatorCheck: - { - int x, y, w, h; - r.rect(&x, &y, &w, &h); - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - TQRect vrect = visualRect( TQRect( x+2, y+2, checkcol, h-2 ), r ); - - SFlags cflags = Style_Default; - if (! dis) - cflags |= Style_Enabled; - if (act) - cflags |= Style_On; - - drawPrimitive(PE_CheckMark, p, ceData, elementFlags, vrect, cg, cflags); - break; - } - - default: - TQMotifStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); - break; - } -} - - -/*! \reimp -*/ -void TQMotifPlusStyle::drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt, - const TQWidget *widget) const -{ - switch (element) { - case CE_PushButton: - { -#ifndef TQT_NO_PUSHBUTTON - TQRect br = r; - int dbi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); - - if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { - if (elementFlags & CEF_IsDefault) - drawMotifPlusShade(p, br, cg, TRUE, FALSE, - &cg.brush(TQColorGroup::Background)); - - br.setCoords(br.left() + dbi, - br.top() + dbi, - br.right() - dbi, - br.bottom() - dbi); - } - - if (flags & Style_HasFocus) - br.addCoords(1, 1, -1, -1); - p->save(); - p->setBrushOrigin( -ceData.bgOffset.x(), - -ceData.bgOffset.y() ); - drawPrimitive(PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags); - p->restore(); -#endif - break; - } - - case CE_CheckBoxLabel: - { -#ifndef TQT_NO_CHECKBOX - if (flags & Style_MouseOver) { - TQRegion r(ceData.rect); - r -= visualRect(subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget), ceData, elementFlags); - p->setClipRegion(r); - p->fillRect(ceData.rect, cg.brush(TQColorGroup::Midlight)); - p->setClipping(FALSE); - } - - int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; - drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, - flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text); - - if (elementFlags & CEF_HasFocus) { - TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags); - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); - } -#endif - break; - } - - case CE_RadioButtonLabel: - { -#ifndef TQT_NO_RADIOBUTTON - if (flags & Style_MouseOver) { - TQRegion r(ceData.rect); - r -= visualRect(subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget), ceData, elementFlags); - p->setClipRegion(r); - p->fillRect(ceData.rect, cg.brush(TQColorGroup::Midlight)); - p->setClipping(FALSE); - } - - int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; - drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, - flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text); - - if (elementFlags & CEF_HasFocus) { - TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags); - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); - } -#endif - break; - } - - case CE_MenuBarItem: - { -#ifndef TQT_NO_MENUDATA - if (opt.isDefault()) - break; - - TQMenuItem *mi = opt.menuItem(); - if ((flags & Style_Enabled) && (flags & Style_Active)) - drawMotifPlusShade(p, r, cg, FALSE, TRUE); - else - p->fillRect(r, cg.button()); - - drawItem(p, r, AlignCenter | ShowPrefix | DontClip | SingleLine, - cg, flags & Style_Enabled, mi->pixmap(), mi->text(), -1, - &cg.buttonText()); -#endif - break; - } - - -#ifndef TQT_NO_POPUPMENU - case CE_PopupMenuItem: - { - if (! widget || opt.isDefault()) - break; - - TQMenuItem *mi = opt.menuItem(); - if ( !mi ) - break; - - int tab = opt.tabWidth(); - int maxpmw = opt.maxIconWidth(); - bool dis = ! (flags & Style_Enabled); - bool checkable = (elementFlags & CEF_IsCheckable); - bool act = flags & Style_Active; - int x, y, w, h; - - r.rect(&x, &y, &w, &h); - - if (checkable) - maxpmw = TQMAX(maxpmw, 15); - - int checkcol = maxpmw; - - if (mi && mi->isSeparator()) { - p->setPen( cg.dark() ); - p->drawLine( x, y, x+w, y ); - p->setPen( cg.light() ); - p->drawLine( x, y+1, x+w, y+1 ); - return; - } - - if ( act && !dis ) - drawMotifPlusShade(p, TQRect(x, y, w, h), cg, FALSE, TRUE); - else - p->fillRect(x, y, w, h, cg.brush( TQColorGroup::Button )); - - if ( !mi ) - return; - - TQRect vrect = visualRect( TQRect( x+2, y+2, checkcol, h-2 ), r ); - if ( mi->isChecked() ) { - if ( mi->iconSet() ) { - drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); - } - } else if ( !act ) { - p->fillRect(vrect, - cg.brush( TQColorGroup::Button )); - } - - if ( mi->iconSet() ) { // draw iconset - TQIconSet::Mode mode = (!dis) ? TQIconSet::Normal : TQIconSet::Disabled; - - if (act && !dis) - mode = TQIconSet::Active; - - TQPixmap pixmap; - if ( checkable && mi->isChecked() ) - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, - TQIconSet::On ); - else - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); - - int pixw = pixmap.width(); - int pixh = pixmap.height(); - - TQRect pmr( 0, 0, pixw, pixh ); - - pmr.moveCenter(vrect.center()); - - p->setPen( cg.text() ); - p->drawPixmap( pmr.topLeft(), pixmap ); - - } else if (checkable) { - if (mi->isChecked()) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); - } - } - - p->setPen( cg.buttonText() ); - - TQColor discol; - if (dis) { - discol = cg.text(); - p->setPen( discol ); - } - - vrect = visualRect( TQRect(x + checkcol + 4, y + 2, - w - checkcol - tab - 3, h - 4), r ); - if (mi->custom()) { - p->save(); - mi->custom()->paint(p, cg, act, !dis, vrect.x(), y + 2, - w - checkcol - tab - 3, h - 4); - p->restore(); - } - - TQString s = mi->text(); - if ( !s.isNull() ) { // draw text - int t = s.find( '\t' ); - int m = 2; - int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; - text_flags |= (TQApplication::reverseLayout() ? AlignRight : AlignLeft ); - if ( t >= 0 ) { // draw tab text - TQRect vr = visualRect( TQRect(x+w-tab-2-2, - y+m, tab, h-2*m), r ); - p->drawText( vr.x(), - y+m, tab, h-2*m, text_flags, s.mid( t+1 ) ); - } - p->drawText(vrect.x(), y + 2, w - checkcol -tab - 3, h - 4, - text_flags, s, t); - } else if (mi->pixmap()) { - TQPixmap *pixmap = mi->pixmap(); - - if (pixmap->depth() == 1) p->setBackgroundMode(OpaqueMode); - TQRect vr = visualRect( TQRect( x + checkcol + 2, y + 2, w - checkcol - 1, h - 4 ), r ); - p->drawPixmap(vr.x(), y + 2, *pixmap); - if (pixmap->depth() == 1) p->setBackgroundMode(TransparentMode); - } - - if (mi->popup()) { - int hh = h / 2; - TQStyle::PrimitiveElement arrow = (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight); - vrect = visualRect( TQRect(x + w - hh - 6, y + (hh / 2), hh, hh), r ); - drawPrimitive(arrow, p, - ceData, elementFlags, - vrect, cg, - ((act && !dis) ? - Style_Down : Style_Default) | - ((!dis) ? Style_Enabled : Style_Default)); - } - break; - } -#endif // TQT_NO_POPUPMENU - - case CE_TabBarTab: - { -#ifndef TQT_NO_TABBAR - bool selected = flags & Style_Selected; - - TQColorGroup g = ceData.colorGroup; - TQPen oldpen = p->pen(); - TQRect fr(r); - - if (! selected) { - if (ceData.tabBarData.shape == TQTabBar::RoundedAbove || - ceData.tabBarData.shape == TQTabBar::TriangularAbove) { - fr.setTop(fr.top() + 2); - } else { - fr.setBottom(fr.bottom() - 2); - } - } - - fr.setWidth(fr.width() - 3); - - p->fillRect(fr.left() + 1, fr.top() + 1, fr.width() - 2, fr.height() - 2, - (selected) ? cg.brush(TQColorGroup::Button) - : cg.brush(TQColorGroup::Mid)); - - if (ceData.tabBarData.shape == TQTabBar::RoundedAbove) { - // "rounded" tabs on top - fr.setBottom(fr.bottom() - 1); - - p->setPen(g.light()); - p->drawLine(fr.left(), fr.top() + 1, - fr.left(), fr.bottom() - 1); - p->drawLine(fr.left() + 1, fr.top(), - fr.right() - 1, fr.top()); - if (! selected) - p->drawLine(fr.left(), fr.bottom(), - fr.right() + 3, fr.bottom()); - - if (fr.left() == 0) - p->drawLine(fr.left(), fr.bottom(), - fr.left(), fr.bottom() + 1); - - p->setPen(g.dark()); - p->drawLine(fr.right() - 1, fr.top() + 2, - fr.right() - 1, fr.bottom() - 1); - - p->setPen(black); - p->drawLine(fr.right(), fr.top() + 1, - fr.right(), fr.bottom() - 1); - } else if (ceData.tabBarData.shape == TQTabBar::RoundedBelow) { - // "rounded" tabs on bottom - fr.setTop(fr.top() + 1); - - p->setPen(g.dark()); - p->drawLine(fr.right() + 3, fr.top() - 1, - fr.right() - 1, fr.top() - 1); - p->drawLine(fr.right() - 1, fr.top(), - fr.right() - 1, fr.bottom() - 2); - p->drawLine(fr.right() - 1, fr.bottom() - 2, - fr.left() + 2, fr.bottom() - 2); - if (! selected) { - p->drawLine(fr.right(), fr.top() - 1, - fr.left() + 1, fr.top() - 1); - - if (fr.left() != 0) - p->drawPoint(fr.left(), fr.top() - 1); - } - - p->setPen(black); - p->drawLine(fr.right(), fr.top(), - fr.right(), fr.bottom() - 2); - p->drawLine(fr.right() - 1, fr.bottom() - 1, - fr.left(), fr.bottom() - 1); - if (! selected) - p->drawLine(fr.right() + 3, fr.top(), - fr.left(), fr.top()); - else - p->drawLine(fr.right() + 3, fr.top(), - fr.right(), fr.top()); - - p->setPen(g.light()); - p->drawLine(fr.left(), fr.top() + 1, - fr.left(), fr.bottom() - 2); - - if (selected) { - p->drawPoint(fr.left(), fr.top()); - if (fr.left() == 0) - p->drawPoint(fr.left(), fr.top() - 1); - - p->setPen(g.button()); - p->drawLine(fr.left() + 2, fr.top() - 1, - fr.left() + 1, fr.top() - 1); - } - } else - // triangular drawing code - TQMotifStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); - - p->setPen(oldpen); -#endif - break; - } - - default: - TQMotifStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); - break; - } -} - - -/*! \reimp -*/ -TQRect TQMotifPlusStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const -{ - TQRect rect; - - switch (r) { - case SR_PushButtonFocusRect: - { -#ifndef TQT_NO_PUSHBUTTON - int dfi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); - - rect = ceData.rect; - if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) - rect.addCoords(dfi, dfi, -dfi, -dfi); -#endif - break; - } - - case SR_CheckBoxIndicator: - { - int h = pixelMetric( PM_IndicatorHeight, ceData, elementFlags ); - rect.setRect(( ceData.rect.height() - h ) / 2, - ( ceData.rect.height() - h ) / 2, - pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), h ); - break; - } - - case SR_RadioButtonIndicator: - { - int h = pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags ); - rect.setRect( ( ceData.rect.height() - h ) / 2, - ( ceData.rect.height() - h ) / 2, - pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), h ); - break; - } - - case SR_CheckBoxFocusRect: - case SR_RadioButtonFocusRect: - rect = ceData.rect; - break; - - case SR_ComboBoxFocusRect: - { -#ifndef TQT_NO_COMBOBOX - if (elementFlags & CEF_IsEditable) { - rect = querySubControlMetrics(CC_ComboBox, ceData, elementFlags, - SC_ComboBoxEditField, TQStyleOption::Default, widget); - rect.addCoords(-3, -3, 3, 3); - } else - rect = ceData.rect; -#endif - break; - } - - case SR_SliderFocusRect: - { -#ifndef TQT_NO_SLIDER - int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); - int x, y, wi, he; - - if ( ceData.orientation == Horizontal ) { - x = 0; - y = tickOffset; - wi = ceData.rect.width(); - he = thickness; - } else { - x = tickOffset; - y = 0; - wi = thickness; - he = ceData.rect.height(); - } - - rect.setRect(x, y, wi, he); -#endif - break; - } - - default: - rect = TQMotifStyle::subRect(r, ceData, elementFlags, widget); - break; - } - - return rect; -} - - -/*! \reimp */ -void TQMotifPlusStyle::drawComplexControl(ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - SCFlags controls, - SCFlags active, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch (control) { - case CC_ScrollBar: - { -#ifndef TQT_NO_SCROLLBAR - TQRect addline, subline, addpage, subpage, slider, first, last; - bool maxedOut = (ceData.minSteps == ceData.maxSteps); - - subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget); - addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget); - subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget); - addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget); - slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget); - first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget); - last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget); - - bool skipUpdate = FALSE; - if (singleton->hovering) { - if (addline.contains(singleton->mousePos)) { - skipUpdate = - (singleton->scrollbarElement == SC_ScrollBarAddLine); - singleton->scrollbarElement = SC_ScrollBarAddLine; - } else if (subline.contains(singleton->mousePos)) { - skipUpdate = - (singleton->scrollbarElement == SC_ScrollBarSubLine); - singleton->scrollbarElement = SC_ScrollBarSubLine; - } else if (slider.contains(singleton->mousePos)) { - skipUpdate = - (singleton->scrollbarElement == SC_ScrollBarSlider); - singleton->scrollbarElement = SC_ScrollBarSlider; - } else { - skipUpdate = - (singleton->scrollbarElement == 0); - singleton->scrollbarElement = 0; - } - } else - singleton->scrollbarElement = 0; - - if (skipUpdate && singleton->scrollbarElement == singleton->lastElement) - break; - - singleton->lastElement = singleton->scrollbarElement; - - if (controls == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | - SC_ScrollBarAddPage | SC_ScrollBarSubPage | - SC_ScrollBarFirst | SC_ScrollBarLast | SC_ScrollBarSlider)) - drawPrimitive(PE_PanelScrollBar, p, ceData, elementFlags, ceData.rect, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarLast) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : Style_Default)); - - if ((controls & SC_ScrollBarSubLine) && subline.isValid()) - drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, - ((active == SC_ScrollBarSubLine || - singleton->scrollbarElement == SC_ScrollBarSubLine) ? - Style_MouseOver: Style_Default) | - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarSubLine) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : Style_Default)); - if ((controls & SC_ScrollBarAddLine) && addline.isValid()) - drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, - ((active == SC_ScrollBarAddLine || - singleton->scrollbarElement == SC_ScrollBarAddLine) ? - Style_MouseOver: Style_Default) | - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarAddLine) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : Style_Default)); - if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) - drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarSubPage) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : Style_Default)); - if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) - drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarAddPage) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : Style_Default)); - if ((controls & SC_ScrollBarFirst) && first.isValid()) - drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarFirst) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : Style_Default)); - if ((controls & SC_ScrollBarLast) && last.isValid()) - drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, - ((maxedOut) ? Style_Default : Style_Enabled) | - ((active == SC_ScrollBarLast) ? - Style_Down : Style_Default) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : Style_Default)); - if ((controls & SC_ScrollBarSlider) && slider.isValid()) { - drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, - ((active == SC_ScrollBarSlider || - singleton->scrollbarElement == SC_ScrollBarSlider) ? - Style_MouseOver: Style_Default) | - ((maxedOut) ? Style_Default : Style_Enabled) | - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : Style_Default)); - - // ### perhaps this should not be able to accept focus if maxedOut? - if (elementFlags & CEF_HasFocus) { - TQRect fr(slider.x() + 2, slider.y() + 2, - slider.width() - 5, slider.height() - 5); - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default); - } - } -#endif - break; - } - - case CC_ComboBox: - { -#ifndef TQT_NO_COMBOBOX - TQRect editfield, arrow; - editfield = - visualRect(querySubControlMetrics(CC_ComboBox, - ceData, elementFlags, - SC_ComboBoxEditField, - opt, widget), ceData, elementFlags); - arrow = - visualRect(querySubControlMetrics(CC_ComboBox, - ceData, elementFlags, - SC_ComboBoxArrow, - opt, widget), ceData, elementFlags); - - if (elementFlags & CEF_IsEditable) { - if (controls & SC_ComboBoxEditField && editfield.isValid()) { - editfield.addCoords(-3, -3, 3, 3); - if (elementFlags & CEF_HasFocus) - editfield.addCoords(1, 1, -1, -1); - drawMotifPlusShade(p, editfield, cg, TRUE, FALSE, - ((elementFlags & CEF_IsEnabled) ? - &cg.brush(TQColorGroup::Base) : - &cg.brush(TQColorGroup::Background))); - } - - if (controls & SC_ComboBoxArrow && arrow.isValid()) { - drawMotifPlusShade(p, arrow, cg, (active == SC_ComboBoxArrow), - (flags & Style_MouseOver)); - - int space = (r.height() - 13) / 2; - arrow.addCoords(space, space, -space, -space); - - if (active == SC_ComboBoxArrow) - flags |= Style_Sunken; - drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags); - } - } else { - if (controls & SC_ComboBoxEditField && editfield.isValid()) { - editfield.addCoords(-3, -3, 3, 3); - if (elementFlags & CEF_HasFocus) - editfield.addCoords(1, 1, -1, -1); - drawMotifPlusShade(p, editfield, cg, FALSE, - (flags & Style_MouseOver)); - } - - if (controls & SC_ComboBoxArrow && arrow.isValid()) - drawMotifPlusShade(p, arrow, cg, FALSE, (flags & Style_MouseOver)); - } - - if ((elementFlags & CEF_HasFocus) || - ((elementFlags & CEF_IsEditable) && (ceData.comboBoxLineEditFlags & CEF_HasFocus))) { - TQRect fr = visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags); - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); - } -#endif - break; - } - - case CC_SpinWidget: - { -#ifndef TQT_NO_SPINWIDGET - SFlags flags = Style_Default; - - if (controls & SC_SpinWidgetFrame) - drawMotifPlusShade(p, r, cg, TRUE, FALSE, &cg.brush(TQColorGroup::Base)); - - if (controls & SC_SpinWidgetUp) { - flags = Style_Enabled; - if (active == SC_SpinWidgetUp ) - flags |= Style_Down; - - PrimitiveElement pe; - if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus ) - pe = PE_SpinWidgetPlus; - else - pe = PE_SpinWidgetUp; - - TQRect re = ceData.spinWidgetData.upRect; - TQColorGroup ucg = ceData.spinWidgetData.upEnabled ? cg : ceData.palette.disabled(); - drawPrimitive(pe, p, ceData, elementFlags, re, ucg, flags); - } - - if (controls & SC_SpinWidgetDown) { - flags = Style_Enabled; - if (active == SC_SpinWidgetDown ) - flags |= Style_Down; - - PrimitiveElement pe; - if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus ) - pe = PE_SpinWidgetMinus; - else - pe = PE_SpinWidgetDown; - - TQRect re = ceData.spinWidgetData.downRect; - TQColorGroup dcg = ceData.spinWidgetData.downEnabled ? cg : ceData.palette.disabled(); - drawPrimitive(pe, p, ceData, elementFlags, re, dcg, flags); - } -#endif - break; - } - - case CC_Slider: - { -#ifndef TQT_NO_SLIDER - bool mouseover = (flags & Style_MouseOver); - - TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, - opt, widget), - handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, - opt, widget); - - if ((controls & SC_SliderGroove) && groove.isValid()) { - drawMotifPlusShade(p, groove, cg, TRUE, FALSE, - &cg.brush(TQColorGroup::Mid)); - - if ( flags & Style_HasFocus ) { - TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget ); - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg, flags ); - } - } - - if ((controls & SC_SliderHandle) && handle.isValid()) { - if ((mouseover && handle.contains(singleton->mousePos)) || - singleton->sliderActive) - flags |= Style_MouseOver; - else - flags &= ~Style_MouseOver; - drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, handle, cg, flags | Style_Raised); - - if ( ceData.orientation == Horizontal ) { - TQCOORD mid = handle.x() + handle.width() / 2; - qDrawShadeLine( p, mid, handle.y() + 1, mid , - handle.y() + handle.height() - 3, - cg, TRUE, 1); - } else { - TQCOORD mid = handle.y() + handle.height() / 2; - qDrawShadeLine( p, handle.x() + 1, mid, - handle.x() + handle.width() - 3, mid, - cg, TRUE, 1); - } - } - - if (controls & SC_SliderTickmarks) - TQMotifStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, - SC_SliderTickmarks, active, opt, widget); -#endif - break; - } - - default: - TQMotifStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, - controls, active, opt, widget); - } -} - - -/*! \reimp -*/ -TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl subcontrol, - const TQStyleOption& opt, - const TQWidget *widget) const -{ - switch (control) { - case CC_SpinWidget: { - int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, 0 ); - TQSize bs; - bs.setHeight( (ceData.rect.height() + 1)/2 ); - if ( bs.height() < 10 ) - bs.setHeight( 10 ); - bs.setWidth( bs.height() ); // 1.6 -approximate golden mean - bs = bs.expandedTo( TQApplication::globalStrut() ); - int y = 0; - int x, lx, rx, h; - x = ceData.rect.width() - y - bs.width(); - lx = fw; - rx = x - fw * 2; - h = bs.height() * 2; - - switch ( subcontrol ) { - case SC_SpinWidgetUp: - return TQRect(x + 1, y, bs.width(), bs.height() - 1); - case SC_SpinWidgetDown: - return TQRect(x + 1, y + bs.height() + 1, bs.width(), bs.height()); - case SC_SpinWidgetButtonField: - return TQRect(x, y, bs.width(), h - 2*fw); - case SC_SpinWidgetEditField: - return TQRect(lx, fw, rx, h - 2*fw); - case SC_SpinWidgetFrame: - return TQRect( 0, 0, ceData.rect.width() - bs.width(), h); - default: - break; - } - break; } - -#ifndef TQT_NO_COMBOBOX - case CC_ComboBox: { - if (elementFlags & CEF_IsEditable) { - int space = (ceData.rect.height() - 13) / 2; - switch (subcontrol) { - case SC_ComboBoxFrame: - return TQRect(); - case SC_ComboBoxEditField: { - TQRect rect = ceData.rect; - rect.setWidth(rect.width() - 13 - space * 2); - rect.addCoords(3, 3, -3, -3); - return rect; } - case SC_ComboBoxArrow: - return TQRect(ceData.rect.width() - 13 - space * 2, 0, - 13 + space * 2, ceData.rect.height()); - default: break; // shouldn't get here - } - - } else { - int space = (ceData.rect.height() - 7) / 2; - switch (subcontrol) { - case SC_ComboBoxFrame: - return TQRect(); - case SC_ComboBoxEditField: { - TQRect rect = ceData.rect; - rect.addCoords(3, 3, -3, -3); - return rect; } - case SC_ComboBoxArrow: // 12 wide, 7 tall - return TQRect(ceData.rect.width() - 12 - space, space, 12, 7); - default: break; // shouldn't get here - } - } - break; } -#endif - -#ifndef TQT_NO_SLIDER - case CC_Slider: { - - if (subcontrol == SC_SliderHandle) { - int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); - int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ) + 2; - int sliderPos = ceData.startStep; - int motifBorder = 2; - - if ( ceData.orientation == Horizontal ) - return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len, - thickness - 2*motifBorder ); - return TQRect( tickOffset + motifBorder, sliderPos + motifBorder, - thickness - 2*motifBorder, len); - } - break; } -#endif - default: break; - } - return TQMotifStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); -} - - -/*! \reimp */ -bool TQMotifPlusStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *event ) -{ - switch(event->type()) { - case TQEvent::MouseButtonPress: - { - singleton->mousePressed = TRUE; - - if (!ceData.widgetObjectTypes.contains("TQSlider")) - break; - - singleton->sliderActive = TRUE; - break; - } - - case TQEvent::MouseButtonRelease: - { - singleton->mousePressed = FALSE; - - if (!ceData.widgetObjectTypes.contains("TQSlider")) - break; - - singleton->sliderActive = FALSE; - widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); - break; - } - - case TQEvent::Enter: - { - if (!ceData.widgetObjectTypes.contains("TQWidget")) - break; - - widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); - break; - } - - case TQEvent::Leave: - { - if (!ceData.widgetObjectTypes.contains("TQWidget")) - break; - - widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); - break; - } - - case TQEvent::MouseMove: - { - if ((!ceData.widgetObjectTypes.contains("TQWidget"))) - break; - - if ((!ceData.widgetObjectTypes.contains("TQScrollBar")) && (!ceData.widgetObjectTypes.contains("TQSlider"))) - break; - - singleton->mousePos = ((TQMouseEvent *) event)->pos(); - if (! singleton->mousePressed) { - singleton->hovering = TRUE; - widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); - singleton->hovering = FALSE; - } - - break; - } - - default: - break; - } - - return TQMotifStyle::objectEventHandler(ceData, elementFlags, source, event); -} - - -/*! \reimp */ -int TQMotifPlusStyle::styleHint(StyleHint hint, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption &opt, - TQStyleHintReturn *returnData, - const TQWidget *widget) const -{ - int ret; - switch (hint) { - case SH_PopupMenu_MouseTracking: - ret = 1; - break; - case SH_MenuIndicatorColumnWidth: - { - int maxpmw = opt.maxIconWidth(); - bool checkable = (elementFlags & CEF_IsCheckable); - - if (checkable) - maxpmw = TQMAX(maxpmw, 15); - - ret = maxpmw; - break; - } - default: - ret = TQMotifStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); - break; - } - return ret; -} - - -#endif // TQT_NO_STYLE_MOTIFPLUS diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp deleted file mode 100644 index 5447295e6..000000000 --- a/src/styles/qmotifstyle.cpp +++ /dev/null @@ -1,2416 +0,0 @@ -/**************************************************************************** -** -** Implementation of Motif-like style class -** -** Created : 981231 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqmotifstyle.h" - -#if !defined(TQT_NO_STYLE_MOTIF) || defined(QT_PLUGIN) - -#include "tqpopupmenu.h" -#include "ntqapplication.h" -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqpixmap.h" -#include "tqpalette.h" -#include "tqwidget.h" -#include "tqpushbutton.h" -#include "tqscrollbar.h" -#include "tqtabbar.h" -#include "tqtabwidget.h" -#include "tqlistview.h" -#include "ntqsplitter.h" -#include "tqslider.h" -#include "tqcombobox.h" -#include "ntqdockwindow.h" -#include "ntqdockarea.h" -#include "tqprogressbar.h" -#include "tqimage.h" -#include - - - -// old constants that might still be useful... -static const int motifItemFrame = 2; // menu item frame width -static const int motifSepHeight = 2; // separator item height -static const int motifItemHMargin = 3; // menu item hor text margin -static const int motifItemVMargin = 2; // menu item ver text margin -static const int motifArrowHMargin = 6; // arrow horizontal margin -static const int motifTabSpacing = 12; // space between text and tab -static const int motifCheckMarkHMargin = 2; // horiz. margins of check mark -static const int motifCheckMarkSpace = 12; - - -/*! - \class TQMotifStyle ntqmotifstyle.h - \brief The TQMotifStyle class provides Motif look and feel. - - \ingroup appearance - - This class implements the Motif look and feel. It closely - resembles the original Motif look as defined by the Open Group, - but with some minor improvements. The Motif style is TQt's default - GUI style on UNIX platforms. -*/ - -/*! - Constructs a TQMotifStyle. - - If \a useHighlightCols is FALSE (the default), the style will - polish the application's color palette to emulate the Motif way of - highlighting, which is a simple inversion between the base and the - text color. -*/ -TQMotifStyle::TQMotifStyle( bool useHighlightCols ) : TQCommonStyle() -{ - highlightCols = useHighlightCols; -} - -/*!\reimp -*/ -TQMotifStyle::~TQMotifStyle() -{ -} - -/*! - If \a arg is FALSE, the style will polish the application's color - palette to emulate the Motif way of highlighting, which is a - simple inversion between the base and the text color. - - The effect will show up the next time an application palette is - set via TQApplication::setPalette(). The current color palette of - the application remains unchanged. - - \sa TQStyle::polish() -*/ -void TQMotifStyle::setUseHighlightColors( bool arg ) -{ - highlightCols = arg; -} - -/*! - Returns TRUE if the style treats the highlight colors of the - palette in a Motif-like manner, which is a simple inversion - between the base and the text color; otherwise returns FALSE. The - default is FALSE. -*/ -bool TQMotifStyle::useHighlightColors() const -{ - return highlightCols; -} - -/*! \reimp */ - -void TQMotifStyle::polish( TQPalette& pal ) -{ - if ( pal.active().light() == pal.active().base() ) { - TQColor nlight = pal.active().light().dark(108 ); - pal.setColor( TQPalette::Active, TQColorGroup::Light, nlight ) ; - pal.setColor( TQPalette::Disabled, TQColorGroup::Light, nlight ) ; - pal.setColor( TQPalette::Inactive, TQColorGroup::Light, nlight ) ; - } - - if ( highlightCols ) - return; - - // force the ugly motif way of highlighting *sigh* - TQColorGroup disabled = pal.disabled(); - TQColorGroup active = pal.active(); - - pal.setColor( TQPalette::Active, TQColorGroup::Highlight, - active.text() ); - pal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, - active.base()); - pal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, - disabled.text() ); - pal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, - disabled.base() ); - pal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, - active.text() ); - pal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, - active.base() ); -} - -/*! - \reimp - \internal - Keep TQStyle::polish() visible. -*/ -void TQMotifStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ - TQStyle::polish(ceData, elementFlags, ptr); -} - -/*! - \reimp - \internal - Keep TQStyle::polish() visible. -*/ -void TQMotifStyle::applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ - TQStyle::applicationPolish(ceData, elementFlags, ptr); -} - -static void rot(TQPointArray& a, int n) -{ - TQPointArray r(a.size()); - for (int i = 0; i < (int)a.size(); i++) { - switch (n) { - case 1: r.setPoint(i,-a[i].y(),a[i].x()); break; - case 2: r.setPoint(i,-a[i].x(),-a[i].y()); break; - case 3: r.setPoint(i,a[i].y(),-a[i].x()); break; - } - } - a = r; -} - - -/*!\reimp -*/ -void TQMotifStyle::drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt ) const -{ - bool dis = ! (flags & Style_Enabled); - bool act = flags & Style_Active; - - switch( pe ) { -#ifndef TQT_NO_LISTVIEW - case PE_CheckListExclusiveIndicator: { - TQCheckListItem *item = opt.checkListItem(); - TQListView *lv = item->listView(); - if(!item) - return; - - if ( item->isEnabled() ) - p->setPen( TQPen( cg.text() ) ); - else - p->setPen( TQPen( lv->palette().color( TQPalette::Disabled, TQColorGroup::Text ) ) ); - TQPointArray a; - - int cx = r.width()/2 - 1; - int cy = r.height()/2; - int e = r.width()/2 - 1; - for ( int i = 0; i < 3; i++ ) { //penWidth 2 doesn't quite work - a.setPoints( 4, cx-e, cy, cx, cy-e, cx+e, cy, cx, cy+e ); - p->drawPolygon( a ); - e--; - } - if ( item->isOn() ) { - if ( item->isEnabled() ) - p->setPen( TQPen( cg.text()) ); - else - p->setPen( TQPen( item->listView()->palette().color( TQPalette::Disabled, - TQColorGroup::Text ) ) ); - TQBrush saveBrush = p->brush(); - p->setBrush( cg.text() ); - e = e - 2; - a.setPoints( 4, cx-e, cy, cx, cy-e, cx+e, cy, cx, cy+e ); - p->drawPolygon( a ); - p->setBrush( saveBrush ); - } - break; } -#endif - case PE_ButtonCommand: - case PE_ButtonBevel: - case PE_ButtonTool: - case PE_HeaderSection: - qDrawShadePanel( p, r, cg, bool(flags & (Style_Down | Style_On )), - pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags), - &cg.brush(TQColorGroup::Button) ); - break; - - case PE_Indicator: { -#ifndef TQT_NO_BUTTON - bool on = flags & Style_On; - bool down = flags & Style_Down; - bool showUp = !( down ^ on ); - TQBrush fill = showUp || flags & Style_NoChange ? cg.brush( TQColorGroup::Button ) : cg.brush(TQColorGroup::Mid ); - if ( flags & Style_NoChange ) { - qDrawPlainRect( p, r, cg.text(), - 1, &fill ); - p->drawLine( r.x() + r.width() - 1, r.y(), - r.x(), r.y() + r.height() - 1); - } else - qDrawShadePanel( p, r, cg, !showUp, - pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags), &fill ); -#endif - break; - } - - case PE_ExclusiveIndicator: - { -#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2) - TQCOORD inner_pts[] = { // used for filling diamond - 2,r.height()/2, - r.width()/2,2, - r.width()-3,r.height()/2, - r.width()/2,r.height()-3 - }; - TQCOORD top_pts[] = { // top (^) of diamond - 0,r.height()/2, - r.width()/2,0, - r.width()-2,r.height()/2-1, - r.width()-3,r.height()/2-1, - r.width()/2,1, - 1,r.height()/2, - 2,r.height()/2, - r.width()/2,2, - r.width()-4,r.height()/2-1 - }; - TQCOORD bottom_pts[] = { // bottom (v) of diamond - 1,r.height()/2+1, - r.width()/2,r.height()-1, - r.width()-1,r.height()/2, - r.width()-2,r.height()/2, - r.width()/2,r.height()-2, - 2,r.height()/2+1, - 3,r.height()/2+1, - r.width()/2,r.height()-3, - r.width()-3,r.height()/2 - }; - bool on = flags & Style_On; - bool down = flags & Style_Down; - bool showUp = !(down ^ on ); - TQPointArray a( TQCOORDARRLEN(inner_pts), inner_pts ); - p->eraseRect( r ); - p->setPen( NoPen ); - p->setBrush( showUp ? cg.brush( TQColorGroup::Button ) : - cg.brush( TQColorGroup::Mid ) ); - a.translate( r.x(), r.y() ); - p->drawPolygon( a ); - p->setPen( showUp ? cg.light() : cg.dark() ); - p->setBrush( NoBrush ); - a.setPoints( TQCOORDARRLEN(top_pts), top_pts ); - a.translate( r.x(), r.y() ); - p->drawPolyline( a ); - p->setPen( showUp ? cg.dark() : cg.light() ); - a.setPoints( TQCOORDARRLEN(bottom_pts), bottom_pts ); - a.translate( r.x(), r.y() ); - p->drawPolyline( a ); - - break; - } - - case PE_ExclusiveIndicatorMask: - { - static TQCOORD inner_pts[] = { // used for filling diamond - 0,r.height()/2, - r.width()/2,0, - r.width()-1,r.height()/2, - r.width()/2,r.height()-1 - }; - TQPointArray a(TQCOORDARRLEN(inner_pts), inner_pts); - p->setPen(color1); - p->setBrush(color1); - a.translate(r.x(), r.y()); - p->drawPolygon(a); - break; - } - - case PE_ArrowUp: - case PE_ArrowDown: - case PE_ArrowRight: - case PE_ArrowLeft: - { - TQRect rect = r; - TQPointArray bFill; - TQPointArray bTop; - TQPointArray bBot; - TQPointArray bLeft; - bool vertical = pe == PE_ArrowUp || pe == PE_ArrowDown; - bool horizontal = !vertical; - int dim = rect.width() < rect.height() ? rect.width() : rect.height(); - int colspec = 0x0000; - - if ( dim < 2 ) - break; - - // adjust size and center (to fix rotation below) - if ( rect.width() > dim ) { - rect.setX( rect.x() + ((rect.width() - dim ) / 2) ); - rect.setWidth( dim ); - } - if ( rect.height() > dim ) { - rect.setY( rect.y() + ((rect.height() - dim ) / 2 )); - rect.setHeight( dim ); - } - - if ( dim > 3 ) { - if ( dim > 6 ) - bFill.resize( dim & 1 ? 3 : 4 ); - bTop.resize( (dim/2)*2 ); - bBot.resize( dim & 1 ? dim + 1 : dim ); - bLeft.resize( dim > 4 ? 4 : 2 ); - bLeft.putPoints( 0, 2, 0,0, 0,dim-1 ); - if ( dim > 4 ) - bLeft.putPoints( 2, 2, 1,2, 1,dim-3 ); - bTop.putPoints( 0, 4, 1,0, 1,1, 2,1, 3,1 ); - bBot.putPoints( 0, 4, 1,dim-1, 1,dim-2, 2,dim-2, 3,dim-2 ); - - for( int i=0; i 6 ) { // dim>6: must fill interior - bFill.putPoints( 0, 2, 1,dim-3, 1,2 ); - if ( dim & 1 ) // if size is an odd number - bFill.setPoint( 2, dim - 3, dim / 2 ); - else - bFill.putPoints( 2, 2, dim-4,dim/2-1, dim-4,dim/2 ); - } - } - else { - if ( dim == 3 ) { // 3x3 arrow pattern - bLeft.setPoints( 4, 0,0, 0,2, 1,1, 1,1 ); - bTop .setPoints( 2, 1,0, 1,0 ); - bBot .setPoints( 2, 1,2, 2,1 ); - } - else { // 2x2 arrow pattern - bLeft.setPoints( 2, 0,0, 0,1 ); - bTop .setPoints( 2, 1,0, 1,0 ); - bBot .setPoints( 2, 1,1, 1,1 ); - } - } - - // We use rot() and translate() as it is more efficient that - // matrix transformations on the painter, and because it still - // works with TQT_NO_TRANSFORMATIONS defined. - - if ( pe == PE_ArrowUp || pe == PE_ArrowLeft ) { - if ( vertical ) { - rot(bFill,3); - rot(bLeft,3); - rot(bTop,3); - rot(bBot,3); - bFill.translate( 0, rect.height() - 1 ); - bLeft.translate( 0, rect.height() - 1 ); - bTop.translate( 0, rect.height() - 1 ); - bBot.translate( 0, rect.height() - 1 ); - } else { - rot(bFill,2); - rot(bLeft,2); - rot(bTop,2); - rot(bBot,2); - bFill.translate( rect.width() - 1, rect.height() - 1 ); - bLeft.translate( rect.width() - 1, rect.height() - 1 ); - bTop.translate( rect.width() - 1, rect.height() - 1 ); - bBot.translate( rect.width() - 1, rect.height() - 1 ); - } - if ( flags & Style_Down ) - colspec = horizontal ? 0x2334 : 0x2343; - else - colspec = horizontal ? 0x1443 : 0x1434; - } else { - if ( vertical ) { - rot(bFill,1); - rot(bLeft,1); - rot(bTop,1); - rot(bBot,1); - bFill.translate( rect.width() - 1, 0 ); - bLeft.translate( rect.width() - 1, 0 ); - bTop.translate( rect.width() - 1, 0 ); - bBot.translate( rect.width() - 1, 0 ); - } - if ( flags & Style_Down ) - colspec = horizontal ? 0x2443 : 0x2434; - else - colspec = horizontal ? 0x1334 : 0x1343; - } - bFill.translate( rect.x(), rect.y() ); - bLeft.translate( rect.x(), rect.y() ); - bTop.translate( rect.x(), rect.y() ); - bBot.translate( rect.x(), rect.y() ); - - TQColor *cols[5]; - if ( flags & Style_Enabled ) { - cols[0] = 0; - cols[1] = (TQColor *)&cg.button(); - cols[2] = (TQColor *)&cg.mid(); - cols[3] = (TQColor *)&cg.light(); - cols[4] = (TQColor *)&cg.dark(); - } else { - cols[0] = 0; - cols[1] = (TQColor *)&cg.button(); - cols[2] = (TQColor *)&cg.button(); - cols[3] = (TQColor *)&cg.button(); - cols[4] = (TQColor *)&cg.button(); - } - -#define CMID *cols[ (colspec>>12) & 0xf ] -#define CLEFT *cols[ (colspec>>8) & 0xf ] -#define CTOP *cols[ (colspec>>4) & 0xf ] -#define CBOT *cols[ colspec & 0xf ] - - TQPen savePen = p->pen(); - TQBrush saveBrush = p->brush(); - TQPen pen( NoPen ); - TQBrush brush = cg.brush( flags & Style_Enabled ? TQColorGroup::Button : - TQColorGroup::Mid ); - p->setPen( pen ); - p->setBrush( brush ); - p->drawPolygon( bFill ); - p->setBrush( NoBrush ); - - p->setPen( CLEFT ); - p->drawLineSegments( bLeft ); - p->setPen( CTOP ); - p->drawLineSegments( bTop ); - p->setPen( CBOT ); - p->drawLineSegments( bBot ); - - p->setBrush( saveBrush ); - p->setPen( savePen ); -#undef CMID -#undef CLEFT -#undef CTOP -#undef CBOT - break; - } - - case PE_SpinWidgetPlus: - case PE_SpinWidgetMinus: - { - p->save(); - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ); - TQRect br; - br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, - r.height() - fw*2 ); - - if ( flags & Style_Sunken ) - p->fillRect( r, cg.brush( TQColorGroup::Dark ) ); - else - p->fillRect( r, cg.brush( TQColorGroup::Button ) ); - - p->setPen( cg.buttonText() ); - p->setBrush( cg.buttonText() ); - - int length; - int x = r.x(), y = r.y(), w = r.width(), h = r.height(); - if ( w <= 8 || h <= 6 ) - length = TQMIN( w-2, h-2 ); - else - length = TQMIN( 2*w / 3, 2*h / 3 ); - - if ( !(length & 1) ) - length -=1; - int xmarg = ( w - length ) / 2; - int ymarg = ( h - length ) / 2; - - p->drawLine( x + xmarg, ( y + h / 2 - 1 ), - x + xmarg + length - 1, ( y + h / 2 - 1 ) ); - if ( pe == PE_SpinWidgetPlus ) - p->drawLine( ( x+w / 2 ) - 1, y + ymarg, - ( x+w / 2 ) - 1, y + ymarg + length - 1 ); - p->restore(); - break; - } - - case PE_SpinWidgetUp: - case PE_SpinWidgetDown: - { - p->save(); - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ); - TQRect br; - br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, - r.height() - fw*2 ); - if ( flags & Style_Sunken ) - p->fillRect( br, cg.brush( TQColorGroup::Mid ) ); - else - p->fillRect( br, cg.brush( TQColorGroup::Button ) ); - - int x = r.x(), y = r.y(), w = r.width(), h = r.height(); - int sw = w-4; - if ( sw < 3 ) - return; - else if ( !(sw & 1) ) - sw--; - sw -= ( sw / 7 ) * 2; // Empty border - int sh = sw/2 + 2; // Must have empty row at foot of arrow - - int sx = x + w / 2 - sw / 2 - 1; - int sy = y + h / 2 - sh / 2 - 1; - - TQPointArray a; - if ( pe == PE_SpinWidgetDown ) - a.setPoints( 3, 0, 1, sw-1, 1, sh-2, sh-1 ); - else - a.setPoints( 3, 0, sh-1, sw-1, sh-1, sh-2, 1 ); - int bsx = 0; - int bsy = 0; - if ( flags & Style_Sunken ) { - bsx = pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags); - bsy = pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags); - } - p->translate( sx + bsx, sy + bsy ); - p->setPen( cg.buttonText() ); - p->setBrush( cg.buttonText() ); - p->drawPolygon( a ); - p->restore(); - break; - } - - case PE_DockWindowHandle: - { - p->save(); - p->translate( r.x(), r.y() ); - - TQColor dark( cg.dark() ); - TQColor light( cg.light() ); - unsigned int i; - if ( flags & Style_Horizontal ) { - int h = r.height(); - if ( h > 6 ) { - if ( flags & Style_On ) - p->fillRect( 1, 1, 8, h - 2, cg.highlight() ); - TQPointArray a( 2 * ((h-6)/3) ); - int y = 3 + (h%3)/2; - p->setPen( dark ); - p->drawLine( 8, 1, 8, h-2 ); - for( i=0; 2*i < a.size(); i ++ ) { - a.setPoint( 2*i, 5, y+1+3*i ); - a.setPoint( 2*i+1, 2, y+2+3*i ); - } - p->drawPoints( a ); - p->setPen( light ); - p->drawLine( 9, 1, 9, h-2 ); - for( i=0; 2*i < a.size(); i++ ) { - a.setPoint( 2*i, 4, y+3*i ); - a.setPoint( 2*i+1, 1, y+1+3*i ); - } - p->drawPoints( a ); - // if ( drawBorder ) { - // p->setPen( TQPen( TQt::darkGray ) ); - // p->drawLine( 0, r.height() - 1, - // tbExtent, r.height() - 1 ); - // } - } - } else { - int w = r.width(); - if ( w > 6 ) { - if ( flags & Style_On ) - p->fillRect( 1, 1, w - 2, 9, cg.highlight() ); - TQPointArray a( 2 * ((w-6)/3) ); - - int x = 3 + (w%3)/2; - p->setPen( dark ); - p->drawLine( 1, 8, w-2, 8 ); - for( i=0; 2*i < a.size(); i ++ ) { - a.setPoint( 2*i, x+1+3*i, 6 ); - a.setPoint( 2*i+1, x+2+3*i, 3 ); - } - p->drawPoints( a ); - p->setPen( light ); - p->drawLine( 1, 9, w-2, 9 ); - for( i=0; 2*i < a.size(); i++ ) { - a.setPoint( 2*i, x+3*i, 5 ); - a.setPoint( 2*i+1, x+1+3*i, 2 ); - } - p->drawPoints( a ); - // if ( drawBorder ) { - // p->setPen( TQPen( TQt::darkGray ) ); - // p->drawLine( r.width() - 1, 0, - // r.width() - 1, tbExtent ); - // } - } - } - p->restore(); - break; - } - - case PE_Splitter: - if (flags & Style_Horizontal) - flags &= ~Style_Horizontal; - else - flags |= Style_Horizontal; - // fall through intended - - case PE_DockWindowResizeHandle: - { - const int motifOffset = 10; - int sw = pixelMetric( PM_SplitterWidth, ceData, elementFlags ); - if ( flags & Style_Horizontal ) { - TQCOORD yPos = r.y() + r.height() / 2; - TQCOORD kPos = r.width() - motifOffset - sw; - TQCOORD kSize = sw - 2; - - qDrawShadeLine( p, 0, yPos, kPos, yPos, cg ); - qDrawShadePanel( p, kPos, yPos - sw / 2 + 1, kSize, kSize, - cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) ); - qDrawShadeLine( p, kPos + kSize - 1, yPos, r.width(), yPos, cg ); - } else { - TQCOORD xPos = r.x() + r.width() / 2; - TQCOORD kPos = motifOffset; - TQCOORD kSize = sw - 2; - - qDrawShadeLine( p, xPos, kPos + kSize - 1, xPos, r.height(), cg ); - qDrawShadePanel( p, xPos - sw / 2 + 1, kPos, kSize, kSize, cg, - FALSE, 1, &cg.brush( TQColorGroup::Button ) ); - qDrawShadeLine( p, xPos, 0, xPos, kPos, cg ); - } - break; - } - - case PE_CheckMark: - { - const int markW = 6; - const int markH = 6; - int posX = r.x() + ( r.width() - markW ) / 2 - 1; - int posY = r.y() + ( r.height() - markH ) / 2; - int dfw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags); - - if (dfw < 2) { - // Could do with some optimizing/caching... - TQPointArray a( 7*2 ); - int i, xx, yy; - xx = posX; - yy = 3 + posY; - for ( i=0; i<3; i++ ) { - a.setPoint( 2*i, xx, yy ); - a.setPoint( 2*i+1, xx, yy+2 ); - xx++; yy++; - } - yy -= 2; - for ( i=3; i<7; i++ ) { - a.setPoint( 2*i, xx, yy ); - a.setPoint( 2*i+1, xx, yy+2 ); - xx++; yy--; - } - if ( ! (flags & Style_Enabled) && ! (flags & Style_On) ) { - int pnt; - p->setPen( cg.highlightedText() ); - TQPoint offset(1,1); - for ( pnt = 0; pnt < (int)a.size(); pnt++ ) - a[pnt] += offset; - p->drawLineSegments( a ); - for ( pnt = 0; pnt < (int)a.size(); pnt++ ) - a[pnt] -= offset; - } - p->setPen( cg.text() ); - p->drawLineSegments( a ); - - qDrawShadePanel( p, posX-2, posY-2, markW+4, markH+6, cg, TRUE, dfw); - } else - qDrawShadePanel( p, posX, posY, markW, markH, cg, TRUE, dfw, - &cg.brush( TQColorGroup::Mid ) ); - - break; - } - - case PE_ScrollBarSubLine: - drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), - p, ceData, elementFlags, r, cg, Style_Enabled | flags); - break; - - case PE_ScrollBarAddLine: - drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), - p, ceData, elementFlags, r, cg, Style_Enabled | flags); - break; - - case PE_ScrollBarSubPage: - case PE_ScrollBarAddPage: - p->fillRect(r, cg.brush(TQColorGroup::Mid)); - break; - - case PE_ScrollBarSlider: - drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, - (flags | Style_Raised) & ~Style_Down); - break; - - case PE_ProgressBarChunk: - p->fillRect( r.x(), r.y() + 2, r.width() - 2, - r.height() - 4, cg.brush(TQColorGroup::Highlight)); - break; - - case PE_PanelScrollBar: - qDrawShadePanel(p, r, cg, TRUE, - pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags), - &cg.brush(TQColorGroup::Mid)); - break; - - case PE_MenuItemIndicatorFrame: - { - // Draw nothing - break; - } - - case PE_MenuItemIndicatorIconFrame: - { - int x, y, w, h; - r.rect( &x, &y, &w, &h ); - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r ); - int xvis = vrect.x(); - - qDrawShadePanel( p, xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) ); - break; - } - - case PE_MenuItemIndicatorCheck: - { - int x, y, w, h; - r.rect( &x, &y, &w, &h ); - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r ); - int xvis = vrect.x(); - int mw = checkcol; - int mh = h - 2*motifItemFrame; - - SFlags cflags = Style_Default; - if (! dis) - cflags |= Style_Enabled; - if (act) - cflags |= Style_On; - - drawPrimitive(PE_CheckMark, p, ceData, elementFlags, TQRect(xvis, y+motifItemFrame, mw, mh), cg, cflags); - break; - } - - default: - TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); - break; - } -} - - -/*!\reimp -*/ -void TQMotifStyle::drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch( element ) { - case CE_PushButton: - { -#ifndef TQT_NO_PUSHBUTTON - int diw, x1, y1, x2, y2; - TQColorGroup newCg = cg; - p->setPen( cg.foreground() ); - p->setBrush( TQBrush( cg.button(), NoBrush ) ); - diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags ); - r.coords( &x1, &y1, &x2, &y2 ); - if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { - x1 += diw; - y1 += diw; - x2 -= diw; - y2 -= diw; - } - TQBrush fill; - if ( elementFlags & CEF_IsDown ) - fill = newCg.brush( TQColorGroup::Mid ); - else if ( elementFlags & CEF_IsOn ) - fill = TQBrush( newCg.mid(), Dense4Pattern ); - else - fill = newCg.brush( TQColorGroup::Button ); - - newCg.setBrush( TQColorGroup::Button, fill ); - if ( elementFlags & CEF_IsDefault ) { - if ( diw == 0 ) { - TQPointArray a; - a.setPoints( 9, - x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1, - x2-1, y1+1, x2-1, y2-1, x1+1, y2-1, x1+1, y1+1 ); - p->setPen( newCg.shadow() ); - p->drawPolygon( a ); - x1 += 2; - y1 += 2; - x2 -= 2; - y2 -= 2; - } else { - qDrawShadePanel( p, r, newCg, TRUE ); - } - } - if ( !( elementFlags & CEF_IsFlat ) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) { - TQRect tmp( x1, y1, x2 - x1 + 1, y2 - y1 + 1 ); - SFlags flags = Style_Default; - if ( elementFlags & CEF_IsOn ) - flags |= Style_On; - if ( elementFlags & CEF_IsDown ) - flags |= Style_Down; - p->save(); - p->setBrushOrigin( -ceData.bgOffset.x(), - -ceData.bgOffset.y() ); - drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, - tmp, newCg, - flags ); - p->restore(); - } - if ( p->brush().style() != NoBrush ) - p->setBrush( NoBrush ); -#endif - break; - } - - case CE_TabBarTab: - { -#ifndef TQT_NO_TABBAR - if ( (elementFlags & CEF_UseGenericParameters) || !(elementFlags & CEF_HasParentWidget) || !opt.tab() ) - break; - - const TQTab * t = opt.tab(); - - int dfw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); - bool selected = flags & Style_Selected; - int o = dfw > 1 ? 1 : 0; - bool lastTab = FALSE; - - TQRect r2( r ); - if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) { - if ( styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignRight && - ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1 ) - lastTab = TRUE; - - if ( o ) { - p->setPen( ceData.colorGroup.light() ); - p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); - p->setPen( ceData.colorGroup.light() ); - p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 ); - if ( r2.left() == 0 ) - p->drawPoint( ceData.rect.bottomLeft() ); - } - else { - p->setPen( ceData.colorGroup.light() ); - p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); - } - - if ( selected ) { - p->fillRect( TQRect( r2.left()+1, r2.bottom()-o, r2.width()-3, 2), - ceData.palette.active().brush( TQColorGroup::Background )); - p->setPen( ceData.colorGroup.background() ); - // p->drawLine( r2.left()+1, r2.bottom(), r2.right()-2, r2.bottom() ); - // if (o) - // p->drawLine( r2.left()+1, r2.bottom()-1, r2.right()-2, r2.bottom()-1 ); - p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top()+2 ); - p->setPen( ceData.colorGroup.light() ); - } else { - p->setPen( ceData.colorGroup.light() ); - r2.setRect( r2.left() + 2, r2.top() + 2, - r2.width() - 4, r2.height() - 2 ); - } - - p->drawLine( r2.left(), r2.bottom()-1, r2.left(), r2.top() + 2 ); - p->drawPoint( r2.left()+1, r2.top() + 1 ); - p->drawLine( r2.left()+2, r2.top(), - r2.right() - 2, r2.top() ); - p->drawPoint( r2.left(), r2.bottom()); - - if ( o ) { - p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top() + 2 ); - p->drawLine( r2.left()+2, r2.top()+1, - r2.right() - 2, r2.top()+1 ); - } - - p->setPen( ceData.colorGroup.dark() ); - p->drawLine( r2.right() - 1, r2.top() + 2, - r2.right() - 1, r2.bottom() - 1 + (selected ? o : -o)); - if ( o ) { - p->drawPoint( r2.right() - 1, r2.top() + 1 ); - p->drawLine( r2.right(), r2.top() + 2, r2.right(), - r2.bottom() - - (selected ? (lastTab ? 0:1):1+o)); - p->drawPoint( r2.right() - 1, r2.top() + 1 ); - } - } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) { - if ( styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignLeft && - ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1 ) - lastTab = TRUE; - if ( selected ) { - p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1), - ceData.palette.active().brush( TQColorGroup::Background )); - p->setPen( ceData.colorGroup.background() ); - // p->drawLine( r2.left()+1, r2.top(), r2.right()-2, r2.top() ); - p->drawLine( r2.left()+1, r2.top(), r2.left()+1, r2.bottom()-2 ); - p->setPen( ceData.colorGroup.dark() ); - } else { - p->setPen( ceData.colorGroup.dark() ); - p->drawLine( r2.left(), r2.top(), r2.right(), r2.top() ); - p->drawLine( r2.left() + 1, r2.top() + 1, - r2.right() - (lastTab ? 0 : 2), - r2.top() + 1 ); - r2.setRect( r2.left() + 2, r2.top(), - r2.width() - 4, r2.height() - 2 ); - } - - p->drawLine( r2.right() - 1, r2.top(), - r2.right() - 1, r2.bottom() - 2 ); - p->drawPoint( r2.right() - 2, r2.bottom() - 2 ); - p->drawLine( r2.right() - 2, r2.bottom() - 1, - r2.left() + 1, r2.bottom() - 1 ); - p->drawPoint( r2.left() + 1, r2.bottom() - 2 ); - - if (dfw > 1) { - p->drawLine( r2.right(), r2.top(), - r2.right(), r2.bottom() - 1 ); - p->drawPoint( r2.right() - 1, r2.bottom() - 1 ); - p->drawLine( r2.right() - 1, r2.bottom(), - r2.left() + 2, r2.bottom() ); - } - - p->setPen( ceData.colorGroup.light() ); - p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2), - r2.left(), r2.bottom() - 2 ); - p->drawLine( r2.left() + 1, r2.top() + (selected ? 0 : 2), - r2.left() + 1, r2.bottom() - 3 ); - - } else { - TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); - } -#endif - break; - } - - case CE_ProgressBarGroove: - qDrawShadePanel(p, r, cg, TRUE, 2); - break; - - case CE_ProgressBarLabel: - { -#ifndef TQT_NO_PROGRESSBAR - const int unit_width = pixelMetric( PM_ProgressBarChunkWidth, ceData, elementFlags, widget ); - int u = r.width() / unit_width; - int p_v = ceData.currentStep; - int t_s = ceData.totalSteps; - if ( u > 0 && ceData.currentStep >= INT_MAX / u && t_s >= u ) { - // scale down to something usable. - p_v /= u; - t_s /= u; - } - if ( ceData.percentageVisible && ceData.totalSteps ) { - int nu = ( u * p_v + t_s/2 ) / t_s; - int x = unit_width * nu; - if ((elementFlags & CEF_IndicatorFollowsStyle) || (elementFlags & CEF_CenterIndicator)) { - p->setPen( cg.highlightedText() ); - p->setClipRect( r.x(), r.y(), x, r.height() ); - p->drawText( r, AlignCenter | SingleLine, ceData.progressText ); - - if ( ceData.currentStep != ceData.totalSteps ) { - p->setClipRect( r.x() + x, r.y(), r.width() - x, r.height() ); - p->setPen( cg.highlight() ); - p->drawText( r, AlignCenter | SingleLine, ceData.progressText ); - } - } else { - p->setPen( cg.text() ); - p->drawText( r, AlignCenter | SingleLine, ceData.progressText ); - } - } -#endif - break; - } - -#ifndef TQT_NO_POPUPMENU - case CE_PopupMenuItem: - { - if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault()) - break; - - TQMenuItem *mi = opt.menuItem(); - if ( !mi ) - break; - - int tab = opt.tabWidth(); - int maxpmw = opt.maxIconWidth(); - bool dis = ! (flags & Style_Enabled); - bool checkable = (elementFlags & CEF_IsCheckable); - bool act = flags & Style_Active; - int x, y, w, h; - - r.rect(&x, &y, &w, &h); - - if ( checkable ) - maxpmw = TQMAX( maxpmw, motifCheckMarkSpace ); - - int checkcol = maxpmw; - - if ( mi && mi->isSeparator() ) { // draw separator - p->setPen( cg.dark() ); - p->drawLine( x, y, x+w, y ); - p->setPen( cg.light() ); - p->drawLine( x, y+1, x+w, y+1 ); - return; - } - - int pw = motifItemFrame; - - if ( act && !dis ) { // active item frame - if (pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) > 1) - qDrawShadePanel( p, x, y, w, h, cg, FALSE, pw, - &cg.brush( TQColorGroup::Button ) ); - else - qDrawShadePanel( p, x+1, y+1, w-2, h-2, cg, TRUE, 1, - &cg.brush( TQColorGroup::Button ) ); - } - else // incognito frame - p->fillRect(x, y, w, h, cg.brush( TQColorGroup::Button )); - - if ( !mi ) - return; - - TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r ); - int xvis = vrect.x(); - if ( mi->isChecked() ) { - if ( mi->iconSet() ) { - drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); - } - } else if ( !act ) { - p->fillRect(xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame, - cg.brush( TQColorGroup::Button )); - } - - if ( mi->iconSet() ) { // draw iconset - TQIconSet::Mode mode = TQIconSet::Normal; // no disabled icons in Motif - if (act && !dis ) - mode = TQIconSet::Active; - TQPixmap pixmap; - if ( checkable && mi->isChecked() ) - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); - else - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); - - int pixw = pixmap.width(); - int pixh = pixmap.height(); - TQRect pmr( 0, 0, pixw, pixh ); - pmr.moveCenter( vrect.center() ); - p->setPen( cg.text() ); - p->drawPixmap( pmr.topLeft(), pixmap ); - - } else if ( checkable ) { // just "checking"... - if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); - } - } - - - p->setPen( cg.buttonText() ); - - TQColor discol; - if ( dis ) { - discol = cg.text(); - p->setPen( discol ); - } - - int xm = motifItemFrame + checkcol + motifItemHMargin; - - vrect = visualRect( TQRect( x+xm, y+motifItemVMargin, w-xm-tab, h-2*motifItemVMargin ), r ); - xvis = vrect.x(); - if ( mi->custom() ) { - int m = motifItemVMargin; - p->save(); - mi->custom()->paint( p, cg, act, !dis, - xvis, y+m, w-xm-tab+1, h-2*m ); - p->restore(); - } - TQString s = mi->text(); - if ( !s.isNull() ) { // draw text - int t = s.find( '\t' ); - int m = motifItemVMargin; - int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; - text_flags |= (TQApplication::reverseLayout() ? AlignRight : AlignLeft ); - if ( t >= 0 ) { // draw tab text - TQRect vr = visualRect( TQRect( x+w-tab-motifItemHMargin-motifItemFrame, - y+motifItemVMargin, tab, h-2*motifItemVMargin ), r ); - int xv = vr.x(); - p->drawText( xv, y+m, tab, h-2*m, text_flags, s.mid( t+1 ) ); - s = s.left( t ); - } - p->drawText( xvis, y+m, w-xm-tab+1, h-2*m, text_flags, s, t ); - } else if ( mi->pixmap() ) { // draw pixmap - TQPixmap *pixmap = mi->pixmap(); - if ( pixmap->depth() == 1 ) - p->setBackgroundMode( OpaqueMode ); - p->drawPixmap( xvis, y+motifItemFrame, *pixmap ); - if ( pixmap->depth() == 1 ) - p->setBackgroundMode( TransparentMode ); - } - if ( mi->popup() ) { // draw sub menu arrow - int dim = (h-2*motifItemFrame) / 2; - TQStyle::PrimitiveElement arrow = (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight); - TQRect vr = visualRect( TQRect(x+w - motifArrowHMargin - motifItemFrame - dim, - y+h/2-dim/2, dim, dim), r ); - if ( act ) - drawPrimitive(arrow, p, ceData, elementFlags, vr, cg, - (Style_Down | - (dis ? Style_Default : Style_Enabled)) ); - else - drawPrimitive(arrow, p, ceData, elementFlags, vr, cg, - (dis ? Style_Default : Style_Enabled)); - } - - break; - } -#endif // TQT_NO_POPUPMENU - - case CE_MenuBarItem: - { - if ( flags & Style_Active ) // active item - qDrawShadePanel( p, r, cg, FALSE, motifItemFrame, - &cg.brush(TQColorGroup::Button) ); - else // other item - p->fillRect( r, cg.brush(TQColorGroup::Button) ); - TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); - break; - } - - default: - TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); - break; - } -} - -static int get_combo_extra_width( int h, int w, int *return_awh=0 ) -{ - int awh, - tmp; - if ( h < 8 ) { - awh = 6; - } else if ( h < 14 ) { - awh = h - 2; - } else { - awh = h/2; - } - tmp = (awh * 3) / 2; - if ( tmp > w / 2 ) { - awh = w / 2 - 3; - tmp = w / 2 + 3; - } - - if ( return_awh ) - *return_awh = awh; - - return tmp; -} - -static void get_combo_parameters( const TQRect &r, - int &ew, int &awh, int &ax, - int &ay, int &sh, int &dh, - int &sy ) -{ - ew = get_combo_extra_width( r.height(), r.width(), &awh ); - - sh = (awh+3)/4; - if ( sh < 3 ) - sh = 3; - dh = sh/2 + 1; - - ay = r.y() + (r.height()-awh-sh-dh)/2; - if ( ay < 0 ) { - //panic mode - ay = 0; - sy = r.height(); - } else { - sy = ay+awh+dh; - } - ax = r.x() + r.width() - ew; - ax += (ew-awh)/2; -} - -/*!\reimp -*/ -void TQMotifStyle::drawComplexControl( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - SCFlags sub, - SCFlags subActive, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch ( control ) { - case CC_SpinWidget: { - SCFlags drawSub = SC_None; - if ( sub & SC_SpinWidgetFrame ) - qDrawShadePanel( p, r, cg, TRUE, - pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) ); - - if ( sub & SC_SpinWidgetUp || sub & SC_SpinWidgetDown ) { - if ( sub & SC_SpinWidgetUp ) - drawSub |= SC_SpinWidgetUp; - if ( sub & SC_SpinWidgetDown ) - drawSub |= SC_SpinWidgetDown; - - TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, - drawSub, subActive, opt, widget ); - } - break; } - - case CC_Slider: - { -#ifndef TQT_NO_SLIDER - TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, - opt, widget), - handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, - opt, widget); - - if ((sub & SC_SliderGroove) && groove.isValid()) { - qDrawShadePanel( p, groove, cg, TRUE, 2, - &cg.brush( TQColorGroup::Mid ) ); - - - if ( flags & Style_HasFocus ) { - TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget ); - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg ); - } - } - - if (( sub & SC_SliderHandle ) && handle.isValid()) { - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, handle, cg ); - - if ( ceData.orientation == Horizontal ) { - TQCOORD mid = handle.x() + handle.width() / 2; - qDrawShadeLine( p, mid, handle.y(), mid, - handle.y() + handle.height() - 2, - cg, TRUE, 1); - } else { - TQCOORD mid = handle.y() + handle.height() / 2; - qDrawShadeLine( p, handle.x(), mid, - handle.x() + handle.width() - 2, mid, - cg, TRUE, 1); - } - } - - if ( sub & SC_SliderTickmarks ) - TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, - SC_SliderTickmarks, subActive, - opt, widget ); -#endif - break; - } - - case CC_ComboBox: -#ifndef TQT_NO_COMBOBOX - if ( sub & SC_ComboBoxArrow ) { - const TQComboBox * cb = (const TQComboBox *) widget; - int awh, ax, ay, sh, sy, dh, ew; - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, cb); - - drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags ); - TQRect ar = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, - opt, cb ), ceData, elementFlags ); - drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags | Style_Enabled ); - - TQRect tr = r; - tr.addCoords( fw, fw, -fw, -fw ); - get_combo_parameters( tr, ew, awh, ax, ay, sh, dh, sy ); - - // draws the shaded line under the arrow - p->setPen( cg.light() ); - p->drawLine( ar.x(), sy, ar.x()+awh-1, sy ); - p->drawLine( ar.x(), sy, ar.x(), sy+sh-1 ); - p->setPen( cg.dark() ); - p->drawLine( ar.x()+1, sy+sh-1, ar.x()+awh-1, sy+sh-1 ); - p->drawLine( ar.x()+awh-1, sy+1, ar.x()+awh-1, sy+sh-1 ); - - if ( cb->hasFocus() ) { - TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, cb ), ceData, elementFlags ); - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg ); - } - } - - if ( sub & SC_ComboBoxEditField ) { - TQComboBox * cb = (TQComboBox *) widget; - if ( cb->editable() ) { - TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, - SC_ComboBoxEditField, cb ), ceData, elementFlags ); - er.addCoords( -1, -1, 1, 1); - qDrawShadePanel( p, er, cg, TRUE, 1, - &cg.brush( TQColorGroup::Button )); - } - } -#endif - p->setPen(cg.buttonText()); - break; - - case CC_ScrollBar: - { - if (sub == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | SC_ScrollBarAddPage | - SC_ScrollBarSubPage | SC_ScrollBarFirst | SC_ScrollBarLast | - SC_ScrollBarSlider)) - drawPrimitive(PE_PanelScrollBar, p, ceData, elementFlags, ceData.rect, cg, - ((ceData.orientation == TQt::Horizontal) ? - Style_Horizontal : Style_Default)); - - TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, sub, - subActive, opt, widget); - break; - } - -#ifndef TQT_NO_LISTVIEW - case CC_ListView: - { - if ( sub & SC_ListView ) { - TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget ); - } - if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) { - if (opt.isDefault()) - break; - - TQListViewItem *item = opt.listViewItem(); - TQListViewItem *child = item->firstChild(); - - int y = r.y(); - int c; - TQPointArray dotlines; - if ( subActive == (uint)SC_All && sub == SC_ListViewExpand ) { - c = 2; - dotlines.resize(2); - dotlines[0] = TQPoint( r.right(), r.top() ); - dotlines[1] = TQPoint( r.right(), r.bottom() ); - } else { - int linetop = 0, linebot = 0; - // each branch needs at most two lines, ie. four end points - dotlines.resize( item->childCount() * 4 ); - c = 0; - - // skip the stuff above the exposed rectangle - while ( child && y + child->height() <= 0 ) { - y += child->totalHeight(); - child = child->nextSibling(); - } - - int bx = r.width() / 2; - - // paint stuff in the magical area - TQListView* v = item->listView(); - while ( child && y < r.height() ) { - if (child->isVisible()) { - int lh; - if ( !item->multiLinesEnabled() ) - lh = child->height(); - else - lh = p->fontMetrics().height() + 2 * v->itemMargin(); - lh = TQMAX( lh, TQApplication::globalStrut().height() ); - if ( lh % 2 > 0 ) - lh++; - linebot = y + lh/2; - if ( (child->isExpandable() || child->childCount()) && - (child->height() > 0) ) { - // needs a box - p->setPen( cg.text() ); - p->drawRect( bx-4, linebot-4, 9, 9 ); - TQPointArray a; - if ( child->isOpen() ) - a.setPoints( 3, bx-2, linebot-2, - bx, linebot+2, - bx+2, linebot-2 ); //RightArrow - else - a.setPoints( 3, bx-2, linebot-2, - bx+2, linebot, - bx-2, linebot+2 ); //DownArrow - p->setBrush( cg.text() ); - p->drawPolygon( a ); - p->setBrush( NoBrush ); - // dotlinery - dotlines[c++] = TQPoint( bx, linetop ); - dotlines[c++] = TQPoint( bx, linebot - 5 ); - dotlines[c++] = TQPoint( bx + 5, linebot ); - dotlines[c++] = TQPoint( r.width(), linebot ); - linetop = linebot + 5; - } else { - // just dotlinery - dotlines[c++] = TQPoint( bx+1, linebot ); - dotlines[c++] = TQPoint( r.width(), linebot ); - } - y += child->totalHeight(); - } - child = child->nextSibling(); - } - - // Expand line height to edge of rectangle if there's any - // visible child below - while ( child && child->height() <= 0) - child = child->nextSibling(); - if ( child ) - linebot = r.height(); - - if ( linetop < linebot ) { - dotlines[c++] = TQPoint( bx, linetop ); - dotlines[c++] = TQPoint( bx, linebot ); - } - } - - int line; // index into dotlines - p->setPen( cg.text() ); - if ( sub & SC_ListViewBranch ) for( line = 0; line < c; line += 2 ) { - p->drawLine( dotlines[line].x(), dotlines[line].y(), - dotlines[line+1].x(), dotlines[line+1].y() ); - } - } - - break; - } -#endif // TQT_NO_LISTVIEW - - default: - TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, - sub, subActive, opt, widget ); - } -} - - -/*! \reimp */ -int TQMotifStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const -{ - int ret; - - switch( metric ) { - case PM_ButtonDefaultIndicator: - ret = 3; - break; - - case PM_ButtonShiftHorizontal: - case PM_ButtonShiftVertical: - ret = 0; - break; - - case PM_SplitterWidth: - ret = TQMAX( 10, TQApplication::globalStrut().width() ); - break; - - case PM_SliderLength: - ret = 30; - break; - - case PM_SliderThickness: - ret = 24; - break; - - case PM_SliderControlThickness: - { -#ifndef TQT_NO_SLIDER - const TQSlider * sl = (const TQSlider *) widget; - int space = (sl->orientation() == Horizontal) ? sl->height() - : sl->width(); - int ticks = sl->tickmarks(); - int n = 0; - if ( ticks & TQSlider::Above ) n++; - if ( ticks & TQSlider::Below ) n++; - if ( !n ) { - ret = space; - break; - } - - int thick = 6; // Magic constant to get 5 + 16 + 5 - - space -= thick; - //### the two sides may be unequal in size - if ( space > 0 ) - thick += (space * 2) / (n + 2); - ret = thick; -#endif - break; - } - - case PM_SliderSpaceAvailable: - { -#ifndef TQT_NO_SLIDER - const TQSlider * sl = (const TQSlider *) widget; - if ( sl->orientation() == Horizontal ) - ret = sl->width() - pixelMetric( PM_SliderLength, ceData, elementFlags, sl ) - 6; - else - ret = sl->height() - pixelMetric( PM_SliderLength, ceData, elementFlags, sl ) - 6; -#endif - break; - } - - case PM_DockWindowHandleExtent: - ret = 9; - break; - - case PM_ProgressBarChunkWidth: - ret = 1; - break; - - case PM_ExclusiveIndicatorWidth: - case PM_ExclusiveIndicatorHeight: - ret = 13; - break; - - case PM_MenuIndicatorFrameHBorder: - case PM_MenuIndicatorFrameVBorder: - case PM_MenuIconIndicatorFrameHBorder: - case PM_MenuIconIndicatorFrameVBorder: - ret = motifItemFrame; - break; - - default: - ret = TQCommonStyle::pixelMetric( metric, ceData, elementFlags, widget ); - break; - } - return ret; -} - - -/*!\reimp -*/ -TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sc, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch ( control ) { - case CC_SpinWidget: { - if ( elementFlags & CEF_UseGenericParameters ) - return TQRect(); - int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, 0 ); - TQSize bs; - bs.setHeight( ceData.rect.height()/2 ); - if ( bs.height() < 8 ) - bs.setHeight( 8 ); - bs.setWidth( TQMIN( bs.height() * 8 / 5, ceData.rect.width() / 4 ) ); // 1.6 -approximate golden mean - bs = bs.expandedTo( TQApplication::globalStrut() ); - int y = 0; - int x, lx, rx; - x = ceData.rect.width() - y - bs.width(); - lx = fw; - rx = x - fw * 2; - switch ( sc ) { - case SC_SpinWidgetUp: - return TQRect(x, y, bs.width(), bs.height()); - case SC_SpinWidgetDown: - return TQRect(x, y + bs.height(), bs.width(), bs.height()); - case SC_SpinWidgetButtonField: - return TQRect(x, y, bs.width(), ceData.rect.height() - 2*fw); - case SC_SpinWidgetEditField: - return TQRect(lx, fw, rx, ceData.rect.height() - 2*fw); - case SC_SpinWidgetFrame: - return TQRect( 0, 0, - ceData.rect.width() - bs.width(), ceData.rect.height() ); - default: - break; - } - break; } - -#ifndef TQT_NO_SLIDER - case CC_Slider: { - if (sc == SC_SliderHandle) { - int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); - int sliderPos = ceData.startStep; - int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); - int motifBorder = 3; - - if ( ceData.orientation == Horizontal ) - return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len, - thickness - 2*motifBorder ); - return TQRect( tickOffset + motifBorder, sliderPos + motifBorder, - thickness - 2*motifBorder, len ); - } - break; } -#endif - -#ifndef TQT_NO_SCROLLBAR - case CC_ScrollBar: { - if (elementFlags & CEF_UseGenericParameters) - return TQRect(); - - int sliderstart = ceData.startStep; - int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); - int fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget); - int buttonw = sbextent - (fw * 2); - int buttonh = sbextent - (fw * 2); - int maxlen = ((ceData.orientation == TQt::Horizontal) ? - ceData.rect.width() : ceData.rect.height()) - - (buttonw * 2) - (fw * 2); - int sliderlen; - - // calculate slider length - if (ceData.maxSteps != ceData.minSteps) { - uint range = ceData.maxSteps - ceData.minSteps; - sliderlen = (ceData.pageStep * maxlen) / - (range + ceData.pageStep); - - if ( sliderlen < 9 || range > INT_MAX/2 ) - sliderlen = 9; - if ( sliderlen > maxlen ) - sliderlen = maxlen; - } else - sliderlen = maxlen; - - switch (sc) { - case SC_ScrollBarSubLine: - // top/left button - if (ceData.orientation == TQt::Horizontal) { - if ( ceData.rect.width()/2 < sbextent ) - buttonw = ceData.rect.width()/2 - (fw*2); - return TQRect(fw, fw, buttonw, buttonh); - } else { - if ( ceData.rect.height()/2 < sbextent ) - buttonh = ceData.rect.height()/2 - (fw*2); - return TQRect(fw, fw, buttonw, buttonh); - } - case SC_ScrollBarAddLine: - // bottom/right button - if (ceData.orientation == TQt::Horizontal) { - if ( ceData.rect.width()/2 < sbextent ) - buttonw = ceData.rect.width()/2 - (fw*2); - return TQRect(ceData.rect.width() - buttonw - fw, fw, - buttonw, buttonh); - } else { - if ( ceData.rect.height()/2 < sbextent ) - buttonh = ceData.rect.height()/2 - (fw*2); - return TQRect(fw, ceData.rect.height() - buttonh - fw, - buttonw, buttonh); - } - case SC_ScrollBarSubPage: - if (ceData.orientation == TQt::Horizontal) - return TQRect(buttonw + fw, fw, sliderstart - buttonw - fw, buttonw); - return TQRect(fw, buttonw + fw, buttonw, sliderstart - buttonw - fw); - - case SC_ScrollBarAddPage: - if (ceData.orientation == TQt::Horizontal) - return TQRect(sliderstart + sliderlen, fw, - maxlen - sliderstart - sliderlen + buttonw + fw, buttonw); - return TQRect(fw, sliderstart + sliderlen, buttonw, - maxlen - sliderstart - sliderlen + buttonw + fw); - - case SC_ScrollBarGroove: - if (ceData.orientation == TQt::Horizontal) - return TQRect(buttonw + fw, fw, maxlen, buttonw); - return TQRect(fw, buttonw + fw, buttonw, maxlen); - - case SC_ScrollBarSlider: - if (ceData.orientation == TQt::Horizontal) - return TQRect(sliderstart, fw, sliderlen, buttonw); - return TQRect(fw, sliderstart, buttonw, sliderlen); - - default: - break; - } - break; } -#endif - -#ifndef TQT_NO_COMBOBOX - case CC_ComboBox: - - switch ( sc ) { - case SC_ComboBoxArrow: { - int ew, awh, sh, dh, ax, ay, sy; - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); - TQRect cr = ceData.rect; - cr.addCoords( fw, fw, -fw, -fw ); - get_combo_parameters( cr, ew, awh, ax, ay, sh, dh, sy ); - return TQRect( ax, ay, awh, awh ); } - - case SC_ComboBoxEditField: { - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); - TQRect rect = ceData.rect; - rect.addCoords( fw, fw, -fw, -fw ); - int ew = get_combo_extra_width( rect.height(), rect.width() ); - rect.addCoords( 1, 1, -1-ew, -1 ); - return rect; } - - default: - break; - } - break; -#endif - default: break; - } - return TQCommonStyle::querySubControlMetrics( control, ceData, elementFlags, sc, opt, widget ); -} - -/*!\reimp -*/ -TQSize TQMotifStyle::sizeFromContents( ContentsType contents, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQSize &contentsSize, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - TQSize sz(contentsSize); - - switch(contents) { - case CT_PushButton: - { -#ifndef TQT_NO_PUSHBUTTON - sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, opt, widget); - if (((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) && - sz.width() < 80 && ceData.fgPixmap.isNull()) - sz.setWidth(80); -#endif - break; - } - - case CT_PopupMenuItem: - { -#ifndef TQT_NO_POPUPMENU - if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault()) - break; - - bool checkable = (elementFlags & CEF_IsCheckable); - TQMenuItem *mi = opt.menuItem(); - int maxpmw = opt.maxIconWidth(); - int w = sz.width(), h = sz.height(); - - if (mi->custom()) { - w = mi->custom()->sizeHint().width(); - h = mi->custom()->sizeHint().height(); - if (! mi->custom()->fullSpan()) - h += 2*motifItemVMargin + 2*motifItemFrame; - } else if ( mi->widget() ) { - } else if ( mi->isSeparator() ) { - w = 10; - h = motifSepHeight; - } else if (mi->pixmap() || ! mi->text().isNull()) - h += 2*motifItemVMargin + 2*motifItemFrame; - - // a little bit of border can never harm - w += 2*motifItemHMargin + 2*motifItemFrame; - - if ( !mi->text().isNull() && mi->text().find('\t') >= 0 ) - // string contains tab - w += motifTabSpacing; - else if (mi->popup()) - // submenu indicator needs some room if we don't have a tab column - w += motifArrowHMargin + 4*motifItemFrame; - - if ( checkable && maxpmw <= 0) - // if we are checkable and have no iconsets, add space for a checkmark - w += motifCheckMarkSpace; - else if (checkable && maxpmw < motifCheckMarkSpace) - // make sure the check-column is wide enough if we have iconsets - w += (motifCheckMarkSpace - maxpmw); - - // if we have a check-column ( iconsets of checkmarks), add space - // to separate the columns - if ( maxpmw > 0 || checkable ) - w += motifCheckMarkHMargin; - - sz = TQSize(w, h); -#endif - break; - } - - default: - sz = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, opt, widget ); - break; - } - - return sz; -} - -/*!\reimp -*/ -TQRect TQMotifStyle::subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const -{ - TQRect rect; - TQRect wrect = ceData.rect; - - switch ( r ) { - case SR_SliderFocusRect: - rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget ); - rect.addCoords( 2, 2, -2, -2 ); - break; - - case SR_ComboBoxFocusRect: - { - int awh, ax, ay, sh, sy, dh, ew; - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); - TQRect tr = wrect; - - tr.addCoords( fw, fw, -fw, -fw ); - get_combo_parameters( tr, ew, awh, ax, ay, sh, dh, sy ); - rect.setRect(ax-2, ay-2, awh+4, awh+sh+dh+4); - break; - } - - case SR_DockWindowHandleRect: - { -#ifndef TQT_NO_MAINWINDOW - if ( (elementFlags & CEF_UseGenericParameters) || !(elementFlags & CEF_HasParentWidget) ) - break; - - if ( !ceData.dwData.hasDockArea || !ceData.dwData.closeEnabled ) - rect.setRect( 0, 0, ceData.rect.width(), ceData.rect.height() ); - else { - if ( ceData.dwData.areaOrientation == Horizontal ) - rect.setRect(2, 15, ceData.rect.width()-2, ceData.rect.height() - 15); - else - rect.setRect(0, 2, ceData.rect.width() - 15, ceData.rect.height() - 2); - } -#endif - break; - } - - case SR_ProgressBarGroove: - case SR_ProgressBarContents: - { -#ifndef TQT_NO_PROGRESSBAR - TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) : - TQApplication::fontMetrics() ) ); - int textw = 0; - if (ceData.percentageVisible) - textw = fm.width("100%") + 6; - - if ((elementFlags & CEF_IndicatorFollowsStyle) || - (elementFlags & CEF_CenterIndicator)) - rect = wrect; - else - rect.setCoords(wrect.left(), wrect.top(), - wrect.right() - textw, wrect.bottom()); -#endif - break; - } - - case SR_ProgressBarLabel: - { -#ifndef TQT_NO_PROGRESSBAR - TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) : - TQApplication::fontMetrics() ) ); - int textw = 0; - if (ceData.percentageVisible) - textw = fm.width("100%") + 6; - - if ((elementFlags & CEF_IndicatorFollowsStyle) || - (elementFlags & CEF_CenterIndicator)) - rect = wrect; - else - rect.setCoords(wrect.right() - textw, wrect.top(), - wrect.right(), wrect.bottom()); -#endif - break; - } - - case SR_CheckBoxContents: - { -#ifndef TQT_NO_CHECKBOX - TQRect ir = subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget); - rect.setRect(ir.right() + 10, wrect.y(), - wrect.width() - ir.width() - 10, wrect.height()); -#endif - break; - } - - case SR_RadioButtonContents: - { - TQRect ir = subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget); - rect.setRect(ir.right() + 10, wrect.y(), - wrect.width() - ir.width() - 10, wrect.height()); - break; - } - - default: - rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget ); - } - - return rect; -} - -/*! \reimp -*/ -void TQMotifStyle::polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ -#ifndef TQT_NO_POPUPMENU - if ( !(ceData.windowState & WState_Polished ) ) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetCheckable); - } -#endif -} - - -#ifndef TQT_NO_IMAGEIO_XPM -static const char * const qt_close_xpm[] = { -"12 12 2 1", -" s None c None", -". c black", -" ", -" ", -" . . ", -" ... ... ", -" ...... ", -" .... ", -" .... ", -" ...... ", -" ... ... ", -" . . ", -" ", -" "}; - -static const char * const qt_maximize_xpm[] = { -"12 12 2 1", -" s None c None", -". c black", -" ", -" ", -" ", -" . ", -" ... ", -" ..... ", -" ....... ", -" ......... ", -" ", -" ", -" ", -" "}; - -static const char * const qt_minimize_xpm[] = { -"12 12 2 1", -" s None c None", -". c black", -" ", -" ", -" ", -" ", -" ......... ", -" ....... ", -" ..... ", -" ... ", -" . ", -" ", -" ", -" "}; - -#if 0 // ### not used??? -static const char * const qt_normalize_xpm[] = { -"12 12 2 1", -" s None c None", -". c black", -" ", -" ", -" . ", -" .. ", -" ... ", -" .... ", -" ..... ", -" ...... ", -" ....... ", -" ", -" ", -" "}; -#endif - -static const char * const qt_normalizeup_xpm[] = { -"12 12 2 1", -" s None c None", -". c black", -" ", -" ", -" ", -" ....... ", -" ...... ", -" ..... ", -" .... ", -" ... ", -" .. ", -" . ", -" ", -" "}; - -static const char * const qt_shade_xpm[] = { -"12 12 2 1", "# c #000000", -". c None", -"............", -"............", -".#########..", -".#########..", -"............", -"............", -"............", -"............", -"............", -"............", -"............", -"............"}; - - -static const char * const qt_unshade_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -".#########..", -".#########..", -".#.......#..", -".#.......#..", -".#.......#..", -".#.......#..", -".#.......#..", -".#########..", -"............", -"............"}; - - -static const char * dock_window_close_xpm[] = { -"8 8 2 1", -"# c #000000", -". c None", -"##....##", -".##..##.", -"..####..", -"...##...", -"..####..", -".##..##.", -"##....##", -"........"}; - -// Message box icons, from page 210 of the Windows style guide. - -// Hand-drawn to resemble Microsoft's icons, but in the Mac/Netscape palette. -// Thanks to TrueColor displays, it is slightly more efficient to have -// them duplicated. -/* XPM */ -static const char * const information_xpm[]={ -"32 32 5 1", -". c None", -"c c #000000", -"* c #999999", -"a c #ffffff", -"b c #0000ff", -"...........********.............", -"........***aaaaaaaa***..........", -"......**aaaaaaaaaaaaaa**........", -".....*aaaaaaaaaaaaaaaaaa*.......", -"....*aaaaaaaabbbbaaaaaaaac......", -"...*aaaaaaaabbbbbbaaaaaaaac.....", -"..*aaaaaaaaabbbbbbaaaaaaaaac....", -".*aaaaaaaaaaabbbbaaaaaaaaaaac...", -".*aaaaaaaaaaaaaaaaaaaaaaaaaac*..", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac*.", -"*aaaaaaaaaabbbbbbbaaaaaaaaaaac*.", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -".*aaaaaaaaaaabbbbbaaaaaaaaaac***", -".*aaaaaaaaaaabbbbbaaaaaaaaaac***", -"..*aaaaaaaaaabbbbbaaaaaaaaac***.", -"...caaaaaaabbbbbbbbbaaaaaac****.", -"....caaaaaaaaaaaaaaaaaaaac****..", -".....caaaaaaaaaaaaaaaaaac****...", -"......ccaaaaaaaaaaaaaacc****....", -".......*cccaaaaaaaaccc*****.....", -"........***cccaaaac*******......", -"..........****caaac*****........", -".............*caaac**...........", -"...............caac**...........", -"................cac**...........", -".................cc**...........", -"..................***...........", -"...................**..........."}; -/* XPM */ -static const char* const warning_xpm[]={ -"32 32 4 1", -". c None", -"a c #ffff00", -"* c #000000", -"b c #999999", -".............***................", -"............*aaa*...............", -"...........*aaaaa*b.............", -"...........*aaaaa*bb............", -"..........*aaaaaaa*bb...........", -"..........*aaaaaaa*bb...........", -".........*aaaaaaaaa*bb..........", -".........*aaaaaaaaa*bb..........", -"........*aaaaaaaaaaa*bb.........", -"........*aaaa***aaaa*bb.........", -".......*aaaa*****aaaa*bb........", -".......*aaaa*****aaaa*bb........", -"......*aaaaa*****aaaaa*bb.......", -"......*aaaaa*****aaaaa*bb.......", -".....*aaaaaa*****aaaaaa*bb......", -".....*aaaaaa*****aaaaaa*bb......", -"....*aaaaaaaa***aaaaaaaa*bb.....", -"....*aaaaaaaa***aaaaaaaa*bb.....", -"...*aaaaaaaaa***aaaaaaaaa*bb....", -"...*aaaaaaaaaa*aaaaaaaaaa*bb....", -"..*aaaaaaaaaaa*aaaaaaaaaaa*bb...", -"..*aaaaaaaaaaaaaaaaaaaaaaa*bb...", -".*aaaaaaaaaaaa**aaaaaaaaaaa*bb..", -".*aaaaaaaaaaa****aaaaaaaaaa*bb..", -"*aaaaaaaaaaaa****aaaaaaaaaaa*bb.", -"*aaaaaaaaaaaaa**aaaaaaaaaaaa*bb.", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", -".*aaaaaaaaaaaaaaaaaaaaaaaaa*bbbb", -"..*************************bbbbb", -"....bbbbbbbbbbbbbbbbbbbbbbbbbbb.", -".....bbbbbbbbbbbbbbbbbbbbbbbbb.."}; -/* XPM */ -static const char* const critical_xpm[]={ -"32 32 4 1", -". c None", -"a c #999999", -"* c #ff0000", -"b c #ffffff", -"...........********.............", -".........************...........", -".......****************.........", -"......******************........", -".....********************a......", -"....**********************a.....", -"...************************a....", -"..*******b**********b*******a...", -"..******bbb********bbb******a...", -".******bbbbb******bbbbb******a..", -".*******bbbbb****bbbbb*******a..", -"*********bbbbb**bbbbb*********a.", -"**********bbbbbbbbbb**********a.", -"***********bbbbbbbb***********aa", -"************bbbbbb************aa", -"************bbbbbb************aa", -"***********bbbbbbbb***********aa", -"**********bbbbbbbbbb**********aa", -"*********bbbbb**bbbbb*********aa", -".*******bbbbb****bbbbb*******aa.", -".******bbbbb******bbbbb******aa.", -"..******bbb********bbb******aaa.", -"..*******b**********b*******aa..", -"...************************aaa..", -"....**********************aaa...", -"....a********************aaa....", -".....a******************aaa.....", -"......a****************aaa......", -".......aa************aaaa.......", -".........aa********aaaaa........", -"...........aaaaaaaaaaa..........", -".............aaaaaaa............"}; -/* XPM */ -static const char *const question_xpm[] = { -"32 32 5 1", -". c None", -"c c #000000", -"* c #999999", -"a c #ffffff", -"b c #0000ff", -"...........********.............", -"........***aaaaaaaa***..........", -"......**aaaaaaaaaaaaaa**........", -".....*aaaaaaaaaaaaaaaaaa*.......", -"....*aaaaaaaaaaaaaaaaaaaac......", -"...*aaaaaaaabbbbbbaaaaaaaac.....", -"..*aaaaaaaabaaabbbbaaaaaaaac....", -".*aaaaaaaabbaaaabbbbaaaaaaaac...", -".*aaaaaaaabbbbaabbbbaaaaaaaac*..", -"*aaaaaaaaabbbbaabbbbaaaaaaaaac*.", -"*aaaaaaaaaabbaabbbbaaaaaaaaaac*.", -"*aaaaaaaaaaaaabbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaaabbbaaaaaaaaaaaac**", -"*aaaaaaaaaaaaabbaaaaaaaaaaaaac**", -"*aaaaaaaaaaaaabbaaaaaaaaaaaaac**", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac**", -".*aaaaaaaaaaaabbaaaaaaaaaaaac***", -".*aaaaaaaaaaabbbbaaaaaaaaaaac***", -"..*aaaaaaaaaabbbbaaaaaaaaaac***.", -"...caaaaaaaaaabbaaaaaaaaaac****.", -"....caaaaaaaaaaaaaaaaaaaac****..", -".....caaaaaaaaaaaaaaaaaac****...", -"......ccaaaaaaaaaaaaaacc****....", -".......*cccaaaaaaaaccc*****.....", -"........***cccaaaac*******......", -"..........****caaac*****........", -".............*caaac**...........", -"...............caac**...........", -"................cac**...........", -".................cc**...........", -"..................***...........", -"...................**...........", -}; -#endif - -/*! - \reimp - */ -TQPixmap TQMotifStyle::stylePixmap(StylePixmap sp, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption& opt, - const TQWidget *widget) const -{ -#ifndef TQT_NO_IMAGEIO_XPM - switch (sp) { - case SP_TitleBarShadeButton: - return TQPixmap((const char **)qt_shade_xpm); - case SP_TitleBarUnshadeButton: - return TQPixmap((const char **)qt_unshade_xpm); - case SP_TitleBarNormalButton: - return TQPixmap((const char **)qt_normalizeup_xpm); - case SP_TitleBarMinButton: - return TQPixmap((const char **)qt_minimize_xpm); - case SP_TitleBarMaxButton: - return TQPixmap((const char **)qt_maximize_xpm); - case SP_TitleBarCloseButton: - return TQPixmap((const char **)qt_close_xpm); - case SP_DockWindowCloseButton: - return TQPixmap((const char **)dock_window_close_xpm ); - - case SP_MessageBoxInformation: - case SP_MessageBoxWarning: - case SP_MessageBoxCritical: - case SP_MessageBoxQuestion: - { - const char * const * xpm_data; - switch ( sp ) { - case SP_MessageBoxInformation: - xpm_data = information_xpm; - break; - case SP_MessageBoxWarning: - xpm_data = warning_xpm; - break; - case SP_MessageBoxCritical: - xpm_data = critical_xpm; - break; - case SP_MessageBoxQuestion: - xpm_data = question_xpm; - break; - default: - xpm_data = 0; - break; - } - TQPixmap pm; - if ( xpm_data ) { - TQImage image( (const char **) xpm_data); - // All that color looks ugly in Motif - TQColorGroup g = TQApplication::palette().active(); - switch ( sp ) { - case SP_MessageBoxInformation: - case SP_MessageBoxQuestion: - image.setColor( 2, 0xff000000 | g.dark().rgb() ); - image.setColor( 3, 0xff000000 | g.base().rgb() ); - image.setColor( 4, 0xff000000 | g.text().rgb() ); - break; - case SP_MessageBoxWarning: - image.setColor( 1, 0xff000000 | g.base().rgb() ); - image.setColor( 2, 0xff000000 | g.text().rgb() ); - image.setColor( 3, 0xff000000 | g.dark().rgb() ); - break; - case SP_MessageBoxCritical: - image.setColor( 1, 0xff000000 | g.dark().rgb() ); - image.setColor( 2, 0xff000000 | g.text().rgb() ); - image.setColor( 3, 0xff000000 | g.base().rgb() ); - break; - default: - break; - } - pm.convertFromImage(image); - } - return pm; - } - - default: - break; - } -#endif - - return TQCommonStyle::stylePixmap(sp, ceData, elementFlags, opt, widget); -} - - -/*! \reimp */ -int TQMotifStyle::styleHint(StyleHint hint, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption &opt, - TQStyleHintReturn *returnData, - const TQWidget *widget) const -{ - int ret; - - switch (hint) { - case SH_GUIStyle: - ret = MotifStyle; - break; - - case SH_ScrollBar_BackgroundMode: - ret = TQWidget::PaletteMid; - break; - - case SH_ScrollBar_MiddleClickAbsolutePosition: - case SH_Slider_SloppyKeyEvents: - case SH_ProgressDialog_CenterCancelButton: - case SH_PopupMenu_SpaceActivatesItem: - case SH_ScrollView_FrameOnlyAroundContents: - ret = 1; - break; - - case SH_PopupMenu_SubMenuPopupDelay: - ret = 96; - break; - - case SH_ProgressDialog_TextLabelAlignment: - ret = AlignAuto | AlignVCenter; - break; - - case SH_ItemView_ChangeHighlightOnFocus: - ret = 0; - break; - - case SH_MenuIndicatorColumnWidth: - { - int maxpmw = opt.maxIconWidth(); - bool checkable = (elementFlags & CEF_IsCheckable); - - if ( checkable ) - maxpmw = TQMAX( maxpmw, motifCheckMarkSpace ); - - ret = maxpmw; - break; - } - - default: - ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); - break; - } - - return ret; -} - - -#endif diff --git a/src/styles/qplatinumstyle.cpp b/src/styles/qplatinumstyle.cpp deleted file mode 100644 index 721a480a7..000000000 --- a/src/styles/qplatinumstyle.cpp +++ /dev/null @@ -1,1552 +0,0 @@ -/**************************************************************************** -** -** Implementation of Platinum-like style class -** -** Created : 981231 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqplatinumstyle.h" - -#if !defined(TQT_NO_STYLE_PLATINUM) || defined(QT_PLUGIN) - -#include "ntqapplication.h" -#include "tqcombobox.h" -#include "ntqdrawutil.h" -#include "tqpainter.h" -#include "tqpalette.h" -#include "tqpixmap.h" -#include "tqpushbutton.h" -#include "tqscrollbar.h" -#include "tqslider.h" -#include - -/*! - \class TQPlatinumStyle ntqplatinumstyle.h - \brief The TQPlatinumStyle class provides Mac/Platinum look and feel. - - \ingroup appearance - - This class implements the Platinum look and feel. It's an - experimental class that tries to resemble a Macinosh-like GUI - style with the TQStyle system. The emulation is currently far from - perfect. - - \sa TQAquaStyle -*/ - - -/*! - Constructs a TQPlatinumStyle -*/ -TQPlatinumStyle::TQPlatinumStyle() -{ -} - -/*!\reimp -*/ -TQPlatinumStyle::~TQPlatinumStyle() -{ -} - - -/*!\reimp - */ -void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt ) const -{ - switch (pe) { - case PE_HeaderSection: - { - // adjust the sunken flag, otherwise headers are drawn - // sunken... - if ( flags & Style_Sunken ) - flags ^= Style_Sunken; - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags, opt ); - break; - } - case PE_ButtonTool: - { - // tool buttons don't change color when pushed in platinum, - // so we need to make the mid and button color the same - TQColorGroup myCG = cg; - TQBrush fill; - - // quick trick to make sure toolbuttons drawn sunken - // when they are activated... - if ( flags & Style_On ) - flags |= Style_Sunken; - - fill = myCG.brush( TQColorGroup::Button ); - myCG.setBrush( TQColorGroup::Mid, fill ); - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, myCG, flags, opt ); - break; - } - case PE_ButtonBevel: - { - int x, - y, - w, - h; - r.rect( &x, &y, &w, &h ); - - TQPen oldPen = p->pen(); - if ( w * h < 1600 || - TQABS(w - h) > 10 ) { - // small buttons - - if ( !(flags & (Style_Sunken | Style_Down)) ) { - p->fillRect( x + 2, y + 2, w - 4, h - 4, - cg.brush(TQColorGroup::Button) ); - // the bright side - p->setPen( cg.dark() ); - // the bright side - p->setPen( cg.dark() ); - p->drawLine( x, y, x + w - 1, y ); - p->drawLine( x, y, x, y + h - 1 ); - - p->setPen( cg.light() ); - p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); - p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); - - // the dark side - p->setPen( cg.mid() ); - p->drawLine( x + 2, y + h - 2, x + w - 2, y + h - 2 ); - p->drawLine( x + w - 2, y + 2, x + w - 2, y + h - 3 ); - - p->setPen( cg.dark().dark() ); - p->drawLine( x + 1, y + h - 1, x + w - 1, - y + h - 1 ); - p->drawLine( x + w - 1, y + 1, - x + w - 1, - y + h - 2 ); - } else { - p->fillRect(x + 2, y + 2, - w - 4, h - 4, - cg.brush( TQColorGroup::Mid )); - - // the dark side - p->setPen( cg.dark().dark() ); - p->drawLine( x, y, x + w - 1, y ); - p->drawLine( x, y, x, y + h - 1 ); - - p->setPen( cg.mid().dark()); - p->drawLine( x + 1, y + 1, - x + w-2, y + 1); - p->drawLine( x + 1, y + 1, - x + 1, y + h - 2 ); - - - // the bright side! - - p->setPen(cg.button()); - p->drawLine( x + 1, y + h - 2, - x + w - 2, - y + h - 2 ); - p->drawLine( x + w - 2, y + 1, - x + w - 2, - y + h - 2 ); - p->setPen(cg.dark()); - p->drawLine(x, y + h - 1, - x + w - 1, - y + h - 1 ); - p->drawLine(x + w - 1, y, - x + w - 1, - y + h - 1 ); - } - } else { - // big ones - if ( !(flags & (Style_Sunken | Style_Down)) ) { - p->fillRect( x + 3, y + 3, w - 6, - h - 6, - cg.brush(TQColorGroup::Button) ); - - // the bright side - p->setPen( cg.button().dark() ); - p->drawLine( x, y, x + w - 1, y ); - p->drawLine( x, y, x, y + h - 1 ); - - p->setPen( cg.button() ); - p->drawLine( x + 1, y + 1, - x + w - 2, y + 1 ); - p->drawLine( x + 1, y + 1, - x + 1, y + h - 2 ); - - p->setPen( cg.light() ); - p->drawLine( x + 2, y + 2, - x + 2, y + h - 2 ); - p->drawLine( x + 2, y + 2, - x + w - 2, y + 2 ); - // the dark side! - - p->setPen( cg.mid() ); - p->drawLine( x + 3, y + h - 3, - x + w - 3, - y + h - 3 ); - p->drawLine( x + w - 3, y + 3, - x + w - 3, - y + h - 3 ); - p->setPen( cg.dark() ); - p->drawLine( x + 2, y + h - 2, - x + w - 2, - y + h - 2 ); - p->drawLine( x + w - 2, y + 2, - x + w - 2, - y + h - 2 ); - - p->setPen( cg.dark().dark() ); - p->drawLine( x + 1, y + h - 1, - x + w - 1, - y + h - 1 ); - p->drawLine( x + w - 1, y + 1, - x + w - 1, - y + h - 1 ); - } else { - p->fillRect( x + 3, y + 3, w - 6, - h - 6, - cg.brush( TQColorGroup::Mid ) ); - - // the dark side - p->setPen( cg.dark().dark().dark() ); - p->drawLine( x, y, x + w - 1, y ); - p->drawLine( x, y, x, y + h - 1 ); - - p->setPen( cg.dark().dark() ); - p->drawLine( x + 1, y + 1, - x + w - 2, y + 1 ); - p->drawLine( x + 1, y + 1, - x + 1, y + h - 2 ); - - p->setPen( cg.mid().dark() ); - p->drawLine( x + 2, y + 2, - x + 2, y + w - 2 ); - p->drawLine( x + 2, y + 2, - x + w - 2, y + 2 ); - - - // the bright side! - - p->setPen( cg.button() ); - p->drawLine( x + 2, y + h - 3, - x + w - 3, - y + h - 3 ); - p->drawLine( x + w - 3, y + 3, - x + w - 3, - y + h - 3 ); - - p->setPen( cg.midlight() ); - p->drawLine( x + 1, y + h - 2, - x + w - 2, - y + h - 2 ); - p->drawLine( x + w - 2, y + 1, - x + w - 2, - y + h - 2 ); - - p->setPen( cg.dark() ); - p->drawLine( x, y + h - 1, - x + w - 1, - y + h - 1 ); - p->drawLine( x + w - 1, y, - x + w - 1, - y + h - 1 ); - - - // corners - p->setPen( mixedColor(cg.dark().dark().dark(), - cg.dark()) ); - p->drawPoint( x, y + h - 1 ); - p->drawPoint( x + w - 1, y ); - - p->setPen( mixedColor(cg.dark().dark(), cg.midlight()) ); - p->drawPoint( x + 1, y + h - 2 ); - p->drawPoint( x + w - 2, y + 1 ); - - p->setPen( mixedColor(cg.mid().dark(), cg.button() ) ); - p->drawPoint( x + 2, y + h - 3 ); - p->drawPoint( x + w - 3, y + 2 ); - } - } - p->setPen( oldPen ); - break; - } - case PE_ButtonCommand: - { - TQPen oldPen = p->pen(); - int x, - y, - w, - h; - r.rect( &x, &y, &w, &h); - - if ( !(flags & (Style_Down | Style_On)) ) { - p->fillRect( x+3, y+3, w-6, h-6, - cg.brush( TQColorGroup::Button )); - // the bright side - p->setPen( cg.shadow() ); - p->drawLine( x, y, x+w-1, y ); - p->drawLine( x, y, x, y + h - 1 ); - - p->setPen( cg.button() ); - p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); - p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); - - p->setPen( cg.light() ); - p->drawLine( x + 2, y + 2, x + 2, y + h - 2 ); - p->drawLine( x + 2, y + 2, x + w - 2, y + 2 ); - - - // the dark side! - - p->setPen( cg.mid() ); - p->drawLine( x + 3, y + h - 3 ,x + w - 3, y + h - 3 ); - p->drawLine( x + w - 3, y + 3, x + w - 3, y + h - 3 ); - - p->setPen( cg.dark() ); - p->drawLine( x + 2, y + h - 2, x + w - 2, y + h - 2 ); - p->drawLine( x + w - 2, y + 2, x + w - 2, y + h - 2 ); - - p->setPen( cg.shadow() ); - p->drawLine( x + 1, y + h - 1, x + w - 1, y + h - 1 ); - p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); - - - // top left corner: - p->setPen( cg.background() ); - p->drawPoint( x, y ); - p->drawPoint( x + 1, y ); - p->drawPoint( x, y+1 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + 1, y + 1 ); - p->setPen( cg.button() ); - p->drawPoint( x + 2, y + 2 ); - p->setPen( white ); - p->drawPoint( x + 3, y + 3 ); - // bottom left corner: - p->setPen( cg.background() ); - p->drawPoint( x, y + h - 1 ); - p->drawPoint( x + 1, y + h - 1 ); - p->drawPoint( x, y + h - 2 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + 1, y + h - 2 ); - p->setPen( cg.dark() ); - p->drawPoint( x + 2, y + h - 3 ); - // top right corner: - p->setPen( cg.background() ); - p->drawPoint( x + w -1, y ); - p->drawPoint( x + w - 2, y ); - p->drawPoint( x + w - 1, y + 1 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + w - 2, y + 1 ); - p->setPen( cg.dark() ); - p->drawPoint( x + w - 3, y + 2 ); - // bottom right corner: - p->setPen( cg.background() ); - p->drawPoint( x + w - 1, y + h - 1 ); - p->drawPoint( x + w - 2, y + h - 1 ); - p->drawPoint( x + w - 1, y + h - 2 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + w - 2, y + h - 2 ); - p->setPen( cg.dark() ); - p->drawPoint( x + w - 3, y + h - 3 ); - p->setPen( cg.mid() ); - p->drawPoint( x + w - 4, y + h - 4 ); - - } else { - p->fillRect( x + 2, y + 2, w - 4, h - 4, - cg.brush(TQColorGroup::Dark) ); - - // the dark side - p->setPen( cg.shadow() ); - p->drawLine( x, y, x + w - 1, y ); - p->drawLine( x, y, x, y + h - 1 ); - - p->setPen( cg.dark().dark() ); - p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); - p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); - - // the bright side! - - p->setPen( cg.button() ); - p->drawLine( x + 1, y + h - 2, x + w - 2, y + h - 2 ); - p->drawLine( x + w - 2, y + 1, x + w - 2, y + h - 2 ); - - p->setPen( cg.dark() ); - p->drawLine( x, y + h - 1, x + w - 1, y + h - 1 ); - p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); - - // top left corner: - p->setPen( cg.background() ); - p->drawPoint( x, y ); - p->drawPoint( x + 1, y ); - p->drawPoint( x, y + 1 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + 1, y + 1 ); - p->setPen( cg.dark().dark() ); - p->drawPoint( x + 3, y + 3 ); - // bottom left corner: - p->setPen( cg.background() ); - p->drawPoint( x, y + h - 1 ); - p->drawPoint( x + 1, y + h - 1 ); - p->drawPoint( x, y + h - 2 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + 1, y + h - 2 ); - // top right corner: - p->setPen( cg.background() ); - p->drawPoint( x + w - 1, y ); - p->drawPoint( x + w - 2, y ); - p->drawPoint( x + w - 1, y + 1 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + w - 2, y + 1 ); - // bottom right corner: - p->setPen( cg.background() ); - p->drawPoint( x + w - 1, y + h - 1 ); - p->drawPoint( x + w - 2, y + h - 1 ); - p->drawPoint( x + w - 1, y + h - 2 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + w - 2, y + h - 2 ); - p->setPen( cg.dark() ); - p->drawPoint( x + w - 3, y + h - 3 ); - p->setPen( cg.mid() ); - p->drawPoint( x + w - 4, y + h - 4 ); - } - p->setPen( oldPen ); - break; - } - case PE_Indicator: - { - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect(r.x(), r.y(), - r.width() - 2, r.height()), - cg, flags ); - p->fillRect( r.x() + r.width() - 2, r.y(), 2, r.height(), - cg.brush( TQColorGroup::Background ) ); - p->setPen( cg.shadow() ); - p->drawRect( r.x(), r.y(), r.width() - 2, r.height() ); - - static const TQCOORD nochange_mark[] = { 3,5, 9,5, 3,6, 9,6 }; - static const TQCOORD check_mark[] = { - 3,5, 5,5, 4,6, 5,6, 5,7, 6,7, 5,8, 6,8, 6,9, 9,9, - 6,10, 8,10, 7,11, 8,11, 7,12, 7,12, 8,8, 9,8, 8,7, 10,7, - 9,6, 10,6, 9,5, 11,5, 10,4, 11,4, 10,3, 12,3, - 11,2, 12,2, 11,1, 13,1, 12,0, 13,0 }; - if ( !(flags & Style_Off) ) { - TQPen oldPen = p->pen(); - int x1 = r.x(); - int y1 = r.y(); - if ( flags & Style_Down ) { - x1++; - y1++; - } - TQPointArray amark; - if ( flags & Style_On ) { - amark = TQPointArray( sizeof(check_mark)/(sizeof(TQCOORD)*2), - check_mark ); - // ### KLUDGE!! - flags ^= Style_On; - flags ^= Style_Down; - } else if ( flags & Style_NoChange ) { - amark = TQPointArray( sizeof(nochange_mark) - / (sizeof(TQCOORD) * 2), - nochange_mark ); - } - - amark.translate( x1 + 1, y1 + 1 ); - p->setPen( cg.dark() ); - p->drawLineSegments( amark ); - amark.translate( -1, -1 ); - p->setPen( cg.foreground() ); - p->drawLineSegments( amark ); - p->setPen( oldPen ); - } - break; - } - case PE_IndicatorMask: - { - int x, - y, - w, - h; - r.rect( &x, &y, &w, &h ); - p->fillRect( x, y, w - 2, h, color1); - if ( flags & Style_Off ) { - TQPen oldPen = p->pen(); - p->setPen ( TQPen(color1, 2)); - p->drawLine( x + 2, y + h / 2 - 1, - x + w / 2 - 1, y + h - 4 ); - p->drawLine( x + w / 2 - 1, y + h - 4, - x + w, 0); - p->setPen( oldPen ); - } - break; - } - case PE_ExclusiveIndicator: - { -#define TQCOORDARRLEN(x) sizeof(x) / (sizeof(TQCOORD) * 2 ) - bool down = flags & Style_Down; - bool on = flags & Style_On; - - static const TQCOORD pts1[] = { // normal circle - 5,0, 8,0, 9,1, 10,1, 11,2, 12,3, 12,4, 13,5, - 13,8, 12,9, 12,10, 11,11, 10,12, 9,12, 8,13, - 5,13, 4,12, 3,12, 2,11, 1,10, 1,9, 0,8, 0,5, - 1,4, 1,3, 2,2, 3,1, 4,1 }; - static const TQCOORD pts2[] = { // top left shadow - 5,1, 8,1, 3,2, 7,2, 2,3, 5,3, 2,4, 4,4, - 1,5, 3,5, 1,6, 1,8, 2,6, 2,7 }; - static const TQCOORD pts3[] = { // bottom right, dark - 5,12, 8,12, 7,11, 10,11, 8,10, 11,10, - 9,9, 11,9, 10,8, 12,8, 11,7, 11,7, - 12,5, 12,7 }; - static const TQCOORD pts4[] = { // bottom right, light - 5,12, 8,12, 7,11, 10,11, 9,10, 11,10, - 10,9, 11,9, 11,7, 11,8, 12,5, 12,8 }; - static const TQCOORD pts5[] = { // check mark - 6,4, 8,4, 10,6, 10,8, 8,10, 6,10, 4,8, 4,6 }; - static const TQCOORD pts6[] = { // check mark extras - 4,5, 5,4, 9,4, 10,5, 10,9, 9,10, 5,10, 4,9 }; - int x, y; - x = r.x(); - y = r.y(); - p->eraseRect( r ); - p->setBrush( (down||on) ? cg.brush( TQColorGroup::Dark ) - : cg.brush( TQColorGroup::Button) ); - p->setPen( NoPen ); - p->drawEllipse( x, y, 13, 13 ); - p->setPen( cg.shadow() ); - TQPointArray a( TQCOORDARRLEN(pts1), pts1 ); - a.translate( x, y ); - p->drawPolyline( a ); // draw normal circle - TQColor tc, bc; - const TQCOORD *bp; - int bl; - if ( down || on ) { // pressed down or on - tc = cg.dark().dark(); - bc = cg.light(); - bp = pts4; - bl = TQCOORDARRLEN(pts4); - } else { // released - tc = cg.light(); - bc = cg.dark(); - bp = pts3; - bl = TQCOORDARRLEN(pts3); - } - p->setPen( tc ); - a.setPoints( TQCOORDARRLEN(pts2), pts2 ); - a.translate( x, y ); - p->drawLineSegments( a ); // draw top shadow - p->setPen( bc ); - a.setPoints( bl, bp ); - a.translate( x, y ); - p->drawLineSegments( a ); - if ( on ) { // draw check mark - int x1 = x, - y1 = y; - p->setBrush( cg.foreground() ); - p->setPen( cg.foreground() ); - a.setPoints( TQCOORDARRLEN(pts5), pts5 ); - a.translate( x1, y1 ); - p->drawPolygon( a ); - p->setBrush( NoBrush ); - p->setPen( cg.dark() ); - a.setPoints( TQCOORDARRLEN(pts6), pts6 ); - a.translate( x1, y1 ); - p->drawLineSegments( a ); - } - break; - } - - case PE_ExclusiveIndicatorMask: - { - static const TQCOORD pts1[] = { // normal circle - 5,0, 8,0, 9,1, 10,1, 11,2, 12,3, 12,4, 13,5, - 13,8, 12,9, 12,10, 11,11, 10,12, 9,12, 8,13, - 5,13, 4,12, 3,12, 2,11, 1,10, 1,9, 0,8, 0,5, - 1,4, 1,3, 2,2, 3,1, 4,1 }; - TQPointArray a(TQCOORDARRLEN(pts1), pts1); - a.translate(r.x(), r.y()); - p->setPen(color1); - p->setBrush(color1); - p->drawPolygon(a); - break; - } - case PE_ScrollBarAddLine: - { - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, - (flags & Style_Enabled) | ((flags & Style_Down) - ? Style_Sunken - : Style_Raised) ); - p->setPen( cg.shadow() ); - p->drawRect( r ); - drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight - : PE_ArrowDown), p, ceData, elementFlags, TQRect(r.x() + 2, - r.y() + 2, - r.width() - 4, - r.height() - 4), - cg, flags ); - break; - } - case PE_ScrollBarSubLine: - { - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, - (flags & Style_Enabled) | ((flags & Style_Down) - ? Style_Sunken - : Style_Raised) ); - p->setPen( cg.shadow() ); - p->drawRect( r ); - drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft - : PE_ArrowUp ), p, ceData, elementFlags, TQRect(r.x() + 2, - r.y() + 2, - r.width() - 4, - r.height() - 4), - cg, flags ); - break; - } - case PE_ScrollBarAddPage: - case PE_ScrollBarSubPage: - { - TQPen oldPen = p->pen(); - if ( r.width() < 3 || r.height() < 3 ) { - p->fillRect( r, cg.brush(TQColorGroup::Mid) ); - p->setPen( cg.shadow() ); - p->drawRect( r ); - p->setPen( oldPen ); - } else { - int x, - y, - w, - h; - r.rect( &x, &y, &w, &h ); - if ( flags & Style_Horizontal ) { - p->fillRect( x + 2, y + 2, w - 2, - h - 4, - cg.brush(TQColorGroup::Mid) ); - // the dark side - p->setPen( cg.dark().dark() ); - p->drawLine( x, y, x + w - 1, y ); - p->setPen( cg.shadow()); - p->drawLine( x, y, x, y + h - 1 ); - - p->setPen( cg.mid().dark()); - p->drawLine( x + 1, y + 1, x + w - 1, - y + 1 ); - p->drawLine( x + 1, y + 1, x + 1, - y + h - 2 ); - - // the bright side! - - p->setPen( cg.button()); - p->drawLine( x + 1, y + h - 2, - x + w - 1, - y + h - 2 ); - p->setPen( cg.shadow()); - p->drawLine( x, y + h - 1, - x + w - 1, - y + h - 1 ); - - } else { - p->fillRect( x + 2, y + 2, w - 4, - h - 2, - cg.brush(TQColorGroup::Mid) ); - - // the dark side - p->setPen( cg.dark().dark() ); - p->drawLine( x, y, x + w - 1, y ); - p->setPen( cg.shadow() ); - p->drawLine( x, y, x, y + h - 1 ); - - p->setPen( cg.mid().dark() ); - p->drawLine( x + 1, y + 1, x + w - 2, - y + 1 ); - p->drawLine( x + 1, y + 1, x + 1, - y + h - 1 ); - - // the bright side! - p->setPen( cg.button() ); - p->drawLine( x + w - 2, y + 1, - x + w - 2, - y + h - 1 ); - - p->setPen( cg.shadow() ); - p->drawLine( x + w - 1, y, - x + w - 1, - y + h - 1 ); - - } - } - p->setPen( oldPen ); - break; - } - case PE_ScrollBarSlider: - { - TQPoint bo = p->brushOrigin(); - p->setBrushOrigin( r.topLeft() ); - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, Style_Raised ); - p->setBrushOrigin( bo ); - drawRiffles( p, r.x(), r.y(), r.width(), r.height(), cg, - flags & Style_Horizontal ); - p->setPen( cg.shadow() ); - p->drawRect( r ); - if ( flags & Style_HasFocus ) { - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, TQRect(r.x() + 2, r.y() + 2, - r.width() - 5, - r.height() - 5 ), - cg, flags ); - } - break; - } - default: - TQWindowsStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); - break; - } - -} - -/*!\reimp - */ -void TQPlatinumStyle::drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch( element ) { - case CE_PushButton: - { -#ifndef TQT_NO_PUSHBUTTON - TQColorGroup myCg( cg ); - int x1, y1, x2, y2; - bool useBevelButton; - SFlags flags; - flags = Style_Default; - p->setBrushOrigin( -ceData.bgOffset.x(), - -ceData.bgOffset.y() ); - - // take care of the flags based on what we know... - if ( elementFlags & CEF_IsDown ) - flags |= Style_Down; - if ( elementFlags & CEF_IsOn ) - flags |= Style_On; - if ( elementFlags & CEF_IsEnabled ) - flags |= Style_Enabled; - if ( elementFlags & CEF_IsDefault ) - flags |= Style_Default; - if (! ( elementFlags & CEF_IsFlat ) && !(flags & Style_Down)) - flags |= Style_Raised; - - r.coords( &x1, &y1, &x2, &y2 ); - - p->setPen( cg.foreground() ); - p->setBrush( TQBrush(cg.button(), NoBrush) ); - - TQBrush fill; - if ( elementFlags & CEF_IsDown ) { - fill = cg.brush( TQColorGroup::Dark ); - // this could be done differently, but this - // makes a down Bezel drawn correctly... - myCg.setBrush( TQColorGroup::Mid, fill ); - } else if ( elementFlags & CEF_IsOn ) { - fill = TQBrush( cg.mid(), Dense4Pattern ); - myCg.setBrush( TQColorGroup::Mid, fill ); - } - // to quote the old TQPlatinumStlye drawPushButton... - // small or square image buttons as well as toggle buttons are - // bevel buttons (what a heuristic....) - if ( ( elementFlags & CEF_BiState ) - || ( (!ceData.fgPixmap.isNull()) && - (ceData.rect.width() * ceData.rect.height() < 1600 || - TQABS( ceData.rect.width() - ceData.rect.height()) < 10 )) ) - useBevelButton = TRUE; - else - useBevelButton = FALSE; - - int diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ); - if ( elementFlags & CEF_IsDefault ) { - x1 += 1; - y1 += 1; - x2 -= 1; - y2 -= 1; - TQColorGroup cg2( myCg ); - SFlags myFlags = flags; - // don't draw the default button sunken, unless it's necessary. - if ( myFlags & Style_Down ) - myFlags ^= Style_Down; - if ( myFlags & Style_Sunken ) - myFlags ^= Style_Sunken; - - cg2.setColor( TQColorGroup::Button, cg.mid() ); - if ( useBevelButton ) { - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1, - x2 - x1 + 1, - y2 - y1 + 1 ), - myCg, myFlags, opt ); - } else { - drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x1, y1, - x2 - x1 + 1, - y2 - y1 + 1 ), - cg2, myFlags, opt ); - } - } - - if ( ( elementFlags & CEF_IsDefault ) || ( elementFlags & CEF_AutoDefault ) ) { - x1 += diw; - y1 += diw; - x2 -= diw; - y2 -= diw; - } - - if ( (!( elementFlags & CEF_IsFlat )) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) { - if ( useBevelButton ) { - // fix for toggle buttons... - if ( flags & (Style_Down | Style_On) ) - flags |= Style_Sunken; - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1, - x2 - x1 + 1, - y2 - y1 + 1 ), - myCg, flags, opt ); - } else { - - drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x1, y1, - x2 - x1 + 1, - y2 - y1 + 1 ), - myCg, flags, opt ); - } - } - - - if ( p->brush().style() != NoBrush ) - p->setBrush( NoBrush ); - break; -#endif - } - case CE_PushButtonLabel: - { -#ifndef TQT_NO_PUSHBUTTON - bool on; - int x, y, w, h; - SFlags flags; - flags = Style_Default; - on = (( elementFlags & CEF_IsDown ) || ( elementFlags & CEF_IsOn )); - r.rect( &x, &y, &w, &h ); - if ( elementFlags & CEF_IsMenuWidget ) { - int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); - - TQColorGroup g = cg; - int xx = x + w - dx - 4; - int yy = y - 3; - int hh = h + 6; - - if ( !on ) { - p->setPen( g.mid() ); - p->drawLine( xx, yy + 2, xx, yy + hh - 3 ); - p->setPen( g.button() ); - p->drawLine( xx + 1, yy + 1, xx + 1, yy + hh - 2 ); - p->setPen( g.light() ); - p->drawLine( xx + 2, yy + 2, xx + 2, yy + hh - 2 ); - } - if ( elementFlags & CEF_IsEnabled ) - flags |= Style_Enabled; - drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect(x + w - dx - 1, y + 2, - dx, h - 4), - g, flags, opt ); - w -= dx; - } -#ifndef TQT_NO_ICONSET - if ( !ceData.iconSet.isNull() ) { - TQIconSet::Mode mode = ( elementFlags & CEF_IsEnabled ) - ? TQIconSet::Normal : TQIconSet::Disabled; - if ( mode == TQIconSet::Normal && ( elementFlags & CEF_HasFocus ) ) - mode = TQIconSet::Active; - TQIconSet::State state = TQIconSet::Off; - if ( ( elementFlags & CEF_BiState ) && ( elementFlags & CEF_IsOn ) ) - state = TQIconSet::On; - TQPixmap pixmap = ceData.iconSet.pixmap( TQIconSet::Small, - mode, state ); - int pixw = pixmap.width(); - int pixh = pixmap.height(); - p->drawPixmap( x + 2, y + h / 2 - pixh / 2, pixmap ); - x += pixw + 4; - w -= pixw + 4; - } -#endif - drawItem( p, TQRect( x, y, w, h ), - AlignCenter | ShowPrefix, - ceData.colorGroup, ( elementFlags & CEF_IsEnabled ), - (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, -1, - on ? &ceData.colorGroup.brightText() - : &ceData.colorGroup.buttonText() ); - if ( elementFlags & CEF_HasFocus ) - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, - subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), - cg, flags ); - break; -#endif - } - default: - TQWindowsStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget ); - break; - } -} - -/*!\reimp - */ -void TQPlatinumStyle::drawComplexControl( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags how, - SCFlags sub, - SCFlags subActive, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch ( control ) { - case CC_ComboBox: - { - int x, - y, - w, - h; - r.rect( &x, &y, &w, &h ); - p->fillRect( x + 2, y + 2, w - 4, - h - 4, cg.brush(TQColorGroup::Button) ); - // the bright side - p->setPen(cg.shadow()); - p->drawLine( x, y, x + w - 1, y ); - p->drawLine( x, y, x, y + h - 1 ); - - p->setPen( cg.light() ); - p->drawLine( x + 1, y + 1, - x + w - 2, y + 1 ); - p->drawLine( x + 1, y + 1, - x + 1, y + h - 2 ); - - // the dark side! - - - p->setPen( cg.mid() ); - p->drawLine( x + 2, y + h - 2, - x + w - 2, y + h - 2 ); - p->drawLine( x + w - 2, y + 2, - x + w - 2, y + h - 2 ); - - p->setPen (cg.shadow() ); - p->drawLine( x + 1, y + h - 1, - x + w - 1, y + h - 1 ); - p->drawLine( x + w - 1, y, - x + w - 1, y + h - 1 ); - - // top left corner: - p->setPen( cg.background() ); - p->drawPoint( x, y ); - p->drawPoint( x + 1, y ); - p->drawPoint( x, y + 1 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + 1, y + 1 ); - p->setPen( white ); - p->drawPoint( x + 3, y + 3 ); - // bottom left corner: - p->setPen( cg.background() ); - p->drawPoint( x, y + h - 1 ); - p->drawPoint( x + 1, y + h - 1 ); - p->drawPoint( x, y + h - 2 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + 1, y + h - 2 ); - // top right corner: - p->setPen( cg.background() ); - p->drawPoint( x + w - 1, y ); - p->drawPoint( x + w - 2, y ); - p->drawPoint( x + w - 1, y + 1 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + w - 2, y + 1 ); - // bottom right corner: - p->setPen( cg.background() ); - p->drawPoint( x + w - 1, y + h - 1 ); - p->drawPoint( x + w - 2, y + h - 1 ); - p->drawPoint( x + w - 1, y + h - 2 ); - p->setPen( cg.shadow() ); - p->drawPoint( x + w - 2, y + h - 2 ); - p->setPen( cg.dark() ); - p->drawPoint( x + w - 3, y + h - 3 ); - - if ( sub & SC_ComboBoxArrow ) { - TQRect rTmp = querySubControlMetrics( CC_ComboBox, ceData, elementFlags, - SC_ComboBoxArrow, opt, widget ); - int xx = rTmp.x(), - yy = rTmp.y(), - ww = rTmp.width(), - hh = rTmp.height(); - // the bright side - - p->setPen( cg.mid() ); - p->drawLine( xx, yy+2, xx, yy+hh-3 ); - - p->setPen( cg.button() ); - p->drawLine( xx+1, yy+1, xx+ww-2, yy+1 ); - p->drawLine( xx+1, yy+1, xx+1, yy+hh-2 ); - - p->setPen( cg.light() ); - p->drawLine( xx+2, yy+2, xx+2, yy+hh-2 ); - p->drawLine( xx+2, yy+2, xx+ww-2, yy+2 ); - - - // the dark side! - - p->setPen( cg.mid() ); - p->drawLine( xx+3, yy+hh-3 ,xx+ww-3, yy+hh-3 ); - p->drawLine( xx+ww-3, yy+3, xx+ww-3, yy+hh-3 ); - - p->setPen( cg.dark() ); - p->drawLine( xx+2, yy+hh-2 ,xx+ww-2, yy+hh-2 ); - p->drawLine( xx+ww-2, yy+2, xx+ww-2, yy+hh-2 ); - - p->setPen( cg.shadow() ); - p->drawLine( xx+1, yy+hh-1,xx+ww-1, yy+hh-1 ); - p->drawLine( xx+ww-1, yy, xx+ww-1, yy+hh-1 ); - - // top right corner: - p->setPen( cg.background() ); - p->drawPoint( xx + ww - 1, yy ); - p->drawPoint( xx + ww - 2, yy ); - p->drawPoint( xx + ww - 1, yy + 1 ); - p->setPen( cg.shadow() ); - p->drawPoint( xx + ww - 2, yy + 1 ); - // bottom right corner: - p->setPen( cg.background() ); - p->drawPoint( xx + ww - 1, yy + hh - 1 ); - p->drawPoint( xx + ww - 2, yy + hh - 1 ); - p->drawPoint( xx + ww - 1, yy + hh - 2 ); - p->setPen( cg.shadow() ); - p->drawPoint( xx + ww - 2, yy + hh - 2 ); - p->setPen( cg.dark() ); - p->drawPoint( xx + ww - 3, yy + hh - 3 ); - p->setPen( cg.mid() ); - p->drawPoint( xx + ww - 4, yy + hh - 4 ); - - // and the arrows - p->setPen( cg.foreground() ); - TQPointArray a ; - a.setPoints( 7, -3,1, 3,1, -2,0, 2,0, -1,-1, 1,-1, 0,-2 ); - a.translate( xx + ww / 2, yy + hh / 2 - 3 ); - p->drawLineSegments( a, 0, 3 ); // draw arrow - p->drawPoint( a[6] ); - a.setPoints( 7, -3,-1, 3,-1, -2,0, 2,0, -1,1, 1,1, 0,2 ); - a.translate( xx + ww / 2, yy + hh / 2 + 2 ); - p->drawLineSegments( a, 0, 3 ); // draw arrow - p->drawPoint( a[6] ); - - } -#ifndef TQT_NO_COMBOBOX - if ( sub & SC_ComboBoxEditField ) { - // sadly this is pretty much the windows code, except - // for the first fillRect call... - TQRect re = - TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, - ceData, elementFlags, - SC_ComboBoxEditField, TQStyleOption::Default, widget ), - ceData, elementFlags ); - if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) - p->fillRect( re.x() + 1, re.y() + 1, - re.width() - 2, re.height() - 2, - cg.brush( TQColorGroup::Highlight ) ); - - if ( elementFlags & CEF_HasFocus ) { - p->setPen( cg.highlightedText() ); - p->setBackgroundColor( cg.highlight() ); - } else { - p->setPen( cg.text() ); - p->setBackgroundColor( cg.background() ); - } - - if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) { - TQRect re = - TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, - widget ), - ceData, elementFlags ); - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg, - Style_FocusAtBorder, - TQStyleOption(cg.highlight())); - } - if ( elementFlags & CEF_IsEditable ) { - // need this for the moment... - // was the code in comboButton rect - TQRect ir( x + 3, y + 3, - w - 6 - 16, h - 6 ); - if ( TQApplication::reverseLayout() ) - ir.moveBy( 16, 0 ); - // end comboButtonRect... - ir.setRect( ir.left() - 1, ir.top() - 1, ir.width() + 2, - ir.height() + 2 ); - qDrawShadePanel( p, ir, cg, TRUE, 2, 0 ); - } - } -#endif - break; - } - case CC_Slider: - { -#ifndef TQT_NO_SLIDER - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); - int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); - int ticks = ceData.tickMarkSetting; - - TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, - opt, widget), - handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, - opt, widget); - - if ((sub & SC_SliderGroove) && groove.isValid()) { - p->fillRect( groove, cg.brush(TQColorGroup::Background) ); - - int x, y, w, h; - int mid = thickness / 2; - - if ( ticks & TQSlider::Above ) - mid += len / 8; - if ( ticks & TQSlider::Below ) - mid -= len / 8; - - if ( ceData.orientation == Horizontal ) { - x = 0; - y = groove.y() + mid - 3; - w = ceData.rect.width(); - h = 7; - } else { - x = groove.x() + mid - 3; - y = 0; - w = 7; - h = ceData.rect.height(); - } - - p->fillRect( x, y, w, h, cg.brush( TQColorGroup::Dark )); - // the dark side - p->setPen( cg.dark() ); - p->drawLine( x, y, x + w - 1, y ); - p->drawLine( x, y, x, y + h - 1); - p->setPen( cg.shadow() ); - p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); - p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); - // the bright side! - p->setPen(cg.shadow()); - p->drawLine( x + 1, y + h - 2, x + w - 2, y + h - 2 ); - p->drawLine( x + w - 2, y + 1, x + w - 2, y + h - 2 ); - p->setPen( cg.light() ); - p->drawLine( x, y + h - 1, x + w - 1, y + h - 1 ); - p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); - // top left corner: - p->setPen(cg.background()); - p->drawPoint( x, y ); - p->drawPoint( x + 1, y ); - p->drawPoint( x, y + 1 ); - p->setPen(cg.shadow()); - p->drawPoint( x + 1, y + 1 ); - // bottom left corner: - p->setPen( cg.background() ); - p->drawPoint( x, y + h - 1 ); - p->drawPoint( x + 1, y + h - 1 ); - p->drawPoint( x, y + h - 2 ); - p->setPen( cg.light() ); - p->drawPoint( x + 1, y + h - 2 ); - // top right corner: - p->setPen( cg.background() ); - p->drawPoint( x + w - 1, y ); - p->drawPoint( x + w - 2, y ); - p->drawPoint( x + w - 1, y + 1 ); - p->setPen( cg.dark() ); - p->drawPoint( x + w - 2, y + 1 ); - // bottom right corner: - p->setPen( cg.background() ); - p->drawPoint( x + w - 1, y + h - 1 ); - p->drawPoint( x + w - 2, y + h - 1 ); - p->drawPoint( x + w - 1, y + h - 2 ); - p->setPen( cg.light() ); - p->drawPoint( x + w - 2, y + h - 2 ); - p->setPen( cg.dark() ); - p->drawPoint( x + w - 3, y + h - 3 ); - // ### end slider groove - - if ( how & Style_HasFocus ) - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg ); - } - - if ((sub & SC_SliderHandle) && handle.isValid()) { - const TQColor c0 = cg.shadow(); - const TQColor c1 = cg.dark(); - const TQColor c3 = cg.light(); - - int x1 = handle.x(); - int x2 = handle.x() + handle.width() - 1; - int y1 = handle.y(); - int y2 = handle.y() + handle.height() - 1; - int mx = handle.width() / 2; - int my = handle.height() / 2; - - if ( ceData.orientation == Vertical ) { - // Background - TQBrush oldBrush = p->brush(); - p->setBrush( cg.brush( TQColorGroup::Button ) ); - p->setPen( NoPen ); - TQPointArray a(6); - a.setPoint( 0, x1 + 1, y1 + 1 ); - a.setPoint( 1, x2 - my + 2, y1 + 1 ); - a.setPoint( 2, x2 - 1, y1 + my - 1 ); - a.setPoint( 3, x2 - 1, y2 - my + 1 ); - a.setPoint( 4, x2 - my + 2, y2 - 1 ); - a.setPoint( 5, x1 + 1, y2 - 1 ); - p->drawPolygon( a ); - p->setBrush( oldBrush ); - - // shadow border - p->setPen( c0 ); - p->drawLine( x1, y1 + 1, x1,y2 - 1 ); - p->drawLine( x2 - my + 2, y1, x2, y1 + my - 2 ); - p->drawLine( x2 - my + 2, y2, x2, y1 + my + 2 ); - p->drawLine( x2, y1 + my - 2, x2, y1 + my + 2 ); - p->drawLine( x1 + 1, y1, x2 - my + 2, y1 ); - p->drawLine( x1 + 1, y2, x2 - my + 2, y2 ); - - // light shadow - p->setPen( c3 ); - p->drawLine( x1 + 1, y1 + 2, x1 + 1, y2 - 2 ); - p->drawLine( x1 + 1, y1 + 1, x2 - my + 2, y1 + 1 ); - p->drawLine( x2 - my + 2, y1 + 1, x2 - 1, y1 + my - 2 ); - - // dark shadow - p->setPen(c1); - p->drawLine( x2 - 1, y1 + my - 2, x2 - 1, y1 + my + 2 ); - p->drawLine( x2 - my + 2, y2 - 1, x2 - 1, y1 + my + 2 ); - p->drawLine( x1 + 1, y2 - 1, x2 -my + 2, y2 - 1 ); - - drawRiffles( p, handle.x(), handle.y() + 2, handle.width() - 3, - handle.height() - 4, cg, TRUE ); - } else { // Horizontal - TQBrush oldBrush = p->brush(); - p->setBrush( cg.brush( TQColorGroup::Button ) ); - p->setPen( NoPen ); - TQPointArray a(6); - a.setPoint( 0, x2 - 1, y1 + 1 ); - a.setPoint( 1, x2 - 1, y2 - mx + 2 ); - a.setPoint( 2, x2 - mx + 1, y2 - 1 ); - a.setPoint( 3, x1 + mx - 1, y2 - 1 ); - a.setPoint( 4, x1 + 1, y2 - mx + 2 ); - a.setPoint( 5, x1 + 1, y1 + 1 ); - p->drawPolygon( a ); - p->setBrush( oldBrush ); - - // shadow border - p->setPen( c0 ); - p->drawLine( x1 + 1, y1, x2 - 1, y1 ); - p->drawLine( x1, y2 - mx + 2, x1 + mx - 2, y2 ); - p->drawLine( x2, y2 - mx + 2, x1 + mx + 2, y2 ); - p->drawLine( x1 + mx - 2, y2, x1 + mx + 2, y2 ); - p->drawLine( x1, y1 + 1, x1, y2 - mx + 2 ); - p->drawLine( x2, y1 + 1, x2, y2 - mx + 2 ); - - // light shadow - p->setPen(c3); - p->drawLine( x1 + 1, y1 + 1, x2 - 1, y1 + 1 ); - p->drawLine( x1 + 1, y1 + 1, x1 + 1, y2 - mx + 2 ); - - // dark shadow - p->setPen(c1); - p->drawLine( x2 - 1, y1 + 1, x2 - 1, y2 - mx + 2 ); - p->drawLine( x1 + 1, y2 - mx + 2, x1 + mx - 2, y2 - 1 ); - p->drawLine( x2 - 1, y2 - mx + 2, x1 + mx + 2, y2 - 1 ); - p->drawLine( x1 + mx - 2, y2 - 1, x1 + mx + 2, y2 - 1 ); - - drawRiffles( p, handle.x() + 2, handle.y(), handle.width() - 4, - handle.height() - 5, cg, FALSE ); - } - } - - if ( sub & SC_SliderTickmarks ) - TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, - cg, how, SC_SliderTickmarks, - subActive, opt, widget ); -#endif - break; - } - default: - TQWindowsStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, - how, sub, subActive, opt, widget ); - break; - } -} - - - -/*!\reimp - */ -TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sc, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch( control ) { -#ifndef TQT_NO_COMBOBOX - case CC_ComboBox: - switch( sc ) { - case SC_ComboBoxArrow: { - TQRect ir = ceData.rect; - int xx; - if( TQApplication::reverseLayout() ) - xx = ir.x(); - else - xx = ir.x() + ir.width() - 20; - return TQRect( xx, ir.y(), 20, ir.height()); } - default: - break; - } - break; -#endif -#ifndef TQT_NO_SCROLLBAR - case CC_ScrollBar: { - int sliderStart = ceData.startStep; - int sbextent = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags, widget ); - int maxlen = ((ceData.orientation == TQt::Horizontal) ? - ceData.rect.width() : ceData.rect.height()) - ( sbextent * 2 ); - - int sliderlen; - - // calculate length - if ( ceData.maxSteps != ceData.minSteps ) { - uint range = ceData.maxSteps - ceData.minSteps; - sliderlen = ( ceData.pageStep * maxlen ) / - ( range + ceData.pageStep ); - - int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget ); - if ( sliderlen < slidermin || range > INT_MAX / 2 ) - sliderlen = slidermin; - if ( sliderlen > maxlen ) - sliderlen = maxlen; - } else { - sliderlen = maxlen; - } - - switch ( sc ) { - case SC_ScrollBarSubLine: - if ( ceData.orientation == TQt::Horizontal ) { - int buttonw = TQMIN( ceData.rect.width() / 2, sbextent ); - return TQRect( ceData.rect.width() - 2 * buttonw, 0, buttonw, sbextent ); - } else { - int buttonh = TQMIN( ceData.rect.height() / 2, sbextent ); - return TQRect( 0, ceData.rect.height() - 2 * buttonh, sbextent, buttonh ); - } - case SC_ScrollBarAddLine: - if ( ceData.orientation == TQt::Horizontal ) { - int buttonw = TQMIN( ceData.rect.width() / 2, sbextent ); - return TQRect( ceData.rect.width() - buttonw, 0, sbextent, buttonw ); - } else { - int buttonh = TQMIN( ceData.rect.height() / 2, sbextent ); - return TQRect(0, ceData.rect.height() - buttonh, sbextent, buttonh ); - } - case SC_ScrollBarSubPage: - if ( ceData.orientation == TQt::Horizontal ) - return TQRect( 1, 0, sliderStart, sbextent ); - return TQRect( 0, 1, sbextent, sliderStart ); - case SC_ScrollBarAddPage: - if ( ceData.orientation == TQt::Horizontal ) - return TQRect( sliderStart + sliderlen, 0, maxlen - sliderStart - sliderlen, sbextent ); - return TQRect( 0, sliderStart + sliderlen, sbextent, maxlen - sliderStart - sliderlen ); - case SC_ScrollBarGroove: - if ( ceData.orientation == TQt::Horizontal ) - return TQRect( 1, 0, ceData.rect.width() - sbextent * 2, ceData.rect.height() ); - return TQRect( 0, 1, ceData.rect.width(), ceData.rect.height() - sbextent * 2 ); - default: - break; - } - break; } -#endif -#ifndef TQT_NO_SLIDER - case CC_Slider: { - int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget); - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget); - int mid = thickness / 2; - int ticks = ceData.tickMarkSetting; - int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); - - switch ( sc ) { - case SC_SliderGroove: - if ( ticks & TQSlider::Above ) - mid += len / 8; - if ( ticks & TQSlider::Below ) - mid -= len / 8; - if ( ceData.orientation == TQSlider::Horizontal ) - return TQRect( 0, tickOffset, ceData.rect.width(), thickness ); - return TQRect( tickOffset, 0, thickness, ceData.rect.height() ); - default: - break; - } - break; } -#endif - default: - break; - } - return TQWindowsStyle::querySubControlMetrics( control, ceData, elementFlags, sc, opt, widget ); -} - - -/*!\reimp - */ -int TQPlatinumStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, - const TQWidget *widget ) const -{ - int ret; - switch( metric ) { - case PM_ButtonDefaultIndicator: - ret = 3; - break; - case PM_ButtonShiftHorizontal: - case PM_ButtonShiftVertical: - ret = 0; - break; - case PM_IndicatorWidth: - ret = 15; - break; - case PM_IndicatorHeight: - ret = 13; - break; - case PM_ExclusiveIndicatorHeight: - case PM_ExclusiveIndicatorWidth: - ret = 15; - break; - case PM_SliderLength: - ret = 17; - break; - case PM_MaximumDragDistance: - ret = -1; - break; - default: - ret = TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget ); - break; - } - return ret; -} - -/*!\reimp - */ -TQRect TQPlatinumStyle::subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const -{ - TQRect rect; - switch ( r ) { - case SR_ComboBoxFocusRect: - { - TQRect tmpR = ceData.rect; - rect = TQRect( tmpR.x() + 4, tmpR.y() + 4, tmpR.width() - 8 - 16, - tmpR.height() - 8 ); - break; - } - default: - rect = TQWindowsStyle::subRect( r, ceData, elementFlags, widget ); - break; - } - return rect; -} - -/*! - Mixes two colors \a c1 and \a c2 to a new color. -*/ -TQColor TQPlatinumStyle::mixedColor(const TQColor &c1, const TQColor &c2) const -{ - int h1,s1,v1,h2,s2,v2; - c1.hsv(&h1,&s1,&v1); - c2.hsv(&h2,&s2,&v2); - return TQColor( (h1+h2)/2, (s1+s2)/2, (v1+v2)/2, TQColor::Hsv ); -} - -/*! - Draws the nifty Macintosh decoration used on sliders using painter - \a p and colorgroup \a g. \a x, \a y, \a w, \a h and \a horizontal - specify the geometry and orientation of the riffles. -*/ -void TQPlatinumStyle::drawRiffles( TQPainter* p, int x, int y, int w, int h, - const TQColorGroup &g, bool horizontal ) const -{ - if (!horizontal) { - if (h > 20) { - y += (h-20)/2 ; - h = 20; - } - if (h > 8) { - int n = h / 4; - int my = y+h/2-n; - int i ; - p->setPen(g.light()); - for (i=0; idrawLine(x+3, my+2*i, x+w-5, my+2*i); - } - p->setPen(g.dark()); - my++; - for (i=0; idrawLine(x+4, my+2*i, x+w-4, my+2*i); - } - } - } - else { - if (w > 20) { - x += (w-20)/2 ; - w = 20; - } - if (w > 8) { - int n = w / 4; - int mx = x+w/2-n; - int i ; - p->setPen(g.light()); - for (i=0; idrawLine(mx+2*i, y+3, mx + 2*i, y+h-5); - } - p->setPen(g.dark()); - mx++; - for (i=0; idrawLine(mx+2*i, y+4, mx + 2*i, y+h-4); - } - } - } -} - - -#endif diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp deleted file mode 100644 index ba510e9cb..000000000 --- a/src/styles/qsgistyle.cpp +++ /dev/null @@ -1,1538 +0,0 @@ -/**************************************************************************** -** -** Implementation of Motif-like style class -** -** Created : 981231 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqsgistyle.h" - -#if !defined(TQT_NO_STYLE_SGI) || defined(QT_PLUGIN) - -#include "tqpopupmenu.h" -#include "ntqapplication.h" -#include "tqbutton.h" -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqpixmap.h" -#include "tqpalette.h" -#include "tqwidget.h" -#include "tqpushbutton.h" -#include "tqscrollbar.h" -#include "tqcombobox.h" -#include "tqslider.h" -#include "tqtextedit.h" -#include "tqtoolbar.h" -#include "tqlineedit.h" -#include "tqmenubar.h" -#include - -#ifndef TQT_NO_SLIDER -struct SliderLastPosition -{ - SliderLastPosition() : rect(0,-1,0,-1), slider(0) {} - TQRect rect; - const void* slider; -}; -#endif - -#ifndef TQT_NO_SCROLLBAR -struct ScrollbarLastPosition -{ - ScrollbarLastPosition() : rect( 0,-1, 0,-1 ), scrollbar(0) {} - TQRect rect; - const void* scrollbar; -}; -#endif - -class TQSGIStylePrivate -{ -public: - TQSGIStylePrivate() - : hotWidget( 0 ), mousePos( -1, -1 ) - { - } - - const void* hotWidget; - TQPoint mousePos; -#ifndef TQT_NO_SCROLLBAR - ScrollbarLastPosition lastScrollbarRect; -#endif -#ifndef TQT_NO_SLIDER - SliderLastPosition lastSliderRect; -#endif -}; - -/*! - \class TQSGIStyle ntqsgistyle.h - \brief The TQSGIStyle class provides SGI/Irix look and feel. - - \ingroup appearance - - This class implements the SGI look and feel. It resembles the - SGI/Irix Motif GUI style as closely as TQStyle allows. -*/ - -/*! - Constructs a TQSGIStyle. - - If \a useHighlightCols is FALSE (default value), the style will - polish the application's color palette to emulate the Motif way of - highlighting, which is a simple inversion between the base and the - text color. - - \sa TQMotifStyle::useHighlightColors() -*/ -TQSGIStyle::TQSGIStyle( bool useHighlightCols ) : TQMotifStyle( useHighlightCols ), isApplicationStyle( 0 ) -{ - d = new TQSGIStylePrivate; -} - -/*! - Destroys the style. -*/ -TQSGIStyle::~TQSGIStyle() -{ - delete d; -} - -/*! - \reimp - - Changes some application-wide settings to be SGI-like, e.g. sets a - bold italic font for menu options. -*/ -void -TQSGIStyle::applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ - isApplicationStyle = 1; - TQMotifStyle::polish( ceData, elementFlags, ptr ); - - TQPalette pal = TQApplication::palette(); - // check this on SGI-Boxes - //pal.setColor( TQColorGroup::Background, pal.active().midlight() ); - if (pal.active().button() == pal.active().background()) - pal.setColor( TQColorGroup::Button, pal.active().button().dark(120) ); - // darker basecolor in list-widgets - pal.setColor( TQColorGroup::Base, pal.active().base().dark(130) ); - if (! useHighlightColors() ) { - pal.setColor( TQPalette::Active, TQColorGroup::Highlight, pal.active().text() ); - pal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, pal.active().base() ); - pal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, pal.inactive().text() ); - pal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, pal.inactive().base() ); - pal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, pal.disabled().text() ); - pal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, pal.disabled().base() ); - } - TQApplication::setPalette( pal, TRUE ); - - // different basecolor and highlighting in Q(Multi)LineEdit - pal.setColor( TQColorGroup::Base, TQColor(211,181,181) ); - pal.setColor( TQPalette::Active, TQColorGroup::Highlight, pal.active().midlight() ); - pal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, pal.active().text() ); - pal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, pal.inactive().midlight() ); - pal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, pal.inactive().text() ); - pal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, pal.disabled().midlight() ); - pal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, pal.disabled().text() ); - - TQApplication::setPalette( pal, TRUE, "TQLineEdit" ); - TQApplication::setPalette( pal, TRUE, "TQTextEdit" ); - TQApplication::setPalette( pal, TRUE, "TQDateTimeEditBase" ); - - pal = TQApplication::palette(); - pal.setColor( TQColorGroup::Button, pal.active().background() ); - TQApplication::setPalette( pal, TRUE, "TQMenuBar" ); - TQApplication::setPalette( pal, TRUE, "TQToolBar" ); - TQApplication::setPalette( pal, TRUE, "TQPopupMenu" ); -} - -/*! \reimp -*/ -void -TQSGIStyle::applicationUnPolish( const TQStyleControlElementData&, ControlElementFlags, void * ) -{ - TQFont f = TQApplication::font(); - TQApplication::setFont( f, TRUE ); // get rid of the special fonts for special widget classes -} - -/*! - \reimp - - Installs an event filter for several widget classes to enable - hovering. -*/ -void -TQSGIStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ - TQMotifStyle::polish(ceData, elementFlags, ptr); - - if ( !isApplicationStyle ) { - TQPalette sgiPal = TQApplication::palette(); - - sgiPal.setColor( TQColorGroup::Background, sgiPal.active().midlight() ); - if (sgiPal.active().button() == sgiPal.active().background()) - sgiPal.setColor( TQColorGroup::Button, sgiPal.active().button().dark(110) ); - sgiPal.setColor( TQColorGroup::Base, sgiPal.active().base().dark(130) ); - if (! useHighlightColors() ) { - sgiPal.setColor( TQPalette::Active, TQColorGroup::Highlight, sgiPal.active().text() ); - sgiPal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, sgiPal.active().base() ); - sgiPal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, sgiPal.inactive().text() ); - sgiPal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, sgiPal.inactive().base() ); - sgiPal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, sgiPal.disabled().text() ); - sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().base() ); - } - - if ( (ceData.widgetObjectTypes.contains("TQLineEdit")) || (ceData.widgetObjectTypes.contains("TQTextEdit")) ) { - // different basecolor and highlighting in Q(Multi)LineEdit - sgiPal.setColor( TQColorGroup::Base, TQColor(211,181,181) ); - sgiPal.setColor( TQPalette::Active, TQColorGroup::Highlight, sgiPal.active().midlight() ); - sgiPal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, sgiPal.active().text() ); - sgiPal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, sgiPal.inactive().midlight() ); - sgiPal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, sgiPal.inactive().text() ); - sgiPal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, sgiPal.disabled().midlight() ); - sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().text() ); - - } else if ( (ceData.widgetObjectTypes.contains("TQMenuBar")) || (ceData.widgetObjectTypes.contains("TQToolBar")) ) { - sgiPal.setColor( TQColorGroup::Button, sgiPal.active().midlight() ); - } - - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetPalette, TQStyleWidgetActionRequestData(sgiPal)); - } - - if ( (ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQSlider")) || (ceData.widgetObjectTypes.contains("TQScrollBar")) ) { - installObjectEventHandler(ceData, elementFlags, ptr, this); - widgetActionRequest(ceData, elementFlags, ptr, WAR_EnableMouseTracking); -#ifndef TQT_NO_SCROLLBAR - if ( ceData.widgetObjectTypes.contains("TQScrollBar") ) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::NoBackground)); - } -#endif - } else if ( ceData.widgetObjectTypes.contains("TQComboBox") ) { - TQFont f = TQApplication::font(); - f.setBold( TRUE ); - f.setItalic( TRUE ); - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f)); -#ifndef TQT_NO_MENUBAR - } else if ( ceData.widgetObjectTypes.contains("TQMenuBar") ) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::StyledPanel | TQFrame::Raised)); - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::PaletteBackground)); - TQFont f = TQApplication::font(); - f.setBold( TRUE ); - f.setItalic( TRUE ); - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f)); -#endif -#ifndef TQT_NO_POPUPMENU - } else if ( ceData.widgetObjectTypes.contains("TQPopupMenu") ) { - TQStyleWidgetActionRequestData requestData; - widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetLineWidth, TQStyleWidgetActionRequestData(pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ) + 1)); - TQFont f = TQApplication::font(); - f.setBold( TRUE ); - f.setItalic( TRUE ); - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f)); -#endif - } else if ( (ceData.widgetObjectTypes.contains("TQToolBar")) || (ceData.widgetObjectTypes.contains("TQToolBarSeparator")) ) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::PaletteBackground)); - } -} - -/*! \reimp */ -void -TQSGIStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ - if ( (ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQSlider")) || (ceData.widgetObjectTypes.contains("TQScrollBar")) ) { - removeObjectEventHandler(ceData, elementFlags, ptr, this); -#ifndef TQT_NO_POPUPMENU - } else if ( ceData.widgetObjectTypes.contains("TQPopupMenu") ) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetLineWidth, TQStyleWidgetActionRequestData(pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ))); - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(TQApplication::font())); -#endif -#if !defined(TQT_NO_MENUBAR) || !defined(TQT_NO_COMBOBOX) - } else if ( (ceData.widgetObjectTypes.contains("TQMenuBar")) || (ceData.widgetObjectTypes.contains("TQComboBox")) ) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(TQApplication::font())); -#endif - } -} - -/*! \reimp */ -bool TQSGIStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) -{ - if ( (!(ceData.widgetObjectTypes.contains("TQWidget"))) || (e->type() == TQEvent::Paint) ) - return TQMotifStyle::objectEventHandler( ceData, elementFlags, source, e ); - - switch ( e->type() ) { - case TQEvent::MouseButtonPress: - { -#ifndef TQT_NO_SCROLLBAR - if (ceData.widgetObjectTypes.contains("TQScrollBar")) { - d->lastScrollbarRect.rect = ceData.sliderRect; - d->lastScrollbarRect.scrollbar = source; - widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); - } else -#endif - { -#ifndef TQT_NO_SLIDER - if (ceData.widgetObjectTypes.contains("TQSlider")) { - d->lastSliderRect.rect = ceData.sliderRect; - d->lastSliderRect.slider = source; - widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); - } -#endif - } - } - break; - - case TQEvent::MouseButtonRelease: - { - if ( 0 ) { -#ifndef TQT_NO_SCROLLBAR - } else if (ceData.widgetObjectTypes.contains("TQScrollBar")) { - TQRect oldRect = d->lastScrollbarRect.rect; - d->lastScrollbarRect.rect = TQRect( 0, -1, 0, -1 ); - widgetActionRequest(ceData, elementFlags, source, WAR_RepaintRect, TQStyleWidgetActionRequestData(oldRect)); -#endif -#ifndef TQT_NO_SLIDER - } else if (ceData.widgetObjectTypes.contains("TQSlider")) { - TQRect oldRect = d->lastSliderRect.rect; - d->lastSliderRect.rect = TQRect( 0, -1, 0, -1 ); - widgetActionRequest(ceData, elementFlags, source, WAR_RepaintRect, TQStyleWidgetActionRequestData(oldRect)); -#endif - } - } - break; - - case TQEvent::MouseMove: - if ( !(elementFlags & CEF_IsActiveWindow) ) - break; - if ( ((TQMouseEvent*)e)->button() ) - break; - - d->hotWidget = source; - d->mousePos = ((TQMouseEvent*)e)->pos(); - widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); - break; - - case TQEvent::Enter: - if ( !(elementFlags & CEF_IsActiveWindow) ) - break; - d->hotWidget = source; - widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); - break; - - case TQEvent::Leave: - if ( !(elementFlags & CEF_IsActiveWindow) ) - break; - if ( source == d->hotWidget) { - d->hotWidget = 0; - widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); - } - break; - - default: - break; - } - return TQMotifStyle::objectEventHandler( ceData, elementFlags, source, e ); -} - -static const int sgiItemFrame = 2; // menu item frame width -// static const int sgiSepHeight = 1; // separator item height -static const int sgiItemHMargin = 3; // menu item hor text margin -static const int sgiItemVMargin = 2; // menu item ver text margin -static const int sgiArrowHMargin = 6; // arrow horizontal margin -static const int sgiTabSpacing = 12; // space between text and tab -// static const int sgiCheckMarkHMargin = 2; // horiz. margins of check mark ### not used?!? -static const int sgiCheckMarkSpace = 20; - -/*! \reimp */ -int TQSGIStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const -{ - switch ( metric ) { - case PM_DefaultFrameWidth: - return 2; - - case PM_ButtonDefaultIndicator: - return 4; - - case PM_ScrollBarExtent: - return 21; - - case PM_IndicatorWidth: - case PM_IndicatorHeight: - return 14; - - case PM_ExclusiveIndicatorWidth: - case PM_ExclusiveIndicatorHeight: - return 12; - - case PM_SplitterWidth: - return TQMAX( 10, TQApplication::globalStrut().width() ); - - case PM_MenuIndicatorFrameHBorder: - return (sgiItemFrame+2); - case PM_MenuIndicatorFrameVBorder: - return (sgiItemFrame+4); - case PM_MenuIconIndicatorFrameHBorder: - case PM_MenuIconIndicatorFrameVBorder: - return sgiItemFrame; - - default: - break; - } - return TQMotifStyle::pixelMetric( metric, ceData, elementFlags, widget ); -} - -static void drawPanel( TQPainter *p, int x, int y, int w, int h, - const TQColorGroup &g, bool sunken, - int lineWidth, const TQBrush* fill) -{ - if ( w == 0 || h == 0 ) - return; -#if defined(CHECK_RANGE) - ASSERT( w > 0 && h > 0 && lineWidth >= 0 ); -#endif - TQPen oldPen = p->pen(); // save pen - TQPointArray a( 4*lineWidth ); - if ( sunken ) - p->setPen( g.dark() ); - else - p->setPen( g.light() ); - int x1, y1, x2, y2; - int i; - int n = 0; - x1 = x; - y1 = y2 = y; - x2 = x+w-2; - for ( i=0; idrawLineSegments( a ); - n = 0; - if ( sunken ) - p->setPen( g.light() ); - else - p->setPen( g.dark() ); - x1 = x; - y1 = y2 = y+h-1; - x2 = x+w-1; - for ( i=0; idrawLineSegments( a ); - if ( fill ) { // fill with fill color - TQBrush oldBrush = p->brush(); - p->setPen( TQt::NoPen ); - p->setBrush( *fill ); - p->drawRect( x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2 ); - p->setBrush( oldBrush ); - } - p->setPen( oldPen ); // restore pen -} - -static void drawSeparator( TQPainter *p, int x1, int y1, int x2, int y2, - const TQColorGroup &g ) -{ - TQPen oldPen = p->pen(); - - p->setPen( g.midlight() ); - p->drawLine( x1, y1, x2, y2 ); - p->setPen( g.shadow() ); - if ( y2-y1 < x2-x1 ) - p->drawLine( x1, y1+1, x2, y2+1 ); - else - p->drawLine( x1+1, y1, x2+1, y2 ); - - p->setPen( oldPen ); -} - -static void drawSGIPrefix( TQPainter *p, int x, int y, TQString* miText ) -{ - if ( miText && (!!(*miText)) ) { - int amp = 0; - bool nextAmp = FALSE; - while ( ( amp = miText->find( '&', amp ) ) != -1 ) { - if ( (uint)amp == miText->length()-1 ) - return; - miText->remove( amp,1 ); - nextAmp = (*miText)[amp] == '&'; // next time if && - - if ( !nextAmp ) { // draw special underlining - uint ulx = p->fontMetrics().width(*miText, amp); - - uint ulw = p->fontMetrics().width(*miText, amp+1) - ulx; - - p->drawLine( x+ulx, y, x+ulx+ulw, y ); - p->drawLine( x+ulx, y+1, x+ulx+ulw/2, y+1 ); - p->drawLine( x+ulx, y+2, x+ulx+ulw/4, y+2 ); - } - amp++; - } - } -} - -static int get_combo_extra_width( int h, int *return_awh=0 ) -{ - int awh; - if ( h < 8 ) { - awh = 6; - } else if ( h < 14 ) { - awh = h - 2; - } else { - awh = h/2; - } - if ( return_awh ) - *return_awh = awh; - return awh*2; -} - -static void get_combo_parameters( const TQRect &r, - int &ew, int &awh, int &ax, - int &ay, int &sh, int &dh, - int &sy ) -{ - ew = get_combo_extra_width( r.height(), &awh ); - - sh = (awh+3)/4; - if ( sh < 3 ) - sh = 3; - dh = sh/2 + 1; - - ay = r.y() + (r.height()-awh-sh-dh)/2; - if ( ay < 0 ) { - //panic mode - ay = 0; - sy = r.height(); - } else { - sy = ay+awh+dh; - } - if( TQApplication::reverseLayout() ) - ax = r.x(); - else - ax = r.x() + r.width() - ew; - ax += (ew-awh)/2; -} - -/*! \reimp */ -void TQSGIStyle::drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt ) const -{ - const int x = r.x(); - const int y = r.y(); - const int w = r.width(); - const int h = r.height(); - const bool sunken = flags & ( Style_Sunken | Style_Down | Style_On ); - const int defaultFrameWidth = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ); - bool hot = ( flags & Style_MouseOver ) && ( flags & Style_Enabled ); - - bool dis = ! (flags & Style_Enabled); - bool act = flags & Style_Active; - - switch ( pe ) { - case PE_ButtonCommand: - { - TQBrush fill; - if ( hot ) { - if ( sunken ) - fill = cg.brush( TQColorGroup::Dark ); - else - fill = cg.brush( TQColorGroup::Midlight ); - } else if ( sunken ) { - fill = cg.brush( TQColorGroup::Mid ); - } else { - fill = cg.brush( TQColorGroup::Button ); - } - - drawPanel( p, x, y, w, h, cg, sunken, defaultFrameWidth, &fill ); - } - break; - - case PE_PanelPopup: - case PE_ButtonBevel: - case PE_ButtonTool: - { - drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x+1, y+1, w-2, h-2 ), cg, flags, opt ); - - TQPen oldPen = p->pen(); - TQPointArray a; - - // draw twocolored rectangle - p->setPen( sunken ? cg.light() : cg.dark().dark(200) ); - a.setPoints( 3, x, y+h-1, x+w-1, y+h-1, x+w-1, y ); - p->drawPolyline( a ); - p->setPen( cg.dark() ); - a.setPoints( 3, x, y+h-2, x, y, x+w-2, y ); - p->drawPolyline( a ); - - p->setPen( oldPen ); - } - break; - - case PE_ArrowUp: - case PE_ArrowDown: - case PE_ArrowLeft: - case PE_ArrowRight: - { - TQPointArray a; // arrow polygon - switch ( pe ) { - case PE_ArrowUp: - a.setPoints( 3, 0,-5, -5,4, 4,4 ); - break; - case PE_ArrowDown: - a.setPoints( 3, 0,4, -4,-4, 4,-4 ); - break; - case PE_ArrowLeft: - a.setPoints( 3, -4,0, 4,-5, 4,4 ); - break; - case PE_ArrowRight: - a.setPoints( 3, 4,0, -4,-5, -4,4 ); - break; - default: - return; - } - - p->save(); - p->setPen( TQt::NoPen ); - a.translate( x+w/2, y+h/2 ); - p->setBrush( flags & Style_Enabled ? cg.dark() : cg.light() ); - p->drawPolygon( a ); // draw arrow - p->restore(); - } - break; - - case PE_Indicator: - { - TQRect er = r; - er.addCoords( 1, 1, -1, -1 ); - int iflags = flags & ~Style_On; - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, iflags, opt ); - if ( !(flags & TQStyle::Style_Off) ) { - er = r; - er.addCoords( 1, 2, 1, 1 ); - drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, flags, opt ); - } - } - break; - - case PE_IndicatorMask: - { - TQPen oldPen = p->pen(); - TQBrush oldBrush = p->brush(); - - p->setPen( TQt::color1 ); - p->setBrush( TQt::color1 ); - p->fillRect( x, y, w, h, TQBrush( TQt::color0 ) ); - TQRect er = r; - er.addCoords( 1, 1, -1, -1 ); - p->fillRect(er, TQBrush(TQt::color1)); - - if ( !(flags & TQStyle::Style_Off) ) { - er = r; - er.addCoords( 1, 2, 1, 1 ); - static const TQCOORD check_mark[] = { - 14,0, 10,0, 11,1, 8,1, 9,2, 7,2, 8,3, 6,3, - 7,4, 1,4, 6,5, 1,5, 6,6, 3,6, 5,7, 4,7, - 5,8, 5,8, 4,3, 2,3, 3,2, 3,2 }; - - TQPointArray amark; - amark = TQPointArray( sizeof(check_mark)/(sizeof(TQCOORD)*2), check_mark ); - amark.translate( er.x()+1, er.y()+1 ); - p->drawLineSegments( amark ); - amark.translate( -1, -1 ); - p->drawLineSegments( amark ); - } - - p->setBrush( oldBrush ); - p->setPen( oldPen ); - } - break; - - case PE_CheckMark: - { - static const TQCOORD check_mark[] = { - 14,0, 10,0, 11,1, 8,1, 9,2, 7,2, 8,3, 6,3, - 7,4, 1,4, 6,5, 1,5, 6,6, 3,6, 5,7, 4,7, - 5,8, 5,8, 4,3, 2,3, 3,2, 3,2 }; - - TQPen oldPen = p->pen(); - - TQPointArray amark; - amark = TQPointArray( sizeof(check_mark)/(sizeof(TQCOORD)*2), check_mark ); - amark.translate( x+1, y+1 ); - - if ( flags & Style_On ) { - p->setPen( flags & Style_Enabled ? cg.shadow() : cg.dark() ); - p->drawLineSegments( amark ); - amark.translate( -1, -1 ); - p->setPen( flags & Style_Enabled ? TQColor(255,0,0) : cg.dark() ); - p->drawLineSegments( amark ); - p->setPen( oldPen ); - } else { - p->setPen( flags & Style_Enabled ? cg.dark() : cg.mid() ); - p->drawLineSegments( amark ); - amark.translate( -1, -1 ); - p->setPen( flags & Style_Enabled ? TQColor(230,120,120) : cg.dark() ); - p->drawLineSegments( amark ); - p->setPen( oldPen ); - } - } - break; - - case PE_ExclusiveIndicator: - { - p->save(); - p->eraseRect( x, y, w, h ); - p->translate( x, y ); - - p->setPen( cg.button() ); - p->setBrush( hot ? cg.midlight() : cg.button() ); - TQPointArray a; - a.setPoints( 4, 5,0, 11,6, 6,11, 0,5); - p->drawPolygon( a ); - - p->setPen( cg.dark() ); - p->drawLine( 0,5, 5,0 ); - p->drawLine( 6,0, 11,5 ); - p->setPen( flags & Style_Down ? cg.light() : cg.dark() ); - p->drawLine( 11,6, 6,11 ); - p->drawLine( 5,11, 0,6 ); - p->drawLine( 2,7, 5,10 ); - p->drawLine( 6,10, 9,7 ); - p->setPen( cg.light() ); - p->drawLine( 2,5, 5,2 ); - - if ( flags & Style_On ) { - p->setPen( flags & Style_Enabled ? TQt::blue : TQt::darkGray ); - p->setBrush( flags & Style_Enabled ? TQt::blue : TQt::darkGray ); - a.setPoints(3, 6,2, 8,4, 6,6 ); - p->drawPolygon( a ); - p->setBrush( TQt::NoBrush ); - - p->setPen( cg.shadow() ); - p->drawLine( 7,7, 9,5 ); - } else { - p->drawLine( 6,2, 9,5 ); - } - p->restore(); - } - break; - - case PE_ExclusiveIndicatorMask: - { - p->save(); - TQPen oldPen = p->pen(); - TQBrush oldBrush = p->brush(); - - p->setPen( TQt::color1 ); - p->setBrush( TQt::color1 ); - TQPointArray a; - a.setPoints( 8, 0,5, 5,0, 6,0, 11,5, 11,6, 6,11, 5,11, 0,6 ); - a.translate( x, y ); - p->drawPolygon( a ); - - p->setBrush( oldBrush ); - p->setPen( oldPen ); - p->restore(); - } - break; - - case PE_Panel: - { - const int lineWidth = opt.isDefault() ? defaultFrameWidth : opt.lineWidth(); - drawPanel( p, x, y, w, h, cg, flags & (Style_Sunken | Style_Down | Style_On), lineWidth, 0 ); - if ( lineWidth <= 1 ) - return; - - // draw extra shadinglines - TQPen oldPen = p->pen(); - p->setPen( cg.midlight() ); - p->drawLine( x+1, y+h-3, x+1, y+1 ); - p->drawLine( x+1, y+1, x+w-3, y+1 ); - p->setPen( cg.mid() ); - p->drawLine( x+1, y+h-2, x+w-2, y+h-2 ); - p->drawLine( x+w-2, y+h-2, x+w-2, y+1 ); - p->setPen(oldPen); - } - break; - - case PE_ScrollBarSubLine: - if ( !r.contains( d->mousePos ) && !(flags & Style_Active) ) - flags &= ~Style_MouseOver; - drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags, opt ); - drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), - p, ceData, elementFlags, r, cg, Style_Enabled | flags); - break; - - case PE_ScrollBarAddLine: - if ( !r.contains( d->mousePos ) ) - flags &= ~Style_MouseOver; - drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags, opt ); - drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), - p, ceData, elementFlags, r, cg, Style_Enabled | flags); - break; - - case PE_ScrollBarSubPage: - case PE_ScrollBarAddPage: - if ( !r.contains( d->mousePos ) ) - flags &= ~Style_MouseOver; - if ( r.isValid() ) - qDrawShadePanel( p, x, y, w, h, cg, FALSE, 1, hot ? &cg.brush( TQColorGroup::Midlight ) : &cg.brush( TQColorGroup::Button ) ); - break; - - case PE_ScrollBarSlider: - { - if ( !r.isValid() ) - break; - if ( !(r.contains( d->mousePos ) || flags & Style_Active) || !(flags & Style_Enabled ) ) - flags &= ~Style_MouseOver; - - TQPixmap pm( r.width(), r.height() ); - TQPainter bp( &pm ); - drawPrimitive(PE_ButtonBevel, &bp, ceData, elementFlags, TQRect(0,0,r.width(),r.height()), cg, flags | Style_Enabled | Style_Raised); - if ( flags & Style_Horizontal ) { - const int sliderM = r.width() / 2; - if ( r.width() > 20 ) { - drawSeparator( &bp, sliderM-5, 2, sliderM-5, r.height()-3, cg ); - drawSeparator( &bp, sliderM+3, 2, sliderM+3, r.height()-3, cg ); - } - if ( r.width() > 10 ) - drawSeparator( &bp, sliderM-1, 2, sliderM-1, r.height()-3, cg ); - - } else { - const int sliderM = r.height() / 2; - if ( r.height() > 20 ) { - drawSeparator( &bp, 2, sliderM-5, r.width()-3, sliderM-5, cg ); - drawSeparator( &bp, 2, sliderM+3, r.width()-3, sliderM+3, cg ); - } - if ( r.height() > 10 ) - drawSeparator( &bp, 2, sliderM-1, r.width()-3, sliderM-1, cg ); - } - bp.end(); - p->drawPixmap( r.x(), r.y(), pm ); - } - - break; - - case PE_Splitter: - { - const int motifOffset = 10; - int sw = pixelMetric( PM_SplitterWidth, ceData, elementFlags ); - if ( flags & Style_Horizontal ) { - int xPos = x + w/2; - int kPos = motifOffset; - int kSize = sw - 2; - - qDrawShadeLine( p, xPos, kPos + kSize - 1 , - xPos, h, cg ); - - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect(xPos-sw/2+1, kPos, kSize, kSize+1), cg, flags, opt ); - qDrawShadeLine( p, xPos+2, 0, xPos, kPos, cg ); - } else { - int yPos = y + h/2; - int kPos = w - motifOffset - sw; - int kSize = sw - 2; - - qDrawShadeLine( p, 0, yPos, kPos, yPos, cg ); - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( kPos, yPos-sw/2+1, kSize+1, kSize ), cg, flags, opt ); - qDrawShadeLine( p, kPos + kSize+1, yPos, w, yPos, cg ); - } - } - break; - - case PE_MenuItemIndicatorFrame: - { - int x, y, w, h; - r.rect(&x, &y, &w, &h); - - SFlags cflags = Style_Default; - if (! dis) - cflags |= Style_Enabled; - if (act) - cflags |= Style_On; - - TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) ); - er.addCoords( 1, 1, -1, -1 ); - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, cflags, opt ); - } - break; - - case PE_MenuItemIndicatorIconFrame: - { - int x, y, w, h; - r.rect(&x, &y, &w, &h); - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, cg, TRUE, 1, &cg.brush( TQColorGroup::Light ) ); - } - break; - - case PE_MenuItemIndicatorCheck: - { - int x, y, w, h; - r.rect(&x, &y, &w, &h); - - SFlags cflags = Style_Default; - if (! dis) - cflags |= Style_Enabled; - if (act) - cflags |= Style_On; - - TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) ); - er.addCoords( 1, 1, -1, -1 ); - er.addCoords( 0, 1, 1, 1 ); - drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, cflags | Style_On, opt ); - } - break; - - default: - TQMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); - break; - } -} - -/*! \reimp */ -void TQSGIStyle::drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - if ( widget == d->hotWidget ) - flags |= Style_MouseOver; - - switch ( element ) { - case CE_PushButton: - { -#ifndef TQT_NO_PUSHBUTTON - int x1, y1, x2, y2; - r.coords( &x1, &y1, &x2, &y2 ); - - p->setPen( cg.foreground() ); - p->setBrush( TQBrush( cg.button(),TQt::NoBrush ) ); - p->setBrushOrigin( -ceData.bgOffset.x(), - -ceData.bgOffset.y() ); - - int diw = pixelMetric( TQStyle::PM_ButtonDefaultIndicator, ceData, elementFlags ); - if ( ( elementFlags & CEF_IsDefault ) || ( elementFlags & CEF_AutoDefault ) ) { - x1 += diw; - y1 += diw; - x2 -= diw; - y2 -= diw; - } - - TQPointArray a; - if ( elementFlags & CEF_IsDefault ) { - if ( diw == 0 ) { - a.setPoints( 9, - x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1, - x2-1, y1+1, x2-1, y2-1, x1+1, y2-1, x1+1, y1+1 ); - p->setPen( cg.shadow() ); - p->drawPolyline( a ); - x1 += 2; - y1 += 2; - x2 -= 2; - y2 -= 2; - } else { - qDrawShadePanel( p, ceData.rect, cg, TRUE ); - } - } - - TQBrush fill = cg.brush( TQColorGroup::Button ); - if ( (!( elementFlags & CEF_IsFlat )) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1, x2-x1+1, y2-y1+1 ), cg, flags, opt ); - - if ( p->brush().style() != TQt::NoBrush ) - p->setBrush( TQt::NoBrush ); -#endif - } - break; - - case CE_PopupMenuItem: - { -#ifndef TQT_NO_POPUPMENU - if ( ( elementFlags & CEF_UseGenericParameters ) || opt.isDefault()) - break; - TQMenuItem *mi = opt.menuItem(); - if ( !mi ) - break; - int tab = opt.tabWidth(); - int maxpmw = opt.maxIconWidth(); - bool dis = ! (flags & Style_Enabled); - bool checkable = ( elementFlags & CEF_IsCheckable ); - bool act = flags & Style_Active; - int x, y, w, h; - - r.rect(&x, &y, &w, &h); - - if ( checkable ) - maxpmw = TQMAX( maxpmw, sgiCheckMarkSpace ); - int checkcol = maxpmw; - - if (mi && mi->isSeparator() ) { - p->setPen( cg.mid() ); - p->drawLine(x, y, x+w, y ); - return; - } - - int pw = sgiItemFrame; - - if ( act && !dis ) { - if ( pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) > 1 ) - drawPanel( p, x, y, w, h, cg, FALSE, pw, - &cg.brush( TQColorGroup::Light ) ); - else - drawPanel( p, x+1, y+1, w-2, h-2, cg, FALSE, 1, - &cg.brush( TQColorGroup::Light ) ); - } else { - p->fillRect( x, y, w, h, cg.brush( TQColorGroup::Button ) ); - } - - if ( !mi ) - return; - - if ( mi->isChecked() ) { - if ( mi->iconSet() ) { - drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); - } - } else { - if ( !act ) - p->fillRect( x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, - cg.brush( TQColorGroup::Button ) ); - } - - if ( mi->iconSet() ) { - TQIconSet::Mode mode = TQIconSet::Normal; - if ( act && !dis ) - mode = TQIconSet::Active; - TQPixmap pixmap; - if ( checkable && mi->isChecked() ) - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); - else - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); - - int pixw = pixmap.width(); - int pixh = pixmap.height(); - TQRect cr( x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame ); - TQRect pmr( 0, 0, pixw, pixh ); - pmr.moveCenter( cr.center() ); - p->setPen( cg.text() ); - p->drawPixmap( pmr.topLeft(), pixmap ); - } else { - if ( checkable ) { - if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt); - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); - } - } - } - - p->setPen( cg.buttonText() ); - - TQColor discol; - if ( dis ) { - discol = cg.text(); - p->setPen( discol ); - } - - int xm = sgiItemFrame + checkcol + sgiItemHMargin; - - if ( mi->custom() ) { - int m = sgiItemVMargin; - p->save(); - mi->custom()->paint( p, cg, act, !dis, - x+xm, y+m, w-xm-tab+1, h-2*m ); - p->restore(); - } - - TQString s = mi->text(); - if ( !!s ) { - int t = s.find( '\t' ); - int m = sgiItemVMargin; - const int text_flags = AlignVCenter | DontClip | SingleLine; //special underline for &x - - TQString miText = s; - if ( t>=0 ) { - p->drawText(x+w-tab-sgiItemHMargin-sgiItemFrame, - y+m, tab, h-2*m, text_flags, miText.mid( t+1 ) ); - miText = s.mid( 0, t ); - } - TQRect br = p->fontMetrics().boundingRect( x+xm, y+m, w-xm-tab+1, h-2*m, - text_flags, mi->text() ); - - drawSGIPrefix( p, br.x()+p->fontMetrics().leftBearing(miText[0]), - br.y()+br.height()+p->fontMetrics().underlinePos()-2, &miText ); - p->drawText( x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, miText, miText.length() ); - } else { - if ( mi->pixmap() ) { - TQPixmap *pixmap = mi->pixmap(); - if ( pixmap->depth() == 1 ) - p->setBackgroundMode( OpaqueMode ); - p->drawPixmap( x+xm, y+sgiItemFrame, *pixmap ); - if ( pixmap->depth() == 1 ) - p->setBackgroundMode( TransparentMode ); - } - } - if ( mi->popup() ) { - int dim = (h-2*sgiItemFrame) / 2; - drawPrimitive( PE_ArrowRight, p, ceData, elementFlags, TQRect( x+w-sgiArrowHMargin-sgiItemFrame-dim, y+h/2-dim/2, dim, dim ), cg, flags ); - } -#endif - } - break; - - case CE_MenuBarItem: - { -#ifndef TQT_NO_MENUDATA - if (opt.isDefault()) - break; - - TQMenuItem *mi = opt.menuItem(); - - bool active = flags & Style_Active; - int x, y, w, h; - r.rect( &x, &y, &w, &h ); - - if ( active ) { - p->setPen( TQPen( cg.shadow(), 1) ); - p->drawRect( x, y, w, h ); - qDrawShadePanel( p, TQRect(x+1,y+1,w-2,h-2), cg, FALSE, 2, - &cg.brush( TQColorGroup::Light )); - } else { - p->fillRect( x, y, w, h, cg.brush( TQColorGroup::Button )); - } - - if ( mi->pixmap() ) - drawItem( p, r, AlignCenter|DontClip|SingleLine, - cg, mi->isEnabled(), mi->pixmap(), "", -1, &cg.buttonText() ); - - if ( !!mi->text() ) { - TQString* text = new TQString(mi->text()); - TQRect br = p->fontMetrics().boundingRect( x, y-2, w+1, h, - AlignCenter|DontClip|SingleLine|ShowPrefix, mi->text() ); - - drawSGIPrefix( p, br.x()+p->fontMetrics().leftBearing((*text)[0]), - br.y()+br.height()+p->fontMetrics().underlinePos()-2, text ); - p->drawText( x, y-2, w+1, h, AlignCenter|DontClip|SingleLine, *text, text->length() ); - delete text; - } -#endif - } - break; - - case CE_CheckBox: - TQMotifStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); - break; - - default: - TQMotifStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); - break; - } -} - -/*! \reimp */ -void TQSGIStyle::drawComplexControl( ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect& r, - const TQColorGroup& cg, - SFlags flags, - SCFlags sub, - SCFlags subActive, - const TQStyleOption& opt, - const TQWidget* widget ) const -{ - if ( widget == d->hotWidget ) - flags |= Style_MouseOver; - - switch ( control ) { - case CC_Slider: - { -#ifndef TQT_NO_SLIDER - TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, - opt, widget), - handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, - opt, widget); - - if ((sub & SC_SliderGroove) && groove.isValid()) { - TQRegion region( groove ); - if ( ( sub & SC_SliderHandle ) && handle.isValid() ) - region = region.subtract( handle ); - if ( d->lastSliderRect.slider == widget && d->lastSliderRect.rect.isValid() ) - region = region.subtract( d->lastSliderRect.rect ); - p->setClipRegion( region ); - - TQRect grooveTop = groove; - grooveTop.addCoords( 1, 1, -1, -1 ); - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, grooveTop, cg, flags & ~Style_MouseOver, opt ); - - if ( flags & Style_HasFocus ) { - TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget ); - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg, flags & ~Style_MouseOver ); - } - - if ( d->lastSliderRect.slider == widget && d->lastSliderRect.rect.isValid() ) { - if ( ( sub & SC_SliderHandle ) && handle.isValid() ) { - region = ceData.rect; - region = region.subtract( handle ); - p->setClipRegion( region ); - } else { - p->setClipping( FALSE ); - } - qDrawShadePanel( p, d->lastSliderRect.rect, cg, TRUE, 1, &cg.brush( TQColorGroup::Dark ) ); - } - p->setClipping( FALSE ); - } - - if (( sub & SC_SliderHandle ) && handle.isValid()) { - if ( flags & Style_MouseOver && !handle.contains( d->mousePos ) && subActive != SC_SliderHandle ) - flags &= ~Style_MouseOver; - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, handle, cg, flags ); - - if ( ceData.orientation == Horizontal ) { - TQCOORD mid = handle.x() + handle.width() / 2; - qDrawShadeLine( p, mid, handle.y(), mid, - handle.y() + handle.height() - 2, - cg, TRUE, 1); - } else { - TQCOORD mid = handle.y() + handle.height() / 2; - qDrawShadeLine( p, handle.x(), mid, - handle.x() + handle.width() - 2, mid, - cg, TRUE, 1); - } - } - - if ( sub & SC_SliderTickmarks ) - TQMotifStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, - SC_SliderTickmarks, subActive, - opt, widget ); -#endif - break; - } - case CC_ComboBox: - { -#ifndef TQT_NO_COMBOBOX - if (sub & SC_ComboBoxFrame) { - TQRect fr = - TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, - SC_ComboBoxFrame, TQStyleOption::Default, widget ), ceData, elementFlags ); - drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, fr, cg, flags ); - } - - if ( sub & SC_ComboBoxArrow ) { - p->save(); - TQRect er = - TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget ), ceData, elementFlags ); - - er.addCoords( 0, 3, 0, 0 ); - - drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, er, cg, flags | Style_Enabled, opt ); - - int awh, ax, ay, sh, sy, dh, ew; - get_combo_parameters( ceData.rect, ew, awh, ax, ay, sh, dh, sy ); - - TQBrush arrow = cg.brush( TQColorGroup::Dark ); - p->fillRect( ax, sy-1, awh, sh, arrow ); - - p->restore(); - if ( elementFlags & CEF_HasFocus ) { - TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ); - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg ); - } - } - if ( sub & SC_ComboBoxEditField ) { - if ( elementFlags & CEF_IsEditable ) { - TQRect er = - TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, - SC_ComboBoxEditField, TQStyleOption::Default, widget ), ceData, elementFlags ); - er.addCoords( -1, -1, 1, 1); - qDrawShadePanel( p, TQRect( er.x()-1, er.y()-1, - er.width()+2, er.height()+2 ), - cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); - } - } -#endif - p->setPen(cg.buttonText()); - break; - } - - case CC_ScrollBar: - { -#ifndef TQT_NO_SCROLLBAR - bool maxedOut = (ceData.minSteps == ceData.maxSteps); - if ( maxedOut ) - flags &= ~Style_Enabled; - - TQRect handle = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSlider, opt, widget ), ceData, elementFlags ); - - if ( sub & SC_ScrollBarGroove ) { - } - if ( sub & SC_ScrollBarAddLine ) { - TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget ), ceData, elementFlags ); - drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, er, cg, flags, opt ); - } - if ( sub & SC_ScrollBarSubLine ) { - TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget ), ceData, elementFlags ); - drawPrimitive( PE_ScrollBarSubLine, p, ceData, elementFlags, er, cg, flags, opt ); - } - if ( sub & SC_ScrollBarAddPage ) { - TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget ), ceData, elementFlags ); - TQRegion region( er ); - if ( d->lastScrollbarRect.scrollbar == widget && - d->lastScrollbarRect.rect.isValid() && - er.intersects( d->lastScrollbarRect.rect ) ) { - region = region.subtract( d->lastScrollbarRect.rect ); - p->setClipRegion( region ); - } - if ( sub & SC_ScrollBarSlider && er.intersects( handle ) ) { - region = region.subtract( handle ); - p->setClipRegion( region ); - } - - drawPrimitive( PE_ScrollBarAddPage, p, ceData, elementFlags, er, cg, flags & ~Style_MouseOver, opt ); - - if ( d->lastScrollbarRect.scrollbar == widget && - d->lastScrollbarRect.rect.isValid() && - er.intersects( d->lastScrollbarRect.rect ) ) { - if ( sub & SC_ScrollBarSlider && handle.isValid() ) { - region = er; - region.subtract( handle ); - p->setClipRegion( region ); - } else { - p->setClipping( FALSE ); - } - qDrawShadePanel( p, d->lastScrollbarRect.rect, cg, TRUE, 1, &cg.brush( TQColorGroup::Dark ) ); - } - p->setClipping( FALSE ); - } - if ( sub & SC_ScrollBarSubPage ) { - TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget ), ceData, elementFlags ); - TQRegion region( er ); - if ( d->lastScrollbarRect.scrollbar == widget && - d->lastScrollbarRect.rect.isValid() && - er.intersects( d->lastScrollbarRect.rect ) ) { - region = region.subtract( d->lastScrollbarRect.rect ); - p->setClipRegion( region ); - } - if ( sub & SC_ScrollBarSlider && er.intersects( handle ) ) { - region = region.subtract( handle ); - p->setClipRegion( region ); - } - drawPrimitive( PE_ScrollBarSubPage, p, ceData, elementFlags, er, cg, flags & ~Style_MouseOver, opt ); - if ( d->lastScrollbarRect.scrollbar == widget && - d->lastScrollbarRect.rect.isValid() && - er.intersects( d->lastScrollbarRect.rect ) ) { - if ( sub & SC_ScrollBarSlider && handle.isValid() ) { - region = er; - region.subtract( handle ); - p->setClipRegion( region ); - } else { - p->setClipping( FALSE ); - } - qDrawShadePanel( p, d->lastScrollbarRect.rect, cg, TRUE, 1, &cg.brush( TQColorGroup::Dark ) ); - } - p->setClipping( FALSE ); - } - if ( sub & SC_ScrollBarSlider ) { - p->setClipping( FALSE ); - if ( subActive == SC_ScrollBarSlider ) - flags |= Style_Active; - - drawPrimitive( PE_ScrollBarSlider, p, ceData, elementFlags, handle, cg, flags, opt ); - } -#endif - } - break; - - default: - TQMotifStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget ); - break; - } -} - -/*!\reimp -*/ -TQSize TQSGIStyle::sizeFromContents( ContentsType contents, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQSize &contentsSize, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - TQSize sz(contentsSize); - - switch(contents) { - case CT_PopupMenuItem: - { -#ifndef TQT_NO_POPUPMENU - if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault()) - break; - - TQMenuItem *mi = opt.menuItem(); - sz = TQMotifStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, - opt, widget ); - // SGI checkmark items needs a bit more room - if ( elementFlags & CEF_IsCheckable ) - sz.setWidth( sz.width() + 8 ); - // submenu indicator needs a bit more room - if (mi->popup()) - sz.setWidth( sz.width() + sgiTabSpacing ); -#endif - break; - } - case CT_ComboBox: - sz.rwidth() += 30; - break; - - default: - sz = TQMotifStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, opt, widget ); - break; - } - - return sz; -} - -/*! \reimp */ -TQRect TQSGIStyle::subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const -{ - TQRect rect; - - switch ( r ) { - case SR_ComboBoxFocusRect: - { - int awh, ax, ay, sh, sy, dh, ew; - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); - TQRect tr = ceData.rect; - - tr.addCoords( fw, fw, -fw, -fw ); - get_combo_parameters( tr, ew, awh, ax, ay, sh, dh, sy ); - rect.setRect(ax-2, ay-2, awh+4, awh+sh+dh+4); - } - break; - default: - return TQMotifStyle::subRect( r, ceData, elementFlags, widget ); - } - - return rect; -} - -/*! \reimp */ -TQRect TQSGIStyle::querySubControlMetrics( ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sub, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch ( control ) { - case CC_ComboBox: - switch ( sub ) { - case SC_ComboBoxFrame: - return ceData.rect; - - case SC_ComboBoxArrow: { - int ew, awh, sh, dh, ax, ay, sy; - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); - TQRect cr = ceData.rect; - cr.addCoords( fw, fw, -fw, -fw ); - get_combo_parameters( cr, ew, awh, ax, ay, sh, dh, sy ); - return TQRect( ax, ay, awh, awh ); } - - case SC_ComboBoxEditField: { - int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); - TQRect rect = ceData.rect; - rect.addCoords( fw, fw, -fw, -fw ); - int ew = get_combo_extra_width( rect.height() ); - rect.addCoords( 1, 1, -1-ew, -1 ); - return rect; } - - default: - break; - } - break; - case CC_ScrollBar: - return TQCommonStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget ); - default: break; - } - return TQMotifStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget ); -} - -/*! \reimp */ -int TQSGIStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const -{ - int ret; - - switch (sh) { - case SH_MenuIndicatorColumnWidth: - { - int maxpmw = opt.maxIconWidth(); - bool checkable = ( elementFlags & CEF_IsCheckable ); - - if ( checkable ) - maxpmw = TQMAX( maxpmw, sgiCheckMarkSpace ); - ret = maxpmw; - } - break; - default: - ret = TQMotifStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); - break; - } - - return ret; -} - -#endif // TQT_NO_STYLE_SGI diff --git a/src/styles/qt_styles.pri b/src/styles/qt_styles.pri index 812690724..b0daa8513 100644 --- a/src/styles/qt_styles.pri +++ b/src/styles/qt_styles.pri @@ -5,10 +5,10 @@ styles { HEADERS +=$$STYLES_H/tqstylefactory.h \ $$STYLES_P/tqstyleinterface_p.h \ $$STYLES_H/tqstyleplugin.h \ - $$STYLES_H/ntqcommonstyle.h + $$STYLES_H/tqcommonstyle.h SOURCES +=$$STYLES_CPP/tqstylefactory.cpp \ $$STYLES_CPP/tqstyleplugin.cpp \ - $$STYLES_CPP/qcommonstyle.cpp + $$STYLES_CPP/tqcommonstyle.cpp contains( styles, all ) { styles += mac cde motifplus sgi platinum compact interlace windows motif @@ -44,8 +44,8 @@ styles { else:DEFINES += TQT_NO_STYLE_AQUA contains( styles, cde ) { - HEADERS +=$$STYLES_H/ntqcdestyle.h - SOURCES +=$$STYLES_CPP/qcdestyle.cpp + HEADERS +=$$STYLES_H/tqcdestyle.h + SOURCES +=$$STYLES_CPP/tqcdestyle.cpp !contains( styles, motif ) { message( cde requires motif ) @@ -55,8 +55,8 @@ styles { else:DEFINES += TQT_NO_STYLE_CDE contains( styles, motifplus ) { - HEADERS +=$$STYLES_H/ntqmotifplusstyle.h - SOURCES +=$$STYLES_CPP/qmotifplusstyle.cpp + HEADERS +=$$STYLES_H/tqmotifplusstyle.h + SOURCES +=$$STYLES_CPP/tqmotifplusstyle.cpp !contains( styles, motif ) { message( motifplus requires motif ) styles += motif @@ -65,8 +65,8 @@ styles { else:DEFINES += TQT_NO_STYLE_MOTIFPLUS contains( styles, interlace ) { - HEADERS +=$$STYLES_H/ntqinterlacestyle.h - SOURCES +=$$STYLES_CPP/qinterlacestyle.cpp + HEADERS +=$$STYLES_H/tqinterlacestyle.h + SOURCES +=$$STYLES_CPP/tqinterlacestyle.cpp !contains( styles, windows ) { message( interlace requires windows ) styles += windows @@ -75,8 +75,8 @@ styles { else:DEFINES += TQT_NO_STYLE_INTERLACE contains( styles, platinum ) { - HEADERS +=$$STYLES_H/ntqplatinumstyle.h - SOURCES +=$$STYLES_CPP/qplatinumstyle.cpp + HEADERS +=$$STYLES_H/tqplatinumstyle.h + SOURCES +=$$STYLES_CPP/tqplatinumstyle.cpp !contains( styles, windows ) { message( platinum requires windows ) styles += windows @@ -85,8 +85,8 @@ styles { else:DEFINES += TQT_NO_STYLE_PLATINUM contains( styles, windowsxp ) { - HEADERS +=$$STYLES_H/qwindowsxpstyle.h - SOURCES +=$$STYLES_CPP/qwindowsxpstyle.cpp + HEADERS +=$$STYLES_H/tqwindowsxpstyle.h + SOURCES +=$$STYLES_CPP/tqwindowsxpstyle.cpp !contains( styles, windowsxp ) { message( windowsxp requires windows ) styles += windows @@ -95,8 +95,8 @@ styles { else:DEFINES += TQT_NO_STYLE_WINDOWSXP contains( styles, sgi ) { - HEADERS +=$$STYLES_H/ntqsgistyle.h - SOURCES +=$$STYLES_CPP/qsgistyle.cpp + HEADERS +=$$STYLES_H/tqsgistyle.h + SOURCES +=$$STYLES_CPP/tqsgistyle.cpp !contains( styles, motif ) { message( sgi requires motif ) styles += motif @@ -105,8 +105,8 @@ styles { else:DEFINES += TQT_NO_STYLE_SGI contains( styles, compact ) { - HEADERS +=$$STYLES_H/ntqcompactstyle.h - SOURCES +=$$STYLES_CPP/qcompactstyle.cpp + HEADERS +=$$STYLES_H/tqcompactstyle.h + SOURCES +=$$STYLES_CPP/tqcompactstyle.cpp !contains( styles, windows ) { message( compact requires windows ) styles += windows @@ -127,14 +127,14 @@ styles { else:DEFINES += TQT_NO_STYLE_POCKETPC contains( styles, windows ) { - HEADERS +=$$STYLES_H/ntqwindowsstyle.h - SOURCES +=$$STYLES_CPP/qwindowsstyle.cpp + HEADERS +=$$STYLES_H/tqwindowsstyle.h + SOURCES +=$$STYLES_CPP/tqwindowsstyle.cpp } else:DEFINES += TQT_NO_STYLE_WINDOWS contains( styles, motif ) { - HEADERS +=$$STYLES_H/ntqmotifstyle.h - SOURCES +=$$STYLES_CPP/qmotifstyle.cpp + HEADERS +=$$STYLES_H/tqmotifstyle.h + SOURCES +=$$STYLES_CPP/tqmotifstyle.cpp } else:DEFINES += TQT_NO_STYLE_MOTIF } diff --git a/src/styles/qwindowsstyle.cpp b/src/styles/qwindowsstyle.cpp deleted file mode 100644 index 1c87c1e9b..000000000 --- a/src/styles/qwindowsstyle.cpp +++ /dev/null @@ -1,2058 +0,0 @@ -/**************************************************************************** -** -** Implementation of Windows-like style class -** -** Created : 981231 -** -** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqwindowsstyle.h" - -#if !defined(TQT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) - -#include "tqpopupmenu.h" -#include "ntqapplication.h" -#include "tqpainter.h" -#include "ntqdrawutil.h" // for now -#include "tqpixmap.h" // for now -#include "tqwidget.h" -#include "tqlabel.h" -#include "tqimage.h" -#include "tqpushbutton.h" -#include "tqcombobox.h" -#include "tqlistbox.h" -#include "tqwidget.h" -#include "ntqrangecontrol.h" -#include "tqscrollbar.h" -#include "tqslider.h" -#include "tqtabwidget.h" -#include "tqtabbar.h" -#include "tqlistview.h" -#include "tqbitmap.h" -#include "ntqcleanuphandler.h" -#include "ntqdockwindow.h" -#include "tqobjectlist.h" -#include "tqmenubar.h" - -#include - - -static const int windowsItemFrame = 2; // menu item frame width -static const int windowsSepHeight = 2; // separator item height -static const int windowsItemHMargin = 3; // menu item hor text margin -static const int windowsItemVMargin = 2; // menu item ver text margin -static const int windowsArrowHMargin = 6; // arrow horizontal margin -static const int windowsTabSpacing = 12; // space between text and tab -static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark -static const int windowsRightBorder = 12; // right border on windows -static const int windowsCheckMarkWidth = 12; // checkmarks width on windows - -static bool use2000style = TRUE; - -enum TQSliderDirection { SlUp, SlDown, SlLeft, SlRight }; - -// A friendly class providing access to TQMenuData's protected member. -class FriendlyMenuData : public TQMenuData -{ - friend class TQWindowsStyle; -}; - -// Private class -class TQWindowsStyle::Private : public TQObject -{ -public: - Private(TQWindowsStyle *parent); - - bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); - -private: - int menuBarTimer; -}; - -TQWindowsStyle::Private::Private(TQWindowsStyle *parent) -: TQObject(parent, "TQWindowsStylePrivate"), menuBarTimer(0) -{ -} - -// Records Alt- and Focus events -bool TQWindowsStyle::Private::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags, void* source, TQEvent *e ) -{ - if (!(ceData.widgetObjectTypes.contains("TQWidget"))) { - return TRUE; - } - - TQWidget *widget = reinterpret_cast(source); - - switch(e->type()) { - case TQEvent::FocusIn: - case TQEvent::FocusOut: - { - // Menubars toggle based on focus - TQMenuBar *menuBar = ::tqt_cast(widget); - if (menuBar && !menuBarTimer) // delayed repaint to avoid flicker - menuBarTimer = menuBar->startTimer(0); - } - break; - case TQEvent::Close: - // Reset widget when closing - break; - case TQEvent::Timer: - { - TQMenuBar *menuBar = ::tqt_cast(widget); - TQTimerEvent *te = (TQTimerEvent*)e; - if (menuBar && te->timerId() == menuBarTimer) { - menuBar->killTimer(te->timerId()); - menuBarTimer = 0; - menuBar->repaint(FALSE); - return TRUE; - } - } - break; - default: - break; - } - - return TRUE; -} - -/*! - \class TQWindowsStyle ntqwindowsstyle.h - \brief The TQWindowsStyle class provides a Microsoft Windows-like look and feel. - - \ingroup appearance - - This style is TQt's default GUI style on Windows. -*/ - -/*! - Constructs a TQWindowsStyle -*/ -TQWindowsStyle::TQWindowsStyle() : TQCommonStyle(), d(0) -{ -#if defined(Q_OS_WIN32) - use2000style = qWinVersion() != TQt::WV_NT && qWinVersion() != TQt::WV_95; -#endif -} - -/*! \reimp */ -TQWindowsStyle::~TQWindowsStyle() -{ - delete d; -} - -/*! \reimp */ -bool TQWindowsStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) { - if (d) { - return d->objectEventHandler(ceData, elementFlags, source, e); - } - return TRUE; -} - -/*! \reimp */ -void TQWindowsStyle::applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) -{ - // We only need the overhead when shortcuts are sometimes hidden - if (styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, 0) && styleHint(SH_HideUnderlineAcceleratorWhenAltUp, TQStyleControlElementData(), CEF_None, 0)) { - d = new Private(this); - installObjectEventHandler(ceData, elementFlags, ptr, this); - } -} - -/*! \reimp */ -void TQWindowsStyle::applicationUnPolish(const TQStyleControlElementData&, ControlElementFlags, void *) -{ - delete d; - d = 0; -} - -/*! \reimp */ -void TQWindowsStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) -{ - TQCommonStyle::polish(ceData, elementFlags, ptr); -} - -/*! \reimp */ -void TQWindowsStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) -{ - TQCommonStyle::polish(ceData, elementFlags, ptr); -} - -/*! \reimp */ -void TQWindowsStyle::polish( TQPalette &pal ) -{ - TQCommonStyle::polish(pal); -} - -/*! \reimp */ -void TQWindowsStyle::drawPrimitive( PrimitiveElement pe, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt ) const -{ - bool dis = !(flags & Style_Enabled); - bool act = flags & Style_Active; - - TQRect rr( r ); - switch (pe) { - case PE_ButtonCommand: - { - TQBrush fill; - - if (! (flags & Style_Down) && (flags & Style_On)) - fill = TQBrush(cg.light(), Dense4Pattern); - else - fill = cg.brush(TQColorGroup::Button); - - if (flags & Style_ButtonDefault && flags & Style_Down) { - p->setPen(cg.dark()); - p->setBrush(fill); - p->drawRect(r); - } else if (flags & (Style_Raised | Style_Down | Style_On | Style_Sunken)) - qDrawWinButton(p, r, cg, flags & (Style_Sunken | Style_Down | - Style_On), &fill); - else - p->fillRect(r, fill); - break; - } - - case PE_ButtonBevel: - case PE_HeaderSection: - { - TQBrush fill; - - if (! (flags & Style_Down) && (flags & Style_On)) - fill = TQBrush(cg.light(), Dense4Pattern); - else - fill = cg.brush(TQColorGroup::Button); - - if (flags & (Style_Raised | Style_Down | Style_On | Style_Sunken)) - qDrawWinButton(p, r, cg, flags & (Style_Down | Style_On), &fill); - else - p->fillRect(r, fill); - break; - } - - case PE_ButtonDefault: - p->setPen(cg.shadow()); - p->drawRect(r); - break; - - case PE_ButtonTool: - { - TQBrush fill; - bool stippled = FALSE; - - if (! (flags & (Style_Down | Style_MouseOver)) && - (flags & Style_On) && - use2000style) { - fill = TQBrush(cg.light(), Dense4Pattern); - stippled = TRUE; - } else - fill = cg.brush(TQColorGroup::Button); - - if (flags & (Style_Raised | Style_Down | Style_On)) { - if (flags & Style_AutoRaise) { - qDrawShadePanel(p, r, cg, flags & (Style_Down | Style_On), - 1, &fill); - - if (stippled) { - p->setPen(cg.button()); - p->drawRect(r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2); - } - } else - qDrawWinButton(p, r, cg, flags & (Style_Down | Style_On), - &fill); - } else - p->fillRect(r, fill); - - break; - } - - case PE_FocusRect: - if (opt.isDefault()) - p->drawWinFocusRect(r); - else - p->drawWinFocusRect(r, opt.color()); - break; - - case PE_Indicator: - { - TQBrush fill; - if (flags & Style_NoChange) { - TQBrush b = p->brush(); - TQColor c = p->backgroundColor(); - p->setBackgroundMode( TransparentMode ); - p->setBackgroundColor( green ); - fill = TQBrush(cg.base(), Dense4Pattern); - p->setBackgroundColor( c ); - p->setBrush( b ); - } else if (flags & Style_Down) - fill = cg.brush( TQColorGroup::Button ); - else if (flags & Style_Enabled) - fill = cg.brush( TQColorGroup::Base ); - else - fill = cg.brush( TQColorGroup::Background ); - - qDrawWinPanel( p, r, cg, TRUE, &fill ); - - if (flags & Style_NoChange ) - p->setPen( cg.dark() ); - else - p->setPen( cg.text() ); - } // FALLTHROUGH - case PE_CheckListIndicator: - if ( pe == PE_CheckListIndicator ) { //since we fall through from PE_Indicator - if ( flags & Style_Enabled ) - p->setPen( TQPen( cg.text(), 1 ) ); - else - p->setPen( TQPen( cg.dark(), 1 ) ); - if ( flags & Style_NoChange ) - p->setBrush( cg.brush( TQColorGroup::Button ) ); - p->drawRect( r.x()+1, r.y()+1, 11, 11 ); - } - if (! (flags & Style_Off)) { - TQPointArray a( 7*2 ); - int i, xx, yy; - xx = rr.x() + 3; - yy = rr.y() + 5; - - for ( i=0; i<3; i++ ) { - a.setPoint( 2*i, xx, yy ); - a.setPoint( 2*i+1, xx, yy+2 ); - xx++; yy++; - } - - yy -= 2; - for ( i=3; i<7; i++ ) { - a.setPoint( 2*i, xx, yy ); - a.setPoint( 2*i+1, xx, yy+2 ); - xx++; yy--; - } - - p->drawLineSegments( a ); - } - break; - - case PE_ExclusiveIndicator: - { -#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2) - static const TQCOORD pts1[] = { // dark lines - 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; - static const TQCOORD pts2[] = { // black lines - 2,8, 1,7, 1,4, 2,3, 2,2, 3,2, 4,1, 7,1, 8,2, 9,2 }; - static const TQCOORD pts3[] = { // background lines - 2,9, 3,9, 4,10, 7,10, 8,9, 9,9, 9,8, 10,7, 10,4, 9,3 }; - static const TQCOORD pts4[] = { // white lines - 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, - 11,4, 10,3, 10,2 }; - static const TQCOORD pts5[] = { // inner fill - 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; - - // make sure the indicator is square - TQRect ir = r; - - if (r.width() < r.height()) { - ir.setTop(r.top() + (r.height() - r.width()) / 2); - ir.setHeight(r.width()); - } else if (r.height() < r.width()) { - ir.setLeft(r.left() + (r.width() - r.height()) / 2); - ir.setWidth(r.height()); - } - - p->eraseRect(ir); - bool down = flags & Style_Down; - bool enabled = flags & Style_Enabled; - bool on = flags & Style_On; - TQPointArray a; - a.setPoints( TQCOORDARRLEN(pts1), pts1 ); - a.translate( ir.x(), ir.y() ); - p->setPen( cg.dark() ); - p->drawPolyline( a ); - a.setPoints( TQCOORDARRLEN(pts2), pts2 ); - a.translate( ir.x(), ir.y() ); - p->setPen( cg.shadow() ); - p->drawPolyline( a ); - a.setPoints( TQCOORDARRLEN(pts3), pts3 ); - a.translate( ir.x(), ir.y() ); - p->setPen( cg.midlight() ); - p->drawPolyline( a ); - a.setPoints( TQCOORDARRLEN(pts4), pts4 ); - a.translate( ir.x(), ir.y() ); - p->setPen( cg.light() ); - p->drawPolyline( a ); - a.setPoints( TQCOORDARRLEN(pts5), pts5 ); - a.translate( ir.x(), ir.y() ); - TQColor fillColor = ( down || !enabled ) ? cg.button() : cg.base(); - p->setPen( fillColor ); - p->setBrush( fillColor ) ; - p->drawPolygon( a ); - if ( on ) { - p->setPen( NoPen ); - p->setBrush( cg.text() ); - p->drawRect( ir.x() + 5, ir.y() + 4, 2, 4 ); - p->drawRect( ir.x() + 4, ir.y() + 5, 4, 2 ); - } - break; - } - - case PE_Panel: - case PE_PanelPopup: - { - int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) - : opt.lineWidth(); - - if (lw == 2) { - TQColorGroup popupCG = cg; - if ( pe == PE_PanelPopup ) { - popupCG.setColor( TQColorGroup::Light, cg.background() ); - popupCG.setColor( TQColorGroup::Midlight, cg.light() ); - } - qDrawWinPanel(p, r, popupCG, flags & Style_Sunken); - } else { - TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); - } - break; - } - - case PE_Splitter: - { - TQPen oldPen = p->pen(); - p->setPen( cg.light() ); - if ( flags & Style_Horizontal ) { - p->drawLine( r.x() + 1, r.y(), r.x() + 1, r.height() ); - p->setPen( cg.dark() ); - p->drawLine( r.x(), r.y(), r.x(), r.height() ); - p->drawLine( r.right()-1, r.y(), r.right()-1, r.height() ); - p->setPen( cg.shadow() ); - p->drawLine( r.right(), r.y(), r.right(), r.height() ); - } else { - p->drawLine( r.x(), r.y() + 1, r.width(), r.y() + 1 ); - p->setPen( cg.dark() ); - p->drawLine( r.x(), r.bottom() - 1, r.width(), r.bottom() - 1 ); - p->setPen( cg.shadow() ); - p->drawLine( r.x(), r.bottom(), r.width(), r.bottom() ); - } - p->setPen( oldPen ); - break; - } - case PE_DockWindowResizeHandle: - { - TQPen oldPen = p->pen(); - p->setPen( cg.light() ); - if ( flags & Style_Horizontal ) { - p->drawLine( r.x(), r.y(), r.width(), r.y() ); - p->setPen( cg.dark() ); - p->drawLine( r.x(), r.bottom() - 1, r.width(), r.bottom() - 1 ); - p->setPen( cg.shadow() ); - p->drawLine( r.x(), r.bottom(), r.width(), r.bottom() ); - } else { - p->drawLine( r.x(), r.y(), r.x(), r.height() ); - p->setPen( cg.dark() ); - p->drawLine( r.right()-1, r.y(), r.right()-1, r.height() ); - p->setPen( cg.shadow() ); - p->drawLine( r.right(), r.y(), r.right(), r.height() ); - } - p->setPen( oldPen ); - break; - } - - case PE_ScrollBarSubLine: - if (use2000style) { - if (flags & Style_Down) { - p->setPen( cg.dark() ); - p->setBrush( cg.brush( TQColorGroup::Button ) ); - p->drawRect( r ); - } else - drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Raised); - } else - drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | - ((flags & Style_Down) ? Style_Down : Style_Raised)); - - drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), - p, ceData, elementFlags, r, cg, flags); - break; - - case PE_ScrollBarAddLine: - if (use2000style) { - if (flags & Style_Down) { - p->setPen( cg.dark() ); - p->setBrush( cg.brush( TQColorGroup::Button ) ); - p->drawRect( r ); - } else - drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Raised); - } else - drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | - ((flags & Style_Down) ? Style_Down : Style_Raised)); - - drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), - p, ceData, elementFlags, r, cg, flags); - break; - - case PE_ScrollBarAddPage: - case PE_ScrollBarSubPage: - { - TQBrush br; - TQColor c = p->backgroundColor(); - - p->setPen(NoPen); - p->setBackgroundMode(OpaqueMode); - - if (flags & Style_Down) { - br = TQBrush(cg.shadow(), Dense4Pattern); - p->setBackgroundColor( cg.dark() ); - p->setBrush( TQBrush(cg.shadow(), Dense4Pattern) ); - } else { - br = (cg.brush(TQColorGroup::Light).pixmap() ? - cg.brush(TQColorGroup::Light) : - TQBrush(cg.light(), Dense4Pattern)); - p->setBrush(br); - } - - p->drawRect(r); - p->setBackgroundColor(c); - break; - } - - case PE_ScrollBarSlider: - if (! (flags & Style_Enabled)) { - TQBrush br = (cg.brush(TQColorGroup::Light).pixmap() ? - cg.brush(TQColorGroup::Light) : - TQBrush(cg.light(), Dense4Pattern)); - p->setPen(NoPen); - p->setBrush(br); - p->setBackgroundMode(OpaqueMode); - p->drawRect(r); - } else - drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, Style_Enabled | Style_Raised); - break; - - case PE_WindowFrame: - { - TQColorGroup popupCG = cg; - popupCG.setColor( TQColorGroup::Light, cg.background() ); - popupCG.setColor( TQColorGroup::Midlight, cg.light() ); - qDrawWinPanel(p, r, popupCG, flags & Style_Sunken); - } - break; - - case PE_MenuItemIndicatorFrame: - { - int x, y, w, h; - r.rect( &x, &y, &w, &h ); - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - TQRect vrect = visualRect( TQRect( x, y, checkcol, h ), r ); - int xvis = vrect.x(); - - if ( act && !dis ) { - qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); - } - else { - TQBrush fill( cg.light(), Dense4Pattern ); - // set the brush origin for the hash pattern to the x/y coordinate - // of the menu item's checkmark... this way, the check marks have - // a consistent look - TQPoint origin = p->brushOrigin(); - p->setBrushOrigin( xvis, y ); - qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &fill ); - // restore the previous brush origin - p->setBrushOrigin( origin ); - } - } - break; - - case PE_MenuItemIndicatorIconFrame: - { - int x, y, w, h; - r.rect( &x, &y, &w, &h ); - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - TQRect vrect = visualRect( TQRect( x, y, checkcol, h ), r ); - int xvis = vrect.x(); - - qDrawShadePanel( p, xvis, y, w, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) ); - } - break; - - case PE_MenuItemIndicatorCheck: - { - int x, y, w, h; - r.rect( &x, &y, &w, &h ); - int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - - int xp = x + windowsItemFrame; - - SFlags cflags = Style_Default; - if (! dis) - cflags |= Style_Enabled; - if (act) - cflags |= Style_On; - - drawPrimitive(PE_CheckMark, p, ceData, elementFlags, visualRect( TQRect(xp, y + windowsItemFrame, checkcol - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags); - } - break; - - default: - if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) { - TQPointArray a; - - switch ( pe ) { - case PE_ArrowUp: - a.setPoints( 7, -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2 ); - break; - - case PE_ArrowDown: - a.setPoints( 7, -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1 ); - break; - - case PE_ArrowRight: - a.setPoints( 7, -2,-3, -2,3, -1,-2, -1,2, 0,-1, 0,1, 1,0 ); - break; - - case PE_ArrowLeft: - a.setPoints( 7, 0,-3, 0,3, -1,-2, -1,2, -2,-1, -2,1, -3,0 ); - break; - - default: - break; - } - - if (a.isNull()) - return; - - p->save(); - if ( flags & Style_Down ) - p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ), - pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) ); - - if ( flags & Style_Enabled ) { - a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 ); - p->setPen( cg.buttonText() ); - p->drawLineSegments( a, 0, 3 ); // draw arrow - p->drawPoint( a[6] ); - } else { - a.translate( r.x() + r.width() / 2 + 1, r.y() + r.height() / 2 + 1 ); - p->setPen( cg.light() ); - p->drawLineSegments( a, 0, 3 ); // draw arrow - p->drawPoint( a[6] ); - a.translate( -1, -1 ); - p->setPen( cg.mid() ); - p->drawLineSegments( a, 0, 3 ); // draw arrow - p->drawPoint( a[6] ); - } - p->restore(); - } else - TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); - } -} - - -/*! - \reimp -*/ -void TQWindowsStyle::drawControl( ControlElement element, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch (element) { -#ifndef TQT_NO_TABBAR - case CE_TabBarTab: - { - if ( ( elementFlags & CEF_UseGenericParameters ) || (!( elementFlags & CEF_HasParentWidget )) || !opt.tab() ) - break; - - const TQTab * t = opt.tab(); - bool selected = flags & Style_Selected; - bool lastTab = (ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1) ? - TRUE : FALSE; - TQRect r2( r ); - if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) { - p->setPen( cg.midlight() ); - - p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); - p->setPen( cg.light() ); - p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 ); - if ( r2.left() == 0 ) - p->drawPoint( ceData.rect.bottomLeft() ); - - if ( selected ) { - p->fillRect( TQRect( r2.left()+1, r2.bottom()-1, r2.width()-3, 2), - cg.brush( TQColorGroup::Background )); - p->setPen( cg.background() ); - p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top()+2 ); - p->setPen( cg.light() ); - } else { - p->setPen( cg.light() ); - r2.setRect( r2.left() + 2, r2.top() + 2, - r2.width() - 4, r2.height() - 2 ); - } - - int x1, x2; - x1 = r2.left(); - x2 = r2.right() - 2; - p->drawLine( x1, r2.bottom()-1, x1, r2.top() + 2 ); - x1++; - p->drawPoint( x1, r2.top() + 1 ); - x1++; - p->drawLine( x1, r2.top(), x2, r2.top() ); - if ( r2.left() > 0 ) { - p->setPen( cg.midlight() ); - } - x1 = r2.left(); - p->drawPoint( x1, r2.bottom()); - - p->setPen( cg.midlight() ); - x1++; - p->drawLine( x1, r2.bottom(), x1, r2.top() + 2 ); - x1++; - p->drawLine( x1, r2.top()+1, x2, r2.top()+1 ); - - p->setPen( cg.dark() ); - x2 = r2.right() - 1; - p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - 1 + - (selected ? 1:-1) ); - p->setPen( cg.shadow() ); - p->drawPoint( x2, r2.top() + 1 ); - p->drawPoint( x2, r2.top() + 1 ); - x2++; - p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - - (selected ? (lastTab ? 0:1) :2)); - } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) { - bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignRight; - bool firstTab = ceData.tabBarData.identIndexMap[t->identifier()] == 0; - if ( selected ) { - p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1), - cg.brush( TQColorGroup::Background )); - p->setPen( cg.background() ); - p->drawLine( r2.left()+1, r2.top(), r2.left()+1, r2.bottom()-2 ); - p->setPen( cg.dark() ); - } else { - p->setPen( cg.shadow() ); - p->drawLine( r2.left() + - (rightAligned && firstTab ? 0 : 1), - r2.top() + 1, - r2.right() - (lastTab ? 0 : 2), - r2.top() + 1 ); - - if ( rightAligned && lastTab ) - p->drawPoint( r2.right(), r2.top() ); - p->setPen( cg.dark() ); - p->drawLine( r2.left(), r2.top(), r2.right() - 1, - r2.top() ); - r2.setRect( r2.left() + 2, r2.top(), - r2.width() - 4, r2.height() - 2 ); - } - - p->drawLine( r2.right() - 1, r2.top() + (selected ? 0: 2), - r2.right() - 1, r2.bottom() - 2 ); - p->drawPoint( r2.right() - 2, r2.bottom() - 2 ); - p->drawLine( r2.right() - 2, r2.bottom() - 1, - r2.left() + 1, r2.bottom() - 1 ); - - p->setPen( cg.midlight() ); - p->drawLine( r2.left() + 1, r2.bottom() - 2, - r2.left() + 1, r2.top() + (selected ? 0 : 2) ); - - p->setPen( cg.shadow() ); - p->drawLine( r2.right(), - r2.top() + (lastTab && rightAligned && - selected) ? 0 : 1, - r2.right(), r2.bottom() - 1 ); - p->drawPoint( r2.right() - 1, r2.bottom() - 1 ); - p->drawLine( r2.right() - 1, r2.bottom(), - r2.left() + 2, r2.bottom() ); - - p->setPen( cg.light() ); - p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2), - r2.left(), r2.bottom() - 2 ); - } else { - TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); - } - break; - } -#endif // TQT_NO_TABBAR - case CE_ToolBoxTab: - { - qDrawShadePanel( p, r, cg, flags & (Style_Sunken | Style_Down | Style_On) , 1, - &cg.brush(TQColorGroup::Button)); - break; - } - -#ifndef TQT_NO_POPUPMENU - case CE_PopupMenuItem: - { - if (( elementFlags & CEF_UseGenericParameters ) || opt.isDefault()) - break; - - TQMenuItem *mi = opt.menuItem(); - if ( !mi ) - break; - - int tab = opt.tabWidth(); - int maxpmw = opt.maxIconWidth(); - bool dis = !(flags&Style_Enabled); - bool checkable = ( elementFlags & CEF_IsCheckable ); - bool act = flags & Style_Active; - int x, y, w, h; - - r.rect(&x, &y, &w, &h); - - if ( checkable ) { - // space for the checkmarks - if (use2000style) - maxpmw = TQMAX( maxpmw, 20 ); - else - maxpmw = TQMAX( maxpmw, 12 ); - } - - int checkcol = maxpmw; - - if ( mi && mi->isSeparator() ) { // draw separator - p->setPen( cg.dark() ); - p->drawLine( x, y, x+w, y ); - p->setPen( cg.light() ); - p->drawLine( x, y+1, x+w, y+1 ); - return; - } - - TQBrush fill = (act ? - cg.brush( TQColorGroup::Highlight ) : - cg.brush( TQColorGroup::Button )); - p->fillRect( x, y, w, h, fill); - - if ( !mi ) - return; - - int xpos = x; - TQRect vrect = visualRect( TQRect( xpos, y, checkcol, h ), r ); - int xvis = vrect.x(); - if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt); - } else if (! act) - p->fillRect(xvis, y, checkcol , h, cg.brush( TQColorGroup::Button )); - - if ( mi->iconSet() ) { // draw iconset - TQIconSet::Mode mode = dis ? TQIconSet::Disabled : TQIconSet::Normal; - if (act && !dis ) - mode = TQIconSet::Active; - TQPixmap pixmap; - if ( checkable && mi->isChecked() ) - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); - else - pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); - int pixw = pixmap.width(); - int pixh = pixmap.height(); - if ( act && !dis && !mi->isChecked() ) - drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); - TQRect pmr( 0, 0, pixw, pixh ); - pmr.moveCenter( vrect.center() ); - p->setPen( cg.text() ); - p->drawPixmap( pmr.topLeft(), pixmap ); - - fill = (act ? - cg.brush( TQColorGroup::Highlight ) : - cg.brush( TQColorGroup::Button )); - int xp = xpos + checkcol + 1; - p->fillRect( visualRect( TQRect( xp, y, w - checkcol - 1, h ), r ), fill); - } else if ( checkable ) { // just "checking"... - if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); - } - } - - p->setPen( act ? cg.highlightedText() : cg.buttonText() ); - - TQColor discol; - if ( dis ) { - discol = cg.text(); - p->setPen( discol ); - } - - int xm = windowsItemFrame + checkcol + windowsItemHMargin; - xpos += xm; - - vrect = visualRect( TQRect( xpos, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin ), r ); - xvis = vrect.x(); - if ( mi->custom() ) { - p->save(); - if ( dis && !act ) { - p->setPen( cg.light() ); - mi->custom()->paint( p, cg, act, !dis, - xvis+1, y+windowsItemVMargin+1, w-xm-tab+1, h-2*windowsItemVMargin ); - p->setPen( discol ); - } - mi->custom()->paint( p, cg, act, !dis, - xvis, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin ); - p->restore(); - } - TQString s = mi->text(); - if ( !s.isNull() ) { // draw text - int t = s.find( '\t' ); - int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; - if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) { - text_flags |= NoAccel; - } - text_flags |= (TQApplication::reverseLayout() ? AlignRight : AlignLeft ); - if ( t >= 0 ) { // draw tab text - int xp = x + w - tab - windowsItemHMargin - windowsItemFrame + 1; - if ( use2000style ) - xp -= 20; - else - xp -= windowsRightBorder; - int xoff = visualRect( TQRect( xp, y+windowsItemVMargin, tab, h-2*windowsItemVMargin ), r ).x(); - if ( dis && !act ) { - p->setPen( cg.light() ); - p->drawText( xoff+1, y+windowsItemVMargin+1, tab, h-2*windowsItemVMargin, text_flags, s.mid( t+1 )); - p->setPen( discol ); - } - p->drawText( xoff, y+windowsItemVMargin, tab, h-2*windowsItemVMargin, text_flags, s.mid( t+1 ) ); - s = s.left( t ); - } - if ( dis && !act ) { - p->setPen( cg.light() ); - p->drawText( xvis+1, y+windowsItemVMargin+1, w-xm-tab+1, h-2*windowsItemVMargin, text_flags, s, t ); - p->setPen( discol ); - } - p->drawText( xvis, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin, text_flags, s, t ); - } else if ( mi->pixmap() ) { // draw pixmap - TQPixmap *pixmap = mi->pixmap(); - if ( pixmap->depth() == 1 ) - p->setBackgroundMode( OpaqueMode ); - p->drawPixmap( xvis, y+windowsItemFrame, *pixmap ); - if ( pixmap->depth() == 1 ) - p->setBackgroundMode( TransparentMode ); - } - if ( mi->popup() ) { // draw sub menu arrow - int dim = (h-2*windowsItemFrame) / 2; - PrimitiveElement arrow; - arrow = ( TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight ); - xpos = x+w - windowsArrowHMargin - windowsItemFrame - dim; - vrect = visualRect( TQRect(xpos, y + h / 2 - dim / 2, dim, dim), r ); - if ( act ) { - TQColorGroup g2 = cg; - g2.setColor( TQColorGroup::ButtonText, g2.highlightedText() ); - drawPrimitive(arrow, p, ceData, elementFlags, vrect, - g2, dis ? Style_Default : Style_Enabled); - } else { - drawPrimitive(arrow, p, ceData, elementFlags, vrect, - cg, dis ? Style_Default : Style_Enabled ); - } - } - - break; - } -#endif - - case CE_MenuBarItem: - { - bool active = flags & Style_Active; - bool hasFocus = flags & Style_HasFocus; - bool down = flags & Style_Down; - TQRect pr = r; - - p->fillRect( r, cg.brush( TQColorGroup::Button ) ); - if ( active || hasFocus ) { - TQBrush b = cg.brush( TQColorGroup::Button ); - if ( active && down ) - p->setBrushOrigin(p->brushOrigin() + TQPoint(1,1)); - if ( active && hasFocus ) - qDrawShadeRect( p, r.x(), r.y(), r.width(), r.height(), - cg, active && down, 1, 0, &b ); - if ( active && down ) { - pr.moveBy( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), - pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); - p->setBrushOrigin(p->brushOrigin() - TQPoint(1,1)); - } - } - TQCommonStyle::drawControl(element, p, ceData, elementFlags, pr, cg, flags, opt, widget); - break; - } - - default: - TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); - } -} - - -/*! - \reimp -*/ -int TQWindowsStyle::pixelMetric(PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const -{ - int ret; - - switch (metric) { - case PM_ButtonDefaultIndicator: - case PM_ButtonShiftHorizontal: - case PM_ButtonShiftVertical: - ret = 1; - break; - - case PM_MaximumDragDistance: - ret = 60; - break; - -#ifndef TQT_NO_SLIDER - case PM_SliderLength: - ret = 11; - break; - - // Returns the number of pixels to use for the business part of the - // slider (i.e., the non-tickmark portion). The remaining space is shared - // equally between the tickmark regions. - case PM_SliderControlThickness: - { - int space = (ceData.orientation == Horizontal) ? ceData.rect.height() - : ceData.rect.width(); - int ticks = ceData.tickMarkSetting; - int n = 0; - if ( ticks & TQSlider::Above ) n++; - if ( ticks & TQSlider::Below ) n++; - if ( !n ) { - ret = space; - break; - } - - int thick = 6; // Magic constant to get 5 + 16 + 5 - if ( ticks != TQSlider::Both && ticks != TQSlider::NoMarks ) - thick += pixelMetric( PM_SliderLength, ceData, elementFlags, widget ) / 4; - - space -= thick; - //### the two sides may be unequal in size - if ( space > 0 ) - thick += (space * 2) / (n + 2); - ret = thick; - break; - } -#endif // TQT_NO_SLIDER - - case PM_MenuBarFrameWidth: - ret = 0; - break; - - case PM_SplitterWidth: - ret = TQMAX( 6, TQApplication::globalStrut().width() ); - break; - - case PM_MenuIndicatorFrameHBorder: - case PM_MenuIndicatorFrameVBorder: - case PM_MenuIconIndicatorFrameHBorder: - case PM_MenuIconIndicatorFrameVBorder: - ret = windowsItemFrame; - break; - - default: - ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget); - break; - } - - return ret; -} - - -/*! - \reimp -*/ -TQSize TQWindowsStyle::sizeFromContents( ContentsType contents, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQSize &contentsSize, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - TQSize sz(contentsSize); - - switch (contents) { - case CT_PushButton: - { -#ifndef TQT_NO_PUSHBUTTON - sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, opt, widget); - int w = sz.width(), h = sz.height(); - - int defwidth = 0; - if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) - defwidth = 2*pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ); - - if (w < 80+defwidth && ceData.fgPixmap.isNull()) - w = 80+defwidth; - if (h < 23+defwidth) - h = 23+defwidth; - - sz = TQSize(w, h); -#endif - break; - } - - case CT_PopupMenuItem: - { -#ifndef TQT_NO_POPUPMENU - if (( elementFlags & CEF_UseGenericParameters ) || opt.isDefault()) - break; - - bool checkable = ( elementFlags & CEF_IsCheckable ); - TQMenuItem *mi = opt.menuItem(); - int maxpmw = opt.maxIconWidth(); - int w = sz.width(), h = sz.height(); - - if (mi->custom()) { - w = mi->custom()->sizeHint().width(); - h = mi->custom()->sizeHint().height(); - if (! mi->custom()->fullSpan()) - h += 2*windowsItemVMargin + 2*windowsItemFrame; - } else if ( mi->widget() ) { - } else if (mi->isSeparator()) { - w = 10; // arbitrary - h = windowsSepHeight; - } else { - if (mi->pixmap()) - h = TQMAX(h, mi->pixmap()->height() + 2*windowsItemFrame); - else if (! mi->text().isNull()) - h = TQMAX(h, TQFontMetrics(ceData.font).height() + 2*windowsItemVMargin + - 2*windowsItemFrame); - - if (mi->iconSet() != 0) - h = TQMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, - TQIconSet::Normal).height() + - 2*windowsItemFrame); - } - - if (! mi->text().isNull() && mi->text().find('\t') >= 0) { - if ( use2000style ) - w += 20; - else - w += windowsTabSpacing; - } else if (mi->popup()) { - w += 2*windowsArrowHMargin; - } - - if (use2000style) { - if (checkable && maxpmw < 20) - w += 20 - maxpmw; - } else { - if (checkable && maxpmw < windowsCheckMarkWidth) - w += windowsCheckMarkWidth - maxpmw; - } - if (checkable || maxpmw > 0) - w += windowsCheckMarkHMargin; - if (use2000style) - w += 20; - else - w += windowsRightBorder; - - sz = TQSize(w, h); -#endif - break; - } - - default: - sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, sz, opt, widget); - break; - } - - return sz; -} - -/*! \reimp -*/ -void TQWindowsStyle::polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ -#ifndef TQT_NO_POPUPMENU - if ( !(ceData.windowState & WState_Polished ) ) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetCheckable); - } -#endif -} - -#ifndef TQT_NO_IMAGEIO_XPM -static const char * const qt_close_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -"..##....##..", -"...##..##...", -"....####....", -".....##.....", -"....####....", -"...##..##...", -"..##....##..", -"............", -"............", -"............"}; - -static const char * const qt_maximize_xpm[]={ -"12 12 2 1", -"# c #000000", -". c None", -"............", -".#########..", -".#########..", -".#.......#..", -".#.......#..", -".#.......#..", -".#.......#..", -".#.......#..", -".#.......#..", -".#########..", -"............", -"............"}; - - -static const char * const qt_minimize_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -"............", -"............", -"............", -"............", -"............", -"............", -"..######....", -"..######....", -"............", -"............"}; - -static const char * const qt_normalizeup_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"....######..", -"....######..", -"....#....#..", -"..######.#..", -"..######.#..", -"..#....###..", -"..#....#....", -"..#....#....", -"..######....", -"............", -"............"}; - - -static const char * const qt_shade_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -"............", -"............", -"............", -".....#......", -"....###.....", -"...#####....", -"..#######...", -"............", -"............", -"............"}; - -static const char * const qt_unshade_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -"............", -"............", -"..#######...", -"...#####....", -"....###.....", -".....#......", -"............", -"............", -"............", -"............"}; - -static const char * dock_window_close_xpm[] = { -"8 8 2 1", -"# c #000000", -". c None", -"........", -".##..##.", -"..####..", -"...##...", -"..####..", -".##..##.", -"........", -"........"}; - -/* XPM */ -static const char * const information_xpm[]={ -"32 32 5 1", -". c None", -"c c #000000", -"* c #999999", -"a c #ffffff", -"b c #0000ff", -"...........********.............", -"........***aaaaaaaa***..........", -"......**aaaaaaaaaaaaaa**........", -".....*aaaaaaaaaaaaaaaaaa*.......", -"....*aaaaaaaabbbbaaaaaaaac......", -"...*aaaaaaaabbbbbbaaaaaaaac.....", -"..*aaaaaaaaabbbbbbaaaaaaaaac....", -".*aaaaaaaaaaabbbbaaaaaaaaaaac...", -".*aaaaaaaaaaaaaaaaaaaaaaaaaac*..", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac*.", -"*aaaaaaaaaabbbbbbbaaaaaaaaaaac*.", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -".*aaaaaaaaaaabbbbbaaaaaaaaaac***", -".*aaaaaaaaaaabbbbbaaaaaaaaaac***", -"..*aaaaaaaaaabbbbbaaaaaaaaac***.", -"...caaaaaaabbbbbbbbbaaaaaac****.", -"....caaaaaaaaaaaaaaaaaaaac****..", -".....caaaaaaaaaaaaaaaaaac****...", -"......ccaaaaaaaaaaaaaacc****....", -".......*cccaaaaaaaaccc*****.....", -"........***cccaaaac*******......", -"..........****caaac*****........", -".............*caaac**...........", -"...............caac**...........", -"................cac**...........", -".................cc**...........", -"..................***...........", -"...................**..........."}; -/* XPM */ -static const char* const warning_xpm[]={ -"32 32 4 1", -". c None", -"a c #ffff00", -"* c #000000", -"b c #999999", -".............***................", -"............*aaa*...............", -"...........*aaaaa*b.............", -"...........*aaaaa*bb............", -"..........*aaaaaaa*bb...........", -"..........*aaaaaaa*bb...........", -".........*aaaaaaaaa*bb..........", -".........*aaaaaaaaa*bb..........", -"........*aaaaaaaaaaa*bb.........", -"........*aaaa***aaaa*bb.........", -".......*aaaa*****aaaa*bb........", -".......*aaaa*****aaaa*bb........", -"......*aaaaa*****aaaaa*bb.......", -"......*aaaaa*****aaaaa*bb.......", -".....*aaaaaa*****aaaaaa*bb......", -".....*aaaaaa*****aaaaaa*bb......", -"....*aaaaaaaa***aaaaaaaa*bb.....", -"....*aaaaaaaa***aaaaaaaa*bb.....", -"...*aaaaaaaaa***aaaaaaaaa*bb....", -"...*aaaaaaaaaa*aaaaaaaaaa*bb....", -"..*aaaaaaaaaaa*aaaaaaaaaaa*bb...", -"..*aaaaaaaaaaaaaaaaaaaaaaa*bb...", -".*aaaaaaaaaaaa**aaaaaaaaaaa*bb..", -".*aaaaaaaaaaa****aaaaaaaaaa*bb..", -"*aaaaaaaaaaaa****aaaaaaaaaaa*bb.", -"*aaaaaaaaaaaaa**aaaaaaaaaaaa*bb.", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", -".*aaaaaaaaaaaaaaaaaaaaaaaaa*bbbb", -"..*************************bbbbb", -"....bbbbbbbbbbbbbbbbbbbbbbbbbbb.", -".....bbbbbbbbbbbbbbbbbbbbbbbbb.."}; -/* XPM */ -static const char* const critical_xpm[]={ -"32 32 4 1", -". c None", -"a c #999999", -"* c #ff0000", -"b c #ffffff", -"...........********.............", -".........************...........", -".......****************.........", -"......******************........", -".....********************a......", -"....**********************a.....", -"...************************a....", -"..*******b**********b*******a...", -"..******bbb********bbb******a...", -".******bbbbb******bbbbb******a..", -".*******bbbbb****bbbbb*******a..", -"*********bbbbb**bbbbb*********a.", -"**********bbbbbbbbbb**********a.", -"***********bbbbbbbb***********aa", -"************bbbbbb************aa", -"************bbbbbb************aa", -"***********bbbbbbbb***********aa", -"**********bbbbbbbbbb**********aa", -"*********bbbbb**bbbbb*********aa", -".*******bbbbb****bbbbb*******aa.", -".******bbbbb******bbbbb******aa.", -"..******bbb********bbb******aaa.", -"..*******b**********b*******aa..", -"...************************aaa..", -"....**********************aaa...", -"....a********************aaa....", -".....a******************aaa.....", -"......a****************aaa......", -".......aa************aaaa.......", -".........aa********aaaaa........", -"...........aaaaaaaaaaa..........", -".............aaaaaaa............"}; -/* XPM */ -static const char *const question_xpm[] = { -"32 32 5 1", -". c None", -"c c #000000", -"* c #999999", -"a c #ffffff", -"b c #0000ff", -"...........********.............", -"........***aaaaaaaa***..........", -"......**aaaaaaaaaaaaaa**........", -".....*aaaaaaaaaaaaaaaaaa*.......", -"....*aaaaaaaaaaaaaaaaaaaac......", -"...*aaaaaaaabbbbbbaaaaaaaac.....", -"..*aaaaaaaabaaabbbbaaaaaaaac....", -".*aaaaaaaabbaaaabbbbaaaaaaaac...", -".*aaaaaaaabbbbaabbbbaaaaaaaac*..", -"*aaaaaaaaabbbbaabbbbaaaaaaaaac*.", -"*aaaaaaaaaabbaabbbbaaaaaaaaaac*.", -"*aaaaaaaaaaaaabbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaaabbbaaaaaaaaaaaac**", -"*aaaaaaaaaaaaabbaaaaaaaaaaaaac**", -"*aaaaaaaaaaaaabbaaaaaaaaaaaaac**", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac**", -".*aaaaaaaaaaaabbaaaaaaaaaaaac***", -".*aaaaaaaaaaabbbbaaaaaaaaaaac***", -"..*aaaaaaaaaabbbbaaaaaaaaaac***.", -"...caaaaaaaaaabbaaaaaaaaaac****.", -"....caaaaaaaaaaaaaaaaaaaac****..", -".....caaaaaaaaaaaaaaaaaac****...", -"......ccaaaaaaaaaaaaaacc****....", -".......*cccaaaaaaaaccc*****.....", -"........***cccaaaac*******......", -"..........****caaac*****........", -".............*caaac**...........", -"...............caac**...........", -"................cac**...........", -".................cc**...........", -"..................***...........", -"...................**...........", -}; -#endif //TQT_NO_IMAGEIO_XPM - -/*! - \reimp - */ -TQPixmap TQWindowsStyle::stylePixmap(StylePixmap stylepixmap, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption& opt, - const TQWidget *widget) const -{ -#ifndef TQT_NO_IMAGEIO_XPM - switch (stylepixmap) { - case SP_TitleBarShadeButton: - return TQPixmap( (const char **)qt_shade_xpm ); - case SP_TitleBarUnshadeButton: - return TQPixmap( (const char **)qt_unshade_xpm ); - case SP_TitleBarNormalButton: - return TQPixmap( (const char **)qt_normalizeup_xpm ); - case SP_TitleBarMinButton: - return TQPixmap( (const char **)qt_minimize_xpm ); - case SP_TitleBarMaxButton: - return TQPixmap( (const char **)qt_maximize_xpm ); - case SP_TitleBarCloseButton: - return TQPixmap( (const char **)qt_close_xpm ); - case SP_DockWindowCloseButton: - return TQPixmap( (const char **)dock_window_close_xpm ); - case SP_MessageBoxInformation: - return TQPixmap( (const char **)information_xpm); - case SP_MessageBoxWarning: - return TQPixmap( (const char **)warning_xpm ); - case SP_MessageBoxCritical: - return TQPixmap( (const char **)critical_xpm ); - case SP_MessageBoxQuestion: - return TQPixmap( (const char **)question_xpm ); - default: - break; - } -#endif //TQT_NO_IMAGEIO_XPM - return TQCommonStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget); -} - -/*!\reimp -*/ -void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - SCFlags sub, - SCFlags subActive, - const TQStyleOption& opt, - const TQWidget *widget ) const -{ - switch (ctrl) { -#ifndef TQT_NO_LISTVIEW - case CC_ListView: - { - if ( sub & SC_ListView ) { - TQCommonStyle::drawComplexControl( ctrl, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget ); - } - if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) { - if (opt.isDefault()) - break; - - TQListViewItem *item = opt.listViewItem(), - *child = item->firstChild(); - - int y = r.y(); - int c; - int dotoffset = 0; - TQPointArray dotlines; - if ( subActive == (uint)SC_All && sub == SC_ListViewExpand ) { - c = 2; - dotlines.resize(2); - dotlines[0] = TQPoint( r.right(), r.top() ); - dotlines[1] = TQPoint( r.right(), r.bottom() ); - } else { - int linetop = 0, linebot = 0; - // each branch needs at most two lines, ie. four end points - dotoffset = (item->itemPos() + item->height() - y) %2; - dotlines.resize( item->childCount() * 4 ); - c = 0; - - // skip the stuff above the exposed rectangle - while ( child && y + child->height() <= 0 ) { - y += child->totalHeight(); - child = child->nextSibling(); - } - - int bx = r.width() / 2; - - // paint stuff in the magical area - TQListView* v = item->listView(); - while ( child && y < r.height() ) { - if (child->isVisible()) { - int lh; - if ( !item->multiLinesEnabled() ) - lh = child->height(); - else - lh = p->fontMetrics().height() + 2 * v->itemMargin(); - lh = TQMAX( lh, TQApplication::globalStrut().height() ); - if ( lh % 2 > 0 ) - lh++; - linebot = y + lh/2; - if ( (child->isExpandable() || child->childCount()) && - (child->height() > 0) ) { - // needs a box - p->setPen( cg.mid() ); - p->drawRect( bx-4, linebot-4, 9, 9 ); - // plus or minus - p->setPen( cg.text() ); - p->drawLine( bx - 2, linebot, bx + 2, linebot ); - if ( !child->isOpen() ) - p->drawLine( bx, linebot - 2, bx, linebot + 2 ); - // dotlinery - p->setPen( cg.mid() ); - dotlines[c++] = TQPoint( bx, linetop ); - dotlines[c++] = TQPoint( bx, linebot - 4 ); - dotlines[c++] = TQPoint( bx + 5, linebot ); - dotlines[c++] = TQPoint( r.width(), linebot ); - linetop = linebot + 5; - } else { - // just dotlinery - dotlines[c++] = TQPoint( bx+1, linebot -1); - dotlines[c++] = TQPoint( r.width(), linebot -1); - } - y += child->totalHeight(); - } - child = child->nextSibling(); - } - - // Expand line height to edge of rectangle if there's any - // visible child below - while ( child && child->height() <= 0) - child = child->nextSibling(); - if ( child ) - linebot = r.height(); - - if ( linetop < linebot ) { - dotlines[c++] = TQPoint( bx, linetop ); - dotlines[c++] = TQPoint( bx, linebot ); - } - } - p->setPen( cg.text() ); - - static TQBitmap *verticalLine = 0, *horizontalLine = 0; - static TQCleanupHandler qlv_cleanup_bitmap; - if ( !verticalLine ) { - // make 128*1 and 1*128 bitmaps that can be used for - // drawing the right sort of lines. - verticalLine = new TQBitmap( 1, 129, TRUE ); - horizontalLine = new TQBitmap( 128, 1, TRUE ); - TQPointArray a( 64 ); - TQPainter p; - p.begin( verticalLine ); - int i; - for( i=0; i<64; i++ ) - a.setPoint( i, 0, i*2+1 ); - p.setPen( color1 ); - p.drawPoints( a ); - p.end(); - TQApplication::flushX(); - verticalLine->setMask( *verticalLine ); - p.begin( horizontalLine ); - for( i=0; i<64; i++ ) - a.setPoint( i, i*2+1, 0 ); - p.setPen( color1 ); - p.drawPoints( a ); - p.end(); - TQApplication::flushX(); - horizontalLine->setMask( *horizontalLine ); - qlv_cleanup_bitmap.add( &verticalLine ); - qlv_cleanup_bitmap.add( &horizontalLine ); - } - - int line; // index into dotlines - if ( sub & SC_ListViewBranch ) for( line = 0; line < c; line += 2 ) { - // assumptions here: lines are horizontal or vertical. - // lines always start with the numerically lowest - // coordinate. - - // point ... relevant coordinate of current point - // end ..... same coordinate of the end of the current line - // other ... the other coordinate of the current point/line - if ( dotlines[line].y() == dotlines[line+1].y() ) { - int end = dotlines[line+1].x(); - int point = dotlines[line].x(); - int other = dotlines[line].y(); - while( point < end ) { - int i = 128; - if ( i+point > end ) - i = end-point; - p->drawPixmap( point, other, *horizontalLine, - 0, 0, i, 1 ); - point += i; - } - } else { - int end = dotlines[line+1].y(); - int point = dotlines[line].y(); - int other = dotlines[line].x(); - int pixmapoffset = ((point & 1) != dotoffset ) ? 1 : 0; - while( point < end ) { - int i = 128; - if ( i+point > end ) - i = end-point; - p->drawPixmap( other, point, *verticalLine, - 0, pixmapoffset, 1, i ); - point += i; - } - } - } - } - } - break; -#endif //TQT_NO_LISTVIEW - -#ifndef TQT_NO_COMBOBOX - case CC_ComboBox: - if ( sub & SC_ComboBoxArrow ) { - SFlags flags = Style_Default; - - qDrawWinPanel( p, r, cg, TRUE, ( elementFlags & CEF_IsEnabled ) ? - &cg.brush( TQColorGroup::Base ): - &cg.brush( TQColorGroup::Background ) ); - - TQRect ar = - TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, - SC_ComboBoxArrow, TQStyleOption::Default, widget ), ceData, elementFlags ); - if ( subActive == SC_ComboBoxArrow ) { - p->setPen( cg.dark() ); - p->setBrush( cg.brush( TQColorGroup::Button ) ); - p->drawRect( ar ); - } else - qDrawWinPanel( p, ar, cg, FALSE, - &cg.brush( TQColorGroup::Button ) ); - - ar.addCoords( 2, 2, -2, -2 ); - if ( elementFlags & CEF_IsEnabled ) - flags |= Style_Enabled; - - if ( subActive == SC_ComboBoxArrow ) { - flags |= Style_Sunken; - } - drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags ); - } - - if ( sub & SC_ComboBoxEditField ) { - TQRect re = - TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, - SC_ComboBoxEditField, TQStyleOption::Default, widget ), ceData, elementFlags ); - if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) - p->fillRect( re.x(), re.y(), re.width(), re.height(), - cg.brush( TQColorGroup::Highlight ) ); - - if ( elementFlags & CEF_HasFocus ) { - p->setPen( cg.highlightedText() ); - p->setBackgroundColor( cg.highlight() ); - - } else { - p->setPen( cg.text() ); - p->setBackgroundColor( cg.background() ); - } - - if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) { - TQRect re = - TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ); - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg, Style_FocusAtBorder, TQStyleOption(cg.highlight())); - } - } - - break; -#endif // TQT_NO_COMBOBOX - -#ifndef TQT_NO_SLIDER - case CC_Slider: - { - int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); - int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); - int ticks = ceData.tickMarkSetting; - - TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, - opt, widget), - handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, - opt, widget); - - if ((sub & SC_SliderGroove) && groove.isValid()) { - int mid = thickness / 2; - - if ( ticks & TQSlider::Above ) - mid += len / 8; - if ( ticks & TQSlider::Below ) - mid -= len / 8; - - p->setPen( cg.shadow() ); - if ( ceData.orientation == Horizontal ) { - qDrawWinPanel( p, groove.x(), groove.y() + mid - 2, - groove.width(), 4, cg, TRUE ); - p->drawLine( groove.x() + 1, groove.y() + mid - 1, - groove.x() + groove.width() - 3, groove.y() + mid - 1 ); - } else { - qDrawWinPanel( p, groove.x() + mid - 2, groove.y(), - 4, groove.height(), cg, TRUE ); - p->drawLine( groove.x() + mid - 1, groove.y() + 1, - groove.x() + mid - 1, - groove.y() + groove.height() - 3 ); - } - } - - if (sub & SC_SliderTickmarks) - TQCommonStyle::drawComplexControl(ctrl, p, ceData, elementFlags, r, cg, flags, - SC_SliderTickmarks, subActive, - opt, widget ); - - if ( sub & SC_SliderHandle ) { - // 4444440 - // 4333310 - // 4322210 - // 4322210 - // 4322210 - // 4322210 - // *43210* - // **410** - // ***0*** - const TQColor c0 = cg.shadow(); - const TQColor c1 = cg.dark(); - // const TQColor c2 = g.button(); - const TQColor c3 = cg.midlight(); - const TQColor c4 = cg.light(); - - int x = handle.x(), y = handle.y(), - wi = handle.width(), he = handle.height(); - - int x1 = x; - int x2 = x+wi-1; - int y1 = y; - int y2 = y+he-1; - - Orientation orient = ceData.orientation; - bool tickAbove = ceData.tickMarkSetting == TQSlider::Above; - bool tickBelow = ceData.tickMarkSetting == TQSlider::Below; - - p->fillRect( x, y, wi, he, cg.brush( TQColorGroup::Background ) ); - - if ( flags & Style_HasFocus ) { - TQRect re = subRect( SR_SliderFocusRect, ceData, elementFlags, widget ); - drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg ); - } - - if ( (tickAbove && tickBelow) || (!tickAbove && !tickBelow) ) { - qDrawWinButton( p, TQRect(x,y,wi,he), cg, FALSE, - &cg.brush( TQColorGroup::Button ) ); - return; - } - - TQSliderDirection dir; - - if ( orient == Horizontal ) - if ( tickAbove ) - dir = SlUp; - else - dir = SlDown; - else - if ( tickAbove ) - dir = SlLeft; - else - dir = SlRight; - - TQPointArray a; - - int d = 0; - switch ( dir ) { - case SlUp: - y1 = y1 + wi/2; - d = (wi + 1) / 2 - 1; - a.setPoints(5, x1,y1, x1,y2, x2,y2, x2,y1, x1+d,y1-d ); - break; - case SlDown: - y2 = y2 - wi/2; - d = (wi + 1) / 2 - 1; - a.setPoints(5, x1,y1, x1,y2, x1+d,y2+d, x2,y2, x2,y1 ); - break; - case SlLeft: - d = (he + 1) / 2 - 1; - x1 = x1 + he/2; - a.setPoints(5, x1,y1, x1-d,y1+d, x1,y2, x2,y2, x2,y1); - break; - case SlRight: - d = (he + 1) / 2 - 1; - x2 = x2 - he/2; - a.setPoints(5, x1,y1, x1,y2, x2,y2, x2+d,y1+d, x2,y1 ); - break; - } - - TQBrush oldBrush = p->brush(); - p->setBrush( cg.brush( TQColorGroup::Button ) ); - p->setPen( NoPen ); - p->drawRect( x1, y1, x2-x1+1, y2-y1+1 ); - p->drawPolygon( a ); - p->setBrush( oldBrush ); - - if ( dir != SlUp ) { - p->setPen( c4 ); - p->drawLine( x1, y1, x2, y1 ); - p->setPen( c3 ); - p->drawLine( x1, y1+1, x2, y1+1 ); - } - if ( dir != SlLeft ) { - p->setPen( c3 ); - p->drawLine( x1+1, y1+1, x1+1, y2 ); - p->setPen( c4 ); - p->drawLine( x1, y1, x1, y2 ); - } - if ( dir != SlRight ) { - p->setPen( c0 ); - p->drawLine( x2, y1, x2, y2 ); - p->setPen( c1 ); - p->drawLine( x2-1, y1+1, x2-1, y2-1 ); - } - if ( dir != SlDown ) { - p->setPen( c0 ); - p->drawLine( x1, y2, x2, y2 ); - p->setPen( c1 ); - p->drawLine( x1+1, y2-1, x2-1, y2-1 ); - } - - switch ( dir ) { - case SlUp: - p->setPen( c4 ); - p->drawLine( x1, y1, x1+d, y1-d); - p->setPen( c0 ); - d = wi - d - 1; - p->drawLine( x2, y1, x2-d, y1-d); - d--; - p->setPen( c3 ); - p->drawLine( x1+1, y1, x1+1+d, y1-d ); - p->setPen( c1 ); - p->drawLine( x2-1, y1, x2-1-d, y1-d); - break; - case SlDown: - p->setPen( c4 ); - p->drawLine( x1, y2, x1+d, y2+d); - p->setPen( c0 ); - d = wi - d - 1; - p->drawLine( x2, y2, x2-d, y2+d); - d--; - p->setPen( c3 ); - p->drawLine( x1+1, y2, x1+1+d, y2+d ); - p->setPen( c1 ); - p->drawLine( x2-1, y2, x2-1-d, y2+d); - break; - case SlLeft: - p->setPen( c4 ); - p->drawLine( x1, y1, x1-d, y1+d); - p->setPen( c0 ); - d = he - d - 1; - p->drawLine( x1, y2, x1-d, y2-d); - d--; - p->setPen( c3 ); - p->drawLine( x1, y1+1, x1-d, y1+1+d ); - p->setPen( c1 ); - p->drawLine( x1, y2-1, x1-d, y2-1-d); - break; - case SlRight: - p->setPen( c4 ); - p->drawLine( x2, y1, x2+d, y1+d); - p->setPen( c0 ); - d = he - d - 1; - p->drawLine( x2, y2, x2+d, y2-d); - d--; - p->setPen( c3 ); - p->drawLine( x2, y1+1, x2+d, y1+1+d ); - p->setPen( c1 ); - p->drawLine( x2, y2-1, x2+d, y2-1-d); - break; - } - } - - break; - } -#endif // TQT_NO_SLIDER - - default: - TQCommonStyle::drawComplexControl( ctrl, p, ceData, elementFlags, r, cg, flags, sub, - subActive, opt, widget ); - break; - } -} - - -/*! \reimp */ -int TQWindowsStyle::styleHint( StyleHint hint, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption &opt, - TQStyleHintReturn *returnData, - const TQWidget *widget ) const -{ - int ret; - - switch (hint) { - case SH_EtchDisabledText: - case SH_Slider_SnapToValue: - case SH_PrintDialog_RightAlignButtons: - case SH_MainWindow_SpaceBelowMenuBar: - case SH_FontDialog_SelectAssociatedText: - case SH_PopupMenu_AllowActiveAndDisabled: - case SH_MenuBar_AltKeyNavigation: - case SH_MenuBar_MouseTracking: - case SH_PopupMenu_MouseTracking: - case SH_ComboBox_ListMouseTracking: - case SH_ScrollBar_StopMouseOverSlider: - ret = 1; - break; - - case SH_ItemView_ChangeHighlightOnFocus: - ret = 0; - break; - - case SH_ToolBox_SelectedPageTitleBold: - ret = 0; - break; - - case SH_MenuIndicatorColumnWidth: - { - int maxpmw = opt.maxIconWidth(); - bool checkable = ( elementFlags & CEF_IsCheckable ); - - if ( checkable ) { - // space for the checkmarks - if (use2000style) - maxpmw = TQMAX( maxpmw, 20 ); - else - maxpmw = TQMAX( maxpmw, 12 ); - } - - ret = maxpmw; - break; - } - - default: - ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); - break; - } - - return ret; -} - -/*! \reimp */ -TQRect TQWindowsStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const -{ - TQRect rect; - - switch (r) { -#ifndef TQT_NO_SLIDER - case SR_SliderFocusRect: - { - rect = ceData.rect; - break; - } -#endif // TQT_NO_SLIDER - case SR_ToolBoxTabContents: - rect = ceData.rect; - break; - default: - rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget ); - break; - } - - return rect; -} - -#endif diff --git a/src/styles/tqcdestyle.cpp b/src/styles/tqcdestyle.cpp new file mode 100644 index 000000000..3c5321386 --- /dev/null +++ b/src/styles/tqcdestyle.cpp @@ -0,0 +1,371 @@ +/**************************************************************************** +** +** Implementation of CDE-like style class +** +** Created : 981231 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqcdestyle.h" + +#if !defined(TQT_NO_STYLE_CDE) || defined(QT_PLUGIN) + +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqbutton.h" +#include + +/*! + \class TQCDEStyle tqcdestyle.h + \brief The TQCDEStyle class provides a CDE look and feel. + + \ingroup appearance + + This style provides a slightly improved Motif look similar to some + versions of the Common Desktop Environment (CDE). The main + differences are thinner frames and more modern radio buttons and + checkboxes. Together with a dark background and a bright + text/foreground color, the style looks quite attractive (at least + for Motif fans). + + Note that the functions provided by TQCDEStyle are + reimplementations of TQStyle functions; see TQStyle for their + documentation. +*/ + +/*! + Constructs a TQCDEStyle. + + If \a useHighlightCols is FALSE (the default), then the style will + polish the application's color palette to emulate the Motif way of + highlighting, which is a simple inversion between the base and the + text color. +*/ +TQCDEStyle::TQCDEStyle( bool useHighlightCols ) : TQMotifStyle( useHighlightCols ) +{ +} + +/*! + Destroys the style. +*/ +TQCDEStyle::~TQCDEStyle() +{ +} + + +/*!\reimp +*/ +int TQCDEStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const +{ + int ret; + + switch( metric ) { + case PM_DefaultFrameWidth: + ret = 1; + break ; + case PM_MenuBarFrameWidth: + ret = 1; + break; + case PM_ScrollBarExtent: + ret = 13; + break; + default: + ret = TQMotifStyle::pixelMetric( metric, ceData, elementFlags, widget ); + break; + } + return ret; +} + +/*! \reimp +*/ +void TQCDEStyle::drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + + switch( element ) { + case CE_MenuBarItem: + { + if ( how & Style_Active ) // active item + qDrawShadePanel( p, r, cg, TRUE, 1, + &cg.brush( TQColorGroup::Button ) ); + else // other item + p->fillRect( r, cg.brush( TQColorGroup::Button ) ); + TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget ); + break; + } + default: + TQMotifStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget ); + break; + } + + +} + +/*! \reimp +*/ +void TQCDEStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + switch( pe ) { + case PE_Indicator: { +#ifndef TQT_NO_BUTTON + bool down = flags & Style_Down; + bool on = flags & Style_On; + bool showUp = !( down ^ on ); + TQBrush fill = showUp || flags & Style_NoChange ? cg.brush( TQColorGroup::Button ) : cg.brush( TQColorGroup::Mid ); + qDrawShadePanel( p, r, cg, !showUp, pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ), &cg.brush( TQColorGroup::Button ) ); + + if ( !( flags & Style_Off ) ) { + TQPointArray a( 7 * 2 ); + int i, xx, yy; + xx = r.x() + 3; + yy = r.y() + 5; + for ( i = 0; i < 3; i++ ) { + a.setPoint( 2 * i, xx, yy ); + a.setPoint( 2 * i + 1, xx, yy + 2 ); + xx++; yy++; + } + yy -= 2; + for ( i = 3; i < 7; i++ ) { + a.setPoint( 2 * i, xx, yy ); + a.setPoint( 2 * i + 1, xx, yy + 2 ); + xx++; yy--; + } + if ( flags & Style_NoChange ) + p->setPen( cg.dark() ); + else + p->setPen( cg.foreground() ); + p->drawLineSegments( a ); + } +#endif + } + break; + case PE_ExclusiveIndicator: + { +#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2) + static const TQCOORD pts1[] = { // up left lines + 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; + static const TQCOORD pts4[] = { // bottom right lines + 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, + 11,4, 10,3, 10,2 }; + static const TQCOORD pts5[] = { // inner fill + 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; + bool down = flags & Style_Down; + bool on = flags & Style_On; + p->eraseRect( r ); + TQPointArray a( TQCOORDARRLEN(pts1), pts1 ); + a.translate( r.x(), r.y() ); + p->setPen( ( down || on ) ? cg.dark() : cg.light() ); + p->drawPolyline( a ); + a.setPoints( TQCOORDARRLEN(pts4), pts4 ); + a.translate( r.x(), r.y() ); + p->setPen( ( down || on ) ? cg.light() : cg.dark() ); + p->drawPolyline( a ); + a.setPoints( TQCOORDARRLEN(pts5), pts5 ); + a.translate( r.x(), r.y() ); + TQColor fillColor = on ? cg.dark() : cg.background(); + p->setPen( fillColor ); + p->setBrush( on ? cg.brush( TQColorGroup::Dark ) : + cg.brush( TQColorGroup::Background ) ); + p->drawPolygon( a ); + break; + } + + case PE_ExclusiveIndicatorMask: + { + static const TQCOORD pts1[] = { + // up left lines + 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1, + // bottom right lines + 10,2, 10,3, 11,4, 11,7, 10,8, 10,9, 9,10, 8,10, 7,11, 4,11, 3,10, 2,10 + }; + TQPointArray a(TQCOORDARRLEN(pts1), pts1); + a.translate(r.x(), r.y()); + p->setPen(color1); + p->setBrush(color1); + p->drawPolygon(a); + break; + } + case PE_ArrowUp: + case PE_ArrowDown: + case PE_ArrowRight: + case PE_ArrowLeft: { + TQRect rect = r; + TQPointArray bFill; // fill polygon + TQPointArray bTop; // top shadow. + TQPointArray bBot; // bottom shadow. + TQPointArray bLeft; // left shadow. + TQWMatrix matrix; // xform matrix + bool vertical = pe == PE_ArrowUp || pe == PE_ArrowDown; + bool horizontal = !vertical; + int dim = rect.width() < rect.height() ? rect.width() : rect.height(); + int colspec = 0x0000; // color specification array + + if ( dim < 2 ) // too small arrow + return; + + // adjust size and center (to fix rotation below) + if ( rect.width() > dim ) { + rect.setX( rect.x() + ( ( rect.width() - dim ) / 2 ) ); + rect.setWidth( dim ); + } + if ( rect.height() > dim ) { + rect.setY( rect.y() + ( ( rect.height() - dim ) / 2 ) ); + rect.setHeight( dim ); + } + + if ( dim > 3 ) { + bFill.resize( dim & 1 ? 3 : 4 ); + bTop.resize( 2 ); + bBot.resize( 2 ); + bLeft.resize( 2 ); + bLeft.putPoints( 0, 2, 0, 0, 0, dim-1 ); + bTop.putPoints( 0, 2, 1, 0, dim-1, dim/2 ); + bBot.putPoints( 0, 2, 1, dim-1, dim-1, dim/2 ); + + if ( dim > 6 ) { // dim>6: must fill interior + bFill.putPoints( 0, 2, 1, dim-1, 1, 1 ); + if ( dim & 1 ) // if size is an odd number + bFill.setPoint( 2, dim - 2, dim / 2 ); + else + bFill.putPoints( 2, 2, dim-2, dim/2-1, dim-2, dim/2 ); + } + } else { + if ( dim == 3 ) { // 3x3 arrow pattern + bLeft.setPoints( 4, 0,0, 0,2, 1,1, 1,1 ); + bTop .setPoints( 2, 1,0, 1,0 ); + bBot .setPoints( 2, 1,2, 2,1 ); + } else { // 2x2 arrow pattern + bLeft.setPoints( 2, 0,0, 0,1 ); + bTop .setPoints( 2, 1,0, 1,0 ); + bBot .setPoints( 2, 1,1, 1,1 ); + } + } + + if ( pe == PE_ArrowUp || pe == PE_ArrowLeft ) { + matrix.translate( rect.x(), rect.y() ); + if ( vertical ) { + matrix.translate( 0, rect.height() - 1 ); + matrix.rotate( -90 ); + } else { + matrix.translate( rect.width() - 1, rect.height() - 1 ); + matrix.rotate( 180 ); + } + if ( flags & Style_Down ) + colspec = horizontal ? 0x2334 : 0x2343; + else + colspec = horizontal ? 0x1443 : 0x1434; + } else if ( pe == PE_ArrowDown || pe == PE_ArrowRight ) { + matrix.translate( rect.x(), rect.y() ); + if ( vertical ) { + matrix.translate( rect.width()-1, 0 ); + matrix.rotate( 90 ); + } + if ( flags & Style_Down ) + colspec = horizontal ? 0x2443 : 0x2434; + else + colspec = horizontal ? 0x1334 : 0x1343; + } + + TQColor *cols[5]; + if ( flags & Style_Enabled ) { + cols[0] = 0; + cols[1] = (TQColor *)&cg.button(); + cols[2] = (TQColor *)&cg.mid(); + cols[3] = (TQColor *)&cg.light(); + cols[4] = (TQColor *)&cg.dark(); + } else { + cols[0] = 0; + cols[1] = (TQColor *)&cg.button(); + cols[2] = (TQColor *)&cg.button(); + cols[3] = (TQColor *)&cg.button(); + cols[4] = (TQColor *)&cg.button(); + } + +#define CMID *cols[ (colspec>>12) & 0xf ] +#define CLEFT *cols[ (colspec>>8) & 0xf ] +#define CTOP *cols[ (colspec>>4) & 0xf ] +#define CBOT *cols[ colspec & 0xf ] + + TQPen savePen = p->pen(); // save current pen + TQBrush saveBrush = p->brush(); // save current brush + TQWMatrix wxm = p->worldMatrix(); + TQPen pen( NoPen ); + TQBrush brush = cg.brush( flags & Style_Enabled ? TQColorGroup::Button : + TQColorGroup::Mid ); + + p->setPen( pen ); + p->setBrush( brush ); + p->setWorldMatrix( matrix, TRUE ); // set transformation matrix + p->drawPolygon( bFill ); // fill arrow + p->setBrush( NoBrush ); // don't fill + + p->setPen( CLEFT ); + p->drawLineSegments( bLeft ); + p->setPen( CBOT ); + p->drawLineSegments( bBot ); + p->setPen( CTOP ); + p->drawLineSegments( bTop ); + + p->setWorldMatrix( wxm ); + p->setBrush( saveBrush ); // restore brush + p->setPen( savePen ); // restore pen + +#undef CMID +#undef CLEFT +#undef CTOP +#undef CBOT + + } + break; + default: + TQMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); + } +} + +#endif diff --git a/src/styles/tqcdestyle.h b/src/styles/tqcdestyle.h new file mode 100644 index 000000000..4b526c8ea --- /dev/null +++ b/src/styles/tqcdestyle.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Definition of the CDE-like style class +** +** Created : 990513 +** +** Copyright (C) 1999-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + + +#ifndef TQCDESTYLE_H +#define TQCDESTYLE_H + +#ifndef QT_H +#include "tqmotifstyle.h" +#endif // QT_H + +#if !defined(TQT_NO_STYLE_CDE) || defined(QT_PLUGIN) + +#if defined(QT_PLUGIN) +#define Q_EXPORT_STYLE_CDE +#else +#define Q_EXPORT_STYLE_CDE TQ_EXPORT +#endif + +class Q_EXPORT_STYLE_CDE TQCDEStyle : public TQMotifStyle +{ + TQ_OBJECT +public: + + TQCDEStyle( bool useHighlightCols = FALSE ); + virtual ~TQCDEStyle(); + + int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; + + void drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + void drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default ) const; + +}; + +#endif // TQT_NO_STYLE_CDE + +#endif // TQCDESTYLE_H diff --git a/src/styles/tqcommonstyle.cpp b/src/styles/tqcommonstyle.cpp new file mode 100644 index 000000000..81a3ace92 --- /dev/null +++ b/src/styles/tqcommonstyle.cpp @@ -0,0 +1,3381 @@ +/**************************************************************************** +** +** Implementation of the TQCommonStyle class +** +** Created : 981231 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqcommonstyle.h" + +#ifndef TQT_NO_STYLE + +#include "tqmutex.h" +#include "tqmenubar.h" +#include "ntqapplication.h" +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqpixmap.h" +#include "tqpushbutton.h" +#include "tqtabbar.h" +#include "tqtabwidget.h" +#include "tqlineedit.h" +#include "tqscrollbar.h" +#include "tqtoolbutton.h" +#include "tqtoolbar.h" +#include "tqcombobox.h" +#include "ntqdockarea.h" +#include "tqheader.h" +#include "tqspinbox.h" +#include "ntqrangecontrol.h" +#include "tqgroupbox.h" +#include "tqslider.h" +#include "tqlistview.h" +#include "tqcheckbox.h" +#include "tqradiobutton.h" +#include "tqbitmap.h" +#include "tqprogressbar.h" +#include "tqlistbox.h" +#include "private/tqdialogbuttons_p.h" +#include +#include +#include "../widgets/qtitlebar_p.h" +#include + +/*! + \class TQCommonStyle tqcommonstyle.h + \brief The TQCommonStyle class encapsulates the common Look and Feel of a GUI. + + \ingroup appearance + + This abstract class implements some of the widget's look and feel + that is common to all GUI styles provided and shipped as part of + TQt. + + All the functions are documented in \l TQStyle. +*/ + +/*! + \enum TQt::ArrowType + + \value UpArrow + \value DownArrow + \value LeftArrow + \value RightArrow + +*/ + +// the active painter, if any... this is used as an optimzation to +// avoid creating a painter if we have an active one (since +// TQStyle::itemRect() needs a painter to operate correctly +static TQPainter *activePainter = 0; + +/*! + Constructs a TQCommonStyle. +*/ +TQCommonStyle::TQCommonStyle() : TQStyle() +{ + activePainter = 0; +} + +/*! \reimp */ +TQCommonStyle::~TQCommonStyle() +{ + activePainter = 0; +} + + +static const char * const check_list_controller_xpm[] = { +"16 16 4 1", +" c None", +". c #000000000000", +"X c #FFFFFFFF0000", +"o c #C71BC30BC71B", +" ", +" ", +" .......... ", +" .XXXXXXXX. ", +" .XXXXXXXX.oo ", +" .XXXXXXXX.oo ", +" .XXXXXXXX.oo ", +" .XXXXXXXX.oo ", +" .XXXXXXXX.oo ", +" .XXXXXXXX.oo ", +" .XXXXXXXX.oo ", +" ..........oo ", +" oooooooooo ", +" oooooooooo ", +" ", +" "}; + +// Increase speed by avoiding constant allocation/deallocation of commonly used strings +static TQString TQPushButton_static_string("TQPushButton"); +static TQString TQToolButton_static_string("TQToolButton"); +static TQString TQButton_static_string("TQButton"); +static TQString TQTabBar_static_string("TQTabBar"); +static TQString TQTitleBar_static_string("TQTitleBar"); +static TQString TQToolBox_static_string("TQToolBox"); +static TQString TQToolBar_static_string("TQToolBar"); +static TQString TQProgressBar_static_string("TQProgressBar"); +static TQString TQPopupMenu_static_string("TQPopupMenu"); +static TQString TQComboBox_static_string("TQComboBox"); +static TQString TQCheckBox_static_string("TQCheckBox"); +static TQString TQRadioButton_static_string("TQRadioButton"); +static TQString TQHeader_static_string("TQHeader"); +static TQString TQScrollBar_static_string("TQScrollBar"); +static TQString TQSlider_static_string("TQSlider"); +static TQString TQDialogButtons_static_string("TQDialogButtons"); +static TQString TQSpinWidget_static_string("TQSpinWidget"); +static TQString TQListView_static_string("TQListView"); +static TQString TQDockWindow_static_string("TQDockWindow"); +static TQString TQTabWidget_static_string("TQTabWidget"); +static TQString TQFrame_static_string("TQFrame"); +static TQString TQWidget_static_string("TQWidget"); + +static TQStyleControlElementData* TQStyleControlElementData_null = NULL; +static void tqt_style_control_element_data_null_cleanup() { + delete TQStyleControlElementData_null; + TQStyleControlElementData_null =0; +} + +#include + +// Keep in sync with duplicate definition in tqobject.cpp +class TQStyleControlElementDataPrivate { + public: + bool isTQPushButton; + bool isTQToolButton; + bool isTQButton; + bool isTQTabBar; + bool isTQTitleBar; + bool isTQToolBox; + bool isTQToolBar; + bool isTQProgressBar; + bool isTQPopupMenu; + bool isTQComboBox; + bool isTQCheckBox; + bool isTQRadioButton; + bool isTQHeader; + bool isTQScrollBar; + bool isTQSlider; + bool isTQDialogButtons; + bool isTQSpinWidget; + bool isTQListView; + bool isTQDockWindow; + bool isTQTabWidget; + bool isTQFrame; + bool isTQWidget; +}; + +TQStringList getObjectTypeListForObject(const TQObject* object) { + TQStringList objectTypes; + + if (object) { + TQMetaObject* objectMetaObject = object->metaObject(); + const char* name; + + while (objectMetaObject) { + name = objectMetaObject->className(); + objectTypes.append(TQString(name)); + objectMetaObject = objectMetaObject->superClass(); + } + } + + return objectTypes; +} + +void determineObjectTypes(const TQObject* object, TQStyleControlElementData &ceData, TQStyleControlElementDataPrivate* ceDataPrivate) { + ceData.widgetObjectTypes = getObjectTypeListForObject(object); + + // Increase speed on repeated calls by checking object types here and caching them + ceDataPrivate->isTQPushButton = ceData.widgetObjectTypes.containsYesNo(TQPushButton_static_string); + ceDataPrivate->isTQToolButton = ceData.widgetObjectTypes.containsYesNo(TQToolButton_static_string); + ceDataPrivate->isTQButton = ceData.widgetObjectTypes.containsYesNo(TQButton_static_string); + ceDataPrivate->isTQTabBar = ceData.widgetObjectTypes.containsYesNo(TQTabBar_static_string); + ceDataPrivate->isTQTitleBar = ceData.widgetObjectTypes.containsYesNo(TQTitleBar_static_string); + ceDataPrivate->isTQToolBox = ceData.widgetObjectTypes.containsYesNo(TQToolBox_static_string); + ceDataPrivate->isTQToolBar = ceData.widgetObjectTypes.containsYesNo(TQToolBar_static_string); + ceDataPrivate->isTQProgressBar = ceData.widgetObjectTypes.containsYesNo(TQProgressBar_static_string); + ceDataPrivate->isTQPopupMenu = ceData.widgetObjectTypes.containsYesNo(TQPopupMenu_static_string); + ceDataPrivate->isTQComboBox = ceData.widgetObjectTypes.containsYesNo(TQComboBox_static_string); + ceDataPrivate->isTQCheckBox = ceData.widgetObjectTypes.containsYesNo(TQCheckBox_static_string); + ceDataPrivate->isTQRadioButton = ceData.widgetObjectTypes.containsYesNo(TQRadioButton_static_string); + ceDataPrivate->isTQHeader = ceData.widgetObjectTypes.containsYesNo(TQHeader_static_string); + ceDataPrivate->isTQScrollBar = ceData.widgetObjectTypes.containsYesNo(TQScrollBar_static_string); + ceDataPrivate->isTQSlider = ceData.widgetObjectTypes.containsYesNo(TQSlider_static_string); + ceDataPrivate->isTQDialogButtons = ceData.widgetObjectTypes.containsYesNo(TQDialogButtons_static_string); + ceDataPrivate->isTQSpinWidget = ceData.widgetObjectTypes.containsYesNo(TQSpinWidget_static_string); + ceDataPrivate->isTQListView = ceData.widgetObjectTypes.containsYesNo(TQListView_static_string); + ceDataPrivate->isTQDockWindow = ceData.widgetObjectTypes.containsYesNo(TQDockWindow_static_string); + ceDataPrivate->isTQTabWidget = ceData.widgetObjectTypes.containsYesNo(TQTabWidget_static_string); + ceDataPrivate->isTQFrame = ceData.widgetObjectTypes.containsYesNo(TQFrame_static_string); + ceDataPrivate->isTQWidget = ceData.widgetObjectTypes.containsYesNo(TQWidget_static_string); +} + +void updateObjectTypeListIfNeeded(const TQObject* object) { + TQStyleControlElementData &ceData = *(const_cast(object)->controlElementDataObject()); + TQStyleControlElementDataPrivate* ceDataPrivate = const_cast(object)->controlElementDataPrivateObject(); + + // This is much faster than (ceData.widgetObjectTypes[0] != TQString(object->metaObject()->className())) due to TQString constructor/destructor overhead + // Casting to const also increases speed by preventing unneeded calls to detach() + if ((ceData.widgetObjectTypes.isEmpty()) || (strcmp(const_cast(ceData.widgetObjectTypes)[0].ascii(), object->metaObject()->className()) != 0)) { + determineObjectTypes(object, ceData, ceDataPrivate); + } +} + +TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, const TQStyleOption& opt, bool populateReliantFields) { + TQStyle::ControlElementFlags cef = TQStyle::CEF_None; + + if (object) { + TQStyleControlElementDataPrivate* ceDataPrivate = const_cast(object)->controlElementDataPrivateObject(); + updateObjectTypeListIfNeeded(object); + + if (ceDataPrivate->isTQPushButton) { + const TQPushButton *button = static_cast(object); + if (button) { + if (button->isDefault()) cef = cef | TQStyle::CEF_IsDefault; + if (button->autoDefault()) cef = cef | TQStyle::CEF_AutoDefault; + if (button->isMenuButton()) cef = cef | TQStyle::CEF_IsMenuWidget; + if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState; + if (button->isFlat()) cef = cef | TQStyle::CEF_IsFlat; + } + } + if (ceDataPrivate->isTQToolButton) { + const TQToolButton *button = static_cast(object); + if (button) { + if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState; + if (button->usesTextLabel()) cef = cef | TQStyle::CEF_UsesTextLabel; + if (button->usesBigPixmap()) cef = cef | TQStyle::CEF_UsesBigPixmap; + if (button->popup()) cef = cef | TQStyle::CEF_HasPopupMenu; + } + } + if (ceDataPrivate->isTQButton) { + const TQButton *button = static_cast(object); + if (button) { + if (button->isDown()) cef = cef | TQStyle::CEF_IsDown; + if (button->isOn()) cef = cef | TQStyle::CEF_IsOn; + if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState; + } + } + if (ceDataPrivate->isTQTabBar) { + const TQTabBar *tb = static_cast(object); + TQTab * t = opt.tab(); + if ((t) && (tb)) { + if (t->identifier() == tb->currentTab()) cef = cef | TQStyle::CEF_IsActive; + } + } + if (ceDataPrivate->isTQTitleBar) { + const TQTitleBar *tb = static_cast(object); + if (tb) { + if (tb->isActive()) cef = cef | TQStyle::CEF_IsActive; + } + } + if (ceDataPrivate->isTQToolBox) { + const TQToolBox *tb = static_cast(object); + if (tb) { + if (!tb->currentItem()) cef = cef | TQStyle::CEF_IsContainerEmpty; + } + } + if (ceDataPrivate->isTQProgressBar) { + const TQProgressBar *pb = static_cast(object); + if (pb) { + if (pb->centerIndicator()) cef = cef | TQStyle::CEF_CenterIndicator; + if (pb->indicatorFollowsStyle()) cef = cef | TQStyle::CEF_IndicatorFollowsStyle; + } + } + if (ceDataPrivate->isTQPopupMenu) { + const TQPopupMenu *pm = static_cast(object); + if (pm) { + if (pm->isCheckable()) cef = cef | TQStyle::CEF_IsCheckable; + } + } + if (ceDataPrivate->isTQComboBox) { + const TQComboBox *cb = static_cast(object); + if (cb) { + if (cb->editable()) cef = cef | TQStyle::CEF_IsEditable; + } + } + // Generic flags + if (ceDataPrivate->isTQWidget) { + const TQWidget* widget = static_cast(object); + if (widget) { + if (widget->isEnabled()) cef = cef | TQStyle::CEF_IsEnabled; + if (widget->parentWidget()) cef = cef | TQStyle::CEF_HasParentWidget; + if (widget->focusProxy()) cef = cef | TQStyle::CEF_HasFocusProxy; + if (widget->hasFocus()) cef = cef | TQStyle::CEF_HasFocus; + if (widget->hasMouse()) cef = cef | TQStyle::CEF_HasMouse; + if (populateReliantFields) { + if (widget->isActiveWindow()) cef = cef | TQStyle::CEF_IsActiveWindow; + if (widget->isTopLevel()) cef = cef | TQStyle::CEF_IsTopLevel; + if (widget->isVisible()) cef = cef | TQStyle::CEF_IsVisible; + if (widget->isShown()) cef = cef | TQStyle::CEF_IsShown; + } + } + } + } + else { + cef = cef | TQStyle::CEF_UseGenericParameters; + } + + return cef; +} + +const TQStyleControlElementData &populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields) { + return populateControlElementDataFromWidget(widget, opt, populateReliantFields, false); +} + +const TQStyleControlElementData &populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields, bool populateMinimumNumberOfFields) { + if (widget) { + TQStyleControlElementData &ceData = *(const_cast(widget)->controlElementDataObject()); + TQStyleControlElementDataPrivate* ceDataPrivate = const_cast(widget)->controlElementDataPrivateObject(); + + ceData.isNull = false; + updateObjectTypeListIfNeeded(widget); + + ceData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; + if (!populateMinimumNumberOfFields) { + const TQPixmap* erasePixmap = widget->backgroundPixmap(); + if (erasePixmap) { + ceData.bgPixmap = *erasePixmap; + } + if (populateReliantFields) { + ceData.bgBrush = widget->backgroundBrush(); + ceData.windowState = (TQt::WindowState)(widget->windowState()); + } + } + ceData.wflags = widget->getWFlags(); + if (!populateMinimumNumberOfFields) { + ceData.bgColor = widget->eraseColor(); + ceData.bgOffset = widget->backgroundOffset(); + ceData.backgroundMode = widget->backgroundMode(); + if (populateReliantFields) { + ceData.fgColor = widget->foregroundColor(); + ceData.colorGroup = widget->colorGroup(); + ceData.paletteBgColor = widget->paletteBackgroundColor(); + } + ceData.geometry = widget->geometry(); + ceData.rect = widget->rect(); + ceData.pos = widget->pos(); + const TQPixmap* icon = widget->icon(); + if (icon) { + ceData.icon = *icon; + } + ceData.palette = widget->palette(); + ceData.font = widget->font(); + } + ceData.name = widget->name(); + ceData.caption = widget->caption(); + if (!populateMinimumNumberOfFields) { + if (ceDataPrivate->isTQPushButton) { + const TQPushButton *button = static_cast(widget); + if (button) { + TQIconSet* iconSet = 0; + const TQPixmap* fgPixmap = 0; + iconSet = button->iconSet(); + fgPixmap = button->pixmap(); + if (iconSet) { + ceData.iconSet = *iconSet; + } + else { + ceData.iconSet = TQIconSet(); + } + if (fgPixmap) { + ceData.fgPixmap = *fgPixmap; + } + } + } + if (ceDataPrivate->isTQToolButton) { + const TQToolButton *button = static_cast(widget); + if (button) { + const TQPixmap* fgPixmap = 0; + ceData.iconSet = button->iconSet(); + fgPixmap = button->pixmap(); + if (fgPixmap) { + ceData.fgPixmap = *fgPixmap; + } + ceData.textLabel = button->textLabel(); + ceData.toolButtonTextPosition = button->textPosition(); + ceData.popupDelay = button->popupDelay(); + } + } + if (ceDataPrivate->isTQCheckBox) { + const TQCheckBox *button = static_cast(widget); + if (button) { + const TQPixmap* fgPixmap = 0; + fgPixmap = button->pixmap(); + if (fgPixmap) { + ceData.fgPixmap = *fgPixmap; + } + } + } + if (ceDataPrivate->isTQRadioButton) { + const TQRadioButton *button = static_cast(widget); + if (button) { + const TQPixmap* fgPixmap = 0; + fgPixmap = button->pixmap(); + if (fgPixmap) { + ceData.fgPixmap = *fgPixmap; + } + } + } + if (ceDataPrivate->isTQButton) { + const TQButton *button = static_cast(widget); + if (button) { + ceData.text = button->text(); + const TQPixmap* paletteBgPixmap = 0; + paletteBgPixmap = button->paletteBackgroundPixmap(); + if (paletteBgPixmap) { + ceData.paletteBgPixmap = *paletteBgPixmap; + } + } + } + if (ceDataPrivate->isTQTabBar) { + const TQTabBar *tb = static_cast(widget); + if (tb) { + ceData.tabBarData.tabCount = tb->count(); + ceData.tabBarData.currentTabIndex = tb->currentTab(); + ceData.tabBarData.shape = tb->shape(); + ceData.tabBarData.identIndexMap.clear(); + const TQTab* currentTab; + for (int i=0; icount(); ++i) { + currentTab = tb->tabAt(i); + if (currentTab) { + ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier()); + } + } + if ( tb->parent() ) { + updateObjectTypeListIfNeeded(tb->parent()); + if ((const_cast(tb->parent())->controlElementDataPrivateObject())->isTQTabWidget) { + const TQTabWidget *tw = static_cast(tb->parent()); + TQWidget *cw; + cw = tw->cornerWidget(TQt::TopLeft); + if (cw) { + updateObjectTypeListIfNeeded(cw); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].pos = cw->pos(); + } + cw = tw->cornerWidget(TQt::TopRight); + if (cw) { + updateObjectTypeListIfNeeded(cw); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].pos = cw->pos(); + } + cw = tw->cornerWidget(TQt::BottomLeft); + if (cw) { + updateObjectTypeListIfNeeded(cw); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].pos = cw->pos(); + } + cw = tw->cornerWidget(TQt::BottomRight); + if (cw) { + updateObjectTypeListIfNeeded(cw); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].pos = cw->pos(); + } + } + } + } + } + if (ceDataPrivate->isTQToolBox) { + const TQToolBox *tb = static_cast(widget); + if (tb) { + const TQWidget* currentItem = tb->currentItem(); + if (currentItem) { + ceData.activeItemPaletteBgColor = currentItem->paletteBackgroundColor(); + } + } + } + if (ceDataPrivate->isTQProgressBar) { + const TQProgressBar *pb = static_cast(widget); + if (pb) { + ceData.currentStep = pb->progress(); + ceData.totalSteps = pb->totalSteps(); + ceData.progressText = pb->progressString(); + ceData.percentageVisible = pb->percentageVisible(); + ceData.orientation = pb->orientation(); + } + } + if (ceDataPrivate->isTQHeader) { + const TQHeader *header = static_cast(widget); + if (header) { + int section = opt.headerSection(); + TQIconSet* iconSet = 0; + iconSet = header->iconSet(section); + ceData.textLabel = header->label(section); + if (iconSet) { + ceData.iconSet = *iconSet; + } + else { + ceData.iconSet = TQIconSet(); + } + } + } + // Complex Controls + if (ceDataPrivate->isTQScrollBar) { + const TQScrollBar *sb = static_cast(widget); + if (sb) { + ceData.orientation = sb->orientation(); + ceData.minSteps = sb->minValue(); + ceData.maxSteps = sb->maxValue(); + ceData.currentStep = sb->value(); + ceData.startStep = sb->sliderStart(); + ceData.lineStep = sb->lineStep(); + ceData.pageStep = sb->pageStep(); + if (populateReliantFields) { + ceData.sliderRect = sb->sliderRect(); + } + } + } + if (ceDataPrivate->isTQSlider) { + const TQSlider *sl = static_cast(widget); + if (sl) { + ceData.orientation = sl->orientation(); + ceData.minSteps = sl->minValue(); + ceData.maxSteps = sl->maxValue(); + ceData.tickMarkSetting = sl->tickmarks(); + ceData.tickInterval = sl->tickInterval(); + ceData.currentStep = sl->value(); + ceData.startStep = sl->sliderStart(); + ceData.lineStep = sl->lineStep(); + ceData.pageStep = sl->pageStep(); + if (populateReliantFields) { + ceData.sliderRect = sl->sliderRect(); + } + } + } + if (ceDataPrivate->isTQDialogButtons) { + const TQDialogButtons *dlgbtns = static_cast(widget); + if (dlgbtns) { + ceData.orientation = dlgbtns->orientation(); + ceData.dlgVisibleButtons = dlgbtns->visibleButtons(); + TQDialogButtons::Button btns[] = { TQDialogButtons::All, TQDialogButtons::Reject, TQDialogButtons::Accept, TQDialogButtons::Apply, TQDialogButtons::Retry, TQDialogButtons::Ignore, TQDialogButtons::Abort, TQDialogButtons::Help }; + for(unsigned int i = 0; i < (sizeof(btns)/sizeof(btns[0])); i++) { + if (ceData.dlgVisibleButtons & btns[i]) { + ceData.dlgVisibleSizeHints[btns[i]] = dlgbtns->sizeHint(btns[i]); + } + } + + } + } + if (ceDataPrivate->isTQTitleBar) { + const TQTitleBar *tb = static_cast(widget); + if (tb) { + ceData.titleBarData.hasWindow = !!(tb->window()); + if (populateReliantFields) { + if (ceData.titleBarData.hasWindow) { + ceData.titleBarData.windowState = (TQt::WindowState)(tb->window()->windowState()); + } + ceData.titleBarData.usesActiveColor = tb->usesActiveColor(); + } + ceData.titleBarData.visibleText = tb->visibleText(); + } + } + if (ceDataPrivate->isTQSpinWidget) { + const TQSpinWidget *sw = static_cast(widget); + if (sw) { + ceData.spinWidgetData.buttonSymbols = sw->buttonSymbols(); + ceData.spinWidgetData.upRect = sw->upRect(); + ceData.spinWidgetData.downRect = sw->downRect(); + ceData.spinWidgetData.upEnabled = sw->isUpEnabled(); + ceData.spinWidgetData.downEnabled = sw->isDownEnabled(); + } + } + if (ceDataPrivate->isTQListView) { + const TQListView *lv = static_cast(widget); + if (lv) { + ceData.listViewData.rootDecorated = lv->rootIsDecorated(); + ceData.listViewData.itemMargin = lv->itemMargin(); + TQWidget* viewport = lv->viewport(); + if (viewport) { + updateObjectTypeListIfNeeded(viewport); + ceData.viewportData.widgetObjectTypes = (const_cast(viewport)->controlElementDataObject())->widgetObjectTypes; + ceData.viewportData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; + const TQPixmap* erasePixmap = viewport->backgroundPixmap(); + if (erasePixmap) { + ceData.viewportData.bgPixmap = *erasePixmap; + } + if (populateReliantFields) { + ceData.viewportData.bgBrush = viewport->backgroundBrush(); + } + if (populateReliantFields) { + ceData.viewportData.windowState = (TQt::WindowState)(widget->windowState()); + } + ceData.viewportData.wflags = viewport->getWFlags(); + ceData.viewportData.bgColor = viewport->eraseColor(); + ceData.viewportData.bgOffset = viewport->backgroundOffset(); + ceData.viewportData.backgroundMode = viewport->backgroundMode(); + if (populateReliantFields) { + ceData.viewportData.fgColor = viewport->foregroundColor(); + ceData.viewportData.colorGroup = viewport->colorGroup(); + ceData.viewportData.paletteBgColor = viewport->paletteBackgroundColor(); + } + ceData.viewportData.geometry = viewport->geometry(); + ceData.viewportData.rect = viewport->rect(); + ceData.viewportData.pos = viewport->pos(); + const TQPixmap* icon = viewport->icon(); + if (icon) { + ceData.viewportData.icon = *icon; + } + ceData.viewportData.palette = viewport->palette(); + ceData.viewportData.font = viewport->font(); + ceData.viewportData.name = viewport->name(); + ceData.viewportData.caption = viewport->caption(); + } + } + } + if (ceDataPrivate->isTQComboBox) { + const TQComboBox *cb = static_cast(widget); + if (cb) { + const TQLineEdit* lineEdit = cb->lineEdit(); + if (lineEdit) { + ceData.comboBoxLineEditFlags = getControlElementFlagsForObject(lineEdit, TQStyleOption::Default); + } + const TQListBox* listBox = cb->listBox(); + if (listBox) { + ceData.comboBoxListBoxFlags = getControlElementFlagsForObject(listBox, TQStyleOption::Default); + } + } + } + if (ceDataPrivate->isTQFrame) { + const TQFrame *frame = static_cast(widget); + if (frame) { + ceData.frameStyle = frame->frameStyle(); + } + } + + const TQWidget* parentWidget = widget->parentWidget(); + if (parentWidget) { + updateObjectTypeListIfNeeded(parentWidget); + ceData.parentWidgetData.widgetObjectTypes = (const_cast(parentWidget)->controlElementDataObject())->widgetObjectTypes; + TQStyleControlElementDataPrivate* parentWidgetCEDataPrivate = const_cast(parentWidget)->controlElementDataPrivateObject(); + ceData.parentWidgetData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; + const TQPixmap* erasePixmap = parentWidget->backgroundPixmap(); + if (erasePixmap) { + ceData.parentWidgetData.bgPixmap = *erasePixmap; + } + if (populateReliantFields) { + ceData.parentWidgetData.bgBrush = parentWidget->backgroundBrush(); + } + if (populateReliantFields) { + ceData.parentWidgetData.windowState = (TQt::WindowState)(widget->windowState()); + } + ceData.parentWidgetData.wflags = parentWidget->getWFlags(); + ceData.parentWidgetData.bgColor = parentWidget->eraseColor(); + ceData.parentWidgetData.bgOffset = parentWidget->backgroundOffset(); + ceData.parentWidgetData.backgroundMode = parentWidget->backgroundMode(); + if (populateReliantFields) { + ceData.parentWidgetData.fgColor = parentWidget->foregroundColor(); + ceData.parentWidgetData.colorGroup = parentWidget->colorGroup(); + ceData.parentWidgetData.paletteBgColor = parentWidget->paletteBackgroundColor(); + } + ceData.parentWidgetData.geometry = parentWidget->geometry(); + ceData.parentWidgetData.rect = parentWidget->rect(); + ceData.parentWidgetData.pos = parentWidget->pos(); + const TQPixmap* icon = parentWidget->icon(); + if (icon) { + ceData.parentWidgetData.icon = *icon; + } + ceData.parentWidgetData.palette = parentWidget->palette(); + ceData.parentWidgetData.font = parentWidget->font(); + ceData.parentWidgetData.name = parentWidget->name(); + ceData.parentWidgetData.caption = parentWidget->caption(); + + if (parentWidgetCEDataPrivate->isTQDockWindow) { + const TQDockWindow * dw = static_cast(parentWidget); + if (dw->area()) { + ceData.dwData.hasDockArea = true; + ceData.dwData.areaOrientation = dw->area()->orientation(); + } + else { + ceData.dwData.hasDockArea = false; + } + ceData.dwData.closeEnabled = dw->isCloseEnabled(); + } + if (parentWidgetCEDataPrivate->isTQToolBar) { + const TQToolBar * toolbar = static_cast(parentWidget); + ceData.toolBarData.orientation = toolbar->orientation(); + } + ceData.parentWidgetFlags = getControlElementFlagsForObject(parentWidget, TQStyleOption::Default, populateReliantFields); + } + const TQWidget* topLevelWidget = widget->topLevelWidget(); + if (topLevelWidget) { + updateObjectTypeListIfNeeded(topLevelWidget); + ceData.topLevelWidgetData.widgetObjectTypes = (const_cast(topLevelWidget)->controlElementDataObject())->widgetObjectTypes; + TQStyleControlElementDataPrivate* topLevelWidgetCEDataPrivate = const_cast(topLevelWidget)->controlElementDataPrivateObject(); + ceData.topLevelWidgetData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; + const TQPixmap* erasePixmap = topLevelWidget->backgroundPixmap(); + if (erasePixmap) { + ceData.topLevelWidgetData.bgPixmap = *erasePixmap; + } + if (populateReliantFields) { + ceData.topLevelWidgetData.bgBrush = topLevelWidget->backgroundBrush(); + } + if (populateReliantFields) { + ceData.topLevelWidgetData.windowState = (TQt::WindowState)(widget->windowState()); + } + ceData.topLevelWidgetData.wflags = topLevelWidget->getWFlags(); + ceData.topLevelWidgetData.bgColor = topLevelWidget->eraseColor(); + ceData.topLevelWidgetData.bgOffset = topLevelWidget->backgroundOffset(); + ceData.topLevelWidgetData.backgroundMode = topLevelWidget->backgroundMode(); + if (populateReliantFields) { + ceData.topLevelWidgetData.fgColor = topLevelWidget->foregroundColor(); + ceData.topLevelWidgetData.colorGroup = topLevelWidget->colorGroup(); + ceData.topLevelWidgetData.paletteBgColor = topLevelWidget->paletteBackgroundColor(); + } + ceData.topLevelWidgetData.geometry = topLevelWidget->geometry(); + ceData.topLevelWidgetData.rect = topLevelWidget->rect(); + ceData.topLevelWidgetData.pos = topLevelWidget->pos(); + const TQPixmap* icon = topLevelWidget->icon(); + if (icon) { + ceData.topLevelWidgetData.icon = *icon; + } + ceData.topLevelWidgetData.palette = topLevelWidget->palette(); + ceData.topLevelWidgetData.font = topLevelWidget->font(); + ceData.topLevelWidgetData.name = topLevelWidget->name(); + ceData.topLevelWidgetData.caption = topLevelWidget->caption(); + + if (topLevelWidgetCEDataPrivate->isTQDockWindow) { + const TQDockWindow * dw = static_cast(topLevelWidget); + if (dw->area()) { + ceData.dwData.hasDockArea = true; + ceData.dwData.areaOrientation = dw->area()->orientation(); + } + else { + ceData.dwData.hasDockArea = false; + } + ceData.dwData.closeEnabled = dw->isCloseEnabled(); + } + if (topLevelWidgetCEDataPrivate->isTQToolBar) { + const TQToolBar * toolbar = static_cast(topLevelWidget); + ceData.toolBarData.orientation = toolbar->orientation(); + } + ceData.topLevelWidgetFlags = getControlElementFlagsForObject(topLevelWidget, TQStyleOption::Default, populateReliantFields); + } + + TQCheckListItem *item = opt.checkListItem(); + if (item) { + ceData.checkListItemData.dataValid = true; + ceData.checkListItemData.enabled = item->isEnabled(); + ceData.checkListItemData.hasParent = ( item->parent() && (item->parent()->rtti() == 1) && (((TQCheckListItem*) item->parent())->type() == TQCheckListItem::Controller) ); + ceData.checkListItemData.height = item->height(); + } + else { + ceData.checkListItemData.dataValid = false; + } + } + + return ceData; + } + else { + if (!TQStyleControlElementData_null) { + TQStyleControlElementData_null = new TQStyleControlElementData(); + tqAddPostRoutine(tqt_style_control_element_data_null_cleanup); + } + TQStyleControlElementData &ceData = *TQStyleControlElementData_null; + return ceData; + } +} + +const TQStyleControlElementData &populateControlElementDataFromApplication(const TQApplication* app, const TQStyleOption&, bool) { + TQStyleControlElementData &ceData = *(const_cast(app)->controlElementDataObject()); + + if (app) { + updateObjectTypeListIfNeeded(app); + ceData.widgetObjectTypes = (const_cast(app)->controlElementDataObject())->widgetObjectTypes; + ceData.palette = app->palette(); + ceData.font = app->font(); + } + + return ceData; +} + +/*! \reimp */ +void TQCommonStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + activePainter = p; + + switch (pe) { +#ifndef TQT_NO_LISTVIEW + case PE_CheckListController: { + p->drawPixmap(r, TQPixmap((const char **)check_list_controller_xpm)); + break; } + case PE_CheckListExclusiveIndicator: { + if(!ceData.checkListItemData.dataValid) + return; + int x = r.x(), y = r.y(); +#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2) + static const TQCOORD pts1[] = { // dark lines + 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; + static const TQCOORD pts2[] = { // black lines + 2,8, 1,7, 1,4, 2,3, 2,2, 3,2, 4,1, 7,1, 8,2, 9,2 }; + static const TQCOORD pts3[] = { // background lines + 2,9, 3,9, 4,10, 7,10, 8,9, 9,9, 9,8, 10,7, 10,4, 9,3 }; + static const TQCOORD pts4[] = { // white lines + 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, + 11,4, 10,3, 10,2 }; + // static const TQCOORD pts5[] = { // inner fill + // 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; + //TQPointArray a; + // p->eraseRect( x, y, w, h ); + + if ( flags & Style_Enabled ) + p->setPen( cg.text() ); + else + p->setPen( TQPen( ceData.palette.color( TQPalette::Disabled, TQColorGroup::Text ) ) ); + TQPointArray a( TQCOORDARRLEN(pts1), pts1 ); + a.translate( x, y ); + //p->setPen( cg.dark() ); + p->drawPolyline( a ); + a.setPoints( TQCOORDARRLEN(pts2), pts2 ); + a.translate( x, y ); + p->drawPolyline( a ); + a.setPoints( TQCOORDARRLEN(pts3), pts3 ); + a.translate( x, y ); + // p->setPen( black ); + p->drawPolyline( a ); + a.setPoints( TQCOORDARRLEN(pts4), pts4 ); + a.translate( x, y ); + // p->setPen( blue ); + p->drawPolyline( a ); + // a.setPoints( TQCOORDARRLEN(pts5), pts5 ); + // a.translate( x, y ); + // TQColor fillColor = isDown() ? g.background() : g.base(); + // p->setPen( fillColor ); + // p->setBrush( fillColor ); + // p->drawPolygon( a ); + if ( flags & Style_On ) { + p->setPen( NoPen ); + p->setBrush( cg.text() ); + p->drawRect( x+5, y+4, 2, 4 ); + p->drawRect( x+4, y+5, 4, 2 ); + } + break; } + case PE_CheckListIndicator: { + if(!ceData.checkListItemData.dataValid) + return; + int x = r.x(), y = r.y(), w = r.width(), h = r.width(), marg = ceData.listViewData.itemMargin; + + if ( flags & Style_Enabled ) + p->setPen( TQPen( cg.text(), 2 ) ); + else + p->setPen( TQPen( ceData.palette.color( TQPalette::Disabled, TQColorGroup::Text ), + 2 ) ); + if ( flags & Style_Selected && !ceData.listViewData.rootDecorated && !ceData.checkListItemData.hasParent ) { + p->fillRect( 0, 0, x + marg + w + 4, ceData.checkListItemData.height, + cg.brush( TQColorGroup::Highlight ) ); + if ( ceData.checkListItemData.enabled ) + p->setPen( TQPen( cg.highlightedText(), 2 ) ); + } + + if ( flags & Style_NoChange ) + p->setBrush( cg.brush( TQColorGroup::Button ) ); + p->drawRect( x+marg, y+2, w-4, h-4 ); + ///////////////////// + x++; + y++; + if ( ( flags & Style_On) || ( flags & Style_NoChange ) ) { + TQPointArray a( 7*2 ); + int i, xx = x+1+marg, yy=y+5; + for ( i=0; i<3; i++ ) { + a.setPoint( 2*i, xx, yy ); + a.setPoint( 2*i+1, xx, yy+2 ); + xx++; yy++; + } + yy -= 2; + for ( i=3; i<7; i++ ) { + a.setPoint( 2*i, xx, yy ); + a.setPoint( 2*i+1, xx, yy+2 ); + xx++; yy--; + } + p->drawLineSegments( a ); + } + break; } +#endif + case PE_HeaderArrow: + p->save(); + if ( flags & Style_Down ) { + TQPointArray pa( 3 ); + p->setPen( cg.light() ); + p->drawLine( r.x() + r.width(), r.y(), r.x() + r.width() / 2, r.height() ); + p->setPen( cg.dark() ); + pa.setPoint( 0, r.x() + r.width() / 2, r.height() ); + pa.setPoint( 1, r.x(), r.y() ); + pa.setPoint( 2, r.x() + r.width(), r.y() ); + p->drawPolyline( pa ); + } else { + TQPointArray pa( 3 ); + p->setPen( cg.light() ); + pa.setPoint( 0, r.x(), r.height() ); + pa.setPoint( 1, r.x() + r.width(), r.height() ); + pa.setPoint( 2, r.x() + r.width() / 2, r.y() ); + p->drawPolyline( pa ); + p->setPen( cg.dark() ); + p->drawLine( r.x(), r.height(), r.x() + r.width() / 2, r.y() ); + } + p->restore(); + break; + + case PE_StatusBarSection: + qDrawShadeRect( p, r, cg, TRUE, 1, 0, 0 ); + break; + + case PE_ButtonCommand: + case PE_ButtonBevel: + case PE_ButtonTool: + case PE_ButtonDropDown: + case PE_HeaderSection: + case PE_HeaderSectionMenu: + qDrawShadePanel(p, r, cg, flags & (Style_Sunken | Style_Down | Style_On) , 1, + &cg.brush(TQColorGroup::Button)); + break; + + case PE_Separator: + qDrawShadeLine( p, r.left(), r.top(), r.right(), r.bottom(), cg, + flags & Style_Sunken, 1, 0); + break; + + case PE_FocusRect: { + const TQColor *bg = 0; + + if (!opt.isDefault()) + bg = &opt.color(); + + TQPen oldPen = p->pen(); + + if (bg) { + int h, s, v; + bg->hsv(&h, &s, &v); + if (v >= 128) + p->setPen(TQt::black); + else + p->setPen(TQt::white); + } else + p->setPen(cg.foreground()); + + if (flags & Style_FocusAtBorder) + p->drawRect(TQRect(r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2)); + else + p->drawRect(r); + + p->setPen(oldPen); + break; } + + case PE_SpinWidgetPlus: + case PE_SpinWidgetMinus: { + p->save(); + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, 0 ); + TQRect br; + br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, + r.height() - fw*2 ); + + p->fillRect( br, cg.brush( TQColorGroup::Button ) ); + p->setPen( cg.buttonText() ); + p->setBrush( cg.buttonText() ); + + int length; + int x = r.x(), y = r.y(), w = r.width(), h = r.height(); + if ( w <= 8 || h <= 6 ) + length = TQMIN( w-2, h-2 ); + else + length = TQMIN( 2*w / 3, 2*h / 3 ); + + if ( !(length & 1) ) + length -=1; + int xmarg = ( w - length ) / 2; + int ymarg = ( h - length ) / 2; + + p->drawLine( x + xmarg, ( y + h / 2 - 1 ), + x + xmarg + length - 1, ( y + h / 2 - 1 ) ); + if ( pe == PE_SpinWidgetPlus ) + p->drawLine( ( x+w / 2 ) - 1, y + ymarg, + ( x+w / 2 ) - 1, y + ymarg + length - 1 ); + p->restore(); + break; } + + case PE_SpinWidgetUp: + case PE_SpinWidgetDown: { + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, 0 ); + TQRect br; + br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, + r.height() - fw*2 ); + p->fillRect( br, cg.brush( TQColorGroup::Button ) ); + int x = r.x(), y = r.y(), w = r.width(), h = r.height(); + int sw = w-4; + if ( sw < 3 ) + break; + else if ( !(sw & 1) ) + sw--; + sw -= ( sw / 7 ) * 2; // Empty border + int sh = sw/2 + 2; // Must have empty row at foot of arrow + + int sx = x + w / 2 - sw / 2 - 1; + int sy = y + h / 2 - sh / 2 - 1; + + TQPointArray a; + if ( pe == PE_SpinWidgetDown ) + a.setPoints( 3, 0, 1, sw-1, 1, sh-2, sh-1 ); + else + a.setPoints( 3, 0, sh-1, sw-1, sh-1, sh-2, 1 ); + int bsx = 0; + int bsy = 0; + if ( flags & Style_Sunken ) { + bsx = pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags); + bsy = pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags); + } + p->save(); + p->translate( sx + bsx, sy + bsy ); + p->setPen( cg.buttonText() ); + p->setBrush( cg.buttonText() ); + p->drawPolygon( a ); + p->restore(); + break; } + + case PE_Indicator: { + if (flags & Style_NoChange) { + p->setPen(cg.foreground()); + p->fillRect(r, cg.brush(TQColorGroup::Button)); + p->drawRect(r); + p->drawLine(r.topLeft(), r.bottomRight()); + } else + qDrawShadePanel(p, r.x(), r.y(), r.width(), r.height(), + cg, flags & (Style_Sunken | Style_On), 1, + &cg.brush(TQColorGroup::Button)); + break; } + + case PE_IndicatorMask: { + p->fillRect(r, color1); + break; } + + case PE_ExclusiveIndicator: { + TQRect ir = r; + p->setPen(cg.dark()); + p->drawArc(r, 0, 5760); + + if (flags & (Style_Sunken | Style_On)) { + ir.addCoords(2, 2, -2, -2); + p->setBrush(cg.foreground()); + p->drawEllipse(ir); + } + + break; } + + case PE_ExclusiveIndicatorMask: { + p->setPen(color1); + p->setBrush(color1); + p->drawEllipse(r); + break; } + + case PE_DockWindowHandle: { + bool highlight = flags & Style_On; + + p->save(); + p->translate( r.x(), r.y() ); + if ( flags & Style_Horizontal ) { + int x = r.width() / 3; + if ( r.height() > 4 ) { + qDrawShadePanel( p, x, 2, 3, r.height() - 4, + cg, highlight, 1, 0 ); + qDrawShadePanel( p, x+3, 2, 3, r.height() - 4, + cg, highlight, 1, 0 ); + } + } else { + if ( r.width() > 4 ) { + int y = r.height() / 3; + qDrawShadePanel( p, 2, y, r.width() - 4, 3, + cg, highlight, 1, 0 ); + qDrawShadePanel( p, 2, y+3, r.width() - 4, 3, + cg, highlight, 1, 0 ); + } + } + p->restore(); + break; + } + + case PE_DockWindowSeparator: { + TQPoint p1, p2; + if ( flags & Style_Horizontal ) { + p1 = TQPoint( r.width()/2, 0 ); + p2 = TQPoint( p1.x(), r.height() ); + } else { + p1 = TQPoint( 0, r.height()/2 ); + p2 = TQPoint( r.width(), p1.y() ); + } + qDrawShadeLine( p, p1, p2, cg, 1, 1, 0 ); + break; } + + case PE_Panel: + case PE_PanelPopup: { + int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) + : opt.lineWidth(); + + qDrawShadePanel(p, r, cg, (flags & Style_Sunken), lw); + break; } + + case PE_PanelDockWindow: { + int lw = opt.isDefault() ? pixelMetric(PM_DockWindowFrameWidth, ceData, elementFlags) + : opt.lineWidth(); + + qDrawShadePanel(p, r, cg, FALSE, lw); + break; } + + case PE_PanelMenuBar: { + int lw = opt.isDefault() ? pixelMetric(PM_MenuBarFrameWidth, ceData, elementFlags) + : opt.lineWidth(); + + qDrawShadePanel(p, r, cg, FALSE, lw, &cg.brush(TQColorGroup::Button)); + break; } + + case PE_SizeGrip: { + p->save(); + + int x, y, w, h; + r.rect(&x, &y, &w, &h); + + int sw = TQMIN( h,w ); + if ( h > w ) + p->translate( 0, h - w ); + else + p->translate( w - h, 0 ); + + int sx = x; + int sy = y; + int s = sw / 3; + + if ( TQApplication::reverseLayout() ) { + sx = x + sw; + for ( int i = 0; i < 4; ++i ) { + p->setPen( TQPen( cg.light(), 1 ) ); + p->drawLine( x, sy - 1 , sx + 1, sw ); + p->setPen( TQPen( cg.dark(), 1 ) ); + p->drawLine( x, sy, sx, sw ); + p->setPen( TQPen( cg.dark(), 1 ) ); + p->drawLine( x, sy + 1, sx - 1, sw ); + sx -= s; + sy += s; + } + } else { + for ( int i = 0; i < 4; ++i ) { + p->setPen( TQPen( cg.light(), 1 ) ); + p->drawLine( sx-1, sw, sw, sy-1 ); + p->setPen( TQPen( cg.dark(), 1 ) ); + p->drawLine( sx, sw, sw, sy ); + p->setPen( TQPen( cg.dark(), 1 ) ); + p->drawLine( sx+1, sw, sw, sy+1 ); + sx += s; + sy += s; + } + } + + p->restore(); + break; } + + case PE_CheckMark: { + const int markW = r.width() > 7 ? 7 : r.width(); + const int markH = markW; + int posX = r.x() + ( r.width() - markW )/2 + 1; + int posY = r.y() + ( r.height() - markH )/2; + + // Could do with some optimizing/caching... + TQPointArray a( markH*2 ); + int i, xx, yy; + xx = posX; + yy = 3 + posY; + for ( i=0; isetPen( cg.highlightedText() ); + TQPoint offset(1,1); + for ( pnt = 0; pnt < (int)a.size(); pnt++ ) + a[pnt] += offset; + p->drawLineSegments( a ); + for ( pnt = 0; pnt < (int)a.size(); pnt++ ) + a[pnt] -= offset; + } + p->setPen( cg.text() ); + p->drawLineSegments( a ); + break; } + + case PE_PanelGroupBox: //We really do not need PE_GroupBoxFrame anymore, nasty holdover ### + drawPrimitive( PE_GroupBoxFrame, p, ceData, elementFlags, r, cg, flags, opt ); + break; + case PE_GroupBoxFrame: { +#ifndef TQT_NO_FRAME + if ( opt.isDefault() ) + break; + int lwidth = opt.lineWidth(), mlwidth = opt.midLineWidth(); + if ( flags & (Style_Sunken|Style_Raised)) + qDrawShadeRect( p, r.x(), r.y(), r.width(), r.height(), cg, flags & Style_Sunken, lwidth, mlwidth ); + else + qDrawPlainRect( p, r.x(), r.y(), r.width(), r.height(), cg.foreground(), lwidth ); +#endif + break; } + + case PE_ProgressBarChunk: + p->fillRect( r.x(), r.y() + 3, r.width() -2, r.height() - 6, + cg.brush(TQColorGroup::Highlight)); + break; + + case PE_PanelLineEdit: + case PE_PanelTabWidget: + case PE_WindowFrame: + drawPrimitive( PE_Panel, p, ceData, elementFlags, r, cg, flags, opt ); + break; + + case PE_RubberBand: + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, r, cg, flags, opt); + break; + default: + break; + } + + activePainter = 0; +} + +void qt_style_erase_region(TQPainter* p, const TQRegion& region, const TQStyleControlElementData &ceData) { + TQRegion reg = region; + + TQPoint offset = ceData.bgOffset; + int ox = offset.x(); + int oy = offset.y(); + + TQRegion origcr = p->clipRegion(); + p->setClipRegion(region); + if (!ceData.bgPixmap.isNull()) { + p->drawTiledPixmap(0, 0, ceData.geometry.width(), ceData.geometry.height(), ceData.bgPixmap, ox, oy); + } + else { + p->fillRect(ceData.rect, ceData.bgColor); + } + p->setClipRegion(origcr); + return; +} + +/*! \reimp */ +void TQCommonStyle::drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + activePainter = p; + + switch (element) { + case CE_MenuBarEmptyArea: { + TQRegion reg; + if(p->hasClipping()) //ick + reg = p->clipRegion(); + else + reg = r; + qt_style_erase_region(p, reg, ceData); + break; } + case CE_PushButton: + { +#ifndef TQT_NO_PUSHBUTTON + TQRect br = r; + int dbi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); + + if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { + if (elementFlags & CEF_IsDefault) { + drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, br, cg, flags); + } + + br.setCoords(br.left() + dbi, + br.top() + dbi, + br.right() - dbi, + br.bottom() - dbi); + } + + p->save(); + p->setBrushOrigin( -ceData.bgOffset.x(), + -ceData.bgOffset.y() ); + drawPrimitive(PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags); + p->restore(); +#endif + break; + } + + case CE_PushButtonLabel: + { +#ifndef TQT_NO_PUSHBUTTON + TQRect ir = r; + + if ((elementFlags & CEF_IsDown) || (elementFlags & CEF_IsOn)) { + flags |= Style_Sunken; + ir.moveBy(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget)); + } + + if (elementFlags & CEF_IsMenuWidget) { + int mbi = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags, widget); + TQRect ar(ir.right() - mbi, ir.y() + 2, mbi - 4, ir.height() - 4); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags, opt); + ir.setWidth(ir.width() - mbi); + } + + int tf=AlignVCenter | ShowPrefix; + if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) + tf |= NoAccel; + +#ifndef TQT_NO_ICONSET + if ( !ceData.iconSet.isNull() ) { + TQIconSet::Mode mode = + (elementFlags & CEF_IsEnabled) ? TQIconSet::Normal : TQIconSet::Disabled; + if ( mode == TQIconSet::Normal && (elementFlags & CEF_HasFocus) ) + mode = TQIconSet::Active; + + TQIconSet::State state = TQIconSet::Off; + if ( (elementFlags & CEF_BiState) && (elementFlags & CEF_IsOn) ) + state = TQIconSet::On; + + TQPixmap pixmap = ceData.iconSet.pixmap( TQIconSet::Small, mode, state ); + int pixw = pixmap.width(); + int pixh = pixmap.height(); + + //Center the icon if there is neither text nor pixmap + if ( ceData.text.isEmpty() && ceData.fgPixmap.isNull() ) + p->drawPixmap( ir.x() + ir.width() / 2 - pixw / 2, ir.y() + ir.height() / 2 - pixh / 2, pixmap ); + else + p->drawPixmap( ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2, pixmap ); + + ir.moveBy(pixw + 4, 0); + ir.setWidth(ir.width() - (pixw + 4)); + // left-align text if there is + if (!ceData.text.isEmpty()) + tf |= AlignLeft; + else if (!ceData.fgPixmap.isNull()) + tf |= AlignHCenter; + } else +#endif //TQT_NO_ICONSET + tf |= AlignHCenter; + drawItem(p, ir, tf, cg, + flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, + ceData.text.length(), &(cg.buttonText()) ); + + if (flags & Style_HasFocus) + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), + cg, flags); +#endif + break; + } + + case CE_CheckBox: + drawPrimitive(PE_Indicator, p, ceData, elementFlags, r, cg, flags, opt); + break; + + case CE_CheckBoxLabel: + { +#ifndef TQT_NO_CHECKBOX + int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; + if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) + alignment |= NoAccel; + + drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, + flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text); + + if (flags & Style_HasFocus) { + TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); + } +#endif + break; + } + + case CE_RadioButton: + drawPrimitive(PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, flags, opt); + break; + + case CE_RadioButtonLabel: + { +#ifndef TQT_NO_RADIOBUTTON + int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; + if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) + alignment |= NoAccel; + drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, + flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text); + + if (flags & Style_HasFocus) { + TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); + } +#endif + break; + } + +#ifndef TQT_NO_TABBAR + case CE_TabBarTab: + { + if ( ceData.tabBarData.shape == TQTabBar::TriangularAbove || + ceData.tabBarData.shape == TQTabBar::TriangularBelow ) { + // triangular, above or below + int y; + int x; + TQPointArray a( 10 ); + a.setPoint( 0, 0, -1 ); + a.setPoint( 1, 0, 0 ); + y = r.height()-2; + x = y/3; + a.setPoint( 2, x++, y-1 ); + a.setPoint( 3, x++, y ); + a.setPoint( 3, x++, y++ ); + a.setPoint( 4, x, y ); + + int i; + int right = r.width() - 1; + for ( i = 0; i < 5; i++ ) + a.setPoint( 9-i, right - a.point( i ).x(), a.point( i ).y() ); + + if ( ceData.tabBarData.shape == TQTabBar::TriangularAbove ) + for ( i = 0; i < 10; i++ ) + a.setPoint( i, a.point(i).x(), + r.height() - 1 - a.point( i ).y() ); + + a.translate( r.left(), r.top() ); + + if ( flags & Style_Selected ) + p->setBrush( cg.base() ); + else + p->setBrush( cg.background() ); + p->setPen( cg.foreground() ); + p->drawPolygon( a ); + p->setBrush( NoBrush ); + } + break; + } + + case CE_TabBarLabel: + { + if ( opt.isDefault() ) + break; + + TQTab * t = opt.tab(); + + TQRect tr = r; + if (elementFlags & CEF_IsActive) + tr.setBottom( tr.bottom() - + pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, widget ) ); + + int alignment = AlignCenter | ShowPrefix; + if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) + alignment |= NoAccel; + drawItem( p, tr, alignment, cg, + flags & Style_Enabled, 0, t->text() ); + + if ( (flags & Style_HasFocus) && !t->text().isEmpty() ) + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, r, cg ); + break; + } +#endif // TQT_NO_TABBAR +#ifndef TQT_NO_TOOLBOX + case CE_ToolBoxTab: + { + int d = 20 + r.height() - 3; + TQPointArray a( 7 ); + a.setPoint( 0, -1, r.height() + 1 ); + a.setPoint( 1, -1, 1 ); + a.setPoint( 2, r.width() - d, 1 ); + a.setPoint( 3, r.width() - 20, r.height() - 2 ); + a.setPoint( 4, r.width() - 1, r.height() - 2 ); + a.setPoint( 5, r.width() - 1, r.height() + 1 ); + a.setPoint( 6, -1, r.height() + 1 ); + + if ( flags & Style_Selected && !(elementFlags & CEF_IsContainerEmpty) ) + p->setBrush( ceData.activeItemPaletteBgColor ); + else + p->setBrush( cg.brush(TQColorGroup::Background) ); + + p->setPen( cg.mid().dark( 150 ) ); + p->drawPolygon( a ); + p->setPen( cg.light() ); + p->drawLine( 0, 2, r.width() - d, 2 ); + p->drawLine( r.width() - d - 1, 2, r.width() - 21, r.height() - 1 ); + p->drawLine( r.width() - 20, r.height() - 1, r.width(), r.height() - 1 ); + p->setBrush( NoBrush ); + break; + } +#endif // TQT_NO_TOOLBOX + case CE_ProgressBarGroove: + qDrawShadePanel(p, r, cg, TRUE, 1, &cg.brush(TQColorGroup::Background)); + break; + +#ifndef TQT_NO_PROGRESSBAR + case CE_ProgressBarContents: + { + // Correct the highlight color if same as background, + // or else we cannot see the progress... + TQColorGroup cgh = cg; + if ( cgh.highlight() == cgh.background() ) + cgh.setColor( TQColorGroup::Highlight, ceData.palette.active().highlight() ); + bool reverse = TQApplication::reverseLayout(); + int fw = 2; + int w = r.width() - 2*fw; + if ( !ceData.totalSteps ) { + // draw busy indicator + int x = ceData.currentStep % (w * 2); + if (x > w) + x = 2 * w - x; + x = reverse ? r.right() - x : x + r.x(); + p->setPen( TQPen(cgh.highlight(), 4) ); + p->drawLine(x, r.y() + 1, x, r.height() - fw); + } else { + const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, ceData, elementFlags, widget); + int u; + if ( unit_width > 1 ) + u = (r.width()+unit_width/3) / unit_width; + else + u = w / unit_width; + int p_v = ceData.currentStep; + int t_s = ceData.totalSteps ? ceData.totalSteps : 1; + + if ( u > 0 && p_v >= INT_MAX / u && t_s >= u ) { + // scale down to something usable. + p_v /= u; + t_s /= u; + } + + // nu < tnu, if last chunk is only a partial chunk + int tnu, nu; + tnu = nu = p_v * u / t_s; + + if (nu * unit_width > w) + nu--; + + // Draw nu units out of a possible u of unit_width + // width, each a rectangle bordered by background + // color, all in a sunken panel with a percentage text + // display at the end. + int x = 0; + int x0 = reverse ? r.right() - ((unit_width > 1) ? + unit_width : fw) : r.x() + fw; + for (int i=0; i= ceData.totalSteps ) + pcolor = &penColor; + drawItem(p, r, AlignCenter | SingleLine, cg, flags & Style_Enabled, 0, + ceData.progressText, -1, pcolor ); + } + break; +#endif // TQT_NO_PROGRESSBAR + + case CE_MenuBarItem: + { +#ifndef TQT_NO_MENUDATA + if (opt.isDefault()) + break; + + TQMenuItem *mi = opt.menuItem(); + int alignment = AlignCenter|ShowPrefix|DontClip|SingleLine; + if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) + alignment |= NoAccel; + drawItem( p, r, alignment, cg, + flags & Style_Enabled, mi->pixmap(), mi->text(), -1, + &cg.buttonText() ); +#endif + break; + } + +#ifndef TQT_NO_TOOLBUTTON + case CE_ToolButtonLabel: + { + TQRect rect = r; + TQt::ArrowType arrowType = opt.isDefault() + ? TQt::DownArrow : opt.arrowType(); + + int shiftX = 0; + int shiftY = 0; + if (flags & (Style_Down | Style_On)) { + shiftX = pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget); + shiftY = pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget); + } + + if (!opt.isDefault()) { + PrimitiveElement pe; + switch (arrowType) { + case TQt::LeftArrow: pe = PE_ArrowLeft; break; + case TQt::RightArrow: pe = PE_ArrowRight; break; + case TQt::UpArrow: pe = PE_ArrowUp; break; + default: + case TQt::DownArrow: pe = PE_ArrowDown; break; + } + + rect.moveBy(shiftX, shiftY); + drawPrimitive(pe, p, ceData, elementFlags, rect, cg, flags, opt); + } else { + TQColor btext = ceData.fgColor; + + if (ceData.iconSet.isNull() && + ! ceData.text.isNull() && + ! (elementFlags & CEF_UsesTextLabel)) { + int alignment = AlignCenter | ShowPrefix; + if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) + alignment |= NoAccel; + + rect.moveBy(shiftX, shiftY); + drawItem(p, rect, alignment, cg, + flags & Style_Enabled, 0, ceData.text, + ceData.text.length(), &btext); + } else { + TQPixmap pm; + TQIconSet::Size size = + (elementFlags & CEF_UsesBigPixmap) ? TQIconSet::Large : TQIconSet::Small; + TQIconSet::State state = + (elementFlags & CEF_IsOn) ? TQIconSet::On : TQIconSet::Off; + TQIconSet::Mode mode; + if (! (elementFlags & CEF_IsEnabled)) + mode = TQIconSet::Disabled; + else if (flags & (Style_Down | Style_On) || + ((flags & Style_Raised) && (flags & Style_AutoRaise))) + mode = TQIconSet::Active; + else + mode = TQIconSet::Normal; + pm = ceData.iconSet.pixmap( size, mode, state ); + + if (elementFlags & CEF_UsesTextLabel) { + p->setFont( ceData.font ); + TQRect pr = rect, tr = rect; + int alignment = ShowPrefix; + if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) + alignment |= NoAccel; + + if ( ceData.toolButtonTextPosition == TQToolButton::Under ) { + int fh = p->fontMetrics().height(); + pr.addCoords( 0, 1, 0, -fh-3 ); + tr.addCoords( 0, pr.bottom(), 0, -3 ); + pr.moveBy(shiftX, shiftY); + drawItem( p, pr, AlignCenter, cg, TRUE, &pm, TQString::null ); + alignment |= AlignCenter; + } else { + pr.setWidth( pm.width() + 8 ); + tr.addCoords( pr.right(), 0, 0, 0 ); + pr.moveBy(shiftX, shiftY); + + drawItem( p, pr, AlignCenter, cg, TRUE, &pm, TQString::null ); + alignment |= AlignLeft | AlignVCenter; + } + + tr.moveBy(shiftX, shiftY); + drawItem( p, tr, alignment, cg, + flags & Style_Enabled, 0, ceData.textLabel, + ceData.textLabel.length(), &btext); + } else { + rect.moveBy(shiftX, shiftY); + drawItem( p, rect, AlignCenter, cg, TRUE, &pm, TQString::null ); + } + } + } + + break; + } +#endif // TQT_NO_TOOLBUTTON +#ifndef TQT_NO_HEADER + case CE_HeaderLabel: + { + TQRect rect = r; + + const TQIconSet* icon = &ceData.iconSet; + if ( icon ) { + TQPixmap pixmap = icon->pixmap( TQIconSet::Small, + flags & Style_Enabled ? + TQIconSet::Normal : TQIconSet::Disabled ); + int pixw = pixmap.width(); + int pixh = pixmap.height(); + // "pixh - 1" because of tricky integer division + + TQRect pixRect = rect; + pixRect.setY( rect.center().y() - (pixh - 1) / 2 ); + drawItem ( p, pixRect, AlignVCenter, cg, flags & Style_Enabled, + &pixmap, TQString::null ); + if (TQApplication::reverseLayout()) + rect.setRight(rect.right() - pixw - 2); + else + rect.setLeft(rect.left() + pixw + 2); + } + + if (rect.isValid()) + drawItem ( p, rect, AlignVCenter, cg, flags & Style_Enabled, + 0, ceData.textLabel, -1, &(cg.buttonText()) ); + } +#endif // TQT_NO_HEADER + default: + break; + } + + activePainter = 0; +} + +/*! \reimp */ +void TQCommonStyle::drawControlMask( ControlElement control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + Q_UNUSED(ceData); + Q_UNUSED(elementFlags); + Q_UNUSED(widget); + + activePainter = p; + + TQColorGroup cg(color1,color1,color1,color1,color1,color1,color1,color1,color0); + + switch (control) { + case CE_PushButton: + drawPrimitive(PE_ButtonCommand, p, ceData, elementFlags, r, cg, Style_Default, opt); + break; + + case CE_CheckBox: + drawPrimitive(PE_IndicatorMask, p, ceData, elementFlags, r, cg, Style_Default, opt); + break; + + case CE_RadioButton: + drawPrimitive(PE_ExclusiveIndicatorMask, p, ceData, elementFlags, r, cg, Style_Default, opt); + break; + + default: + p->fillRect(r, color1); + break; + } + + activePainter = 0; +} + +/*! \reimp */ +TQRect TQCommonStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const +{ + TQRect rect, wrect(ceData.rect); + + switch (r) { +#ifndef TQT_NO_DIALOGBUTTONS + case SR_DialogButtonAbort: + case SR_DialogButtonRetry: + case SR_DialogButtonIgnore: + case SR_DialogButtonAccept: + case SR_DialogButtonReject: + case SR_DialogButtonApply: + case SR_DialogButtonHelp: + case SR_DialogButtonAll: + case SR_DialogButtonCustom: { + TQDialogButtons::Button srch = TQDialogButtons::None; + if(r == SR_DialogButtonAccept) + srch = TQDialogButtons::Accept; + else if(r == SR_DialogButtonReject) + srch = TQDialogButtons::Reject; + else if(r == SR_DialogButtonAll) + srch = TQDialogButtons::All; + else if(r == SR_DialogButtonApply) + srch = TQDialogButtons::Apply; + else if(r == SR_DialogButtonHelp) + srch = TQDialogButtons::Help; + else if(r == SR_DialogButtonRetry) + srch = TQDialogButtons::Retry; + else if(r == SR_DialogButtonIgnore) + srch = TQDialogButtons::Ignore; + else if(r == SR_DialogButtonAbort) + srch = TQDialogButtons::Abort; + + const int bwidth = pixelMetric(PM_DialogButtonsButtonWidth, ceData, elementFlags, widget), + bheight = pixelMetric(PM_DialogButtonsButtonHeight, ceData, elementFlags, widget), + bspace = pixelMetric(PM_DialogButtonsSeparator, ceData, elementFlags, widget), + fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget); + int start = fw; + if(ceData.orientation == Horizontal) + start = wrect.right() - fw; + TQDialogButtons::Button btns[] = { TQDialogButtons::All, TQDialogButtons::Reject, TQDialogButtons::Accept, //reverse order (right to left) + TQDialogButtons::Apply, TQDialogButtons::Retry, TQDialogButtons::Ignore, TQDialogButtons::Abort, + TQDialogButtons::Help }; + for(unsigned int i = 0, cnt = 0; i < (sizeof(btns)/sizeof(btns[0])); i++) { + if (ceData.dlgVisibleButtons & btns[i]) { + TQSize szH = ceData.dlgVisibleSizeHints[btns[i]]; + int mwidth = TQMAX(bwidth, szH.width()), mheight = TQMAX(bheight, szH.height()); + if(ceData.orientation == Horizontal) { + start -= mwidth; + if(cnt) + start -= bspace; + } else if(cnt) { + start += mheight; + start += bspace; + } + cnt++; + if(btns[i] == srch) { + if(ceData.orientation == Horizontal) + return TQRect(start, wrect.bottom() - fw - mheight, mwidth, mheight); + else + return TQRect(fw, start, mwidth, mheight); + } + } + } + if(r == SR_DialogButtonCustom) { + if(ceData.orientation == Horizontal) + return TQRect(fw, fw, start - fw - bspace, wrect.height() - (fw*2)); + else + return TQRect(fw, start, wrect.width() - (fw*2), wrect.height() - start - (fw*2)); + } + return TQRect(); } +#endif //TQT_NO_DIALOGBUTTONS + case SR_PushButtonContents: + { +#ifndef TQT_NO_PUSHBUTTON + int dx1, dx2; + + dx1 = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget); + if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) + dx1 += pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); + dx2 = dx1 * 2; + + rect.setRect(wrect.x() + dx1, + wrect.y() + dx1, + wrect.width() - dx2, + wrect.height() - dx2); +#endif + break; + } + + case SR_PushButtonFocusRect: + { +#ifndef TQT_NO_PUSHBUTTON + int dbw1 = 0, dbw2 = 0; + if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { + dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); + dbw2 = dbw1 * 2; + } + + int dfw1 = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2, + dfw2 = dfw1 * 2; + + rect.setRect(wrect.x() + dfw1 + dbw1, + wrect.y() + dfw1 + dbw1, + wrect.width() - dfw2 - dbw2, + wrect.height() - dfw2 - dbw2); +#endif + break; + } + + case SR_CheckBoxIndicator: + { + int h = pixelMetric( PM_IndicatorHeight, ceData, elementFlags, widget ); + rect.setRect(0, ( wrect.height() - h ) / 2, + pixelMetric( PM_IndicatorWidth, ceData, elementFlags, widget ), h ); + break; + } + + case SR_CheckBoxContents: + { +#ifndef TQT_NO_CHECKBOX + TQRect ir = subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget); + rect.setRect(ir.right() + 6, wrect.y(), + wrect.width() - ir.width() - 6, wrect.height()); +#endif + break; + } + + case SR_CheckBoxFocusRect: + { +#ifndef TQT_NO_CHECKBOX + if ( ceData.fgPixmap.isNull() && ceData.text.isEmpty() ) { + rect = subRect( SR_CheckBoxIndicator, ceData, elementFlags, widget ); + rect.addCoords( 1, 1, -1, -1 ); + break; + } + TQRect cr = subRect(SR_CheckBoxContents, ceData, elementFlags, widget); + + // don't create a painter if we have an active one + TQPainter *p = 0; + if (! activePainter) + p = new TQPainter(widget); + rect = itemRect((activePainter ? activePainter : p), + cr, AlignLeft | AlignVCenter | ShowPrefix, + (elementFlags & CEF_IsEnabled), + (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, + ceData.text); + + delete p; + + rect.addCoords( -3, -2, 3, 2 ); + rect = rect.intersect(wrect); +#endif + break; + } + + case SR_RadioButtonIndicator: + { + int h = pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags, widget ); + rect.setRect(0, ( wrect.height() - h ) / 2, + pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags, widget ), h ); + break; + } + + case SR_RadioButtonContents: + { + TQRect ir = subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget); + rect.setRect(ir.right() + 6, wrect.y(), + wrect.width() - ir.width() - 6, wrect.height()); + break; + } + + case SR_RadioButtonFocusRect: + { +#ifndef TQT_NO_RADIOBUTTON + if ( ceData.fgPixmap.isNull() && ceData.text.isEmpty() ) { + rect = subRect( SR_RadioButtonIndicator, ceData, elementFlags, widget ); + rect.addCoords( 1, 1, -1, -1 ); + break; + } + TQRect cr = subRect(SR_RadioButtonContents, ceData, elementFlags, widget); + + // don't create a painter if we have an active one + TQPainter *p = 0; + if (! activePainter) + p = new TQPainter(widget); + rect = itemRect((activePainter ? activePainter : p), + cr, AlignLeft | AlignVCenter | ShowPrefix, + (elementFlags & CEF_IsEnabled), + (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, + ceData.text); + delete p; + + rect.addCoords( -3, -2, 3, 2 ); + rect = rect.intersect(wrect); +#endif + break; + } + + case SR_ComboBoxFocusRect: + rect.setRect(3, 3, ceData.rect.width()-6-16, ceData.rect.height()-6); + break; + +#ifndef TQT_NO_SLIDER + case SR_SliderFocusRect: + { + int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + + if ( ceData.orientation == Horizontal ) + rect.setRect( 0, tickOffset-1, ceData.rect.width(), thickness+2 ); + else + rect.setRect( tickOffset-1, 0, thickness+2, ceData.rect.height() ); + rect = rect.intersect( ceData.rect ); // ## is this really necessary? + break; + } +#endif // TQT_NO_SLIDER + +#ifndef TQT_NO_MAINWINDOW + case SR_DockWindowHandleRect: + { + if (!(elementFlags & CEF_HasParentWidget)) + break; + + if ( !ceData.dwData.hasDockArea || !ceData.dwData.closeEnabled ) + rect.setRect( 0, 0, ceData.rect.width(), ceData.rect.height() ); + else { + if ( ceData.dwData.areaOrientation == Horizontal ) + rect.setRect(0, 15, ceData.rect.width(), ceData.rect.height() - 15); + else + rect.setRect(0, 1, ceData.rect.width() - 15, ceData.rect.height() - 1); + } + break; + } +#endif // TQT_NO_MAINWINDOW + + case SR_ProgressBarGroove: + case SR_ProgressBarContents: + { +#ifndef TQT_NO_PROGRESSBAR + TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) : + TQApplication::fontMetrics() ) ); + int textw = 0; + if (ceData.percentageVisible) + textw = fm.width("100%") + 6; + + if ((elementFlags & CEF_IndicatorFollowsStyle) || + ! (elementFlags & CEF_CenterIndicator)) + rect.setCoords(wrect.left(), wrect.top(), + wrect.right() - textw, wrect.bottom()); + else + rect = wrect; +#endif + break; + } + + case SR_ProgressBarLabel: + { +#ifndef TQT_NO_PROGRESSBAR + TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) : + TQApplication::fontMetrics() ) ); + int textw = 0; + if (ceData.percentageVisible) + textw = fm.width("100%") + 6; + + if ((elementFlags & CEF_IndicatorFollowsStyle) || + ! (elementFlags & CEF_CenterIndicator)) + rect.setCoords(wrect.right() - textw, wrect.top(), + wrect.right(), wrect.bottom()); + else + rect = wrect; +#endif + break; + } + + case SR_ToolButtonContents: + rect = querySubControlMetrics(CC_ToolButton, ceData, elementFlags, SC_ToolButton, TQStyleOption::Default, widget); + break; + + case SR_ToolBoxTabContents: + rect = wrect; + rect.addCoords( 0, 0, -30, 0 ); + break; + + default: + rect = wrect; + break; + } + + return rect; +} + +#ifndef TQT_NO_RANGECONTROL +/* + I really need this and I don't want to expose it in TQRangeControl.. +*/ +static int qPositionFromValue( const TQStyleControlElementData &ceData, int logical_val, + int span ) +{ + if ( span <= 0 || logical_val < ceData.minSteps || + ceData.maxSteps <= ceData.minSteps ) + return 0; + if ( logical_val > ceData.maxSteps ) + return span; + + uint range = ceData.maxSteps - ceData.minSteps; + uint p = logical_val - ceData.minSteps; + + if ( range > (uint)INT_MAX/4096 ) { + const int scale = 4096*2; + return ( (p/scale) * span ) / (range/scale); + // ### the above line is probably not 100% correct + // ### but fixing it isn't worth the extreme pain... + } else if ( range > (uint)span ) { + return (2*p*span + range) / (2*range); + } else { + uint div = span / range; + uint mod = span % range; + return p*div + (2*p*mod + range) / (2*range); + } + //equiv. to (p*span)/range + 0.5 + // no overflow because of this implicit assumption: + // span <= 4096 +} +#endif // TQT_NO_RANGECONTROL + +/*! \reimp */ +void TQCommonStyle::drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + SCFlags controls, + SCFlags active, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + activePainter = p; + + switch (control) { +#ifndef TQT_NO_SCROLLBAR + case CC_ScrollBar: + { + TQRect addline, subline, addpage, subpage, slider, first, last; + bool maxedOut = (ceData.minSteps == ceData.maxSteps); + + subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget); + addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget); + subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget); + addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget); + slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget); + first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget); + last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget); + + if ((controls & SC_ScrollBarSubLine) && subline.isValid()) + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarSubLine) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : 0)); + if ((controls & SC_ScrollBarAddLine) && addline.isValid()) + drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarAddLine) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : 0)); + if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) + drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarSubPage) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : 0)); + if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) + drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarAddPage) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : 0)); + if ((controls & SC_ScrollBarFirst) && first.isValid()) + drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarFirst) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : 0)); + if ((controls & SC_ScrollBarLast) && last.isValid()) + drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarLast) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : 0)); + if ((controls & SC_ScrollBarSlider) && slider.isValid()) { + drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarSlider) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : 0)); + + // ### perhaps this should not be able to accept focus if maxedOut? + if (elementFlags & CEF_HasFocus) { + TQRect fr(slider.x() + 2, slider.y() + 2, + slider.width() - 5, slider.height() - 5); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default); + } + } + + break; + } +#endif // TQT_NO_SCROLLBAR + +#ifndef TQT_NO_TOOLBUTTON + case CC_ToolButton: + { + TQColorGroup c = cg; + if ( ceData.backgroundMode != PaletteButton ) + c.setBrush( TQColorGroup::Button, + ceData.bgColor ); + TQRect button, menuarea; + button = visualRect( querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget), ceData, elementFlags ); + menuarea = visualRect( querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget), ceData, elementFlags ); + + SFlags bflags = flags, + mflags = flags; + + if (active & SC_ToolButton) + bflags |= Style_Down; + if (active & SC_ToolButtonMenu) + mflags |= Style_Down; + + if (controls & SC_ToolButton) { + if (bflags & (Style_Down | Style_On | Style_Raised)) { + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, c, bflags, opt); + } else if ( (elementFlags & CEF_HasParentWidget) && + ! ceData.parentWidgetData.bgPixmap.isNull() ) { + TQPixmap pixmap = + ceData.parentWidgetData.bgPixmap; + + p->drawTiledPixmap( r, pixmap, ceData.pos ); + } + } + + if (controls & SC_ToolButtonMenu) { + if (mflags & (Style_Down | Style_On | Style_Raised)) + drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, c, mflags, opt); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, c, mflags, opt); + } + + if ((elementFlags & CEF_HasFocus) && !(elementFlags & CEF_HasFocusProxy)) { + TQRect fr = ceData.rect; + fr.addCoords(3, 3, -3, -3); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, c); + } + + break; + } +#endif // TQT_NO_TOOLBUTTON + +#ifndef TQT_NO_TITLEBAR + case CC_TitleBar: + { + if ( controls & SC_TitleBarLabel ) { + TQColorGroup cgroup = (ceData.titleBarData.usesActiveColor) ? + ceData.palette.active() : ceData.palette.inactive(); + + TQColor left = cgroup.highlight(); + TQColor right = cgroup.base(); + + if ( left != right ) { + double rS = left.red(); + double gS = left.green(); + double bS = left.blue(); + + const double rD = double(right.red() - rS) / ceData.rect.width(); + const double gD = double(right.green() - gS) / ceData.rect.width(); + const double bD = double(right.blue() - bS) / ceData.rect.width(); + + const int w = ceData.rect.width(); + for ( int sx = 0; sx < w; sx++ ) { + rS+=rD; + gS+=gD; + bS+=bD; + p->setPen( TQColor( (int)rS, (int)gS, (int)bS ) ); + p->drawLine( sx, 0, sx, ceData.rect.height() ); + } + } else { + p->fillRect( ceData.rect, left ); + } + + TQRect ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarLabel, TQStyleOption::Default, widget ), ceData, elementFlags ); + + p->setPen( cgroup.highlightedText() ); + p->drawText(ir.x()+2, ir.y(), ir.width()-2, ir.height(), + AlignAuto | AlignVCenter | SingleLine, ceData.titleBarData.visibleText ); + } + + TQRect ir; + bool down = FALSE; + TQPixmap pm; + + if ( controls & SC_TitleBarCloseButton ) { + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarCloseButton, TQStyleOption::Default, widget ), ceData, elementFlags ); + down = active & SC_TitleBarCloseButton; + if ( widget->testWFlags( WStyle_Tool ) +#ifndef TQT_NO_MAINWINDOW + || ::tqt_cast(widget) +#endif + ) + pm = stylePixmap(SP_DockWindowCloseButton, ceData, elementFlags, TQStyleOption::Default, widget); + else + pm = stylePixmap(SP_TitleBarCloseButton, ceData, elementFlags, TQStyleOption::Default, widget); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, + down ? Style_Down : Style_Raised); + + p->save(); + if( down ) + p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); + drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); + p->restore(); + } + + if ( ceData.titleBarData.hasWindow ) { + if ( controls & SC_TitleBarMaxButton ) { + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarMaxButton, TQStyleOption::Default, widget ), ceData, elementFlags ); + + down = active & SC_TitleBarMaxButton; + pm = TQPixmap(stylePixmap(SP_TitleBarMaxButton, ceData, elementFlags, TQStyleOption::Default, widget)); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, + down ? Style_Down : Style_Raised); + + p->save(); + if( down ) + p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); + drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); + p->restore(); + } + + if ( controls & SC_TitleBarNormalButton || controls & SC_TitleBarMinButton ) { + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarMinButton, TQStyleOption::Default, widget ), ceData, elementFlags ); + TQStyle::SubControl ctrl = (controls & SC_TitleBarNormalButton ? + SC_TitleBarNormalButton : + SC_TitleBarMinButton); + TQStyle::StylePixmap spixmap = (controls & SC_TitleBarNormalButton ? + SP_TitleBarNormalButton : + SP_TitleBarMinButton); + down = active & ctrl; + pm = TQPixmap(stylePixmap(spixmap, ceData, elementFlags, TQStyleOption::Default, widget)); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, + down ? Style_Down : Style_Raised); + + p->save(); + if( down ) + p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); + drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); + p->restore(); + } + + if ( controls & SC_TitleBarShadeButton ) { + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarShadeButton, TQStyleOption::Default, widget ), ceData, elementFlags ); + + down = active & SC_TitleBarShadeButton; + pm = TQPixmap(stylePixmap(SP_TitleBarShadeButton, ceData, elementFlags, TQStyleOption::Default, widget)); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, + down ? Style_Down : Style_Raised); + p->save(); + if( down ) + p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); + drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); + p->restore(); + } + + if ( controls & SC_TitleBarUnshadeButton ) { + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarUnshadeButton, TQStyleOption::Default, widget ), ceData, elementFlags ); + + down = active & SC_TitleBarUnshadeButton; + pm = TQPixmap(stylePixmap(SP_TitleBarUnshadeButton, ceData, elementFlags, TQStyleOption::Default, widget)); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, ir, ceData.colorGroup, + down ? Style_Down : Style_Raised); + p->save(); + if( down ) + p->translate( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); + drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, &pm, TQString::null ); + p->restore(); + } + } +#ifndef TQT_NO_WIDGET_TOPEXTRA + if ( controls & SC_TitleBarSysMenu ) { + if ( !ceData.icon.isNull() ) { + ir = visualRect( querySubControlMetrics( CC_TitleBar, ceData, elementFlags, SC_TitleBarSysMenu, TQStyleOption::Default, widget ), ceData, elementFlags ); + drawItem( p, ir, AlignCenter, ceData.colorGroup, TRUE, (ceData.icon.isNull())?NULL:&ceData.icon, TQString::null ); + } + } +#endif + break; + } +#endif //TQT_NO_TITLEBAR + + case CC_SpinWidget: { +#ifndef TQT_NO_SPINWIDGET + SFlags flags; + PrimitiveElement pe; + + if ( controls & SC_SpinWidgetFrame ) + qDrawWinPanel( p, r, cg, TRUE ); //cstyle == Sunken ); + + if ( controls & SC_SpinWidgetUp ) { + flags = Style_Default | Style_Enabled; + if (active == SC_SpinWidgetUp ) { + flags |= Style_On; + flags |= Style_Sunken; + } else + flags |= Style_Raised; + if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus ) + pe = PE_SpinWidgetPlus; + else + pe = PE_SpinWidgetUp; + + TQRect re = ceData.spinWidgetData.upRect; + TQColorGroup ucg = ceData.spinWidgetData.upEnabled ? cg : ceData.palette.disabled(); + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, re, ucg, flags); + drawPrimitive(pe, p, ceData, elementFlags, re, ucg, flags); + } + + if ( controls & SC_SpinWidgetDown ) { + flags = Style_Default | Style_Enabled; + if (active == SC_SpinWidgetDown ) { + flags |= Style_On; + flags |= Style_Sunken; + } else + flags |= Style_Raised; + if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus ) + pe = PE_SpinWidgetMinus; + else + pe = PE_SpinWidgetDown; + + TQRect re = ceData.spinWidgetData.downRect; + TQColorGroup dcg = ceData.spinWidgetData.downEnabled ? cg : ceData.palette.disabled(); + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, re, dcg, flags); + drawPrimitive(pe, p, ceData, elementFlags, re, dcg, flags); + } +#endif + break; } + +#ifndef TQT_NO_SLIDER + case CC_Slider: + switch ( controls ) { + case SC_SliderTickmarks: { + int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); + int ticks = ceData.tickMarkSetting; + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); + int available = pixelMetric( PM_SliderSpaceAvailable, ceData, elementFlags, widget ); + int interval = ceData.tickInterval; + + if ( interval <= 0 ) { + interval = ceData.lineStep; + if ( qPositionFromValue( ceData, interval, available ) - + qPositionFromValue( ceData, 0, available ) < 3 ) + interval = ceData.pageStep; + } + + int fudge = len / 2; + int pos; + + if ( ticks & TQSlider::Above ) { + p->setPen( cg.foreground() ); + int v = ceData.minSteps; + if ( !interval ) + interval = 1; + while ( v <= ceData.maxSteps + 1 ) { + pos = qPositionFromValue( ceData, v, available ) + fudge; + if ( ceData.orientation == Horizontal ) + p->drawLine( pos, 0, pos, tickOffset-2 ); + else + p->drawLine( 0, pos, tickOffset-2, pos ); + v += interval; + } + } + + if ( ticks & TQSlider::Below ) { + p->setPen( cg.foreground() ); + int v = ceData.minSteps; + if ( !interval ) + interval = 1; + while ( v <= ceData.maxSteps + 1 ) { + pos = qPositionFromValue( ceData, v, available ) + fudge; + if ( ceData.orientation == Horizontal ) + p->drawLine( pos, tickOffset+thickness+1, pos, + tickOffset+thickness+1 + available-2 ); + else + p->drawLine( tickOffset+thickness+1, pos, + tickOffset+thickness+1 + available-2, + pos ); + v += interval; + } + + } + + break; } + } + break; +#endif // TQT_NO_SLIDER +#ifndef TQT_NO_LISTVIEW + case CC_ListView: + if ( controls & SC_ListView ) { + p->fillRect( r, ceData.viewportData.bgBrush ); + } + break; +#endif //TQT_NO_LISTVIEW + default: + break; + } + + activePainter = 0; +} + +/*! \reimp */ +void TQCommonStyle::drawComplexControlMask( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + const ControlElementFlags elementFlags, + const TQRect &r, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + Q_UNUSED(control); + Q_UNUSED(ceData); + Q_UNUSED(elementFlags); + Q_UNUSED(widget); + Q_UNUSED(opt); + + p->fillRect(r, color1); +} + +/*! \reimp */ +TQRect TQCommonStyle::querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sc, + const TQStyleOption &opt, + const TQWidget *widget ) const +{ + switch ( control ) { + case CC_SpinWidget: { + int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, widget); + TQSize bs; + bs.setHeight( ceData.rect.height()/2 - fw ); + if ( bs.height() < 8 ) + bs.setHeight( 8 ); + bs.setWidth( TQMIN( bs.height() * 8 / 5, ceData.rect.width() / 4 ) ); // 1.6 -approximate golden mean + bs = bs.expandedTo( TQApplication::globalStrut() ); + int y = fw; + int x, lx, rx; + x = ceData.rect.width() - y - bs.width(); + lx = fw; + rx = x - fw; + switch ( sc ) { + case SC_SpinWidgetUp: + return TQRect(x, y, bs.width(), bs.height()); + case SC_SpinWidgetDown: + return TQRect(x, y + bs.height(), bs.width(), bs.height()); + case SC_SpinWidgetButtonField: + return TQRect(x, y, bs.width(), ceData.rect.height() - 2*fw); + case SC_SpinWidgetEditField: + return TQRect(lx, fw, rx, ceData.rect.height() - 2*fw); + case SC_SpinWidgetFrame: + return ceData.rect; + default: + break; + } + break; } + + case CC_ComboBox: { + int x = 0, y = 0, wi = ceData.rect.width(), he = ceData.rect.height(); + int xpos = x; + xpos += wi - 2 - 16; + + switch ( sc ) { + case SC_ComboBoxFrame: + return ceData.rect; + case SC_ComboBoxArrow: + return TQRect(xpos, y+2, 16, he-4); + case SC_ComboBoxEditField: + return TQRect(x+3, y+3, wi-6-16, he-6); + case SC_ComboBoxListBoxPopup: + return opt.rect(); + default: + break; + } + break; } + +#ifndef TQT_NO_SCROLLBAR + case CC_ScrollBar: { + int sliderstart = 0; + int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); + int maxlen = ((ceData.orientation == TQt::Horizontal) ? + ceData.rect.width() : ceData.rect.height()) - (sbextent * 2); + int sliderlen; + + sliderstart = ceData.startStep; + + // calculate slider length + if (ceData.maxSteps != ceData.minSteps) { + uint range = ceData.maxSteps - ceData.minSteps; + sliderlen = (TQ_LLONG(ceData.pageStep) * maxlen) / (range + ceData.pageStep); + + int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget ); + if ( sliderlen < slidermin || range > INT_MAX / 2 ) + sliderlen = slidermin; + if ( sliderlen > maxlen ) + sliderlen = maxlen; + } else + sliderlen = maxlen; + + switch (sc) { + case SC_ScrollBarSubLine: // top/left button + if (ceData.orientation == TQt::Horizontal) { + int buttonWidth = TQMIN(ceData.rect.width()/2, sbextent); + return TQRect( 0, 0, buttonWidth, sbextent ); + } else { + int buttonHeight = TQMIN(ceData.rect.height()/2, sbextent); + return TQRect( 0, 0, sbextent, buttonHeight ); + } + + case SC_ScrollBarAddLine: // bottom/right button + if (ceData.orientation == TQt::Horizontal) { + int buttonWidth = TQMIN(ceData.rect.width()/2, sbextent); + return TQRect( ceData.rect.width() - buttonWidth, 0, buttonWidth, sbextent ); + } else { + int buttonHeight = TQMIN(ceData.rect.height()/2, sbextent); + return TQRect( 0, ceData.rect.height() - buttonHeight, sbextent, buttonHeight ); + } + + case SC_ScrollBarSubPage: // between top/left button and slider + if (ceData.orientation == TQt::Horizontal) + return TQRect(sbextent, 0, sliderstart - sbextent, sbextent); + return TQRect(0, sbextent, sbextent, sliderstart - sbextent); + + case SC_ScrollBarAddPage: // between bottom/right button and slider + if (ceData.orientation == TQt::Horizontal) + return TQRect(sliderstart + sliderlen, 0, + maxlen - sliderstart - sliderlen + sbextent, sbextent); + return TQRect(0, sliderstart + sliderlen, + sbextent, maxlen - sliderstart - sliderlen + sbextent); + + case SC_ScrollBarGroove: + if (ceData.orientation == TQt::Horizontal) + return TQRect(sbextent, 0, ceData.rect.width() - sbextent * 2, + ceData.rect.height()); + return TQRect(0, sbextent, ceData.rect.width(), + ceData.rect.height() - sbextent * 2); + + case SC_ScrollBarSlider: + if (ceData.orientation == TQt::Horizontal) + return TQRect(sliderstart, 0, sliderlen, sbextent); + return TQRect(0, sliderstart, sbextent, sliderlen); + + default: break; + } + + break; } +#endif // TQT_NO_SCROLLBAR + +#ifndef TQT_NO_SLIDER + case CC_Slider: { + int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + + switch ( sc ) { + case SC_SliderHandle: { + int sliderPos = 0; + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); + + sliderPos = ceData.startStep; + + if ( ceData.orientation == Horizontal ) + return TQRect( sliderPos, tickOffset, len, thickness ); + return TQRect( tickOffset, sliderPos, thickness, len ); } + case SC_SliderGroove: { + if ( ceData.orientation == Horizontal ) + return TQRect( 0, tickOffset, ceData.rect.width(), thickness ); + return TQRect( tickOffset, 0, thickness, ceData.rect.height() ); } + + default: + break; + } + break; } +#endif // TQT_NO_SLIDER + +#if !defined(TQT_NO_TOOLBUTTON) && !defined(TQT_NO_POPUPMENU) + case CC_ToolButton: { + int mbi = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags, widget); + + TQRect rect = ceData.rect; + switch (sc) { + case SC_ToolButton: + if ((elementFlags & CEF_HasPopupMenu) && ! ceData.popupDelay) + rect.addCoords(0, 0, -mbi, 0); + return rect; + + case SC_ToolButtonMenu: + if ((elementFlags & CEF_HasPopupMenu) && ! ceData.popupDelay) + rect.addCoords(rect.width() - mbi, 0, 0, 0); + return rect; + + default: break; + } + break; + } +#endif // TQT_NO_TOOLBUTTON && TQT_NO_POPUPMENU + +#ifndef TQT_NO_TITLEBAR + case CC_TitleBar: { + const int controlTop = 2; + const int controlHeight = ceData.rect.height() - controlTop * 2; + + switch (sc) { + case SC_TitleBarLabel: { + TQRect ir( 0, 0, ceData.rect.width(), ceData.rect.height() ); + if ( ceData.wflags & WStyle_Tool ) { + if ( ceData.wflags & WStyle_SysMenu ) + ir.addCoords( 0, 0, -controlHeight-3, 0 ); + if ( ceData.wflags & WStyle_MinMax ) + ir.addCoords( 0, 0, -controlHeight-2, 0 ); + } else { + if ( ceData.wflags & WStyle_SysMenu ) + ir.addCoords( controlHeight+3, 0, -controlHeight-3, 0 ); + if ( ceData.wflags & WStyle_Minimize ) + ir.addCoords( 0, 0, -controlHeight-2, 0 ); + if ( ceData.wflags & WStyle_Maximize ) + ir.addCoords( 0, 0, -controlHeight-2, 0 ); + } + return ir; } + + case SC_TitleBarCloseButton: + return TQRect( ceData.rect.width() - ( controlHeight + controlTop ), + controlTop, controlHeight, controlHeight ); + + case SC_TitleBarMaxButton: + case SC_TitleBarShadeButton: + case SC_TitleBarUnshadeButton: + return TQRect( ceData.rect.width() - ( ( controlHeight + controlTop ) * 2 ), + controlTop, controlHeight, controlHeight ); + + case SC_TitleBarMinButton: + case SC_TitleBarNormalButton: { + int offset = controlHeight + controlTop; + if ( !( ceData.wflags & WStyle_Maximize ) ) + offset *= 2; + else + offset *= 3; + return TQRect( ceData.rect.width() - offset, controlTop, controlHeight, controlHeight ); + } + + case SC_TitleBarSysMenu: + return TQRect( 3, controlTop, controlHeight, controlHeight); + + default: break; + } + break; } +#endif //TQT_NO_TITLEBAR + + default: + break; + } + return TQRect(); +} + +/*! \reimp */ +TQStyle::SubControl TQCommonStyle::querySubControl(ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQPoint &pos, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + SubControl ret = SC_None; + + switch (control) { +#ifndef TQT_NO_LISTVIEW + case CC_ListView: + { + if(pos.x() >= 0 && pos.x() < + opt.listViewItem()->listView()->treeStepSize()) + ret = SC_ListViewExpand; + break; + } +#endif +#ifndef TQT_NO_SCROLLBAR + case CC_ScrollBar: + { + TQRect r; + uint ctrl = SC_ScrollBarAddLine; + + // we can do this because subcontrols were designed to be masks as well... + while (ret == SC_None && ctrl <= SC_ScrollBarGroove) { + r = querySubControlMetrics(control, ceData, elementFlags, + (TQStyle::SubControl) ctrl, opt, widget); + if (r.isValid() && r.contains(pos)) + ret = (TQStyle::SubControl) ctrl; + + ctrl <<= 1; + } + + break; + } +#endif + case CC_TitleBar: + { +#ifndef TQT_NO_TITLEBAR + TQRect r; + uint ctrl = SC_TitleBarLabel; + + // we can do this because subcontrols were designed to be masks as well... + while (ret == SC_None && ctrl <= SC_TitleBarUnshadeButton) { + r = visualRect( querySubControlMetrics( control, ceData, elementFlags, (TQStyle::SubControl) ctrl, opt, widget ), ceData, elementFlags ); + if (r.isValid() && r.contains(pos)) + ret = (TQStyle::SubControl) ctrl; + + ctrl <<= 1; + } + if ( ceData.titleBarData.hasWindow ) { + if ( ceData.wflags & WStyle_Tool ) { + if ( ret == SC_TitleBarMinButton || ret == SC_TitleBarMaxButton ) { + if ( ceData.titleBarData.windowState & WindowMinimized ) + ret = SC_TitleBarUnshadeButton; + else + ret = SC_TitleBarShadeButton; + } + } else if ( ret == SC_TitleBarMinButton && (ceData.titleBarData.windowState & WindowMinimized) ) { + ret = TQStyle::SC_TitleBarNormalButton; + } + } +#endif + break; + } + + default: + break; + } + + return ret; +} + +/*! \reimp */ +int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const +{ + int ret; + + switch (m) { + case PM_DialogButtonsSeparator: + ret = 5; + break; + case PM_DialogButtonsButtonWidth: + ret = 70; + break; + case PM_DialogButtonsButtonHeight: + ret = 30; + break; + case PM_CheckListControllerSize: + case PM_CheckListButtonSize: + ret = 16; + break; + case PM_TitleBarHeight: { + if ( !(elementFlags & CEF_UseGenericParameters) ) { + if ( ceData.wflags & WStyle_Tool ) { + ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 16 ); +#ifndef TQT_NO_MAINWINDOW + } else if ( ceData.widgetObjectTypes.containsYesNo(TQDockWindow_static_string) ) { + ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 13 ); +#endif + } else { + ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 18 ); + } + } + else { + ret = 0; + } + break; } + case PM_ScrollBarSliderMin: + ret = 9; + break; + + case PM_ButtonMargin: + ret = 6; + break; + + case PM_ButtonDefaultIndicator: + ret = 0; + break; + + case PM_MenuButtonIndicator: + if ( elementFlags & CEF_UseGenericParameters ) + ret = 12; + else + ret = TQMAX(12, (ceData.rect.height() - 4) / 3); + break; + + case PM_ButtonShiftHorizontal: + case PM_ButtonShiftVertical: + ret = 0; + break; + + case PM_SpinBoxFrameWidth: + case PM_DefaultFrameWidth: + ret = 2; + break; + + case PM_MDIFrameWidth: + ret = 2; + break; + + case PM_MDIMinimizedWidth: + ret = 196; + break; + +#ifndef TQT_NO_SCROLLBAR + case PM_ScrollBarExtent: + if ( elementFlags & CEF_UseGenericParameters ) { + ret = 16; + } else { + int s = ceData.orientation == TQt::Horizontal ? + TQApplication::globalStrut().height() + : TQApplication::globalStrut().width(); + ret = TQMAX( 16, s ); + } + break; +#endif + case PM_MaximumDragDistance: + ret = -1; + break; + +#ifndef TQT_NO_SLIDER + case PM_SliderThickness: + ret = 16; + break; + + case PM_SliderTickmarkOffset: + { + if ( elementFlags & CEF_UseGenericParameters ) { + ret = 0; + break; + } + + int space = (ceData.orientation == Horizontal) ? ceData.rect.height() : + ceData.rect.width(); + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + int ticks = ceData.tickMarkSetting; + + if ( ticks == TQSlider::Both ) { + ret = (space - thickness) / 2; + } + else if ( ticks == TQSlider::Above ) { + ret = space - thickness; + } + else { + ret = 0; + } + break; + } + + case PM_SliderSpaceAvailable: + { + if ( ceData.orientation == Horizontal ) + ret = ceData.rect.width() - pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); + else + ret = ceData.rect.height() - pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); + break; + } +#endif // TQT_NO_SLIDER + + case PM_DockWindowSeparatorExtent: + ret = 6; + break; + + case PM_DockWindowHandleExtent: + ret = 8; + break; + + case PM_DockWindowFrameWidth: + ret = 1; + break; + + case PM_MenuBarFrameWidth: + ret = 2; + break; + + case PM_MenuBarItemSpacing: + case PM_ToolBarItemSpacing: + ret = 0; + break; + + case PM_TabBarTabOverlap: + ret = 3; + break; + + case PM_TabBarBaseHeight: + ret = 0; + break; + + case PM_TabBarBaseOverlap: + ret = 0; + break; + + case PM_TabBarTabHSpace: + ret = 24; + break; + + case PM_TabBarTabShiftHorizontal: + case PM_TabBarTabShiftVertical: + ret = 2; + break; + +#ifndef TQT_NO_TABBAR + case PM_TabBarTabVSpace: + { + if ( ceData.widgetObjectTypes.containsYesNo(TQTabBar_static_string) && ( ceData.tabBarData.shape == TQTabBar::RoundedAbove || + ceData.tabBarData.shape == TQTabBar::RoundedBelow ) ) + ret = 10; + else + ret = 0; + break; + } +#endif + + case PM_ProgressBarChunkWidth: + ret = 9; + break; + + case PM_IndicatorWidth: + ret = 13; + break; + + case PM_IndicatorHeight: + ret = 13; + break; + + case PM_ExclusiveIndicatorWidth: + ret = 12; + break; + + case PM_ExclusiveIndicatorHeight: + ret = 12; + break; + + case PM_PopupMenuFrameHorizontalExtra: + case PM_PopupMenuFrameVerticalExtra: + ret = 0; + break; + + case PM_HeaderMargin: + ret = 4; + break; + case PM_HeaderMarkSize: + ret = 32; + break; + case PM_HeaderGripMargin: + ret = 4; + break; + case PM_TabBarScrollButtonWidth: + ret = 16; + break; + case PM_ArrowSize: + ret = 7; + break; + default: + ret = 0; + break; + } + + return ret; +} + +/*! \reimp */ +TQSize TQCommonStyle::sizeFromContents(ContentsType contents, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &contentsSize, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + TQSize sz(contentsSize); + + switch (contents) { +#ifndef TQT_NO_DIALOGBUTTONS + case CT_DialogButtons: { + int w = contentsSize.width(), h = contentsSize.height(); + const int bwidth = pixelMetric(PM_DialogButtonsButtonWidth, ceData, elementFlags, widget), + bspace = pixelMetric(PM_DialogButtonsSeparator, ceData, elementFlags, widget), + bheight = pixelMetric(PM_DialogButtonsButtonHeight, ceData, elementFlags, widget); + if(ceData.orientation == Horizontal) { + if(!w) + w = bwidth; + } else { + if(!h) + h = bheight; + } + TQDialogButtons::Button btns[] = { TQDialogButtons::All, TQDialogButtons::Reject, TQDialogButtons::Accept, //reverse order (right to left) + TQDialogButtons::Apply, TQDialogButtons::Retry, TQDialogButtons::Ignore, TQDialogButtons::Abort, + TQDialogButtons::Help }; + for(unsigned int i = 0, cnt = 0; i < (sizeof(btns)/sizeof(btns[0])); i++) { + if (ceData.dlgVisibleButtons & btns[i]) { + TQSize szH = ceData.dlgVisibleSizeHints[btns[i]]; + int mwidth = TQMAX(bwidth, szH.width()), mheight = TQMAX(bheight, szH.height()); + if(ceData.orientation == Horizontal) + h = TQMAX(h, mheight); + else + w = TQMAX(w, mwidth); + + if(cnt) + w += bspace; + cnt++; + if(ceData.orientation == Horizontal) + w += mwidth; + else + h += mheight; + } + } + const int fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2; + sz = TQSize(w + fw, h + fw); + break; } +#endif //TQT_NO_DIALOGBUTTONS + case CT_PushButton: + { +#ifndef TQT_NO_PUSHBUTTON + int w = contentsSize.width(), + h = contentsSize.height(), + bm = pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget), + fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2; + + w += bm + fw; + h += bm + fw; + + if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { + int dbw = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget) * 2; + w += dbw; + h += dbw; + } + + sz = TQSize(w, h); +#endif + break; + } + + case CT_CheckBox: + { +#ifndef TQT_NO_CHECKBOX + TQRect irect = subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget); + int h = pixelMetric( PM_IndicatorHeight, ceData, elementFlags, widget ); + int margins = (ceData.fgPixmap.isNull() && ceData.text.isEmpty()) ? 0 : 10; + sz += TQSize(irect.right() + margins, 4 ); + sz.setHeight( TQMAX( sz.height(), h ) ); +#endif + break; + } + + case CT_RadioButton: + { +#ifndef TQT_NO_RADIOBUTTON + TQRect irect = subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget); + int h = pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags, widget ); + int margins = (ceData.fgPixmap.isNull() && ceData.text.isEmpty()) ? 0 : 10; + sz += TQSize(irect.right() + margins, 4 ); + sz.setHeight( TQMAX( sz.height(), h ) ); +#endif + break; + } + + case CT_ToolButton: + { + sz = TQSize(sz.width() + 6, sz.height() + 5); + break; + } + + case CT_ComboBox: + { + int dfw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2; + sz = TQSize(sz.width() + dfw + 21, sz.height() + dfw ); + break; + } + + case CT_PopupMenuItem: + { +#ifndef TQT_NO_POPUPMENU + if (opt.isDefault()) + break; + + bool checkable = (elementFlags & CEF_IsCheckable); + TQMenuItem *mi = opt.menuItem(); + int maxpmw = opt.maxIconWidth(); + int w = sz.width(), h = sz.height(); + + if (mi->custom()) { + w = mi->custom()->sizeHint().width(); + h = mi->custom()->sizeHint().height(); + if (! mi->custom()->fullSpan()) + h += 8; + } else if ( mi->widget() ) { + } else if (mi->isSeparator()) { + w = 10; + h = 2; + } else { + if (mi->pixmap()) + h = TQMAX(h, mi->pixmap()->height() + 4); + else + h = TQMAX(h, TQFontMetrics(ceData.font).height() + 8); + + if (mi->iconSet() != 0) + h = TQMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, + TQIconSet::Normal).height() + 4); + } + + if (! mi->text().isNull()) { + if (mi->text().find('\t') >= 0) + w += 12; + } + + if (maxpmw) + w += maxpmw + 6; + if (checkable && maxpmw < 20) + w += 20 - maxpmw; + if (checkable || maxpmw > 0) + w += 2; + w += 12; + + sz = TQSize(w, h); +#endif + break; + } + + case CT_LineEdit: + case CT_Header: + case CT_Slider: + case CT_ProgressBar: + // just return the contentsSize for now + // fall through intended + + default: + break; + } + + return sz; +} + +/*! \reimp */ +int TQCommonStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget * w) const +{ + Q_UNUSED(w); + + int ret; + + switch (sh) { +#ifndef TQT_NO_DIALOGBUTTONS + case SH_DialogButtons_DefaultButton: + ret = TQDialogButtons::Accept; + break; +#endif + case SH_GroupBox_TextLabelVerticalAlignment: + ret = TQt::AlignVCenter; + break; + + case SH_GroupBox_TextLabelColor: + ret = (int) ( (!(elementFlags & CEF_UseGenericParameters)) ? ceData.fgColor.rgb() : 0 ); + break; + + case SH_ListViewExpand_SelectMouseType: + case SH_TabBar_SelectMouseType: + ret = TQEvent::MouseButtonPress; + break; + + case SH_GUIStyle: + ret = WindowsStyle; + break; + + case SH_ScrollBar_BackgroundMode: + ret = TQWidget::PaletteBackground; + break; + + case SH_TabBar_Alignment: + case SH_Header_ArrowAlignment: + ret = TQt::AlignLeft; + break; + + case SH_PopupMenu_SubMenuPopupDelay: + ret = 256; + break; + + case SH_ProgressDialog_TextLabelAlignment: + ret = TQt::AlignCenter; + break; + + case SH_BlinkCursorWhenTextSelected: + ret = 1; + break; + + case SH_Table_GridLineColor: + ret = -1; + break; + + case SH_LineEdit_PasswordCharacter: + ret = '*'; + break; + + case SH_ToolBox_SelectedPageTitleBold: + ret = 1; + break; + + case SH_UnderlineAccelerator: + ret = 1; + break; + + case SH_ToolButton_Uses3D: + ret = 1; + break; + + case SH_HideUnderlineAcceleratorWhenAltUp: + ret = 0; + break; + + case SH_PopupMenu_SubMenuArrowColorActiveEnabled: + case SH_PopupMenu_SubMenuArrowColorActiveDisabled: + case SH_PopupMenu_SubMenuArrowColorInactiveEnabled: + case SH_PopupMenu_SubMenuArrowColorInactiveDisabled: + ret = -1; + break; + + default: + ret = 0; + break; + } + + return ret; +} + +/*! \reimp */ +TQPixmap TQCommonStyle::stylePixmap(StylePixmap, const TQStyleControlElementData&, ControlElementFlags, const TQStyleOption&, const TQWidget *) const +{ + return TQPixmap(); +} + +#endif // TQT_NO_STYLE diff --git a/src/styles/tqcommonstyle.h b/src/styles/tqcommonstyle.h new file mode 100644 index 000000000..705177d71 --- /dev/null +++ b/src/styles/tqcommonstyle.h @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Definition of TQCommonStyle class +** +** Created : 980616 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQCOMMONSTYLE_H +#define TQCOMMONSTYLE_H + +#ifndef QT_H +#include "tqstyle.h" +#endif // QT_H + +#ifndef TQT_NO_STYLE + +class TQ_EXPORT TQCommonStyle: public TQStyle +{ + TQ_OBJECT + +public: + TQCommonStyle(); + ~TQCommonStyle(); + + // New API + void drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default ) const; + + // New API + void drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + // New API + void drawControlMask( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + // New API + TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const; + + // New API + void drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how = Style_Default, +#ifdef Q_QDOC + SCFlags sub = SC_All, +#else + SCFlags sub = (uint)SC_All, +#endif + SCFlags subActive = SC_None, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + // New API + void drawComplexControlMask( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + const ControlElementFlags elementFlags, + const TQRect &r, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + // New API + TQRect querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sc, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + // New API + SubControl querySubControl( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQPoint &pos, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + // New API + int pixelMetric( PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; + + // New API + TQSize sizeFromContents( ContentsType s, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &contentsSize, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + // New API + int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget * w) const; + + // New API + TQPixmap stylePixmap( StylePixmap sp, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + +private: + // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQCommonStyle( const TQCommonStyle & ); + TQCommonStyle &operator=( const TQCommonStyle & ); +#endif +}; + +#endif // TQT_NO_STYLE + +#endif // TQCOMMONSTYLE_H diff --git a/src/styles/tqcompactstyle.cpp b/src/styles/tqcompactstyle.cpp new file mode 100644 index 000000000..b4c510229 --- /dev/null +++ b/src/styles/tqcompactstyle.cpp @@ -0,0 +1,395 @@ +/**************************************************************************** +** +** Implementation of compact style class +** +** Created : 006231 +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqcompactstyle.h" + +#if !defined(TQT_NO_STYLE_COMPACT) || defined(QT_PLUGIN) + +#include "tqfontmetrics.h" +#include "tqpalette.h" +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqmenudata.h" +#include "tqpopupmenu.h" + +TQCompactStyle::TQCompactStyle() +: TQWindowsStyle() +{ +} + +/*! \reimp */ +int TQCompactStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) +{ + int ret; + switch ( metric ) { + case PM_ButtonMargin: + ret = 2; + break; + // tws - I added this in to stop this "Windows Scroll behaivor." Remove it + // if you don't want it. + case PM_MaximumDragDistance: + ret = -1; + break; + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = 0; + break; + default: + ret = TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget ); + break; + } + return ret; +} + +static const int motifItemFrame = 0; // menu item frame width +static const int motifSepHeight = 2; // separator item height +static const int motifItemHMargin = 1; // menu item hor text margin +static const int motifItemVMargin = 2; // menu item ver text margin +static const int motifArrowHMargin = 0; // arrow horizontal margin +static const int motifTabSpacing = 4; // space between text and tab +static const int motifCheckMarkHMargin = 1; // horiz. margins of check mark +static const int windowsRightBorder = 8; // right border on windows +static const int windowsCheckMarkWidth = 2; // checkmarks width on windows + +#if 0 +static int extraPopupMenuItemWidth( bool checkable, int maxpmw, TQMenuItem* mi, const TQFontMetrics& /*fm*/ ) +{ + int w = 2*motifItemHMargin + 2*motifItemFrame; // a little bit of border can never harm + + if ( mi->isSeparator() ) + return 10; // arbitrary + else if ( mi->pixmap() ) + w += mi->pixmap()->width(); // pixmap only + + if ( !mi->text().isNull() ) { + if ( mi->text().find('\t') >= 0 ) // string contains tab + w += motifTabSpacing; + } + + if ( maxpmw ) { // we have iconsets + w += maxpmw; + w += 6; // add a little extra border around the iconset + } + + if ( checkable && maxpmw < windowsCheckMarkWidth ) { + w += windowsCheckMarkWidth - maxpmw; // space for the checkmarks + } + + if ( maxpmw > 0 || checkable ) // we have a check-column ( iconsets or checkmarks) + w += motifCheckMarkHMargin; // add space to separate the columns + + w += windowsRightBorder; // windows has a strange wide border on the right side + + return w; +} + +static int popupMenuItemHeight( bool /*checkable*/, TQMenuItem* mi, const TQFontMetrics& fm ) +{ + int h = 0; + if ( mi->isSeparator() ) // separator height + h = motifSepHeight; + else if ( mi->pixmap() ) // pixmap height + h = mi->pixmap()->height() + 2*motifItemFrame; + else // text height + h = fm.height() + 2*motifItemVMargin + 2*motifItemFrame - 1; + + if ( !mi->isSeparator() && mi->iconSet() != 0 ) { + h = TQMAX( h, mi->iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).height() + 2*motifItemFrame ); + } + if ( mi->custom() ) + h = TQMAX( h, mi->custom()->sizeHint().height() + 2*motifItemVMargin + 2*motifItemFrame ) - 1; + return h; +} +#endif + +void drawPopupMenuItem( TQPainter*, bool, + int, int, TQMenuItem*, + const TQPalette&, bool, + bool, + int, int, int, int) +{ + +} + +/*! \reimp */ +void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, + const TQColorGroup &g, SFlags flags, const TQStyleOption& opt, const TQWidget *widget ) +{ + switch ( element ) { + case CE_PopupMenuItem: + { + if ( (elementFlags & CEF_UseGenericParameters) || opt.isDefault()) + break; + + TQMenuItem *mi = opt.menuItem(); + if ( !mi ) + break; + + int tab = opt.tabWidth(); + int maxpmw = opt.maxIconWidth(); + bool dis = !(flags & Style_Enabled); + bool checkable = (elementFlags & CEF_IsCheckable); + bool act = flags & Style_Active; + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + + TQColorGroup itemg = g; + + if ( checkable ) + maxpmw = TQMAX( maxpmw, 8 ); // space for the checkmarks + + int checkcol = maxpmw; + + if ( mi && mi->isSeparator() ) { // draw separator + p->setPen( g.dark() ); + p->drawLine( x, y, x+w, y ); + p->setPen( g.light() ); + p->drawLine( x, y+1, x+w, y+1 ); + return; + } + + TQBrush fill = act? g.brush( TQColorGroup::Highlight ) : + g.brush( TQColorGroup::Button ); + p->fillRect( x, y, w, h, fill); + + if ( !mi ) + return; + + if ( mi->isChecked() ) { + drawPrimitive( PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, itemg, flags, opt ); + } else if ( !act ) { + p->fillRect(x, y, checkcol , h, + g.brush( TQColorGroup::Button )); + } + + if ( mi->iconSet() ) { // draw iconset + TQIconSet::Mode mode = dis ? TQIconSet::Disabled : TQIconSet::Normal; + if (act && !dis ) + mode = TQIconSet::Active; + TQPixmap pixmap; + if ( checkable && mi->isChecked() ) + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); + else + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); + int pixw = pixmap.width(); + int pixh = pixmap.height(); + if ( act && !dis ) { + if ( !mi->isChecked() ) + drawPrimitive( PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, itemg, flags, opt ); + } + TQRect cr( x, y, checkcol, h ); + TQRect pmr( 0, 0, pixw, pixh ); + pmr.moveCenter( cr.center() ); + p->setPen( itemg.text() ); + p->drawPixmap( pmr.topLeft(), pixmap ); + + TQBrush fill = act? g.brush( TQColorGroup::Highlight ) : + g.brush( TQColorGroup::Button ); + p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill); + } else if ( checkable ) { // just "checking"... + if ( mi->isChecked() ) { + drawPrimitive( PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, itemg, flags, opt ); + } + } + + p->setPen( act ? g.highlightedText() : g.buttonText() ); + + TQColor discol; + if ( dis ) { + discol = itemg.text(); + p->setPen( discol ); + } + + int xm = motifItemFrame + checkcol + motifItemHMargin; + + if ( mi->custom() ) { + int m = motifItemVMargin; + p->save(); + if ( dis && !act ) { + p->setPen( g.light() ); + mi->custom()->paint( p, itemg, act, !dis, + x+xm+1, y+m+1, w-xm-tab+1, h-2*m ); + p->setPen( discol ); + } + mi->custom()->paint( p, itemg, act, !dis, + x+xm, y+m, w-xm-tab+1, h-2*m ); + p->restore(); + } + TQString s = mi->text(); + if ( !s.isNull() ) { // draw text + int t = s.find( '\t' ); + int m = motifItemVMargin; + const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; + if ( t >= 0 ) { // draw tab text + if ( dis && !act ) { + p->setPen( g.light() ); + p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1, + y+m+1, tab, h-2*m, text_flags, s.mid( t+1 )); + p->setPen( discol ); + } + p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame, + y+m, tab, h-2*m, text_flags, s.mid( t+1 ) ); + s = s.left( t ); + } + if ( dis && !act ) { + p->setPen( g.light() ); + p->drawText( x+xm+1, y+m+1, w-xm+1, h-2*m, text_flags, s, t ); + p->setPen( discol ); + } + p->drawText( x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t ); + } else if ( mi->pixmap() ) { // draw pixmap + TQPixmap *pixmap = mi->pixmap(); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( OpaqueMode ); + p->drawPixmap( x+xm, y+motifItemFrame, *pixmap ); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( TransparentMode ); + } + if ( mi->popup() ) { // draw sub menu arrow + int dim = (h-2*motifItemFrame) / 2; + if ( act ) { + if ( !dis ) + discol = white; + TQColorGroup g2( discol, g.highlight(), + white, white, + dis ? discol : white, + discol, white ); + drawPrimitive(PE_ArrowRight, p, ceData, elementFlags, TQRect(x+w - motifArrowHMargin - motifItemFrame - dim, y + h / 2 - dim / 2, dim, dim), + g2, Style_Enabled); + } else { + drawPrimitive(PE_ArrowRight, p, ceData, elementFlags, TQRect(x+w - motifArrowHMargin - motifItemFrame - dim, y + h / 2 - dim / 2, dim, dim), + g, !dis ? Style_Enabled : Style_Default); + } + } + } + break; + + default: + TQWindowsStyle::drawControl( element, p, ceData, elementFlags, r, g, flags, opt, widget ); + break; + } +} + +/*! \reimp */ +void TQCompactStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + bool dis = !(flags & Style_Enabled); + bool act = flags & Style_Active; + + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + + switch (pe) { + case PE_MenuItemIndicatorFrame: + { + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + if ( act && !dis ) { + qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); + } else { + qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) ); + } + } + break; + case PE_MenuItemIndicatorIconFrame: + { + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + qDrawShadePanel( p, x, y, checkcol, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) ); + } + break; + case PE_MenuItemIndicatorCheck: + { + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + int mw = checkcol + motifItemFrame; + int mh = h - 2*motifItemFrame; + + SFlags cflags = Style_Default; + if (! dis) { + cflags |= Style_Enabled; + } + if (act) { + cflags |= Style_On; + } + + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect(x + motifItemFrame + 2, y + motifItemFrame, mw, mh), cg, cflags, opt ); + } + break; + default: + break; + } +} + +/*! \reimp */ +int TQCompactStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const +{ + int ret; + + switch (sh) { + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = (elementFlags & CEF_IsCheckable); + + if ( checkable ) + maxpmw = TQMAX( maxpmw, 8 ); // space for the checkmarks + + ret = maxpmw; + } + break; + default: + ret = TQWindowsStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); + break; + } + + return ret; +} + +#endif diff --git a/src/styles/tqcompactstyle.h b/src/styles/tqcompactstyle.h new file mode 100644 index 000000000..a8b93f092 --- /dev/null +++ b/src/styles/tqcompactstyle.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Definition of compact style class, good for small displays +** +** Created : 000623 +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQCOMPACTSTYLE_H +#define TQCOMPACTSTYLE_H + +#ifndef QT_H +#include "tqwindowsstyle.h" +#endif // QT_H + +#if !defined(TQT_NO_STYLE_COMPACT) || defined(QT_PLUGIN) + +#if defined(QT_PLUGIN) +#define Q_EXPORT_STYLE_COMPACT +#else +#define Q_EXPORT_STYLE_COMPACT TQ_EXPORT +#endif + +class Q_EXPORT_STYLE_COMPACT TQCompactStyle : public TQWindowsStyle +{ +public: + TQCompactStyle(); + + int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ); + + void drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default ) const; + + void drawControl( ControlElement element, TQPainter *p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, + const TQColorGroup &cg, SFlags how = Style_Default, const TQStyleOption& = TQStyleOption::Default, const TQWidget *w = 0 ); + + int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget *) const; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQCompactStyle( const TQCompactStyle & ); + TQCompactStyle& operator=( const TQCompactStyle & ); +#endif +}; + +#endif // TQT_NO_STYLE_WINDOWS + +#endif // TQCOMPACTSTYLE_H diff --git a/src/styles/tqinterlacestyle.cpp b/src/styles/tqinterlacestyle.cpp new file mode 100644 index 000000000..c0a84c7ae --- /dev/null +++ b/src/styles/tqinterlacestyle.cpp @@ -0,0 +1,805 @@ +/**************************************************************************** +** +** Implementation of TQInterlaceStyle class +** +** Created : 010122 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#if 0 // ###### not ported to new API yet + +#include "tqinterlacestyle.h" + +#if !defined(TQT_NO_STYLE_INTERLACE) || defined(QT_PLUGIN) + +#include "ntqapplication.h" +#include "tqpainter.h" +#include "ntqdrawutil.h" // for now +#include "tqpalette.h" // for now +#include "tqwidget.h" +#include "tqlabel.h" +#include "tqpushbutton.h" +#include "tqwidget.h" +#include "ntqrangecontrol.h" +#include "tqscrollbar.h" +#include "tqlistbox.h" + +#include + +/*! + \class TQInterlaceStyle tqinterlacestyle.h + \brief The TQInterlaceStyle class provides a Look and Feel suitable for interlaced displays. + \ingroup appearance + + This class implements a look and feel that reduces flicker as much as + possible on interlaced displays (i.e. television). It is an experimental + style. In addition to using this style you will need to select a font + that does not flicker. +*/ + +/*! + Constructs a TQInterlaceStyle +*/ +TQInterlaceStyle::TQInterlaceStyle() : TQMotifStyle() +{ + setUseHighlightColors( TRUE ); +} + +/*! \reimp +*/ +int TQInterlaceStyle::buttonDefaultIndicatorWidth() const +{ + return 0; +} + +/*! \reimp +*/ +int TQInterlaceStyle::setSliderThickness() const +{ + return 18; +} + +/*! \reimp +*/ +TQSize TQInterlaceStyle::scrollBarExtent() const +{ + return TQSize( 18, 18 ); +} + +/*! \reimp +*/ +int TQInterlaceStyle::defaultFrameWidth() const +{ + return 2; +} + +/*! + \reimp + */ +void TQInterlaceStyle::polish( TQApplication *app) +{ + oldPalette = app->palette(); +#if 0 + TQColor bg( 128, 64, 128 ); + TQColor btn( 255, 145, 0 ); + TQColor mid = bg.dark( 120 ); + TQColor low = mid.dark( 120 ); + TQColor fg( white ); +#else + TQColor bg( 224, 224, 224 ); + TQColor btn = bg.dark( 105 ); + TQColor mid = bg.dark( 120 ); + TQColor low = mid.dark( 120 ); + TQColor fg( black ); +#endif + + TQColorGroup cg( fg, btn, low, low, mid, black, black, white, bg ); + cg.setColor( TQColorGroup::Highlight, TQColor( 255, 255, 192 ) ); + cg.setColor( TQColorGroup::HighlightedText, black ); + + TQColorGroup dcg( cg ); + dcg.setColor( TQColorGroup::ButtonText, low ); + dcg.setColor( TQColorGroup::Text, low ); + + app->setPalette( TQPalette( cg, dcg, cg ), TRUE ); +} + +/*! + \reimp + */ +void TQInterlaceStyle::unPolish( TQApplication *app) +{ + app->setPalette(oldPalette, TRUE); +} + +/*! + \reimp + */ +void TQInterlaceStyle::polish( TQWidget* w) +{ + + // the polish function sets some widgets to transparent mode and + // some to translate background mode in order to get the full + // benefit from the nice pixmaps in the color group. + + if ( w->inherits("TQLCDNumber") ){ + return; + } + + if ( !w->isTopLevel() ) { + if ( w->inherits("TQGroupBox") + || w->inherits("TQTabWidget") + || w->inherits("TQPushButton") ) { + w->setAutoMask( TRUE ); + return; + } + if (w->inherits("TQLabel") + || w->inherits("TQSlider") + || w->inherits("TQButton") + || w->inherits("TQProgressBar") + ){ + w->setBackgroundOrigin( TQWidget::ParentOrigin ); + } + } + + if ( w->inherits( "TQFrame" ) ) { + TQFrame *f = (TQFrame *)w; + switch ( f->frameShape() ) { + case TQFrame::WinPanel: + f->setFrameShape( TQFrame::StyledPanel ); + + case TQFrame::Panel: + case TQFrame::Box: + case TQFrame::StyledPanel: + case TQFrame::PopupPanel: + if ( f->frameWidth() == 1 ) + f->setLineWidth( 2 ); + break; + default: + break; + } + } + + if ( w->inherits( "TQListBox" ) ) { + // the list box in combos has an ugly border otherwise + TQFrame *f = (TQFrame *)w; + if ( f->frameShadow() == TQFrame::Plain ) { + f->setFrameShadow( TQFrame::Raised ); + f->setLineWidth( 1 ); + } + } +} + +/*! + \reimp +*/ +void TQInterlaceStyle::unPolish( TQWidget* w) +{ + + // the polish function sets some widgets to transparent mode and + // some to translate background mode in order to get the full + // benefit from the nice pixmaps in the color group. + + if ( w->inherits("TQLCDNumber") ){ + return; + } + + if ( !w->isTopLevel() ) { + if ( w->inherits("TQGroupBox") + || w->inherits("TQTabWidget") + || w->inherits("TQPushButton" ) ) { + w->setAutoMask( FALSE ); + return; + } + if (w->inherits("TQLabel") + || w->inherits("TQSlider") + || w->inherits("TQButton") + || w->inherits("TQProgressBar") + ){ + w->setBackgroundOrigin( TQWidget::WidgetOrigin ); + } + } + +} + +/*! + \reimp +*/ +TQRect TQInterlaceStyle::pushButtonContentsRect( TQPushButton *btn ) +{ + int fw = 0; + if ( btn->isDefault() || btn->autoDefault() ) + fw = buttonDefaultIndicatorWidth(); + + return buttonRect( fw+5, fw, btn->width()-2*fw-10, btn->height()-2*fw ); +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawFocusRect ( TQPainter *p, const TQRect &/*r*/, const TQColorGroup &g, const TQColor * bg, bool /*atBorder*/ ) +{ + if (bg ) { + int h,s,v; + bg->hsv(&h,&s,&v); + if (v >= 128) + p->setPen( TQt::black ); + else + p->setPen( TQt::white ); + } + else + p->setPen( g.foreground() ); +/* + p->setBrush( NoBrush ); + if ( atBorder ) { + p->drawRect( TQRect( r.x()+1, r.y()+2, r.width()-2, r.height()-4 ) ); + p->drawRect( TQRect( r.x()+2, r.y()+1, r.width()-4, r.height()-2 ) ); + } else { + p->drawRect( TQRect( r.x(), r.y()+1, r.width(), r.height()-2 ) ); + p->drawRect( TQRect( r.x()+1, r.y(), r.width()-2, r.height() ) ); + } +*/ +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawButton( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &g, bool /* sunken */, + const TQBrush *fill ) +{ + const int lineWidth = 2; + + p->setBrush( g.brush( TQColorGroup::Dark ) ); + p->setPen( NoPen ); + p->drawRect( x+1, y+1, 2, 2 ); + p->drawRect( x+w-3, y+1, 2, 2 ); + p->drawRect( x+1, y+h-3, 2, 2 ); + p->drawRect( x+w-3, y+h-3, 2, 2 ); + + p->drawRect( x+2, y, w-4, 2 ); + p->drawRect( x+2, y+h-lineWidth, w-4, lineWidth ); + p->drawRect( x, y+2, lineWidth, h-4 ); + p->drawRect( x+w-lineWidth, y+2, lineWidth, h-4 ); + + if ( fill ) { + x += 2; + y += 2; + w -= 4; + h -= 4; + p->setBrush( *fill ); + p->setPen( NoPen ); + p->drawRect( x+1, y, w-2, 1 ); + p->drawRect( x, y+1, w, h-2 ); + p->drawRect( x+1, y+h-1, w-2, 1 ); + } +} + +/*! \reimp */ +void TQInterlaceStyle::drawButtonMask( TQPainter * p, int x, int y, int w, int h ) +{ + TQBrush fill( color1 ); + TQColorGroup cg; + cg.setBrush( TQColorGroup::Dark, color1 ); + drawButton( p, x, y, w, h, cg, FALSE, &fill ); +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawBevelButton( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &g, bool sunken, const TQBrush* fill ) +{ + TQInterlaceStyle::drawButton(p, x, y, w, h, g, sunken, fill); +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawPushButton( TQPushButton* btn, TQPainter *p) +{ + TQColorGroup g = btn->colorGroup(); + int x1, y1, x2, y2; + + btn->rect().coords( &x1, &y1, &x2, &y2 ); // get coordinates + + TQBrush fill( g.button() ); + if ( btn->isDown() || btn->isOn() ) + fill = g.mid(); + + if ( btn->hasFocus() ) + g.setBrush( TQColorGroup::Dark, black ); + drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, FALSE, &fill ); + + if ( btn->isMenuButton() ) { + int dx = (y1-y2-4)/3; + drawArrow( p, DownArrow, FALSE, + x2 - dx, dx, y1, y2 - y1, + g, btn->isEnabled() ); + } + + if ( p->brush().style() != NoBrush ) + p->setBrush( NoBrush ); +} + +/*! + \reimp +*/ +TQSize TQInterlaceStyle::indicatorSize () const +{ + return TQSize(13,13); +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawIndicator( TQPainter * p, int x, int y, int w, int h, const TQColorGroup &g, int s, bool down, bool enabled ) +{ + p->fillRect( x, y, w, h, g.brush( TQColorGroup::Background ) ); + TQBrush fill; + if ( s == TQButton::NoChange ) { + TQBrush b = p->brush(); + TQColor c = p->backgroundColor(); + p->setBackgroundMode( TransparentMode ); + p->setBackgroundColor( green ); + fill = TQBrush(g.base(), Dense4Pattern); + p->setBackgroundColor( c ); + p->setBrush( b ); + } else if ( down ) + fill = g.brush( TQColorGroup::Button ); + else + fill = g.brush( enabled ? TQColorGroup::Base : TQColorGroup::Background ); + + drawButton( p, x, y, w, h, g, FALSE, &fill ); + + if ( s != TQButton::Off ) { + TQPointArray a( 7*2 ); + int i, xx, yy; + xx = x+3; + yy = y+5; + for ( i=0; i<3; i++ ) { + a.setPoint( 2*i, xx, yy ); + a.setPoint( 2*i+1, xx, yy+2 ); + xx++; yy++; + } + yy -= 2; + for ( i=3; i<7; i++ ) { + a.setPoint( 2*i, xx, yy ); + a.setPoint( 2*i+1, xx, yy+2 ); + xx++; yy--; + } + if ( s == TQButton::NoChange ) { + p->setPen( g.dark() ); + } else { + p->setPen( g.text() ); + } + p->drawLineSegments( a ); + } +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawIndicatorMask( TQPainter *p, int x, int y, int w, int h, int ) +{ + drawButtonMask( p, x, y, w, h ); +} + +/*! + \reimp +*/ +TQSize TQInterlaceStyle::exclusiveIndicatorSize() const +{ + return TQSize(13,13); +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawExclusiveIndicator( TQPainter *p, int x, int y, int w, int h, const TQColorGroup &g, bool on, bool down, bool enabled ) +{ + p->fillRect( x, y, w, h, g.brush( TQColorGroup::Background ) ); + p->setBrush( g.dark() ); + p->setPen( TQPen( NoPen ) ); + p->drawEllipse( x, y, w, h ); + + x += 2; + y += 2; + w -= 4; + h -= 4; + TQColor fillColor = ( down || !enabled ) ? g.button() : g.base(); + p->setBrush( fillColor ); + p->drawEllipse( x, y, w, h ); + + if ( on ) { + p->setBrush( g.text() ); + p->drawEllipse( x+2, y+2, w-4, h-4 ); + } +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawExclusiveIndicatorMask( TQPainter *p, int x, int y, int w, int h, bool ) +{ + p->setBrush( color1 ); + p->setPen( TQPen( NoPen ) ); + p->drawEllipse( x, y, w, h ); +} + +static int get_combo_extra_width( int h, int *return_awh=0 ) +{ + int awh; + if ( h < 8 ) { + awh = 6; + } else if ( h < 14 ) { + awh = h - 2; + } else { + awh = h/2; + } + if ( return_awh ) + *return_awh = awh; + return awh*3/2; +} + +/*! + \reimp +*/ +TQRect TQInterlaceStyle::comboButtonRect ( int x, int y, int w, int h ) +{ + TQRect r = buttonRect( x, y, w, h ); + int ew = get_combo_extra_width( r.height() ); + return TQRect(r.x(), r.y(), r.width()-ew, r.height()); +} + +static void get_combo_parameters( const TQRect &r, + int &ew, int &awh, int &ax, + int &ay, int &sh, int &dh, + int &sy ) +{ + ew = get_combo_extra_width( r.height(), &awh ); + + sh = (awh+3)/4; + if ( sh < 3 ) + sh = 3; + dh = sh/2 + 1; + + ay = r.y() + (r.height()-awh-sh-dh)/2; + if ( ay < 0 ) { + //panic mode + ay = 0; + sy = r.height(); + } else { + sy = ay+awh+dh; + } + ax = r.x() + r.width() - ew +(ew-awh)/2; +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawComboButton( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &g, + bool /* sunken */, + bool /*editable*/, + bool /*enabled */, + const TQBrush *fb ) +{ + TQBrush fill = fb ? *fb : g.brush( TQColorGroup::Button ); + + int awh, ax, ay, sh, sy, dh, ew; + get_combo_parameters( buttonRect(x,y,w,h), ew, awh, ax, ay, sh, dh, sy ); + + drawButton( p, x, y, w, h, g, FALSE, &fill ); + + qDrawArrow( p, DownArrow, MotifStyle, FALSE, ax, ay, awh, awh, g, TRUE ); + + p->setPen( g.dark() ); + p->drawRect( ax+1, sy+1, awh-1, sh-1 ); +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawPushButtonLabel( TQPushButton* btn, TQPainter *p) +{ + TQRect r = btn->rect(); + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + + int x1, y1, x2, y2; + btn->rect().coords( &x1, &y1, &x2, &y2 ); // get coordinates + int dx = 0; + int dy = 0; + if ( btn->isMenuButton() ) + dx = (y2-y1) / 3; + if ( btn->isOn() || btn->isDown() ) { +// dx--; +// dy--; + } + if ( dx || dy ) + p->translate( dx, dy ); + + x += 2; y += 2; w -= 4; h -= 4; + TQColorGroup g = btn->colorGroup(); + const TQColor *col = &btn->colorGroup().buttonText(); + if ( (btn->isDown() || btn->isOn()) ) + col = &btn->colorGroup().brightText(); + else if ( !btn->isEnabled() ) + col = &btn->colorGroup().dark(); + drawItem( p, x, y, w, h, + AlignCenter|ShowPrefix, + g, btn->isEnabled(), + btn->pixmap(), btn->text(), -1, col ); + + if ( dx || dy ) + p->translate( -dx, -dy ); +} + +#define HORIZONTAL (sb->orientation() == TQScrollBar::Horizontal) +#define VERTICAL !HORIZONTAL +#define MOTIF_BORDER defaultFrameWidth() +#define SLIDER_MIN 9 // ### motif says 6 but that's too small + + +/*! \reimp */ + +void TQInterlaceStyle::scrollBarMetrics( const TQScrollBar* sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim ) +{ + int maxLength; + int b = MOTIF_BORDER; + int length = HORIZONTAL ? sb->width() : sb->height(); + int extent = HORIZONTAL ? sb->height() : sb->width(); + + if ( length > ( extent - b*2 - 1 )*2 + b*2 ) + buttonDim = extent - b*2; + else + buttonDim = ( length - b*2 )/2 - 1; + + sliderMin = b + buttonDim; + maxLength = length - b*2 - buttonDim*2; + + if ( sb->maxValue() == sb->minValue() ) { + sliderLength = maxLength; + } else { + uint range = sb->maxValue()-sb->minValue(); + sliderLength = (sb->pageStep()*maxLength)/ + (range + sb->pageStep()); + if ( sliderLength < SLIDER_MIN || range > INT_MAX/2 ) + sliderLength = SLIDER_MIN; + if ( sliderLength > maxLength ) + sliderLength = maxLength; + } + sliderMax = sliderMin + maxLength - sliderLength; + +} + + +/*! \reimp */ + +void TQInterlaceStyle::drawScrollBarControls( TQPainter* p, const TQScrollBar* sb, + int sliderStart, uint controls, + uint activeControl ) +{ +#define ADD_LINE_ACTIVE ( activeControl == AddLine ) +#define SUB_LINE_ACTIVE ( activeControl == SubLine ) + TQColorGroup g = sb->colorGroup(); + + int sliderMin, sliderMax, sliderLength, buttonDim; + scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); + + TQBrush fill = g.brush( TQColorGroup::Mid ); + if (sb->backgroundPixmap() ){ + fill = TQBrush( g.mid(), *sb->backgroundPixmap() ); + } + + if ( controls == (AddLine | SubLine | AddPage | SubPage | Slider | First | Last ) ) + drawPanel( p, 0, 0, sb->width(), sb->height(), g, FALSE, 2, &fill ); + + if (sliderStart > sliderMax) { // sanity check + sliderStart = sliderMax; + } + + int b = MOTIF_BORDER; + int dimB = buttonDim; + TQRect addB; + TQRect subB; + TQRect addPageR; + TQRect subPageR; + TQRect sliderR; + int addX, addY, subX, subY; + int length = HORIZONTAL ? sb->width() : sb->height(); + int extent = HORIZONTAL ? sb->height() : sb->width(); + + if ( HORIZONTAL ) { + subY = addY = ( extent - dimB ) / 2; + subX = b; + addX = length - dimB - b; + } else { + subX = addX = ( extent - dimB ) / 2; + subY = b; + addY = length - dimB - b; + } + + subB.setRect( subX,subY,dimB,dimB ); + addB.setRect( addX,addY,dimB,dimB ); + + int sliderEnd = sliderStart + sliderLength; + int sliderW = extent - b*2; + if ( HORIZONTAL ) { + subPageR.setRect( subB.right() + 1, b, + sliderStart - subB.right() , sliderW ); + addPageR.setRect( sliderEnd-1, b, addX - sliderEnd+1, sliderW ); + sliderR .setRect( sliderStart, b, sliderLength, sliderW ); + } else { + subPageR.setRect( b, subB.bottom()+1, sliderW, + sliderStart - subB.bottom() ); + addPageR.setRect( b, sliderEnd-1, sliderW, addY - sliderEnd + 1); + sliderR .setRect( b, sliderStart, sliderW, sliderLength ); + } + + if ( controls & AddLine ) + drawArrow( p, VERTICAL ? DownArrow : RightArrow, + ADD_LINE_ACTIVE, addB.x(), addB.y(), + addB.width(), addB.height(), g, TRUE ); + if ( controls & SubLine ) + drawArrow( p, VERTICAL ? UpArrow : LeftArrow, + SUB_LINE_ACTIVE, subB.x(), subB.y(), + subB.width(), subB.height(), g, TRUE ); + + if ( controls & SubPage ) + p->fillRect( subPageR, fill ); + + if ( controls & AddPage ) + p->fillRect( addPageR, fill ); + + if ( controls & Slider ) { + TQPoint bo = p->brushOrigin(); + p->setBrushOrigin(sliderR.topLeft()); + if ( sliderR.isValid() ) + drawButton( p, sliderR.x(), sliderR.y(), + sliderR.width(), sliderR.height(), g, + FALSE, &g.brush( TQColorGroup::Button ) ); + p->setBrushOrigin(bo); + } + +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawSlider ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, Orientation orient, bool, bool) +{ + p->fillRect( x, y, w, h, g.brush( TQColorGroup::Background ) ); + drawButton( p, x, y, w, h, g, FALSE, &g.brush( TQColorGroup::Button ) ); + if ( orient == Horizontal ) { + TQCOORD mid = x + w / 2; + qDrawShadeLine( p, mid, y , mid, y + h - 2, g, TRUE, 1); + } else { + TQCOORD mid = y +h / 2; + qDrawShadeLine( p, x, mid, x + w - 2, mid, g, TRUE, 1); + } +} + + +/*! + \reimp +*/ +void TQInterlaceStyle::drawSliderGroove ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, TQCOORD , Orientation o) +{ + p->setBrush( g.brush( TQColorGroup::Dark ) ); + p->setPen( NoPen ); + + if ( o == Horizontal ) + drawButton( p, x, y+h/2-3, w, 6, g, FALSE, &g.brush( TQColorGroup::Mid ) ); + else + drawButton( p, x+w/2-3, y, 6, h, g, FALSE, &g.brush( TQColorGroup::Mid ) ); +} + + +/*! + \reimp +*/ +int TQInterlaceStyle::splitterWidth() const +{ + return TQMAX( 12, TQApplication::globalStrut().width() ); +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawSplitter( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &g, Orientation orient) +{ + const int motifOffset = 12; + int sw = splitterWidth(); + if ( orient == Horizontal ) { + TQCOORD xPos = x + w/2; + TQCOORD kPos = motifOffset; + TQCOORD kSize = sw - 4; + + qDrawShadeLine( p, xPos, kPos + kSize - 1 , + xPos, h, g ); + drawPanel( p, xPos-sw/2+2, kPos, + kSize, kSize, g, FALSE, 2, + &g.brush( TQColorGroup::Button )); + qDrawShadeLine( p, xPos, 0, xPos, kPos, g ); + } else { + TQCOORD yPos = y + h/2; + TQCOORD kPos = w - motifOffset - sw; + TQCOORD kSize = sw - 4; + + qDrawShadeLine( p, 0, yPos, kPos, yPos, g ); + drawPanel( p, kPos, yPos-sw/2+2, + kSize, kSize, g, FALSE, 2, + &g.brush( TQColorGroup::Button )); + qDrawShadeLine( p, kPos + kSize -1, yPos, + w, yPos, g ); + } + +} + +/*! + \reimp +*/ +void TQInterlaceStyle::drawPanel( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &g, bool /*sunken*/, + int lineWidth, const TQBrush *fill ) +{ + if ( lineWidth < 2 ) + lineWidth = 2; + + p->setBrush( g.brush( TQColorGroup::Dark ) ); + p->setPen( NoPen ); + + p->drawRect( x, y, w, lineWidth ); + p->drawRect( x, y+h-lineWidth, w, lineWidth ); + p->drawRect( x, y, lineWidth, h ); + p->drawRect( x+w-lineWidth, y, lineWidth, h ); + + if ( fill ) { + x += lineWidth; + y += lineWidth; + w -= 2*lineWidth; + h -= 2*lineWidth; + p->setBrush( *fill ); + p->setPen( NoPen ); + p->drawRect( x, y, w, h ); + } +} + +#endif // TQT_NO_STYLE_INTERLACE + +#endif diff --git a/src/styles/tqinterlacestyle.h b/src/styles/tqinterlacestyle.h new file mode 100644 index 000000000..8c1982712 --- /dev/null +++ b/src/styles/tqinterlacestyle.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Implementation of TQInterlaceStyle widget class +** +** Created : 010122 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#if 0 // ###### not ported to new API yet +#ifndef TQINTERLACESTYLE_H +#define TQINTERLACESTYLE_H + +#ifndef QT_H +#include "tqmotifstyle.h" +#endif // QT_H + +#if !defined(TQT_NO_STYLE_INTERLACE) || defined(QT_PLUGIN) + +#include "tqpalette.h" + +class TQ_EXPORT TQInterlaceStyle : public TQMotifStyle +{ +public: + TQInterlaceStyle(); + void polish( TQApplication*); + void unPolish( TQApplication*); + void polish( TQWidget* ); + void unPolish( TQWidget* ); + + int defaultFrameWidth() const; + TQRect pushButtonContentsRect( TQPushButton *btn ); + + void drawFocusRect ( TQPainter *, const TQRect &, const TQColorGroup &, const TQColor * bg = 0, bool = FALSE ); + void drawButton( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &g, bool sunken = FALSE, + const TQBrush *fill = 0 ); + void drawButtonMask ( TQPainter * p, int x, int y, int w, int h ); + void drawBevelButton( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &g, bool sunken = FALSE, + const TQBrush *fill = 0 ); + + void drawPushButton( TQPushButton* btn, TQPainter *p); + TQSize indicatorSize () const; + void drawIndicator ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, int state, bool down = FALSE, bool enabled = TRUE ); + void drawIndicatorMask( TQPainter *p, int x, int y, int w, int h, int ); + TQSize exclusiveIndicatorSize () const; + void drawExclusiveIndicator( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool on, bool down = FALSE, bool enabled = TRUE ); + void drawExclusiveIndicatorMask( TQPainter * p, int x, int y, int w, int h, bool ); + TQRect comboButtonRect ( int x, int y, int w, int h ); + void drawComboButton( TQPainter *p, int x, int y, int w, int h, const TQColorGroup &g, bool sunken, bool editable, bool enabled, const TQBrush *fb ); + void drawPushButtonLabel( TQPushButton* btn, TQPainter *p); + void drawPanel( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &, bool sunken, + int lineWidth, const TQBrush *fill ); + + void scrollBarMetrics( const TQScrollBar* sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim ); + void drawScrollBarControls( TQPainter* p, const TQScrollBar* sb, int sliderStart, uint controls, uint activeControl ); + void drawSlider( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, Orientation, bool tickAbove, bool tickBelow ); + void drawSliderGroove( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, TQCOORD c, Orientation ); + int splitterWidth() const; + void drawSplitter( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &g, Orientation orient); + + int buttonDefaultIndicatorWidth() const; + int setSliderThickness() const; + TQSize scrollBarExtent() const; + +private: + TQPalette oldPalette; +}; + +#endif // TQT_NO_STYLE_INTERLACE + +#endif +#endif diff --git a/src/styles/tqmotifplusstyle.cpp b/src/styles/tqmotifplusstyle.cpp new file mode 100644 index 000000000..eec496cda --- /dev/null +++ b/src/styles/tqmotifplusstyle.cpp @@ -0,0 +1,1629 @@ +/**************************************************************************** +** +** Implementation of TQMotifPlusStyle class +** +** Created : 000727 +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqmotifplusstyle.h" + +#if !defined(TQT_NO_STYLE_MOTIFPLUS) || defined(QT_PLUGIN) + +#include "tqmenubar.h" +#include "ntqapplication.h" +#include "tqpainter.h" +#include "tqpalette.h" +#include "tqframe.h" +#include "tqpushbutton.h" +#include "tqcheckbox.h" +#include "tqradiobutton.h" +#include "tqcombobox.h" +#include "tqlineedit.h" +#include "tqspinbox.h" +#include "tqslider.h" +#include "ntqdrawutil.h" +#include "tqscrollbar.h" +#include "tqtabbar.h" +#include "tqtoolbar.h" +#include "ntqguardedptr.h" +#include "tqlayout.h" + + +struct TQMotifPlusStylePrivate +{ + TQMotifPlusStylePrivate() + : hovering(FALSE), sliderActive(FALSE), mousePressed(FALSE), + scrollbarElement(0), lastElement(0), ref(1) + { ; } + + bool hovering, sliderActive, mousePressed; + int scrollbarElement, lastElement, ref; + TQPoint mousePos; +}; + +static TQMotifPlusStylePrivate * singleton = 0; + + +static void drawMotifPlusShade(TQPainter *p, + const TQRect &r, + const TQColorGroup &g, + bool sunken, bool mouseover, + const TQBrush *fill = 0) +{ + TQPen oldpen = p->pen(); + TQPointArray a(4); + TQColor button = + mouseover ? g.midlight() : g.button(); + TQBrush brush = + mouseover ? g.brush(TQColorGroup::Midlight) : g.brush(TQColorGroup::Button); + int x, y, w, h; + + r.rect(&x, &y, &w, &h); + + if (sunken) p->setPen(g.dark()); else p->setPen(g.light()); + a.setPoint(0, x, y + h - 1); + a.setPoint(1, x, y); + a.setPoint(2, x, y); + a.setPoint(3, x + w - 1, y); + p->drawLineSegments(a); + + if (sunken) p->setPen(TQt::black); else p->setPen(button); + a.setPoint(0, x + 1, y + h - 2); + a.setPoint(1, x + 1, y + 1); + a.setPoint(2, x + 1, y + 1); + a.setPoint(3, x + w - 2, y + 1); + p->drawLineSegments(a); + + if (sunken) p->setPen(button); else p->setPen(g.dark()); + a.setPoint(0, x + 2, y + h - 2); + a.setPoint(1, x + w - 2, y + h - 2); + a.setPoint(2, x + w - 2, y + h - 2); + a.setPoint(3, x + w - 2, y + 2); + p->drawLineSegments(a); + + if (sunken) p->setPen(g.light()); else p->setPen(TQt::black); + a.setPoint(0, x + 1, y + h - 1); + a.setPoint(1, x + w - 1, y + h - 1); + a.setPoint(2, x + w - 1, y + h - 1); + a.setPoint(3, x + w - 1, y); + p->drawLineSegments(a); + + if (fill) + p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); + else + p->fillRect(x + 2, y + 2, w - 4, h - 4, brush); + + p->setPen(oldpen); +} + + +/*! + \class TQMotifPlusStyle tqmotifplusstyle.h + \brief The TQMotifPlusStyle class provides a more sophisticated Motif-ish look and feel. + + \ingroup appearance + + This class implements a Motif-ish look and feel with the more + sophisticated bevelling as used by the GIMP Toolkit (GTK+) for + Unix/X11. +*/ + +/*! + Constructs a TQMotifPlusStyle + + If \a hoveringHighlight is TRUE (the default), then the style will + not highlight push buttons, checkboxes, radiobuttons, comboboxes, + scrollbars or sliders. +*/ +TQMotifPlusStyle::TQMotifPlusStyle(bool hoveringHighlight) : TQMotifStyle(TRUE) +{ + if ( !singleton ) + singleton = new TQMotifPlusStylePrivate; + else + singleton->ref++; + + useHoveringHighlight = hoveringHighlight; +} + +/*! \reimp */ +TQMotifPlusStyle::~TQMotifPlusStyle() +{ + if ( singleton && singleton->ref-- <= 0) { + delete singleton; + singleton = 0; + } +} + + +/*! \reimp */ +void TQMotifPlusStyle::polish(TQPalette &) +{ +} + + +/*! \reimp */ +void TQMotifPlusStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) +{ + if (ceData.widgetObjectTypes.contains("TQWidget")) { +#ifndef TQT_NO_FRAME + if ((ceData.widgetObjectTypes.contains("TQFrame")) && (ceData.frameStyle == TQFrame::Panel)) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::WinPanel)); + } +#endif + +#ifndef TQT_NO_MENUBAR + if ((ceData.widgetObjectTypes.contains("TQMenuBar")) && (ceData.frameStyle != TQFrame::NoFrame)) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::StyledPanel | TQFrame::Raised)); + } +#endif + +#ifndef TQT_NO_TOOLBAR + if (ceData.widgetObjectTypes.contains("TQToolBar")) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetLayoutMargin, TQStyleWidgetActionRequestData(2)); + } +#endif + } + if (useHoveringHighlight) { + if ((ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQComboBox"))) { + installObjectEventHandler(ceData, elementFlags, ptr, this); + } + + if ((ceData.widgetObjectTypes.contains("TQScrollBar")) || (ceData.widgetObjectTypes.contains("TQSlider"))) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_EnableMouseTracking); + installObjectEventHandler(ceData, elementFlags, ptr, this); + } + } + + TQMotifStyle::polish(ceData, elementFlags, ptr); +} + + +/*! \reimp */ +void TQMotifPlusStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) +{ + removeObjectEventHandler(ceData, elementFlags, ptr, this); + TQMotifStyle::unPolish(ceData, elementFlags, ptr); +} + + +/*! \reimp */ +void TQMotifPlusStyle::applicationPolish(const TQStyleControlElementData&, ControlElementFlags, void *) +{ +} + + +/*! \reimp */ +void TQMotifPlusStyle::applicationUnPolish(const TQStyleControlElementData&, ControlElementFlags, void *) +{ +} + + +/*! \reimp */ +int TQMotifPlusStyle::pixelMetric(PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const +{ + int ret; + + switch (metric) { + case PM_ScrollBarExtent: + ret = 15; + break; + + case PM_ButtonDefaultIndicator: + ret = 5; + break; + + case PM_ButtonMargin: + ret = 4; + break; + + case PM_SliderThickness: + ret = 15; + break; + + case PM_IndicatorWidth: + case PM_IndicatorHeight: + ret = 10; + break; + + case PM_ExclusiveIndicatorWidth: + case PM_ExclusiveIndicatorHeight: + ret = 11; + break; + + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = 2; + break; + + default: + ret = TQMotifStyle::pixelMetric(metric, ceData, elementFlags, widget); + break; + } + + return ret; +} + + +/*! \reimp */ +void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + bool dis = ! (flags & Style_Enabled); + bool act = flags & Style_Active; + + switch (pe) { + case PE_HeaderSection: + + case PE_ButtonCommand: + case PE_ButtonBevel: + case PE_ButtonTool: + if (flags & (Style_Down | Style_On | Style_Raised | Style_Sunken)) + drawMotifPlusShade( p, r, cg, bool(flags & (Style_Down | Style_On)), + bool(flags & Style_MouseOver)); + else if (flags & Style_MouseOver) + p->fillRect(r, cg.brush(TQColorGroup::Midlight)); + else + p->fillRect(r, cg.brush(TQColorGroup::Button)); + break; + + case PE_Panel: + case PE_PanelPopup: + case PE_PanelMenuBar: + case PE_PanelDockWindow: + if ( opt.lineWidth() ) + drawMotifPlusShade( p, r, cg, (flags & Style_Sunken), (flags & Style_MouseOver)); + else if ( flags & Style_MouseOver ) + p->fillRect(r, cg.brush(TQColorGroup::Midlight)); + else + p->fillRect(r, cg.brush(TQColorGroup::Button)); + break; + + case PE_SpinWidgetUp: + drawPrimitive(PE_ArrowUp, p, ceData, elementFlags, r, cg, flags, opt); + break; + + case PE_SpinWidgetDown: + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, r, cg, flags, opt); + break; + + case PE_Indicator: + { + TQBrush fill; + if (flags & Style_On) + fill = cg.brush(TQColorGroup::Mid); + else if (flags & Style_MouseOver) + fill = cg.brush(TQColorGroup::Midlight); + else + fill = cg.brush(TQColorGroup::Button); + + if (flags & Style_NoChange) { + qDrawPlainRect(p, r, cg.text(), 1, &fill); + p->drawLine(r.topRight(), r.bottomLeft()); + } else + drawMotifPlusShade(p, r, cg, (flags & Style_On), + (flags & Style_MouseOver), &fill); + break; + } + + case PE_ExclusiveIndicator: + { + TQPen oldpen = p->pen(); + TQPointArray thick(8); + TQPointArray thin(4); + TQColor button = ((flags & Style_MouseOver) ? cg.midlight() : cg.button()); + TQBrush brush = ((flags & Style_MouseOver) ? + cg.brush(TQColorGroup::Midlight) : + cg.brush(TQColorGroup::Button)); + int x, y, w, h; + r.rect(&x, &y, &w, &h); + + p->fillRect(x, y, w, h, brush); + + + if (flags & Style_On) { + thick.setPoint(0, x, y + (h / 2)); + thick.setPoint(1, x + (w / 2), y); + thick.setPoint(2, x + 1, y + (h / 2)); + thick.setPoint(3, x + (w / 2), y + 1); + thick.setPoint(4, x + (w / 2), y); + thick.setPoint(5, x + w - 1, y + (h / 2)); + thick.setPoint(6, x + (w / 2), y + 1); + thick.setPoint(7, x + w - 2, y + (h / 2)); + p->setPen(cg.dark()); + p->drawLineSegments(thick); + + thick.setPoint(0, x + 1, y + (h / 2) + 1); + thick.setPoint(1, x + (w / 2), y + h - 1); + thick.setPoint(2, x + 2, y + (h / 2) + 1); + thick.setPoint(3, x + (w / 2), y + h - 2); + thick.setPoint(4, x + (w / 2), y + h - 1); + thick.setPoint(5, x + w - 2, y + (h / 2) + 1); + thick.setPoint(6, x + (w / 2), y + h - 2); + thick.setPoint(7, x + w - 3, y + (h / 2) + 1); + p->setPen(cg.light()); + p->drawLineSegments(thick); + + thin.setPoint(0, x + 2, y + (h / 2)); + thin.setPoint(1, x + (w / 2), y + 2); + thin.setPoint(2, x + (w / 2), y + 2); + thin.setPoint(3, x + w - 3, y + (h / 2)); + p->setPen(TQt::black); + p->drawLineSegments(thin); + + thin.setPoint(0, x + 3, y + (h / 2) + 1); + thin.setPoint(1, x + (w / 2), y + h - 3); + thin.setPoint(2, x + (w / 2), y + h - 3); + thin.setPoint(3, x + w - 4, y + (h / 2) + 1); + p->setPen(cg.mid()); + p->drawLineSegments(thin); + } else { + thick.setPoint(0, x, y + (h / 2)); + thick.setPoint(1, x + (w / 2), y); + thick.setPoint(2, x + 1, y + (h / 2)); + thick.setPoint(3, x + (w / 2), y + 1); + thick.setPoint(4, x + (w / 2), y); + thick.setPoint(5, x + w - 1, y + (h / 2)); + thick.setPoint(6, x + (w / 2), y + 1); + thick.setPoint(7, x + w - 2, y + (h / 2)); + p->setPen(cg.light()); + p->drawLineSegments(thick); + + thick.setPoint(0, x + 2, y + (h / 2) + 1); + thick.setPoint(1, x + (w / 2), y + h - 2); + thick.setPoint(2, x + 3, y + (h / 2) + 1); + thick.setPoint(3, x + (w / 2), y + h - 3); + thick.setPoint(4, x + (w / 2), y + h - 2); + thick.setPoint(5, x + w - 3, y + (h / 2) + 1); + thick.setPoint(6, x + (w / 2), y + h - 3); + thick.setPoint(7, x + w - 4, y + (h / 2) + 1); + p->setPen(cg.dark()); + p->drawLineSegments(thick); + + thin.setPoint(0, x + 2, y + (h / 2)); + thin.setPoint(1, x + (w / 2), y + 2); + thin.setPoint(2, x + (w / 2), y + 2); + thin.setPoint(3, x + w - 3, y + (h / 2)); + p->setPen(button); + p->drawLineSegments(thin); + + thin.setPoint(0, x + 1, y + (h / 2) + 1); + thin.setPoint(1, x + (w / 2), y + h - 1); + thin.setPoint(2, x + (w / 2), y + h - 1); + thin.setPoint(3, x + w - 2, y + (h / 2) + 1); + p->setPen(TQt::black); + p->drawLineSegments(thin); + } + + p->setPen(oldpen); + break; + } + + + + case PE_ArrowDown: + case PE_ArrowLeft: + case PE_ArrowRight: + case PE_ArrowUp: + { + TQPen oldpen = p->pen(); + TQBrush oldbrush = p->brush(); + TQPointArray poly(3); + TQColor button = (flags & Style_MouseOver) ? cg.midlight() : cg.button(); + bool down = (flags & Style_Down); + int x, y, w, h; + r.rect(&x, &y, &w, &h); + + p->save(); + p->setBrush(button); + + switch (pe) { + case PE_ArrowUp: + { + poly.setPoint(0, x + (w / 2), y ); + poly.setPoint(1, x, y + h - 1); + poly.setPoint(2, x + w - 1, y + h - 1); + p->drawPolygon(poly); + + if (down) + p->setPen(button); + else + p->setPen(cg.dark()); + p->drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2); + + if (down) + p->setPen(cg.light()); + else + p->setPen(black); + p->drawLine(x, y + h - 1, x + w - 1, y + h - 1); + + if (down) + p->setPen(button); + else + p->setPen(cg.dark()); + p->drawLine(x + w - 2, y + h - 1, x + (w / 2), y + 1); + + if (down) + p->setPen(cg.light()); + else + p->setPen(black); + p->drawLine(x + w - 1, y + h - 1, x + (w / 2), y); + + if (down) + p->setPen(black); + else + p->setPen(button); + p->drawLine(x + (w / 2), y + 1, x + 1, y + h - 1); + + if (down) + p->setPen(cg.dark()); + else + p->setPen(cg.light()); + p->drawLine(x + (w / 2), y, x, y + h - 1); + break; + } + + case PE_ArrowDown: + { + poly.setPoint(0, x + w - 1, y); + poly.setPoint(1, x, y); + poly.setPoint(2, x + (w / 2), y + h - 1); + p->drawPolygon(poly); + + if (down) + p->setPen(black); + else + p->setPen(button); + p->drawLine(x + w - 2, y + 1, x + 1, y + 1); + + if (down) + p->setPen(cg.dark()); + else + p->setPen(cg.light()); + p->drawLine(x + w - 1, y, x, y); + + if (down) + p->setPen(black); + else + p->setPen(button); + p->drawLine(x + 1, y, x + (w / 2), y + h - 2); + + if (down) + p->setPen(cg.dark()); + else + p->setPen(cg.light()); + p->drawLine(x, y, x + (w / 2), y + h - 1); + + if (down) + p->setPen(button); + else + p->setPen(cg.dark()); + p->drawLine(x + (w / 2), y + h - 2, x + w - 2, y); + + if (down) + p->setPen(cg.light()); + else + p->setPen(black); + p->drawLine(x + (w / 2), y + h - 1, x + w - 1, y); + break; + } + + case PE_ArrowLeft: + { + poly.setPoint(0, x, y + (h / 2)); + poly.setPoint(1, x + w - 1, y + h - 1); + poly.setPoint(2, x + w - 1, y); + p->drawPolygon(poly); + + if (down) + p->setPen(button); + else + p->setPen(cg.dark()); + p->drawLine(x + 1, y + (h / 2), x + w - 1, y + h - 1); + + if (down) + p->setPen(cg.light()); + else + p->setPen(black); + p->drawLine(x, y + (h / 2), x + w - 1, y + h - 1); + + if (down) + p->setPen(button); + else + p->setPen(cg.dark()); + p->drawLine(x + w - 2, y + h - 1, x + w - 2, y + 1); + + if (down) + p->setPen(cg.light()); + else + p->setPen(black); + p->drawLine(x + w - 1, y + h - 1, x + w - 1, y); + + if (down) + p->setPen(black); + else + p->setPen(button); + p->drawLine(x + w - 1, y + 1, x + 1, y + (h / 2)); + + if (down) + p->setPen(cg.dark()); + else + p->setPen(cg.light()); + p->drawLine(x + w - 1, y, x, y + (h / 2)); + break; + } + + case PE_ArrowRight: + { + poly.setPoint(0, x + w - 1, y + (h / 2)); + poly.setPoint(1, x, y); + poly.setPoint(2, x, y + h - 1); + p->drawPolygon(poly); + + if (down) + p->setPen(black); + else + p->setPen(button); + p->drawLine( x + w - 1, y + (h / 2), x + 1, y + 1); + + if (down) + p->setPen(cg.dark()); + else + p->setPen(cg.light()); + p->drawLine(x + w - 1, y + (h / 2), x, y); + + if (down) + p->setPen(black); + else + p->setPen(button); + p->drawLine(x + 1, y + 1, x + 1, y + h - 2); + + if (down) + p->setPen(cg.dark()); + else + p->setPen(cg.light()); + p->drawLine(x, y, x, y + h - 1); + + if (down) + p->setPen(button); + else + p->setPen(cg.dark()); + p->drawLine(x + 1, y + h - 2, x + w - 1, y + (h / 2)); + + if (down) + p->setPen(cg.light()); + else + p->setPen(black); + p->drawLine(x, y + h - 1, x + w - 1, y + (h / 2)); + break; + } + + default: + break; + } + + p->restore(); + p->setBrush(oldbrush); + p->setPen(oldpen); + break; + } + + case PE_PanelScrollBar: + { + drawMotifPlusShade(p, r, cg, TRUE, FALSE, &cg.brush(TQColorGroup::Mid)); + break; + } + + case PE_MenuItemIndicatorFrame: + { + // Draw nothing + break; + } + case PE_MenuItemIndicatorIconFrame: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + TQRect vrect = visualRect( TQRect( x+2, y+2, checkcol, h-2 ), r ); + + qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) ); + break; + } + + case PE_MenuItemIndicatorCheck: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + TQRect vrect = visualRect( TQRect( x+2, y+2, checkcol, h-2 ), r ); + + SFlags cflags = Style_Default; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; + + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, vrect, cg, cflags); + break; + } + + default: + TQMotifStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); + break; + } +} + + +/*! \reimp +*/ +void TQMotifPlusStyle::drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt, + const TQWidget *widget) const +{ + switch (element) { + case CE_PushButton: + { +#ifndef TQT_NO_PUSHBUTTON + TQRect br = r; + int dbi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); + + if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { + if (elementFlags & CEF_IsDefault) + drawMotifPlusShade(p, br, cg, TRUE, FALSE, + &cg.brush(TQColorGroup::Background)); + + br.setCoords(br.left() + dbi, + br.top() + dbi, + br.right() - dbi, + br.bottom() - dbi); + } + + if (flags & Style_HasFocus) + br.addCoords(1, 1, -1, -1); + p->save(); + p->setBrushOrigin( -ceData.bgOffset.x(), + -ceData.bgOffset.y() ); + drawPrimitive(PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags); + p->restore(); +#endif + break; + } + + case CE_CheckBoxLabel: + { +#ifndef TQT_NO_CHECKBOX + if (flags & Style_MouseOver) { + TQRegion r(ceData.rect); + r -= visualRect(subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget), ceData, elementFlags); + p->setClipRegion(r); + p->fillRect(ceData.rect, cg.brush(TQColorGroup::Midlight)); + p->setClipping(FALSE); + } + + int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; + drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, + flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text); + + if (elementFlags & CEF_HasFocus) { + TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); + } +#endif + break; + } + + case CE_RadioButtonLabel: + { +#ifndef TQT_NO_RADIOBUTTON + if (flags & Style_MouseOver) { + TQRegion r(ceData.rect); + r -= visualRect(subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget), ceData, elementFlags); + p->setClipRegion(r); + p->fillRect(ceData.rect, cg.brush(TQColorGroup::Midlight)); + p->setClipping(FALSE); + } + + int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; + drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, + flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text); + + if (elementFlags & CEF_HasFocus) { + TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); + } +#endif + break; + } + + case CE_MenuBarItem: + { +#ifndef TQT_NO_MENUDATA + if (opt.isDefault()) + break; + + TQMenuItem *mi = opt.menuItem(); + if ((flags & Style_Enabled) && (flags & Style_Active)) + drawMotifPlusShade(p, r, cg, FALSE, TRUE); + else + p->fillRect(r, cg.button()); + + drawItem(p, r, AlignCenter | ShowPrefix | DontClip | SingleLine, + cg, flags & Style_Enabled, mi->pixmap(), mi->text(), -1, + &cg.buttonText()); +#endif + break; + } + + +#ifndef TQT_NO_POPUPMENU + case CE_PopupMenuItem: + { + if (! widget || opt.isDefault()) + break; + + TQMenuItem *mi = opt.menuItem(); + if ( !mi ) + break; + + int tab = opt.tabWidth(); + int maxpmw = opt.maxIconWidth(); + bool dis = ! (flags & Style_Enabled); + bool checkable = (elementFlags & CEF_IsCheckable); + bool act = flags & Style_Active; + int x, y, w, h; + + r.rect(&x, &y, &w, &h); + + if (checkable) + maxpmw = TQMAX(maxpmw, 15); + + int checkcol = maxpmw; + + if (mi && mi->isSeparator()) { + p->setPen( cg.dark() ); + p->drawLine( x, y, x+w, y ); + p->setPen( cg.light() ); + p->drawLine( x, y+1, x+w, y+1 ); + return; + } + + if ( act && !dis ) + drawMotifPlusShade(p, TQRect(x, y, w, h), cg, FALSE, TRUE); + else + p->fillRect(x, y, w, h, cg.brush( TQColorGroup::Button )); + + if ( !mi ) + return; + + TQRect vrect = visualRect( TQRect( x+2, y+2, checkcol, h-2 ), r ); + if ( mi->isChecked() ) { + if ( mi->iconSet() ) { + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); + } + } else if ( !act ) { + p->fillRect(vrect, + cg.brush( TQColorGroup::Button )); + } + + if ( mi->iconSet() ) { // draw iconset + TQIconSet::Mode mode = (!dis) ? TQIconSet::Normal : TQIconSet::Disabled; + + if (act && !dis) + mode = TQIconSet::Active; + + TQPixmap pixmap; + if ( checkable && mi->isChecked() ) + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, + TQIconSet::On ); + else + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); + + int pixw = pixmap.width(); + int pixh = pixmap.height(); + + TQRect pmr( 0, 0, pixw, pixh ); + + pmr.moveCenter(vrect.center()); + + p->setPen( cg.text() ); + p->drawPixmap( pmr.topLeft(), pixmap ); + + } else if (checkable) { + if (mi->isChecked()) { + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); + } + } + + p->setPen( cg.buttonText() ); + + TQColor discol; + if (dis) { + discol = cg.text(); + p->setPen( discol ); + } + + vrect = visualRect( TQRect(x + checkcol + 4, y + 2, + w - checkcol - tab - 3, h - 4), r ); + if (mi->custom()) { + p->save(); + mi->custom()->paint(p, cg, act, !dis, vrect.x(), y + 2, + w - checkcol - tab - 3, h - 4); + p->restore(); + } + + TQString s = mi->text(); + if ( !s.isNull() ) { // draw text + int t = s.find( '\t' ); + int m = 2; + int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; + text_flags |= (TQApplication::reverseLayout() ? AlignRight : AlignLeft ); + if ( t >= 0 ) { // draw tab text + TQRect vr = visualRect( TQRect(x+w-tab-2-2, + y+m, tab, h-2*m), r ); + p->drawText( vr.x(), + y+m, tab, h-2*m, text_flags, s.mid( t+1 ) ); + } + p->drawText(vrect.x(), y + 2, w - checkcol -tab - 3, h - 4, + text_flags, s, t); + } else if (mi->pixmap()) { + TQPixmap *pixmap = mi->pixmap(); + + if (pixmap->depth() == 1) p->setBackgroundMode(OpaqueMode); + TQRect vr = visualRect( TQRect( x + checkcol + 2, y + 2, w - checkcol - 1, h - 4 ), r ); + p->drawPixmap(vr.x(), y + 2, *pixmap); + if (pixmap->depth() == 1) p->setBackgroundMode(TransparentMode); + } + + if (mi->popup()) { + int hh = h / 2; + TQStyle::PrimitiveElement arrow = (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight); + vrect = visualRect( TQRect(x + w - hh - 6, y + (hh / 2), hh, hh), r ); + drawPrimitive(arrow, p, + ceData, elementFlags, + vrect, cg, + ((act && !dis) ? + Style_Down : Style_Default) | + ((!dis) ? Style_Enabled : Style_Default)); + } + break; + } +#endif // TQT_NO_POPUPMENU + + case CE_TabBarTab: + { +#ifndef TQT_NO_TABBAR + bool selected = flags & Style_Selected; + + TQColorGroup g = ceData.colorGroup; + TQPen oldpen = p->pen(); + TQRect fr(r); + + if (! selected) { + if (ceData.tabBarData.shape == TQTabBar::RoundedAbove || + ceData.tabBarData.shape == TQTabBar::TriangularAbove) { + fr.setTop(fr.top() + 2); + } else { + fr.setBottom(fr.bottom() - 2); + } + } + + fr.setWidth(fr.width() - 3); + + p->fillRect(fr.left() + 1, fr.top() + 1, fr.width() - 2, fr.height() - 2, + (selected) ? cg.brush(TQColorGroup::Button) + : cg.brush(TQColorGroup::Mid)); + + if (ceData.tabBarData.shape == TQTabBar::RoundedAbove) { + // "rounded" tabs on top + fr.setBottom(fr.bottom() - 1); + + p->setPen(g.light()); + p->drawLine(fr.left(), fr.top() + 1, + fr.left(), fr.bottom() - 1); + p->drawLine(fr.left() + 1, fr.top(), + fr.right() - 1, fr.top()); + if (! selected) + p->drawLine(fr.left(), fr.bottom(), + fr.right() + 3, fr.bottom()); + + if (fr.left() == 0) + p->drawLine(fr.left(), fr.bottom(), + fr.left(), fr.bottom() + 1); + + p->setPen(g.dark()); + p->drawLine(fr.right() - 1, fr.top() + 2, + fr.right() - 1, fr.bottom() - 1); + + p->setPen(black); + p->drawLine(fr.right(), fr.top() + 1, + fr.right(), fr.bottom() - 1); + } else if (ceData.tabBarData.shape == TQTabBar::RoundedBelow) { + // "rounded" tabs on bottom + fr.setTop(fr.top() + 1); + + p->setPen(g.dark()); + p->drawLine(fr.right() + 3, fr.top() - 1, + fr.right() - 1, fr.top() - 1); + p->drawLine(fr.right() - 1, fr.top(), + fr.right() - 1, fr.bottom() - 2); + p->drawLine(fr.right() - 1, fr.bottom() - 2, + fr.left() + 2, fr.bottom() - 2); + if (! selected) { + p->drawLine(fr.right(), fr.top() - 1, + fr.left() + 1, fr.top() - 1); + + if (fr.left() != 0) + p->drawPoint(fr.left(), fr.top() - 1); + } + + p->setPen(black); + p->drawLine(fr.right(), fr.top(), + fr.right(), fr.bottom() - 2); + p->drawLine(fr.right() - 1, fr.bottom() - 1, + fr.left(), fr.bottom() - 1); + if (! selected) + p->drawLine(fr.right() + 3, fr.top(), + fr.left(), fr.top()); + else + p->drawLine(fr.right() + 3, fr.top(), + fr.right(), fr.top()); + + p->setPen(g.light()); + p->drawLine(fr.left(), fr.top() + 1, + fr.left(), fr.bottom() - 2); + + if (selected) { + p->drawPoint(fr.left(), fr.top()); + if (fr.left() == 0) + p->drawPoint(fr.left(), fr.top() - 1); + + p->setPen(g.button()); + p->drawLine(fr.left() + 2, fr.top() - 1, + fr.left() + 1, fr.top() - 1); + } + } else + // triangular drawing code + TQMotifStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); + + p->setPen(oldpen); +#endif + break; + } + + default: + TQMotifStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); + break; + } +} + + +/*! \reimp +*/ +TQRect TQMotifPlusStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const +{ + TQRect rect; + + switch (r) { + case SR_PushButtonFocusRect: + { +#ifndef TQT_NO_PUSHBUTTON + int dfi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget); + + rect = ceData.rect; + if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) + rect.addCoords(dfi, dfi, -dfi, -dfi); +#endif + break; + } + + case SR_CheckBoxIndicator: + { + int h = pixelMetric( PM_IndicatorHeight, ceData, elementFlags ); + rect.setRect(( ceData.rect.height() - h ) / 2, + ( ceData.rect.height() - h ) / 2, + pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), h ); + break; + } + + case SR_RadioButtonIndicator: + { + int h = pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags ); + rect.setRect( ( ceData.rect.height() - h ) / 2, + ( ceData.rect.height() - h ) / 2, + pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), h ); + break; + } + + case SR_CheckBoxFocusRect: + case SR_RadioButtonFocusRect: + rect = ceData.rect; + break; + + case SR_ComboBoxFocusRect: + { +#ifndef TQT_NO_COMBOBOX + if (elementFlags & CEF_IsEditable) { + rect = querySubControlMetrics(CC_ComboBox, ceData, elementFlags, + SC_ComboBoxEditField, TQStyleOption::Default, widget); + rect.addCoords(-3, -3, 3, 3); + } else + rect = ceData.rect; +#endif + break; + } + + case SR_SliderFocusRect: + { +#ifndef TQT_NO_SLIDER + int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + int x, y, wi, he; + + if ( ceData.orientation == Horizontal ) { + x = 0; + y = tickOffset; + wi = ceData.rect.width(); + he = thickness; + } else { + x = tickOffset; + y = 0; + wi = thickness; + he = ceData.rect.height(); + } + + rect.setRect(x, y, wi, he); +#endif + break; + } + + default: + rect = TQMotifStyle::subRect(r, ceData, elementFlags, widget); + break; + } + + return rect; +} + + +/*! \reimp */ +void TQMotifPlusStyle::drawComplexControl(ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + SCFlags controls, + SCFlags active, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch (control) { + case CC_ScrollBar: + { +#ifndef TQT_NO_SCROLLBAR + TQRect addline, subline, addpage, subpage, slider, first, last; + bool maxedOut = (ceData.minSteps == ceData.maxSteps); + + subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget); + addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget); + subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget); + addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget); + slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget); + first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget); + last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget); + + bool skipUpdate = FALSE; + if (singleton->hovering) { + if (addline.contains(singleton->mousePos)) { + skipUpdate = + (singleton->scrollbarElement == SC_ScrollBarAddLine); + singleton->scrollbarElement = SC_ScrollBarAddLine; + } else if (subline.contains(singleton->mousePos)) { + skipUpdate = + (singleton->scrollbarElement == SC_ScrollBarSubLine); + singleton->scrollbarElement = SC_ScrollBarSubLine; + } else if (slider.contains(singleton->mousePos)) { + skipUpdate = + (singleton->scrollbarElement == SC_ScrollBarSlider); + singleton->scrollbarElement = SC_ScrollBarSlider; + } else { + skipUpdate = + (singleton->scrollbarElement == 0); + singleton->scrollbarElement = 0; + } + } else + singleton->scrollbarElement = 0; + + if (skipUpdate && singleton->scrollbarElement == singleton->lastElement) + break; + + singleton->lastElement = singleton->scrollbarElement; + + if (controls == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | + SC_ScrollBarAddPage | SC_ScrollBarSubPage | + SC_ScrollBarFirst | SC_ScrollBarLast | SC_ScrollBarSlider)) + drawPrimitive(PE_PanelScrollBar, p, ceData, elementFlags, ceData.rect, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarLast) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + + if ((controls & SC_ScrollBarSubLine) && subline.isValid()) + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, + ((active == SC_ScrollBarSubLine || + singleton->scrollbarElement == SC_ScrollBarSubLine) ? + Style_MouseOver: Style_Default) | + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarSubLine) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + if ((controls & SC_ScrollBarAddLine) && addline.isValid()) + drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, + ((active == SC_ScrollBarAddLine || + singleton->scrollbarElement == SC_ScrollBarAddLine) ? + Style_MouseOver: Style_Default) | + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarAddLine) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) + drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarSubPage) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) + drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarAddPage) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + if ((controls & SC_ScrollBarFirst) && first.isValid()) + drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarFirst) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + if ((controls & SC_ScrollBarLast) && last.isValid()) + drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, + ((maxedOut) ? Style_Default : Style_Enabled) | + ((active == SC_ScrollBarLast) ? + Style_Down : Style_Default) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + if ((controls & SC_ScrollBarSlider) && slider.isValid()) { + drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, + ((active == SC_ScrollBarSlider || + singleton->scrollbarElement == SC_ScrollBarSlider) ? + Style_MouseOver: Style_Default) | + ((maxedOut) ? Style_Default : Style_Enabled) | + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + + // ### perhaps this should not be able to accept focus if maxedOut? + if (elementFlags & CEF_HasFocus) { + TQRect fr(slider.x() + 2, slider.y() + 2, + slider.width() - 5, slider.height() - 5); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default); + } + } +#endif + break; + } + + case CC_ComboBox: + { +#ifndef TQT_NO_COMBOBOX + TQRect editfield, arrow; + editfield = + visualRect(querySubControlMetrics(CC_ComboBox, + ceData, elementFlags, + SC_ComboBoxEditField, + opt, widget), ceData, elementFlags); + arrow = + visualRect(querySubControlMetrics(CC_ComboBox, + ceData, elementFlags, + SC_ComboBoxArrow, + opt, widget), ceData, elementFlags); + + if (elementFlags & CEF_IsEditable) { + if (controls & SC_ComboBoxEditField && editfield.isValid()) { + editfield.addCoords(-3, -3, 3, 3); + if (elementFlags & CEF_HasFocus) + editfield.addCoords(1, 1, -1, -1); + drawMotifPlusShade(p, editfield, cg, TRUE, FALSE, + ((elementFlags & CEF_IsEnabled) ? + &cg.brush(TQColorGroup::Base) : + &cg.brush(TQColorGroup::Background))); + } + + if (controls & SC_ComboBoxArrow && arrow.isValid()) { + drawMotifPlusShade(p, arrow, cg, (active == SC_ComboBoxArrow), + (flags & Style_MouseOver)); + + int space = (r.height() - 13) / 2; + arrow.addCoords(space, space, -space, -space); + + if (active == SC_ComboBoxArrow) + flags |= Style_Sunken; + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags); + } + } else { + if (controls & SC_ComboBoxEditField && editfield.isValid()) { + editfield.addCoords(-3, -3, 3, 3); + if (elementFlags & CEF_HasFocus) + editfield.addCoords(1, 1, -1, -1); + drawMotifPlusShade(p, editfield, cg, FALSE, + (flags & Style_MouseOver)); + } + + if (controls & SC_ComboBoxArrow && arrow.isValid()) + drawMotifPlusShade(p, arrow, cg, FALSE, (flags & Style_MouseOver)); + } + + if ((elementFlags & CEF_HasFocus) || + ((elementFlags & CEF_IsEditable) && (ceData.comboBoxLineEditFlags & CEF_HasFocus))) { + TQRect fr = visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags); + } +#endif + break; + } + + case CC_SpinWidget: + { +#ifndef TQT_NO_SPINWIDGET + SFlags flags = Style_Default; + + if (controls & SC_SpinWidgetFrame) + drawMotifPlusShade(p, r, cg, TRUE, FALSE, &cg.brush(TQColorGroup::Base)); + + if (controls & SC_SpinWidgetUp) { + flags = Style_Enabled; + if (active == SC_SpinWidgetUp ) + flags |= Style_Down; + + PrimitiveElement pe; + if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus ) + pe = PE_SpinWidgetPlus; + else + pe = PE_SpinWidgetUp; + + TQRect re = ceData.spinWidgetData.upRect; + TQColorGroup ucg = ceData.spinWidgetData.upEnabled ? cg : ceData.palette.disabled(); + drawPrimitive(pe, p, ceData, elementFlags, re, ucg, flags); + } + + if (controls & SC_SpinWidgetDown) { + flags = Style_Enabled; + if (active == SC_SpinWidgetDown ) + flags |= Style_Down; + + PrimitiveElement pe; + if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus ) + pe = PE_SpinWidgetMinus; + else + pe = PE_SpinWidgetDown; + + TQRect re = ceData.spinWidgetData.downRect; + TQColorGroup dcg = ceData.spinWidgetData.downEnabled ? cg : ceData.palette.disabled(); + drawPrimitive(pe, p, ceData, elementFlags, re, dcg, flags); + } +#endif + break; + } + + case CC_Slider: + { +#ifndef TQT_NO_SLIDER + bool mouseover = (flags & Style_MouseOver); + + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, + opt, widget), + handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, + opt, widget); + + if ((controls & SC_SliderGroove) && groove.isValid()) { + drawMotifPlusShade(p, groove, cg, TRUE, FALSE, + &cg.brush(TQColorGroup::Mid)); + + if ( flags & Style_HasFocus ) { + TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg, flags ); + } + } + + if ((controls & SC_SliderHandle) && handle.isValid()) { + if ((mouseover && handle.contains(singleton->mousePos)) || + singleton->sliderActive) + flags |= Style_MouseOver; + else + flags &= ~Style_MouseOver; + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, handle, cg, flags | Style_Raised); + + if ( ceData.orientation == Horizontal ) { + TQCOORD mid = handle.x() + handle.width() / 2; + qDrawShadeLine( p, mid, handle.y() + 1, mid , + handle.y() + handle.height() - 3, + cg, TRUE, 1); + } else { + TQCOORD mid = handle.y() + handle.height() / 2; + qDrawShadeLine( p, handle.x() + 1, mid, + handle.x() + handle.width() - 3, mid, + cg, TRUE, 1); + } + } + + if (controls & SC_SliderTickmarks) + TQMotifStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, + SC_SliderTickmarks, active, opt, widget); +#endif + break; + } + + default: + TQMotifStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, + controls, active, opt, widget); + } +} + + +/*! \reimp +*/ +TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl subcontrol, + const TQStyleOption& opt, + const TQWidget *widget) const +{ + switch (control) { + case CC_SpinWidget: { + int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, 0 ); + TQSize bs; + bs.setHeight( (ceData.rect.height() + 1)/2 ); + if ( bs.height() < 10 ) + bs.setHeight( 10 ); + bs.setWidth( bs.height() ); // 1.6 -approximate golden mean + bs = bs.expandedTo( TQApplication::globalStrut() ); + int y = 0; + int x, lx, rx, h; + x = ceData.rect.width() - y - bs.width(); + lx = fw; + rx = x - fw * 2; + h = bs.height() * 2; + + switch ( subcontrol ) { + case SC_SpinWidgetUp: + return TQRect(x + 1, y, bs.width(), bs.height() - 1); + case SC_SpinWidgetDown: + return TQRect(x + 1, y + bs.height() + 1, bs.width(), bs.height()); + case SC_SpinWidgetButtonField: + return TQRect(x, y, bs.width(), h - 2*fw); + case SC_SpinWidgetEditField: + return TQRect(lx, fw, rx, h - 2*fw); + case SC_SpinWidgetFrame: + return TQRect( 0, 0, ceData.rect.width() - bs.width(), h); + default: + break; + } + break; } + +#ifndef TQT_NO_COMBOBOX + case CC_ComboBox: { + if (elementFlags & CEF_IsEditable) { + int space = (ceData.rect.height() - 13) / 2; + switch (subcontrol) { + case SC_ComboBoxFrame: + return TQRect(); + case SC_ComboBoxEditField: { + TQRect rect = ceData.rect; + rect.setWidth(rect.width() - 13 - space * 2); + rect.addCoords(3, 3, -3, -3); + return rect; } + case SC_ComboBoxArrow: + return TQRect(ceData.rect.width() - 13 - space * 2, 0, + 13 + space * 2, ceData.rect.height()); + default: break; // shouldn't get here + } + + } else { + int space = (ceData.rect.height() - 7) / 2; + switch (subcontrol) { + case SC_ComboBoxFrame: + return TQRect(); + case SC_ComboBoxEditField: { + TQRect rect = ceData.rect; + rect.addCoords(3, 3, -3, -3); + return rect; } + case SC_ComboBoxArrow: // 12 wide, 7 tall + return TQRect(ceData.rect.width() - 12 - space, space, 12, 7); + default: break; // shouldn't get here + } + } + break; } +#endif + +#ifndef TQT_NO_SLIDER + case CC_Slider: { + + if (subcontrol == SC_SliderHandle) { + int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ) + 2; + int sliderPos = ceData.startStep; + int motifBorder = 2; + + if ( ceData.orientation == Horizontal ) + return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len, + thickness - 2*motifBorder ); + return TQRect( tickOffset + motifBorder, sliderPos + motifBorder, + thickness - 2*motifBorder, len); + } + break; } +#endif + default: break; + } + return TQMotifStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); +} + + +/*! \reimp */ +bool TQMotifPlusStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *event ) +{ + switch(event->type()) { + case TQEvent::MouseButtonPress: + { + singleton->mousePressed = TRUE; + + if (!ceData.widgetObjectTypes.contains("TQSlider")) + break; + + singleton->sliderActive = TRUE; + break; + } + + case TQEvent::MouseButtonRelease: + { + singleton->mousePressed = FALSE; + + if (!ceData.widgetObjectTypes.contains("TQSlider")) + break; + + singleton->sliderActive = FALSE; + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); + break; + } + + case TQEvent::Enter: + { + if (!ceData.widgetObjectTypes.contains("TQWidget")) + break; + + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); + break; + } + + case TQEvent::Leave: + { + if (!ceData.widgetObjectTypes.contains("TQWidget")) + break; + + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); + break; + } + + case TQEvent::MouseMove: + { + if ((!ceData.widgetObjectTypes.contains("TQWidget"))) + break; + + if ((!ceData.widgetObjectTypes.contains("TQScrollBar")) && (!ceData.widgetObjectTypes.contains("TQSlider"))) + break; + + singleton->mousePos = ((TQMouseEvent *) event)->pos(); + if (! singleton->mousePressed) { + singleton->hovering = TRUE; + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); + singleton->hovering = FALSE; + } + + break; + } + + default: + break; + } + + return TQMotifStyle::objectEventHandler(ceData, elementFlags, source, event); +} + + +/*! \reimp */ +int TQMotifPlusStyle::styleHint(StyleHint hint, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption &opt, + TQStyleHintReturn *returnData, + const TQWidget *widget) const +{ + int ret; + switch (hint) { + case SH_PopupMenu_MouseTracking: + ret = 1; + break; + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = (elementFlags & CEF_IsCheckable); + + if (checkable) + maxpmw = TQMAX(maxpmw, 15); + + ret = maxpmw; + break; + } + default: + ret = TQMotifStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); + break; + } + return ret; +} + + +#endif // TQT_NO_STYLE_MOTIFPLUS diff --git a/src/styles/tqmotifplusstyle.h b/src/styles/tqmotifplusstyle.h new file mode 100644 index 000000000..049609e9a --- /dev/null +++ b/src/styles/tqmotifplusstyle.h @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Definition of TQMotifPlusStyle class +** +** Created : 000727 +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQMOTIFPLUSSTYLE_H +#define TQMOTIFPLUSSTYLE_H + + +#ifndef QT_H +#include "tqmotifstyle.h" +#endif // QT_H + +#if !defined(TQT_NO_STYLE_MOTIFPLUS) || defined(QT_PLUGIN) + +#if defined(QT_PLUGIN) +#define Q_EXPORT_STYLE_MOTIFPLUS +#else +#define Q_EXPORT_STYLE_MOTIFPLUS TQ_EXPORT +#endif + +class Q_EXPORT_STYLE_MOTIFPLUS TQMotifPlusStyle : public TQMotifStyle +{ + TQ_OBJECT + +public: + TQMotifPlusStyle(bool hoveringHighlight = TRUE); + virtual ~TQMotifPlusStyle(); + + void polish(TQPalette &pal); + void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); + void unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); + + void applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); + void applicationUnPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); + + void drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default ) const; + + void drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + TQRect subRect(SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const; + + void drawComplexControl(ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how = Style_Default, +#ifdef Q_QDOC + SCFlags controls = SC_All, +#else + SCFlags controls = (uint)SC_All, +#endif + SCFlags active = SC_None, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + TQRect querySubControlMetrics(ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl subcontrol, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0) const; + + int pixelMetric(PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0) const; + + int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, + TQStyleHintReturn* = 0, const TQWidget * = 0) const; + + bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); + + +private: + bool useHoveringHighlight; +}; + + +#endif // TQT_NO_STYLE_MOTIFPLUS + +#endif // TQMOTIFPLUSSTYLE_H diff --git a/src/styles/tqmotifstyle.cpp b/src/styles/tqmotifstyle.cpp new file mode 100644 index 000000000..990b339a4 --- /dev/null +++ b/src/styles/tqmotifstyle.cpp @@ -0,0 +1,2416 @@ +/**************************************************************************** +** +** Implementation of Motif-like style class +** +** Created : 981231 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqmotifstyle.h" + +#if !defined(TQT_NO_STYLE_MOTIF) || defined(QT_PLUGIN) + +#include "tqpopupmenu.h" +#include "ntqapplication.h" +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqpixmap.h" +#include "tqpalette.h" +#include "tqwidget.h" +#include "tqpushbutton.h" +#include "tqscrollbar.h" +#include "tqtabbar.h" +#include "tqtabwidget.h" +#include "tqlistview.h" +#include "ntqsplitter.h" +#include "tqslider.h" +#include "tqcombobox.h" +#include "ntqdockwindow.h" +#include "ntqdockarea.h" +#include "tqprogressbar.h" +#include "tqimage.h" +#include + + + +// old constants that might still be useful... +static const int motifItemFrame = 2; // menu item frame width +static const int motifSepHeight = 2; // separator item height +static const int motifItemHMargin = 3; // menu item hor text margin +static const int motifItemVMargin = 2; // menu item ver text margin +static const int motifArrowHMargin = 6; // arrow horizontal margin +static const int motifTabSpacing = 12; // space between text and tab +static const int motifCheckMarkHMargin = 2; // horiz. margins of check mark +static const int motifCheckMarkSpace = 12; + + +/*! + \class TQMotifStyle tqmotifstyle.h + \brief The TQMotifStyle class provides Motif look and feel. + + \ingroup appearance + + This class implements the Motif look and feel. It closely + resembles the original Motif look as defined by the Open Group, + but with some minor improvements. The Motif style is TQt's default + GUI style on UNIX platforms. +*/ + +/*! + Constructs a TQMotifStyle. + + If \a useHighlightCols is FALSE (the default), the style will + polish the application's color palette to emulate the Motif way of + highlighting, which is a simple inversion between the base and the + text color. +*/ +TQMotifStyle::TQMotifStyle( bool useHighlightCols ) : TQCommonStyle() +{ + highlightCols = useHighlightCols; +} + +/*!\reimp +*/ +TQMotifStyle::~TQMotifStyle() +{ +} + +/*! + If \a arg is FALSE, the style will polish the application's color + palette to emulate the Motif way of highlighting, which is a + simple inversion between the base and the text color. + + The effect will show up the next time an application palette is + set via TQApplication::setPalette(). The current color palette of + the application remains unchanged. + + \sa TQStyle::polish() +*/ +void TQMotifStyle::setUseHighlightColors( bool arg ) +{ + highlightCols = arg; +} + +/*! + Returns TRUE if the style treats the highlight colors of the + palette in a Motif-like manner, which is a simple inversion + between the base and the text color; otherwise returns FALSE. The + default is FALSE. +*/ +bool TQMotifStyle::useHighlightColors() const +{ + return highlightCols; +} + +/*! \reimp */ + +void TQMotifStyle::polish( TQPalette& pal ) +{ + if ( pal.active().light() == pal.active().base() ) { + TQColor nlight = pal.active().light().dark(108 ); + pal.setColor( TQPalette::Active, TQColorGroup::Light, nlight ) ; + pal.setColor( TQPalette::Disabled, TQColorGroup::Light, nlight ) ; + pal.setColor( TQPalette::Inactive, TQColorGroup::Light, nlight ) ; + } + + if ( highlightCols ) + return; + + // force the ugly motif way of highlighting *sigh* + TQColorGroup disabled = pal.disabled(); + TQColorGroup active = pal.active(); + + pal.setColor( TQPalette::Active, TQColorGroup::Highlight, + active.text() ); + pal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, + active.base()); + pal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, + disabled.text() ); + pal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, + disabled.base() ); + pal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, + active.text() ); + pal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, + active.base() ); +} + +/*! + \reimp + \internal + Keep TQStyle::polish() visible. +*/ +void TQMotifStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ + TQStyle::polish(ceData, elementFlags, ptr); +} + +/*! + \reimp + \internal + Keep TQStyle::polish() visible. +*/ +void TQMotifStyle::applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ + TQStyle::applicationPolish(ceData, elementFlags, ptr); +} + +static void rot(TQPointArray& a, int n) +{ + TQPointArray r(a.size()); + for (int i = 0; i < (int)a.size(); i++) { + switch (n) { + case 1: r.setPoint(i,-a[i].y(),a[i].x()); break; + case 2: r.setPoint(i,-a[i].x(),-a[i].y()); break; + case 3: r.setPoint(i,a[i].y(),-a[i].x()); break; + } + } + a = r; +} + + +/*!\reimp +*/ +void TQMotifStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + bool dis = ! (flags & Style_Enabled); + bool act = flags & Style_Active; + + switch( pe ) { +#ifndef TQT_NO_LISTVIEW + case PE_CheckListExclusiveIndicator: { + TQCheckListItem *item = opt.checkListItem(); + TQListView *lv = item->listView(); + if(!item) + return; + + if ( item->isEnabled() ) + p->setPen( TQPen( cg.text() ) ); + else + p->setPen( TQPen( lv->palette().color( TQPalette::Disabled, TQColorGroup::Text ) ) ); + TQPointArray a; + + int cx = r.width()/2 - 1; + int cy = r.height()/2; + int e = r.width()/2 - 1; + for ( int i = 0; i < 3; i++ ) { //penWidth 2 doesn't quite work + a.setPoints( 4, cx-e, cy, cx, cy-e, cx+e, cy, cx, cy+e ); + p->drawPolygon( a ); + e--; + } + if ( item->isOn() ) { + if ( item->isEnabled() ) + p->setPen( TQPen( cg.text()) ); + else + p->setPen( TQPen( item->listView()->palette().color( TQPalette::Disabled, + TQColorGroup::Text ) ) ); + TQBrush saveBrush = p->brush(); + p->setBrush( cg.text() ); + e = e - 2; + a.setPoints( 4, cx-e, cy, cx, cy-e, cx+e, cy, cx, cy+e ); + p->drawPolygon( a ); + p->setBrush( saveBrush ); + } + break; } +#endif + case PE_ButtonCommand: + case PE_ButtonBevel: + case PE_ButtonTool: + case PE_HeaderSection: + qDrawShadePanel( p, r, cg, bool(flags & (Style_Down | Style_On )), + pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags), + &cg.brush(TQColorGroup::Button) ); + break; + + case PE_Indicator: { +#ifndef TQT_NO_BUTTON + bool on = flags & Style_On; + bool down = flags & Style_Down; + bool showUp = !( down ^ on ); + TQBrush fill = showUp || flags & Style_NoChange ? cg.brush( TQColorGroup::Button ) : cg.brush(TQColorGroup::Mid ); + if ( flags & Style_NoChange ) { + qDrawPlainRect( p, r, cg.text(), + 1, &fill ); + p->drawLine( r.x() + r.width() - 1, r.y(), + r.x(), r.y() + r.height() - 1); + } else + qDrawShadePanel( p, r, cg, !showUp, + pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags), &fill ); +#endif + break; + } + + case PE_ExclusiveIndicator: + { +#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2) + TQCOORD inner_pts[] = { // used for filling diamond + 2,r.height()/2, + r.width()/2,2, + r.width()-3,r.height()/2, + r.width()/2,r.height()-3 + }; + TQCOORD top_pts[] = { // top (^) of diamond + 0,r.height()/2, + r.width()/2,0, + r.width()-2,r.height()/2-1, + r.width()-3,r.height()/2-1, + r.width()/2,1, + 1,r.height()/2, + 2,r.height()/2, + r.width()/2,2, + r.width()-4,r.height()/2-1 + }; + TQCOORD bottom_pts[] = { // bottom (v) of diamond + 1,r.height()/2+1, + r.width()/2,r.height()-1, + r.width()-1,r.height()/2, + r.width()-2,r.height()/2, + r.width()/2,r.height()-2, + 2,r.height()/2+1, + 3,r.height()/2+1, + r.width()/2,r.height()-3, + r.width()-3,r.height()/2 + }; + bool on = flags & Style_On; + bool down = flags & Style_Down; + bool showUp = !(down ^ on ); + TQPointArray a( TQCOORDARRLEN(inner_pts), inner_pts ); + p->eraseRect( r ); + p->setPen( NoPen ); + p->setBrush( showUp ? cg.brush( TQColorGroup::Button ) : + cg.brush( TQColorGroup::Mid ) ); + a.translate( r.x(), r.y() ); + p->drawPolygon( a ); + p->setPen( showUp ? cg.light() : cg.dark() ); + p->setBrush( NoBrush ); + a.setPoints( TQCOORDARRLEN(top_pts), top_pts ); + a.translate( r.x(), r.y() ); + p->drawPolyline( a ); + p->setPen( showUp ? cg.dark() : cg.light() ); + a.setPoints( TQCOORDARRLEN(bottom_pts), bottom_pts ); + a.translate( r.x(), r.y() ); + p->drawPolyline( a ); + + break; + } + + case PE_ExclusiveIndicatorMask: + { + static TQCOORD inner_pts[] = { // used for filling diamond + 0,r.height()/2, + r.width()/2,0, + r.width()-1,r.height()/2, + r.width()/2,r.height()-1 + }; + TQPointArray a(TQCOORDARRLEN(inner_pts), inner_pts); + p->setPen(color1); + p->setBrush(color1); + a.translate(r.x(), r.y()); + p->drawPolygon(a); + break; + } + + case PE_ArrowUp: + case PE_ArrowDown: + case PE_ArrowRight: + case PE_ArrowLeft: + { + TQRect rect = r; + TQPointArray bFill; + TQPointArray bTop; + TQPointArray bBot; + TQPointArray bLeft; + bool vertical = pe == PE_ArrowUp || pe == PE_ArrowDown; + bool horizontal = !vertical; + int dim = rect.width() < rect.height() ? rect.width() : rect.height(); + int colspec = 0x0000; + + if ( dim < 2 ) + break; + + // adjust size and center (to fix rotation below) + if ( rect.width() > dim ) { + rect.setX( rect.x() + ((rect.width() - dim ) / 2) ); + rect.setWidth( dim ); + } + if ( rect.height() > dim ) { + rect.setY( rect.y() + ((rect.height() - dim ) / 2 )); + rect.setHeight( dim ); + } + + if ( dim > 3 ) { + if ( dim > 6 ) + bFill.resize( dim & 1 ? 3 : 4 ); + bTop.resize( (dim/2)*2 ); + bBot.resize( dim & 1 ? dim + 1 : dim ); + bLeft.resize( dim > 4 ? 4 : 2 ); + bLeft.putPoints( 0, 2, 0,0, 0,dim-1 ); + if ( dim > 4 ) + bLeft.putPoints( 2, 2, 1,2, 1,dim-3 ); + bTop.putPoints( 0, 4, 1,0, 1,1, 2,1, 3,1 ); + bBot.putPoints( 0, 4, 1,dim-1, 1,dim-2, 2,dim-2, 3,dim-2 ); + + for( int i=0; i 6 ) { // dim>6: must fill interior + bFill.putPoints( 0, 2, 1,dim-3, 1,2 ); + if ( dim & 1 ) // if size is an odd number + bFill.setPoint( 2, dim - 3, dim / 2 ); + else + bFill.putPoints( 2, 2, dim-4,dim/2-1, dim-4,dim/2 ); + } + } + else { + if ( dim == 3 ) { // 3x3 arrow pattern + bLeft.setPoints( 4, 0,0, 0,2, 1,1, 1,1 ); + bTop .setPoints( 2, 1,0, 1,0 ); + bBot .setPoints( 2, 1,2, 2,1 ); + } + else { // 2x2 arrow pattern + bLeft.setPoints( 2, 0,0, 0,1 ); + bTop .setPoints( 2, 1,0, 1,0 ); + bBot .setPoints( 2, 1,1, 1,1 ); + } + } + + // We use rot() and translate() as it is more efficient that + // matrix transformations on the painter, and because it still + // works with TQT_NO_TRANSFORMATIONS defined. + + if ( pe == PE_ArrowUp || pe == PE_ArrowLeft ) { + if ( vertical ) { + rot(bFill,3); + rot(bLeft,3); + rot(bTop,3); + rot(bBot,3); + bFill.translate( 0, rect.height() - 1 ); + bLeft.translate( 0, rect.height() - 1 ); + bTop.translate( 0, rect.height() - 1 ); + bBot.translate( 0, rect.height() - 1 ); + } else { + rot(bFill,2); + rot(bLeft,2); + rot(bTop,2); + rot(bBot,2); + bFill.translate( rect.width() - 1, rect.height() - 1 ); + bLeft.translate( rect.width() - 1, rect.height() - 1 ); + bTop.translate( rect.width() - 1, rect.height() - 1 ); + bBot.translate( rect.width() - 1, rect.height() - 1 ); + } + if ( flags & Style_Down ) + colspec = horizontal ? 0x2334 : 0x2343; + else + colspec = horizontal ? 0x1443 : 0x1434; + } else { + if ( vertical ) { + rot(bFill,1); + rot(bLeft,1); + rot(bTop,1); + rot(bBot,1); + bFill.translate( rect.width() - 1, 0 ); + bLeft.translate( rect.width() - 1, 0 ); + bTop.translate( rect.width() - 1, 0 ); + bBot.translate( rect.width() - 1, 0 ); + } + if ( flags & Style_Down ) + colspec = horizontal ? 0x2443 : 0x2434; + else + colspec = horizontal ? 0x1334 : 0x1343; + } + bFill.translate( rect.x(), rect.y() ); + bLeft.translate( rect.x(), rect.y() ); + bTop.translate( rect.x(), rect.y() ); + bBot.translate( rect.x(), rect.y() ); + + TQColor *cols[5]; + if ( flags & Style_Enabled ) { + cols[0] = 0; + cols[1] = (TQColor *)&cg.button(); + cols[2] = (TQColor *)&cg.mid(); + cols[3] = (TQColor *)&cg.light(); + cols[4] = (TQColor *)&cg.dark(); + } else { + cols[0] = 0; + cols[1] = (TQColor *)&cg.button(); + cols[2] = (TQColor *)&cg.button(); + cols[3] = (TQColor *)&cg.button(); + cols[4] = (TQColor *)&cg.button(); + } + +#define CMID *cols[ (colspec>>12) & 0xf ] +#define CLEFT *cols[ (colspec>>8) & 0xf ] +#define CTOP *cols[ (colspec>>4) & 0xf ] +#define CBOT *cols[ colspec & 0xf ] + + TQPen savePen = p->pen(); + TQBrush saveBrush = p->brush(); + TQPen pen( NoPen ); + TQBrush brush = cg.brush( flags & Style_Enabled ? TQColorGroup::Button : + TQColorGroup::Mid ); + p->setPen( pen ); + p->setBrush( brush ); + p->drawPolygon( bFill ); + p->setBrush( NoBrush ); + + p->setPen( CLEFT ); + p->drawLineSegments( bLeft ); + p->setPen( CTOP ); + p->drawLineSegments( bTop ); + p->setPen( CBOT ); + p->drawLineSegments( bBot ); + + p->setBrush( saveBrush ); + p->setPen( savePen ); +#undef CMID +#undef CLEFT +#undef CTOP +#undef CBOT + break; + } + + case PE_SpinWidgetPlus: + case PE_SpinWidgetMinus: + { + p->save(); + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ); + TQRect br; + br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, + r.height() - fw*2 ); + + if ( flags & Style_Sunken ) + p->fillRect( r, cg.brush( TQColorGroup::Dark ) ); + else + p->fillRect( r, cg.brush( TQColorGroup::Button ) ); + + p->setPen( cg.buttonText() ); + p->setBrush( cg.buttonText() ); + + int length; + int x = r.x(), y = r.y(), w = r.width(), h = r.height(); + if ( w <= 8 || h <= 6 ) + length = TQMIN( w-2, h-2 ); + else + length = TQMIN( 2*w / 3, 2*h / 3 ); + + if ( !(length & 1) ) + length -=1; + int xmarg = ( w - length ) / 2; + int ymarg = ( h - length ) / 2; + + p->drawLine( x + xmarg, ( y + h / 2 - 1 ), + x + xmarg + length - 1, ( y + h / 2 - 1 ) ); + if ( pe == PE_SpinWidgetPlus ) + p->drawLine( ( x+w / 2 ) - 1, y + ymarg, + ( x+w / 2 ) - 1, y + ymarg + length - 1 ); + p->restore(); + break; + } + + case PE_SpinWidgetUp: + case PE_SpinWidgetDown: + { + p->save(); + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ); + TQRect br; + br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, + r.height() - fw*2 ); + if ( flags & Style_Sunken ) + p->fillRect( br, cg.brush( TQColorGroup::Mid ) ); + else + p->fillRect( br, cg.brush( TQColorGroup::Button ) ); + + int x = r.x(), y = r.y(), w = r.width(), h = r.height(); + int sw = w-4; + if ( sw < 3 ) + return; + else if ( !(sw & 1) ) + sw--; + sw -= ( sw / 7 ) * 2; // Empty border + int sh = sw/2 + 2; // Must have empty row at foot of arrow + + int sx = x + w / 2 - sw / 2 - 1; + int sy = y + h / 2 - sh / 2 - 1; + + TQPointArray a; + if ( pe == PE_SpinWidgetDown ) + a.setPoints( 3, 0, 1, sw-1, 1, sh-2, sh-1 ); + else + a.setPoints( 3, 0, sh-1, sw-1, sh-1, sh-2, 1 ); + int bsx = 0; + int bsy = 0; + if ( flags & Style_Sunken ) { + bsx = pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags); + bsy = pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags); + } + p->translate( sx + bsx, sy + bsy ); + p->setPen( cg.buttonText() ); + p->setBrush( cg.buttonText() ); + p->drawPolygon( a ); + p->restore(); + break; + } + + case PE_DockWindowHandle: + { + p->save(); + p->translate( r.x(), r.y() ); + + TQColor dark( cg.dark() ); + TQColor light( cg.light() ); + unsigned int i; + if ( flags & Style_Horizontal ) { + int h = r.height(); + if ( h > 6 ) { + if ( flags & Style_On ) + p->fillRect( 1, 1, 8, h - 2, cg.highlight() ); + TQPointArray a( 2 * ((h-6)/3) ); + int y = 3 + (h%3)/2; + p->setPen( dark ); + p->drawLine( 8, 1, 8, h-2 ); + for( i=0; 2*i < a.size(); i ++ ) { + a.setPoint( 2*i, 5, y+1+3*i ); + a.setPoint( 2*i+1, 2, y+2+3*i ); + } + p->drawPoints( a ); + p->setPen( light ); + p->drawLine( 9, 1, 9, h-2 ); + for( i=0; 2*i < a.size(); i++ ) { + a.setPoint( 2*i, 4, y+3*i ); + a.setPoint( 2*i+1, 1, y+1+3*i ); + } + p->drawPoints( a ); + // if ( drawBorder ) { + // p->setPen( TQPen( TQt::darkGray ) ); + // p->drawLine( 0, r.height() - 1, + // tbExtent, r.height() - 1 ); + // } + } + } else { + int w = r.width(); + if ( w > 6 ) { + if ( flags & Style_On ) + p->fillRect( 1, 1, w - 2, 9, cg.highlight() ); + TQPointArray a( 2 * ((w-6)/3) ); + + int x = 3 + (w%3)/2; + p->setPen( dark ); + p->drawLine( 1, 8, w-2, 8 ); + for( i=0; 2*i < a.size(); i ++ ) { + a.setPoint( 2*i, x+1+3*i, 6 ); + a.setPoint( 2*i+1, x+2+3*i, 3 ); + } + p->drawPoints( a ); + p->setPen( light ); + p->drawLine( 1, 9, w-2, 9 ); + for( i=0; 2*i < a.size(); i++ ) { + a.setPoint( 2*i, x+3*i, 5 ); + a.setPoint( 2*i+1, x+1+3*i, 2 ); + } + p->drawPoints( a ); + // if ( drawBorder ) { + // p->setPen( TQPen( TQt::darkGray ) ); + // p->drawLine( r.width() - 1, 0, + // r.width() - 1, tbExtent ); + // } + } + } + p->restore(); + break; + } + + case PE_Splitter: + if (flags & Style_Horizontal) + flags &= ~Style_Horizontal; + else + flags |= Style_Horizontal; + // fall through intended + + case PE_DockWindowResizeHandle: + { + const int motifOffset = 10; + int sw = pixelMetric( PM_SplitterWidth, ceData, elementFlags ); + if ( flags & Style_Horizontal ) { + TQCOORD yPos = r.y() + r.height() / 2; + TQCOORD kPos = r.width() - motifOffset - sw; + TQCOORD kSize = sw - 2; + + qDrawShadeLine( p, 0, yPos, kPos, yPos, cg ); + qDrawShadePanel( p, kPos, yPos - sw / 2 + 1, kSize, kSize, + cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) ); + qDrawShadeLine( p, kPos + kSize - 1, yPos, r.width(), yPos, cg ); + } else { + TQCOORD xPos = r.x() + r.width() / 2; + TQCOORD kPos = motifOffset; + TQCOORD kSize = sw - 2; + + qDrawShadeLine( p, xPos, kPos + kSize - 1, xPos, r.height(), cg ); + qDrawShadePanel( p, xPos - sw / 2 + 1, kPos, kSize, kSize, cg, + FALSE, 1, &cg.brush( TQColorGroup::Button ) ); + qDrawShadeLine( p, xPos, 0, xPos, kPos, cg ); + } + break; + } + + case PE_CheckMark: + { + const int markW = 6; + const int markH = 6; + int posX = r.x() + ( r.width() - markW ) / 2 - 1; + int posY = r.y() + ( r.height() - markH ) / 2; + int dfw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags); + + if (dfw < 2) { + // Could do with some optimizing/caching... + TQPointArray a( 7*2 ); + int i, xx, yy; + xx = posX; + yy = 3 + posY; + for ( i=0; i<3; i++ ) { + a.setPoint( 2*i, xx, yy ); + a.setPoint( 2*i+1, xx, yy+2 ); + xx++; yy++; + } + yy -= 2; + for ( i=3; i<7; i++ ) { + a.setPoint( 2*i, xx, yy ); + a.setPoint( 2*i+1, xx, yy+2 ); + xx++; yy--; + } + if ( ! (flags & Style_Enabled) && ! (flags & Style_On) ) { + int pnt; + p->setPen( cg.highlightedText() ); + TQPoint offset(1,1); + for ( pnt = 0; pnt < (int)a.size(); pnt++ ) + a[pnt] += offset; + p->drawLineSegments( a ); + for ( pnt = 0; pnt < (int)a.size(); pnt++ ) + a[pnt] -= offset; + } + p->setPen( cg.text() ); + p->drawLineSegments( a ); + + qDrawShadePanel( p, posX-2, posY-2, markW+4, markH+6, cg, TRUE, dfw); + } else + qDrawShadePanel( p, posX, posY, markW, markH, cg, TRUE, dfw, + &cg.brush( TQColorGroup::Mid ) ); + + break; + } + + case PE_ScrollBarSubLine: + drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), + p, ceData, elementFlags, r, cg, Style_Enabled | flags); + break; + + case PE_ScrollBarAddLine: + drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), + p, ceData, elementFlags, r, cg, Style_Enabled | flags); + break; + + case PE_ScrollBarSubPage: + case PE_ScrollBarAddPage: + p->fillRect(r, cg.brush(TQColorGroup::Mid)); + break; + + case PE_ScrollBarSlider: + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, + (flags | Style_Raised) & ~Style_Down); + break; + + case PE_ProgressBarChunk: + p->fillRect( r.x(), r.y() + 2, r.width() - 2, + r.height() - 4, cg.brush(TQColorGroup::Highlight)); + break; + + case PE_PanelScrollBar: + qDrawShadePanel(p, r, cg, TRUE, + pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags), + &cg.brush(TQColorGroup::Mid)); + break; + + case PE_MenuItemIndicatorFrame: + { + // Draw nothing + break; + } + + case PE_MenuItemIndicatorIconFrame: + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r ); + int xvis = vrect.x(); + + qDrawShadePanel( p, xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) ); + break; + } + + case PE_MenuItemIndicatorCheck: + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r ); + int xvis = vrect.x(); + int mw = checkcol; + int mh = h - 2*motifItemFrame; + + SFlags cflags = Style_Default; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; + + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, TQRect(xvis, y+motifItemFrame, mw, mh), cg, cflags); + break; + } + + default: + TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); + break; + } +} + + +/*!\reimp +*/ +void TQMotifStyle::drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch( element ) { + case CE_PushButton: + { +#ifndef TQT_NO_PUSHBUTTON + int diw, x1, y1, x2, y2; + TQColorGroup newCg = cg; + p->setPen( cg.foreground() ); + p->setBrush( TQBrush( cg.button(), NoBrush ) ); + diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags ); + r.coords( &x1, &y1, &x2, &y2 ); + if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) { + x1 += diw; + y1 += diw; + x2 -= diw; + y2 -= diw; + } + TQBrush fill; + if ( elementFlags & CEF_IsDown ) + fill = newCg.brush( TQColorGroup::Mid ); + else if ( elementFlags & CEF_IsOn ) + fill = TQBrush( newCg.mid(), Dense4Pattern ); + else + fill = newCg.brush( TQColorGroup::Button ); + + newCg.setBrush( TQColorGroup::Button, fill ); + if ( elementFlags & CEF_IsDefault ) { + if ( diw == 0 ) { + TQPointArray a; + a.setPoints( 9, + x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1, + x2-1, y1+1, x2-1, y2-1, x1+1, y2-1, x1+1, y1+1 ); + p->setPen( newCg.shadow() ); + p->drawPolygon( a ); + x1 += 2; + y1 += 2; + x2 -= 2; + y2 -= 2; + } else { + qDrawShadePanel( p, r, newCg, TRUE ); + } + } + if ( !( elementFlags & CEF_IsFlat ) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) { + TQRect tmp( x1, y1, x2 - x1 + 1, y2 - y1 + 1 ); + SFlags flags = Style_Default; + if ( elementFlags & CEF_IsOn ) + flags |= Style_On; + if ( elementFlags & CEF_IsDown ) + flags |= Style_Down; + p->save(); + p->setBrushOrigin( -ceData.bgOffset.x(), + -ceData.bgOffset.y() ); + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, + tmp, newCg, + flags ); + p->restore(); + } + if ( p->brush().style() != NoBrush ) + p->setBrush( NoBrush ); +#endif + break; + } + + case CE_TabBarTab: + { +#ifndef TQT_NO_TABBAR + if ( (elementFlags & CEF_UseGenericParameters) || !(elementFlags & CEF_HasParentWidget) || !opt.tab() ) + break; + + const TQTab * t = opt.tab(); + + int dfw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); + bool selected = flags & Style_Selected; + int o = dfw > 1 ? 1 : 0; + bool lastTab = FALSE; + + TQRect r2( r ); + if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) { + if ( styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignRight && + ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1 ) + lastTab = TRUE; + + if ( o ) { + p->setPen( ceData.colorGroup.light() ); + p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); + p->setPen( ceData.colorGroup.light() ); + p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 ); + if ( r2.left() == 0 ) + p->drawPoint( ceData.rect.bottomLeft() ); + } + else { + p->setPen( ceData.colorGroup.light() ); + p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); + } + + if ( selected ) { + p->fillRect( TQRect( r2.left()+1, r2.bottom()-o, r2.width()-3, 2), + ceData.palette.active().brush( TQColorGroup::Background )); + p->setPen( ceData.colorGroup.background() ); + // p->drawLine( r2.left()+1, r2.bottom(), r2.right()-2, r2.bottom() ); + // if (o) + // p->drawLine( r2.left()+1, r2.bottom()-1, r2.right()-2, r2.bottom()-1 ); + p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top()+2 ); + p->setPen( ceData.colorGroup.light() ); + } else { + p->setPen( ceData.colorGroup.light() ); + r2.setRect( r2.left() + 2, r2.top() + 2, + r2.width() - 4, r2.height() - 2 ); + } + + p->drawLine( r2.left(), r2.bottom()-1, r2.left(), r2.top() + 2 ); + p->drawPoint( r2.left()+1, r2.top() + 1 ); + p->drawLine( r2.left()+2, r2.top(), + r2.right() - 2, r2.top() ); + p->drawPoint( r2.left(), r2.bottom()); + + if ( o ) { + p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top() + 2 ); + p->drawLine( r2.left()+2, r2.top()+1, + r2.right() - 2, r2.top()+1 ); + } + + p->setPen( ceData.colorGroup.dark() ); + p->drawLine( r2.right() - 1, r2.top() + 2, + r2.right() - 1, r2.bottom() - 1 + (selected ? o : -o)); + if ( o ) { + p->drawPoint( r2.right() - 1, r2.top() + 1 ); + p->drawLine( r2.right(), r2.top() + 2, r2.right(), + r2.bottom() - + (selected ? (lastTab ? 0:1):1+o)); + p->drawPoint( r2.right() - 1, r2.top() + 1 ); + } + } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) { + if ( styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignLeft && + ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1 ) + lastTab = TRUE; + if ( selected ) { + p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1), + ceData.palette.active().brush( TQColorGroup::Background )); + p->setPen( ceData.colorGroup.background() ); + // p->drawLine( r2.left()+1, r2.top(), r2.right()-2, r2.top() ); + p->drawLine( r2.left()+1, r2.top(), r2.left()+1, r2.bottom()-2 ); + p->setPen( ceData.colorGroup.dark() ); + } else { + p->setPen( ceData.colorGroup.dark() ); + p->drawLine( r2.left(), r2.top(), r2.right(), r2.top() ); + p->drawLine( r2.left() + 1, r2.top() + 1, + r2.right() - (lastTab ? 0 : 2), + r2.top() + 1 ); + r2.setRect( r2.left() + 2, r2.top(), + r2.width() - 4, r2.height() - 2 ); + } + + p->drawLine( r2.right() - 1, r2.top(), + r2.right() - 1, r2.bottom() - 2 ); + p->drawPoint( r2.right() - 2, r2.bottom() - 2 ); + p->drawLine( r2.right() - 2, r2.bottom() - 1, + r2.left() + 1, r2.bottom() - 1 ); + p->drawPoint( r2.left() + 1, r2.bottom() - 2 ); + + if (dfw > 1) { + p->drawLine( r2.right(), r2.top(), + r2.right(), r2.bottom() - 1 ); + p->drawPoint( r2.right() - 1, r2.bottom() - 1 ); + p->drawLine( r2.right() - 1, r2.bottom(), + r2.left() + 2, r2.bottom() ); + } + + p->setPen( ceData.colorGroup.light() ); + p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2), + r2.left(), r2.bottom() - 2 ); + p->drawLine( r2.left() + 1, r2.top() + (selected ? 0 : 2), + r2.left() + 1, r2.bottom() - 3 ); + + } else { + TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); + } +#endif + break; + } + + case CE_ProgressBarGroove: + qDrawShadePanel(p, r, cg, TRUE, 2); + break; + + case CE_ProgressBarLabel: + { +#ifndef TQT_NO_PROGRESSBAR + const int unit_width = pixelMetric( PM_ProgressBarChunkWidth, ceData, elementFlags, widget ); + int u = r.width() / unit_width; + int p_v = ceData.currentStep; + int t_s = ceData.totalSteps; + if ( u > 0 && ceData.currentStep >= INT_MAX / u && t_s >= u ) { + // scale down to something usable. + p_v /= u; + t_s /= u; + } + if ( ceData.percentageVisible && ceData.totalSteps ) { + int nu = ( u * p_v + t_s/2 ) / t_s; + int x = unit_width * nu; + if ((elementFlags & CEF_IndicatorFollowsStyle) || (elementFlags & CEF_CenterIndicator)) { + p->setPen( cg.highlightedText() ); + p->setClipRect( r.x(), r.y(), x, r.height() ); + p->drawText( r, AlignCenter | SingleLine, ceData.progressText ); + + if ( ceData.currentStep != ceData.totalSteps ) { + p->setClipRect( r.x() + x, r.y(), r.width() - x, r.height() ); + p->setPen( cg.highlight() ); + p->drawText( r, AlignCenter | SingleLine, ceData.progressText ); + } + } else { + p->setPen( cg.text() ); + p->drawText( r, AlignCenter | SingleLine, ceData.progressText ); + } + } +#endif + break; + } + +#ifndef TQT_NO_POPUPMENU + case CE_PopupMenuItem: + { + if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault()) + break; + + TQMenuItem *mi = opt.menuItem(); + if ( !mi ) + break; + + int tab = opt.tabWidth(); + int maxpmw = opt.maxIconWidth(); + bool dis = ! (flags & Style_Enabled); + bool checkable = (elementFlags & CEF_IsCheckable); + bool act = flags & Style_Active; + int x, y, w, h; + + r.rect(&x, &y, &w, &h); + + if ( checkable ) + maxpmw = TQMAX( maxpmw, motifCheckMarkSpace ); + + int checkcol = maxpmw; + + if ( mi && mi->isSeparator() ) { // draw separator + p->setPen( cg.dark() ); + p->drawLine( x, y, x+w, y ); + p->setPen( cg.light() ); + p->drawLine( x, y+1, x+w, y+1 ); + return; + } + + int pw = motifItemFrame; + + if ( act && !dis ) { // active item frame + if (pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) > 1) + qDrawShadePanel( p, x, y, w, h, cg, FALSE, pw, + &cg.brush( TQColorGroup::Button ) ); + else + qDrawShadePanel( p, x+1, y+1, w-2, h-2, cg, TRUE, 1, + &cg.brush( TQColorGroup::Button ) ); + } + else // incognito frame + p->fillRect(x, y, w, h, cg.brush( TQColorGroup::Button )); + + if ( !mi ) + return; + + TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r ); + int xvis = vrect.x(); + if ( mi->isChecked() ) { + if ( mi->iconSet() ) { + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); + } + } else if ( !act ) { + p->fillRect(xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame, + cg.brush( TQColorGroup::Button )); + } + + if ( mi->iconSet() ) { // draw iconset + TQIconSet::Mode mode = TQIconSet::Normal; // no disabled icons in Motif + if (act && !dis ) + mode = TQIconSet::Active; + TQPixmap pixmap; + if ( checkable && mi->isChecked() ) + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); + else + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); + + int pixw = pixmap.width(); + int pixh = pixmap.height(); + TQRect pmr( 0, 0, pixw, pixh ); + pmr.moveCenter( vrect.center() ); + p->setPen( cg.text() ); + p->drawPixmap( pmr.topLeft(), pixmap ); + + } else if ( checkable ) { // just "checking"... + if ( mi->isChecked() ) { + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); + } + } + + + p->setPen( cg.buttonText() ); + + TQColor discol; + if ( dis ) { + discol = cg.text(); + p->setPen( discol ); + } + + int xm = motifItemFrame + checkcol + motifItemHMargin; + + vrect = visualRect( TQRect( x+xm, y+motifItemVMargin, w-xm-tab, h-2*motifItemVMargin ), r ); + xvis = vrect.x(); + if ( mi->custom() ) { + int m = motifItemVMargin; + p->save(); + mi->custom()->paint( p, cg, act, !dis, + xvis, y+m, w-xm-tab+1, h-2*m ); + p->restore(); + } + TQString s = mi->text(); + if ( !s.isNull() ) { // draw text + int t = s.find( '\t' ); + int m = motifItemVMargin; + int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; + text_flags |= (TQApplication::reverseLayout() ? AlignRight : AlignLeft ); + if ( t >= 0 ) { // draw tab text + TQRect vr = visualRect( TQRect( x+w-tab-motifItemHMargin-motifItemFrame, + y+motifItemVMargin, tab, h-2*motifItemVMargin ), r ); + int xv = vr.x(); + p->drawText( xv, y+m, tab, h-2*m, text_flags, s.mid( t+1 ) ); + s = s.left( t ); + } + p->drawText( xvis, y+m, w-xm-tab+1, h-2*m, text_flags, s, t ); + } else if ( mi->pixmap() ) { // draw pixmap + TQPixmap *pixmap = mi->pixmap(); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( OpaqueMode ); + p->drawPixmap( xvis, y+motifItemFrame, *pixmap ); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( TransparentMode ); + } + if ( mi->popup() ) { // draw sub menu arrow + int dim = (h-2*motifItemFrame) / 2; + TQStyle::PrimitiveElement arrow = (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight); + TQRect vr = visualRect( TQRect(x+w - motifArrowHMargin - motifItemFrame - dim, + y+h/2-dim/2, dim, dim), r ); + if ( act ) + drawPrimitive(arrow, p, ceData, elementFlags, vr, cg, + (Style_Down | + (dis ? Style_Default : Style_Enabled)) ); + else + drawPrimitive(arrow, p, ceData, elementFlags, vr, cg, + (dis ? Style_Default : Style_Enabled)); + } + + break; + } +#endif // TQT_NO_POPUPMENU + + case CE_MenuBarItem: + { + if ( flags & Style_Active ) // active item + qDrawShadePanel( p, r, cg, FALSE, motifItemFrame, + &cg.brush(TQColorGroup::Button) ); + else // other item + p->fillRect( r, cg.brush(TQColorGroup::Button) ); + TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); + break; + } + + default: + TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); + break; + } +} + +static int get_combo_extra_width( int h, int w, int *return_awh=0 ) +{ + int awh, + tmp; + if ( h < 8 ) { + awh = 6; + } else if ( h < 14 ) { + awh = h - 2; + } else { + awh = h/2; + } + tmp = (awh * 3) / 2; + if ( tmp > w / 2 ) { + awh = w / 2 - 3; + tmp = w / 2 + 3; + } + + if ( return_awh ) + *return_awh = awh; + + return tmp; +} + +static void get_combo_parameters( const TQRect &r, + int &ew, int &awh, int &ax, + int &ay, int &sh, int &dh, + int &sy ) +{ + ew = get_combo_extra_width( r.height(), r.width(), &awh ); + + sh = (awh+3)/4; + if ( sh < 3 ) + sh = 3; + dh = sh/2 + 1; + + ay = r.y() + (r.height()-awh-sh-dh)/2; + if ( ay < 0 ) { + //panic mode + ay = 0; + sy = r.height(); + } else { + sy = ay+awh+dh; + } + ax = r.x() + r.width() - ew; + ax += (ew-awh)/2; +} + +/*!\reimp +*/ +void TQMotifStyle::drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + SCFlags sub, + SCFlags subActive, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch ( control ) { + case CC_SpinWidget: { + SCFlags drawSub = SC_None; + if ( sub & SC_SpinWidgetFrame ) + qDrawShadePanel( p, r, cg, TRUE, + pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) ); + + if ( sub & SC_SpinWidgetUp || sub & SC_SpinWidgetDown ) { + if ( sub & SC_SpinWidgetUp ) + drawSub |= SC_SpinWidgetUp; + if ( sub & SC_SpinWidgetDown ) + drawSub |= SC_SpinWidgetDown; + + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, + drawSub, subActive, opt, widget ); + } + break; } + + case CC_Slider: + { +#ifndef TQT_NO_SLIDER + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, + opt, widget), + handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, + opt, widget); + + if ((sub & SC_SliderGroove) && groove.isValid()) { + qDrawShadePanel( p, groove, cg, TRUE, 2, + &cg.brush( TQColorGroup::Mid ) ); + + + if ( flags & Style_HasFocus ) { + TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg ); + } + } + + if (( sub & SC_SliderHandle ) && handle.isValid()) { + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, handle, cg ); + + if ( ceData.orientation == Horizontal ) { + TQCOORD mid = handle.x() + handle.width() / 2; + qDrawShadeLine( p, mid, handle.y(), mid, + handle.y() + handle.height() - 2, + cg, TRUE, 1); + } else { + TQCOORD mid = handle.y() + handle.height() / 2; + qDrawShadeLine( p, handle.x(), mid, + handle.x() + handle.width() - 2, mid, + cg, TRUE, 1); + } + } + + if ( sub & SC_SliderTickmarks ) + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, + SC_SliderTickmarks, subActive, + opt, widget ); +#endif + break; + } + + case CC_ComboBox: +#ifndef TQT_NO_COMBOBOX + if ( sub & SC_ComboBoxArrow ) { + const TQComboBox * cb = (const TQComboBox *) widget; + int awh, ax, ay, sh, sy, dh, ew; + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, cb); + + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags ); + TQRect ar = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, + opt, cb ), ceData, elementFlags ); + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags | Style_Enabled ); + + TQRect tr = r; + tr.addCoords( fw, fw, -fw, -fw ); + get_combo_parameters( tr, ew, awh, ax, ay, sh, dh, sy ); + + // draws the shaded line under the arrow + p->setPen( cg.light() ); + p->drawLine( ar.x(), sy, ar.x()+awh-1, sy ); + p->drawLine( ar.x(), sy, ar.x(), sy+sh-1 ); + p->setPen( cg.dark() ); + p->drawLine( ar.x()+1, sy+sh-1, ar.x()+awh-1, sy+sh-1 ); + p->drawLine( ar.x()+awh-1, sy+1, ar.x()+awh-1, sy+sh-1 ); + + if ( cb->hasFocus() ) { + TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, cb ), ceData, elementFlags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg ); + } + } + + if ( sub & SC_ComboBoxEditField ) { + TQComboBox * cb = (TQComboBox *) widget; + if ( cb->editable() ) { + TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, + SC_ComboBoxEditField, cb ), ceData, elementFlags ); + er.addCoords( -1, -1, 1, 1); + qDrawShadePanel( p, er, cg, TRUE, 1, + &cg.brush( TQColorGroup::Button )); + } + } +#endif + p->setPen(cg.buttonText()); + break; + + case CC_ScrollBar: + { + if (sub == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | SC_ScrollBarAddPage | + SC_ScrollBarSubPage | SC_ScrollBarFirst | SC_ScrollBarLast | + SC_ScrollBarSlider)) + drawPrimitive(PE_PanelScrollBar, p, ceData, elementFlags, ceData.rect, cg, + ((ceData.orientation == TQt::Horizontal) ? + Style_Horizontal : Style_Default)); + + TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, sub, + subActive, opt, widget); + break; + } + +#ifndef TQT_NO_LISTVIEW + case CC_ListView: + { + if ( sub & SC_ListView ) { + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget ); + } + if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) { + if (opt.isDefault()) + break; + + TQListViewItem *item = opt.listViewItem(); + TQListViewItem *child = item->firstChild(); + + int y = r.y(); + int c; + TQPointArray dotlines; + if ( subActive == (uint)SC_All && sub == SC_ListViewExpand ) { + c = 2; + dotlines.resize(2); + dotlines[0] = TQPoint( r.right(), r.top() ); + dotlines[1] = TQPoint( r.right(), r.bottom() ); + } else { + int linetop = 0, linebot = 0; + // each branch needs at most two lines, ie. four end points + dotlines.resize( item->childCount() * 4 ); + c = 0; + + // skip the stuff above the exposed rectangle + while ( child && y + child->height() <= 0 ) { + y += child->totalHeight(); + child = child->nextSibling(); + } + + int bx = r.width() / 2; + + // paint stuff in the magical area + TQListView* v = item->listView(); + while ( child && y < r.height() ) { + if (child->isVisible()) { + int lh; + if ( !item->multiLinesEnabled() ) + lh = child->height(); + else + lh = p->fontMetrics().height() + 2 * v->itemMargin(); + lh = TQMAX( lh, TQApplication::globalStrut().height() ); + if ( lh % 2 > 0 ) + lh++; + linebot = y + lh/2; + if ( (child->isExpandable() || child->childCount()) && + (child->height() > 0) ) { + // needs a box + p->setPen( cg.text() ); + p->drawRect( bx-4, linebot-4, 9, 9 ); + TQPointArray a; + if ( child->isOpen() ) + a.setPoints( 3, bx-2, linebot-2, + bx, linebot+2, + bx+2, linebot-2 ); //RightArrow + else + a.setPoints( 3, bx-2, linebot-2, + bx+2, linebot, + bx-2, linebot+2 ); //DownArrow + p->setBrush( cg.text() ); + p->drawPolygon( a ); + p->setBrush( NoBrush ); + // dotlinery + dotlines[c++] = TQPoint( bx, linetop ); + dotlines[c++] = TQPoint( bx, linebot - 5 ); + dotlines[c++] = TQPoint( bx + 5, linebot ); + dotlines[c++] = TQPoint( r.width(), linebot ); + linetop = linebot + 5; + } else { + // just dotlinery + dotlines[c++] = TQPoint( bx+1, linebot ); + dotlines[c++] = TQPoint( r.width(), linebot ); + } + y += child->totalHeight(); + } + child = child->nextSibling(); + } + + // Expand line height to edge of rectangle if there's any + // visible child below + while ( child && child->height() <= 0) + child = child->nextSibling(); + if ( child ) + linebot = r.height(); + + if ( linetop < linebot ) { + dotlines[c++] = TQPoint( bx, linetop ); + dotlines[c++] = TQPoint( bx, linebot ); + } + } + + int line; // index into dotlines + p->setPen( cg.text() ); + if ( sub & SC_ListViewBranch ) for( line = 0; line < c; line += 2 ) { + p->drawLine( dotlines[line].x(), dotlines[line].y(), + dotlines[line+1].x(), dotlines[line+1].y() ); + } + } + + break; + } +#endif // TQT_NO_LISTVIEW + + default: + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, + sub, subActive, opt, widget ); + } +} + + +/*! \reimp */ +int TQMotifStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const +{ + int ret; + + switch( metric ) { + case PM_ButtonDefaultIndicator: + ret = 3; + break; + + case PM_ButtonShiftHorizontal: + case PM_ButtonShiftVertical: + ret = 0; + break; + + case PM_SplitterWidth: + ret = TQMAX( 10, TQApplication::globalStrut().width() ); + break; + + case PM_SliderLength: + ret = 30; + break; + + case PM_SliderThickness: + ret = 24; + break; + + case PM_SliderControlThickness: + { +#ifndef TQT_NO_SLIDER + const TQSlider * sl = (const TQSlider *) widget; + int space = (sl->orientation() == Horizontal) ? sl->height() + : sl->width(); + int ticks = sl->tickmarks(); + int n = 0; + if ( ticks & TQSlider::Above ) n++; + if ( ticks & TQSlider::Below ) n++; + if ( !n ) { + ret = space; + break; + } + + int thick = 6; // Magic constant to get 5 + 16 + 5 + + space -= thick; + //### the two sides may be unequal in size + if ( space > 0 ) + thick += (space * 2) / (n + 2); + ret = thick; +#endif + break; + } + + case PM_SliderSpaceAvailable: + { +#ifndef TQT_NO_SLIDER + const TQSlider * sl = (const TQSlider *) widget; + if ( sl->orientation() == Horizontal ) + ret = sl->width() - pixelMetric( PM_SliderLength, ceData, elementFlags, sl ) - 6; + else + ret = sl->height() - pixelMetric( PM_SliderLength, ceData, elementFlags, sl ) - 6; +#endif + break; + } + + case PM_DockWindowHandleExtent: + ret = 9; + break; + + case PM_ProgressBarChunkWidth: + ret = 1; + break; + + case PM_ExclusiveIndicatorWidth: + case PM_ExclusiveIndicatorHeight: + ret = 13; + break; + + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = motifItemFrame; + break; + + default: + ret = TQCommonStyle::pixelMetric( metric, ceData, elementFlags, widget ); + break; + } + return ret; +} + + +/*!\reimp +*/ +TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sc, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch ( control ) { + case CC_SpinWidget: { + if ( elementFlags & CEF_UseGenericParameters ) + return TQRect(); + int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, 0 ); + TQSize bs; + bs.setHeight( ceData.rect.height()/2 ); + if ( bs.height() < 8 ) + bs.setHeight( 8 ); + bs.setWidth( TQMIN( bs.height() * 8 / 5, ceData.rect.width() / 4 ) ); // 1.6 -approximate golden mean + bs = bs.expandedTo( TQApplication::globalStrut() ); + int y = 0; + int x, lx, rx; + x = ceData.rect.width() - y - bs.width(); + lx = fw; + rx = x - fw * 2; + switch ( sc ) { + case SC_SpinWidgetUp: + return TQRect(x, y, bs.width(), bs.height()); + case SC_SpinWidgetDown: + return TQRect(x, y + bs.height(), bs.width(), bs.height()); + case SC_SpinWidgetButtonField: + return TQRect(x, y, bs.width(), ceData.rect.height() - 2*fw); + case SC_SpinWidgetEditField: + return TQRect(lx, fw, rx, ceData.rect.height() - 2*fw); + case SC_SpinWidgetFrame: + return TQRect( 0, 0, + ceData.rect.width() - bs.width(), ceData.rect.height() ); + default: + break; + } + break; } + +#ifndef TQT_NO_SLIDER + case CC_Slider: { + if (sc == SC_SliderHandle) { + int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget ); + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + int sliderPos = ceData.startStep; + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); + int motifBorder = 3; + + if ( ceData.orientation == Horizontal ) + return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len, + thickness - 2*motifBorder ); + return TQRect( tickOffset + motifBorder, sliderPos + motifBorder, + thickness - 2*motifBorder, len ); + } + break; } +#endif + +#ifndef TQT_NO_SCROLLBAR + case CC_ScrollBar: { + if (elementFlags & CEF_UseGenericParameters) + return TQRect(); + + int sliderstart = ceData.startStep; + int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); + int fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget); + int buttonw = sbextent - (fw * 2); + int buttonh = sbextent - (fw * 2); + int maxlen = ((ceData.orientation == TQt::Horizontal) ? + ceData.rect.width() : ceData.rect.height()) - + (buttonw * 2) - (fw * 2); + int sliderlen; + + // calculate slider length + if (ceData.maxSteps != ceData.minSteps) { + uint range = ceData.maxSteps - ceData.minSteps; + sliderlen = (ceData.pageStep * maxlen) / + (range + ceData.pageStep); + + if ( sliderlen < 9 || range > INT_MAX/2 ) + sliderlen = 9; + if ( sliderlen > maxlen ) + sliderlen = maxlen; + } else + sliderlen = maxlen; + + switch (sc) { + case SC_ScrollBarSubLine: + // top/left button + if (ceData.orientation == TQt::Horizontal) { + if ( ceData.rect.width()/2 < sbextent ) + buttonw = ceData.rect.width()/2 - (fw*2); + return TQRect(fw, fw, buttonw, buttonh); + } else { + if ( ceData.rect.height()/2 < sbextent ) + buttonh = ceData.rect.height()/2 - (fw*2); + return TQRect(fw, fw, buttonw, buttonh); + } + case SC_ScrollBarAddLine: + // bottom/right button + if (ceData.orientation == TQt::Horizontal) { + if ( ceData.rect.width()/2 < sbextent ) + buttonw = ceData.rect.width()/2 - (fw*2); + return TQRect(ceData.rect.width() - buttonw - fw, fw, + buttonw, buttonh); + } else { + if ( ceData.rect.height()/2 < sbextent ) + buttonh = ceData.rect.height()/2 - (fw*2); + return TQRect(fw, ceData.rect.height() - buttonh - fw, + buttonw, buttonh); + } + case SC_ScrollBarSubPage: + if (ceData.orientation == TQt::Horizontal) + return TQRect(buttonw + fw, fw, sliderstart - buttonw - fw, buttonw); + return TQRect(fw, buttonw + fw, buttonw, sliderstart - buttonw - fw); + + case SC_ScrollBarAddPage: + if (ceData.orientation == TQt::Horizontal) + return TQRect(sliderstart + sliderlen, fw, + maxlen - sliderstart - sliderlen + buttonw + fw, buttonw); + return TQRect(fw, sliderstart + sliderlen, buttonw, + maxlen - sliderstart - sliderlen + buttonw + fw); + + case SC_ScrollBarGroove: + if (ceData.orientation == TQt::Horizontal) + return TQRect(buttonw + fw, fw, maxlen, buttonw); + return TQRect(fw, buttonw + fw, buttonw, maxlen); + + case SC_ScrollBarSlider: + if (ceData.orientation == TQt::Horizontal) + return TQRect(sliderstart, fw, sliderlen, buttonw); + return TQRect(fw, sliderstart, buttonw, sliderlen); + + default: + break; + } + break; } +#endif + +#ifndef TQT_NO_COMBOBOX + case CC_ComboBox: + + switch ( sc ) { + case SC_ComboBoxArrow: { + int ew, awh, sh, dh, ax, ay, sy; + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); + TQRect cr = ceData.rect; + cr.addCoords( fw, fw, -fw, -fw ); + get_combo_parameters( cr, ew, awh, ax, ay, sh, dh, sy ); + return TQRect( ax, ay, awh, awh ); } + + case SC_ComboBoxEditField: { + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); + TQRect rect = ceData.rect; + rect.addCoords( fw, fw, -fw, -fw ); + int ew = get_combo_extra_width( rect.height(), rect.width() ); + rect.addCoords( 1, 1, -1-ew, -1 ); + return rect; } + + default: + break; + } + break; +#endif + default: break; + } + return TQCommonStyle::querySubControlMetrics( control, ceData, elementFlags, sc, opt, widget ); +} + +/*!\reimp +*/ +TQSize TQMotifStyle::sizeFromContents( ContentsType contents, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &contentsSize, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + TQSize sz(contentsSize); + + switch(contents) { + case CT_PushButton: + { +#ifndef TQT_NO_PUSHBUTTON + sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, opt, widget); + if (((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) && + sz.width() < 80 && ceData.fgPixmap.isNull()) + sz.setWidth(80); +#endif + break; + } + + case CT_PopupMenuItem: + { +#ifndef TQT_NO_POPUPMENU + if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault()) + break; + + bool checkable = (elementFlags & CEF_IsCheckable); + TQMenuItem *mi = opt.menuItem(); + int maxpmw = opt.maxIconWidth(); + int w = sz.width(), h = sz.height(); + + if (mi->custom()) { + w = mi->custom()->sizeHint().width(); + h = mi->custom()->sizeHint().height(); + if (! mi->custom()->fullSpan()) + h += 2*motifItemVMargin + 2*motifItemFrame; + } else if ( mi->widget() ) { + } else if ( mi->isSeparator() ) { + w = 10; + h = motifSepHeight; + } else if (mi->pixmap() || ! mi->text().isNull()) + h += 2*motifItemVMargin + 2*motifItemFrame; + + // a little bit of border can never harm + w += 2*motifItemHMargin + 2*motifItemFrame; + + if ( !mi->text().isNull() && mi->text().find('\t') >= 0 ) + // string contains tab + w += motifTabSpacing; + else if (mi->popup()) + // submenu indicator needs some room if we don't have a tab column + w += motifArrowHMargin + 4*motifItemFrame; + + if ( checkable && maxpmw <= 0) + // if we are checkable and have no iconsets, add space for a checkmark + w += motifCheckMarkSpace; + else if (checkable && maxpmw < motifCheckMarkSpace) + // make sure the check-column is wide enough if we have iconsets + w += (motifCheckMarkSpace - maxpmw); + + // if we have a check-column ( iconsets of checkmarks), add space + // to separate the columns + if ( maxpmw > 0 || checkable ) + w += motifCheckMarkHMargin; + + sz = TQSize(w, h); +#endif + break; + } + + default: + sz = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, opt, widget ); + break; + } + + return sz; +} + +/*!\reimp +*/ +TQRect TQMotifStyle::subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const +{ + TQRect rect; + TQRect wrect = ceData.rect; + + switch ( r ) { + case SR_SliderFocusRect: + rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget ); + rect.addCoords( 2, 2, -2, -2 ); + break; + + case SR_ComboBoxFocusRect: + { + int awh, ax, ay, sh, sy, dh, ew; + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); + TQRect tr = wrect; + + tr.addCoords( fw, fw, -fw, -fw ); + get_combo_parameters( tr, ew, awh, ax, ay, sh, dh, sy ); + rect.setRect(ax-2, ay-2, awh+4, awh+sh+dh+4); + break; + } + + case SR_DockWindowHandleRect: + { +#ifndef TQT_NO_MAINWINDOW + if ( (elementFlags & CEF_UseGenericParameters) || !(elementFlags & CEF_HasParentWidget) ) + break; + + if ( !ceData.dwData.hasDockArea || !ceData.dwData.closeEnabled ) + rect.setRect( 0, 0, ceData.rect.width(), ceData.rect.height() ); + else { + if ( ceData.dwData.areaOrientation == Horizontal ) + rect.setRect(2, 15, ceData.rect.width()-2, ceData.rect.height() - 15); + else + rect.setRect(0, 2, ceData.rect.width() - 15, ceData.rect.height() - 2); + } +#endif + break; + } + + case SR_ProgressBarGroove: + case SR_ProgressBarContents: + { +#ifndef TQT_NO_PROGRESSBAR + TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) : + TQApplication::fontMetrics() ) ); + int textw = 0; + if (ceData.percentageVisible) + textw = fm.width("100%") + 6; + + if ((elementFlags & CEF_IndicatorFollowsStyle) || + (elementFlags & CEF_CenterIndicator)) + rect = wrect; + else + rect.setCoords(wrect.left(), wrect.top(), + wrect.right() - textw, wrect.bottom()); +#endif + break; + } + + case SR_ProgressBarLabel: + { +#ifndef TQT_NO_PROGRESSBAR + TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) : + TQApplication::fontMetrics() ) ); + int textw = 0; + if (ceData.percentageVisible) + textw = fm.width("100%") + 6; + + if ((elementFlags & CEF_IndicatorFollowsStyle) || + (elementFlags & CEF_CenterIndicator)) + rect = wrect; + else + rect.setCoords(wrect.right() - textw, wrect.top(), + wrect.right(), wrect.bottom()); +#endif + break; + } + + case SR_CheckBoxContents: + { +#ifndef TQT_NO_CHECKBOX + TQRect ir = subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget); + rect.setRect(ir.right() + 10, wrect.y(), + wrect.width() - ir.width() - 10, wrect.height()); +#endif + break; + } + + case SR_RadioButtonContents: + { + TQRect ir = subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget); + rect.setRect(ir.right() + 10, wrect.y(), + wrect.width() - ir.width() - 10, wrect.height()); + break; + } + + default: + rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget ); + } + + return rect; +} + +/*! \reimp +*/ +void TQMotifStyle::polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ +#ifndef TQT_NO_POPUPMENU + if ( !(ceData.windowState & WState_Polished ) ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetCheckable); + } +#endif +} + + +#ifndef TQT_NO_IMAGEIO_XPM +static const char * const qt_close_xpm[] = { +"12 12 2 1", +" s None c None", +". c black", +" ", +" ", +" . . ", +" ... ... ", +" ...... ", +" .... ", +" .... ", +" ...... ", +" ... ... ", +" . . ", +" ", +" "}; + +static const char * const qt_maximize_xpm[] = { +"12 12 2 1", +" s None c None", +". c black", +" ", +" ", +" ", +" . ", +" ... ", +" ..... ", +" ....... ", +" ......... ", +" ", +" ", +" ", +" "}; + +static const char * const qt_minimize_xpm[] = { +"12 12 2 1", +" s None c None", +". c black", +" ", +" ", +" ", +" ", +" ......... ", +" ....... ", +" ..... ", +" ... ", +" . ", +" ", +" ", +" "}; + +#if 0 // ### not used??? +static const char * const qt_normalize_xpm[] = { +"12 12 2 1", +" s None c None", +". c black", +" ", +" ", +" . ", +" .. ", +" ... ", +" .... ", +" ..... ", +" ...... ", +" ....... ", +" ", +" ", +" "}; +#endif + +static const char * const qt_normalizeup_xpm[] = { +"12 12 2 1", +" s None c None", +". c black", +" ", +" ", +" ", +" ....... ", +" ...... ", +" ..... ", +" .... ", +" ... ", +" .. ", +" . ", +" ", +" "}; + +static const char * const qt_shade_xpm[] = { +"12 12 2 1", "# c #000000", +". c None", +"............", +"............", +".#########..", +".#########..", +"............", +"............", +"............", +"............", +"............", +"............", +"............", +"............"}; + + +static const char * const qt_unshade_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +".#########..", +".#########..", +".#.......#..", +".#.......#..", +".#.......#..", +".#.......#..", +".#.......#..", +".#########..", +"............", +"............"}; + + +static const char * dock_window_close_xpm[] = { +"8 8 2 1", +"# c #000000", +". c None", +"##....##", +".##..##.", +"..####..", +"...##...", +"..####..", +".##..##.", +"##....##", +"........"}; + +// Message box icons, from page 210 of the Windows style guide. + +// Hand-drawn to resemble Microsoft's icons, but in the Mac/Netscape palette. +// Thanks to TrueColor displays, it is slightly more efficient to have +// them duplicated. +/* XPM */ +static const char * const information_xpm[]={ +"32 32 5 1", +". c None", +"c c #000000", +"* c #999999", +"a c #ffffff", +"b c #0000ff", +"...........********.............", +"........***aaaaaaaa***..........", +"......**aaaaaaaaaaaaaa**........", +".....*aaaaaaaaaaaaaaaaaa*.......", +"....*aaaaaaaabbbbaaaaaaaac......", +"...*aaaaaaaabbbbbbaaaaaaaac.....", +"..*aaaaaaaaabbbbbbaaaaaaaaac....", +".*aaaaaaaaaaabbbbaaaaaaaaaaac...", +".*aaaaaaaaaaaaaaaaaaaaaaaaaac*..", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac*.", +"*aaaaaaaaaabbbbbbbaaaaaaaaaaac*.", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +".*aaaaaaaaaaabbbbbaaaaaaaaaac***", +".*aaaaaaaaaaabbbbbaaaaaaaaaac***", +"..*aaaaaaaaaabbbbbaaaaaaaaac***.", +"...caaaaaaabbbbbbbbbaaaaaac****.", +"....caaaaaaaaaaaaaaaaaaaac****..", +".....caaaaaaaaaaaaaaaaaac****...", +"......ccaaaaaaaaaaaaaacc****....", +".......*cccaaaaaaaaccc*****.....", +"........***cccaaaac*******......", +"..........****caaac*****........", +".............*caaac**...........", +"...............caac**...........", +"................cac**...........", +".................cc**...........", +"..................***...........", +"...................**..........."}; +/* XPM */ +static const char* const warning_xpm[]={ +"32 32 4 1", +". c None", +"a c #ffff00", +"* c #000000", +"b c #999999", +".............***................", +"............*aaa*...............", +"...........*aaaaa*b.............", +"...........*aaaaa*bb............", +"..........*aaaaaaa*bb...........", +"..........*aaaaaaa*bb...........", +".........*aaaaaaaaa*bb..........", +".........*aaaaaaaaa*bb..........", +"........*aaaaaaaaaaa*bb.........", +"........*aaaa***aaaa*bb.........", +".......*aaaa*****aaaa*bb........", +".......*aaaa*****aaaa*bb........", +"......*aaaaa*****aaaaa*bb.......", +"......*aaaaa*****aaaaa*bb.......", +".....*aaaaaa*****aaaaaa*bb......", +".....*aaaaaa*****aaaaaa*bb......", +"....*aaaaaaaa***aaaaaaaa*bb.....", +"....*aaaaaaaa***aaaaaaaa*bb.....", +"...*aaaaaaaaa***aaaaaaaaa*bb....", +"...*aaaaaaaaaa*aaaaaaaaaa*bb....", +"..*aaaaaaaaaaa*aaaaaaaaaaa*bb...", +"..*aaaaaaaaaaaaaaaaaaaaaaa*bb...", +".*aaaaaaaaaaaa**aaaaaaaaaaa*bb..", +".*aaaaaaaaaaa****aaaaaaaaaa*bb..", +"*aaaaaaaaaaaa****aaaaaaaaaaa*bb.", +"*aaaaaaaaaaaaa**aaaaaaaaaaaa*bb.", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", +".*aaaaaaaaaaaaaaaaaaaaaaaaa*bbbb", +"..*************************bbbbb", +"....bbbbbbbbbbbbbbbbbbbbbbbbbbb.", +".....bbbbbbbbbbbbbbbbbbbbbbbbb.."}; +/* XPM */ +static const char* const critical_xpm[]={ +"32 32 4 1", +". c None", +"a c #999999", +"* c #ff0000", +"b c #ffffff", +"...........********.............", +".........************...........", +".......****************.........", +"......******************........", +".....********************a......", +"....**********************a.....", +"...************************a....", +"..*******b**********b*******a...", +"..******bbb********bbb******a...", +".******bbbbb******bbbbb******a..", +".*******bbbbb****bbbbb*******a..", +"*********bbbbb**bbbbb*********a.", +"**********bbbbbbbbbb**********a.", +"***********bbbbbbbb***********aa", +"************bbbbbb************aa", +"************bbbbbb************aa", +"***********bbbbbbbb***********aa", +"**********bbbbbbbbbb**********aa", +"*********bbbbb**bbbbb*********aa", +".*******bbbbb****bbbbb*******aa.", +".******bbbbb******bbbbb******aa.", +"..******bbb********bbb******aaa.", +"..*******b**********b*******aa..", +"...************************aaa..", +"....**********************aaa...", +"....a********************aaa....", +".....a******************aaa.....", +"......a****************aaa......", +".......aa************aaaa.......", +".........aa********aaaaa........", +"...........aaaaaaaaaaa..........", +".............aaaaaaa............"}; +/* XPM */ +static const char *const question_xpm[] = { +"32 32 5 1", +". c None", +"c c #000000", +"* c #999999", +"a c #ffffff", +"b c #0000ff", +"...........********.............", +"........***aaaaaaaa***..........", +"......**aaaaaaaaaaaaaa**........", +".....*aaaaaaaaaaaaaaaaaa*.......", +"....*aaaaaaaaaaaaaaaaaaaac......", +"...*aaaaaaaabbbbbbaaaaaaaac.....", +"..*aaaaaaaabaaabbbbaaaaaaaac....", +".*aaaaaaaabbaaaabbbbaaaaaaaac...", +".*aaaaaaaabbbbaabbbbaaaaaaaac*..", +"*aaaaaaaaabbbbaabbbbaaaaaaaaac*.", +"*aaaaaaaaaabbaabbbbaaaaaaaaaac*.", +"*aaaaaaaaaaaaabbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaaabbbaaaaaaaaaaaac**", +"*aaaaaaaaaaaaabbaaaaaaaaaaaaac**", +"*aaaaaaaaaaaaabbaaaaaaaaaaaaac**", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac**", +".*aaaaaaaaaaaabbaaaaaaaaaaaac***", +".*aaaaaaaaaaabbbbaaaaaaaaaaac***", +"..*aaaaaaaaaabbbbaaaaaaaaaac***.", +"...caaaaaaaaaabbaaaaaaaaaac****.", +"....caaaaaaaaaaaaaaaaaaaac****..", +".....caaaaaaaaaaaaaaaaaac****...", +"......ccaaaaaaaaaaaaaacc****....", +".......*cccaaaaaaaaccc*****.....", +"........***cccaaaac*******......", +"..........****caaac*****........", +".............*caaac**...........", +"...............caac**...........", +"................cac**...........", +".................cc**...........", +"..................***...........", +"...................**...........", +}; +#endif + +/*! + \reimp + */ +TQPixmap TQMotifStyle::stylePixmap(StylePixmap sp, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& opt, + const TQWidget *widget) const +{ +#ifndef TQT_NO_IMAGEIO_XPM + switch (sp) { + case SP_TitleBarShadeButton: + return TQPixmap((const char **)qt_shade_xpm); + case SP_TitleBarUnshadeButton: + return TQPixmap((const char **)qt_unshade_xpm); + case SP_TitleBarNormalButton: + return TQPixmap((const char **)qt_normalizeup_xpm); + case SP_TitleBarMinButton: + return TQPixmap((const char **)qt_minimize_xpm); + case SP_TitleBarMaxButton: + return TQPixmap((const char **)qt_maximize_xpm); + case SP_TitleBarCloseButton: + return TQPixmap((const char **)qt_close_xpm); + case SP_DockWindowCloseButton: + return TQPixmap((const char **)dock_window_close_xpm ); + + case SP_MessageBoxInformation: + case SP_MessageBoxWarning: + case SP_MessageBoxCritical: + case SP_MessageBoxQuestion: + { + const char * const * xpm_data; + switch ( sp ) { + case SP_MessageBoxInformation: + xpm_data = information_xpm; + break; + case SP_MessageBoxWarning: + xpm_data = warning_xpm; + break; + case SP_MessageBoxCritical: + xpm_data = critical_xpm; + break; + case SP_MessageBoxQuestion: + xpm_data = question_xpm; + break; + default: + xpm_data = 0; + break; + } + TQPixmap pm; + if ( xpm_data ) { + TQImage image( (const char **) xpm_data); + // All that color looks ugly in Motif + TQColorGroup g = TQApplication::palette().active(); + switch ( sp ) { + case SP_MessageBoxInformation: + case SP_MessageBoxQuestion: + image.setColor( 2, 0xff000000 | g.dark().rgb() ); + image.setColor( 3, 0xff000000 | g.base().rgb() ); + image.setColor( 4, 0xff000000 | g.text().rgb() ); + break; + case SP_MessageBoxWarning: + image.setColor( 1, 0xff000000 | g.base().rgb() ); + image.setColor( 2, 0xff000000 | g.text().rgb() ); + image.setColor( 3, 0xff000000 | g.dark().rgb() ); + break; + case SP_MessageBoxCritical: + image.setColor( 1, 0xff000000 | g.dark().rgb() ); + image.setColor( 2, 0xff000000 | g.text().rgb() ); + image.setColor( 3, 0xff000000 | g.base().rgb() ); + break; + default: + break; + } + pm.convertFromImage(image); + } + return pm; + } + + default: + break; + } +#endif + + return TQCommonStyle::stylePixmap(sp, ceData, elementFlags, opt, widget); +} + + +/*! \reimp */ +int TQMotifStyle::styleHint(StyleHint hint, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption &opt, + TQStyleHintReturn *returnData, + const TQWidget *widget) const +{ + int ret; + + switch (hint) { + case SH_GUIStyle: + ret = MotifStyle; + break; + + case SH_ScrollBar_BackgroundMode: + ret = TQWidget::PaletteMid; + break; + + case SH_ScrollBar_MiddleClickAbsolutePosition: + case SH_Slider_SloppyKeyEvents: + case SH_ProgressDialog_CenterCancelButton: + case SH_PopupMenu_SpaceActivatesItem: + case SH_ScrollView_FrameOnlyAroundContents: + ret = 1; + break; + + case SH_PopupMenu_SubMenuPopupDelay: + ret = 96; + break; + + case SH_ProgressDialog_TextLabelAlignment: + ret = AlignAuto | AlignVCenter; + break; + + case SH_ItemView_ChangeHighlightOnFocus: + ret = 0; + break; + + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = (elementFlags & CEF_IsCheckable); + + if ( checkable ) + maxpmw = TQMAX( maxpmw, motifCheckMarkSpace ); + + ret = maxpmw; + break; + } + + default: + ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); + break; + } + + return ret; +} + + +#endif diff --git a/src/styles/tqmotifstyle.h b/src/styles/tqmotifstyle.h new file mode 100644 index 000000000..3b8aac02f --- /dev/null +++ b/src/styles/tqmotifstyle.h @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Definition of Motif-like style class +** +** Created : 981231 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQMOTIFSTYLE_H +#define TQMOTIFSTYLE_H + +#ifndef QT_H +#include "tqcommonstyle.h" +#endif // QT_H + +#if !defined(TQT_NO_STYLE_MOTIF) || defined(QT_PLUGIN) + +class TQPalette; + +#if defined(QT_PLUGIN) +#define Q_EXPORT_STYLE_MOTIF +#else +#define Q_EXPORT_STYLE_MOTIF TQ_EXPORT +#endif + + +class Q_EXPORT_STYLE_MOTIF TQMotifStyle : public TQCommonStyle +{ + TQ_OBJECT +public: + TQMotifStyle( bool useHighlightCols=FALSE ); + virtual ~TQMotifStyle(); + + void setUseHighlightColors( bool ); + bool useHighlightColors() const; + + void polish( TQPalette& ); + void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + + void polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + + // new style API + void drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default ) const; + + void drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + void drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect& r, + const TQColorGroup& cg, + SFlags how = Style_Default, +#ifdef Q_QDOC + SCFlags sub = SC_All, +#else + SCFlags sub = (uint)SC_All, +#endif + SCFlags subActive = SC_None, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; + + TQRect querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sc, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; + + TQSize sizeFromContents( ContentsType contents, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &contentsSize, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const; + + TQPixmap stylePixmap(StylePixmap, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption& = TQStyleOption::Default, const TQWidget * = 0) const; + + int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, + TQStyleHintReturn* = 0, const TQWidget * = 0) const; + +private: + bool highlightCols; + + // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQMotifStyle( const TQMotifStyle & ); + TQMotifStyle& operator=( const TQMotifStyle & ); +#endif +}; + +#endif // TQT_NO_STYLE_MOTIF + +#endif // TQMOTIFSTYLE_H diff --git a/src/styles/tqplatinumstyle.cpp b/src/styles/tqplatinumstyle.cpp new file mode 100644 index 000000000..28d90cb94 --- /dev/null +++ b/src/styles/tqplatinumstyle.cpp @@ -0,0 +1,1552 @@ +/**************************************************************************** +** +** Implementation of Platinum-like style class +** +** Created : 981231 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqplatinumstyle.h" + +#if !defined(TQT_NO_STYLE_PLATINUM) || defined(QT_PLUGIN) + +#include "ntqapplication.h" +#include "tqcombobox.h" +#include "ntqdrawutil.h" +#include "tqpainter.h" +#include "tqpalette.h" +#include "tqpixmap.h" +#include "tqpushbutton.h" +#include "tqscrollbar.h" +#include "tqslider.h" +#include + +/*! + \class TQPlatinumStyle tqplatinumstyle.h + \brief The TQPlatinumStyle class provides Mac/Platinum look and feel. + + \ingroup appearance + + This class implements the Platinum look and feel. It's an + experimental class that tries to resemble a Macinosh-like GUI + style with the TQStyle system. The emulation is currently far from + perfect. + + \sa TQAquaStyle +*/ + + +/*! + Constructs a TQPlatinumStyle +*/ +TQPlatinumStyle::TQPlatinumStyle() +{ +} + +/*!\reimp +*/ +TQPlatinumStyle::~TQPlatinumStyle() +{ +} + + +/*!\reimp + */ +void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + switch (pe) { + case PE_HeaderSection: + { + // adjust the sunken flag, otherwise headers are drawn + // sunken... + if ( flags & Style_Sunken ) + flags ^= Style_Sunken; + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags, opt ); + break; + } + case PE_ButtonTool: + { + // tool buttons don't change color when pushed in platinum, + // so we need to make the mid and button color the same + TQColorGroup myCG = cg; + TQBrush fill; + + // quick trick to make sure toolbuttons drawn sunken + // when they are activated... + if ( flags & Style_On ) + flags |= Style_Sunken; + + fill = myCG.brush( TQColorGroup::Button ); + myCG.setBrush( TQColorGroup::Mid, fill ); + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, myCG, flags, opt ); + break; + } + case PE_ButtonBevel: + { + int x, + y, + w, + h; + r.rect( &x, &y, &w, &h ); + + TQPen oldPen = p->pen(); + if ( w * h < 1600 || + TQABS(w - h) > 10 ) { + // small buttons + + if ( !(flags & (Style_Sunken | Style_Down)) ) { + p->fillRect( x + 2, y + 2, w - 4, h - 4, + cg.brush(TQColorGroup::Button) ); + // the bright side + p->setPen( cg.dark() ); + // the bright side + p->setPen( cg.dark() ); + p->drawLine( x, y, x + w - 1, y ); + p->drawLine( x, y, x, y + h - 1 ); + + p->setPen( cg.light() ); + p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); + p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); + + // the dark side + p->setPen( cg.mid() ); + p->drawLine( x + 2, y + h - 2, x + w - 2, y + h - 2 ); + p->drawLine( x + w - 2, y + 2, x + w - 2, y + h - 3 ); + + p->setPen( cg.dark().dark() ); + p->drawLine( x + 1, y + h - 1, x + w - 1, + y + h - 1 ); + p->drawLine( x + w - 1, y + 1, + x + w - 1, + y + h - 2 ); + } else { + p->fillRect(x + 2, y + 2, + w - 4, h - 4, + cg.brush( TQColorGroup::Mid )); + + // the dark side + p->setPen( cg.dark().dark() ); + p->drawLine( x, y, x + w - 1, y ); + p->drawLine( x, y, x, y + h - 1 ); + + p->setPen( cg.mid().dark()); + p->drawLine( x + 1, y + 1, + x + w-2, y + 1); + p->drawLine( x + 1, y + 1, + x + 1, y + h - 2 ); + + + // the bright side! + + p->setPen(cg.button()); + p->drawLine( x + 1, y + h - 2, + x + w - 2, + y + h - 2 ); + p->drawLine( x + w - 2, y + 1, + x + w - 2, + y + h - 2 ); + p->setPen(cg.dark()); + p->drawLine(x, y + h - 1, + x + w - 1, + y + h - 1 ); + p->drawLine(x + w - 1, y, + x + w - 1, + y + h - 1 ); + } + } else { + // big ones + if ( !(flags & (Style_Sunken | Style_Down)) ) { + p->fillRect( x + 3, y + 3, w - 6, + h - 6, + cg.brush(TQColorGroup::Button) ); + + // the bright side + p->setPen( cg.button().dark() ); + p->drawLine( x, y, x + w - 1, y ); + p->drawLine( x, y, x, y + h - 1 ); + + p->setPen( cg.button() ); + p->drawLine( x + 1, y + 1, + x + w - 2, y + 1 ); + p->drawLine( x + 1, y + 1, + x + 1, y + h - 2 ); + + p->setPen( cg.light() ); + p->drawLine( x + 2, y + 2, + x + 2, y + h - 2 ); + p->drawLine( x + 2, y + 2, + x + w - 2, y + 2 ); + // the dark side! + + p->setPen( cg.mid() ); + p->drawLine( x + 3, y + h - 3, + x + w - 3, + y + h - 3 ); + p->drawLine( x + w - 3, y + 3, + x + w - 3, + y + h - 3 ); + p->setPen( cg.dark() ); + p->drawLine( x + 2, y + h - 2, + x + w - 2, + y + h - 2 ); + p->drawLine( x + w - 2, y + 2, + x + w - 2, + y + h - 2 ); + + p->setPen( cg.dark().dark() ); + p->drawLine( x + 1, y + h - 1, + x + w - 1, + y + h - 1 ); + p->drawLine( x + w - 1, y + 1, + x + w - 1, + y + h - 1 ); + } else { + p->fillRect( x + 3, y + 3, w - 6, + h - 6, + cg.brush( TQColorGroup::Mid ) ); + + // the dark side + p->setPen( cg.dark().dark().dark() ); + p->drawLine( x, y, x + w - 1, y ); + p->drawLine( x, y, x, y + h - 1 ); + + p->setPen( cg.dark().dark() ); + p->drawLine( x + 1, y + 1, + x + w - 2, y + 1 ); + p->drawLine( x + 1, y + 1, + x + 1, y + h - 2 ); + + p->setPen( cg.mid().dark() ); + p->drawLine( x + 2, y + 2, + x + 2, y + w - 2 ); + p->drawLine( x + 2, y + 2, + x + w - 2, y + 2 ); + + + // the bright side! + + p->setPen( cg.button() ); + p->drawLine( x + 2, y + h - 3, + x + w - 3, + y + h - 3 ); + p->drawLine( x + w - 3, y + 3, + x + w - 3, + y + h - 3 ); + + p->setPen( cg.midlight() ); + p->drawLine( x + 1, y + h - 2, + x + w - 2, + y + h - 2 ); + p->drawLine( x + w - 2, y + 1, + x + w - 2, + y + h - 2 ); + + p->setPen( cg.dark() ); + p->drawLine( x, y + h - 1, + x + w - 1, + y + h - 1 ); + p->drawLine( x + w - 1, y, + x + w - 1, + y + h - 1 ); + + + // corners + p->setPen( mixedColor(cg.dark().dark().dark(), + cg.dark()) ); + p->drawPoint( x, y + h - 1 ); + p->drawPoint( x + w - 1, y ); + + p->setPen( mixedColor(cg.dark().dark(), cg.midlight()) ); + p->drawPoint( x + 1, y + h - 2 ); + p->drawPoint( x + w - 2, y + 1 ); + + p->setPen( mixedColor(cg.mid().dark(), cg.button() ) ); + p->drawPoint( x + 2, y + h - 3 ); + p->drawPoint( x + w - 3, y + 2 ); + } + } + p->setPen( oldPen ); + break; + } + case PE_ButtonCommand: + { + TQPen oldPen = p->pen(); + int x, + y, + w, + h; + r.rect( &x, &y, &w, &h); + + if ( !(flags & (Style_Down | Style_On)) ) { + p->fillRect( x+3, y+3, w-6, h-6, + cg.brush( TQColorGroup::Button )); + // the bright side + p->setPen( cg.shadow() ); + p->drawLine( x, y, x+w-1, y ); + p->drawLine( x, y, x, y + h - 1 ); + + p->setPen( cg.button() ); + p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); + p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); + + p->setPen( cg.light() ); + p->drawLine( x + 2, y + 2, x + 2, y + h - 2 ); + p->drawLine( x + 2, y + 2, x + w - 2, y + 2 ); + + + // the dark side! + + p->setPen( cg.mid() ); + p->drawLine( x + 3, y + h - 3 ,x + w - 3, y + h - 3 ); + p->drawLine( x + w - 3, y + 3, x + w - 3, y + h - 3 ); + + p->setPen( cg.dark() ); + p->drawLine( x + 2, y + h - 2, x + w - 2, y + h - 2 ); + p->drawLine( x + w - 2, y + 2, x + w - 2, y + h - 2 ); + + p->setPen( cg.shadow() ); + p->drawLine( x + 1, y + h - 1, x + w - 1, y + h - 1 ); + p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); + + + // top left corner: + p->setPen( cg.background() ); + p->drawPoint( x, y ); + p->drawPoint( x + 1, y ); + p->drawPoint( x, y+1 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + 1, y + 1 ); + p->setPen( cg.button() ); + p->drawPoint( x + 2, y + 2 ); + p->setPen( white ); + p->drawPoint( x + 3, y + 3 ); + // bottom left corner: + p->setPen( cg.background() ); + p->drawPoint( x, y + h - 1 ); + p->drawPoint( x + 1, y + h - 1 ); + p->drawPoint( x, y + h - 2 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + 1, y + h - 2 ); + p->setPen( cg.dark() ); + p->drawPoint( x + 2, y + h - 3 ); + // top right corner: + p->setPen( cg.background() ); + p->drawPoint( x + w -1, y ); + p->drawPoint( x + w - 2, y ); + p->drawPoint( x + w - 1, y + 1 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + w - 2, y + 1 ); + p->setPen( cg.dark() ); + p->drawPoint( x + w - 3, y + 2 ); + // bottom right corner: + p->setPen( cg.background() ); + p->drawPoint( x + w - 1, y + h - 1 ); + p->drawPoint( x + w - 2, y + h - 1 ); + p->drawPoint( x + w - 1, y + h - 2 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + w - 2, y + h - 2 ); + p->setPen( cg.dark() ); + p->drawPoint( x + w - 3, y + h - 3 ); + p->setPen( cg.mid() ); + p->drawPoint( x + w - 4, y + h - 4 ); + + } else { + p->fillRect( x + 2, y + 2, w - 4, h - 4, + cg.brush(TQColorGroup::Dark) ); + + // the dark side + p->setPen( cg.shadow() ); + p->drawLine( x, y, x + w - 1, y ); + p->drawLine( x, y, x, y + h - 1 ); + + p->setPen( cg.dark().dark() ); + p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); + p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); + + // the bright side! + + p->setPen( cg.button() ); + p->drawLine( x + 1, y + h - 2, x + w - 2, y + h - 2 ); + p->drawLine( x + w - 2, y + 1, x + w - 2, y + h - 2 ); + + p->setPen( cg.dark() ); + p->drawLine( x, y + h - 1, x + w - 1, y + h - 1 ); + p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); + + // top left corner: + p->setPen( cg.background() ); + p->drawPoint( x, y ); + p->drawPoint( x + 1, y ); + p->drawPoint( x, y + 1 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + 1, y + 1 ); + p->setPen( cg.dark().dark() ); + p->drawPoint( x + 3, y + 3 ); + // bottom left corner: + p->setPen( cg.background() ); + p->drawPoint( x, y + h - 1 ); + p->drawPoint( x + 1, y + h - 1 ); + p->drawPoint( x, y + h - 2 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + 1, y + h - 2 ); + // top right corner: + p->setPen( cg.background() ); + p->drawPoint( x + w - 1, y ); + p->drawPoint( x + w - 2, y ); + p->drawPoint( x + w - 1, y + 1 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + w - 2, y + 1 ); + // bottom right corner: + p->setPen( cg.background() ); + p->drawPoint( x + w - 1, y + h - 1 ); + p->drawPoint( x + w - 2, y + h - 1 ); + p->drawPoint( x + w - 1, y + h - 2 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + w - 2, y + h - 2 ); + p->setPen( cg.dark() ); + p->drawPoint( x + w - 3, y + h - 3 ); + p->setPen( cg.mid() ); + p->drawPoint( x + w - 4, y + h - 4 ); + } + p->setPen( oldPen ); + break; + } + case PE_Indicator: + { + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect(r.x(), r.y(), + r.width() - 2, r.height()), + cg, flags ); + p->fillRect( r.x() + r.width() - 2, r.y(), 2, r.height(), + cg.brush( TQColorGroup::Background ) ); + p->setPen( cg.shadow() ); + p->drawRect( r.x(), r.y(), r.width() - 2, r.height() ); + + static const TQCOORD nochange_mark[] = { 3,5, 9,5, 3,6, 9,6 }; + static const TQCOORD check_mark[] = { + 3,5, 5,5, 4,6, 5,6, 5,7, 6,7, 5,8, 6,8, 6,9, 9,9, + 6,10, 8,10, 7,11, 8,11, 7,12, 7,12, 8,8, 9,8, 8,7, 10,7, + 9,6, 10,6, 9,5, 11,5, 10,4, 11,4, 10,3, 12,3, + 11,2, 12,2, 11,1, 13,1, 12,0, 13,0 }; + if ( !(flags & Style_Off) ) { + TQPen oldPen = p->pen(); + int x1 = r.x(); + int y1 = r.y(); + if ( flags & Style_Down ) { + x1++; + y1++; + } + TQPointArray amark; + if ( flags & Style_On ) { + amark = TQPointArray( sizeof(check_mark)/(sizeof(TQCOORD)*2), + check_mark ); + // ### KLUDGE!! + flags ^= Style_On; + flags ^= Style_Down; + } else if ( flags & Style_NoChange ) { + amark = TQPointArray( sizeof(nochange_mark) + / (sizeof(TQCOORD) * 2), + nochange_mark ); + } + + amark.translate( x1 + 1, y1 + 1 ); + p->setPen( cg.dark() ); + p->drawLineSegments( amark ); + amark.translate( -1, -1 ); + p->setPen( cg.foreground() ); + p->drawLineSegments( amark ); + p->setPen( oldPen ); + } + break; + } + case PE_IndicatorMask: + { + int x, + y, + w, + h; + r.rect( &x, &y, &w, &h ); + p->fillRect( x, y, w - 2, h, color1); + if ( flags & Style_Off ) { + TQPen oldPen = p->pen(); + p->setPen ( TQPen(color1, 2)); + p->drawLine( x + 2, y + h / 2 - 1, + x + w / 2 - 1, y + h - 4 ); + p->drawLine( x + w / 2 - 1, y + h - 4, + x + w, 0); + p->setPen( oldPen ); + } + break; + } + case PE_ExclusiveIndicator: + { +#define TQCOORDARRLEN(x) sizeof(x) / (sizeof(TQCOORD) * 2 ) + bool down = flags & Style_Down; + bool on = flags & Style_On; + + static const TQCOORD pts1[] = { // normal circle + 5,0, 8,0, 9,1, 10,1, 11,2, 12,3, 12,4, 13,5, + 13,8, 12,9, 12,10, 11,11, 10,12, 9,12, 8,13, + 5,13, 4,12, 3,12, 2,11, 1,10, 1,9, 0,8, 0,5, + 1,4, 1,3, 2,2, 3,1, 4,1 }; + static const TQCOORD pts2[] = { // top left shadow + 5,1, 8,1, 3,2, 7,2, 2,3, 5,3, 2,4, 4,4, + 1,5, 3,5, 1,6, 1,8, 2,6, 2,7 }; + static const TQCOORD pts3[] = { // bottom right, dark + 5,12, 8,12, 7,11, 10,11, 8,10, 11,10, + 9,9, 11,9, 10,8, 12,8, 11,7, 11,7, + 12,5, 12,7 }; + static const TQCOORD pts4[] = { // bottom right, light + 5,12, 8,12, 7,11, 10,11, 9,10, 11,10, + 10,9, 11,9, 11,7, 11,8, 12,5, 12,8 }; + static const TQCOORD pts5[] = { // check mark + 6,4, 8,4, 10,6, 10,8, 8,10, 6,10, 4,8, 4,6 }; + static const TQCOORD pts6[] = { // check mark extras + 4,5, 5,4, 9,4, 10,5, 10,9, 9,10, 5,10, 4,9 }; + int x, y; + x = r.x(); + y = r.y(); + p->eraseRect( r ); + p->setBrush( (down||on) ? cg.brush( TQColorGroup::Dark ) + : cg.brush( TQColorGroup::Button) ); + p->setPen( NoPen ); + p->drawEllipse( x, y, 13, 13 ); + p->setPen( cg.shadow() ); + TQPointArray a( TQCOORDARRLEN(pts1), pts1 ); + a.translate( x, y ); + p->drawPolyline( a ); // draw normal circle + TQColor tc, bc; + const TQCOORD *bp; + int bl; + if ( down || on ) { // pressed down or on + tc = cg.dark().dark(); + bc = cg.light(); + bp = pts4; + bl = TQCOORDARRLEN(pts4); + } else { // released + tc = cg.light(); + bc = cg.dark(); + bp = pts3; + bl = TQCOORDARRLEN(pts3); + } + p->setPen( tc ); + a.setPoints( TQCOORDARRLEN(pts2), pts2 ); + a.translate( x, y ); + p->drawLineSegments( a ); // draw top shadow + p->setPen( bc ); + a.setPoints( bl, bp ); + a.translate( x, y ); + p->drawLineSegments( a ); + if ( on ) { // draw check mark + int x1 = x, + y1 = y; + p->setBrush( cg.foreground() ); + p->setPen( cg.foreground() ); + a.setPoints( TQCOORDARRLEN(pts5), pts5 ); + a.translate( x1, y1 ); + p->drawPolygon( a ); + p->setBrush( NoBrush ); + p->setPen( cg.dark() ); + a.setPoints( TQCOORDARRLEN(pts6), pts6 ); + a.translate( x1, y1 ); + p->drawLineSegments( a ); + } + break; + } + + case PE_ExclusiveIndicatorMask: + { + static const TQCOORD pts1[] = { // normal circle + 5,0, 8,0, 9,1, 10,1, 11,2, 12,3, 12,4, 13,5, + 13,8, 12,9, 12,10, 11,11, 10,12, 9,12, 8,13, + 5,13, 4,12, 3,12, 2,11, 1,10, 1,9, 0,8, 0,5, + 1,4, 1,3, 2,2, 3,1, 4,1 }; + TQPointArray a(TQCOORDARRLEN(pts1), pts1); + a.translate(r.x(), r.y()); + p->setPen(color1); + p->setBrush(color1); + p->drawPolygon(a); + break; + } + case PE_ScrollBarAddLine: + { + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, + (flags & Style_Enabled) | ((flags & Style_Down) + ? Style_Sunken + : Style_Raised) ); + p->setPen( cg.shadow() ); + p->drawRect( r ); + drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight + : PE_ArrowDown), p, ceData, elementFlags, TQRect(r.x() + 2, + r.y() + 2, + r.width() - 4, + r.height() - 4), + cg, flags ); + break; + } + case PE_ScrollBarSubLine: + { + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, + (flags & Style_Enabled) | ((flags & Style_Down) + ? Style_Sunken + : Style_Raised) ); + p->setPen( cg.shadow() ); + p->drawRect( r ); + drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft + : PE_ArrowUp ), p, ceData, elementFlags, TQRect(r.x() + 2, + r.y() + 2, + r.width() - 4, + r.height() - 4), + cg, flags ); + break; + } + case PE_ScrollBarAddPage: + case PE_ScrollBarSubPage: + { + TQPen oldPen = p->pen(); + if ( r.width() < 3 || r.height() < 3 ) { + p->fillRect( r, cg.brush(TQColorGroup::Mid) ); + p->setPen( cg.shadow() ); + p->drawRect( r ); + p->setPen( oldPen ); + } else { + int x, + y, + w, + h; + r.rect( &x, &y, &w, &h ); + if ( flags & Style_Horizontal ) { + p->fillRect( x + 2, y + 2, w - 2, + h - 4, + cg.brush(TQColorGroup::Mid) ); + // the dark side + p->setPen( cg.dark().dark() ); + p->drawLine( x, y, x + w - 1, y ); + p->setPen( cg.shadow()); + p->drawLine( x, y, x, y + h - 1 ); + + p->setPen( cg.mid().dark()); + p->drawLine( x + 1, y + 1, x + w - 1, + y + 1 ); + p->drawLine( x + 1, y + 1, x + 1, + y + h - 2 ); + + // the bright side! + + p->setPen( cg.button()); + p->drawLine( x + 1, y + h - 2, + x + w - 1, + y + h - 2 ); + p->setPen( cg.shadow()); + p->drawLine( x, y + h - 1, + x + w - 1, + y + h - 1 ); + + } else { + p->fillRect( x + 2, y + 2, w - 4, + h - 2, + cg.brush(TQColorGroup::Mid) ); + + // the dark side + p->setPen( cg.dark().dark() ); + p->drawLine( x, y, x + w - 1, y ); + p->setPen( cg.shadow() ); + p->drawLine( x, y, x, y + h - 1 ); + + p->setPen( cg.mid().dark() ); + p->drawLine( x + 1, y + 1, x + w - 2, + y + 1 ); + p->drawLine( x + 1, y + 1, x + 1, + y + h - 1 ); + + // the bright side! + p->setPen( cg.button() ); + p->drawLine( x + w - 2, y + 1, + x + w - 2, + y + h - 1 ); + + p->setPen( cg.shadow() ); + p->drawLine( x + w - 1, y, + x + w - 1, + y + h - 1 ); + + } + } + p->setPen( oldPen ); + break; + } + case PE_ScrollBarSlider: + { + TQPoint bo = p->brushOrigin(); + p->setBrushOrigin( r.topLeft() ); + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, Style_Raised ); + p->setBrushOrigin( bo ); + drawRiffles( p, r.x(), r.y(), r.width(), r.height(), cg, + flags & Style_Horizontal ); + p->setPen( cg.shadow() ); + p->drawRect( r ); + if ( flags & Style_HasFocus ) { + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, TQRect(r.x() + 2, r.y() + 2, + r.width() - 5, + r.height() - 5 ), + cg, flags ); + } + break; + } + default: + TQWindowsStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); + break; + } + +} + +/*!\reimp + */ +void TQPlatinumStyle::drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch( element ) { + case CE_PushButton: + { +#ifndef TQT_NO_PUSHBUTTON + TQColorGroup myCg( cg ); + int x1, y1, x2, y2; + bool useBevelButton; + SFlags flags; + flags = Style_Default; + p->setBrushOrigin( -ceData.bgOffset.x(), + -ceData.bgOffset.y() ); + + // take care of the flags based on what we know... + if ( elementFlags & CEF_IsDown ) + flags |= Style_Down; + if ( elementFlags & CEF_IsOn ) + flags |= Style_On; + if ( elementFlags & CEF_IsEnabled ) + flags |= Style_Enabled; + if ( elementFlags & CEF_IsDefault ) + flags |= Style_Default; + if (! ( elementFlags & CEF_IsFlat ) && !(flags & Style_Down)) + flags |= Style_Raised; + + r.coords( &x1, &y1, &x2, &y2 ); + + p->setPen( cg.foreground() ); + p->setBrush( TQBrush(cg.button(), NoBrush) ); + + TQBrush fill; + if ( elementFlags & CEF_IsDown ) { + fill = cg.brush( TQColorGroup::Dark ); + // this could be done differently, but this + // makes a down Bezel drawn correctly... + myCg.setBrush( TQColorGroup::Mid, fill ); + } else if ( elementFlags & CEF_IsOn ) { + fill = TQBrush( cg.mid(), Dense4Pattern ); + myCg.setBrush( TQColorGroup::Mid, fill ); + } + // to quote the old TQPlatinumStlye drawPushButton... + // small or square image buttons as well as toggle buttons are + // bevel buttons (what a heuristic....) + if ( ( elementFlags & CEF_BiState ) + || ( (!ceData.fgPixmap.isNull()) && + (ceData.rect.width() * ceData.rect.height() < 1600 || + TQABS( ceData.rect.width() - ceData.rect.height()) < 10 )) ) + useBevelButton = TRUE; + else + useBevelButton = FALSE; + + int diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ); + if ( elementFlags & CEF_IsDefault ) { + x1 += 1; + y1 += 1; + x2 -= 1; + y2 -= 1; + TQColorGroup cg2( myCg ); + SFlags myFlags = flags; + // don't draw the default button sunken, unless it's necessary. + if ( myFlags & Style_Down ) + myFlags ^= Style_Down; + if ( myFlags & Style_Sunken ) + myFlags ^= Style_Sunken; + + cg2.setColor( TQColorGroup::Button, cg.mid() ); + if ( useBevelButton ) { + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1, + x2 - x1 + 1, + y2 - y1 + 1 ), + myCg, myFlags, opt ); + } else { + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x1, y1, + x2 - x1 + 1, + y2 - y1 + 1 ), + cg2, myFlags, opt ); + } + } + + if ( ( elementFlags & CEF_IsDefault ) || ( elementFlags & CEF_AutoDefault ) ) { + x1 += diw; + y1 += diw; + x2 -= diw; + y2 -= diw; + } + + if ( (!( elementFlags & CEF_IsFlat )) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) { + if ( useBevelButton ) { + // fix for toggle buttons... + if ( flags & (Style_Down | Style_On) ) + flags |= Style_Sunken; + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1, + x2 - x1 + 1, + y2 - y1 + 1 ), + myCg, flags, opt ); + } else { + + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x1, y1, + x2 - x1 + 1, + y2 - y1 + 1 ), + myCg, flags, opt ); + } + } + + + if ( p->brush().style() != NoBrush ) + p->setBrush( NoBrush ); + break; +#endif + } + case CE_PushButtonLabel: + { +#ifndef TQT_NO_PUSHBUTTON + bool on; + int x, y, w, h; + SFlags flags; + flags = Style_Default; + on = (( elementFlags & CEF_IsDown ) || ( elementFlags & CEF_IsOn )); + r.rect( &x, &y, &w, &h ); + if ( elementFlags & CEF_IsMenuWidget ) { + int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); + + TQColorGroup g = cg; + int xx = x + w - dx - 4; + int yy = y - 3; + int hh = h + 6; + + if ( !on ) { + p->setPen( g.mid() ); + p->drawLine( xx, yy + 2, xx, yy + hh - 3 ); + p->setPen( g.button() ); + p->drawLine( xx + 1, yy + 1, xx + 1, yy + hh - 2 ); + p->setPen( g.light() ); + p->drawLine( xx + 2, yy + 2, xx + 2, yy + hh - 2 ); + } + if ( elementFlags & CEF_IsEnabled ) + flags |= Style_Enabled; + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect(x + w - dx - 1, y + 2, + dx, h - 4), + g, flags, opt ); + w -= dx; + } +#ifndef TQT_NO_ICONSET + if ( !ceData.iconSet.isNull() ) { + TQIconSet::Mode mode = ( elementFlags & CEF_IsEnabled ) + ? TQIconSet::Normal : TQIconSet::Disabled; + if ( mode == TQIconSet::Normal && ( elementFlags & CEF_HasFocus ) ) + mode = TQIconSet::Active; + TQIconSet::State state = TQIconSet::Off; + if ( ( elementFlags & CEF_BiState ) && ( elementFlags & CEF_IsOn ) ) + state = TQIconSet::On; + TQPixmap pixmap = ceData.iconSet.pixmap( TQIconSet::Small, + mode, state ); + int pixw = pixmap.width(); + int pixh = pixmap.height(); + p->drawPixmap( x + 2, y + h / 2 - pixh / 2, pixmap ); + x += pixw + 4; + w -= pixw + 4; + } +#endif + drawItem( p, TQRect( x, y, w, h ), + AlignCenter | ShowPrefix, + ceData.colorGroup, ( elementFlags & CEF_IsEnabled ), + (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, -1, + on ? &ceData.colorGroup.brightText() + : &ceData.colorGroup.buttonText() ); + if ( elementFlags & CEF_HasFocus ) + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), + cg, flags ); + break; +#endif + } + default: + TQWindowsStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget ); + break; + } +} + +/*!\reimp + */ +void TQPlatinumStyle::drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how, + SCFlags sub, + SCFlags subActive, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch ( control ) { + case CC_ComboBox: + { + int x, + y, + w, + h; + r.rect( &x, &y, &w, &h ); + p->fillRect( x + 2, y + 2, w - 4, + h - 4, cg.brush(TQColorGroup::Button) ); + // the bright side + p->setPen(cg.shadow()); + p->drawLine( x, y, x + w - 1, y ); + p->drawLine( x, y, x, y + h - 1 ); + + p->setPen( cg.light() ); + p->drawLine( x + 1, y + 1, + x + w - 2, y + 1 ); + p->drawLine( x + 1, y + 1, + x + 1, y + h - 2 ); + + // the dark side! + + + p->setPen( cg.mid() ); + p->drawLine( x + 2, y + h - 2, + x + w - 2, y + h - 2 ); + p->drawLine( x + w - 2, y + 2, + x + w - 2, y + h - 2 ); + + p->setPen (cg.shadow() ); + p->drawLine( x + 1, y + h - 1, + x + w - 1, y + h - 1 ); + p->drawLine( x + w - 1, y, + x + w - 1, y + h - 1 ); + + // top left corner: + p->setPen( cg.background() ); + p->drawPoint( x, y ); + p->drawPoint( x + 1, y ); + p->drawPoint( x, y + 1 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + 1, y + 1 ); + p->setPen( white ); + p->drawPoint( x + 3, y + 3 ); + // bottom left corner: + p->setPen( cg.background() ); + p->drawPoint( x, y + h - 1 ); + p->drawPoint( x + 1, y + h - 1 ); + p->drawPoint( x, y + h - 2 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + 1, y + h - 2 ); + // top right corner: + p->setPen( cg.background() ); + p->drawPoint( x + w - 1, y ); + p->drawPoint( x + w - 2, y ); + p->drawPoint( x + w - 1, y + 1 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + w - 2, y + 1 ); + // bottom right corner: + p->setPen( cg.background() ); + p->drawPoint( x + w - 1, y + h - 1 ); + p->drawPoint( x + w - 2, y + h - 1 ); + p->drawPoint( x + w - 1, y + h - 2 ); + p->setPen( cg.shadow() ); + p->drawPoint( x + w - 2, y + h - 2 ); + p->setPen( cg.dark() ); + p->drawPoint( x + w - 3, y + h - 3 ); + + if ( sub & SC_ComboBoxArrow ) { + TQRect rTmp = querySubControlMetrics( CC_ComboBox, ceData, elementFlags, + SC_ComboBoxArrow, opt, widget ); + int xx = rTmp.x(), + yy = rTmp.y(), + ww = rTmp.width(), + hh = rTmp.height(); + // the bright side + + p->setPen( cg.mid() ); + p->drawLine( xx, yy+2, xx, yy+hh-3 ); + + p->setPen( cg.button() ); + p->drawLine( xx+1, yy+1, xx+ww-2, yy+1 ); + p->drawLine( xx+1, yy+1, xx+1, yy+hh-2 ); + + p->setPen( cg.light() ); + p->drawLine( xx+2, yy+2, xx+2, yy+hh-2 ); + p->drawLine( xx+2, yy+2, xx+ww-2, yy+2 ); + + + // the dark side! + + p->setPen( cg.mid() ); + p->drawLine( xx+3, yy+hh-3 ,xx+ww-3, yy+hh-3 ); + p->drawLine( xx+ww-3, yy+3, xx+ww-3, yy+hh-3 ); + + p->setPen( cg.dark() ); + p->drawLine( xx+2, yy+hh-2 ,xx+ww-2, yy+hh-2 ); + p->drawLine( xx+ww-2, yy+2, xx+ww-2, yy+hh-2 ); + + p->setPen( cg.shadow() ); + p->drawLine( xx+1, yy+hh-1,xx+ww-1, yy+hh-1 ); + p->drawLine( xx+ww-1, yy, xx+ww-1, yy+hh-1 ); + + // top right corner: + p->setPen( cg.background() ); + p->drawPoint( xx + ww - 1, yy ); + p->drawPoint( xx + ww - 2, yy ); + p->drawPoint( xx + ww - 1, yy + 1 ); + p->setPen( cg.shadow() ); + p->drawPoint( xx + ww - 2, yy + 1 ); + // bottom right corner: + p->setPen( cg.background() ); + p->drawPoint( xx + ww - 1, yy + hh - 1 ); + p->drawPoint( xx + ww - 2, yy + hh - 1 ); + p->drawPoint( xx + ww - 1, yy + hh - 2 ); + p->setPen( cg.shadow() ); + p->drawPoint( xx + ww - 2, yy + hh - 2 ); + p->setPen( cg.dark() ); + p->drawPoint( xx + ww - 3, yy + hh - 3 ); + p->setPen( cg.mid() ); + p->drawPoint( xx + ww - 4, yy + hh - 4 ); + + // and the arrows + p->setPen( cg.foreground() ); + TQPointArray a ; + a.setPoints( 7, -3,1, 3,1, -2,0, 2,0, -1,-1, 1,-1, 0,-2 ); + a.translate( xx + ww / 2, yy + hh / 2 - 3 ); + p->drawLineSegments( a, 0, 3 ); // draw arrow + p->drawPoint( a[6] ); + a.setPoints( 7, -3,-1, 3,-1, -2,0, 2,0, -1,1, 1,1, 0,2 ); + a.translate( xx + ww / 2, yy + hh / 2 + 2 ); + p->drawLineSegments( a, 0, 3 ); // draw arrow + p->drawPoint( a[6] ); + + } +#ifndef TQT_NO_COMBOBOX + if ( sub & SC_ComboBoxEditField ) { + // sadly this is pretty much the windows code, except + // for the first fillRect call... + TQRect re = + TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, + ceData, elementFlags, + SC_ComboBoxEditField, TQStyleOption::Default, widget ), + ceData, elementFlags ); + if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) + p->fillRect( re.x() + 1, re.y() + 1, + re.width() - 2, re.height() - 2, + cg.brush( TQColorGroup::Highlight ) ); + + if ( elementFlags & CEF_HasFocus ) { + p->setPen( cg.highlightedText() ); + p->setBackgroundColor( cg.highlight() ); + } else { + p->setPen( cg.text() ); + p->setBackgroundColor( cg.background() ); + } + + if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) { + TQRect re = + TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, + widget ), + ceData, elementFlags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg, + Style_FocusAtBorder, + TQStyleOption(cg.highlight())); + } + if ( elementFlags & CEF_IsEditable ) { + // need this for the moment... + // was the code in comboButton rect + TQRect ir( x + 3, y + 3, + w - 6 - 16, h - 6 ); + if ( TQApplication::reverseLayout() ) + ir.moveBy( 16, 0 ); + // end comboButtonRect... + ir.setRect( ir.left() - 1, ir.top() - 1, ir.width() + 2, + ir.height() + 2 ); + qDrawShadePanel( p, ir, cg, TRUE, 2, 0 ); + } + } +#endif + break; + } + case CC_Slider: + { +#ifndef TQT_NO_SLIDER + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); + int ticks = ceData.tickMarkSetting; + + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, + opt, widget), + handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, + opt, widget); + + if ((sub & SC_SliderGroove) && groove.isValid()) { + p->fillRect( groove, cg.brush(TQColorGroup::Background) ); + + int x, y, w, h; + int mid = thickness / 2; + + if ( ticks & TQSlider::Above ) + mid += len / 8; + if ( ticks & TQSlider::Below ) + mid -= len / 8; + + if ( ceData.orientation == Horizontal ) { + x = 0; + y = groove.y() + mid - 3; + w = ceData.rect.width(); + h = 7; + } else { + x = groove.x() + mid - 3; + y = 0; + w = 7; + h = ceData.rect.height(); + } + + p->fillRect( x, y, w, h, cg.brush( TQColorGroup::Dark )); + // the dark side + p->setPen( cg.dark() ); + p->drawLine( x, y, x + w - 1, y ); + p->drawLine( x, y, x, y + h - 1); + p->setPen( cg.shadow() ); + p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); + p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); + // the bright side! + p->setPen(cg.shadow()); + p->drawLine( x + 1, y + h - 2, x + w - 2, y + h - 2 ); + p->drawLine( x + w - 2, y + 1, x + w - 2, y + h - 2 ); + p->setPen( cg.light() ); + p->drawLine( x, y + h - 1, x + w - 1, y + h - 1 ); + p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); + // top left corner: + p->setPen(cg.background()); + p->drawPoint( x, y ); + p->drawPoint( x + 1, y ); + p->drawPoint( x, y + 1 ); + p->setPen(cg.shadow()); + p->drawPoint( x + 1, y + 1 ); + // bottom left corner: + p->setPen( cg.background() ); + p->drawPoint( x, y + h - 1 ); + p->drawPoint( x + 1, y + h - 1 ); + p->drawPoint( x, y + h - 2 ); + p->setPen( cg.light() ); + p->drawPoint( x + 1, y + h - 2 ); + // top right corner: + p->setPen( cg.background() ); + p->drawPoint( x + w - 1, y ); + p->drawPoint( x + w - 2, y ); + p->drawPoint( x + w - 1, y + 1 ); + p->setPen( cg.dark() ); + p->drawPoint( x + w - 2, y + 1 ); + // bottom right corner: + p->setPen( cg.background() ); + p->drawPoint( x + w - 1, y + h - 1 ); + p->drawPoint( x + w - 2, y + h - 1 ); + p->drawPoint( x + w - 1, y + h - 2 ); + p->setPen( cg.light() ); + p->drawPoint( x + w - 2, y + h - 2 ); + p->setPen( cg.dark() ); + p->drawPoint( x + w - 3, y + h - 3 ); + // ### end slider groove + + if ( how & Style_HasFocus ) + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg ); + } + + if ((sub & SC_SliderHandle) && handle.isValid()) { + const TQColor c0 = cg.shadow(); + const TQColor c1 = cg.dark(); + const TQColor c3 = cg.light(); + + int x1 = handle.x(); + int x2 = handle.x() + handle.width() - 1; + int y1 = handle.y(); + int y2 = handle.y() + handle.height() - 1; + int mx = handle.width() / 2; + int my = handle.height() / 2; + + if ( ceData.orientation == Vertical ) { + // Background + TQBrush oldBrush = p->brush(); + p->setBrush( cg.brush( TQColorGroup::Button ) ); + p->setPen( NoPen ); + TQPointArray a(6); + a.setPoint( 0, x1 + 1, y1 + 1 ); + a.setPoint( 1, x2 - my + 2, y1 + 1 ); + a.setPoint( 2, x2 - 1, y1 + my - 1 ); + a.setPoint( 3, x2 - 1, y2 - my + 1 ); + a.setPoint( 4, x2 - my + 2, y2 - 1 ); + a.setPoint( 5, x1 + 1, y2 - 1 ); + p->drawPolygon( a ); + p->setBrush( oldBrush ); + + // shadow border + p->setPen( c0 ); + p->drawLine( x1, y1 + 1, x1,y2 - 1 ); + p->drawLine( x2 - my + 2, y1, x2, y1 + my - 2 ); + p->drawLine( x2 - my + 2, y2, x2, y1 + my + 2 ); + p->drawLine( x2, y1 + my - 2, x2, y1 + my + 2 ); + p->drawLine( x1 + 1, y1, x2 - my + 2, y1 ); + p->drawLine( x1 + 1, y2, x2 - my + 2, y2 ); + + // light shadow + p->setPen( c3 ); + p->drawLine( x1 + 1, y1 + 2, x1 + 1, y2 - 2 ); + p->drawLine( x1 + 1, y1 + 1, x2 - my + 2, y1 + 1 ); + p->drawLine( x2 - my + 2, y1 + 1, x2 - 1, y1 + my - 2 ); + + // dark shadow + p->setPen(c1); + p->drawLine( x2 - 1, y1 + my - 2, x2 - 1, y1 + my + 2 ); + p->drawLine( x2 - my + 2, y2 - 1, x2 - 1, y1 + my + 2 ); + p->drawLine( x1 + 1, y2 - 1, x2 -my + 2, y2 - 1 ); + + drawRiffles( p, handle.x(), handle.y() + 2, handle.width() - 3, + handle.height() - 4, cg, TRUE ); + } else { // Horizontal + TQBrush oldBrush = p->brush(); + p->setBrush( cg.brush( TQColorGroup::Button ) ); + p->setPen( NoPen ); + TQPointArray a(6); + a.setPoint( 0, x2 - 1, y1 + 1 ); + a.setPoint( 1, x2 - 1, y2 - mx + 2 ); + a.setPoint( 2, x2 - mx + 1, y2 - 1 ); + a.setPoint( 3, x1 + mx - 1, y2 - 1 ); + a.setPoint( 4, x1 + 1, y2 - mx + 2 ); + a.setPoint( 5, x1 + 1, y1 + 1 ); + p->drawPolygon( a ); + p->setBrush( oldBrush ); + + // shadow border + p->setPen( c0 ); + p->drawLine( x1 + 1, y1, x2 - 1, y1 ); + p->drawLine( x1, y2 - mx + 2, x1 + mx - 2, y2 ); + p->drawLine( x2, y2 - mx + 2, x1 + mx + 2, y2 ); + p->drawLine( x1 + mx - 2, y2, x1 + mx + 2, y2 ); + p->drawLine( x1, y1 + 1, x1, y2 - mx + 2 ); + p->drawLine( x2, y1 + 1, x2, y2 - mx + 2 ); + + // light shadow + p->setPen(c3); + p->drawLine( x1 + 1, y1 + 1, x2 - 1, y1 + 1 ); + p->drawLine( x1 + 1, y1 + 1, x1 + 1, y2 - mx + 2 ); + + // dark shadow + p->setPen(c1); + p->drawLine( x2 - 1, y1 + 1, x2 - 1, y2 - mx + 2 ); + p->drawLine( x1 + 1, y2 - mx + 2, x1 + mx - 2, y2 - 1 ); + p->drawLine( x2 - 1, y2 - mx + 2, x1 + mx + 2, y2 - 1 ); + p->drawLine( x1 + mx - 2, y2 - 1, x1 + mx + 2, y2 - 1 ); + + drawRiffles( p, handle.x() + 2, handle.y(), handle.width() - 4, + handle.height() - 5, cg, FALSE ); + } + } + + if ( sub & SC_SliderTickmarks ) + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, + cg, how, SC_SliderTickmarks, + subActive, opt, widget ); +#endif + break; + } + default: + TQWindowsStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, + how, sub, subActive, opt, widget ); + break; + } +} + + + +/*!\reimp + */ +TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sc, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch( control ) { +#ifndef TQT_NO_COMBOBOX + case CC_ComboBox: + switch( sc ) { + case SC_ComboBoxArrow: { + TQRect ir = ceData.rect; + int xx; + if( TQApplication::reverseLayout() ) + xx = ir.x(); + else + xx = ir.x() + ir.width() - 20; + return TQRect( xx, ir.y(), 20, ir.height()); } + default: + break; + } + break; +#endif +#ifndef TQT_NO_SCROLLBAR + case CC_ScrollBar: { + int sliderStart = ceData.startStep; + int sbextent = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags, widget ); + int maxlen = ((ceData.orientation == TQt::Horizontal) ? + ceData.rect.width() : ceData.rect.height()) - ( sbextent * 2 ); + + int sliderlen; + + // calculate length + if ( ceData.maxSteps != ceData.minSteps ) { + uint range = ceData.maxSteps - ceData.minSteps; + sliderlen = ( ceData.pageStep * maxlen ) / + ( range + ceData.pageStep ); + + int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget ); + if ( sliderlen < slidermin || range > INT_MAX / 2 ) + sliderlen = slidermin; + if ( sliderlen > maxlen ) + sliderlen = maxlen; + } else { + sliderlen = maxlen; + } + + switch ( sc ) { + case SC_ScrollBarSubLine: + if ( ceData.orientation == TQt::Horizontal ) { + int buttonw = TQMIN( ceData.rect.width() / 2, sbextent ); + return TQRect( ceData.rect.width() - 2 * buttonw, 0, buttonw, sbextent ); + } else { + int buttonh = TQMIN( ceData.rect.height() / 2, sbextent ); + return TQRect( 0, ceData.rect.height() - 2 * buttonh, sbextent, buttonh ); + } + case SC_ScrollBarAddLine: + if ( ceData.orientation == TQt::Horizontal ) { + int buttonw = TQMIN( ceData.rect.width() / 2, sbextent ); + return TQRect( ceData.rect.width() - buttonw, 0, sbextent, buttonw ); + } else { + int buttonh = TQMIN( ceData.rect.height() / 2, sbextent ); + return TQRect(0, ceData.rect.height() - buttonh, sbextent, buttonh ); + } + case SC_ScrollBarSubPage: + if ( ceData.orientation == TQt::Horizontal ) + return TQRect( 1, 0, sliderStart, sbextent ); + return TQRect( 0, 1, sbextent, sliderStart ); + case SC_ScrollBarAddPage: + if ( ceData.orientation == TQt::Horizontal ) + return TQRect( sliderStart + sliderlen, 0, maxlen - sliderStart - sliderlen, sbextent ); + return TQRect( 0, sliderStart + sliderlen, sbextent, maxlen - sliderStart - sliderlen ); + case SC_ScrollBarGroove: + if ( ceData.orientation == TQt::Horizontal ) + return TQRect( 1, 0, ceData.rect.width() - sbextent * 2, ceData.rect.height() ); + return TQRect( 0, 1, ceData.rect.width(), ceData.rect.height() - sbextent * 2 ); + default: + break; + } + break; } +#endif +#ifndef TQT_NO_SLIDER + case CC_Slider: { + int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget); + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget); + int mid = thickness / 2; + int ticks = ceData.tickMarkSetting; + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); + + switch ( sc ) { + case SC_SliderGroove: + if ( ticks & TQSlider::Above ) + mid += len / 8; + if ( ticks & TQSlider::Below ) + mid -= len / 8; + if ( ceData.orientation == TQSlider::Horizontal ) + return TQRect( 0, tickOffset, ceData.rect.width(), thickness ); + return TQRect( tickOffset, 0, thickness, ceData.rect.height() ); + default: + break; + } + break; } +#endif + default: + break; + } + return TQWindowsStyle::querySubControlMetrics( control, ceData, elementFlags, sc, opt, widget ); +} + + +/*!\reimp + */ +int TQPlatinumStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, + const TQWidget *widget ) const +{ + int ret; + switch( metric ) { + case PM_ButtonDefaultIndicator: + ret = 3; + break; + case PM_ButtonShiftHorizontal: + case PM_ButtonShiftVertical: + ret = 0; + break; + case PM_IndicatorWidth: + ret = 15; + break; + case PM_IndicatorHeight: + ret = 13; + break; + case PM_ExclusiveIndicatorHeight: + case PM_ExclusiveIndicatorWidth: + ret = 15; + break; + case PM_SliderLength: + ret = 17; + break; + case PM_MaximumDragDistance: + ret = -1; + break; + default: + ret = TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget ); + break; + } + return ret; +} + +/*!\reimp + */ +TQRect TQPlatinumStyle::subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const +{ + TQRect rect; + switch ( r ) { + case SR_ComboBoxFocusRect: + { + TQRect tmpR = ceData.rect; + rect = TQRect( tmpR.x() + 4, tmpR.y() + 4, tmpR.width() - 8 - 16, + tmpR.height() - 8 ); + break; + } + default: + rect = TQWindowsStyle::subRect( r, ceData, elementFlags, widget ); + break; + } + return rect; +} + +/*! + Mixes two colors \a c1 and \a c2 to a new color. +*/ +TQColor TQPlatinumStyle::mixedColor(const TQColor &c1, const TQColor &c2) const +{ + int h1,s1,v1,h2,s2,v2; + c1.hsv(&h1,&s1,&v1); + c2.hsv(&h2,&s2,&v2); + return TQColor( (h1+h2)/2, (s1+s2)/2, (v1+v2)/2, TQColor::Hsv ); +} + +/*! + Draws the nifty Macintosh decoration used on sliders using painter + \a p and colorgroup \a g. \a x, \a y, \a w, \a h and \a horizontal + specify the geometry and orientation of the riffles. +*/ +void TQPlatinumStyle::drawRiffles( TQPainter* p, int x, int y, int w, int h, + const TQColorGroup &g, bool horizontal ) const +{ + if (!horizontal) { + if (h > 20) { + y += (h-20)/2 ; + h = 20; + } + if (h > 8) { + int n = h / 4; + int my = y+h/2-n; + int i ; + p->setPen(g.light()); + for (i=0; idrawLine(x+3, my+2*i, x+w-5, my+2*i); + } + p->setPen(g.dark()); + my++; + for (i=0; idrawLine(x+4, my+2*i, x+w-4, my+2*i); + } + } + } + else { + if (w > 20) { + x += (w-20)/2 ; + w = 20; + } + if (w > 8) { + int n = w / 4; + int mx = x+w/2-n; + int i ; + p->setPen(g.light()); + for (i=0; idrawLine(mx+2*i, y+3, mx + 2*i, y+h-5); + } + p->setPen(g.dark()); + mx++; + for (i=0; idrawLine(mx+2*i, y+4, mx + 2*i, y+h-4); + } + } + } +} + + +#endif diff --git a/src/styles/tqplatinumstyle.h b/src/styles/tqplatinumstyle.h new file mode 100644 index 000000000..74e319f9f --- /dev/null +++ b/src/styles/tqplatinumstyle.h @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Definition of Platinum-like style class +** +** Created : 981231 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQPLATINUMSTYLE_H +#define TQPLATINUMSTYLE_H + +#ifndef QT_H +#include "tqwindowsstyle.h" +#endif // QT_H + +#if !defined(TQT_NO_STYLE_PLATINUM) || defined(QT_PLUGIN) + +class TQPalette; + +#if defined(QT_PLUGIN) +#define Q_EXPORT_STYLE_PLATINUM +#else +#define Q_EXPORT_STYLE_PLATINUM TQ_EXPORT +#endif + +class Q_EXPORT_STYLE_PLATINUM TQPlatinumStyle : public TQWindowsStyle +{ + TQ_OBJECT +public: + TQPlatinumStyle(); + virtual ~TQPlatinumStyle(); + + // new Style Stuff + void drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default ) const; + + void drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + void drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how = Style_Default, +#ifdef Q_QDOC + SCFlags sub = SC_All, +#else + SCFlags sub = (uint)SC_All, +#endif + SCFlags subActive = SC_None, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + TQRect querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sc, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; + + TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const; + +protected: + TQColor mixedColor(const TQColor &, const TQColor &) const; + void drawRiffles( TQPainter* p, int x, int y, int w, int h, + const TQColorGroup &g, bool horizontal ) const; +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQPlatinumStyle( const TQPlatinumStyle & ); + TQPlatinumStyle& operator=( const TQPlatinumStyle & ); +#endif +}; + +#endif // TQT_NO_STYLE_PLATINUM + +#endif // TQPLATINUMSTYLE_H diff --git a/src/styles/tqsgistyle.cpp b/src/styles/tqsgistyle.cpp new file mode 100644 index 000000000..43e2f7db2 --- /dev/null +++ b/src/styles/tqsgistyle.cpp @@ -0,0 +1,1538 @@ +/**************************************************************************** +** +** Implementation of Motif-like style class +** +** Created : 981231 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqsgistyle.h" + +#if !defined(TQT_NO_STYLE_SGI) || defined(QT_PLUGIN) + +#include "tqpopupmenu.h" +#include "ntqapplication.h" +#include "tqbutton.h" +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqpixmap.h" +#include "tqpalette.h" +#include "tqwidget.h" +#include "tqpushbutton.h" +#include "tqscrollbar.h" +#include "tqcombobox.h" +#include "tqslider.h" +#include "tqtextedit.h" +#include "tqtoolbar.h" +#include "tqlineedit.h" +#include "tqmenubar.h" +#include + +#ifndef TQT_NO_SLIDER +struct SliderLastPosition +{ + SliderLastPosition() : rect(0,-1,0,-1), slider(0) {} + TQRect rect; + const void* slider; +}; +#endif + +#ifndef TQT_NO_SCROLLBAR +struct ScrollbarLastPosition +{ + ScrollbarLastPosition() : rect( 0,-1, 0,-1 ), scrollbar(0) {} + TQRect rect; + const void* scrollbar; +}; +#endif + +class TQSGIStylePrivate +{ +public: + TQSGIStylePrivate() + : hotWidget( 0 ), mousePos( -1, -1 ) + { + } + + const void* hotWidget; + TQPoint mousePos; +#ifndef TQT_NO_SCROLLBAR + ScrollbarLastPosition lastScrollbarRect; +#endif +#ifndef TQT_NO_SLIDER + SliderLastPosition lastSliderRect; +#endif +}; + +/*! + \class TQSGIStyle tqsgistyle.h + \brief The TQSGIStyle class provides SGI/Irix look and feel. + + \ingroup appearance + + This class implements the SGI look and feel. It resembles the + SGI/Irix Motif GUI style as closely as TQStyle allows. +*/ + +/*! + Constructs a TQSGIStyle. + + If \a useHighlightCols is FALSE (default value), the style will + polish the application's color palette to emulate the Motif way of + highlighting, which is a simple inversion between the base and the + text color. + + \sa TQMotifStyle::useHighlightColors() +*/ +TQSGIStyle::TQSGIStyle( bool useHighlightCols ) : TQMotifStyle( useHighlightCols ), isApplicationStyle( 0 ) +{ + d = new TQSGIStylePrivate; +} + +/*! + Destroys the style. +*/ +TQSGIStyle::~TQSGIStyle() +{ + delete d; +} + +/*! + \reimp + + Changes some application-wide settings to be SGI-like, e.g. sets a + bold italic font for menu options. +*/ +void +TQSGIStyle::applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ + isApplicationStyle = 1; + TQMotifStyle::polish( ceData, elementFlags, ptr ); + + TQPalette pal = TQApplication::palette(); + // check this on SGI-Boxes + //pal.setColor( TQColorGroup::Background, pal.active().midlight() ); + if (pal.active().button() == pal.active().background()) + pal.setColor( TQColorGroup::Button, pal.active().button().dark(120) ); + // darker basecolor in list-widgets + pal.setColor( TQColorGroup::Base, pal.active().base().dark(130) ); + if (! useHighlightColors() ) { + pal.setColor( TQPalette::Active, TQColorGroup::Highlight, pal.active().text() ); + pal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, pal.active().base() ); + pal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, pal.inactive().text() ); + pal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, pal.inactive().base() ); + pal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, pal.disabled().text() ); + pal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, pal.disabled().base() ); + } + TQApplication::setPalette( pal, TRUE ); + + // different basecolor and highlighting in Q(Multi)LineEdit + pal.setColor( TQColorGroup::Base, TQColor(211,181,181) ); + pal.setColor( TQPalette::Active, TQColorGroup::Highlight, pal.active().midlight() ); + pal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, pal.active().text() ); + pal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, pal.inactive().midlight() ); + pal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, pal.inactive().text() ); + pal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, pal.disabled().midlight() ); + pal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, pal.disabled().text() ); + + TQApplication::setPalette( pal, TRUE, "TQLineEdit" ); + TQApplication::setPalette( pal, TRUE, "TQTextEdit" ); + TQApplication::setPalette( pal, TRUE, "TQDateTimeEditBase" ); + + pal = TQApplication::palette(); + pal.setColor( TQColorGroup::Button, pal.active().background() ); + TQApplication::setPalette( pal, TRUE, "TQMenuBar" ); + TQApplication::setPalette( pal, TRUE, "TQToolBar" ); + TQApplication::setPalette( pal, TRUE, "TQPopupMenu" ); +} + +/*! \reimp +*/ +void +TQSGIStyle::applicationUnPolish( const TQStyleControlElementData&, ControlElementFlags, void * ) +{ + TQFont f = TQApplication::font(); + TQApplication::setFont( f, TRUE ); // get rid of the special fonts for special widget classes +} + +/*! + \reimp + + Installs an event filter for several widget classes to enable + hovering. +*/ +void +TQSGIStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ + TQMotifStyle::polish(ceData, elementFlags, ptr); + + if ( !isApplicationStyle ) { + TQPalette sgiPal = TQApplication::palette(); + + sgiPal.setColor( TQColorGroup::Background, sgiPal.active().midlight() ); + if (sgiPal.active().button() == sgiPal.active().background()) + sgiPal.setColor( TQColorGroup::Button, sgiPal.active().button().dark(110) ); + sgiPal.setColor( TQColorGroup::Base, sgiPal.active().base().dark(130) ); + if (! useHighlightColors() ) { + sgiPal.setColor( TQPalette::Active, TQColorGroup::Highlight, sgiPal.active().text() ); + sgiPal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, sgiPal.active().base() ); + sgiPal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, sgiPal.inactive().text() ); + sgiPal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, sgiPal.inactive().base() ); + sgiPal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, sgiPal.disabled().text() ); + sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().base() ); + } + + if ( (ceData.widgetObjectTypes.contains("TQLineEdit")) || (ceData.widgetObjectTypes.contains("TQTextEdit")) ) { + // different basecolor and highlighting in Q(Multi)LineEdit + sgiPal.setColor( TQColorGroup::Base, TQColor(211,181,181) ); + sgiPal.setColor( TQPalette::Active, TQColorGroup::Highlight, sgiPal.active().midlight() ); + sgiPal.setColor( TQPalette::Active, TQColorGroup::HighlightedText, sgiPal.active().text() ); + sgiPal.setColor( TQPalette::Inactive, TQColorGroup::Highlight, sgiPal.inactive().midlight() ); + sgiPal.setColor( TQPalette::Inactive, TQColorGroup::HighlightedText, sgiPal.inactive().text() ); + sgiPal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, sgiPal.disabled().midlight() ); + sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().text() ); + + } else if ( (ceData.widgetObjectTypes.contains("TQMenuBar")) || (ceData.widgetObjectTypes.contains("TQToolBar")) ) { + sgiPal.setColor( TQColorGroup::Button, sgiPal.active().midlight() ); + } + + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetPalette, TQStyleWidgetActionRequestData(sgiPal)); + } + + if ( (ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQSlider")) || (ceData.widgetObjectTypes.contains("TQScrollBar")) ) { + installObjectEventHandler(ceData, elementFlags, ptr, this); + widgetActionRequest(ceData, elementFlags, ptr, WAR_EnableMouseTracking); +#ifndef TQT_NO_SCROLLBAR + if ( ceData.widgetObjectTypes.contains("TQScrollBar") ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::NoBackground)); + } +#endif + } else if ( ceData.widgetObjectTypes.contains("TQComboBox") ) { + TQFont f = TQApplication::font(); + f.setBold( TRUE ); + f.setItalic( TRUE ); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f)); +#ifndef TQT_NO_MENUBAR + } else if ( ceData.widgetObjectTypes.contains("TQMenuBar") ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::StyledPanel | TQFrame::Raised)); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::PaletteBackground)); + TQFont f = TQApplication::font(); + f.setBold( TRUE ); + f.setItalic( TRUE ); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f)); +#endif +#ifndef TQT_NO_POPUPMENU + } else if ( ceData.widgetObjectTypes.contains("TQPopupMenu") ) { + TQStyleWidgetActionRequestData requestData; + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetLineWidth, TQStyleWidgetActionRequestData(pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ) + 1)); + TQFont f = TQApplication::font(); + f.setBold( TRUE ); + f.setItalic( TRUE ); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f)); +#endif + } else if ( (ceData.widgetObjectTypes.contains("TQToolBar")) || (ceData.widgetObjectTypes.contains("TQToolBarSeparator")) ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::PaletteBackground)); + } +} + +/*! \reimp */ +void +TQSGIStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ + if ( (ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQSlider")) || (ceData.widgetObjectTypes.contains("TQScrollBar")) ) { + removeObjectEventHandler(ceData, elementFlags, ptr, this); +#ifndef TQT_NO_POPUPMENU + } else if ( ceData.widgetObjectTypes.contains("TQPopupMenu") ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetLineWidth, TQStyleWidgetActionRequestData(pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ))); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(TQApplication::font())); +#endif +#if !defined(TQT_NO_MENUBAR) || !defined(TQT_NO_COMBOBOX) + } else if ( (ceData.widgetObjectTypes.contains("TQMenuBar")) || (ceData.widgetObjectTypes.contains("TQComboBox")) ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(TQApplication::font())); +#endif + } +} + +/*! \reimp */ +bool TQSGIStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) +{ + if ( (!(ceData.widgetObjectTypes.contains("TQWidget"))) || (e->type() == TQEvent::Paint) ) + return TQMotifStyle::objectEventHandler( ceData, elementFlags, source, e ); + + switch ( e->type() ) { + case TQEvent::MouseButtonPress: + { +#ifndef TQT_NO_SCROLLBAR + if (ceData.widgetObjectTypes.contains("TQScrollBar")) { + d->lastScrollbarRect.rect = ceData.sliderRect; + d->lastScrollbarRect.scrollbar = source; + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); + } else +#endif + { +#ifndef TQT_NO_SLIDER + if (ceData.widgetObjectTypes.contains("TQSlider")) { + d->lastSliderRect.rect = ceData.sliderRect; + d->lastSliderRect.slider = source; + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); + } +#endif + } + } + break; + + case TQEvent::MouseButtonRelease: + { + if ( 0 ) { +#ifndef TQT_NO_SCROLLBAR + } else if (ceData.widgetObjectTypes.contains("TQScrollBar")) { + TQRect oldRect = d->lastScrollbarRect.rect; + d->lastScrollbarRect.rect = TQRect( 0, -1, 0, -1 ); + widgetActionRequest(ceData, elementFlags, source, WAR_RepaintRect, TQStyleWidgetActionRequestData(oldRect)); +#endif +#ifndef TQT_NO_SLIDER + } else if (ceData.widgetObjectTypes.contains("TQSlider")) { + TQRect oldRect = d->lastSliderRect.rect; + d->lastSliderRect.rect = TQRect( 0, -1, 0, -1 ); + widgetActionRequest(ceData, elementFlags, source, WAR_RepaintRect, TQStyleWidgetActionRequestData(oldRect)); +#endif + } + } + break; + + case TQEvent::MouseMove: + if ( !(elementFlags & CEF_IsActiveWindow) ) + break; + if ( ((TQMouseEvent*)e)->button() ) + break; + + d->hotWidget = source; + d->mousePos = ((TQMouseEvent*)e)->pos(); + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); + break; + + case TQEvent::Enter: + if ( !(elementFlags & CEF_IsActiveWindow) ) + break; + d->hotWidget = source; + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); + break; + + case TQEvent::Leave: + if ( !(elementFlags & CEF_IsActiveWindow) ) + break; + if ( source == d->hotWidget) { + d->hotWidget = 0; + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); + } + break; + + default: + break; + } + return TQMotifStyle::objectEventHandler( ceData, elementFlags, source, e ); +} + +static const int sgiItemFrame = 2; // menu item frame width +// static const int sgiSepHeight = 1; // separator item height +static const int sgiItemHMargin = 3; // menu item hor text margin +static const int sgiItemVMargin = 2; // menu item ver text margin +static const int sgiArrowHMargin = 6; // arrow horizontal margin +static const int sgiTabSpacing = 12; // space between text and tab +// static const int sgiCheckMarkHMargin = 2; // horiz. margins of check mark ### not used?!? +static const int sgiCheckMarkSpace = 20; + +/*! \reimp */ +int TQSGIStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const +{ + switch ( metric ) { + case PM_DefaultFrameWidth: + return 2; + + case PM_ButtonDefaultIndicator: + return 4; + + case PM_ScrollBarExtent: + return 21; + + case PM_IndicatorWidth: + case PM_IndicatorHeight: + return 14; + + case PM_ExclusiveIndicatorWidth: + case PM_ExclusiveIndicatorHeight: + return 12; + + case PM_SplitterWidth: + return TQMAX( 10, TQApplication::globalStrut().width() ); + + case PM_MenuIndicatorFrameHBorder: + return (sgiItemFrame+2); + case PM_MenuIndicatorFrameVBorder: + return (sgiItemFrame+4); + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + return sgiItemFrame; + + default: + break; + } + return TQMotifStyle::pixelMetric( metric, ceData, elementFlags, widget ); +} + +static void drawPanel( TQPainter *p, int x, int y, int w, int h, + const TQColorGroup &g, bool sunken, + int lineWidth, const TQBrush* fill) +{ + if ( w == 0 || h == 0 ) + return; +#if defined(CHECK_RANGE) + ASSERT( w > 0 && h > 0 && lineWidth >= 0 ); +#endif + TQPen oldPen = p->pen(); // save pen + TQPointArray a( 4*lineWidth ); + if ( sunken ) + p->setPen( g.dark() ); + else + p->setPen( g.light() ); + int x1, y1, x2, y2; + int i; + int n = 0; + x1 = x; + y1 = y2 = y; + x2 = x+w-2; + for ( i=0; idrawLineSegments( a ); + n = 0; + if ( sunken ) + p->setPen( g.light() ); + else + p->setPen( g.dark() ); + x1 = x; + y1 = y2 = y+h-1; + x2 = x+w-1; + for ( i=0; idrawLineSegments( a ); + if ( fill ) { // fill with fill color + TQBrush oldBrush = p->brush(); + p->setPen( TQt::NoPen ); + p->setBrush( *fill ); + p->drawRect( x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2 ); + p->setBrush( oldBrush ); + } + p->setPen( oldPen ); // restore pen +} + +static void drawSeparator( TQPainter *p, int x1, int y1, int x2, int y2, + const TQColorGroup &g ) +{ + TQPen oldPen = p->pen(); + + p->setPen( g.midlight() ); + p->drawLine( x1, y1, x2, y2 ); + p->setPen( g.shadow() ); + if ( y2-y1 < x2-x1 ) + p->drawLine( x1, y1+1, x2, y2+1 ); + else + p->drawLine( x1+1, y1, x2+1, y2 ); + + p->setPen( oldPen ); +} + +static void drawSGIPrefix( TQPainter *p, int x, int y, TQString* miText ) +{ + if ( miText && (!!(*miText)) ) { + int amp = 0; + bool nextAmp = FALSE; + while ( ( amp = miText->find( '&', amp ) ) != -1 ) { + if ( (uint)amp == miText->length()-1 ) + return; + miText->remove( amp,1 ); + nextAmp = (*miText)[amp] == '&'; // next time if && + + if ( !nextAmp ) { // draw special underlining + uint ulx = p->fontMetrics().width(*miText, amp); + + uint ulw = p->fontMetrics().width(*miText, amp+1) - ulx; + + p->drawLine( x+ulx, y, x+ulx+ulw, y ); + p->drawLine( x+ulx, y+1, x+ulx+ulw/2, y+1 ); + p->drawLine( x+ulx, y+2, x+ulx+ulw/4, y+2 ); + } + amp++; + } + } +} + +static int get_combo_extra_width( int h, int *return_awh=0 ) +{ + int awh; + if ( h < 8 ) { + awh = 6; + } else if ( h < 14 ) { + awh = h - 2; + } else { + awh = h/2; + } + if ( return_awh ) + *return_awh = awh; + return awh*2; +} + +static void get_combo_parameters( const TQRect &r, + int &ew, int &awh, int &ax, + int &ay, int &sh, int &dh, + int &sy ) +{ + ew = get_combo_extra_width( r.height(), &awh ); + + sh = (awh+3)/4; + if ( sh < 3 ) + sh = 3; + dh = sh/2 + 1; + + ay = r.y() + (r.height()-awh-sh-dh)/2; + if ( ay < 0 ) { + //panic mode + ay = 0; + sy = r.height(); + } else { + sy = ay+awh+dh; + } + if( TQApplication::reverseLayout() ) + ax = r.x(); + else + ax = r.x() + r.width() - ew; + ax += (ew-awh)/2; +} + +/*! \reimp */ +void TQSGIStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + const int x = r.x(); + const int y = r.y(); + const int w = r.width(); + const int h = r.height(); + const bool sunken = flags & ( Style_Sunken | Style_Down | Style_On ); + const int defaultFrameWidth = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ); + bool hot = ( flags & Style_MouseOver ) && ( flags & Style_Enabled ); + + bool dis = ! (flags & Style_Enabled); + bool act = flags & Style_Active; + + switch ( pe ) { + case PE_ButtonCommand: + { + TQBrush fill; + if ( hot ) { + if ( sunken ) + fill = cg.brush( TQColorGroup::Dark ); + else + fill = cg.brush( TQColorGroup::Midlight ); + } else if ( sunken ) { + fill = cg.brush( TQColorGroup::Mid ); + } else { + fill = cg.brush( TQColorGroup::Button ); + } + + drawPanel( p, x, y, w, h, cg, sunken, defaultFrameWidth, &fill ); + } + break; + + case PE_PanelPopup: + case PE_ButtonBevel: + case PE_ButtonTool: + { + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x+1, y+1, w-2, h-2 ), cg, flags, opt ); + + TQPen oldPen = p->pen(); + TQPointArray a; + + // draw twocolored rectangle + p->setPen( sunken ? cg.light() : cg.dark().dark(200) ); + a.setPoints( 3, x, y+h-1, x+w-1, y+h-1, x+w-1, y ); + p->drawPolyline( a ); + p->setPen( cg.dark() ); + a.setPoints( 3, x, y+h-2, x, y, x+w-2, y ); + p->drawPolyline( a ); + + p->setPen( oldPen ); + } + break; + + case PE_ArrowUp: + case PE_ArrowDown: + case PE_ArrowLeft: + case PE_ArrowRight: + { + TQPointArray a; // arrow polygon + switch ( pe ) { + case PE_ArrowUp: + a.setPoints( 3, 0,-5, -5,4, 4,4 ); + break; + case PE_ArrowDown: + a.setPoints( 3, 0,4, -4,-4, 4,-4 ); + break; + case PE_ArrowLeft: + a.setPoints( 3, -4,0, 4,-5, 4,4 ); + break; + case PE_ArrowRight: + a.setPoints( 3, 4,0, -4,-5, -4,4 ); + break; + default: + return; + } + + p->save(); + p->setPen( TQt::NoPen ); + a.translate( x+w/2, y+h/2 ); + p->setBrush( flags & Style_Enabled ? cg.dark() : cg.light() ); + p->drawPolygon( a ); // draw arrow + p->restore(); + } + break; + + case PE_Indicator: + { + TQRect er = r; + er.addCoords( 1, 1, -1, -1 ); + int iflags = flags & ~Style_On; + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, iflags, opt ); + if ( !(flags & TQStyle::Style_Off) ) { + er = r; + er.addCoords( 1, 2, 1, 1 ); + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, flags, opt ); + } + } + break; + + case PE_IndicatorMask: + { + TQPen oldPen = p->pen(); + TQBrush oldBrush = p->brush(); + + p->setPen( TQt::color1 ); + p->setBrush( TQt::color1 ); + p->fillRect( x, y, w, h, TQBrush( TQt::color0 ) ); + TQRect er = r; + er.addCoords( 1, 1, -1, -1 ); + p->fillRect(er, TQBrush(TQt::color1)); + + if ( !(flags & TQStyle::Style_Off) ) { + er = r; + er.addCoords( 1, 2, 1, 1 ); + static const TQCOORD check_mark[] = { + 14,0, 10,0, 11,1, 8,1, 9,2, 7,2, 8,3, 6,3, + 7,4, 1,4, 6,5, 1,5, 6,6, 3,6, 5,7, 4,7, + 5,8, 5,8, 4,3, 2,3, 3,2, 3,2 }; + + TQPointArray amark; + amark = TQPointArray( sizeof(check_mark)/(sizeof(TQCOORD)*2), check_mark ); + amark.translate( er.x()+1, er.y()+1 ); + p->drawLineSegments( amark ); + amark.translate( -1, -1 ); + p->drawLineSegments( amark ); + } + + p->setBrush( oldBrush ); + p->setPen( oldPen ); + } + break; + + case PE_CheckMark: + { + static const TQCOORD check_mark[] = { + 14,0, 10,0, 11,1, 8,1, 9,2, 7,2, 8,3, 6,3, + 7,4, 1,4, 6,5, 1,5, 6,6, 3,6, 5,7, 4,7, + 5,8, 5,8, 4,3, 2,3, 3,2, 3,2 }; + + TQPen oldPen = p->pen(); + + TQPointArray amark; + amark = TQPointArray( sizeof(check_mark)/(sizeof(TQCOORD)*2), check_mark ); + amark.translate( x+1, y+1 ); + + if ( flags & Style_On ) { + p->setPen( flags & Style_Enabled ? cg.shadow() : cg.dark() ); + p->drawLineSegments( amark ); + amark.translate( -1, -1 ); + p->setPen( flags & Style_Enabled ? TQColor(255,0,0) : cg.dark() ); + p->drawLineSegments( amark ); + p->setPen( oldPen ); + } else { + p->setPen( flags & Style_Enabled ? cg.dark() : cg.mid() ); + p->drawLineSegments( amark ); + amark.translate( -1, -1 ); + p->setPen( flags & Style_Enabled ? TQColor(230,120,120) : cg.dark() ); + p->drawLineSegments( amark ); + p->setPen( oldPen ); + } + } + break; + + case PE_ExclusiveIndicator: + { + p->save(); + p->eraseRect( x, y, w, h ); + p->translate( x, y ); + + p->setPen( cg.button() ); + p->setBrush( hot ? cg.midlight() : cg.button() ); + TQPointArray a; + a.setPoints( 4, 5,0, 11,6, 6,11, 0,5); + p->drawPolygon( a ); + + p->setPen( cg.dark() ); + p->drawLine( 0,5, 5,0 ); + p->drawLine( 6,0, 11,5 ); + p->setPen( flags & Style_Down ? cg.light() : cg.dark() ); + p->drawLine( 11,6, 6,11 ); + p->drawLine( 5,11, 0,6 ); + p->drawLine( 2,7, 5,10 ); + p->drawLine( 6,10, 9,7 ); + p->setPen( cg.light() ); + p->drawLine( 2,5, 5,2 ); + + if ( flags & Style_On ) { + p->setPen( flags & Style_Enabled ? TQt::blue : TQt::darkGray ); + p->setBrush( flags & Style_Enabled ? TQt::blue : TQt::darkGray ); + a.setPoints(3, 6,2, 8,4, 6,6 ); + p->drawPolygon( a ); + p->setBrush( TQt::NoBrush ); + + p->setPen( cg.shadow() ); + p->drawLine( 7,7, 9,5 ); + } else { + p->drawLine( 6,2, 9,5 ); + } + p->restore(); + } + break; + + case PE_ExclusiveIndicatorMask: + { + p->save(); + TQPen oldPen = p->pen(); + TQBrush oldBrush = p->brush(); + + p->setPen( TQt::color1 ); + p->setBrush( TQt::color1 ); + TQPointArray a; + a.setPoints( 8, 0,5, 5,0, 6,0, 11,5, 11,6, 6,11, 5,11, 0,6 ); + a.translate( x, y ); + p->drawPolygon( a ); + + p->setBrush( oldBrush ); + p->setPen( oldPen ); + p->restore(); + } + break; + + case PE_Panel: + { + const int lineWidth = opt.isDefault() ? defaultFrameWidth : opt.lineWidth(); + drawPanel( p, x, y, w, h, cg, flags & (Style_Sunken | Style_Down | Style_On), lineWidth, 0 ); + if ( lineWidth <= 1 ) + return; + + // draw extra shadinglines + TQPen oldPen = p->pen(); + p->setPen( cg.midlight() ); + p->drawLine( x+1, y+h-3, x+1, y+1 ); + p->drawLine( x+1, y+1, x+w-3, y+1 ); + p->setPen( cg.mid() ); + p->drawLine( x+1, y+h-2, x+w-2, y+h-2 ); + p->drawLine( x+w-2, y+h-2, x+w-2, y+1 ); + p->setPen(oldPen); + } + break; + + case PE_ScrollBarSubLine: + if ( !r.contains( d->mousePos ) && !(flags & Style_Active) ) + flags &= ~Style_MouseOver; + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags, opt ); + drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), + p, ceData, elementFlags, r, cg, Style_Enabled | flags); + break; + + case PE_ScrollBarAddLine: + if ( !r.contains( d->mousePos ) ) + flags &= ~Style_MouseOver; + drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags, opt ); + drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), + p, ceData, elementFlags, r, cg, Style_Enabled | flags); + break; + + case PE_ScrollBarSubPage: + case PE_ScrollBarAddPage: + if ( !r.contains( d->mousePos ) ) + flags &= ~Style_MouseOver; + if ( r.isValid() ) + qDrawShadePanel( p, x, y, w, h, cg, FALSE, 1, hot ? &cg.brush( TQColorGroup::Midlight ) : &cg.brush( TQColorGroup::Button ) ); + break; + + case PE_ScrollBarSlider: + { + if ( !r.isValid() ) + break; + if ( !(r.contains( d->mousePos ) || flags & Style_Active) || !(flags & Style_Enabled ) ) + flags &= ~Style_MouseOver; + + TQPixmap pm( r.width(), r.height() ); + TQPainter bp( &pm ); + drawPrimitive(PE_ButtonBevel, &bp, ceData, elementFlags, TQRect(0,0,r.width(),r.height()), cg, flags | Style_Enabled | Style_Raised); + if ( flags & Style_Horizontal ) { + const int sliderM = r.width() / 2; + if ( r.width() > 20 ) { + drawSeparator( &bp, sliderM-5, 2, sliderM-5, r.height()-3, cg ); + drawSeparator( &bp, sliderM+3, 2, sliderM+3, r.height()-3, cg ); + } + if ( r.width() > 10 ) + drawSeparator( &bp, sliderM-1, 2, sliderM-1, r.height()-3, cg ); + + } else { + const int sliderM = r.height() / 2; + if ( r.height() > 20 ) { + drawSeparator( &bp, 2, sliderM-5, r.width()-3, sliderM-5, cg ); + drawSeparator( &bp, 2, sliderM+3, r.width()-3, sliderM+3, cg ); + } + if ( r.height() > 10 ) + drawSeparator( &bp, 2, sliderM-1, r.width()-3, sliderM-1, cg ); + } + bp.end(); + p->drawPixmap( r.x(), r.y(), pm ); + } + + break; + + case PE_Splitter: + { + const int motifOffset = 10; + int sw = pixelMetric( PM_SplitterWidth, ceData, elementFlags ); + if ( flags & Style_Horizontal ) { + int xPos = x + w/2; + int kPos = motifOffset; + int kSize = sw - 2; + + qDrawShadeLine( p, xPos, kPos + kSize - 1 , + xPos, h, cg ); + + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect(xPos-sw/2+1, kPos, kSize, kSize+1), cg, flags, opt ); + qDrawShadeLine( p, xPos+2, 0, xPos, kPos, cg ); + } else { + int yPos = y + h/2; + int kPos = w - motifOffset - sw; + int kSize = sw - 2; + + qDrawShadeLine( p, 0, yPos, kPos, yPos, cg ); + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( kPos, yPos-sw/2+1, kSize+1, kSize ), cg, flags, opt ); + qDrawShadeLine( p, kPos + kSize+1, yPos, w, yPos, cg ); + } + } + break; + + case PE_MenuItemIndicatorFrame: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + + SFlags cflags = Style_Default; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; + + TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) ); + er.addCoords( 1, 1, -1, -1 ); + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, cflags, opt ); + } + break; + + case PE_MenuItemIndicatorIconFrame: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, cg, TRUE, 1, &cg.brush( TQColorGroup::Light ) ); + } + break; + + case PE_MenuItemIndicatorCheck: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + + SFlags cflags = Style_Default; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; + + TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) ); + er.addCoords( 1, 1, -1, -1 ); + er.addCoords( 0, 1, 1, 1 ); + drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, cflags | Style_On, opt ); + } + break; + + default: + TQMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); + break; + } +} + +/*! \reimp */ +void TQSGIStyle::drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + if ( widget == d->hotWidget ) + flags |= Style_MouseOver; + + switch ( element ) { + case CE_PushButton: + { +#ifndef TQT_NO_PUSHBUTTON + int x1, y1, x2, y2; + r.coords( &x1, &y1, &x2, &y2 ); + + p->setPen( cg.foreground() ); + p->setBrush( TQBrush( cg.button(),TQt::NoBrush ) ); + p->setBrushOrigin( -ceData.bgOffset.x(), + -ceData.bgOffset.y() ); + + int diw = pixelMetric( TQStyle::PM_ButtonDefaultIndicator, ceData, elementFlags ); + if ( ( elementFlags & CEF_IsDefault ) || ( elementFlags & CEF_AutoDefault ) ) { + x1 += diw; + y1 += diw; + x2 -= diw; + y2 -= diw; + } + + TQPointArray a; + if ( elementFlags & CEF_IsDefault ) { + if ( diw == 0 ) { + a.setPoints( 9, + x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1, + x2-1, y1+1, x2-1, y2-1, x1+1, y2-1, x1+1, y1+1 ); + p->setPen( cg.shadow() ); + p->drawPolyline( a ); + x1 += 2; + y1 += 2; + x2 -= 2; + y2 -= 2; + } else { + qDrawShadePanel( p, ceData.rect, cg, TRUE ); + } + } + + TQBrush fill = cg.brush( TQColorGroup::Button ); + if ( (!( elementFlags & CEF_IsFlat )) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1, x2-x1+1, y2-y1+1 ), cg, flags, opt ); + + if ( p->brush().style() != TQt::NoBrush ) + p->setBrush( TQt::NoBrush ); +#endif + } + break; + + case CE_PopupMenuItem: + { +#ifndef TQT_NO_POPUPMENU + if ( ( elementFlags & CEF_UseGenericParameters ) || opt.isDefault()) + break; + TQMenuItem *mi = opt.menuItem(); + if ( !mi ) + break; + int tab = opt.tabWidth(); + int maxpmw = opt.maxIconWidth(); + bool dis = ! (flags & Style_Enabled); + bool checkable = ( elementFlags & CEF_IsCheckable ); + bool act = flags & Style_Active; + int x, y, w, h; + + r.rect(&x, &y, &w, &h); + + if ( checkable ) + maxpmw = TQMAX( maxpmw, sgiCheckMarkSpace ); + int checkcol = maxpmw; + + if (mi && mi->isSeparator() ) { + p->setPen( cg.mid() ); + p->drawLine(x, y, x+w, y ); + return; + } + + int pw = sgiItemFrame; + + if ( act && !dis ) { + if ( pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) > 1 ) + drawPanel( p, x, y, w, h, cg, FALSE, pw, + &cg.brush( TQColorGroup::Light ) ); + else + drawPanel( p, x+1, y+1, w-2, h-2, cg, FALSE, 1, + &cg.brush( TQColorGroup::Light ) ); + } else { + p->fillRect( x, y, w, h, cg.brush( TQColorGroup::Button ) ); + } + + if ( !mi ) + return; + + if ( mi->isChecked() ) { + if ( mi->iconSet() ) { + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); + } + } else { + if ( !act ) + p->fillRect( x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, + cg.brush( TQColorGroup::Button ) ); + } + + if ( mi->iconSet() ) { + TQIconSet::Mode mode = TQIconSet::Normal; + if ( act && !dis ) + mode = TQIconSet::Active; + TQPixmap pixmap; + if ( checkable && mi->isChecked() ) + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); + else + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); + + int pixw = pixmap.width(); + int pixh = pixmap.height(); + TQRect cr( x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame ); + TQRect pmr( 0, 0, pixw, pixh ); + pmr.moveCenter( cr.center() ); + p->setPen( cg.text() ); + p->drawPixmap( pmr.topLeft(), pixmap ); + } else { + if ( checkable ) { + if ( mi->isChecked() ) { + drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); + } + } + } + + p->setPen( cg.buttonText() ); + + TQColor discol; + if ( dis ) { + discol = cg.text(); + p->setPen( discol ); + } + + int xm = sgiItemFrame + checkcol + sgiItemHMargin; + + if ( mi->custom() ) { + int m = sgiItemVMargin; + p->save(); + mi->custom()->paint( p, cg, act, !dis, + x+xm, y+m, w-xm-tab+1, h-2*m ); + p->restore(); + } + + TQString s = mi->text(); + if ( !!s ) { + int t = s.find( '\t' ); + int m = sgiItemVMargin; + const int text_flags = AlignVCenter | DontClip | SingleLine; //special underline for &x + + TQString miText = s; + if ( t>=0 ) { + p->drawText(x+w-tab-sgiItemHMargin-sgiItemFrame, + y+m, tab, h-2*m, text_flags, miText.mid( t+1 ) ); + miText = s.mid( 0, t ); + } + TQRect br = p->fontMetrics().boundingRect( x+xm, y+m, w-xm-tab+1, h-2*m, + text_flags, mi->text() ); + + drawSGIPrefix( p, br.x()+p->fontMetrics().leftBearing(miText[0]), + br.y()+br.height()+p->fontMetrics().underlinePos()-2, &miText ); + p->drawText( x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, miText, miText.length() ); + } else { + if ( mi->pixmap() ) { + TQPixmap *pixmap = mi->pixmap(); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( OpaqueMode ); + p->drawPixmap( x+xm, y+sgiItemFrame, *pixmap ); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( TransparentMode ); + } + } + if ( mi->popup() ) { + int dim = (h-2*sgiItemFrame) / 2; + drawPrimitive( PE_ArrowRight, p, ceData, elementFlags, TQRect( x+w-sgiArrowHMargin-sgiItemFrame-dim, y+h/2-dim/2, dim, dim ), cg, flags ); + } +#endif + } + break; + + case CE_MenuBarItem: + { +#ifndef TQT_NO_MENUDATA + if (opt.isDefault()) + break; + + TQMenuItem *mi = opt.menuItem(); + + bool active = flags & Style_Active; + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + + if ( active ) { + p->setPen( TQPen( cg.shadow(), 1) ); + p->drawRect( x, y, w, h ); + qDrawShadePanel( p, TQRect(x+1,y+1,w-2,h-2), cg, FALSE, 2, + &cg.brush( TQColorGroup::Light )); + } else { + p->fillRect( x, y, w, h, cg.brush( TQColorGroup::Button )); + } + + if ( mi->pixmap() ) + drawItem( p, r, AlignCenter|DontClip|SingleLine, + cg, mi->isEnabled(), mi->pixmap(), "", -1, &cg.buttonText() ); + + if ( !!mi->text() ) { + TQString* text = new TQString(mi->text()); + TQRect br = p->fontMetrics().boundingRect( x, y-2, w+1, h, + AlignCenter|DontClip|SingleLine|ShowPrefix, mi->text() ); + + drawSGIPrefix( p, br.x()+p->fontMetrics().leftBearing((*text)[0]), + br.y()+br.height()+p->fontMetrics().underlinePos()-2, text ); + p->drawText( x, y-2, w+1, h, AlignCenter|DontClip|SingleLine, *text, text->length() ); + delete text; + } +#endif + } + break; + + case CE_CheckBox: + TQMotifStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); + break; + + default: + TQMotifStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget ); + break; + } +} + +/*! \reimp */ +void TQSGIStyle::drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect& r, + const TQColorGroup& cg, + SFlags flags, + SCFlags sub, + SCFlags subActive, + const TQStyleOption& opt, + const TQWidget* widget ) const +{ + if ( widget == d->hotWidget ) + flags |= Style_MouseOver; + + switch ( control ) { + case CC_Slider: + { +#ifndef TQT_NO_SLIDER + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, + opt, widget), + handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, + opt, widget); + + if ((sub & SC_SliderGroove) && groove.isValid()) { + TQRegion region( groove ); + if ( ( sub & SC_SliderHandle ) && handle.isValid() ) + region = region.subtract( handle ); + if ( d->lastSliderRect.slider == widget && d->lastSliderRect.rect.isValid() ) + region = region.subtract( d->lastSliderRect.rect ); + p->setClipRegion( region ); + + TQRect grooveTop = groove; + grooveTop.addCoords( 1, 1, -1, -1 ); + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, grooveTop, cg, flags & ~Style_MouseOver, opt ); + + if ( flags & Style_HasFocus ) { + TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg, flags & ~Style_MouseOver ); + } + + if ( d->lastSliderRect.slider == widget && d->lastSliderRect.rect.isValid() ) { + if ( ( sub & SC_SliderHandle ) && handle.isValid() ) { + region = ceData.rect; + region = region.subtract( handle ); + p->setClipRegion( region ); + } else { + p->setClipping( FALSE ); + } + qDrawShadePanel( p, d->lastSliderRect.rect, cg, TRUE, 1, &cg.brush( TQColorGroup::Dark ) ); + } + p->setClipping( FALSE ); + } + + if (( sub & SC_SliderHandle ) && handle.isValid()) { + if ( flags & Style_MouseOver && !handle.contains( d->mousePos ) && subActive != SC_SliderHandle ) + flags &= ~Style_MouseOver; + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, handle, cg, flags ); + + if ( ceData.orientation == Horizontal ) { + TQCOORD mid = handle.x() + handle.width() / 2; + qDrawShadeLine( p, mid, handle.y(), mid, + handle.y() + handle.height() - 2, + cg, TRUE, 1); + } else { + TQCOORD mid = handle.y() + handle.height() / 2; + qDrawShadeLine( p, handle.x(), mid, + handle.x() + handle.width() - 2, mid, + cg, TRUE, 1); + } + } + + if ( sub & SC_SliderTickmarks ) + TQMotifStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, + SC_SliderTickmarks, subActive, + opt, widget ); +#endif + break; + } + case CC_ComboBox: + { +#ifndef TQT_NO_COMBOBOX + if (sub & SC_ComboBoxFrame) { + TQRect fr = + TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, + SC_ComboBoxFrame, TQStyleOption::Default, widget ), ceData, elementFlags ); + drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, fr, cg, flags ); + } + + if ( sub & SC_ComboBoxArrow ) { + p->save(); + TQRect er = + TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget ), ceData, elementFlags ); + + er.addCoords( 0, 3, 0, 0 ); + + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, er, cg, flags | Style_Enabled, opt ); + + int awh, ax, ay, sh, sy, dh, ew; + get_combo_parameters( ceData.rect, ew, awh, ax, ay, sh, dh, sy ); + + TQBrush arrow = cg.brush( TQColorGroup::Dark ); + p->fillRect( ax, sy-1, awh, sh, arrow ); + + p->restore(); + if ( elementFlags & CEF_HasFocus ) { + TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg ); + } + } + if ( sub & SC_ComboBoxEditField ) { + if ( elementFlags & CEF_IsEditable ) { + TQRect er = + TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, + SC_ComboBoxEditField, TQStyleOption::Default, widget ), ceData, elementFlags ); + er.addCoords( -1, -1, 1, 1); + qDrawShadePanel( p, TQRect( er.x()-1, er.y()-1, + er.width()+2, er.height()+2 ), + cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); + } + } +#endif + p->setPen(cg.buttonText()); + break; + } + + case CC_ScrollBar: + { +#ifndef TQT_NO_SCROLLBAR + bool maxedOut = (ceData.minSteps == ceData.maxSteps); + if ( maxedOut ) + flags &= ~Style_Enabled; + + TQRect handle = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSlider, opt, widget ), ceData, elementFlags ); + + if ( sub & SC_ScrollBarGroove ) { + } + if ( sub & SC_ScrollBarAddLine ) { + TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget ), ceData, elementFlags ); + drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, er, cg, flags, opt ); + } + if ( sub & SC_ScrollBarSubLine ) { + TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget ), ceData, elementFlags ); + drawPrimitive( PE_ScrollBarSubLine, p, ceData, elementFlags, er, cg, flags, opt ); + } + if ( sub & SC_ScrollBarAddPage ) { + TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget ), ceData, elementFlags ); + TQRegion region( er ); + if ( d->lastScrollbarRect.scrollbar == widget && + d->lastScrollbarRect.rect.isValid() && + er.intersects( d->lastScrollbarRect.rect ) ) { + region = region.subtract( d->lastScrollbarRect.rect ); + p->setClipRegion( region ); + } + if ( sub & SC_ScrollBarSlider && er.intersects( handle ) ) { + region = region.subtract( handle ); + p->setClipRegion( region ); + } + + drawPrimitive( PE_ScrollBarAddPage, p, ceData, elementFlags, er, cg, flags & ~Style_MouseOver, opt ); + + if ( d->lastScrollbarRect.scrollbar == widget && + d->lastScrollbarRect.rect.isValid() && + er.intersects( d->lastScrollbarRect.rect ) ) { + if ( sub & SC_ScrollBarSlider && handle.isValid() ) { + region = er; + region.subtract( handle ); + p->setClipRegion( region ); + } else { + p->setClipping( FALSE ); + } + qDrawShadePanel( p, d->lastScrollbarRect.rect, cg, TRUE, 1, &cg.brush( TQColorGroup::Dark ) ); + } + p->setClipping( FALSE ); + } + if ( sub & SC_ScrollBarSubPage ) { + TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget ), ceData, elementFlags ); + TQRegion region( er ); + if ( d->lastScrollbarRect.scrollbar == widget && + d->lastScrollbarRect.rect.isValid() && + er.intersects( d->lastScrollbarRect.rect ) ) { + region = region.subtract( d->lastScrollbarRect.rect ); + p->setClipRegion( region ); + } + if ( sub & SC_ScrollBarSlider && er.intersects( handle ) ) { + region = region.subtract( handle ); + p->setClipRegion( region ); + } + drawPrimitive( PE_ScrollBarSubPage, p, ceData, elementFlags, er, cg, flags & ~Style_MouseOver, opt ); + if ( d->lastScrollbarRect.scrollbar == widget && + d->lastScrollbarRect.rect.isValid() && + er.intersects( d->lastScrollbarRect.rect ) ) { + if ( sub & SC_ScrollBarSlider && handle.isValid() ) { + region = er; + region.subtract( handle ); + p->setClipRegion( region ); + } else { + p->setClipping( FALSE ); + } + qDrawShadePanel( p, d->lastScrollbarRect.rect, cg, TRUE, 1, &cg.brush( TQColorGroup::Dark ) ); + } + p->setClipping( FALSE ); + } + if ( sub & SC_ScrollBarSlider ) { + p->setClipping( FALSE ); + if ( subActive == SC_ScrollBarSlider ) + flags |= Style_Active; + + drawPrimitive( PE_ScrollBarSlider, p, ceData, elementFlags, handle, cg, flags, opt ); + } +#endif + } + break; + + default: + TQMotifStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget ); + break; + } +} + +/*!\reimp +*/ +TQSize TQSGIStyle::sizeFromContents( ContentsType contents, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &contentsSize, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + TQSize sz(contentsSize); + + switch(contents) { + case CT_PopupMenuItem: + { +#ifndef TQT_NO_POPUPMENU + if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault()) + break; + + TQMenuItem *mi = opt.menuItem(); + sz = TQMotifStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, + opt, widget ); + // SGI checkmark items needs a bit more room + if ( elementFlags & CEF_IsCheckable ) + sz.setWidth( sz.width() + 8 ); + // submenu indicator needs a bit more room + if (mi->popup()) + sz.setWidth( sz.width() + sgiTabSpacing ); +#endif + break; + } + case CT_ComboBox: + sz.rwidth() += 30; + break; + + default: + sz = TQMotifStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, opt, widget ); + break; + } + + return sz; +} + +/*! \reimp */ +TQRect TQSGIStyle::subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const +{ + TQRect rect; + + switch ( r ) { + case SR_ComboBoxFocusRect: + { + int awh, ax, ay, sh, sy, dh, ew; + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); + TQRect tr = ceData.rect; + + tr.addCoords( fw, fw, -fw, -fw ); + get_combo_parameters( tr, ew, awh, ax, ay, sh, dh, sy ); + rect.setRect(ax-2, ay-2, awh+4, awh+sh+dh+4); + } + break; + default: + return TQMotifStyle::subRect( r, ceData, elementFlags, widget ); + } + + return rect; +} + +/*! \reimp */ +TQRect TQSGIStyle::querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sub, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch ( control ) { + case CC_ComboBox: + switch ( sub ) { + case SC_ComboBoxFrame: + return ceData.rect; + + case SC_ComboBoxArrow: { + int ew, awh, sh, dh, ax, ay, sy; + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); + TQRect cr = ceData.rect; + cr.addCoords( fw, fw, -fw, -fw ); + get_combo_parameters( cr, ew, awh, ax, ay, sh, dh, sy ); + return TQRect( ax, ay, awh, awh ); } + + case SC_ComboBoxEditField: { + int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ); + TQRect rect = ceData.rect; + rect.addCoords( fw, fw, -fw, -fw ); + int ew = get_combo_extra_width( rect.height() ); + rect.addCoords( 1, 1, -1-ew, -1 ); + return rect; } + + default: + break; + } + break; + case CC_ScrollBar: + return TQCommonStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget ); + default: break; + } + return TQMotifStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget ); +} + +/*! \reimp */ +int TQSGIStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const +{ + int ret; + + switch (sh) { + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = ( elementFlags & CEF_IsCheckable ); + + if ( checkable ) + maxpmw = TQMAX( maxpmw, sgiCheckMarkSpace ); + ret = maxpmw; + } + break; + default: + ret = TQMotifStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); + break; + } + + return ret; +} + +#endif // TQT_NO_STYLE_SGI diff --git a/src/styles/tqsgistyle.h b/src/styles/tqsgistyle.h new file mode 100644 index 000000000..d09ad4cf4 --- /dev/null +++ b/src/styles/tqsgistyle.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Definition of SGI-like style class +** +** Created : 981231 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSGISTYLE_H +#define TQSGISTYLE_H + +#ifndef QT_H +#include "tqmotifstyle.h" +#include "ntqguardedptr.h" +#include "tqwidget.h" +#endif // QT_H + +#if !defined(TQT_NO_STYLE_SGI) || defined(QT_PLUGIN) + +#if defined(QT_PLUGIN) +#define Q_EXPORT_STYLE_SGI +#else +#define Q_EXPORT_STYLE_SGI TQ_EXPORT +#endif + +class TQSGIStylePrivate; + +class Q_EXPORT_STYLE_SGI TQSGIStyle: public TQMotifStyle +{ + TQ_OBJECT +public: + TQSGIStyle( bool useHighlightCols = FALSE ); + virtual ~TQSGIStyle(); + +#if !defined(Q_NO_USING_KEYWORD) + using TQMotifStyle::polish; +#endif + void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + + void drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default ) const; + + void drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags how = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + void drawComplexControl( ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect& r, + const TQColorGroup& cg, + SFlags how = Style_Default, +#ifdef Q_QDOC + SCFlags sub = SC_All, +#else + SCFlags sub = (uint)SC_All, +#endif + SCFlags subActive = SC_None, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; + + int pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const; + + TQSize sizeFromContents( ContentsType contents, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &contentsSize, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const; + TQRect querySubControlMetrics( ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sc, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget *) const; + + bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); + +private: + TQSGIStylePrivate *d; + + uint isApplicationStyle :1; +#if defined(TQ_DISABLE_COPY) + TQSGIStyle( const TQSGIStyle & ); + TQSGIStyle& operator=( const TQSGIStyle & ); +#endif + +}; + +#endif // TQT_NO_STYLE_SGI + +#endif // TQSGISTYLE_H diff --git a/src/styles/tqstylefactory.cpp b/src/styles/tqstylefactory.cpp index d87794f9a..f31c8e0f0 100644 --- a/src/styles/tqstylefactory.cpp +++ b/src/styles/tqstylefactory.cpp @@ -44,15 +44,15 @@ #ifndef TQT_NO_STYLE #include "ntqapplication.h" -#include "ntqwindowsstyle.h" -#include "ntqmotifstyle.h" -#include "ntqcdestyle.h" -#include "ntqmotifplusstyle.h" -#include "ntqplatinumstyle.h" -#include "ntqsgistyle.h" -#include "ntqcompactstyle.h" +#include "tqwindowsstyle.h" +#include "tqmotifstyle.h" +#include "tqcdestyle.h" +#include "tqmotifplusstyle.h" +#include "tqplatinumstyle.h" +#include "tqsgistyle.h" +#include "tqcompactstyle.h" #ifndef TQT_NO_STYLE_WINDOWSXP -#include "qwindowsxpstyle.h" +#include "tqwindowsxpstyle.h" #endif #ifndef TQT_NO_STYLE_AQUA #include "qaquastyle.h" diff --git a/src/styles/tqwindowsstyle.cpp b/src/styles/tqwindowsstyle.cpp new file mode 100644 index 000000000..844ff294a --- /dev/null +++ b/src/styles/tqwindowsstyle.cpp @@ -0,0 +1,2058 @@ +/**************************************************************************** +** +** Implementation of Windows-like style class +** +** Created : 981231 +** +** Copyright (C) 1998-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqwindowsstyle.h" + +#if !defined(TQT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) + +#include "tqpopupmenu.h" +#include "ntqapplication.h" +#include "tqpainter.h" +#include "ntqdrawutil.h" // for now +#include "tqpixmap.h" // for now +#include "tqwidget.h" +#include "tqlabel.h" +#include "tqimage.h" +#include "tqpushbutton.h" +#include "tqcombobox.h" +#include "tqlistbox.h" +#include "tqwidget.h" +#include "ntqrangecontrol.h" +#include "tqscrollbar.h" +#include "tqslider.h" +#include "tqtabwidget.h" +#include "tqtabbar.h" +#include "tqlistview.h" +#include "tqbitmap.h" +#include "ntqcleanuphandler.h" +#include "ntqdockwindow.h" +#include "tqobjectlist.h" +#include "tqmenubar.h" + +#include + + +static const int windowsItemFrame = 2; // menu item frame width +static const int windowsSepHeight = 2; // separator item height +static const int windowsItemHMargin = 3; // menu item hor text margin +static const int windowsItemVMargin = 2; // menu item ver text margin +static const int windowsArrowHMargin = 6; // arrow horizontal margin +static const int windowsTabSpacing = 12; // space between text and tab +static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark +static const int windowsRightBorder = 12; // right border on windows +static const int windowsCheckMarkWidth = 12; // checkmarks width on windows + +static bool use2000style = TRUE; + +enum TQSliderDirection { SlUp, SlDown, SlLeft, SlRight }; + +// A friendly class providing access to TQMenuData's protected member. +class FriendlyMenuData : public TQMenuData +{ + friend class TQWindowsStyle; +}; + +// Private class +class TQWindowsStyle::Private : public TQObject +{ +public: + Private(TQWindowsStyle *parent); + + bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); + +private: + int menuBarTimer; +}; + +TQWindowsStyle::Private::Private(TQWindowsStyle *parent) +: TQObject(parent, "TQWindowsStylePrivate"), menuBarTimer(0) +{ +} + +// Records Alt- and Focus events +bool TQWindowsStyle::Private::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags, void* source, TQEvent *e ) +{ + if (!(ceData.widgetObjectTypes.contains("TQWidget"))) { + return TRUE; + } + + TQWidget *widget = reinterpret_cast(source); + + switch(e->type()) { + case TQEvent::FocusIn: + case TQEvent::FocusOut: + { + // Menubars toggle based on focus + TQMenuBar *menuBar = ::tqt_cast(widget); + if (menuBar && !menuBarTimer) // delayed repaint to avoid flicker + menuBarTimer = menuBar->startTimer(0); + } + break; + case TQEvent::Close: + // Reset widget when closing + break; + case TQEvent::Timer: + { + TQMenuBar *menuBar = ::tqt_cast(widget); + TQTimerEvent *te = (TQTimerEvent*)e; + if (menuBar && te->timerId() == menuBarTimer) { + menuBar->killTimer(te->timerId()); + menuBarTimer = 0; + menuBar->repaint(FALSE); + return TRUE; + } + } + break; + default: + break; + } + + return TRUE; +} + +/*! + \class TQWindowsStyle tqwindowsstyle.h + \brief The TQWindowsStyle class provides a Microsoft Windows-like look and feel. + + \ingroup appearance + + This style is TQt's default GUI style on Windows. +*/ + +/*! + Constructs a TQWindowsStyle +*/ +TQWindowsStyle::TQWindowsStyle() : TQCommonStyle(), d(0) +{ +#if defined(Q_OS_WIN32) + use2000style = qWinVersion() != TQt::WV_NT && qWinVersion() != TQt::WV_95; +#endif +} + +/*! \reimp */ +TQWindowsStyle::~TQWindowsStyle() +{ + delete d; +} + +/*! \reimp */ +bool TQWindowsStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) { + if (d) { + return d->objectEventHandler(ceData, elementFlags, source, e); + } + return TRUE; +} + +/*! \reimp */ +void TQWindowsStyle::applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) +{ + // We only need the overhead when shortcuts are sometimes hidden + if (styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, 0) && styleHint(SH_HideUnderlineAcceleratorWhenAltUp, TQStyleControlElementData(), CEF_None, 0)) { + d = new Private(this); + installObjectEventHandler(ceData, elementFlags, ptr, this); + } +} + +/*! \reimp */ +void TQWindowsStyle::applicationUnPolish(const TQStyleControlElementData&, ControlElementFlags, void *) +{ + delete d; + d = 0; +} + +/*! \reimp */ +void TQWindowsStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) +{ + TQCommonStyle::polish(ceData, elementFlags, ptr); +} + +/*! \reimp */ +void TQWindowsStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) +{ + TQCommonStyle::polish(ceData, elementFlags, ptr); +} + +/*! \reimp */ +void TQWindowsStyle::polish( TQPalette &pal ) +{ + TQCommonStyle::polish(pal); +} + +/*! \reimp */ +void TQWindowsStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + bool dis = !(flags & Style_Enabled); + bool act = flags & Style_Active; + + TQRect rr( r ); + switch (pe) { + case PE_ButtonCommand: + { + TQBrush fill; + + if (! (flags & Style_Down) && (flags & Style_On)) + fill = TQBrush(cg.light(), Dense4Pattern); + else + fill = cg.brush(TQColorGroup::Button); + + if (flags & Style_ButtonDefault && flags & Style_Down) { + p->setPen(cg.dark()); + p->setBrush(fill); + p->drawRect(r); + } else if (flags & (Style_Raised | Style_Down | Style_On | Style_Sunken)) + qDrawWinButton(p, r, cg, flags & (Style_Sunken | Style_Down | + Style_On), &fill); + else + p->fillRect(r, fill); + break; + } + + case PE_ButtonBevel: + case PE_HeaderSection: + { + TQBrush fill; + + if (! (flags & Style_Down) && (flags & Style_On)) + fill = TQBrush(cg.light(), Dense4Pattern); + else + fill = cg.brush(TQColorGroup::Button); + + if (flags & (Style_Raised | Style_Down | Style_On | Style_Sunken)) + qDrawWinButton(p, r, cg, flags & (Style_Down | Style_On), &fill); + else + p->fillRect(r, fill); + break; + } + + case PE_ButtonDefault: + p->setPen(cg.shadow()); + p->drawRect(r); + break; + + case PE_ButtonTool: + { + TQBrush fill; + bool stippled = FALSE; + + if (! (flags & (Style_Down | Style_MouseOver)) && + (flags & Style_On) && + use2000style) { + fill = TQBrush(cg.light(), Dense4Pattern); + stippled = TRUE; + } else + fill = cg.brush(TQColorGroup::Button); + + if (flags & (Style_Raised | Style_Down | Style_On)) { + if (flags & Style_AutoRaise) { + qDrawShadePanel(p, r, cg, flags & (Style_Down | Style_On), + 1, &fill); + + if (stippled) { + p->setPen(cg.button()); + p->drawRect(r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2); + } + } else + qDrawWinButton(p, r, cg, flags & (Style_Down | Style_On), + &fill); + } else + p->fillRect(r, fill); + + break; + } + + case PE_FocusRect: + if (opt.isDefault()) + p->drawWinFocusRect(r); + else + p->drawWinFocusRect(r, opt.color()); + break; + + case PE_Indicator: + { + TQBrush fill; + if (flags & Style_NoChange) { + TQBrush b = p->brush(); + TQColor c = p->backgroundColor(); + p->setBackgroundMode( TransparentMode ); + p->setBackgroundColor( green ); + fill = TQBrush(cg.base(), Dense4Pattern); + p->setBackgroundColor( c ); + p->setBrush( b ); + } else if (flags & Style_Down) + fill = cg.brush( TQColorGroup::Button ); + else if (flags & Style_Enabled) + fill = cg.brush( TQColorGroup::Base ); + else + fill = cg.brush( TQColorGroup::Background ); + + qDrawWinPanel( p, r, cg, TRUE, &fill ); + + if (flags & Style_NoChange ) + p->setPen( cg.dark() ); + else + p->setPen( cg.text() ); + } // FALLTHROUGH + case PE_CheckListIndicator: + if ( pe == PE_CheckListIndicator ) { //since we fall through from PE_Indicator + if ( flags & Style_Enabled ) + p->setPen( TQPen( cg.text(), 1 ) ); + else + p->setPen( TQPen( cg.dark(), 1 ) ); + if ( flags & Style_NoChange ) + p->setBrush( cg.brush( TQColorGroup::Button ) ); + p->drawRect( r.x()+1, r.y()+1, 11, 11 ); + } + if (! (flags & Style_Off)) { + TQPointArray a( 7*2 ); + int i, xx, yy; + xx = rr.x() + 3; + yy = rr.y() + 5; + + for ( i=0; i<3; i++ ) { + a.setPoint( 2*i, xx, yy ); + a.setPoint( 2*i+1, xx, yy+2 ); + xx++; yy++; + } + + yy -= 2; + for ( i=3; i<7; i++ ) { + a.setPoint( 2*i, xx, yy ); + a.setPoint( 2*i+1, xx, yy+2 ); + xx++; yy--; + } + + p->drawLineSegments( a ); + } + break; + + case PE_ExclusiveIndicator: + { +#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2) + static const TQCOORD pts1[] = { // dark lines + 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; + static const TQCOORD pts2[] = { // black lines + 2,8, 1,7, 1,4, 2,3, 2,2, 3,2, 4,1, 7,1, 8,2, 9,2 }; + static const TQCOORD pts3[] = { // background lines + 2,9, 3,9, 4,10, 7,10, 8,9, 9,9, 9,8, 10,7, 10,4, 9,3 }; + static const TQCOORD pts4[] = { // white lines + 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, + 11,4, 10,3, 10,2 }; + static const TQCOORD pts5[] = { // inner fill + 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; + + // make sure the indicator is square + TQRect ir = r; + + if (r.width() < r.height()) { + ir.setTop(r.top() + (r.height() - r.width()) / 2); + ir.setHeight(r.width()); + } else if (r.height() < r.width()) { + ir.setLeft(r.left() + (r.width() - r.height()) / 2); + ir.setWidth(r.height()); + } + + p->eraseRect(ir); + bool down = flags & Style_Down; + bool enabled = flags & Style_Enabled; + bool on = flags & Style_On; + TQPointArray a; + a.setPoints( TQCOORDARRLEN(pts1), pts1 ); + a.translate( ir.x(), ir.y() ); + p->setPen( cg.dark() ); + p->drawPolyline( a ); + a.setPoints( TQCOORDARRLEN(pts2), pts2 ); + a.translate( ir.x(), ir.y() ); + p->setPen( cg.shadow() ); + p->drawPolyline( a ); + a.setPoints( TQCOORDARRLEN(pts3), pts3 ); + a.translate( ir.x(), ir.y() ); + p->setPen( cg.midlight() ); + p->drawPolyline( a ); + a.setPoints( TQCOORDARRLEN(pts4), pts4 ); + a.translate( ir.x(), ir.y() ); + p->setPen( cg.light() ); + p->drawPolyline( a ); + a.setPoints( TQCOORDARRLEN(pts5), pts5 ); + a.translate( ir.x(), ir.y() ); + TQColor fillColor = ( down || !enabled ) ? cg.button() : cg.base(); + p->setPen( fillColor ); + p->setBrush( fillColor ) ; + p->drawPolygon( a ); + if ( on ) { + p->setPen( NoPen ); + p->setBrush( cg.text() ); + p->drawRect( ir.x() + 5, ir.y() + 4, 2, 4 ); + p->drawRect( ir.x() + 4, ir.y() + 5, 4, 2 ); + } + break; + } + + case PE_Panel: + case PE_PanelPopup: + { + int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) + : opt.lineWidth(); + + if (lw == 2) { + TQColorGroup popupCG = cg; + if ( pe == PE_PanelPopup ) { + popupCG.setColor( TQColorGroup::Light, cg.background() ); + popupCG.setColor( TQColorGroup::Midlight, cg.light() ); + } + qDrawWinPanel(p, r, popupCG, flags & Style_Sunken); + } else { + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); + } + break; + } + + case PE_Splitter: + { + TQPen oldPen = p->pen(); + p->setPen( cg.light() ); + if ( flags & Style_Horizontal ) { + p->drawLine( r.x() + 1, r.y(), r.x() + 1, r.height() ); + p->setPen( cg.dark() ); + p->drawLine( r.x(), r.y(), r.x(), r.height() ); + p->drawLine( r.right()-1, r.y(), r.right()-1, r.height() ); + p->setPen( cg.shadow() ); + p->drawLine( r.right(), r.y(), r.right(), r.height() ); + } else { + p->drawLine( r.x(), r.y() + 1, r.width(), r.y() + 1 ); + p->setPen( cg.dark() ); + p->drawLine( r.x(), r.bottom() - 1, r.width(), r.bottom() - 1 ); + p->setPen( cg.shadow() ); + p->drawLine( r.x(), r.bottom(), r.width(), r.bottom() ); + } + p->setPen( oldPen ); + break; + } + case PE_DockWindowResizeHandle: + { + TQPen oldPen = p->pen(); + p->setPen( cg.light() ); + if ( flags & Style_Horizontal ) { + p->drawLine( r.x(), r.y(), r.width(), r.y() ); + p->setPen( cg.dark() ); + p->drawLine( r.x(), r.bottom() - 1, r.width(), r.bottom() - 1 ); + p->setPen( cg.shadow() ); + p->drawLine( r.x(), r.bottom(), r.width(), r.bottom() ); + } else { + p->drawLine( r.x(), r.y(), r.x(), r.height() ); + p->setPen( cg.dark() ); + p->drawLine( r.right()-1, r.y(), r.right()-1, r.height() ); + p->setPen( cg.shadow() ); + p->drawLine( r.right(), r.y(), r.right(), r.height() ); + } + p->setPen( oldPen ); + break; + } + + case PE_ScrollBarSubLine: + if (use2000style) { + if (flags & Style_Down) { + p->setPen( cg.dark() ); + p->setBrush( cg.brush( TQColorGroup::Button ) ); + p->drawRect( r ); + } else + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Raised); + } else + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | + ((flags & Style_Down) ? Style_Down : Style_Raised)); + + drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), + p, ceData, elementFlags, r, cg, flags); + break; + + case PE_ScrollBarAddLine: + if (use2000style) { + if (flags & Style_Down) { + p->setPen( cg.dark() ); + p->setBrush( cg.brush( TQColorGroup::Button ) ); + p->drawRect( r ); + } else + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Raised); + } else + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | + ((flags & Style_Down) ? Style_Down : Style_Raised)); + + drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), + p, ceData, elementFlags, r, cg, flags); + break; + + case PE_ScrollBarAddPage: + case PE_ScrollBarSubPage: + { + TQBrush br; + TQColor c = p->backgroundColor(); + + p->setPen(NoPen); + p->setBackgroundMode(OpaqueMode); + + if (flags & Style_Down) { + br = TQBrush(cg.shadow(), Dense4Pattern); + p->setBackgroundColor( cg.dark() ); + p->setBrush( TQBrush(cg.shadow(), Dense4Pattern) ); + } else { + br = (cg.brush(TQColorGroup::Light).pixmap() ? + cg.brush(TQColorGroup::Light) : + TQBrush(cg.light(), Dense4Pattern)); + p->setBrush(br); + } + + p->drawRect(r); + p->setBackgroundColor(c); + break; + } + + case PE_ScrollBarSlider: + if (! (flags & Style_Enabled)) { + TQBrush br = (cg.brush(TQColorGroup::Light).pixmap() ? + cg.brush(TQColorGroup::Light) : + TQBrush(cg.light(), Dense4Pattern)); + p->setPen(NoPen); + p->setBrush(br); + p->setBackgroundMode(OpaqueMode); + p->drawRect(r); + } else + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, Style_Enabled | Style_Raised); + break; + + case PE_WindowFrame: + { + TQColorGroup popupCG = cg; + popupCG.setColor( TQColorGroup::Light, cg.background() ); + popupCG.setColor( TQColorGroup::Midlight, cg.light() ); + qDrawWinPanel(p, r, popupCG, flags & Style_Sunken); + } + break; + + case PE_MenuItemIndicatorFrame: + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + TQRect vrect = visualRect( TQRect( x, y, checkcol, h ), r ); + int xvis = vrect.x(); + + if ( act && !dis ) { + qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); + } + else { + TQBrush fill( cg.light(), Dense4Pattern ); + // set the brush origin for the hash pattern to the x/y coordinate + // of the menu item's checkmark... this way, the check marks have + // a consistent look + TQPoint origin = p->brushOrigin(); + p->setBrushOrigin( xvis, y ); + qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &fill ); + // restore the previous brush origin + p->setBrushOrigin( origin ); + } + } + break; + + case PE_MenuItemIndicatorIconFrame: + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + TQRect vrect = visualRect( TQRect( x, y, checkcol, h ), r ); + int xvis = vrect.x(); + + qDrawShadePanel( p, xvis, y, w, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) ); + } + break; + + case PE_MenuItemIndicatorCheck: + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + int xp = x + windowsItemFrame; + + SFlags cflags = Style_Default; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; + + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, visualRect( TQRect(xp, y + windowsItemFrame, checkcol - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags); + } + break; + + default: + if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) { + TQPointArray a; + + switch ( pe ) { + case PE_ArrowUp: + a.setPoints( 7, -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2 ); + break; + + case PE_ArrowDown: + a.setPoints( 7, -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1 ); + break; + + case PE_ArrowRight: + a.setPoints( 7, -2,-3, -2,3, -1,-2, -1,2, 0,-1, 0,1, 1,0 ); + break; + + case PE_ArrowLeft: + a.setPoints( 7, 0,-3, 0,3, -1,-2, -1,2, -2,-1, -2,1, -3,0 ); + break; + + default: + break; + } + + if (a.isNull()) + return; + + p->save(); + if ( flags & Style_Down ) + p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ), + pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) ); + + if ( flags & Style_Enabled ) { + a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 ); + p->setPen( cg.buttonText() ); + p->drawLineSegments( a, 0, 3 ); // draw arrow + p->drawPoint( a[6] ); + } else { + a.translate( r.x() + r.width() / 2 + 1, r.y() + r.height() / 2 + 1 ); + p->setPen( cg.light() ); + p->drawLineSegments( a, 0, 3 ); // draw arrow + p->drawPoint( a[6] ); + a.translate( -1, -1 ); + p->setPen( cg.mid() ); + p->drawLineSegments( a, 0, 3 ); // draw arrow + p->drawPoint( a[6] ); + } + p->restore(); + } else + TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); + } +} + + +/*! + \reimp +*/ +void TQWindowsStyle::drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch (element) { +#ifndef TQT_NO_TABBAR + case CE_TabBarTab: + { + if ( ( elementFlags & CEF_UseGenericParameters ) || (!( elementFlags & CEF_HasParentWidget )) || !opt.tab() ) + break; + + const TQTab * t = opt.tab(); + bool selected = flags & Style_Selected; + bool lastTab = (ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1) ? + TRUE : FALSE; + TQRect r2( r ); + if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) { + p->setPen( cg.midlight() ); + + p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); + p->setPen( cg.light() ); + p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 ); + if ( r2.left() == 0 ) + p->drawPoint( ceData.rect.bottomLeft() ); + + if ( selected ) { + p->fillRect( TQRect( r2.left()+1, r2.bottom()-1, r2.width()-3, 2), + cg.brush( TQColorGroup::Background )); + p->setPen( cg.background() ); + p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top()+2 ); + p->setPen( cg.light() ); + } else { + p->setPen( cg.light() ); + r2.setRect( r2.left() + 2, r2.top() + 2, + r2.width() - 4, r2.height() - 2 ); + } + + int x1, x2; + x1 = r2.left(); + x2 = r2.right() - 2; + p->drawLine( x1, r2.bottom()-1, x1, r2.top() + 2 ); + x1++; + p->drawPoint( x1, r2.top() + 1 ); + x1++; + p->drawLine( x1, r2.top(), x2, r2.top() ); + if ( r2.left() > 0 ) { + p->setPen( cg.midlight() ); + } + x1 = r2.left(); + p->drawPoint( x1, r2.bottom()); + + p->setPen( cg.midlight() ); + x1++; + p->drawLine( x1, r2.bottom(), x1, r2.top() + 2 ); + x1++; + p->drawLine( x1, r2.top()+1, x2, r2.top()+1 ); + + p->setPen( cg.dark() ); + x2 = r2.right() - 1; + p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - 1 + + (selected ? 1:-1) ); + p->setPen( cg.shadow() ); + p->drawPoint( x2, r2.top() + 1 ); + p->drawPoint( x2, r2.top() + 1 ); + x2++; + p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - + (selected ? (lastTab ? 0:1) :2)); + } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) { + bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignRight; + bool firstTab = ceData.tabBarData.identIndexMap[t->identifier()] == 0; + if ( selected ) { + p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1), + cg.brush( TQColorGroup::Background )); + p->setPen( cg.background() ); + p->drawLine( r2.left()+1, r2.top(), r2.left()+1, r2.bottom()-2 ); + p->setPen( cg.dark() ); + } else { + p->setPen( cg.shadow() ); + p->drawLine( r2.left() + + (rightAligned && firstTab ? 0 : 1), + r2.top() + 1, + r2.right() - (lastTab ? 0 : 2), + r2.top() + 1 ); + + if ( rightAligned && lastTab ) + p->drawPoint( r2.right(), r2.top() ); + p->setPen( cg.dark() ); + p->drawLine( r2.left(), r2.top(), r2.right() - 1, + r2.top() ); + r2.setRect( r2.left() + 2, r2.top(), + r2.width() - 4, r2.height() - 2 ); + } + + p->drawLine( r2.right() - 1, r2.top() + (selected ? 0: 2), + r2.right() - 1, r2.bottom() - 2 ); + p->drawPoint( r2.right() - 2, r2.bottom() - 2 ); + p->drawLine( r2.right() - 2, r2.bottom() - 1, + r2.left() + 1, r2.bottom() - 1 ); + + p->setPen( cg.midlight() ); + p->drawLine( r2.left() + 1, r2.bottom() - 2, + r2.left() + 1, r2.top() + (selected ? 0 : 2) ); + + p->setPen( cg.shadow() ); + p->drawLine( r2.right(), + r2.top() + (lastTab && rightAligned && + selected) ? 0 : 1, + r2.right(), r2.bottom() - 1 ); + p->drawPoint( r2.right() - 1, r2.bottom() - 1 ); + p->drawLine( r2.right() - 1, r2.bottom(), + r2.left() + 2, r2.bottom() ); + + p->setPen( cg.light() ); + p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2), + r2.left(), r2.bottom() - 2 ); + } else { + TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); + } + break; + } +#endif // TQT_NO_TABBAR + case CE_ToolBoxTab: + { + qDrawShadePanel( p, r, cg, flags & (Style_Sunken | Style_Down | Style_On) , 1, + &cg.brush(TQColorGroup::Button)); + break; + } + +#ifndef TQT_NO_POPUPMENU + case CE_PopupMenuItem: + { + if (( elementFlags & CEF_UseGenericParameters ) || opt.isDefault()) + break; + + TQMenuItem *mi = opt.menuItem(); + if ( !mi ) + break; + + int tab = opt.tabWidth(); + int maxpmw = opt.maxIconWidth(); + bool dis = !(flags&Style_Enabled); + bool checkable = ( elementFlags & CEF_IsCheckable ); + bool act = flags & Style_Active; + int x, y, w, h; + + r.rect(&x, &y, &w, &h); + + if ( checkable ) { + // space for the checkmarks + if (use2000style) + maxpmw = TQMAX( maxpmw, 20 ); + else + maxpmw = TQMAX( maxpmw, 12 ); + } + + int checkcol = maxpmw; + + if ( mi && mi->isSeparator() ) { // draw separator + p->setPen( cg.dark() ); + p->drawLine( x, y, x+w, y ); + p->setPen( cg.light() ); + p->drawLine( x, y+1, x+w, y+1 ); + return; + } + + TQBrush fill = (act ? + cg.brush( TQColorGroup::Highlight ) : + cg.brush( TQColorGroup::Button )); + p->fillRect( x, y, w, h, fill); + + if ( !mi ) + return; + + int xpos = x; + TQRect vrect = visualRect( TQRect( xpos, y, checkcol, h ), r ); + int xvis = vrect.x(); + if ( mi->isChecked() ) { + drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt); + } else if (! act) + p->fillRect(xvis, y, checkcol , h, cg.brush( TQColorGroup::Button )); + + if ( mi->iconSet() ) { // draw iconset + TQIconSet::Mode mode = dis ? TQIconSet::Disabled : TQIconSet::Normal; + if (act && !dis ) + mode = TQIconSet::Active; + TQPixmap pixmap; + if ( checkable && mi->isChecked() ) + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On ); + else + pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); + int pixw = pixmap.width(); + int pixh = pixmap.height(); + if ( act && !dis && !mi->isChecked() ) + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); + TQRect pmr( 0, 0, pixw, pixh ); + pmr.moveCenter( vrect.center() ); + p->setPen( cg.text() ); + p->drawPixmap( pmr.topLeft(), pixmap ); + + fill = (act ? + cg.brush( TQColorGroup::Highlight ) : + cg.brush( TQColorGroup::Button )); + int xp = xpos + checkcol + 1; + p->fillRect( visualRect( TQRect( xp, y, w - checkcol - 1, h ), r ), fill); + } else if ( checkable ) { // just "checking"... + if ( mi->isChecked() ) { + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); + } + } + + p->setPen( act ? cg.highlightedText() : cg.buttonText() ); + + TQColor discol; + if ( dis ) { + discol = cg.text(); + p->setPen( discol ); + } + + int xm = windowsItemFrame + checkcol + windowsItemHMargin; + xpos += xm; + + vrect = visualRect( TQRect( xpos, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin ), r ); + xvis = vrect.x(); + if ( mi->custom() ) { + p->save(); + if ( dis && !act ) { + p->setPen( cg.light() ); + mi->custom()->paint( p, cg, act, !dis, + xvis+1, y+windowsItemVMargin+1, w-xm-tab+1, h-2*windowsItemVMargin ); + p->setPen( discol ); + } + mi->custom()->paint( p, cg, act, !dis, + xvis, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin ); + p->restore(); + } + TQString s = mi->text(); + if ( !s.isNull() ) { // draw text + int t = s.find( '\t' ); + int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; + if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) { + text_flags |= NoAccel; + } + text_flags |= (TQApplication::reverseLayout() ? AlignRight : AlignLeft ); + if ( t >= 0 ) { // draw tab text + int xp = x + w - tab - windowsItemHMargin - windowsItemFrame + 1; + if ( use2000style ) + xp -= 20; + else + xp -= windowsRightBorder; + int xoff = visualRect( TQRect( xp, y+windowsItemVMargin, tab, h-2*windowsItemVMargin ), r ).x(); + if ( dis && !act ) { + p->setPen( cg.light() ); + p->drawText( xoff+1, y+windowsItemVMargin+1, tab, h-2*windowsItemVMargin, text_flags, s.mid( t+1 )); + p->setPen( discol ); + } + p->drawText( xoff, y+windowsItemVMargin, tab, h-2*windowsItemVMargin, text_flags, s.mid( t+1 ) ); + s = s.left( t ); + } + if ( dis && !act ) { + p->setPen( cg.light() ); + p->drawText( xvis+1, y+windowsItemVMargin+1, w-xm-tab+1, h-2*windowsItemVMargin, text_flags, s, t ); + p->setPen( discol ); + } + p->drawText( xvis, y+windowsItemVMargin, w-xm-tab+1, h-2*windowsItemVMargin, text_flags, s, t ); + } else if ( mi->pixmap() ) { // draw pixmap + TQPixmap *pixmap = mi->pixmap(); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( OpaqueMode ); + p->drawPixmap( xvis, y+windowsItemFrame, *pixmap ); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( TransparentMode ); + } + if ( mi->popup() ) { // draw sub menu arrow + int dim = (h-2*windowsItemFrame) / 2; + PrimitiveElement arrow; + arrow = ( TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight ); + xpos = x+w - windowsArrowHMargin - windowsItemFrame - dim; + vrect = visualRect( TQRect(xpos, y + h / 2 - dim / 2, dim, dim), r ); + if ( act ) { + TQColorGroup g2 = cg; + g2.setColor( TQColorGroup::ButtonText, g2.highlightedText() ); + drawPrimitive(arrow, p, ceData, elementFlags, vrect, + g2, dis ? Style_Default : Style_Enabled); + } else { + drawPrimitive(arrow, p, ceData, elementFlags, vrect, + cg, dis ? Style_Default : Style_Enabled ); + } + } + + break; + } +#endif + + case CE_MenuBarItem: + { + bool active = flags & Style_Active; + bool hasFocus = flags & Style_HasFocus; + bool down = flags & Style_Down; + TQRect pr = r; + + p->fillRect( r, cg.brush( TQColorGroup::Button ) ); + if ( active || hasFocus ) { + TQBrush b = cg.brush( TQColorGroup::Button ); + if ( active && down ) + p->setBrushOrigin(p->brushOrigin() + TQPoint(1,1)); + if ( active && hasFocus ) + qDrawShadeRect( p, r.x(), r.y(), r.width(), r.height(), + cg, active && down, 1, 0, &b ); + if ( active && down ) { + pr.moveBy( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) ); + p->setBrushOrigin(p->brushOrigin() - TQPoint(1,1)); + } + } + TQCommonStyle::drawControl(element, p, ceData, elementFlags, pr, cg, flags, opt, widget); + break; + } + + default: + TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); + } +} + + +/*! + \reimp +*/ +int TQWindowsStyle::pixelMetric(PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const +{ + int ret; + + switch (metric) { + case PM_ButtonDefaultIndicator: + case PM_ButtonShiftHorizontal: + case PM_ButtonShiftVertical: + ret = 1; + break; + + case PM_MaximumDragDistance: + ret = 60; + break; + +#ifndef TQT_NO_SLIDER + case PM_SliderLength: + ret = 11; + break; + + // Returns the number of pixels to use for the business part of the + // slider (i.e., the non-tickmark portion). The remaining space is shared + // equally between the tickmark regions. + case PM_SliderControlThickness: + { + int space = (ceData.orientation == Horizontal) ? ceData.rect.height() + : ceData.rect.width(); + int ticks = ceData.tickMarkSetting; + int n = 0; + if ( ticks & TQSlider::Above ) n++; + if ( ticks & TQSlider::Below ) n++; + if ( !n ) { + ret = space; + break; + } + + int thick = 6; // Magic constant to get 5 + 16 + 5 + if ( ticks != TQSlider::Both && ticks != TQSlider::NoMarks ) + thick += pixelMetric( PM_SliderLength, ceData, elementFlags, widget ) / 4; + + space -= thick; + //### the two sides may be unequal in size + if ( space > 0 ) + thick += (space * 2) / (n + 2); + ret = thick; + break; + } +#endif // TQT_NO_SLIDER + + case PM_MenuBarFrameWidth: + ret = 0; + break; + + case PM_SplitterWidth: + ret = TQMAX( 6, TQApplication::globalStrut().width() ); + break; + + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = windowsItemFrame; + break; + + default: + ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget); + break; + } + + return ret; +} + + +/*! + \reimp +*/ +TQSize TQWindowsStyle::sizeFromContents( ContentsType contents, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &contentsSize, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + TQSize sz(contentsSize); + + switch (contents) { + case CT_PushButton: + { +#ifndef TQT_NO_PUSHBUTTON + sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, opt, widget); + int w = sz.width(), h = sz.height(); + + int defwidth = 0; + if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) + defwidth = 2*pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ); + + if (w < 80+defwidth && ceData.fgPixmap.isNull()) + w = 80+defwidth; + if (h < 23+defwidth) + h = 23+defwidth; + + sz = TQSize(w, h); +#endif + break; + } + + case CT_PopupMenuItem: + { +#ifndef TQT_NO_POPUPMENU + if (( elementFlags & CEF_UseGenericParameters ) || opt.isDefault()) + break; + + bool checkable = ( elementFlags & CEF_IsCheckable ); + TQMenuItem *mi = opt.menuItem(); + int maxpmw = opt.maxIconWidth(); + int w = sz.width(), h = sz.height(); + + if (mi->custom()) { + w = mi->custom()->sizeHint().width(); + h = mi->custom()->sizeHint().height(); + if (! mi->custom()->fullSpan()) + h += 2*windowsItemVMargin + 2*windowsItemFrame; + } else if ( mi->widget() ) { + } else if (mi->isSeparator()) { + w = 10; // arbitrary + h = windowsSepHeight; + } else { + if (mi->pixmap()) + h = TQMAX(h, mi->pixmap()->height() + 2*windowsItemFrame); + else if (! mi->text().isNull()) + h = TQMAX(h, TQFontMetrics(ceData.font).height() + 2*windowsItemVMargin + + 2*windowsItemFrame); + + if (mi->iconSet() != 0) + h = TQMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, + TQIconSet::Normal).height() + + 2*windowsItemFrame); + } + + if (! mi->text().isNull() && mi->text().find('\t') >= 0) { + if ( use2000style ) + w += 20; + else + w += windowsTabSpacing; + } else if (mi->popup()) { + w += 2*windowsArrowHMargin; + } + + if (use2000style) { + if (checkable && maxpmw < 20) + w += 20 - maxpmw; + } else { + if (checkable && maxpmw < windowsCheckMarkWidth) + w += windowsCheckMarkWidth - maxpmw; + } + if (checkable || maxpmw > 0) + w += windowsCheckMarkHMargin; + if (use2000style) + w += 20; + else + w += windowsRightBorder; + + sz = TQSize(w, h); +#endif + break; + } + + default: + sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, sz, opt, widget); + break; + } + + return sz; +} + +/*! \reimp +*/ +void TQWindowsStyle::polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ +#ifndef TQT_NO_POPUPMENU + if ( !(ceData.windowState & WState_Polished ) ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetCheckable); + } +#endif +} + +#ifndef TQT_NO_IMAGEIO_XPM +static const char * const qt_close_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +"..##....##..", +"...##..##...", +"....####....", +".....##.....", +"....####....", +"...##..##...", +"..##....##..", +"............", +"............", +"............"}; + +static const char * const qt_maximize_xpm[]={ +"12 12 2 1", +"# c #000000", +". c None", +"............", +".#########..", +".#########..", +".#.......#..", +".#.......#..", +".#.......#..", +".#.......#..", +".#.......#..", +".#.......#..", +".#########..", +"............", +"............"}; + + +static const char * const qt_minimize_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +"............", +"............", +"............", +"............", +"............", +"............", +"..######....", +"..######....", +"............", +"............"}; + +static const char * const qt_normalizeup_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"....######..", +"....######..", +"....#....#..", +"..######.#..", +"..######.#..", +"..#....###..", +"..#....#....", +"..#....#....", +"..######....", +"............", +"............"}; + + +static const char * const qt_shade_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +"............", +"............", +"............", +".....#......", +"....###.....", +"...#####....", +"..#######...", +"............", +"............", +"............"}; + +static const char * const qt_unshade_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +"............", +"............", +"..#######...", +"...#####....", +"....###.....", +".....#......", +"............", +"............", +"............", +"............"}; + +static const char * dock_window_close_xpm[] = { +"8 8 2 1", +"# c #000000", +". c None", +"........", +".##..##.", +"..####..", +"...##...", +"..####..", +".##..##.", +"........", +"........"}; + +/* XPM */ +static const char * const information_xpm[]={ +"32 32 5 1", +". c None", +"c c #000000", +"* c #999999", +"a c #ffffff", +"b c #0000ff", +"...........********.............", +"........***aaaaaaaa***..........", +"......**aaaaaaaaaaaaaa**........", +".....*aaaaaaaaaaaaaaaaaa*.......", +"....*aaaaaaaabbbbaaaaaaaac......", +"...*aaaaaaaabbbbbbaaaaaaaac.....", +"..*aaaaaaaaabbbbbbaaaaaaaaac....", +".*aaaaaaaaaaabbbbaaaaaaaaaaac...", +".*aaaaaaaaaaaaaaaaaaaaaaaaaac*..", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac*.", +"*aaaaaaaaaabbbbbbbaaaaaaaaaaac*.", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +".*aaaaaaaaaaabbbbbaaaaaaaaaac***", +".*aaaaaaaaaaabbbbbaaaaaaaaaac***", +"..*aaaaaaaaaabbbbbaaaaaaaaac***.", +"...caaaaaaabbbbbbbbbaaaaaac****.", +"....caaaaaaaaaaaaaaaaaaaac****..", +".....caaaaaaaaaaaaaaaaaac****...", +"......ccaaaaaaaaaaaaaacc****....", +".......*cccaaaaaaaaccc*****.....", +"........***cccaaaac*******......", +"..........****caaac*****........", +".............*caaac**...........", +"...............caac**...........", +"................cac**...........", +".................cc**...........", +"..................***...........", +"...................**..........."}; +/* XPM */ +static const char* const warning_xpm[]={ +"32 32 4 1", +". c None", +"a c #ffff00", +"* c #000000", +"b c #999999", +".............***................", +"............*aaa*...............", +"...........*aaaaa*b.............", +"...........*aaaaa*bb............", +"..........*aaaaaaa*bb...........", +"..........*aaaaaaa*bb...........", +".........*aaaaaaaaa*bb..........", +".........*aaaaaaaaa*bb..........", +"........*aaaaaaaaaaa*bb.........", +"........*aaaa***aaaa*bb.........", +".......*aaaa*****aaaa*bb........", +".......*aaaa*****aaaa*bb........", +"......*aaaaa*****aaaaa*bb.......", +"......*aaaaa*****aaaaa*bb.......", +".....*aaaaaa*****aaaaaa*bb......", +".....*aaaaaa*****aaaaaa*bb......", +"....*aaaaaaaa***aaaaaaaa*bb.....", +"....*aaaaaaaa***aaaaaaaa*bb.....", +"...*aaaaaaaaa***aaaaaaaaa*bb....", +"...*aaaaaaaaaa*aaaaaaaaaa*bb....", +"..*aaaaaaaaaaa*aaaaaaaaaaa*bb...", +"..*aaaaaaaaaaaaaaaaaaaaaaa*bb...", +".*aaaaaaaaaaaa**aaaaaaaaaaa*bb..", +".*aaaaaaaaaaa****aaaaaaaaaa*bb..", +"*aaaaaaaaaaaa****aaaaaaaaaaa*bb.", +"*aaaaaaaaaaaaa**aaaaaaaaaaaa*bb.", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", +".*aaaaaaaaaaaaaaaaaaaaaaaaa*bbbb", +"..*************************bbbbb", +"....bbbbbbbbbbbbbbbbbbbbbbbbbbb.", +".....bbbbbbbbbbbbbbbbbbbbbbbbb.."}; +/* XPM */ +static const char* const critical_xpm[]={ +"32 32 4 1", +". c None", +"a c #999999", +"* c #ff0000", +"b c #ffffff", +"...........********.............", +".........************...........", +".......****************.........", +"......******************........", +".....********************a......", +"....**********************a.....", +"...************************a....", +"..*******b**********b*******a...", +"..******bbb********bbb******a...", +".******bbbbb******bbbbb******a..", +".*******bbbbb****bbbbb*******a..", +"*********bbbbb**bbbbb*********a.", +"**********bbbbbbbbbb**********a.", +"***********bbbbbbbb***********aa", +"************bbbbbb************aa", +"************bbbbbb************aa", +"***********bbbbbbbb***********aa", +"**********bbbbbbbbbb**********aa", +"*********bbbbb**bbbbb*********aa", +".*******bbbbb****bbbbb*******aa.", +".******bbbbb******bbbbb******aa.", +"..******bbb********bbb******aaa.", +"..*******b**********b*******aa..", +"...************************aaa..", +"....**********************aaa...", +"....a********************aaa....", +".....a******************aaa.....", +"......a****************aaa......", +".......aa************aaaa.......", +".........aa********aaaaa........", +"...........aaaaaaaaaaa..........", +".............aaaaaaa............"}; +/* XPM */ +static const char *const question_xpm[] = { +"32 32 5 1", +". c None", +"c c #000000", +"* c #999999", +"a c #ffffff", +"b c #0000ff", +"...........********.............", +"........***aaaaaaaa***..........", +"......**aaaaaaaaaaaaaa**........", +".....*aaaaaaaaaaaaaaaaaa*.......", +"....*aaaaaaaaaaaaaaaaaaaac......", +"...*aaaaaaaabbbbbbaaaaaaaac.....", +"..*aaaaaaaabaaabbbbaaaaaaaac....", +".*aaaaaaaabbaaaabbbbaaaaaaaac...", +".*aaaaaaaabbbbaabbbbaaaaaaaac*..", +"*aaaaaaaaabbbbaabbbbaaaaaaaaac*.", +"*aaaaaaaaaabbaabbbbaaaaaaaaaac*.", +"*aaaaaaaaaaaaabbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaaabbbaaaaaaaaaaaac**", +"*aaaaaaaaaaaaabbaaaaaaaaaaaaac**", +"*aaaaaaaaaaaaabbaaaaaaaaaaaaac**", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac**", +".*aaaaaaaaaaaabbaaaaaaaaaaaac***", +".*aaaaaaaaaaabbbbaaaaaaaaaaac***", +"..*aaaaaaaaaabbbbaaaaaaaaaac***.", +"...caaaaaaaaaabbaaaaaaaaaac****.", +"....caaaaaaaaaaaaaaaaaaaac****..", +".....caaaaaaaaaaaaaaaaaac****...", +"......ccaaaaaaaaaaaaaacc****....", +".......*cccaaaaaaaaccc*****.....", +"........***cccaaaac*******......", +"..........****caaac*****........", +".............*caaac**...........", +"...............caac**...........", +"................cac**...........", +".................cc**...........", +"..................***...........", +"...................**...........", +}; +#endif //TQT_NO_IMAGEIO_XPM + +/*! + \reimp + */ +TQPixmap TQWindowsStyle::stylePixmap(StylePixmap stylepixmap, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& opt, + const TQWidget *widget) const +{ +#ifndef TQT_NO_IMAGEIO_XPM + switch (stylepixmap) { + case SP_TitleBarShadeButton: + return TQPixmap( (const char **)qt_shade_xpm ); + case SP_TitleBarUnshadeButton: + return TQPixmap( (const char **)qt_unshade_xpm ); + case SP_TitleBarNormalButton: + return TQPixmap( (const char **)qt_normalizeup_xpm ); + case SP_TitleBarMinButton: + return TQPixmap( (const char **)qt_minimize_xpm ); + case SP_TitleBarMaxButton: + return TQPixmap( (const char **)qt_maximize_xpm ); + case SP_TitleBarCloseButton: + return TQPixmap( (const char **)qt_close_xpm ); + case SP_DockWindowCloseButton: + return TQPixmap( (const char **)dock_window_close_xpm ); + case SP_MessageBoxInformation: + return TQPixmap( (const char **)information_xpm); + case SP_MessageBoxWarning: + return TQPixmap( (const char **)warning_xpm ); + case SP_MessageBoxCritical: + return TQPixmap( (const char **)critical_xpm ); + case SP_MessageBoxQuestion: + return TQPixmap( (const char **)question_xpm ); + default: + break; + } +#endif //TQT_NO_IMAGEIO_XPM + return TQCommonStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget); +} + +/*!\reimp +*/ +void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + SCFlags sub, + SCFlags subActive, + const TQStyleOption& opt, + const TQWidget *widget ) const +{ + switch (ctrl) { +#ifndef TQT_NO_LISTVIEW + case CC_ListView: + { + if ( sub & SC_ListView ) { + TQCommonStyle::drawComplexControl( ctrl, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget ); + } + if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) { + if (opt.isDefault()) + break; + + TQListViewItem *item = opt.listViewItem(), + *child = item->firstChild(); + + int y = r.y(); + int c; + int dotoffset = 0; + TQPointArray dotlines; + if ( subActive == (uint)SC_All && sub == SC_ListViewExpand ) { + c = 2; + dotlines.resize(2); + dotlines[0] = TQPoint( r.right(), r.top() ); + dotlines[1] = TQPoint( r.right(), r.bottom() ); + } else { + int linetop = 0, linebot = 0; + // each branch needs at most two lines, ie. four end points + dotoffset = (item->itemPos() + item->height() - y) %2; + dotlines.resize( item->childCount() * 4 ); + c = 0; + + // skip the stuff above the exposed rectangle + while ( child && y + child->height() <= 0 ) { + y += child->totalHeight(); + child = child->nextSibling(); + } + + int bx = r.width() / 2; + + // paint stuff in the magical area + TQListView* v = item->listView(); + while ( child && y < r.height() ) { + if (child->isVisible()) { + int lh; + if ( !item->multiLinesEnabled() ) + lh = child->height(); + else + lh = p->fontMetrics().height() + 2 * v->itemMargin(); + lh = TQMAX( lh, TQApplication::globalStrut().height() ); + if ( lh % 2 > 0 ) + lh++; + linebot = y + lh/2; + if ( (child->isExpandable() || child->childCount()) && + (child->height() > 0) ) { + // needs a box + p->setPen( cg.mid() ); + p->drawRect( bx-4, linebot-4, 9, 9 ); + // plus or minus + p->setPen( cg.text() ); + p->drawLine( bx - 2, linebot, bx + 2, linebot ); + if ( !child->isOpen() ) + p->drawLine( bx, linebot - 2, bx, linebot + 2 ); + // dotlinery + p->setPen( cg.mid() ); + dotlines[c++] = TQPoint( bx, linetop ); + dotlines[c++] = TQPoint( bx, linebot - 4 ); + dotlines[c++] = TQPoint( bx + 5, linebot ); + dotlines[c++] = TQPoint( r.width(), linebot ); + linetop = linebot + 5; + } else { + // just dotlinery + dotlines[c++] = TQPoint( bx+1, linebot -1); + dotlines[c++] = TQPoint( r.width(), linebot -1); + } + y += child->totalHeight(); + } + child = child->nextSibling(); + } + + // Expand line height to edge of rectangle if there's any + // visible child below + while ( child && child->height() <= 0) + child = child->nextSibling(); + if ( child ) + linebot = r.height(); + + if ( linetop < linebot ) { + dotlines[c++] = TQPoint( bx, linetop ); + dotlines[c++] = TQPoint( bx, linebot ); + } + } + p->setPen( cg.text() ); + + static TQBitmap *verticalLine = 0, *horizontalLine = 0; + static TQCleanupHandler qlv_cleanup_bitmap; + if ( !verticalLine ) { + // make 128*1 and 1*128 bitmaps that can be used for + // drawing the right sort of lines. + verticalLine = new TQBitmap( 1, 129, TRUE ); + horizontalLine = new TQBitmap( 128, 1, TRUE ); + TQPointArray a( 64 ); + TQPainter p; + p.begin( verticalLine ); + int i; + for( i=0; i<64; i++ ) + a.setPoint( i, 0, i*2+1 ); + p.setPen( color1 ); + p.drawPoints( a ); + p.end(); + TQApplication::flushX(); + verticalLine->setMask( *verticalLine ); + p.begin( horizontalLine ); + for( i=0; i<64; i++ ) + a.setPoint( i, i*2+1, 0 ); + p.setPen( color1 ); + p.drawPoints( a ); + p.end(); + TQApplication::flushX(); + horizontalLine->setMask( *horizontalLine ); + qlv_cleanup_bitmap.add( &verticalLine ); + qlv_cleanup_bitmap.add( &horizontalLine ); + } + + int line; // index into dotlines + if ( sub & SC_ListViewBranch ) for( line = 0; line < c; line += 2 ) { + // assumptions here: lines are horizontal or vertical. + // lines always start with the numerically lowest + // coordinate. + + // point ... relevant coordinate of current point + // end ..... same coordinate of the end of the current line + // other ... the other coordinate of the current point/line + if ( dotlines[line].y() == dotlines[line+1].y() ) { + int end = dotlines[line+1].x(); + int point = dotlines[line].x(); + int other = dotlines[line].y(); + while( point < end ) { + int i = 128; + if ( i+point > end ) + i = end-point; + p->drawPixmap( point, other, *horizontalLine, + 0, 0, i, 1 ); + point += i; + } + } else { + int end = dotlines[line+1].y(); + int point = dotlines[line].y(); + int other = dotlines[line].x(); + int pixmapoffset = ((point & 1) != dotoffset ) ? 1 : 0; + while( point < end ) { + int i = 128; + if ( i+point > end ) + i = end-point; + p->drawPixmap( other, point, *verticalLine, + 0, pixmapoffset, 1, i ); + point += i; + } + } + } + } + } + break; +#endif //TQT_NO_LISTVIEW + +#ifndef TQT_NO_COMBOBOX + case CC_ComboBox: + if ( sub & SC_ComboBoxArrow ) { + SFlags flags = Style_Default; + + qDrawWinPanel( p, r, cg, TRUE, ( elementFlags & CEF_IsEnabled ) ? + &cg.brush( TQColorGroup::Base ): + &cg.brush( TQColorGroup::Background ) ); + + TQRect ar = + TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, + SC_ComboBoxArrow, TQStyleOption::Default, widget ), ceData, elementFlags ); + if ( subActive == SC_ComboBoxArrow ) { + p->setPen( cg.dark() ); + p->setBrush( cg.brush( TQColorGroup::Button ) ); + p->drawRect( ar ); + } else + qDrawWinPanel( p, ar, cg, FALSE, + &cg.brush( TQColorGroup::Button ) ); + + ar.addCoords( 2, 2, -2, -2 ); + if ( elementFlags & CEF_IsEnabled ) + flags |= Style_Enabled; + + if ( subActive == SC_ComboBoxArrow ) { + flags |= Style_Sunken; + } + drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags ); + } + + if ( sub & SC_ComboBoxEditField ) { + TQRect re = + TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, + SC_ComboBoxEditField, TQStyleOption::Default, widget ), ceData, elementFlags ); + if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) + p->fillRect( re.x(), re.y(), re.width(), re.height(), + cg.brush( TQColorGroup::Highlight ) ); + + if ( elementFlags & CEF_HasFocus ) { + p->setPen( cg.highlightedText() ); + p->setBackgroundColor( cg.highlight() ); + + } else { + p->setPen( cg.text() ); + p->setBackgroundColor( cg.background() ); + } + + if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) { + TQRect re = + TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg, Style_FocusAtBorder, TQStyleOption(cg.highlight())); + } + } + + break; +#endif // TQT_NO_COMBOBOX + +#ifndef TQT_NO_SLIDER + case CC_Slider: + { + int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget ); + int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); + int ticks = ceData.tickMarkSetting; + + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, + opt, widget), + handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, + opt, widget); + + if ((sub & SC_SliderGroove) && groove.isValid()) { + int mid = thickness / 2; + + if ( ticks & TQSlider::Above ) + mid += len / 8; + if ( ticks & TQSlider::Below ) + mid -= len / 8; + + p->setPen( cg.shadow() ); + if ( ceData.orientation == Horizontal ) { + qDrawWinPanel( p, groove.x(), groove.y() + mid - 2, + groove.width(), 4, cg, TRUE ); + p->drawLine( groove.x() + 1, groove.y() + mid - 1, + groove.x() + groove.width() - 3, groove.y() + mid - 1 ); + } else { + qDrawWinPanel( p, groove.x() + mid - 2, groove.y(), + 4, groove.height(), cg, TRUE ); + p->drawLine( groove.x() + mid - 1, groove.y() + 1, + groove.x() + mid - 1, + groove.y() + groove.height() - 3 ); + } + } + + if (sub & SC_SliderTickmarks) + TQCommonStyle::drawComplexControl(ctrl, p, ceData, elementFlags, r, cg, flags, + SC_SliderTickmarks, subActive, + opt, widget ); + + if ( sub & SC_SliderHandle ) { + // 4444440 + // 4333310 + // 4322210 + // 4322210 + // 4322210 + // 4322210 + // *43210* + // **410** + // ***0*** + const TQColor c0 = cg.shadow(); + const TQColor c1 = cg.dark(); + // const TQColor c2 = g.button(); + const TQColor c3 = cg.midlight(); + const TQColor c4 = cg.light(); + + int x = handle.x(), y = handle.y(), + wi = handle.width(), he = handle.height(); + + int x1 = x; + int x2 = x+wi-1; + int y1 = y; + int y2 = y+he-1; + + Orientation orient = ceData.orientation; + bool tickAbove = ceData.tickMarkSetting == TQSlider::Above; + bool tickBelow = ceData.tickMarkSetting == TQSlider::Below; + + p->fillRect( x, y, wi, he, cg.brush( TQColorGroup::Background ) ); + + if ( flags & Style_HasFocus ) { + TQRect re = subRect( SR_SliderFocusRect, ceData, elementFlags, widget ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg ); + } + + if ( (tickAbove && tickBelow) || (!tickAbove && !tickBelow) ) { + qDrawWinButton( p, TQRect(x,y,wi,he), cg, FALSE, + &cg.brush( TQColorGroup::Button ) ); + return; + } + + TQSliderDirection dir; + + if ( orient == Horizontal ) + if ( tickAbove ) + dir = SlUp; + else + dir = SlDown; + else + if ( tickAbove ) + dir = SlLeft; + else + dir = SlRight; + + TQPointArray a; + + int d = 0; + switch ( dir ) { + case SlUp: + y1 = y1 + wi/2; + d = (wi + 1) / 2 - 1; + a.setPoints(5, x1,y1, x1,y2, x2,y2, x2,y1, x1+d,y1-d ); + break; + case SlDown: + y2 = y2 - wi/2; + d = (wi + 1) / 2 - 1; + a.setPoints(5, x1,y1, x1,y2, x1+d,y2+d, x2,y2, x2,y1 ); + break; + case SlLeft: + d = (he + 1) / 2 - 1; + x1 = x1 + he/2; + a.setPoints(5, x1,y1, x1-d,y1+d, x1,y2, x2,y2, x2,y1); + break; + case SlRight: + d = (he + 1) / 2 - 1; + x2 = x2 - he/2; + a.setPoints(5, x1,y1, x1,y2, x2,y2, x2+d,y1+d, x2,y1 ); + break; + } + + TQBrush oldBrush = p->brush(); + p->setBrush( cg.brush( TQColorGroup::Button ) ); + p->setPen( NoPen ); + p->drawRect( x1, y1, x2-x1+1, y2-y1+1 ); + p->drawPolygon( a ); + p->setBrush( oldBrush ); + + if ( dir != SlUp ) { + p->setPen( c4 ); + p->drawLine( x1, y1, x2, y1 ); + p->setPen( c3 ); + p->drawLine( x1, y1+1, x2, y1+1 ); + } + if ( dir != SlLeft ) { + p->setPen( c3 ); + p->drawLine( x1+1, y1+1, x1+1, y2 ); + p->setPen( c4 ); + p->drawLine( x1, y1, x1, y2 ); + } + if ( dir != SlRight ) { + p->setPen( c0 ); + p->drawLine( x2, y1, x2, y2 ); + p->setPen( c1 ); + p->drawLine( x2-1, y1+1, x2-1, y2-1 ); + } + if ( dir != SlDown ) { + p->setPen( c0 ); + p->drawLine( x1, y2, x2, y2 ); + p->setPen( c1 ); + p->drawLine( x1+1, y2-1, x2-1, y2-1 ); + } + + switch ( dir ) { + case SlUp: + p->setPen( c4 ); + p->drawLine( x1, y1, x1+d, y1-d); + p->setPen( c0 ); + d = wi - d - 1; + p->drawLine( x2, y1, x2-d, y1-d); + d--; + p->setPen( c3 ); + p->drawLine( x1+1, y1, x1+1+d, y1-d ); + p->setPen( c1 ); + p->drawLine( x2-1, y1, x2-1-d, y1-d); + break; + case SlDown: + p->setPen( c4 ); + p->drawLine( x1, y2, x1+d, y2+d); + p->setPen( c0 ); + d = wi - d - 1; + p->drawLine( x2, y2, x2-d, y2+d); + d--; + p->setPen( c3 ); + p->drawLine( x1+1, y2, x1+1+d, y2+d ); + p->setPen( c1 ); + p->drawLine( x2-1, y2, x2-1-d, y2+d); + break; + case SlLeft: + p->setPen( c4 ); + p->drawLine( x1, y1, x1-d, y1+d); + p->setPen( c0 ); + d = he - d - 1; + p->drawLine( x1, y2, x1-d, y2-d); + d--; + p->setPen( c3 ); + p->drawLine( x1, y1+1, x1-d, y1+1+d ); + p->setPen( c1 ); + p->drawLine( x1, y2-1, x1-d, y2-1-d); + break; + case SlRight: + p->setPen( c4 ); + p->drawLine( x2, y1, x2+d, y1+d); + p->setPen( c0 ); + d = he - d - 1; + p->drawLine( x2, y2, x2+d, y2-d); + d--; + p->setPen( c3 ); + p->drawLine( x2, y1+1, x2+d, y1+1+d ); + p->setPen( c1 ); + p->drawLine( x2, y2-1, x2+d, y2-1-d); + break; + } + } + + break; + } +#endif // TQT_NO_SLIDER + + default: + TQCommonStyle::drawComplexControl( ctrl, p, ceData, elementFlags, r, cg, flags, sub, + subActive, opt, widget ); + break; + } +} + + +/*! \reimp */ +int TQWindowsStyle::styleHint( StyleHint hint, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption &opt, + TQStyleHintReturn *returnData, + const TQWidget *widget ) const +{ + int ret; + + switch (hint) { + case SH_EtchDisabledText: + case SH_Slider_SnapToValue: + case SH_PrintDialog_RightAlignButtons: + case SH_MainWindow_SpaceBelowMenuBar: + case SH_FontDialog_SelectAssociatedText: + case SH_PopupMenu_AllowActiveAndDisabled: + case SH_MenuBar_AltKeyNavigation: + case SH_MenuBar_MouseTracking: + case SH_PopupMenu_MouseTracking: + case SH_ComboBox_ListMouseTracking: + case SH_ScrollBar_StopMouseOverSlider: + ret = 1; + break; + + case SH_ItemView_ChangeHighlightOnFocus: + ret = 0; + break; + + case SH_ToolBox_SelectedPageTitleBold: + ret = 0; + break; + + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = ( elementFlags & CEF_IsCheckable ); + + if ( checkable ) { + // space for the checkmarks + if (use2000style) + maxpmw = TQMAX( maxpmw, 20 ); + else + maxpmw = TQMAX( maxpmw, 12 ); + } + + ret = maxpmw; + break; + } + + default: + ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); + break; + } + + return ret; +} + +/*! \reimp */ +TQRect TQWindowsStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const +{ + TQRect rect; + + switch (r) { +#ifndef TQT_NO_SLIDER + case SR_SliderFocusRect: + { + rect = ceData.rect; + break; + } +#endif // TQT_NO_SLIDER + case SR_ToolBoxTabContents: + rect = ceData.rect; + break; + default: + rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget ); + break; + } + + return rect; +} + +#endif diff --git a/src/styles/tqwindowsstyle.h b/src/styles/tqwindowsstyle.h new file mode 100644 index 000000000..268ae7850 --- /dev/null +++ b/src/styles/tqwindowsstyle.h @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Definition of Windows-like style class +** +** Created : 981231 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQWINDOWSSTYLE_H +#define TQWINDOWSSTYLE_H + +#ifndef QT_H +#include "tqcommonstyle.h" +#endif // QT_H + +#if !defined(TQT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) + +#if defined(QT_PLUGIN) +#define Q_EXPORT_STYLE_WINDOWS +#else +#define Q_EXPORT_STYLE_WINDOWS TQ_EXPORT +#endif + + +class Q_EXPORT_STYLE_WINDOWS TQWindowsStyle : public TQCommonStyle +{ + TQ_OBJECT +public: + TQWindowsStyle(); + ~TQWindowsStyle(); + + void applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); + void applicationUnPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); + + void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); + void unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); + + void polish( TQPalette & ); + + virtual void polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + + // new stuff + void drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default ) const; + + void drawControl( ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + void drawComplexControl( ComplexControl control, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect& r, + const TQColorGroup& cg, + SFlags flags = Style_Default, +#ifdef Q_QDOC + SCFlags sub = SC_All, +#else + SCFlags sub = (uint)SC_All, +#endif + SCFlags subActive = SC_None, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget* widget = 0 ) const; + + int pixelMetric( PixelMetric metric, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget = 0 ) const; + + TQSize sizeFromContents( ContentsType contents, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &contentsSize, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + int styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, + TQStyleHintReturn* = 0, const TQWidget* = 0) const; + + TQPixmap stylePixmap( StylePixmap stylepixmap, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = 0 ) const; + + TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const; + + bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); + +private: + class Private; + Private *d; + + // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQWindowsStyle( const TQWindowsStyle & ); + TQWindowsStyle& operator=( const TQWindowsStyle & ); +#endif +}; + +#endif // TQT_NO_STYLE_WINDOWS + +#endif // TQWINDOWSSTYLE_H diff --git a/tools/designer/designer/propertyeditor.cpp b/tools/designer/designer/propertyeditor.cpp index 898a03039..d84474ea6 100644 --- a/tools/designer/designer/propertyeditor.cpp +++ b/tools/designer/designer/propertyeditor.cpp @@ -96,7 +96,7 @@ static TQFontDatabase *fontDataBase = 0; TQString assistantPath(); #ifdef TQ_WS_MAC -#include +#include static void setupStyle(TQWidget *w) { static TQStyle *windowsStyle = 0; -- cgit v1.2.1