wxruby3-mdap 1.0.0.pre.rc.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,480 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+
6
+ module Wx
7
+
8
+ # Namespace for Material Design Art Provider elements.
9
+ module MDAP
10
+
11
+ # @api private
12
+ class << self
13
+
14
+ private
15
+
16
+ # private registry for collected art clients and their art
17
+ def art_registry
18
+ @art_registry ||= {}
19
+ end
20
+
21
+ # check the private registry for availability of art for given client and art ids
22
+ def get_art(client_id, art_id)
23
+ return nil unless art_registry.has_key?(client_id)
24
+ art_registry[client_id][:art][art_id]
25
+ end
26
+
27
+ # private registry mapping art client groups (FLUENT_UI, FONT_AWESOME etc.) to client ids
28
+ def art_client_groups
29
+ @art_client_groups ||= {}
30
+ end
31
+
32
+ # Base Art mapper class
33
+ # Art mapper classes are used for the mapping standard wxRuby3 Art (Client) ids to
34
+ # Material Design ids
35
+ # @api private
36
+ class ArtMapper
37
+ def get_art(_client_id, _art_id)
38
+ nil
39
+ end
40
+
41
+ class << self
42
+ def null_mapper
43
+ @null_mapper ||= ArtMapper.new
44
+ end
45
+ end
46
+ end
47
+
48
+ # Toplevel standard art mapper
49
+ # @api private
50
+ class StdArtMapper < ArtMapper
51
+
52
+ def initialize
53
+ @map = {}
54
+ end
55
+
56
+ def get_mapper(client_id)
57
+ @map[client_id] || ArtMapper.null_mapper
58
+ end
59
+
60
+ def get_art(client_id, art_id)
61
+ (@map[client_id] || ArtMapper.null_mapper).get_art(client_id, art_id)
62
+ end
63
+
64
+ def self.create(&block)
65
+ std_mapper = StdArtMapper.new
66
+ std_mapper.instance_eval(&block) if block_given?
67
+ std_mapper
68
+ end
69
+
70
+ private
71
+
72
+ def map_art(for_client: , &block)
73
+ @map[for_client] = ArtClientIdMapMapper.create(self, &block)
74
+ end
75
+
76
+ def redirect_art(for_client:, to_client:, &block)
77
+ @map[for_client] = ArtClientRedirectMapper.create(self, to_client, &block)
78
+ end
79
+
80
+ end
81
+
82
+ # A mapper that refers standard art ids to specific Material Design art ids
83
+ # (for a specific Material Design client id)
84
+ # @api private
85
+ class ArtClientIdMapMapper < ArtMapper
86
+ def initialize(base)
87
+ @base = base
88
+ @id_map = ::Hash.new(ArtMapper.null_mapper) #.merge!(id_map)
89
+ end
90
+
91
+ def get_art(client_id, art_id)
92
+ @id_map[art_id].get_art(client_id, art_id)
93
+ end
94
+
95
+ def self.create(base, &block)
96
+ client_mapper = ArtClientIdMapMapper.new(base)
97
+ client_mapper.instance_eval(&block) if block_given?
98
+ client_mapper
99
+ end
100
+
101
+ protected
102
+
103
+ def map_art_id(from_art:, to_art:, to_client: nil)
104
+ @id_map[from_art] = ArtIdAlternateMapper.new(@base, to_art, to_client)
105
+ end
106
+
107
+ end
108
+
109
+ # A mapper that refers a single standard art id to a specific Material Design art id
110
+ # @api private
111
+ class ArtIdAlternateMapper < ArtMapper
112
+ def initialize(base, art_id, client_id=nil)
113
+ @base = base
114
+ @art_id = art_id
115
+ @client_id = client_id
116
+ end
117
+
118
+ def get_art(client_id, _art_id)
119
+ Wx::MDAP.__send__(:get_art, @client_id || client_id, @art_id)
120
+ end
121
+ end
122
+
123
+ # A mapper that redirects mapping for a Material Design client to the mapper for another
124
+ # Material Design client (with the option of overriding partially)
125
+ # @api private
126
+ class ArtClientRedirectMapper < ArtClientIdMapMapper
127
+ def initialize(base, tgt_client_id)
128
+ super(base)
129
+ @tgt_client_id = tgt_client_id
130
+ end
131
+
132
+ def get_art(client_id, art_id)
133
+ super ||
134
+ @base.get_mapper(@tgt_client_id).get_art(client_id, art_id) ||
135
+ @base.get_mapper(@tgt_client_id).get_art(@tgt_client_id, art_id)
136
+ end
137
+
138
+ def self.create(base, tgt_client, &block)
139
+ client_redirector = ArtClientRedirectMapper.new(base, tgt_client)
140
+ client_redirector.instance_eval(&block) if block_given?
141
+ client_redirector
142
+ end
143
+
144
+ end
145
+
146
+ # Returns the standard wxRuby3 Art mappings
147
+ def std_mapper
148
+ @std_mapper ||= StdArtMapper.create do
149
+ map_art for_client: Wx::MDAP::ART_FLUENT_UI_FILLED do
150
+ map_art_id from_art: Wx::ART_ERROR, to_art: Wx::MDAP::ART_ERROR_CIRCLE
151
+ map_art_id from_art: Wx::ART_QUESTION, to_art: Wx::MDAP::ART_QUESTION
152
+ map_art_id from_art: Wx::ART_WARNING, to_art: Wx::MDAP::ART_WARNING
153
+ map_art_id from_art: Wx::ART_INFORMATION, to_art: Wx::MDAP::ART_INFO
154
+ map_art_id from_art: Wx::ART_ADD_BOOKMARK, to_art: Wx::MDAP::ART_BOOKMARK_ADD
155
+ map_art_id from_art: Wx::ART_DEL_BOOKMARK, to_art: Wx::MDAP::ART_BOOKMARK_OFF
156
+ map_art_id from_art: Wx::ART_HELP_SIDE_PANEL, to_art: Wx::MDAP::ART_PANEL_LEFT_TEXT
157
+ map_art_id from_art: Wx::ART_HELP_SETTINGS, to_art: Wx::MDAP::ART_SETTINGS
158
+ map_art_id from_art: Wx::ART_HELP_BOOK, to_art: Wx::MDAP::ART_BOOK
159
+ map_art_id from_art: Wx::ART_HELP_FOLDER, to_art: Wx::MDAP::ART_BOOK_OPEN
160
+ map_art_id from_art: Wx::ART_HELP_PAGE, to_art: Wx::MDAP::ART_DOCUMENT
161
+ map_art_id from_art: Wx::ART_GO_BACK, to_art: Wx::MDAP::ART_ARROW_LEFT
162
+ map_art_id from_art: Wx::ART_GO_FORWARD, to_art: Wx::MDAP::ART_ARROW_RIGHT
163
+ map_art_id from_art: Wx::ART_GO_UP, to_art: Wx::MDAP::ART_ARROW_UP
164
+ map_art_id from_art: Wx::ART_GO_DOWN, to_art: Wx::MDAP::ART_ARROW_DOWN
165
+ map_art_id from_art: Wx::ART_GO_TO_PARENT, to_art: Wx::MDAP::ART_ARROW_TURN_UP_LEFT
166
+ map_art_id from_art: Wx::ART_GO_HOME, to_art: Wx::MDAP::ART_HOME
167
+ map_art_id from_art: Wx::ART_GOTO_FIRST, to_art: Wx::MDAP::ART_ARROW_PREVIOUS
168
+ map_art_id from_art: Wx::ART_GOTO_LAST, to_art: Wx::MDAP::ART_ARROW_NEXT
169
+ map_art_id from_art: Wx::ART_PRINT, to_art: Wx::MDAP::ART_PRINT
170
+ map_art_id from_art: Wx::ART_HELP, to_art: Wx::MDAP::ART_QUESTION_CIRCLE
171
+ map_art_id from_art: Wx::ART_TIP, to_art: Wx::MDAP::ART_LIGHTBULB
172
+ map_art_id from_art: Wx::ART_REPORT_VIEW, to_art: Wx::MDAP::ART_CONTENT_VIEW
173
+ map_art_id from_art: Wx::ART_LIST_VIEW, to_art: Wx::MDAP::ART_TEXT_BULLET_LIST_SQUARE
174
+ map_art_id from_art: Wx::ART_NEW_DIR, to_art: Wx::MDAP::ART_FOLDER_ADD
175
+ map_art_id from_art: Wx::ART_FOLDER, to_art: Wx::MDAP::ART_FOLDER
176
+ map_art_id from_art: Wx::ART_FOLDER_OPEN, to_art: Wx::MDAP::ART_FOLDER_OPEN
177
+ map_art_id from_art: Wx::ART_GO_DIR_UP, to_art: Wx::MDAP::ART_FOLDER_ARROW_UP
178
+ map_art_id from_art: Wx::ART_EXECUTABLE_FILE, to_art: Wx::MDAP::ART_SETTINGS_COG_MULTIPLE
179
+ map_art_id from_art: Wx::ART_NORMAL_FILE, to_art: Wx::MDAP::ART_DOCUMENT
180
+ map_art_id from_art: Wx::ART_TICK_MARK, to_art: Wx::MDAP::ART_CHECKMARK
181
+ map_art_id from_art: Wx::ART_CROSS_MARK, to_art: Wx::MDAP::ART_DISMISS
182
+ map_art_id from_art: Wx::ART_MISSING_IMAGE, to_art: Wx::MDAP::ART_IMAGE_OFF
183
+ map_art_id from_art: Wx::ART_NEW, to_art: Wx::MDAP::ART_DOCUMENT_ADD
184
+ map_art_id from_art: Wx::ART_FILE_OPEN, to_art: Wx::MDAP::ART_DOCUMENT_FOLDER
185
+ map_art_id from_art: Wx::ART_FILE_SAVE, to_art: Wx::MDAP::ART_SAVE
186
+ map_art_id from_art: Wx::ART_FILE_SAVE_AS, to_art: Wx::MDAP::ART_SAVE_EDIT
187
+ map_art_id from_art: Wx::ART_DELETE, to_art: Wx::MDAP::ART_DELETE
188
+ map_art_id from_art: Wx::ART_COPY, to_art: Wx::MDAP::ART_COPY
189
+ map_art_id from_art: Wx::ART_CUT, to_art: Wx::MDAP::ART_CUT
190
+ map_art_id from_art: Wx::ART_PASTE, to_art: Wx::MDAP::ART_CLIPBOARD_PASTE
191
+ map_art_id from_art: Wx::ART_UNDO, to_art: Wx::MDAP::ART_ARROW_UNDO
192
+ map_art_id from_art: Wx::ART_REDO, to_art: Wx::MDAP::ART_ARROW_UNDO_TEMP_RTL
193
+ map_art_id from_art: Wx::ART_PLUS, to_art: Wx::MDAP::ART_ADD
194
+ map_art_id from_art: Wx::ART_MINUS, to_art: Wx::MDAP::ART_SUBTRACT
195
+ map_art_id from_art: Wx::ART_CLOSE, to_art: Wx::MDAP::ART_DISMISS_CIRCLE
196
+ map_art_id from_art: Wx::ART_QUIT, to_art: Wx::MDAP::ART_ARROW_EXIT
197
+ map_art_id from_art: Wx::ART_FIND, to_art: Wx::MDAP::ART_SEARCH
198
+ map_art_id from_art: Wx::ART_FIND_AND_REPLACE, to_art: Wx::MDAP::ART_FIND_REPLACE, to_client: Wx::MDAP::ART_MATERIAL_DESIGN_FILLED
199
+ map_art_id from_art: Wx::ART_FULL_SCREEN, to_art: Wx::MDAP::ART_FULL_SCREEN_MAXIMIZE
200
+ map_art_id from_art: Wx::ART_EDIT, to_art: Wx::MDAP::ART_EDIT
201
+ map_art_id from_art: Wx::ART_HARDDISK, to_art: Wx::MDAP::ART_HARD_DRIVE
202
+ map_art_id from_art: Wx::ART_FLOPPY, to_art: Wx::MDAP::ART_SAVE
203
+ map_art_id from_art: Wx::ART_CDROM, to_art: Wx::MDAP::ART_CD
204
+ map_art_id from_art: Wx::ART_REMOVABLE, to_art: Wx::MDAP::ART_PLUG_DISCONNECTED
205
+ map_art_id from_art: Wx::ART_STOP, to_art: Wx::MDAP::ART_STOP
206
+ map_art_id from_art: Wx::ART_REFRESH, to_art: Wx::MDAP::ART_ARROW_SYNC
207
+ end
208
+
209
+ redirect_art for_client: Wx::MDAP::ART_FLUENT_UI_REGULAR, to_client: Wx::MDAP::ART_FLUENT_UI_FILLED
210
+
211
+ map_art for_client: Wx::MDAP::ART_MATERIAL_DESIGN_FILLED do
212
+ map_art_id from_art: Wx::ART_ERROR, to_art: Wx::MDAP::ART_ERROR
213
+ map_art_id from_art: Wx::ART_QUESTION, to_art: Wx::MDAP::ART_QUESTION_MARK
214
+ map_art_id from_art: Wx::ART_WARNING, to_art: Wx::MDAP::ART_WARNING
215
+ map_art_id from_art: Wx::ART_INFORMATION, to_art: Wx::MDAP::ART_INFO
216
+ map_art_id from_art: Wx::ART_ADD_BOOKMARK, to_art: Wx::MDAP::ART_BOOKMARK_ADD
217
+ map_art_id from_art: Wx::ART_DEL_BOOKMARK, to_art: Wx::MDAP::ART_BOOKMARK_REMOVE
218
+ map_art_id from_art: Wx::ART_HELP_SIDE_PANEL, to_art: Wx::MDAP::ART_VERTICAL_SPLIT
219
+ map_art_id from_art: Wx::ART_HELP_SETTINGS, to_art: Wx::MDAP::ART_SETTINGS
220
+ map_art_id from_art: Wx::ART_HELP_BOOK, to_art: Wx::MDAP::ART_BOOK
221
+ map_art_id from_art: Wx::ART_HELP_FOLDER, to_art: Wx::MDAP::ART_FOLDER
222
+ map_art_id from_art: Wx::ART_HELP_PAGE, to_art: Wx::MDAP::ART_TEXT_SNIPPET
223
+ map_art_id from_art: Wx::ART_GO_BACK, to_art: Wx::MDAP::ART_KEYBOARD_ARROW_LEFT
224
+ map_art_id from_art: Wx::ART_GO_FORWARD, to_art: Wx::MDAP::ART_KEYBOARD_ARROW_RIGHT
225
+ map_art_id from_art: Wx::ART_GO_UP, to_art: Wx::MDAP::ART_KEYBOARD_ARROW_UP
226
+ map_art_id from_art: Wx::ART_GO_DOWN, to_art: Wx::MDAP::ART_KEYBOARD_ARROW_DOWN
227
+ map_art_id from_art: Wx::ART_GO_TO_PARENT, to_art: Wx::MDAP::ART_REPLAY
228
+ map_art_id from_art: Wx::ART_GO_HOME, to_art: Wx::MDAP::ART_HOME
229
+ map_art_id from_art: Wx::ART_GOTO_FIRST, to_art: Wx::MDAP::ART_FIRST_PAGE
230
+ map_art_id from_art: Wx::ART_GOTO_LAST, to_art: Wx::MDAP::ART_LAST_PAGE
231
+ map_art_id from_art: Wx::ART_PRINT, to_art: Wx::MDAP::ART_PRINT
232
+ map_art_id from_art: Wx::ART_HELP, to_art: Wx::MDAP::ART_HELP
233
+ map_art_id from_art: Wx::ART_TIP, to_art: Wx::MDAP::ART_LIGHTBULB
234
+ map_art_id from_art: Wx::ART_REPORT_VIEW, to_art: Wx::MDAP::ART_WYSIWYG
235
+ map_art_id from_art: Wx::ART_LIST_VIEW, to_art: Wx::MDAP::ART_VIEW_LIST
236
+ map_art_id from_art: Wx::ART_NEW_DIR, to_art: Wx::MDAP::ART_CREATE_NEW_FOLDER
237
+ map_art_id from_art: Wx::ART_FOLDER, to_art: Wx::MDAP::ART_FOLDER
238
+ map_art_id from_art: Wx::ART_FOLDER_OPEN, to_art: Wx::MDAP::ART_FOLDER_OPEN
239
+ map_art_id from_art: Wx::ART_GO_DIR_UP, to_art: Wx::MDAP::ART_DRIVE_FOLDER_UPLOAD
240
+ map_art_id from_art: Wx::ART_EXECUTABLE_FILE, to_art: Wx::MDAP::ART_MISCELLANEOUS_SERVICES
241
+ map_art_id from_art: Wx::ART_NORMAL_FILE, to_art: Wx::MDAP::ART_INSERT_DRIVE_FILE
242
+ map_art_id from_art: Wx::ART_TICK_MARK, to_art: Wx::MDAP::ART_CHECK
243
+ map_art_id from_art: Wx::ART_CROSS_MARK, to_art: Wx::MDAP::ART_CLEAR
244
+ map_art_id from_art: Wx::ART_MISSING_IMAGE, to_art: Wx::MDAP::ART_IMAGE_NOT_SUPPORTED
245
+ map_art_id from_art: Wx::ART_NEW, to_art: Wx::MDAP::ART_NOTE_ADD
246
+ map_art_id from_art: Wx::ART_FILE_OPEN, to_art: Wx::MDAP::ART_FILE_OPEN
247
+ map_art_id from_art: Wx::ART_FILE_SAVE, to_art: Wx::MDAP::ART_SAVE
248
+ map_art_id from_art: Wx::ART_FILE_SAVE_AS, to_art: Wx::MDAP::ART_SAVE_AS
249
+ map_art_id from_art: Wx::ART_DELETE, to_art: Wx::MDAP::ART_DELETE
250
+ map_art_id from_art: Wx::ART_COPY, to_art: Wx::MDAP::ART_CONTENT_COPY
251
+ map_art_id from_art: Wx::ART_CUT, to_art: Wx::MDAP::ART_CONTENT_CUT
252
+ map_art_id from_art: Wx::ART_PASTE, to_art: Wx::MDAP::ART_CONTENT_PASTE
253
+ map_art_id from_art: Wx::ART_UNDO, to_art: Wx::MDAP::ART_UNDO
254
+ map_art_id from_art: Wx::ART_REDO, to_art: Wx::MDAP::ART_REDO
255
+ map_art_id from_art: Wx::ART_PLUS, to_art: Wx::MDAP::ART_ADD
256
+ map_art_id from_art: Wx::ART_MINUS, to_art: Wx::MDAP::ART_REMOVE
257
+ map_art_id from_art: Wx::ART_CLOSE, to_art: Wx::MDAP::ART_CANCEL
258
+ map_art_id from_art: Wx::ART_QUIT, to_art: Wx::MDAP::ART_EXIT_TO_APP
259
+ map_art_id from_art: Wx::ART_FIND, to_art: Wx::MDAP::ART_SEARCH
260
+ map_art_id from_art: Wx::ART_FIND_AND_REPLACE, to_art: Wx::MDAP::ART_FIND_REPLACE
261
+ map_art_id from_art: Wx::ART_FULL_SCREEN, to_art: Wx::MDAP::ART_FULLSCREEN
262
+ map_art_id from_art: Wx::ART_EDIT, to_art: Wx::MDAP::ART_EDIT
263
+ map_art_id from_art: Wx::ART_HARDDISK, to_art: Wx::MDAP::ART_HARD_DRIVE, to_client: Wx::MDAP::ART_FLUENT_UI_FILLED
264
+ map_art_id from_art: Wx::ART_FLOPPY, to_art: Wx::MDAP::ART_SAVE
265
+ map_art_id from_art: Wx::ART_CDROM, to_art: Wx::MDAP::ART_CD, to_client: Wx::MDAP::ART_FLUENT_UI_FILLED
266
+ map_art_id from_art: Wx::ART_REMOVABLE, to_art: Wx::MDAP::ART_PLUG_DISCONNECTED, to_client: Wx::MDAP::ART_FLUENT_UI_FILLED
267
+ map_art_id from_art: Wx::ART_STOP, to_art: Wx::MDAP::ART_STOP
268
+ map_art_id from_art: Wx::ART_REFRESH, to_art: Wx::MDAP::ART_SYNC
269
+ end
270
+
271
+ redirect_art for_client: Wx::MDAP::ART_MATERIAL_DESIGN_OUTLINED, to_client: Wx::MDAP::ART_MATERIAL_DESIGN_FILLED do
272
+ map_art_id from_art: Wx::ART_HARDDISK, to_art: Wx::MDAP::ART_HARD_DRIVE, to_client: Wx::MDAP::ART_FLUENT_UI_REGULAR
273
+ map_art_id from_art: Wx::ART_REMOVABLE, to_art: Wx::MDAP::ART_PLUG_DISCONNECTED, to_client: Wx::MDAP::ART_FLUENT_UI_REGULAR
274
+ end
275
+
276
+ redirect_art for_client: Wx::MDAP::ART_MATERIAL_DESIGN_ROUND, to_client: Wx::MDAP::ART_MATERIAL_DESIGN_FILLED
277
+
278
+ redirect_art for_client: Wx::MDAP::ART_MATERIAL_DESIGN_SHARP, to_client: Wx::MDAP::ART_MATERIAL_DESIGN_FILLED
279
+
280
+ redirect_art for_client: Wx::MDAP::ART_MATERIAL_DESIGN_TWO_TONE, to_client: Wx::MDAP::ART_MATERIAL_DESIGN_FILLED do
281
+ map_art_id from_art: Wx::ART_HARDDISK, to_art: Wx::MDAP::ART_HARD_DRIVE, to_client: Wx::MDAP::ART_FLUENT_UI_REGULAR
282
+ map_art_id from_art: Wx::ART_REMOVABLE, to_art: Wx::MDAP::ART_PLUG_DISCONNECTED, to_client: Wx::MDAP::ART_FLUENT_UI_REGULAR
283
+ end
284
+
285
+ map_art for_client: Wx::MDAP::ART_FONT_AWESOME_SOLID do
286
+ map_art_id from_art: Wx::ART_ERROR, to_art: Wx::MDAP::ART_CIRCLE_EXCLAMATION
287
+ map_art_id from_art: Wx::ART_QUESTION, to_art: Wx::MDAP::ART_QUESTION
288
+ map_art_id from_art: Wx::ART_WARNING, to_art: Wx::MDAP::ART_TRIANGLE_EXCLAMATION
289
+ map_art_id from_art: Wx::ART_INFORMATION, to_art: Wx::MDAP::ART_CIRCLE_INFO
290
+ map_art_id from_art: Wx::ART_ADD_BOOKMARK, to_art: Wx::MDAP::ART_BOOKMARK_ADD, to_client: Wx::MDAP::ART_FLUENT_UI_FILLED
291
+ map_art_id from_art: Wx::ART_DEL_BOOKMARK, to_art: Wx::MDAP::ART_BOOKMARK_OFF, to_client: Wx::MDAP::ART_FLUENT_UI_FILLED
292
+ map_art_id from_art: Wx::ART_HELP_SIDE_PANEL, to_art: Wx::MDAP::ART_PANEL_LEFT_TEXT, to_client: Wx::MDAP::ART_FLUENT_UI_FILLED
293
+ map_art_id from_art: Wx::ART_HELP_SETTINGS, to_art: Wx::MDAP::ART_SETTINGS, to_client: Wx::MDAP::ART_FLUENT_UI_FILLED
294
+ map_art_id from_art: Wx::ART_HELP_BOOK, to_art: Wx::MDAP::ART_BOOK
295
+ map_art_id from_art: Wx::ART_HELP_FOLDER, to_art: Wx::MDAP::ART_FOLDER
296
+ map_art_id from_art: Wx::ART_HELP_PAGE, to_art: Wx::MDAP::ART_FILE_LINES
297
+ map_art_id from_art: Wx::ART_GO_BACK, to_art: Wx::MDAP::ART_ANGLE_LEFT
298
+ map_art_id from_art: Wx::ART_GO_FORWARD, to_art: Wx::MDAP::ART_ANGLE_RIGHT
299
+ map_art_id from_art: Wx::ART_GO_UP, to_art: Wx::MDAP::ART_ANGLE_UP
300
+ map_art_id from_art: Wx::ART_GO_DOWN, to_art: Wx::MDAP::ART_ANGLE_DOWN
301
+ map_art_id from_art: Wx::ART_GO_TO_PARENT, to_art: Wx::MDAP::ART_ARROW_TURN_UP
302
+ map_art_id from_art: Wx::ART_GO_HOME, to_art: Wx::MDAP::ART_HOUSE
303
+ map_art_id from_art: Wx::ART_GOTO_FIRST, to_art: Wx::MDAP::ART_ANGLES_LEFT
304
+ map_art_id from_art: Wx::ART_GOTO_LAST, to_art: Wx::MDAP::ART_ANGLES_RIGHT
305
+ map_art_id from_art: Wx::ART_PRINT, to_art: Wx::MDAP::ART_PRINT
306
+ map_art_id from_art: Wx::ART_HELP, to_art: Wx::MDAP::ART_CIRCLE_QUESTION
307
+ map_art_id from_art: Wx::ART_TIP, to_art: Wx::MDAP::ART_LIGHTBULB
308
+ map_art_id from_art: Wx::ART_REPORT_VIEW, to_art: Wx::MDAP::ART_TABLE_COLUMNS
309
+ map_art_id from_art: Wx::ART_LIST_VIEW, to_art: Wx::MDAP::ART_TABLE_LIST
310
+ map_art_id from_art: Wx::ART_NEW_DIR, to_art: Wx::MDAP::ART_FOLDER_PLUS
311
+ map_art_id from_art: Wx::ART_FOLDER, to_art: Wx::MDAP::ART_FOLDER
312
+ map_art_id from_art: Wx::ART_FOLDER_OPEN, to_art: Wx::MDAP::ART_FOLDER_OPEN
313
+ map_art_id from_art: Wx::ART_GO_DIR_UP, to_art: Wx::MDAP::ART_ARROW_TURN_UP
314
+ map_art_id from_art: Wx::ART_EXECUTABLE_FILE, to_art: Wx::MDAP::ART_GEARS
315
+ map_art_id from_art: Wx::ART_NORMAL_FILE, to_art: Wx::MDAP::ART_FILE
316
+ map_art_id from_art: Wx::ART_TICK_MARK, to_art: Wx::MDAP::ART_CHECK
317
+ map_art_id from_art: Wx::ART_CROSS_MARK, to_art: Wx::MDAP::ART_XMARK
318
+ map_art_id from_art: Wx::ART_MISSING_IMAGE, to_art: Wx::MDAP::ART_RECTANGLE_XMARK
319
+ map_art_id from_art: Wx::ART_NEW, to_art: Wx::MDAP::ART_FILE_CIRCLE_PLUS
320
+ map_art_id from_art: Wx::ART_FILE_OPEN, to_art: Wx::MDAP::ART_FILE_ARROW_UP
321
+ map_art_id from_art: Wx::ART_FILE_SAVE, to_art: Wx::MDAP::ART_FILE_ARROW_DOWN
322
+ map_art_id from_art: Wx::ART_FILE_SAVE_AS, to_art: Wx::MDAP::ART_FILE_PEN
323
+ map_art_id from_art: Wx::ART_DELETE, to_art: Wx::MDAP::ART_TRASH_CAN
324
+ map_art_id from_art: Wx::ART_COPY, to_art: Wx::MDAP::ART_COPY
325
+ map_art_id from_art: Wx::ART_CUT, to_art: Wx::MDAP::ART_SCISSORS
326
+ map_art_id from_art: Wx::ART_PASTE, to_art: Wx::MDAP::ART_PASTE
327
+ map_art_id from_art: Wx::ART_UNDO, to_art: Wx::MDAP::ART_ARROW_ROTATE_LEFT
328
+ map_art_id from_art: Wx::ART_REDO, to_art: Wx::MDAP::ART_ARROW_ROTATE_RIGHT
329
+ map_art_id from_art: Wx::ART_PLUS, to_art: Wx::MDAP::ART_PLUS
330
+ map_art_id from_art: Wx::ART_MINUS, to_art: Wx::MDAP::ART_MINUS
331
+ map_art_id from_art: Wx::ART_CLOSE, to_art: Wx::MDAP::ART_CIRCLE_XMARK
332
+ map_art_id from_art: Wx::ART_QUIT, to_art: Wx::MDAP::ART_ARROW_RIGHT_FROM_BRACKET
333
+ map_art_id from_art: Wx::ART_FIND, to_art: Wx::MDAP::ART_MAGNIFYING_GLASS
334
+ map_art_id from_art: Wx::ART_FIND_AND_REPLACE, to_art: Wx::MDAP::ART_FIND_REPLACE, to_client: Wx::MDAP::ART_MATERIAL_DESIGN_FILLED
335
+ map_art_id from_art: Wx::ART_FULL_SCREEN, to_art: Wx::MDAP::ART_EXPAND
336
+ map_art_id from_art: Wx::ART_EDIT, to_art: Wx::MDAP::ART_PEN
337
+ map_art_id from_art: Wx::ART_HARDDISK, to_art: Wx::MDAP::ART_HARD_DRIVE
338
+ map_art_id from_art: Wx::ART_FLOPPY, to_art: Wx::MDAP::ART_FLOPPY_DISK
339
+ map_art_id from_art: Wx::ART_CDROM, to_art: Wx::MDAP::ART_CD, to_client: Wx::MDAP::ART_FLUENT_UI_FILLED
340
+ map_art_id from_art: Wx::ART_REMOVABLE, to_art: Wx::MDAP::ART_PLUG
341
+ map_art_id from_art: Wx::ART_STOP, to_art: Wx::MDAP::ART_STOP
342
+ map_art_id from_art: Wx::ART_REFRESH, to_art: Wx::MDAP::ART_ARROWS_ROTATE
343
+ end
344
+
345
+ redirect_art for_client: Wx::MDAP::ART_FONT_AWESOME_REGULAR, to_client: Wx::MDAP::ART_FONT_AWESOME_SOLID do
346
+ map_art_id from_art: Wx::ART_ADD_BOOKMARK, to_art: Wx::MDAP::ART_BOOKMARK_ADD, to_client: Wx::MDAP::ART_FLUENT_UI_REGULAR
347
+ map_art_id from_art: Wx::ART_DEL_BOOKMARK, to_art: Wx::MDAP::ART_BOOKMARK_REMOVE, to_client: Wx::MDAP::ART_FLUENT_UI_REGULAR
348
+ map_art_id from_art: Wx::ART_HELP_SIDE_PANEL, to_art: Wx::MDAP::ART_PANEL_LEFT_TEXT, to_client: Wx::MDAP::ART_FLUENT_UI_REGULAR
349
+ map_art_id from_art: Wx::ART_HELP_SETTINGS, to_art: Wx::MDAP::ART_SETTINGS, to_client: Wx::MDAP::ART_FLUENT_UI_REGULAR
350
+ map_art_id from_art: Wx::ART_FIND_AND_REPLACE, to_art: Wx::MDAP::ART_FIND_REPLACE, to_client: Wx::MDAP::ART_MATERIAL_DESIGN_OUTLINED
351
+ map_art_id from_art: Wx::ART_CDROM, to_art: Wx::MDAP::ART_CD, to_client: Wx::MDAP::ART_FLUENT_UI_REGULAR
352
+ end
353
+ end
354
+ end
355
+
356
+ # Collects art from the given collection and auto-creates art client ids and art ids.
357
+ # Registers all art for later retrieval.
358
+ # @param [String] collection name of art collection (folder)
359
+ # @return [void]
360
+ def collect_art_for(collection)
361
+ # recursively iterate the folders and files of the `collection` directory
362
+ # and auto-create Art Client Ids and Art Ids
363
+ art_folder = File.directory?(collection) ? File.expand_path(collection) : File.join(__dir__, 'art', collection)
364
+ art_group = File.basename(art_folder, '.*').upcase.gsub('-', '_')
365
+ raise ArgumentError, "Cannot find art folder #{collection}." unless File.directory?(art_folder)
366
+ art_client_groups[art_group] ||= []
367
+ Dir[File.join(art_folder, '*')].each do |art_client_path|
368
+ if File.directory?(art_client_path)
369
+ # does this folder contain SVG files?
370
+ img_list = Dir[File.join(art_client_path, '*.svg')]
371
+ unless img_list.empty?
372
+
373
+ # create ArtClientId constant for this folder and register art client
374
+ art_const = "ART_#{art_group}_#{File.basename(art_client_path, '.*').upcase.gsub('-', '_')}"
375
+ art_client_id = const_set(art_const, "#{art_const}_C")
376
+ art_registry[art_client_id] = { const: art_const.to_sym, art: {} }
377
+ art_client_groups[art_group] << art_const.to_sym
378
+
379
+ # create and register ArtId for each image file
380
+ art_id_registry = art_registry[art_client_id][:art]
381
+ img_list.each do |img_file|
382
+ art_id = "ART_#{File.basename(img_file, '.*').upcase.gsub('-', '_')}"
383
+ const_set(art_id, art_id) unless const_defined?(art_id)
384
+ art_id_registry[art_id] = img_file
385
+ end
386
+
387
+ end
388
+ end
389
+ end
390
+ nil
391
+ end
392
+
393
+ public
394
+
395
+ # @api private
396
+ def get_art_client_group_ids
397
+ art_client_groups.keys
398
+ end
399
+ alias :art_client_group_ids :get_art_client_group_ids
400
+
401
+ # @api private
402
+ def get_art_client_ids_for_group(grp_id)
403
+ art_client_groups[grp_id] || []
404
+ end
405
+ alias :art_client_ids_for_group :get_art_client_ids_for_group
406
+
407
+ # @api private
408
+ def get_art_group_for_client(client)
409
+ grp, _ = art_client_groups.find { |_, grp_clients| grp_clients.include?(client) }
410
+ grp
411
+ end
412
+ alias :art_group_for_client :get_art_group_for_client
413
+
414
+ # @api private
415
+ def get_art_ids_for_group(grp_id)
416
+ get_art_client_ids_for_group(grp_id).inject([]) { |list, sym| list |= get_all_art_ids_for(MDAP.const_get(sym)) }.sort
417
+ end
418
+ alias :art_ids_for_group :get_art_ids_for_group
419
+
420
+ # Returns the image path for the art for the specified client and id
421
+ # @param [String] client art client id
422
+ # @param [String] id art id
423
+ # @return [String] art path
424
+ # @api private
425
+ def get_art_for(client, id)
426
+ # try to resolve exact match
427
+ art_path = get_art(client, id)
428
+ # if not found and this is a standard wxWidgets Art Id try the std mappers
429
+ if art_path.nil? && id.start_with?('wx')
430
+ art_path = std_mapper.get_art(client, id)
431
+ end
432
+ art_path
433
+ end
434
+ alias :art_for :get_art_for
435
+
436
+ # Returns a list op all art client constant names (as symbols).
437
+ # @return [Array<Symbol>] art client constant names
438
+ # @api private
439
+ def get_all_art_clients
440
+ art_registry.values.collect { |clreg| clreg[:const] }
441
+ end
442
+ alias :all_art_clients :get_all_art_clients
443
+
444
+ # Returns a list of all art id constant names (as symbols) for the given art client id
445
+ # @param [String] client Art Client Id
446
+ # @return [Array<Symbol>] art id constant names
447
+ # @api private
448
+ def get_all_art_ids_for(client)
449
+ art_registry.has_key?(client) ? art_registry[client][:art].keys.collect { |art_id| art_id.to_sym } : []
450
+ end
451
+ alias :all_art_ids_for :get_all_art_ids_for
452
+
453
+ # @api private
454
+ def has_art_client_id?(client)
455
+ art_registry.has_key?(client)
456
+ end
457
+
458
+ # @api private
459
+ def has_art_id?(client, id)
460
+ art_registry.has_key?(client) && art_registry[client][:art].has_key?(id)
461
+ end
462
+
463
+ # Returns a list of all Material Design art id constant names (as symbols)
464
+ # @return [Array<Symbol>] art id constant names
465
+ # @api private
466
+ def get_all_art_ids
467
+ art_registry.values.collect { |clreg| clreg[:art].keys.collect { |art_id| art_id.to_sym } }.flatten.uniq
468
+ end
469
+ alias :all_art_ids :get_all_art_ids
470
+
471
+ end
472
+
473
+ collect_art_for('fluent_ui')
474
+ collect_art_for('font_awesome')
475
+ collect_art_for('material_design')
476
+ collect_art_for('simple_icons')
477
+
478
+ end
479
+
480
+ end