1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
|
/*****************************************************************************
* Copyright 2003 - 2010 Craig Drummond <craig.p.drummond@gmail.com> *
* Copyright 2013 - 2015 Yichao Yu <yyc1992@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 2.1 of the *
* License, or (at your option) version 3, or any later version accepted *
* by the membership of KDE e.V. (or its successor approved by the *
* membership of KDE e.V.), which shall act as a proxy defined in *
* Section 6 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library. If not, *
* see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef QTC_UTILS_OPTIONS_H
#define QTC_UTILS_OPTIONS_H
#include "number.h"
enum class Shading {
Simple,
HSL,
HSV,
HCY,
};
enum EScrollbar {
SCROLLBAR_KDE,
SCROLLBAR_WINDOWS,
SCROLLBAR_PLATINUM,
SCROLLBAR_NEXT,
SCROLLBAR_NONE
};
enum EAppearance {
APPEARANCE_CUSTOM1,
APPEARANCE_CUSTOM2,
APPEARANCE_CUSTOM3,
APPEARANCE_CUSTOM4,
APPEARANCE_CUSTOM5,
APPEARANCE_CUSTOM6,
APPEARANCE_CUSTOM7,
APPEARANCE_CUSTOM8,
APPEARANCE_CUSTOM9,
APPEARANCE_CUSTOM10,
APPEARANCE_CUSTOM11,
APPEARANCE_CUSTOM12,
APPEARANCE_CUSTOM13,
APPEARANCE_CUSTOM14,
APPEARANCE_CUSTOM15,
APPEARANCE_CUSTOM16,
APPEARANCE_CUSTOM17,
APPEARANCE_CUSTOM18,
APPEARANCE_CUSTOM19,
APPEARANCE_CUSTOM20,
APPEARANCE_CUSTOM21,
APPEARANCE_CUSTOM22,
APPEARANCE_CUSTOM23,
NUM_CUSTOM_GRAD,
APPEARANCE_FLAT = NUM_CUSTOM_GRAD,
APPEARANCE_RAISED,
APPEARANCE_DULL_GLASS,
APPEARANCE_SHINY_GLASS,
APPEARANCE_AGUA,
APPEARANCE_SOFT_GRADIENT,
APPEARANCE_GRADIENT,
APPEARANCE_HARSH_GRADIENT,
APPEARANCE_INVERTED,
APPEARANCE_DARK_INVERTED,
APPEARANCE_SPLIT_GRADIENT,
APPEARANCE_BEVELLED,
APPEARANCE_FADE, /* Only for poupmenu items! */
APPEARANCE_STRIPED = APPEARANCE_FADE, /* Only for windows and menus */
APPEARANCE_NONE = APPEARANCE_FADE, /* Only for titlebars */
APPEARANCE_FILE, /* Only for windows and menus */
APPEARANCE_LV_BEVELLED, /* To be used only with qtcGetGradient */
APPEARANCE_AGUA_MOD,
APPEARANCE_LV_AGUA,
NUM_STD_APP = (APPEARANCE_LV_AGUA - NUM_CUSTOM_GRAD) + 1
};
enum EFrame {
FRAME_NONE,
FRAME_PLAIN,
FRAME_LINE,
FRAME_SHADED,
FRAME_FADED
};
enum EGradientBorder {
GB_NONE,
GB_LIGHT,
GB_3D,
GB_3D_FULL,
GB_SHINE
};
enum ECornerBits {
CORNER_TL = 1 << 0,
CORNER_TR = 1 << 1,
CORNER_BR = 1 << 2,
CORNER_BL = 1 << 3,
ROUNDED_NONE = 0,
ROUNDED_TOP = CORNER_TL | CORNER_TR,
ROUNDED_BOTTOM = CORNER_BL | CORNER_BR,
ROUNDED_LEFT = CORNER_TL | CORNER_BL,
ROUNDED_RIGHT = CORNER_TR | CORNER_BR,
ROUNDED_TOPRIGHT = CORNER_TR,
ROUNDED_BOTTOMRIGHT = CORNER_BR,
ROUNDED_TOPLEFT = CORNER_TL,
ROUNDED_BOTTOMLEFT = CORNER_BL,
ROUNDED_ALL = CORNER_TL | CORNER_TR | CORNER_BR | CORNER_BL,
};
QTC_ALWAYS_INLINE static inline bool
qtcUseBorder(EGradientBorder border)
{
return QtCurve::noneOf(border, GB_SHINE, GB_NONE);
}
QTC_ALWAYS_INLINE static inline bool
qtcNoFrame(EFrame frame)
{
return QtCurve::oneOf(frame, FRAME_NONE, FRAME_LINE);
}
QTC_ALWAYS_INLINE static inline bool
qtcIsFlatBgnd(EAppearance appear)
{
return QtCurve::oneOf(appear, APPEARANCE_FLAT, APPEARANCE_RAISED);
}
QTC_ALWAYS_INLINE static inline bool
qtcIsFlat(EAppearance appear)
{
return qtcIsFlatBgnd(appear) || appear == APPEARANCE_FADE;
}
/**
* Number of scrollbar buttons.
**/
QTC_ALWAYS_INLINE static inline int
qtcScrollbarButtonNum(EScrollbar type)
{
switch (type) {
default:
case SCROLLBAR_KDE:
return 3;
case SCROLLBAR_WINDOWS:
case SCROLLBAR_PLATINUM:
case SCROLLBAR_NEXT:
return 2;
case SCROLLBAR_NONE:
return 0;
}
}
/**
* Number of scrollbar button we leave space for.
* Some applications (e.g. choqok) use the minimum size of scrollbar to
* determine the height of input area. Setting a lower limit on this makes
* sure that the calculated minimum size is not too small.
* See https://github.com/QtCurve/qtcurve-qt4/issues/7
* and https://bugs.kde.org/show_bug.cgi?id=317690
**/
QTC_ALWAYS_INLINE static inline int
qtcScrollbarButtonNumSize(EScrollbar type)
{
return qtcMax(qtcScrollbarButtonNum(type), 2);
}
/**
* shadow size control for X11.
**/
void
qtcX11SetShadowSize(int);
int
qtcX11ShadowSize();
namespace QtCurve {
namespace Config {
template<typename T> T loadValue(const char *str, T def);
#define _QTC_CONFIG_DEF_LOAD_VALUE(type, str, def) \
type loadValue<type>(const char *str, type def)
#define QTC_CONFIG_DEF_LOAD_VALUE(type) \
template _QTC_CONFIG_DEF_LOAD_VALUE(type, str, def)
#ifndef __QTC_UTILS_OPTIONS_INTERNAL__
extern QTC_CONFIG_DEF_LOAD_VALUE(Shading);
extern QTC_CONFIG_DEF_LOAD_VALUE(EScrollbar);
extern QTC_CONFIG_DEF_LOAD_VALUE(EFrame);
#undef _QTC_CONFIG_DEF_LOAD_VALUE
#undef QTC_CONFIG_DEF_LOAD_VALUE
#endif
}
}
#endif
|