File indexing completed on 2024-04-21 16:30:51

0001 /*****************************************************************************
0002  *   Copyright 2003 - 2010 Craig Drummond <craig.p.drummond@gmail.com>       *
0003  *   Copyright 2013 - 2015 Yichao Yu <yyc1992@gmail.com>                     *
0004  *                                                                           *
0005  *   This program is free software; you can redistribute it and/or modify    *
0006  *   it under the terms of the GNU Lesser General Public License as          *
0007  *   published by the Free Software Foundation; either version 2.1 of the    *
0008  *   License, or (at your option) version 3, or any later version accepted   *
0009  *   by the membership of KDE e.V. (or its successor approved by the         *
0010  *   membership of KDE e.V.), which shall act as a proxy defined in          *
0011  *   Section 6 of version 3 of the license.                                  *
0012  *                                                                           *
0013  *   This program is distributed in the hope that it will be useful,         *
0014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
0015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *
0016  *   Lesser General Public License for more details.                         *
0017  *                                                                           *
0018  *   You should have received a copy of the GNU Lesser General Public        *
0019  *   License along with this library. If not,                                *
0020  *   see <http://www.gnu.org/licenses/>.                                     *
0021  *****************************************************************************/
0022 
0023 #ifndef __QT_SETTINGS_H__
0024 #define __QT_SETTINGS_H__
0025 
0026 #include <gtk/gtk.h>
0027 
0028 #include <common/common.h>
0029 
0030 namespace QtCurve {
0031 
0032 #define READ_INACTIVE_PAL /* Control whether QtCurve should read the inactive palette as well.. */
0033 
0034 #define DEBUG_PREFIX "QtCurve: "
0035 #define RC_SETTING "QtC__"
0036 
0037 #define COL_EQ(A, B)(abs(A-B)<(3<<8))
0038 
0039 #define EQUAL_COLOR(A, B) \
0040    (COL_EQ(A.red, B.red) && COL_EQ(A.green, B.green) && COL_EQ(A.blue, B.blue))
0041 
0042 #define toQtColor(col) \
0043     ((col&0xFF00)>>8)
0044 /*    ((int)((((double)col)/256.0)+0.5))*/
0045 
0046 #define toGtkColor(col) \
0047     ((col<<8)+col)
0048 
0049 typedef struct {
0050     int smlTbSize,
0051         tbSize,
0052         dndSize,
0053         btnSize,
0054         mnuSize,
0055         dlgSize;
0056 } QtIcons;
0057 
0058 typedef enum {
0059     COLOR_BACKGROUND,
0060     COLOR_BUTTON,
0061     COLOR_SELECTED,
0062     COLOR_WINDOW,
0063 
0064     COLOR_MID,
0065     COLOR_TEXT,
0066     COLOR_TEXT_SELECTED,
0067     COLOR_LV,
0068 
0069     COLOR_TOOLTIP,
0070 
0071     COLOR_BUTTON_TEXT,
0072     COLOR_WINDOW_TEXT,
0073     COLOR_TOOLTIP_TEXT,
0074 
0075     COLOR_FOCUS,    /* KDE4 */
0076     COLOR_HOVER,    /* KDE4 */
0077     COLOR_WINDOW_BORDER,
0078     COLOR_WINDOW_BORDER_TEXT,
0079 
0080     COLOR_NUMCOLORS,
0081     COLOR_NUMCOLORS_STD = COLOR_NUMCOLORS-2 /* Remove Window border colors */
0082 } QtColorRoles;
0083 
0084 typedef enum {
0085     GTK_APP_UNKNOWN,
0086     GTK_APP_MOZILLA,
0087     GTK_APP_NEW_MOZILLA, /* For firefox3 */
0088     GTK_APP_OPEN_OFFICE,
0089     GTK_APP_VMPLAYER,
0090     GTK_APP_GIMP,
0091     GTK_APP_JAVA,
0092     GTK_APP_JAVA_SWT,
0093     GTK_APP_EVOLUTION,
0094     GTK_APP_GHB
0095 } EGtkApp;
0096 
0097 typedef enum {
0098     PAL_ACTIVE,
0099     PAL_DISABLED,
0100     PAL_INACTIVE
0101 #ifndef READ_INACTIVE_PAL
0102         = PAL_ACTIVE
0103 #endif
0104     ,
0105 
0106     PAL_NUMPALS
0107 } QtPallete;
0108 
0109 typedef enum {
0110     FONT_GENERAL,
0111     FONT_MENU,
0112     FONT_TOOLBAR,
0113 
0114     FONT_NUM_STD,
0115 
0116     FONT_BOLD = FONT_NUM_STD,
0117 
0118     FONT_NUM_TOTAL
0119 } QtFont;
0120 
0121 typedef enum {
0122     DEBUG_NONE,
0123     DEBUG_SETTINGS,
0124     DEBUG_ALL,
0125 } QtcDebug;
0126 
0127 typedef struct {
0128     GdkColor        colors[PAL_NUMPALS][COLOR_NUMCOLORS]; /*,
0129                     inactiveSelectCol;*/
0130     char *fonts[FONT_NUM_TOTAL];
0131     char *icons;
0132 #ifdef QTC_GTK2_STYLE_SUPPORT
0133     char *styleName;
0134 #endif
0135     const char *appName;
0136     GtkToolbarStyle toolbarStyle;
0137     QtIcons         iconSizes;
0138     bool buttonIcons;
0139     bool shadeSortedList;
0140     EGtkApp app;
0141     bool qt4;
0142     bool inactiveChangeSelectionColor;
0143     bool useAlpha;
0144     // int startDragDist;
0145     int startDragTime;
0146     QtcDebug debug;
0147 } QtData;
0148 
0149 typedef struct {
0150     GdkColor background[TOTAL_SHADES+1],
0151              button[2][TOTAL_SHADES+1],
0152              *slider,
0153              *defbtn,
0154              *mouseover,
0155              *combobtn,
0156              *selectedcr,
0157              *sortedlv,
0158              *sidebar,
0159              *progress,
0160              *wborder[2],
0161              mdi_text[2],
0162              menubar[TOTAL_SHADES+1],
0163              highlight[TOTAL_SHADES+1],
0164              focus[TOTAL_SHADES+1],
0165              menu[TOTAL_SHADES+1],
0166              *check_radio;
0167 } QtCPalette;
0168 
0169 extern QtCPalette qtcPalette;
0170 extern Options opts;
0171 extern QtData qtSettings;
0172 
0173 bool qtSettingsInit();
0174 void qtSettingsSetColors(GtkStyle *style, GtkRcStyle *rc_style);
0175 
0176 }
0177 
0178 #endif