Eneboo - Documentación para desarrolladores
src/plugins/styles/qtcurve/common.h
Ir a la documentación de este archivo.
00001 #ifndef __COMMON_H__
00002 #define __COMMON_H__
00003 
00004 /*
00005   QtCurve (C) Craig Drummond, 2003 - 2010 craig.p.drummond@gmail.com
00006 
00007   ----
00008 
00009   This program is free software; you can redistr ibute it and/or
00010   modify it under the terms of the GNU General Public
00011   License version 2 as published by the Free Software Foundation.
00012 
00013   This program is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016   General Public License for more details.
00017 
00018   You should have received a copy of the GNU General Public License
00019   along with this program; see the file COPYING.  If not, write to
00020   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021   Boston, MA 02110-1301, USA.
00022 */
00023 
00024 #include "config.h"
00025 
00026 #define MAKE_VERSION(a, b) (((a) << 16) | ((b) << 8))
00027 #define MAKE_VERSION3(a, b, c) (((a) << 16) | ((b) << 8) | (c))
00028 
00029 /*
00030     The following #define disables the rounding when scrollbar type==none.
00031 #define SIMPLE_SCROLLBARS
00032 */
00033 
00034 /*
00035     The following #define controls whether a scrollbar's slider should overlap
00036     the scrollbar buttons when at min/max. This removes the thick looking line
00037     between the slider and the buttons.
00038 */
00039 #define INCREASE_SB_SLIDER
00040 
00041 typedef enum
00042 {
00043     SHADING_SIMPLE=0,
00044     SHADING_HSL=1,
00045     SHADING_HSV=2,
00046     SHADING_HCY=3
00047 } EShading;
00048 
00049 #ifdef __cplusplus
00050 #include <qconfig.h>
00051 #include <qapplication.h>
00052 #include <map>
00053 #include <set>
00054 #if defined QT_VERSION && (QT_VERSION >= 0x040000)
00055 #include <QtCore/QString>
00056 #endif // defined QT_VERSION && (QT_VERSION >= 0x040000)
00057 #else // __cplusplus
00058 #include <glib.h>
00059 #endif // __cplusplus
00060 
00061 #ifdef __cplusplus
00062 #define IS_BLACK(A) (0==(A).red() && 0==(A).green() && 0==(A).blue())
00063 #else
00064 #define IS_BLACK(A) (0==(A).red && 0==(A).green && 0==(A).blue)
00065 #endif
00066 
00067 #ifdef __cplusplus
00068 #include <qpixmap.h>
00069 class QColor;
00070 typedef QColor color;
00071 
00072 #if defined QT_VERSION && (QT_VERSION >= 0x040000)
00073 #include <QtCore/QSet>
00074 typedef QSet<QString> Strings;
00075 #else // QT_VERSION && (QT_VERSION >= 0x040000)
00076 typedef QStringList Strings;
00077 #endif // QT_VERSION && (QT_VERSION >= 0x040000)
00078 
00079 #else // __cplusplus
00080 #include <gtk/gtk.h>
00081 #include <gdk/gdk.h>
00082 typedef gboolean bool;
00083 typedef GdkColor color;
00084 typedef gchar ** Strings;
00085 #define true TRUE
00086 #define false FALSE
00087 #endif // __cplusplus
00088 
00089 #define SETTINGS_GROUP        "Settings"
00090 #define KWIN_GROUP            "KWin"
00091 
00092 /* qtc_<theme name>.themerc support */
00093 #define KDE_PREFIX(V) ((4==(V)) ? KDE4PREFIX : KDE3PREFIX)
00094 #define THEME_DIR    "/share/apps/kstyle/themes/"
00095 #define THEME_DIR4   "/share/kde4/apps/kstyle/themes/"
00096 #define THEME_PREFIX "qtc_"
00097 #define THEME_SUFFIX ".themerc"
00098 #define BORDER_SIZE_FILE "windowBorderSizes"
00099 
00100 #define LV_SIZE      7
00101 
00102 #define LARGE_ARR_WIDTH  7
00103 #define LARGE_ARR_HEIGHT 4
00104 #define SMALL_ARR_WIDTH  5
00105 #define SMALL_ARR_HEIGHT 3
00106 
00107 #define NUM_STD_SHADES   6
00108 #define NUM_EXTRA_SHADES 3
00109 
00110 enum
00111 {
00112     ALPHA_ETCH_LIGHT = 0,
00113     ALPHA_ETCH_DARK,
00114     NUM_STD_ALPHAS
00115 };
00116 
00117 #define TOTAL_SHADES     NUM_STD_SHADES+NUM_EXTRA_SHADES
00118 #define ORIGINAL_SHADE   TOTAL_SHADES
00119 
00120 #define SHADE_ORIG_HIGHLIGHT NUM_STD_SHADES
00121 #define SHADE_4_HIGHLIGHT    NUM_STD_SHADES+1
00122 #define SHADE_2_HIGHLIGHT    NUM_STD_SHADES+2
00123 
00124 /* 3d effect - i.e. buttons, etc */
00125 #define SHADES \
00126     static const double shades[2][11][NUM_STD_SHADES]=\
00127     { \
00128         { /* HSV & HSL */ \
00129             { 1.05, 1.04, 0.90, 0.800, 0.830, 0.82 }, \
00130             { 1.06, 1.04, 0.90, 0.790, 0.831, 0.78 }, \
00131             { 1.07, 1.04, 0.90, 0.785, 0.832, 0.75 }, \
00132             { 1.08, 1.05, 0.90, 0.782, 0.833, 0.72 }, \
00133             { 1.09, 1.05, 0.90, 0.782, 0.834, 0.70 }, \
00134             { 1.10, 1.06, 0.90, 0.782, 0.836, 0.68 }, \
00135             { 1.12, 1.06, 0.90, 0.782, 0.838, 0.63 }, \
00136             { 1.16, 1.07, 0.90, 0.782, 0.840, 0.62 }, /* default */ \
00137             { 1.18, 1.07, 0.90, 0.783, 0.842, 0.60 }, \
00138             { 1.20, 1.08, 0.90, 0.784, 0.844, 0.58 }, \
00139             { 1.22, 1.08, 0.90, 0.786, 0.848, 0.55 }  \
00140         }, \
00141         { /* SIMPLE */ \
00142             { 1.07, 1.03, 0.91, 0.780, 0.834, 0.75 }, \
00143             { 1.08, 1.03, 0.91, 0.781, 0.835, 0.74 }, \
00144             { 1.09, 1.03, 0.91, 0.782, 0.836, 0.73 }, \
00145             { 1.10, 1.04, 0.91, 0.783, 0.837, 0.72 }, \
00146             { 1.11, 1.04, 0.91, 0.784, 0.838, 0.71 }, \
00147             { 1.12, 1.05, 0.91, 0.785, 0.840, 0.70 }, \
00148             { 1.13, 1.05, 0.91, 0.786, 0.842, 0.69 }, \
00149             { 1.14, 1.06, 0.91, 0.787, 0.844, 0.68 }, /* default */ \
00150             { 1.16, 1.06, 0.91, 0.788, 0.846, 0.66 }, \
00151             { 1.18, 1.07, 0.91, 0.789, 0.848, 0.64 }, \
00152             { 1.20, 1.07, 0.91, 0.790, 0.850, 0.62 }  \
00153         } \
00154     } ;
00155 
00156 #define SIMPLE_SHADING (!shading)
00157 #define DEFAULT_CONTRAST 7
00158 
00159 #define THIN_SBAR_MOD  ((opts.sliderWidth<DEFAULT_SLIDER_WIDTH ? 3 : opts.sliderWidth>DEFAULT_SLIDER_WIDTH ? (opts.sliderWidth-9)/2 : 4)+(EFFECT_NONE==opts.buttonEffect ? 1 : 0))
00160 #define SLIDER_SIZE (opts.sliderWidth<DEFAULT_SLIDER_WIDTH ? DEFAULT_SLIDER_WIDTH-2 : opts.sliderWidth)
00161 #define CIRCULAR_SLIDER_SIZE 15
00162 #define GLOW_MO           1 /*ORIGINAL_SHADE*/
00163 #define GLOW_DEFBTN       1
00164 #define GLOW_ALPHA(DEF)   ((DEF) ? 0.5 : 0.65)
00165 #define DEF_BNT_TINT      0.4
00166 #define ENTRY_INNER_ALPHA 0.4
00167 #define INACTIVE_SEL_ALPHA 0.5
00168 
00169 #define SUNKEN_BEVEL_DARK_ALPHA(X)  (X.value()/800.0) // 0.25
00170 #define SUNKEN_BEVEL_LIGHT_ALPHA(X) (X.value()/500.0) // 0.40
00171 
00172 #define MENU_SIZE_ATOM        "_QTCURVE_MENUBAR_SIZE_"
00173 #define STATUSBAR_ATOM        "_QTCURVE_STATUSBAR_"
00174 #define TITLEBAR_SIZE_ATOM    "_QTCURVE_TITLEBAR_SIZE_"
00175 #define ACTIVE_WINDOW_ATOM    "_QTCURVE_ACTIVE_WINDOW_"
00176 #define TOGGLE_MENUBAR_ATOM   "_QTCURVE_TOGGLE_MENUBAR_"
00177 #define TOGGLE_STATUSBAR_ATOM "_QTCURVE_TOGGLE_STATUSBAR_"
00178 #define OPACITY_ATOM          "_QTCURVE_OPACITY_"
00179 #define BGND_ATOM             "_QTCURVE_BGND_"
00180 #define BLEND_TITLEBAR     (opts.menubarAppearance==opts.titlebarAppearance && opts.menubarAppearance==opts.inactiveTitlebarAppearance && \
00181                            !(opts.windowBorder&WINDOW_BORDER_BLEND_TITLEBAR) && SHADE_WINDOW_BORDER==opts.shadeMenubars && opts.windowDrag)
00182 
00183 #define STD_BORDER         5
00184 #define STD_BORDER_BR      2
00185 #define PBAR_BORDER        4
00186 #define ARROW_MO_SHADE     4
00187 #define LOWER_BORDER_ALPHA 0.35
00188 #define DISABLED_BORDER STD_BORDER /*3*/
00189 #define BORDER_VAL(E) (/*(E) ?*/ STD_BORDER/* : DISABLED_BORDER*/)
00190 #define SLIDER_MO_BORDER_VAL 3
00191 
00192 #define FRAME_DARK_SHADOW 2
00193 #define FOCUS_SHADE(SEL)         (FOCUS_GLOW==opts.focus ? GLOW_MO : ((SEL) ? 3 : ORIGINAL_SHADE))
00194 #define MENU_STRIPE_SHADE (USE_LIGHTER_POPUP_MENU ? ORIGINAL_SHADE : 2)
00195 #define MENU_SEP_SHADE    (USE_LIGHTER_POPUP_MENU ? 4 : 3)
00196 
00197 #define BGND_STRIPE_SHADE 0.95
00198 
00199 #define SHADE(c, s) \
00200     (c>10 || c<0 || s>=NUM_STD_SHADES || s<0 \
00201         ? 1.0 \
00202         : opts.darkerBorders && (STD_BORDER==i || DISABLED_BORDER==i) \
00203             ? shades[SHADING_SIMPLE==opts.shading ? 1 : 0][c][s] - 0.1 \
00204             : shades[SHADING_SIMPLE==opts.shading ? 1 : 0][c][s] )
00205 
00206 #define TAB_APPEARANCE(A)   (A) /* (APPEARANCE_GLASS==(A) ? APPEARANCE_GRADIENT : (A)) */
00207 
00208 #define INVERT_SHADE(A) (1.0+(1.0-(A)))
00209 
00210 #define ROUNDED (ROUND_NONE!=opts.round)
00211 
00212 #define TOOLBAR_SEP_GAP        (opts.fadeLines ? 5 : 6)
00213 #define FADE_SIZE              0.4
00214 #define ETCHED_DARK            0.95
00215 
00216 #define IS_GLASS(A) (APPEARANCE_DULL_GLASS==(A) || APPEARANCE_SHINY_GLASS==(A))
00217 #define IS_CUSTOM(A) ((A)>=APPEARANCE_CUSTOM1 && (A)<(APPEARANCE_CUSTOM1+NUM_CUSTOM_GRAD))
00218 #define IS_FLAT(A)  (APPEARANCE_FLAT==(A) || APPEARANCE_RAISED==(A) || APPEARANCE_FADE==(A))
00219 #define IS_FLAT_BGND(A)  (APPEARANCE_FLAT==(A) || APPEARANCE_RAISED==(A))
00220 
00221 #ifdef __cplusplus
00222 #define MENUBAR_DARK_LIMIT 160
00223 #define TOO_DARK(A) ((A).red()<MENUBAR_DARK_LIMIT || (A).green()<MENUBAR_DARK_LIMIT || (A).blue()<MENUBAR_DARK_LIMIT)
00224 #else // __cplusplus
00225 #define MENUBAR_DARK_LIMIT (160<<8)
00226 #define TOO_DARK(A) ((A).red<MENUBAR_DARK_LIMIT || (A).green<MENUBAR_DARK_LIMIT || (A).blue<MENUBAR_DARK_LIMIT)
00227 #endif // __cplusplus
00228 
00229 #define TO_FACTOR(A) ((100.0+((double)(A)))/100.0)
00230 #define DEFAULT_HIGHLIGHT_FACTOR                   3
00231 #define DEFAULT_SPLITTER_HIGHLIGHT_FACTOR          3
00232 #define DEFAULT_CR_HIGHLIGHT_FACTOR                0
00233 #define DEFAULT_EXPANDER_HIGHLIGHT_FACTOR          3
00234 #define MAX_HIGHLIGHT_FACTOR                      50
00235 #define MIN_HIGHLIGHT_FACTOR                     -50
00236 #define MENUBAR_DARK_FACTOR        TO_FACTOR(-3)
00237 #define INACTIVE_HIGHLIGHT_FACTOR  TO_FACTOR(20)
00238 #define LV_HEADER_DARK_FACTOR      TO_FACTOR(-10)
00239 #define DEF_POPUPMENU_LIGHT_FACTOR                 2
00240 #define MIN_LIGHTER_POPUP_MENU                  -100
00241 #define MAX_LIGHTER_POPUP_MENU                   100
00242 
00243 #define MIN_GB_FACTOR -50
00244 #define MAX_GB_FACTOR  50
00245 #define DEF_GB_FACTOR  -3
00246 
00247 #define TO_ALPHA(A) (((double)((A)<0 ? -(A) : (A)))/100.0)
00248 #define DEF_COLOR_SEL_TAB_FACTOR  25
00249 #define MIN_COLOR_SEL_TAB_FACTOR   0
00250 #define MAX_COLOR_SEL_TAB_FACTOR 100
00251 
00252 #define DEF_TAB_BGND         0
00253 #define MIN_TAB_BGND        -5
00254 #define MAX_TAB_BGND         5
00255 
00256 #define DEFAULT_MENU_DELAY 225
00257 #define MIN_MENU_DELAY       0
00258 #define MAX_MENU_DELAY     500
00259 
00260 #define DEFAULT_SLIDER_WIDTH 15
00261 #define MIN_SLIDER_WIDTH     11
00262 #define MAX_SLIDER_WIDTH     31
00263 
00264 #define SIZE_GRIP_SIZE 12
00265 
00266 #define USE_LIGHTER_POPUP_MENU (opts.lighterPopupMenuBgnd)
00267 #define USE_BORDER(B)          (GB_SHINE!=(B) && GB_NONE!=(B))
00268 #define DRAW_MENU_BORDER       (APPEARANCE_FLAT!=opts.menuBgndAppearance && opts.version>=MAKE_VERSION(1,7) && \
00269                                 USE_BORDER(qtcGetGradient(opts.menuBgndAppearance, &opts)->border))
00270 
00271 #define USE_GLOW_FOCUS(mouseOver) (FOCUS_GLOW==opts.focus && (MO_GLOW!=opts.coloredMouseOver || !(mouseOver)))
00272 
00273 #define USE_SHADED_MENU_BAR_COLORS (SHADE_CUSTOM==opts.shadeMenubars || SHADE_BLEND_SELECTED==opts.shadeMenubars)
00274 #define MENUBAR_GLASS_SELECTED_DARK_FACTOR 0.9
00275 
00276 #define MENUITEM_FADE_SIZE 48
00277 
00278 #define NUM_SPLITTER_DASHES 21
00279 
00280 #ifdef __cplusplus
00281 #define WIDGET_BUTTON(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || \
00282                           WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || WIDGET_DIAL==(w) || \
00283                           WIDGET_COMBO==(w) || WIDGET_COMBO_BUTTON==(w) || WIDGET_MDI_WINDOW_BUTTON==(w) || \
00284                           WIDGET_TOOLBAR_BUTTON==(w) )
00285 #define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || WIDGET_SLIDER_TROUGH==(w) || \
00286                         WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || WIDGET_DIAL==(w) || \
00287                         (WIDGET_SLIDER==(w) && MO_GLOW==opts.coloredMouseOver) || \
00288                         WIDGET_FILLED_SLIDER_TROUGH==(w) || WIDGET_MDI_WINDOW_BUTTON==(w) || WIDGET_TOOLBAR_BUTTON==(w))
00289 #define AGUA_WIDGET(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || IS_SLIDER((w)) || \
00290                         WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || \
00291                         WIDGET_COMBO==(w) WIDGET_COMBO_BUTTON==(w) || WIDGET_MDI_WINDOW_BUTTON==(w))
00292 #else // __cplusplus
00293 #define WIDGET_BUTTON(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || WIDGET_TOGGLE_BUTTON==(w) || \
00294                           WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || \
00295                           WIDGET_RADIO_BUTTON==(w) || WIDGET_COMBO==(w) || WIDGET_COMBO_BUTTON==(w) || WIDGET_UNCOLOURED_MO_BUTTON==(w) || \
00296                           WIDGET_TOOLBAR_BUTTON==(w))
00297 #define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || WIDGET_TOGGLE_BUTTON==(w) || WIDGET_SLIDER_TROUGH==(w) || \
00298                         WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || \
00299                         (WIDGET_SLIDER==(w) && MO_GLOW==opts.coloredMouseOver) || \
00300                         WIDGET_FILLED_SLIDER_TROUGH==(w) || WIDGET_COMBO==(w) || WIDGET_UNCOLOURED_MO_BUTTON==(w) || \
00301                         WIDGET_TOOLBAR_BUTTON==(w))
00302 #define AGUA_WIDGET(w) (WIDGET_STD_BUTTON==(w) || WIDGET_DEF_BUTTON==(w) || WIDGET_TOGGLE_BUTTON==(w) || IS_SLIDER((w)) || \
00303                         WIDGET_CHECKBOX==(w) || WIDGET_RADIO_BUTTON==(w) || \
00304                         WIDGET_COMBO==(w) WIDGET_COMBO_BUTTON==(w))
00305 #endif // __cplusplus
00306 
00307 #define SLIDER(w) (WIDGET_SB_SLIDER==(w) || WIDGET_SLIDER==(w))
00308 #define CIRCULAR_SLIDER(w) (WIDGET_SLIDER==(w) && SLIDER_CIRCULAR==opts.sliderStyle)
00309 
00310 #define MODIFY_AGUA_X(A, X) (APPEARANCE_AGUA==(A) ?  (X) : (A))
00311 #define MODIFY_AGUA(A)      MODIFY_AGUA_X((A), APPEARANCE_AGUA_MOD)
00312 #define AGUA_MAX 32.0
00313 #define AGUA_MID_SHADE 0.85
00314 
00315 #define COLORED_BORDER_SIZE 3
00316 #define PROGRESS_CHUNK_WIDTH 10
00317 #define STRIPE_WIDTH 10
00318 #define DRAW_LIGHT_BORDER(SUKEN, WIDGET, APP) \
00319     (!(SUKEN) && (GB_LIGHT==qtcGetGradient(APP, &opts)->border) && WIDGET_MENU_ITEM!=(WIDGET) && !IS_TROUGH(WIDGET) && \
00320                           (WIDGET_DEF_BUTTON!=(WIDGET) || IND_COLORED!=opts.defBtnIndicator))
00321 
00322 #define DRAW_3D_FULL_BORDER(SUNKEN, APP) \
00323     (!(SUNKEN) && GB_3D_FULL==qtcGetGradient((APP), &opts)->border)
00324     
00325 #define DRAW_3D_BORDER(SUNKEN, APP) \
00326     (!(SUNKEN) && GB_3D==qtcGetGradient((APP), &opts)->border)
00327 
00328 #define DRAW_SHINE(SUNKEN, APP) \
00329     (!(SUNKEN) && GB_SHINE==qtcGetGradient((APP), &opts)->border)
00330 
00331 #define LIGHT_BORDER(APP) (APPEARANCE_DULL_GLASS==(APP) ? 1 : 0)
00332 
00333 #define PROGRESS_ANIMATION 100
00334 #define MIN_SLIDER_SIZE(A) (LINE_DOTS==(A) ? 24 : 20)
00335 
00336 #define CR_SMALL_SIZE 13
00337 #define CR_LARGE_SIZE 15
00338 
00339 #define TAB_APP(A)   (APPEARANCE_BEVELLED==(A) || APPEARANCE_SPLIT_GRADIENT==(A) ? APPEARANCE_GRADIENT : (A))
00340 #define NORM_TAB_APP TAB_APP(opts.tabAppearance)
00341 #define SEL_TAB_APP  TAB_APP(opts.activeTabAppearance)
00342 
00343 #define SLIDER_MO_SHADE  (SHADE_SELECTED==opts.shadeSliders ? 1 : (SHADE_BLEND_SELECTED==opts.shadeSliders ? 0 : ORIGINAL_SHADE))
00344 #define SLIDER_MO_PLASTIK_BORDER (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 2 : 1)
00345 #define SLIDER_MO_LEN    (SLIDER_TRIANGULAR==opts.sliderStyle ? 2 : (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 4 : 3))
00346 #define SB_SLIDER_MO_LEN(A) ((A)<22 && !FULLLY_ROUNDED \
00347                                     ? 2 \
00348                                     : ((A)<32 || (SHADE_SELECTED!=opts.shadeSliders && SHADE_BLEND_SELECTED!=opts.shadeSliders) \
00349                                         ? 4 \
00350                                         : 6))
00351 
00352 #define CR_MO_FILL          1
00353 #define MO_DEF_BTN          2
00354 #define MO_PLASTIK_DARK(W)  (WIDGET_DEF_BUTTON==(W) && IND_COLORED==opts.defBtnIndicator ? 3 : 2) /*? 2 : 1) */
00355 #define MO_PLASTIK_LIGHT(W) (WIDGET_DEF_BUTTON==(W) && IND_COLORED==opts.defBtnIndicator ? 4 : 1) /*? 2 : 0) */
00356 
00357 #define MO_STD_DARK(W)     (MO_GLOW==opts.coloredMouseOver \
00358                                     ? 1 \
00359                                     : MO_PLASTIK_DARK(W))
00360 #define MO_STD_LIGHT(W, S) (MO_GLOW==opts.coloredMouseOver \
00361                                     ? 1 \
00362                                     : MO_PLASTIK_LIGHT(W))
00363 
00364 #define FULLLY_ROUNDED     (opts.round>=ROUND_FULL)
00365 #define DO_EFFECT          (EFFECT_NONE!=opts.buttonEffect)
00366 #if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
00367 #define SLIDER_GLOW        (DO_EFFECT && MO_GLOW==opts.coloredMouseOver /*&& SLIDER_TRIANGULAR!=opts.sliderStyle*/ ? 2 : 0)
00368 #endif
00369 
00370 #define ENTRY_MO (opts.unifyCombo && opts.unifySpin)
00371 
00372 #if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
00373 #define FOCUS_ALPHA              0.08
00374 #define FOCUS_GLOW_LINE_ALPHA    0.5
00375 #if !defined __cplusplus
00376 #define BORDER_BLEND_ALPHA(W)    (WIDGET_ENTRY==(W) || WIDGET_SCROLLVIEW==(W) || WIDGET_SPIN==(W) || WIDGET_COMBO_BUTTON==(W) ? 0.4 : 0.7)
00377 #else // !defined __cplusplus
00378 #define BORDER_BLEND_ALPHA(W)    (WIDGET_ENTRY==(W) || WIDGET_SCROLLVIEW==(W) ? 0.45 : 0.7)
00379 #endif // !defined __cplusplus
00380  
00381 #define ETCH_TOP_ALPHA           0.055
00382 #define ETCH_BOTTOM_ALPHA        0.1
00383 // #if defined QT_VERSION && (QT_VERSION >= 0x040000)
00384 // #define ETCH_RADIO_TOP_ALPHA     0.055
00385 // #define ETCH_RADIO_BOTTOM_ALPHA  0.80
00386 // #else
00387 #define ETCH_RADIO_TOP_ALPHA     0.09
00388 #define ETCH_RADIO_BOTTOM_ALPHA  1.0
00389 // #endif
00390 
00391 #define RINGS_INNER_ALPHA(T) qtcRingAlpha[IMG_PLAIN_RINGS==(T) ? 1 : 0] //(IMG_PLAIN_RINGS==opts.bgndImage.type ? 0.25 :  0.125)
00392 #define RINGS_OUTER_ALPHA    qtcRingAlpha[2] //0.5
00393 #define RINGS_WIDTH(T)       (IMG_SQUARE_RINGS==T ? 260 : 450)
00394 #define RINGS_HEIGHT(T)      (IMG_SQUARE_RINGS==T ? 220 : 360)
00395 
00396 #define RINGS_SQUARE_LARGE_ALPHA (RINGS_OUTER_ALPHA*0.675)
00397 #define RINGS_SQUARE_SMALL_ALPHA (RINGS_OUTER_ALPHA*0.50)
00398 #define RINGS_SQUARE_LINE_WIDTH  20.0
00399 #define RINGS_SQUARE_RADIUS      18.0
00400 #define RINGS_SQUARE_LARGE_SIZE  120.0
00401 #define RINGS_SQUARE_SMALL_SIZE  100.0
00402 
00403 #if !defined __cplusplus
00404 #define MENU_AND_TOOLTIP_RADIUS   (opts.round>=ROUND_FULL ? 5.0 : 3.5)
00405 #else // !defined __cplusplus
00406 #define MENU_AND_TOOLTIP_RADIUS   (opts.round>=ROUND_FULL ? 5.0 : 2.5)
00407 #endif // !defined __cplusplus
00408 
00409 #define CUSTOM_BGND (!(IS_FLAT_BGND(opts.bgndAppearance)) || IMG_NONE!=opts.bgndImage.type || 100!=opts.bgndOpacity || 100!=opts.dlgOpacity)
00410 
00411 #define GLOW_PROG_ALPHA 0.55
00412 
00413 #endif // !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
00414 
00415 #if defined __cplusplus && defined QT_VERSION && (QT_VERSION >= 0x040000)
00416 
00417 #include <qstyle.h>
00418 typedef enum
00419 {
00420     QtC_Round = QStyle::PM_CustomBase,
00421     QtC_TitleBarButtonAppearance,
00422     QtC_TitleAlignment,
00423     QtC_TitleBarButtons,
00424     QtC_TitleBarIcon,
00425     QtC_TitleBarIconColor,
00426     QtC_TitleBarEffect,
00427     QtC_BlendMenuAndTitleBar,
00428     QtC_ShadeMenubarOnlyWhenActive,
00429     QtC_ToggleButtons,
00430     QtC_MenubarColor,
00431     QtC_WindowBorder,
00432     QtC_CustomBgnd,
00433     QtC_TitleBarApp
00434 } QtCMetrics;
00435 
00436 #define QtC_StateKWin            ((QStyle::StateFlag)0x10000000)
00437 // PE_FrameWindow
00438 #define QtC_StateKWinNotFull     ((QStyle::StateFlag)0x20000000)
00439 // CC_TitleBar
00440 #define QtC_StateKWinFillBgnd    ((QStyle::StateFlag)0x20000000)
00441 #define QtC_StateKWinNoBorder    ((QStyle::StateFlag)0x40000000)
00442 #define QtC_StateKWinCompositing ((QStyle::StateFlag)0x80000000)
00443 #define QtC_StateKWinTabDrag     ((QStyle::StateFlag)0x00000001)
00444 
00445 #define QtC_PE_DrawBackground    ((QStyle::PrimitiveElement)(QStyle::PE_CustomBase+10000))
00446 
00447 #define CLOSE_COLOR              QColor(191, 82, 82)
00448 #define DARK_WINDOW_TEXT(A)  ((A).red()<230 || (A).green()<230 || (A).blue()<230)
00449 #define HOVER_BUTTON_ALPHA(A)    (DARK_WINDOW_TEXT(A) ? 0.25 : 0.65)
00450 #define WINDOW_TEXT_SHADOW_ALPHA(A) (EFFECT_SHADOW==(A) ? 0.10 : 0.60)
00451 #define WINDOW_SHADOW_COLOR(A)      (EFFECT_SHADOW==(A) ? Qt::black : Qt::white)
00452 
00453 #endif //defined __cplusplus && defined QT_VERSION && (QT_VERSION >= 0x040000)
00454 
00455 #if defined QT_VERSION && (QT_VERSION >= 0x040000)
00456 #define QTCURVE_PREVIEW_CONFIG      "QTCURVE_PREVIEW_CONFIG"
00457 #define QTCURVE_PREVIEW_CONFIG_FULL "QTCURVE_PREVIEW_CONFIG_FULL"
00458 
00459 typedef enum
00460 {
00461     DWT_BUTTONS_AS_PER_TITLEBAR    = 0x0001,
00462     DWT_COLOR_AS_PER_TITLEBAR      = 0x0002,
00463     DWT_FONT_AS_PER_TITLEBAR       = 0x0004,
00464     DWT_TEXT_ALIGN_AS_PER_TITLEBAR = 0x0008,
00465     DWT_EFFECT_AS_PER_TITLEBAR     = 0x0010,
00466     DWT_ROUND_TOP_ONLY             = 0x0020,
00467     DWT_ICON_COLOR_AS_PER_TITLEBAR = 0x0040
00468 } EDwtSettingsFlags;
00469 
00470 typedef enum
00471 {
00472     TITLEBAR_BUTTON_ROUND                   = 0x0001,
00473     TITLEBAR_BUTTON_HOVER_FRAME             = 0x0002,
00474     TITLEBAR_BUTTON_HOVER_SYMBOL            = 0x0004,
00475     TITLEBAR_BUTTON_NO_FRAME                = 0x0008,
00476     TITLEBAR_BUTTON_COLOR                   = 0x0010,
00477     TITLEBAR_BUTTON_COLOR_INACTIVE          = 0x0020,
00478     TITLEBAR_BUTTON_COLOR_MOUSE_OVER        = 0x0040,
00479     TITLEBAR_BUTTON_STD_COLOR               = 0x0080,
00480     TITLEBAR_BUTTON_COLOR_SYMBOL            = 0x0100,
00481     TITLEBAR_BUTTON_HOVER_SYMBOL_FULL       = 0x0200,
00482     TITLEBAR_BUTTON_SUNKEN_BACKGROUND       = 0x0400,
00483     TITLEBAR_BUTTOM_ARROW_MIN_MAX           = 0x0800,
00484     TITLEBAR_BUTTOM_HIDE_ON_INACTIVE_WINDOW = 0x1000,
00485     TITLEBAR_BUTTON_ICON_COLOR              = 0x2000,
00486     TITLEBAR_BUTTON_USE_HOVER_COLOR         = 0x4000
00487 } ETitleBarButtonFlags;
00488 
00489 typedef enum
00490 {
00491     TITLEBAR_ICON_NONE,
00492     TITLEBAR_ICON_MENU_BUTTON,
00493     TITLEBAR_ICON_NEXT_TO_TITLE
00494 } ETitleBarIcon;
00495 
00496 typedef enum
00497 {
00498     TITLEBAR_CLOSE,
00499     TITLEBAR_MIN,
00500     TITLEBAR_MAX,
00501     TITLEBAR_HELP,
00502     TITLEBAR_MENU,
00503     TITLEBAR_SHADE,
00504     TITLEBAR_ALL_DESKTOPS,
00505     TITLEBAR_KEEP_ABOVE,
00506     TITLEBAR_KEEP_BELOW,
00507     NUM_TITLEBAR_BUTTONS
00508 } ETitleBarButtons;
00509 
00510 #define TBAR_VERSION_HACK        65535
00511 #define TBAR_BORDER_VERSION_HACK (TBAR_VERSION_HACK+1000)
00512 
00513 typedef std::map<int, QColor> TBCols;
00514 #endif // defined QT_VERSION && (QT_VERSION >= 0x040000)
00515 
00516 typedef enum
00517 {
00518     WINDOW_BORDER_COLOR_TITLEBAR_ONLY            = 0x01, // colorTitlebarOnly
00519     WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR = 0x02, // titlebarMenuColor
00520     WINDOW_BORDER_ADD_LIGHT_BORDER               = 0x04, // titlebarBorder
00521     WINDOW_BORDER_BLEND_TITLEBAR                 = 0x08, // titlebarBlend
00522     WINDOW_BORDER_SEPARATOR                      = 0x10,
00523     WINDOW_BORDER_FILL_TITLEBAR                  = 0x20
00524 } EWindowBorder;
00525 
00526 typedef enum
00527 {
00528     IMG_NONE,
00529     IMG_BORDERED_RINGS,
00530     IMG_PLAIN_RINGS,
00531     IMG_SQUARE_RINGS,
00532     IMG_FILE
00533 } EImageType;
00534 
00535 typedef struct
00536 {
00537 #if defined __cplusplus
00538     QString   file;
00539     QPixmap   img;
00540 #else // __cplusplus
00541     const char *file;
00542     GdkPixbuf *img;
00543 #endif // __cplusplus
00544 } QtCPixmap;
00545 
00546 #define BGND_IMG_ON_BORDER (IMG_FILE==opts.bgndImage.type && opts.bgndImage.onBorder)
00547 
00548 typedef enum
00549 {
00550     PP_TL,
00551     PP_TM,
00552     PP_TR,
00553     PP_BL,
00554     PP_BM,
00555     PP_BR,
00556     PP_LM,
00557     PP_RM,
00558     PP_CENTRED,
00559 } EPixPos;
00560 
00561 typedef struct
00562 {
00563     EImageType type;
00564     bool       loaded,
00565                onBorder;
00566     QtCPixmap  pixmap;
00567     int        width,
00568                height;
00569     EPixPos    pos;
00570 } QtCImage;
00571 
00572 typedef enum
00573 {
00574     THIN_BUTTONS    = 0x0001,
00575     THIN_MENU_ITEMS = 0x0002,
00576     THIN_FRAMES     = 0x0004
00577 } EThinFlags;
00578 
00579 typedef enum
00580 {
00581     SQUARE_NONE               = 0x0000,
00582     SQUARE_ENTRY              = 0x0001,
00583     SQUARE_PROGRESS           = 0x0002,
00584     SQUARE_SCROLLVIEW         = 0x0004,
00585     SQUARE_LISTVIEW_SELECTION = 0x0008,
00586     SQUARE_FRAME              = 0x0010,
00587     SQUARE_TAB_FRAME          = 0x0020,
00588     SQUARE_SLIDER             = 0x0040,
00589     SQUARE_SB_SLIDER          = 0x0080,
00590     SQUARE_WINDOWS            = 0x0100,
00591     SQUARE_TOOLTIPS           = 0x0200,
00592     SQUARE_POPUP_MENUS        = 0x0400,
00593 
00594     SQUARE_ALL                = 0xFFFF
00595 } ESquare;
00596 
00597 typedef enum
00598 {
00599     WM_DRAG_NONE             = 0,
00600     WM_DRAG_MENUBAR          = 1,
00601     WM_DRAG_MENU_AND_TOOLBAR = 2,
00602     WM_DRAG_ALL              = 3
00603 } EWmDrag;
00604 
00605 typedef enum
00606 {
00607     EFFECT_NONE,
00608     EFFECT_ETCH,
00609     EFFECT_SHADOW
00610 } EEffect;
00611 
00612 typedef enum
00613 {
00614     PIX_CHECK,
00615 #ifdef __cplusplus
00616 #if defined QT_VERSION && (QT_VERSION < 0x040000)
00617     PIX_RADIO_ON,
00618     PIX_RADIO_BORDER,
00619     PIX_RADIO_INNER,
00620     PIX_RADIO_LIGHT,
00621     PIX_SLIDER,
00622     PIX_SLIDER_LIGHT,
00623     PIX_SLIDER_V,
00624     PIX_SLIDER_LIGHT_V,
00625 #endif // defined QT_VERSION && (QT_VERSION < 0x040000)
00626     PIX_DOT
00627 #else // __cplusplus
00628     PIX_BLANK
00629 #endif // __cplusplus
00630 } EPixmap;
00631 
00632 typedef enum
00633 {
00634     WIDGET_TAB_TOP,
00635     WIDGET_TAB_BOT,
00636     WIDGET_STD_BUTTON,
00637     WIDGET_DEF_BUTTON,
00638     WIDGET_TOOLBAR_BUTTON,
00639     WIDGET_LISTVIEW_HEADER,
00640     WIDGET_SLIDER,
00641     WIDGET_SLIDER_TROUGH,
00642     WIDGET_FILLED_SLIDER_TROUGH,
00643     WIDGET_SB_SLIDER,
00644     WIDGET_SB_BUTTON,
00645     WIDGET_SB_BGND,
00646     WIDGET_TROUGH,
00647     WIDGET_CHECKBOX,
00648     WIDGET_RADIO_BUTTON,
00649     WIDGET_COMBO,
00650     WIDGET_COMBO_BUTTON,
00651     WIDGET_MENU_ITEM,
00652     WIDGET_PROGRESSBAR,
00653     WIDGET_PBAR_TROUGH,
00654 #ifndef __cplusplus
00655     WIDGET_ENTRY_PROGRESSBAR,
00656     WIDGET_TOGGLE_BUTTON,
00657     WIDGET_SPIN_UP,
00658     WIDGET_SPIN_DOWN,
00659     WIDGET_UNCOLOURED_MO_BUTTON,
00660 #else // __cplusplus
00661     WIDGET_CHECKBUTTON,        // Qt4 only
00662     WIDGET_MDI_WINDOW,         // Qt4 only
00663     WIDGET_MDI_WINDOW_TITLE,   // Qt4 only
00664     WIDGET_MDI_WINDOW_BUTTON,  // Qt4 only
00665     WIDGET_DOCK_WIDGET_TITLE,
00666     WIDGET_DIAL,
00667 #endif // __cplusplus
00668     WIDGET_SPIN,
00669     WIDGET_ENTRY,
00670     WIDGET_SCROLLVIEW,
00671     WIDGET_SELECTION,
00672     WIDGET_FRAME,
00673     WIDGET_NO_ETCH_BTN,
00674     WIDGET_MENU_BUTTON,        // Qt4 only
00675     WIDGET_FOCUS,
00676     WIDGET_TAB_FRAME,
00677     WIDGET_OTHER
00678 } EWidget;
00679 
00680 typedef enum
00681 {
00682     APP_ALLOW_BASIC,
00683     APP_ALLOW_FADE,
00684     APP_ALLOW_STRIPED,
00685     APP_ALLOW_NONE
00686 } EAppAllow;
00687 
00688 typedef enum
00689 {
00690     APPEARANCE_CUSTOM1,
00691     APPEARANCE_CUSTOM2,
00692     APPEARANCE_CUSTOM3,
00693     APPEARANCE_CUSTOM4,
00694     APPEARANCE_CUSTOM5,
00695     APPEARANCE_CUSTOM6,
00696     APPEARANCE_CUSTOM7,
00697     APPEARANCE_CUSTOM8,
00698     APPEARANCE_CUSTOM9,
00699     APPEARANCE_CUSTOM10,
00700     APPEARANCE_CUSTOM11,
00701     APPEARANCE_CUSTOM12,
00702     APPEARANCE_CUSTOM13,
00703     APPEARANCE_CUSTOM14,
00704     APPEARANCE_CUSTOM15,
00705     APPEARANCE_CUSTOM16,
00706     APPEARANCE_CUSTOM17,
00707     APPEARANCE_CUSTOM18,
00708     APPEARANCE_CUSTOM19,
00709     APPEARANCE_CUSTOM20,
00710     APPEARANCE_CUSTOM21,
00711     APPEARANCE_CUSTOM22,
00712     APPEARANCE_CUSTOM23,
00713 
00714         NUM_CUSTOM_GRAD,
00715 
00716     APPEARANCE_FLAT = NUM_CUSTOM_GRAD,
00717     APPEARANCE_RAISED,
00718     APPEARANCE_DULL_GLASS,
00719     APPEARANCE_SHINY_GLASS,
00720     APPEARANCE_AGUA,
00721     APPEARANCE_SOFT_GRADIENT,
00722     APPEARANCE_GRADIENT,
00723     APPEARANCE_HARSH_GRADIENT,
00724     APPEARANCE_INVERTED,
00725     APPEARANCE_DARK_INVERTED,
00726     APPEARANCE_SPLIT_GRADIENT,
00727     APPEARANCE_BEVELLED,
00728         APPEARANCE_FADE, /* Only for poupmenu items! */
00729         APPEARANCE_STRIPED = APPEARANCE_FADE, /* Only for windows  and menus */
00730         APPEARANCE_NONE = APPEARANCE_FADE, /* Only for titlebars */
00731         APPEARANCE_FILE,  /* Only for windows  and menus */
00732         APPEARANCE_LV_BEVELLED, /* To be used only with qtcGetGradient */
00733         APPEARANCE_AGUA_MOD,
00734         APPEARANCE_LV_AGUA,
00735     NUM_STD_APP = (APPEARANCE_LV_AGUA-NUM_CUSTOM_GRAD)+1
00736 } EAppearance;
00737 
00738 #define IS_SLIDER(W)        (WIDGET_SLIDER==(W) || WIDGET_SB_SLIDER==(W))
00739 #define IS_TROUGH(W)        (WIDGET_SLIDER_TROUGH==(W) || WIDGET_PBAR_TROUGH==(W) || WIDGET_TROUGH==(W) || WIDGET_FILLED_SLIDER_TROUGH==(W))
00740 #ifndef __cplusplus
00741 #define IS_TOGGLE_BUTTON(W) (WIDGET_TOGGLE_BUTTON==(W) || WIDGET_CHECKBOX==(W))
00742 #endif // __cplusplus
00743 
00744 typedef enum
00745 {
00746     CORNER_TL = 0x1,
00747     CORNER_TR = 0x2,
00748     CORNER_BR = 0x4,
00749     CORNER_BL = 0x8
00750 } ECornerBits;
00751 
00752 #define ROUNDED_NONE        0x0
00753 #define ROUNDED_TOP         (CORNER_TL|CORNER_TR)
00754 #define ROUNDED_BOTTOM      (CORNER_BL|CORNER_BR)
00755 #define ROUNDED_LEFT        (CORNER_TL|CORNER_BL)
00756 #define ROUNDED_RIGHT       (CORNER_TR|CORNER_BR)
00757 #define ROUNDED_TOPRIGHT    CORNER_TR
00758 #define ROUNDED_BOTTOMRIGHT CORNER_BR
00759 #define ROUNDED_TOPLEFT     CORNER_TL
00760 #define ROUNDED_BOTTOMLEFT  CORNER_BL
00761 #define ROUNDED_ALL         (CORNER_TL|CORNER_TR|CORNER_BR|CORNER_BL)
00762 
00763 typedef enum
00764 {
00765     IND_CORNER,
00766     IND_FONT_COLOR,
00767     IND_COLORED,
00768     IND_TINT,
00769     IND_GLOW,
00770     IND_DARKEN,
00771     IND_SELECTED,
00772     IND_NONE
00773 } EDefBtnIndicator;
00774 
00775 typedef enum
00776 {
00777     LINE_NONE,
00778     LINE_SUNKEN,
00779     LINE_FLAT,
00780     LINE_DOTS,
00781     LINE_1DOT,
00782     LINE_DASHES,
00783 } ELine;
00784 
00785 typedef enum
00786 {
00787     TB_NONE,
00788     TB_LIGHT,
00789     TB_DARK,
00790     TB_LIGHT_ALL,
00791     TB_DARK_ALL
00792 } ETBarBorder;
00793 
00794 typedef enum
00795 {
00796     TBTN_STANDARD,
00797     TBTN_RAISED,
00798     TBTN_JOINED
00799 } ETBarBtn;
00800 
00801 typedef enum
00802 {
00803     BORDER_FLAT,
00804     BORDER_RAISED,
00805     BORDER_SUNKEN,
00806     BORDER_LIGHT
00807 } EBorder;
00808 
00809 /*
00810     This whole EShade enum is a complete mess!
00811     For menubars, we dont blend - so blend is selected, and selected is darken
00812     For check/radios - we dont blend, so blend is selected, and we dont allow darken
00813 */
00814 typedef enum
00815 {
00816     SHADE_NONE,
00817     SHADE_CUSTOM,
00818     SHADE_SELECTED,
00819     SHADE_BLEND_SELECTED,
00820     SHADE_DARKEN,
00821     SHADE_WINDOW_BORDER
00822 } EShade;
00823 
00824 typedef enum
00825 {
00826     ECOLOR_BASE,
00827     ECOLOR_BACKGROUND,
00828     ECOLOR_DARK,
00829 } EColor;
00830 
00831 typedef enum
00832 {
00833     ROUND_NONE,
00834     ROUND_SLIGHT,
00835     ROUND_FULL,
00836     ROUND_EXTRA,
00837     ROUND_MAX
00838 } ERound;
00839 
00840 typedef enum
00841 {
00842     SCROLLBAR_KDE,
00843     SCROLLBAR_WINDOWS,
00844     SCROLLBAR_PLATINUM,
00845     SCROLLBAR_NEXT,
00846     SCROLLBAR_NONE
00847 } EScrollbar;
00848 
00849 typedef enum
00850 {
00851     FRAME_NONE,
00852     FRAME_PLAIN,
00853     FRAME_LINE,
00854     FRAME_SHADED,
00855     FRAME_FADED
00856 } EFrame;
00857 
00858 typedef enum
00859 {
00860     GB_LBL_BOLD     = 0x01,
00861     GB_LBL_CENTRED  = 0x02,
00862     GB_LBL_INSIDE   = 0x04,
00863     GB_LBL_OUTSIDE  = 0x08
00864 } EGBLabel;
00865 
00866 #define NO_FRAME(A) (FRAME_NONE==(A) || FRAME_LINE==(A))
00867 
00868 typedef enum
00869 {
00870     MO_NONE,
00871     MO_COLORED,
00872     MO_COLORED_THICK,
00873     MO_PLASTIK,
00874     MO_GLOW
00875 } EMouseOver;
00876 
00877 typedef enum
00878 {
00879     STRIPE_NONE,
00880     STRIPE_PLAIN,
00881     STRIPE_DIAGONAL,
00882     STRIPE_FADE
00883 } EStripe;
00884 
00885 typedef enum
00886 {
00887     SLIDER_PLAIN,
00888     SLIDER_ROUND,
00889     SLIDER_PLAIN_ROTATED,
00890     SLIDER_ROUND_ROTATED,
00891     SLIDER_TRIANGULAR,
00892     SLIDER_CIRCULAR
00893 } ESliderStyle;
00894 
00895 #define ROTATED_SLIDER (SLIDER_PLAIN_ROTATED==opts.sliderStyle || SLIDER_ROUND_ROTATED==opts.sliderStyle)
00896 
00897 typedef enum
00898 {
00899     FOCUS_STANDARD,
00900     FOCUS_RECTANGLE,
00901     FOCUS_FULL,
00902     FOCUS_FILLED,
00903     FOCUS_LINE,
00904     FOCUS_GLOW
00905 } EFocus;
00906 
00907 typedef enum
00908 {
00909     TAB_MO_TOP,
00910     TAB_MO_BOTTOM,
00911     TAB_MO_GLOW
00912 } ETabMo;
00913 
00914 typedef enum
00915 {
00916     GT_HORIZ,
00917     GT_VERT
00918 } EGradType;
00919 
00920 typedef enum
00921 {
00922     GLOW_NONE,
00923     GLOW_START,
00924     GLOW_MIDDLE,
00925     GLOW_END
00926 } EGlow;
00927 
00928 #define FULL_FOCUS     (FOCUS_FULL==opts.focus  || FOCUS_FILLED==opts.focus)
00929 
00930 enum
00931 {
00932     HIDE_NONE     = 0x00,
00933     HIDE_KEYBOARD = 0x01,
00934     HIDE_KWIN     = 0x02
00935 };
00936 
00937 #if defined __cplusplus
00938 typedef enum
00939 {
00940     ALIGN_LEFT,
00941     ALIGN_CENTER,
00942     ALIGN_FULL_CENTER,
00943     ALIGN_RIGHT
00944 } EAlign;
00945 #endif
00946 
00947 #ifdef __cplusplus
00948 #include <math.h>
00949 
00950 inline bool qtcEqual(double d1, double d2)
00951 {
00952     return (fabs(d1 - d2) < 0.0001);
00953 }
00954 #else // __cplusplus
00955 #define qtcEqual(A, B) (fabs(A - B) < 0.0001)
00956 #endif // __cplusplus
00957 
00958 #ifdef __cplusplus
00959 struct GradientStop
00960 #else // __cplusplus
00961 typedef struct
00962 #endif // __cplusplus
00963 {
00964 #ifdef __cplusplus
00965     GradientStop(double p=0.0, double v=0.0, double a=1.0) : pos(p), val(v), alpha(a) { }
00966 
00967     bool operator==(const GradientStop &o) const
00968     {
00969         return qtcEqual(pos, o.pos) && qtcEqual(val, o.val) && qtcEqual(alpha, o.alpha);
00970     }
00971 
00972     bool operator<(const GradientStop &o) const
00973     {
00974         return pos<o.pos || (qtcEqual(pos, o.pos) && (val<o.val || (qtcEqual(val, o.val) && alpha<o.alpha)));
00975     }
00976 #endif //__cplusplus
00977 
00978     double pos,
00979            val,
00980            alpha;
00981 }
00982 #ifndef __cplusplus
00983 GradientStop
00984 #endif // __cplusplus
00985 ;
00986 
00987 typedef enum
00988 {
00989     GB_NONE,
00990     GB_LIGHT,
00991     GB_3D,
00992     GB_3D_FULL,
00993     GB_SHINE
00994 } EGradientBorder;
00995 
00996 #if 0
00997 typedef enum
00998 {
00999     LV_NONE,
01000     LV_NEW,
01001     LV_OLD
01002 } ELvLines;
01003 #endif
01004 
01005 typedef struct
01006 {
01007     int titleHeight,
01008         toolTitleHeight,
01009         bottom,
01010         sides;
01011 } WindowBorders;
01012 
01013 #ifdef __cplusplus
01014 struct GradientStopCont : public std::set<GradientStop>
01015 {
01016     GradientStopCont fix() const
01017     {
01018         GradientStopCont c(*this);
01019         if(size())
01020         {
01021             GradientStopCont::const_iterator   first(c.begin());
01022             GradientStopCont::reverse_iterator last(c.rbegin());
01023 
01024             if((*first).pos>0.001)
01025                 c.insert(GradientStop(0.0, 1.0));
01026             if((*last).pos<0.999)
01027                 c.insert(GradientStop(1.0, 1.0));
01028         }
01029         return c;                                  
01030     }
01031 };
01032 struct Gradient
01033 #else // __cplusplus
01034 typedef struct
01035 #endif // __cplusplus
01036 {
01037 #ifdef __cplusplus
01038     Gradient() : border(GB_3D) { }
01039 
01040     bool operator==(const Gradient &o) const
01041     {
01042         return border==o.border && stops==o.stops;
01043     }
01044 #endif // __cplusplus
01045     EGradientBorder  border;
01046 #ifdef __cplusplus
01047     GradientStopCont stops;
01048 #else // __cplusplus
01049     int              numStops;
01050     GradientStop     *stops;
01051 #endif // __cplusplus
01052 }
01053 #ifndef __cplusplus
01054 Gradient
01055 #endif // __cplusplus
01056 ;
01057 
01058 #define USE_CUSTOM_SHADES(A) ((A).customShades[0]>0.00001)
01059 #define USE_CUSTOM_ALPHAS(A) ((A).customAlphas[0]>0.00001)
01060 
01061 #ifdef __cplusplus
01062 typedef std::map<EAppearance, Gradient> GradientCont;
01063 struct Options
01064 #else // __cplusplus
01065 typedef struct
01066 #endif // __cplusplus
01067 {
01068 
01069     int              version,
01070                      contrast,
01071                      passwordChar,
01072                      highlightFactor,
01073                      lighterPopupMenuBgnd,
01074                      menuDelay,
01075                      sliderWidth,
01076                      tabBgnd,
01077                      colorSelTab,
01078                      expanderHighlight,
01079                      crHighlight,
01080                      splitterHighlight,
01081                      crSize,
01082                      gbFactor,
01083                      gbLabel,
01084                      thin;
01085     ERound           round;
01086     bool             embolden,
01087                      highlightTab,
01088                      roundAllTabs,
01089                      animatedProgress,
01090 #ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
01091                      fixParentlessDialogs,
01092 #endif
01093                      customMenuTextColor,
01094                      menubarMouseOver,
01095                      useHighlightForMenu,
01096                      shadeMenubarOnlyWhenActive,
01097                      lvButton,
01098                      drawStatusBarFrames,
01099                      fillSlider,
01100                      roundMbTopOnly,
01101                      gtkScrollViews,
01102                      stdSidebarButtons,
01103                      toolbarTabs,
01104                      gtkComboMenus,
01105                      mapKdeIcons,
01106                      gtkButtonOrder,
01107                      fadeLines,
01108                      reorderGtkButtons,
01109                      borderMenuitems,
01110                      colorMenubarMouseOver,
01111                      darkerBorders,
01112                      vArrows,
01113                      xCheck,
01114                      crButton,
01115                      smallRadio,
01116                      fillProgress,
01117                      comboSplitter,
01118                      highlightScrollViews,
01119                      etchEntry,
01120                      colorSliderMouseOver,
01121                      thinSbarGroove,
01122                      flatSbarButtons,
01123                      borderSbarGroove,
01124                      borderProgress,
01125                      popupBorder,
01126                      unifySpinBtns,
01127                      unifyCombo,
01128                      unifySpin,
01129                      borderTab,
01130                      borderInactiveTab,
01131                      doubleGtkComboArrow,
01132                      menuIcons,
01133 #if defined QT_VERSION && (QT_VERSION >= 0x040000)
01134                      stdBtnSizes,
01135                      xbar,
01136 #endif // defined QT_VERSION && (QT_VERSION >= 0x040000)
01137                      forceAlternateLvCols,
01138                      invertBotTab,
01139                      boldProgress,
01140                      coloredTbarMo,
01141                      borderSelection,
01142                      stripedSbar,
01143                      shadePopupMenu,
01144                      hideShortcutUnderline;
01145     EFrame           groupBox;
01146     EGlow            glowProgress;
01147     bool             lvLines;
01148     EGradType        bgndGrad,
01149                      menuBgndGrad;
01150     int              menubarHiding,
01151                      statusbarHiding,
01152                      square,
01153                      windowDrag,
01154                      windowBorder,
01155                      bgndOpacity,
01156                      menuBgndOpacity,
01157                      dlgOpacity;
01158 #if defined QT_VERSION && (QT_VERSION >= 0x040000)
01159     int              dwtSettings;
01160     int              titlebarButtons;
01161     TBCols           titlebarButtonColors;
01162     ETitleBarIcon    titlebarIcon;
01163 #endif // defined QT_VERSION && (QT_VERSION >= 0x040000)
01164     EStripe          stripedProgress;
01165     ESliderStyle     sliderStyle;
01166     EMouseOver       coloredMouseOver;
01167     ETBarBorder      toolbarBorders;
01168     ETBarBtn         tbarBtns;
01169     EDefBtnIndicator defBtnIndicator;
01170     ELine            sliderThumbs,
01171                      handles,
01172                      toolbarSeparators,
01173                      splitters;
01174     ETabMo           tabMouseOver;
01175 /* NOTE: If add an appearance setting, increase the number of custmo gradients to match! */
01176     EAppearance      appearance,
01177                      bgndAppearance,
01178                      menuBgndAppearance,
01179                      menubarAppearance,
01180                      menuitemAppearance,
01181                      toolbarAppearance,
01182                      lvAppearance,
01183                      tabAppearance,
01184                      activeTabAppearance,
01185                      sliderAppearance,
01186                      titlebarAppearance,
01187                      inactiveTitlebarAppearance,
01188 #ifdef __cplusplus
01189                      titlebarButtonAppearance,
01190                      dwtAppearance,
01191 #endif // __cplusplus
01192                      selectionAppearance,
01193                      menuStripeAppearance,
01194                      progressAppearance,
01195                      progressGrooveAppearance,
01196                      grooveAppearance,
01197                      sunkenAppearance,
01198                      sbarBgndAppearance,
01199                      sliderFill,
01200                      tooltipAppearance,
01201                      tbarBtnAppearance;
01202     EShade           shadeSliders,
01203                      shadeMenubars,
01204                      menuStripe,
01205                      shadeCheckRadio,
01206                      comboBtn,
01207                      sortedLv,
01208                      crColor,
01209                      progressColor;
01210     EColor           progressGrooveColor;
01211     EEffect          buttonEffect,
01212                      tbarBtnEffect;
01213     EScrollbar       scrollbarType;
01214     EFocus           focus;
01215     color            customMenubarsColor,
01216                      customSlidersColor,
01217                      customMenuNormTextColor,
01218                      customMenuSelTextColor,
01219                      customMenuStripeColor,
01220                      customCheckRadioColor,
01221                      customComboBtnColor,
01222                      customSortedLvColor,
01223                      customCrBgndColor,
01224                      customProgressColor;
01225     EShading         shading;
01226 #if defined __cplusplus
01227     EAlign           titlebarAlignment;
01228     EEffect          titlebarEffect;
01229     bool             centerTabText;
01230 #endif //__cplusplus
01231     double           customShades[NUM_STD_SHADES],
01232                      customAlphas[NUM_STD_ALPHAS];
01233 #ifdef __cplusplus
01234     GradientCont     customGradient;
01235 #else // __cplusplus
01236     Gradient         *customGradient[NUM_CUSTOM_GRAD];
01237 #endif // __cplusplus
01238     QtCPixmap        bgndPixmap;
01239     QtCPixmap        menuBgndPixmap;
01240     QtCImage         bgndImage,
01241                      menuBgndImage;
01242 #if !defined __cplusplus || (defined QT_VERSION && (QT_VERSION >= 0x040000))
01243     /* NOTE: If add any more settings here, need to alter copyOpts/freeOpts/defaultSettings in config_file.c */
01244     Strings          noBgndGradientApps,
01245                      noBgndOpacityApps,
01246                      noMenuBgndOpacityApps,
01247                      noBgndImageApps;
01248 #endif
01249 #ifdef QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
01250     Strings          noDlgFixApps;
01251 #endif
01252     Strings          noMenuStripeApps;
01253 #if defined QT_VERSION && (QT_VERSION >= 0x040000)
01254     Strings          menubarApps,
01255                      statusbarApps,
01256                      useQtFileDialogApps,
01257                      windowDragWhiteList,
01258                      windowDragBlackList;
01259 #endif // defined QT_VERSION && (QT_VERSION >= 0x040000)
01260 
01261 #ifndef __cplusplus
01262 } Options;
01263 #else // __cplusplus
01264 };
01265 #endif // __cplusplus
01266 
01267 #ifndef MIN
01268 #define MIN(a, b) ((a) < (b) ? (a) : (b))
01269 #endif
01270 #ifndef MAX
01271 #define MAX(a, b) ((b) < (a) ? (a) : (b))
01272 #endif
01273 
01274 #if defined QT_VERSION && (QT_VERSION >= 0x040000) && !defined QTC_QT_ONLY
01275 #include <KDE/KColorUtils>
01276 #define tint(COLA, COLB, FACTOR) KColorUtils::tint((COLA), (COLB), (FACTOR))
01277 #define midColor(COLA, COLB) KColorUtils::mix((COLA), (COLB), 0.5)
01278 #else // QT_VERSION && (QT_VERSION >= 0x040000) && !defined QTC_QT_ONLY
01279 #include "colorutils.h"
01280 #ifdef __cplusplus
01281 #define tint(COLA, COLB, FACTOR) ColorUtils_tint(&(COLA), &(COLB), (FACTOR))
01282 #define midColor(COLA, COLB) ColorUtils_mix(&(COLA), &(COLB), 0.5)
01283 #define midColorF(COLA, COLB, FACTOR) ColorUtils_mix(&(COLA), &(COLB), FACTOR-0.5)
01284 #else // __cplusplus
01285 #define tint(COLA, COLB, FACTOR) ColorUtils_tint((COLA), (COLB), (FACTOR))
01286 #define midColor(COLA, COLB) ColorUtils_mix((COLA), (COLB), 0.5)
01287 #endif // __cplusplus
01288 #endif // QT_VERSION && (QT_VERSION >= 0x040000) && !defined QTC_QT_ONLY
01289 
01290 extern void qtcRgbToHsv(double r, double g, double b, double *h, double *s, double *v);
01291 extern void qtcRgbToHsv(double r, double g, double b, double *h, double *s, double *v);
01292 #ifdef __cplusplus
01293 extern void qtcShade(const Options *opts, const color &ca, color *cb, double k);
01294 #else
01295 extern void qtcShade(const Options *opts, const color *ca, color *cb, double k);
01296 #endif
01297 
01298 extern void qtcAdjustPix(unsigned char *data, int numChannels, int w, int h, int stride, int ro, int go, int bo, double shade);
01299 extern void qtcSetupGradient(Gradient *grad, EGradientBorder border, int numStops, ...);
01300 extern const Gradient * qtcGetGradient(EAppearance app, const Options *opts);
01301 
01302 #ifdef __cplusplus
01303 extern EAppearance qtcWidgetApp(EWidget w, const Options *opts, bool active=true);
01304 #else
01305 extern EAppearance qtcWidgetApp(EWidget w, const Options *opts);
01306 #endif
01307 
01308 typedef enum
01309 {
01310     RADIUS_SELECTION,
01311     RADIUS_INTERNAL,
01312     RADIUS_EXTERNAL,
01313     RADIUS_ETCH
01314 } ERadius;
01315 
01316 #define MIN_ROUND_MAX_HEIGHT    12
01317 #define MIN_ROUND_MAX_WIDTH     24
01318 #define BGND_SHINE_SIZE 300
01319 #define BGND_SHINE_STEPS  8
01320 
01321 #define MIN_ROUND_FULL_SIZE     8
01322 #ifdef __cplusplus
01323 #define MIN_ROUND_EXTRA_SIZE(W) (WIDGET_SPIN==(W) ? 7 : 14)
01324 #else // __cplusplus
01325 #define MIN_ROUND_EXTRA_SIZE(W) (WIDGET_SPIN_UP==(W) || WIDGET_SPIN_DOWN==(W) || WIDGET_SPIN==(W) ? 7 : 14)
01326 #endif // __cplusplus
01327 
01328 #if defined __cplusplus
01329 #define IS_MAX_ROUND_WIDGET(A) \
01330             (WIDGET_STD_BUTTON==A || WIDGET_DEF_BUTTON==A /*|| WIDGET_MENU_BUTTON==A*/)
01331 #define IS_EXTRA_ROUND_WIDGET(A) \
01332             (A!=WIDGET_MENU_ITEM && A!=WIDGET_TAB_FRAME && A!=WIDGET_PBAR_TROUGH && A!=WIDGET_PROGRESSBAR && \
01333              A!=WIDGET_MDI_WINDOW && A!=WIDGET_MDI_WINDOW_TITLE)
01334              
01335 #define EXTRA_INNER_RADIUS   3.5
01336 #define EXTRA_OUTER_RADIUS   4.5
01337 #define EXTRA_ETCH_RADIUS    5.5
01338 #define FULL_INNER_RADIUS    1.5
01339 #define FULL_OUTER_RADIUS    2.5
01340 #define FULL_ETCH_RADIUS     3.5
01341 
01342 #if defined QT_VERSION && (QT_VERSION < 0x040600)
01343 #define SLIGHT_INNER_RADIUS  0.5
01344 #define SLIGHT_OUTER_RADIUS  1.5
01345 #define SLIGHT_ETCH_RADIUS   2.5
01346 #else // QT_VERSION && (QT_VERSION < 0x040600)
01347 #define SLIGHT_INNER_RADIUS  0.75
01348 #define SLIGHT_OUTER_RADIUS  1.75
01349 #define SLIGHT_ETCH_RADIUS   2.75
01350 #endif //QT_VERSION && (QT_VERSION < 0x040600)
01351 
01352 #else // __cplusplus
01353 
01354 #define IS_MAX_ROUND_WIDGET(A) \
01355             (WIDGET_STD_BUTTON==A || WIDGET_DEF_BUTTON==A || WIDGET_TOGGLE_BUTTON==A /*|| WIDGET_MENU_BUTTON==A*/)
01356 #define IS_EXTRA_ROUND_WIDGET(A) \
01357             (A!=WIDGET_MENU_ITEM && A!=WIDGET_TAB_FRAME && A!=WIDGET_PBAR_TROUGH && A!=WIDGET_PROGRESSBAR)
01358 
01359 #define EXTRA_INNER_RADIUS   4
01360 #define EXTRA_OUTER_RADIUS   5
01361 #define EXTRA_ETCH_RADIUS    6
01362 #define FULL_INNER_RADIUS    2
01363 #define FULL_OUTER_RADIUS    3
01364 #define FULL_ETCH_RADIUS     4
01365 #define SLIGHT_INNER_RADIUS  1
01366 #define SLIGHT_OUTER_RADIUS  2
01367 #define SLIGHT_ETCH_RADIUS   3
01368 
01369 #endif // __cplusplus
01370 
01371 #define MAX_RADIUS_INTERNAL 9.0
01372 #define MAX_RADIUS_EXTERNAL (MAX_RADIUS_INTERNAL+2.0)
01373 
01374 extern double qtcRingAlpha[3];
01375 extern ERound qtcGetWidgetRound(const Options *opts, int w, int h, EWidget widget);
01376 extern double qtcGetRadius(const Options *opts, int w, int h, EWidget widget, ERadius rad);
01377 extern double qtcShineAlpha(const color *bgnd);
01378 extern void qtcCalcRingAlphas(const color *bgnd);
01379 
01380 #endif // __COMMON_H__
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'