1 /***************************************************************************** 2 * Copyright 2003 - 2010 Craig Drummond <craig.p.drummond@gmail.com> * 3 * Copyright 2013 - 2015 Yichao Yu <yyc1992@gmail.com> * 4 * * 5 * This program is free software; you can redistribute it and/or modify * 6 * it under the terms of the GNU Lesser General Public License as * 7 * published by the Free Software Foundation; either version 2.1 of the * 8 * License, or (at your option) version 3, or any later version accepted * 9 * by the membership of KDE e.V. (or its successor approved by the * 10 * membership of KDE e.V.), which shall act as a proxy defined in * 11 * Section 6 of version 3 of the license. * 12 * * 13 * This program is distributed in the hope that it will be useful, * 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 16 * Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public * 19 * License along with this library. If not, * 20 * see <http://www.gnu.org/licenses/>. * 21 *****************************************************************************/ 22 23 #ifndef __QT_SETTINGS_H__ 24 #define __QT_SETTINGS_H__ 25 26 #include <gtk/gtk.h> 27 28 #include <common/common.h> 29 30 namespace QtCurve { 31 32 #define READ_INACTIVE_PAL /* Control whether QtCurve should read the inactive palette as well.. */ 33 34 #define DEBUG_PREFIX "QtCurve: " 35 #define RC_SETTING "QtC__" 36 37 #define COL_EQ(A, B)(abs(A-B)<(3<<8)) 38 39 #define EQUAL_COLOR(A, B) \ 40 (COL_EQ(A.red, B.red) && COL_EQ(A.green, B.green) && COL_EQ(A.blue, B.blue)) 41 42 #define toQtColor(col) \ 43 ((col&0xFF00)>>8) 44 /* ((int)((((double)col)/256.0)+0.5))*/ 45 46 #define toGtkColor(col) \ 47 ((col<<8)+col) 48 49 typedef struct { 50 int smlTbSize, 51 tbSize, 52 dndSize, 53 btnSize, 54 mnuSize, 55 dlgSize; 56 } QtIcons; 57 58 typedef enum { 59 COLOR_BACKGROUND, 60 COLOR_BUTTON, 61 COLOR_SELECTED, 62 COLOR_WINDOW, 63 64 COLOR_MID, 65 COLOR_TEXT, 66 COLOR_TEXT_SELECTED, 67 COLOR_LV, 68 69 COLOR_TOOLTIP, 70 71 COLOR_BUTTON_TEXT, 72 COLOR_WINDOW_TEXT, 73 COLOR_TOOLTIP_TEXT, 74 75 COLOR_FOCUS, /* KDE4 */ 76 COLOR_HOVER, /* KDE4 */ 77 COLOR_WINDOW_BORDER, 78 COLOR_WINDOW_BORDER_TEXT, 79 80 COLOR_NUMCOLORS, 81 COLOR_NUMCOLORS_STD = COLOR_NUMCOLORS-2 /* Remove Window border colors */ 82 } QtColorRoles; 83 84 typedef enum { 85 GTK_APP_UNKNOWN, 86 GTK_APP_MOZILLA, 87 GTK_APP_NEW_MOZILLA, /* For firefox3 */ 88 GTK_APP_OPEN_OFFICE, 89 GTK_APP_VMPLAYER, 90 GTK_APP_GIMP, 91 GTK_APP_JAVA, 92 GTK_APP_JAVA_SWT, 93 GTK_APP_EVOLUTION, 94 GTK_APP_GHB 95 } EGtkApp; 96 97 typedef enum { 98 PAL_ACTIVE, 99 PAL_DISABLED, 100 PAL_INACTIVE 101 #ifndef READ_INACTIVE_PAL 102 = PAL_ACTIVE 103 #endif 104 , 105 106 PAL_NUMPALS 107 } QtPallete; 108 109 typedef enum { 110 FONT_GENERAL, 111 FONT_MENU, 112 FONT_TOOLBAR, 113 114 FONT_NUM_STD, 115 116 FONT_BOLD = FONT_NUM_STD, 117 118 FONT_NUM_TOTAL 119 } QtFont; 120 121 typedef enum { 122 DEBUG_NONE, 123 DEBUG_SETTINGS, 124 DEBUG_ALL, 125 } QtcDebug; 126 127 typedef struct { 128 GdkColor colors[PAL_NUMPALS][COLOR_NUMCOLORS]; /*, 129 inactiveSelectCol;*/ 130 char *fonts[FONT_NUM_TOTAL]; 131 char *icons; 132 #ifdef QTC_GTK2_STYLE_SUPPORT 133 char *styleName; 134 #endif 135 const char *appName; 136 GtkToolbarStyle toolbarStyle; 137 QtIcons iconSizes; 138 bool buttonIcons; 139 bool shadeSortedList; 140 EGtkApp app; 141 bool qt4; 142 bool inactiveChangeSelectionColor; 143 bool useAlpha; 144 // int startDragDist; 145 int startDragTime; 146 QtcDebug debug; 147 } QtData; 148 149 typedef struct { 150 GdkColor background[TOTAL_SHADES+1], 151 button[2][TOTAL_SHADES+1], 152 *slider, 153 *defbtn, 154 *mouseover, 155 *combobtn, 156 *selectedcr, 157 *sortedlv, 158 *sidebar, 159 *progress, 160 *wborder[2], 161 mdi_text[2], 162 menubar[TOTAL_SHADES+1], 163 highlight[TOTAL_SHADES+1], 164 focus[TOTAL_SHADES+1], 165 menu[TOTAL_SHADES+1], 166 *check_radio; 167 } QtCPalette; 168 169 extern QtCPalette qtcPalette; 170 extern Options opts; 171 extern QtData qtSettings; 172 173 bool qtSettingsInit(); 174 void qtSettingsSetColors(GtkStyle *style, GtkRcStyle *rc_style); 175 176 } 177 178 #endif 179