From d1fb90134ab8504932ee36de6157f846b50f7415 Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 6 May 2011 22:09:18 +0000 Subject: TQt4 port kde-style-qtcurve This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kde-style-qtcurve@1230744 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- common/common.h | 220 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 110 insertions(+), 110 deletions(-) (limited to 'common/common.h') diff --git a/common/common.h b/common/common.h index c64872b..e7b1974 100644 --- a/common/common.h +++ b/common/common.h @@ -2,7 +2,7 @@ #define __COMMON_H__ /* - QtCurve (C) Craig Drummond, 2003 - 2010 craig.p.drummond@gmail.com + TQtCurve (C) Craig Drummond, 2003 - 2010 craig.p.drummond@gmail.com ---- @@ -22,14 +22,14 @@ */ /* This file is quite 'hacky' as it contains lots of static function definitions - but I want to share the code - between Qt and Gtk, but not polute the namespace with exported functions... */ + between TQt and Gtk, but not polute the namespace with exported functions... */ #include #include #include #include "config.h" -#if defined _WIN32 && defined QT_VERSION && (QT_VERSION >= 0x040000) +#if defined _WIN32 && (0x039999 >= 0x040000) #include #include #include @@ -66,28 +66,28 @@ typedef enum } EShading; #ifdef __cplusplus -#include +#include #ifdef CONFIG_DIALOG -#include +#include #endif #include #include -#if !defined CONFIG_DIALOG && defined QT_VERSION && (QT_VERSION >= 0x040000) -#include +#if !defined CONFIG_DIALOG && (0x039999 >= 0x040000) +#include #endif #else #include #endif #ifdef __cplusplus -#include -typedef QColor color; +#include +typedef TQColor color; -#if defined QT_VERSION && (QT_VERSION >= 0x040000) -#include -typedef QSet Strings; +#if (0x039999 >= 0x040000) +#include +typedef TQSet Strings; #else -typedef QStringList Strings; +typedef TQStringList Strings; #endif #else @@ -182,14 +182,14 @@ enum #define SUNKEN_BEVEL_DARK_ALPHA(X) (X.value()/800.0) // 0.25 #define SUNKEN_BEVEL_LIGHT_ALPHA(X) (X.value()/500.0) // 0.40 -#define MENU_SIZE_ATOM "_QTCURVE_MENUBAR_SIZE_" -#define STATUSBAR_ATOM "_QTCURVE_STATUSBAR_" -#define TITLEBAR_SIZE_ATOM "_QTCURVE_TITLEBAR_SIZE_" -#define ACTIVE_WINDOW_ATOM "_QTCURVE_ACTIVE_WINDOW_" -#define TOGGLE_MENUBAR_ATOM "_QTCURVE_TOGGLE_MENUBAR_" -#define TOGGLE_STATUSBAR_ATOM "_QTCURVE_TOGGLE_STATUSBAR_" -#define OPACITY_ATOM "_QTCURVE_OPACITY_" -#define BGND_ATOM "_QTCURVE_BGND_" +#define MENU_SIZE_ATOM "_TQTCURVE_MENUBAR_SIZE_" +#define STATUSBAR_ATOM "_TQTCURVE_STATUSBAR_" +#define TITLEBAR_SIZE_ATOM "_TQTCURVE_TITLEBAR_SIZE_" +#define ACTIVE_WINDOW_ATOM "_TQTCURVE_ACTIVE_WINDOW_" +#define TOGGLE_MENUBAR_ATOM "_TQTCURVE_TOGGLE_MENUBAR_" +#define TOGGLE_STATUSBAR_ATOM "_TQTCURVE_TOGGLE_STATUSBAR_" +#define OPACITY_ATOM "_TQTCURVE_OPACITY_" +#define BGND_ATOM "_TQTCURVE_BGND_" #define BLEND_TITLEBAR (opts.menubarAppearance==opts.titlebarAppearance && opts.menubarAppearance==opts.inactiveTitlebarAppearance && \ !(opts.windowBorder&WINDOW_BORDER_BLEND_TITLEBAR) && SHADE_WINDOW_BORDER==opts.shadeMenubars && opts.windowDrag) @@ -372,19 +372,19 @@ enum #define FULLLY_ROUNDED (opts.round>=ROUND_FULL) #define DO_EFFECT (EFFECT_NONE!=opts.buttonEffect) -#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if !defined __cplusplus || ( (0x039999 >= 0x040000)) #define SLIDER_GLOW (DO_EFFECT && MO_GLOW==opts.coloredMouseOver /*&& SLIDER_TRIANGULAR!=opts.sliderStyle*/ ? 2 : 0) #endif #define ENTRY_MO (opts.unifyCombo && opts.unifySpin) -#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if !defined __cplusplus || ( (0x039999 >= 0x040000)) #define FOCUS_ALPHA 0.08 #define FOCUS_GLOW_LINE_ALPHA 0.5 #define BORDER_BLEND_ALPHA 0.7 #define ETCH_TOP_ALPHA 0.055 #define ETCH_BOTTOM_ALPHA 0.1 -// #if defined QT_VERSION && (QT_VERSION >= 0x040000) +// #if (0x039999 >= 0x040000) // #define ETCH_RADIO_TOP_ALPHA 0.055 // #define ETCH_RADIO_BOTTOM_ALPHA 0.80 // #else @@ -394,15 +394,15 @@ enum #define RINGS_INNER_ALPHA(T) qtcRingAlpha[IMG_PLAIN_RINGS==(T) ? 1 : 0] //(IMG_PLAIN_RINGS==opts.bgndImage.type ? 0.25 : 0.125) #define RINGS_OUTER_ALPHA qtcRingAlpha[2] //0.5 -#define RINGS_WIDTH(T) (IMG_SQUARE_RINGS==T ? 260 : 450) -#define RINGS_HEIGHT(T) (IMG_SQUARE_RINGS==T ? 220 : 360) +#define RINGS_WIDTH(T) (IMG_STQUARE_RINGS==T ? 260 : 450) +#define RINGS_HEIGHT(T) (IMG_STQUARE_RINGS==T ? 220 : 360) -#define RINGS_SQUARE_LARGE_ALPHA (RINGS_OUTER_ALPHA*0.675) -#define RINGS_SQUARE_SMALL_ALPHA (RINGS_OUTER_ALPHA*0.50) -#define RINGS_SQUARE_LINE_WIDTH 20.0 -#define RINGS_SQUARE_RADIUS 18.0 -#define RINGS_SQUARE_LARGE_SIZE 120.0 -#define RINGS_SQUARE_SMALL_SIZE 100.0 +#define RINGS_STQUARE_LARGE_ALPHA (RINGS_OUTER_ALPHA*0.675) +#define RINGS_STQUARE_SMALL_ALPHA (RINGS_OUTER_ALPHA*0.50) +#define RINGS_STQUARE_LINE_WIDTH 20.0 +#define RINGS_STQUARE_RADIUS 18.0 +#define RINGS_STQUARE_LARGE_SIZE 120.0 +#define RINGS_STQUARE_SMALL_SIZE 100.0 #if !defined __cplusplus #define MENU_AND_TOOLTIP_RADIUS (opts.round>=ROUND_FULL ? 5.0 : 3.5) @@ -416,48 +416,48 @@ enum #endif -#if defined __cplusplus && defined QT_VERSION && (QT_VERSION >= 0x040000) +#if defined __cplusplus && (0x039999 >= 0x040000) -#include +#include typedef enum { - QtC_Round = QStyle::PM_CustomBase, - QtC_TitleBarButtonAppearance, - QtC_TitleAlignment, - QtC_TitleBarButtons, - QtC_TitleBarIcon, - QtC_TitleBarIconColor, - QtC_TitleBarEffect, - QtC_BlendMenuAndTitleBar, - QtC_ShadeMenubarOnlyWhenActive, - QtC_ToggleButtons, - QtC_MenubarColor, - QtC_WindowBorder, - QtC_CustomBgnd, - QtC_TitleBarApp -} QtCMetrics; - -#define QtC_StateKWin ((QStyle::StateFlag)0x10000000) + TQtC_Round = TQStyle::PM_CustomBase, + TQtC_TitleBarButtonAppearance, + TQtC_TitleAlignment, + TQtC_TitleBarButtons, + TQtC_TitleBarIcon, + TQtC_TitleBarIconColor, + TQtC_TitleBarEffect, + TQtC_BlendMenuAndTitleBar, + TQtC_ShadeMenubarOnlyWhenActive, + TQtC_ToggleButtons, + TQtC_MenubarColor, + TQtC_WindowBorder, + TQtC_CustomBgnd, + TQtC_TitleBarApp +} TQtCMetrics; + +#define TQtC_StateKWin ((TQStyle::StateFlag)0x10000000) // PE_FrameWindow -#define QtC_StateKWinNotFull ((QStyle::StateFlag)0x20000000) +#define TQtC_StateKWinNotFull ((TQStyle::StateFlag)0x20000000) // CC_TitleBar -#define QtC_StateKWinFillBgnd ((QStyle::StateFlag)0x20000000) -#define QtC_StateKWinNoBorder ((QStyle::StateFlag)0x40000000) -#define QtC_StateKWinCompositing ((QStyle::StateFlag)0x80000000) -#define QtC_StateKWinTabDrag ((QStyle::StateFlag)0x00000001) +#define TQtC_StateKWinFillBgnd ((TQStyle::StateFlag)0x20000000) +#define TQtC_StateKWinNoBorder ((TQStyle::StateFlag)0x40000000) +#define TQtC_StateKWinCompositing ((TQStyle::StateFlag)0x80000000) +#define TQtC_StateKWinTabDrag ((TQStyle::StateFlag)0x00000001) -#define QtC_PE_DrawBackground ((QStyle::PrimitiveElement)(QStyle::PE_CustomBase+10000)) +#define TQtC_PE_DrawBackground ((TQStyle::PrimitiveElement)(TQStyle::PE_CustomBase+10000)) -#define CLOSE_COLOR QColor(191, 82, 82) +#define CLOSE_COLOR TQColor(191, 82, 82) #define DARK_WINDOW_TEXT(A) ((A).red()<230 || (A).green()<230 || (A).blue()<230) #define HOVER_BUTTON_ALPHA(A) (DARK_WINDOW_TEXT(A) ? 0.25 : 0.65) #define WINDOW_TEXT_SHADOW_ALPHA(A) (EFFECT_SHADOW==(A) ? 0.10 : 0.60) -#define WINDOW_SHADOW_COLOR(A) (EFFECT_SHADOW==(A) ? Qt::black : Qt::white) +#define WINDOW_SHADOW_COLOR(A) (EFFECT_SHADOW==(A) ? TQt::black : TQt::white) #endif -#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) -#define QTCURVE_PREVIEW_CONFIG "QTCURVE_PREVIEW_CONFIG" -#define QTCURVE_PREVIEW_CONFIG_FULL "QTCURVE_PREVIEW_CONFIG_FULL" +#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) +#define TQTCURVE_PREVIEW_CONFIG "TQTCURVE_PREVIEW_CONFIG" +#define TQTCURVE_PREVIEW_CONFIG_FULL "TQTCURVE_PREVIEW_CONFIG_FULL" typedef enum { @@ -512,7 +512,7 @@ typedef enum #define TBAR_VERSION_HACK 65535 #define TBAR_BORDER_VERSION_HACK (TBAR_VERSION_HACK+1000) -typedef std::map TBCols; +typedef std::map TBCols; #endif typedef enum @@ -529,7 +529,7 @@ typedef enum IMG_NONE, IMG_BORDERED_RINGS, IMG_PLAIN_RINGS, - IMG_SQUARE_RINGS, + IMG_STQUARE_RINGS, IMG_FILE } EImageType; @@ -538,29 +538,29 @@ typedef struct EImageType type; bool loaded; #if defined __cplusplus - QString file; - QPixmap pix; + TQString file; + TQPixmap pix; #else // __cplusplus const char *file; GdkPixbuf *pix; #endif // __cplusplus int width, height; -} QtCImage; +} TQtCImage; typedef enum { - SQUARE_NONE = 0x0000, - SQUARE_ENTRY = 0x0001, - SQUARE_PROGRESS = 0x0002, - SQUARE_SCROLLVIEW = 0x0004, - SQUARE_LISTVIEW_SELECTION = 0x0008, - SQUARE_FRAME = 0x0010, - SQUARE_TAB_FRAME = 0x0020, - SQUARE_SLIDER = 0x0040, - SQUARE_SB_SLIDER = 0x0080, - SQUARE_WINDOWS = 0x0100, - SQUARE_TOOLTIPS = 0x0200, - SQUARE_POPUP_MENUS = 0x0400 + STQUARE_NONE = 0x0000, + STQUARE_ENTRY = 0x0001, + STQUARE_PROGRESS = 0x0002, + STQUARE_SCROLLVIEW = 0x0004, + STQUARE_LISTVIEW_SELECTION = 0x0008, + STQUARE_FRAME = 0x0010, + STQUARE_TAB_FRAME = 0x0020, + STQUARE_SLIDER = 0x0040, + STQUARE_SB_SLIDER = 0x0080, + STQUARE_WINDOWS = 0x0100, + STQUARE_TOOLTIPS = 0x0200, + STQUARE_POPUP_MENUS = 0x0400 } ESquare; typedef enum @@ -582,7 +582,7 @@ typedef enum { PIX_CHECK, #ifdef __cplusplus -#if defined QT_VERSION && (QT_VERSION < 0x040000) +#if (0x039999 < 0x040000) PIX_RADIO_ON, PIX_RADIO_BORDER, PIX_RADIO_INNER, @@ -627,10 +627,10 @@ typedef enum WIDGET_SPIN_DOWN, WIDGET_UNCOLOURED_MO_BUTTON, #else - WIDGET_CHECKBUTTON, // Qt4 only - WIDGET_MDI_WINDOW, // Qt4 only - WIDGET_MDI_WINDOW_TITLE, // Qt4 only - WIDGET_MDI_WINDOW_BUTTON, // Qt4 only + WIDGET_CHECKBUTTON, // TQt4 only + WIDGET_MDI_WINDOW, // TQt4 only + WIDGET_MDI_WINDOW_TITLE, // TQt4 only + WIDGET_MDI_WINDOW_BUTTON, // TQt4 only WIDGET_DOCK_WIDGET_TITLE, WIDGET_DIAL, #endif @@ -640,7 +640,7 @@ typedef enum WIDGET_SELECTION, WIDGET_FRAME, WIDGET_NO_ETCH_BTN, - WIDGET_MENU_BUTTON, // Qt4 only + WIDGET_MENU_BUTTON, // TQt4 only WIDGET_FOCUS, WIDGET_TAB_FRAME, WIDGET_OTHER @@ -1045,7 +1045,7 @@ typedef struct highlightTab, roundAllTabs, animatedProgress, -#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT +#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT fixParentlessDialogs, #endif customMenuTextColor, @@ -1069,7 +1069,7 @@ typedef struct */ #endif mapKdeIcons, -#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus +#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) || !defined __cplusplus gtkButtonOrder, fadeLines, #endif @@ -1099,10 +1099,10 @@ typedef struct borderInactiveTab, doubleGtkComboArrow, menuIcons, -#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) stdBtnSizes, #endif -#if defined QT_VERSION && (QT_VERSION >= 0x040000) +#if (0x039999 >= 0x040000) xbar, #endif forceAlternateLvCols, @@ -1125,10 +1125,10 @@ typedef struct bgndOpacity, menuBgndOpacity, dlgOpacity; -#if defined QT_VERSION && (QT_VERSION >= 0x040000) +#if (0x039999 >= 0x040000) int dwtSettings; #endif -#if defined CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) int titlebarButtons; TBCols titlebarButtonColors; ETitleBarIcon titlebarIcon; @@ -1204,23 +1204,23 @@ typedef struct #else Gradient *customGradient[NUM_CUSTOM_GRAD]; #endif - QtCImage bgndImage, + TQtCImage bgndImage, menuBgndImage; -#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if !defined __cplusplus || ( (0x039999 >= 0x040000)) /* NOTE: If add any more settings here, need to alter copyOpts/freeOpts/defaultSettings in config_file.c */ Strings noBgndGradientApps, noBgndOpacityApps, noMenuBgndOpacityApps, noBgndImageApps; #endif -#ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT +#ifdef TQTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT Strings noDlgFixApps; #endif Strings noMenuStripeApps; -#if defined QT_VERSION && (QT_VERSION >= 0x040000) +#if (0x039999 >= 0x040000) Strings menubarApps, statusbarApps, - useQtFileDialogApps, + useTQtFileDialogApps, windowDragWhiteList, windowDragBlackList; #endif @@ -1416,7 +1416,7 @@ inline int limit(double c) } #endif -#if defined QT_VERSION && (QT_VERSION >= 0x040000) && !defined QTC_QT_ONLY +#if (0x039999 >= 0x040000) && !defined TQTC_TQT_ONLY #include #define tint(COLA, COLB, FACTOR) KColorUtils::tint((COLA), (COLB), (FACTOR)) #define midColor(COLA, COLB) KColorUtils::mix((COLA), (COLB), 0.5) @@ -1528,7 +1528,7 @@ static void shade(const Options *opts, const color *ca, color *cb, double k) case SHADING_HCY: { #define HCY_FACTOR 0.15 - #if defined QT_VERSION && (QT_VERSION >= 0x040000) && !defined QTC_QT_ONLY + #if (0x039999 >= 0x040000) && !defined TQTC_TQT_ONLY if(k>1.0) *cb=KColorUtils::lighten(ca, (k*(1+HCY_FACTOR))-1.0, 1.0); else @@ -1546,7 +1546,7 @@ static void shade(const Options *opts, const color *ca, color *cb, double k) #endif } } -#if defined __cplusplus && defined QT_VERSION && (QT_VERSION >= 0x040000) +#if defined __cplusplus && (0x039999 >= 0x040000) cb->setAlpha(ca.alpha()); #endif #ifndef __cplusplus @@ -1581,7 +1581,7 @@ static void adjustPix(unsigned char *data, int numChannels, int w, int h, int st unsigned char source=data[offset+column+1]; #if defined __cplusplus -#if Q_BYTE_ORDER == Q_BIG_ENDIAN +#if TQ_BYTE_ORDER == TQ_BIG_ENDIAN /* ARGB */ data[offset+column+1] = checkBounds(r-source); data[offset+column+2] = checkBounds(g-source); @@ -1751,7 +1751,7 @@ static EAppearance widgetApp(EWidget w, const Options *opts) #define MIN_ROUND_MAX_HEIGHT 12 #define MIN_ROUND_MAX_WIDTH 24 -#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if !defined __cplusplus || ( (0x039999 >= 0x040000)) #if defined __cplusplus #define EXTRA_INNER_RADIUS 3.5 @@ -1761,7 +1761,7 @@ static EAppearance widgetApp(EWidget w, const Options *opts) #define FULL_OUTER_RADIUS 2.5 #define FULL_ETCH_RADIUS 3.5 -#if defined QT_VERSION && (QT_VERSION < 0x040600) +#if (0x039999 < 0x040600) #define SLIGHT_INNER_RADIUS 0.5 #define SLIGHT_OUTER_RADIUS 1.5 #define SLIGHT_ETCH_RADIUS 2.5 @@ -1819,14 +1819,14 @@ ERound getWidgetRound(const Options *opts, int w, int h, EWidget widget) { ERound r=opts->round; - if( ((WIDGET_PBAR_TROUGH==widget || WIDGET_PROGRESSBAR==widget) && (opts->square&SQUARE_PROGRESS)) || - (WIDGET_ENTRY==widget && (opts->square&SQUARE_ENTRY)) ) + if( ((WIDGET_PBAR_TROUGH==widget || WIDGET_PROGRESSBAR==widget) && (opts->square&STQUARE_PROGRESS)) || + (WIDGET_ENTRY==widget && (opts->square&STQUARE_ENTRY)) ) return ROUND_NONE; if((WIDGET_CHECKBOX==widget || WIDGET_FOCUS==widget) && ROUND_NONE!=r) r=ROUND_SLIGHT; -#if defined __cplusplus && (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if defined __cplusplus && ( (0x039999 >= 0x040000)) if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) || WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget) return ROUND_MAX; @@ -1836,7 +1836,7 @@ ERound getWidgetRound(const Options *opts, int w, int h, EWidget widget) return ROUND_MAX; #endif -#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if !defined __cplusplus || ( (0x039999 >= 0x040000)) if(WIDGET_SLIDER==widget && (SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle)) return ROUND_MAX; @@ -1870,11 +1870,11 @@ static double getRadius(const Options *opts, int w, int h, EWidget widget, ERadi if((WIDGET_CHECKBOX==widget || WIDGET_FOCUS==widget) && ROUND_NONE!=r) r=ROUND_SLIGHT; - if( ((WIDGET_PBAR_TROUGH==widget || WIDGET_PROGRESSBAR==widget) && (opts->square&SQUARE_PROGRESS)) || - (WIDGET_ENTRY==widget && (opts->square&SQUARE_ENTRY)) ) + if( ((WIDGET_PBAR_TROUGH==widget || WIDGET_PROGRESSBAR==widget) && (opts->square&STQUARE_PROGRESS)) || + (WIDGET_ENTRY==widget && (opts->square&STQUARE_ENTRY)) ) return 0.0; -#if defined __cplusplus && (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if defined __cplusplus && ( (0x039999 >= 0x040000)) if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) || WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget) return (w>h ? h : w)/2.0; @@ -1884,7 +1884,7 @@ static double getRadius(const Options *opts, int w, int h, EWidget widget, ERadi return (w>h ? h : w)/2.0; #endif -#if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000)) +#if !defined __cplusplus || ( (0x039999 >= 0x040000)) if(WIDGET_SLIDER==widget && (SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle)) return (w>h ? h : w)/2.0; -- cgit v1.2.1