21
21
TkCommandNames = ['style'.freeze].freeze
23
23
# --- Tk::Tile::Style.__define_wrapper_proc_for_compatibility__! ---
24
# On Ttk (Tile) extension, 'style' command has imcompatible changes
25
# depend on the version of the extention. It requires modifying the
26
# Tcl/Tk scripts to define local styles. The rule for modification
27
# is a simple one. But, if users want to keep compatibility between
28
# versions of the extension, they will have to contrive to do that.
24
# On Ttk (Tile) extension, 'style' command has imcompatible changes
25
# depend on the version of the extention. It requires modifying the
26
# Tcl/Tk scripts to define local styles. The rule for modification
27
# is a simple one. But, if users want to keep compatibility between
28
# versions of the extension, they will have to contrive to do that.
29
29
# It may be troublesome, especially for Ruby/Tk users.
30
# This method may help such work. This method make some definitions
31
# on the Tcl/Tk interpreter to work with different version of style
32
# command format. Please give attention to use this method. It may
33
# conflict with some definitions on Tcl/Tk scripts.
30
# This method may help such work. This method make some definitions
31
# on the Tcl/Tk interpreter to work with different version of style
32
# command format. Please give attention to use this method. It may
33
# conflict with some definitions on Tcl/Tk scripts.
34
34
if Tk::Tile::TILE_SPEC_VERSION_ID < 7
35
35
def __define_wrapper_proc_for_compatibility__!
36
36
__define_themes_and_setTheme_proc__!
212
212
def lookup(style, opt, state=None, fallback_value=None)
213
tk_call(TkCommandNames[0], 'lookup', style,
213
tk_call(TkCommandNames[0], 'lookup', style,
214
214
'-' << opt.to_s, state, fallback_value)
233
233
def element_create(name, type, *args)
234
234
if type == 'image' || type == :image
235
235
element_create_image(name, *args)
236
elsif type == 'vsapi' || type == :vsapi
237
element_create_vsapi(name, *args)
237
239
tk_call(TkCommandNames[0], 'element', 'create', name, type, *args)
253
255
# probably, command format is tile 0.8+ (Tcl/Tk8.5+) style
254
256
if Tk::Tile::TILE_SPEC_VERSION_ID >= 8
256
tk_call(TkCommandNames[0],
258
tk_call(TkCommandNames[0],
257
259
'element', 'create', name, 'image', spec, opts)
259
261
tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec)
262
264
fail ArgumentError, 'illegal arguments' if opts.key?('map')
263
265
base = spec.shift
264
266
opts['map'] = spec
265
tk_call(TkCommandNames[0],
267
tk_call(TkCommandNames[0],
266
268
'element', 'create', name, 'image', base, opts)
271
273
spec = [spec, *(opts.delete('map'))] if opts.key?('map')
274
tk_call(TkCommandNames[0],
276
tk_call(TkCommandNames[0],
275
277
'element', 'create', name, 'image', spec, opts)
277
279
tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec)
284
def element_create_vsapi(name, class_name, part_id, *args)
285
# supported on Tcl/Tk 8.6 or later
288
if (state_map = args.shift || None)
289
if state_map.kind_of?(Hash)
290
opts = _symbolkey2str(state_map)
294
opts = args.shift || None
295
fail ArgumentError, "too many arguments" unless args.empty?
297
# define a Microsoft Visual Styles element
298
tk_call(TkCommandNames[0], 'element', 'create', name, 'vsapi',
299
class_name, part_id, state_map, opts)
282
302
def element_names()
283
303
list(tk_call(TkCommandNames[0], 'element', 'names'))