Module: TkItemConfigMethod
- Includes:
- TkItemConfigOptkeys, TkTreatItemFont, TkUtil
- Included in:
- Tk::BLT::Busy, Tk::BLT::DnD, Tk::BLT::DragDrop, Tk::BLT::Htext, Tk::BLT::PlotComponent, Tk::BLT::Table, Tk::BLT::Tabset, Tk::BLT::Ted, Tk::BLT::Treeview::ConfigMethod, Tk::BWidget::ButtonBox, Tk::BWidget::Dialog, Tk::BWidget::ListBox, Tk::BWidget::NoteBook, Tk::BWidget::Tree, Tk::Iwidgets::Buttonbox, Tk::Iwidgets::Checkbox, Tk::Iwidgets::Dialogshell, Tk::Iwidgets::Menubar, Tk::Iwidgets::Messagebox, Tk::Iwidgets::Notebook, Tk::Iwidgets::Panedwindow, Tk::Iwidgets::Radiobox, Tk::Iwidgets::Tabnotebook, Tk::Iwidgets::Tabset, Tk::Iwidgets::Toolbar, Tk::Tcllib::TablelistItemConfig, Tk::Tile::TNotebook, Tk::Tile::TreeviewConfig, Tk::TkTable::ConfigMethod, Tk::TreeCtrl::ConfigMethod, Tk::Vu::PieSliceConfigMethod, TkCanvasItemConfig, TkListItemConfig, TkMenuEntryConfig, TkTextTagConfig
- Defined in:
- ext/lib/tk/itemconfig.rb
Constant Summary
Constants included
from TkUtil
TkUtil::None, TkUtil::RELEASE_DATE
Class Method Summary
collapse
Instance Method Summary
collapse
#__conv_item_keyonly_opts, #itemconfig_hash_kv
Methods included from TkUtil
_conv_args, #_conv_args, #_fromUTF8, _get_eval_enc_str, #_get_eval_enc_str, #_get_eval_string, _get_eval_string, _symbolkey2str, #_symbolkey2str, #_toUTF8, bool, #bool, callback, eval_cmd, #hash_kv, hash_kv, install_cmd, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd
#kanjifont_copy, #kanjitagfont_configure, #latintagfont_configure, #latintagfont_copy, #tagfont_configinfo, #tagfont_configure, #tagfont_copy
Class Method Details
123
124
125
|
# File 'ext/lib/tk/itemconfig.rb', line 123
def TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
@mode || false
end
|
126
127
128
129
|
# File 'ext/lib/tk/itemconfig.rb', line 126
def TkItemConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode)
fail SecurityError, "can't change the mode" if $SAFE>=4
@mode = (mode)? true: false
end
|
Instance Method Details
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
# File 'ext/lib/tk/itemconfig.rb', line 350
def __check_available_itemconfigure_options(tagOrId, keys)
id = tagid(tagOrId)
availables = self.__current_itemconfiginfo(id).keys
availables |= __font_optkeys.map{|k|
[k.to_s, "latin#{k}", "ascii#{k}", "kanji#{k}"]
}.flatten
availables |= __item_methodcall_optkeys(id).keys.map{|k| k.to_s}
availables |= __item_keyonly_optkeys(id).keys.map{|k| k.to_s}
keys = _symbolkey2str(keys)
keys.delete_if{|k, v| !(availables.include?(k))}
end
|
#__current_itemconfiginfo(tagOrId, slot = nil) ⇒ Object
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
|
# File 'ext/lib/tk/itemconfig.rb', line 1178
def __current_itemconfiginfo(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
org_slot = slot
begin
conf = __itemconfiginfo_core(tagOrId, slot)
if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
|| conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
return {conf[0] => conf[-1]}
end
slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]]
end while(org_slot != slot)
fail RuntimeError,
"there is a configure alias loop about '#{org_slot}'"
else
ret = {}
__itemconfiginfo_core(tagOrId).each{|conf|
if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
|| conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
ret[conf[0]] = conf[-1]
end
}
ret
end
else ret = {}
__itemconfiginfo_core(tagOrId, slot).each{|key, conf|
ret[key] = conf[-1] if conf.kind_of?(Array)
}
ret
end
end
|
#current_itemconfiginfo(tagOrId, slot = nil) ⇒ Object
1212
1213
1214
|
# File 'ext/lib/tk/itemconfig.rb', line 1212
def current_itemconfiginfo(tagOrId, slot = nil)
__current_itemconfiginfo(tagOrId, slot)
end
|
#itemcget(tagOrId, option) ⇒ Object
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
# File 'ext/lib/tk/itemconfig.rb', line 247
def itemcget(tagOrId, option)
unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
__itemcget_core(tagOrId, option)
else
begin
__itemcget_core(tagOrId, option)
rescue => e
begin
if __current_itemconfiginfo(tagOrId).has_key?(option.to_s)
fail e
else
nil
end
rescue
fail e end
end
end
end
|
#itemcget_strict(tagOrId, option) ⇒ Object
268
269
270
271
|
# File 'ext/lib/tk/itemconfig.rb', line 268
def itemcget_strict(tagOrId, option)
__itemcget_core(tagOrId, option)
end
|
#itemconfiginfo(tagOrId, slot = nil) ⇒ Object
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
|
# File 'ext/lib/tk/itemconfig.rb', line 1160
def itemconfiginfo(tagOrId, slot = nil)
if slot && TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
begin
__itemconfiginfo_core(tagOrId, slot)
rescue => e
begin
__itemconfiginfo_core(tagOrId)
Array.new(__item_configinfo_struct.values.max).unshift(slot.to_s)
rescue
fail e end
end
else
__itemconfiginfo_core(tagOrId, slot)
end
end
|
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
|
# File 'ext/lib/tk/itemconfig.rb', line 367
def itemconfigure(tagOrId, slot, value=None)
unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
__itemconfigure_core(tagOrId, slot, value)
else
if slot.kind_of?(Hash)
begin
__itemconfigure_core(tagOrId, slot)
rescue
slot = __check_available_itemconfigure_options(tagOrId, slot)
__itemconfigure_core(tagOrId, slot) unless slot.empty?
end
else
begin
__itemconfigure_core(tagOrId, slot, value)
rescue => e
begin
if __current_itemconfiginfo(tagOrId).has_key?(slot.to_s)
fail e
else
nil
end
rescue
fail e end
end
end
end
self
end
|
#tagid(tagOrId) ⇒ Object
158
159
160
161
|
# File 'ext/lib/tk/itemconfig.rb', line 158
def tagid(tagOrId)
tagOrId
end
|