1 /*******************************************************************************
2 *                         Goggles Music Manager                                *
3 ********************************************************************************
4 *           Copyright (C) 2006-2021 by Sander Jansen. All Rights Reserved      *
5 *                               ---                                            *
6 * This program is free software: you can redistribute it and/or modify         *
7 * it under the terms of the GNU General Public License as published by         *
8 * the Free Software Foundation, either version 3 of the License, or            *
9 * (at your option) any later version.                                          *
10 *                                                                              *
11 * This program is distributed in the hope that it will be useful,              *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of               *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                *
14 * GNU General Public License for more details.                                 *
15 *                                                                              *
16 * You should have received a copy of the GNU General Public License            *
17 * along with this program.  If not, see http://www.gnu.org/licenses.           *
18 ********************************************************************************/
19 #ifndef GMICONTHEME_H
20 #define GMICONTHEME_H
21 
22 struct GMIconSet {
23   FXString name;
24   FXString dir;
25   FXString small;
26   FXString medium;
27   FXString large;
28   void load(FXStream & store);
29   void save(FXStream & store);
30   };
31 
32 typedef FXArray<GMIconSet> GMIconSetList;
33 
34 class GMIconTheme {
35 private:
36   FXApp * app;
37 private:
38   GMIconSetList iconsets;
39   FXStringList  basedirs;
40   FXint         set;
41   FXint         smallsize;
42   FXint         mediumsize;
43   FXint         largesize;
44   FXbool        rsvg;
45 protected:
46   FXIcon  * loadIcon(const FXString & filename);
47   FXImage * loadImage(const FXString & filename);
48 protected:
49   void loadIcon(FXIconPtr & icon,const FXString &pathlist,FXint size,const char * value,const FXColor blend);
50   void loadResource(FXIconPtr & icon,const void * data,const FXColor blend,const char * type="png");
51 protected:
52   FXbool load_cache();
53   void   save_cache();
54   void   build();
55   FXString get_svg_cache();
56   void clear_svg_cache();
57 public:
58   FXIconPtr icon_applogo;
59   FXIconPtr icon_applogo_small;
60 public:
61   FXIconPtr icon_play;
62   FXIconPtr icon_pause;
63   FXIconPtr icon_stop;
64   FXIconPtr icon_next;
65   FXIconPtr icon_prev;
66   FXIconPtr icon_play_toolbar;
67   FXIconPtr icon_pause_toolbar;
68   FXIconPtr icon_stop_toolbar;
69   FXIconPtr icon_next_toolbar;
70   FXIconPtr icon_prev_toolbar;
71   FXIconPtr icon_copy;
72   FXIconPtr icon_cut;
73   FXIconPtr icon_paste;
74   FXIconPtr icon_exit;
75   FXIconPtr icon_close;
76   FXIconPtr icon_settings;
77   FXIconPtr icon_import;
78   FXIconPtr icon_delete;
79   FXIconPtr icon_edit;
80   FXIconPtr icon_undo;
81   FXIconPtr icon_info;
82   FXIconPtr icon_sort;
83   FXIconPtr icon_album;
84   FXIconPtr icon_artist;
85   FXIconPtr icon_genre;
86   FXIconPtr icon_source_library;
87   FXIconPtr icon_source_playlist;
88   FXIconPtr icon_source_playqueue;
89   FXIconPtr icon_source_local;
90   FXIconPtr icon_source_internetradio;
91   FXIconPtr icon_source_podcast;
92   FXIconPtr icon_podcast;
93   FXIconPtr icon_playqueue;
94   FXIconPtr icon_volume_high;
95   FXIconPtr icon_volume_medium;
96   FXIconPtr icon_volume_low;
97   FXIconPtr icon_volume_muted;
98   FXIconPtr icon_volume_high_toolbar;
99   FXIconPtr icon_volume_medium_toolbar;
100   FXIconPtr icon_volume_low_toolbar;
101   FXIconPtr icon_volume_muted_toolbar;
102   FXIconPtr icon_export;
103   FXIconPtr icon_find;
104   FXIconPtr icon_sync;
105   FXIconPtr icon_nocover;
106   FXIconPtr icon_customize;
107   FXIconPtr icon_document;
108   FXIconPtr icon_create;
109   FXIconPtr icon_media;
110   FXIconPtr icon_home;
111   FXIconPtr icon_file_small;
112   FXIconPtr icon_file_big;
113   FXIconPtr icon_audio_small;
114   FXIconPtr icon_audio_big;
115   FXIconPtr icon_folder_open_small;
116   FXIconPtr icon_folder_small;
117   FXIconPtr icon_folder_big;
118   FXIconPtr icon_image_small;
119   FXIconPtr icon_image_big;
120   FXIconPtr icon_progress;
121   FXIconPtr icon_localcopy;
122   FXIconPtr icon_download;
123   FXIconPtr icon_error;
124   FXIconPtr icon_add;
125   FXIconPtr icon_remove;
126 public:
127   FXCursorPtr cursor_hand;
128 private:
129   static GMIconTheme * me;
130 public:
131   static GMIconTheme * instance();
132 public:
133   GMIconTheme(FXApp * app);
134 
135   void loadSmall(FXIconPtr & icon,const char * value,const FXColor blend);
136 
137   void loadMedium(FXIconPtr & icon,const char * value,const FXColor blend);
138 
139   void loadLarge(FXIconPtr & icon,const char * value,const FXColor blend);
140 
141   FXImage * loadSmall(const char * value);
142 
getSmallSize()143   FXint getSmallSize() const { return smallsize; }
144 
getMediumSize()145   FXint getMediumSize() const { return mediumsize; }
146 
getLargeSize()147   FXint getLargeSize() const { return largesize; }
148 
149   FXint getNumThemes() const;
150 
151   void setCurrentTheme(FXint i);
152 
153   FXint getCurrentTheme() const;
154 
155   FXString getThemeName(FXint i);
156 
157   void load();
158 
159   void loadExternal();
160 
161   void loadInternal();
162 
163   ~GMIconTheme();
164   };
165 
166 extern void gm_set_application_icon(FXWindow*);
167 
168 
169 #endif
170 
171