Class: TkWindow

Inherits:
TkObject show all
Extended by:
TkBindCore
Includes:
Tk::TkDND::DND, Tk::TkDND::Shape, TkWinfo
Defined in:
lib/tkextlib/tkDND/tkdnd.rb,
lib/tkextlib/tkDND/shape.rb,
lib/tkextlib/tcllib/cursor.rb,
lib/tkextlib/tktrans/tktrans.rb,
lib/tk.rb

Constant Summary collapse

TkCommandNames =
[].freeze
WidgetClassName =

> If TkCommandNames is a string (not a null string),

assume the string is a Tcl/Tk's create command of the widget class.
''.freeze

Constants included from Tk

Tk::AUTO_PATH, Tk::INTERP, Tk::JAPANIZED_TK, Tk::LIBRARY_PATH, Tk::MAINLOOP, Tk::PACKAGE_PATH, Tk::RELEASE_DATE, Tk::TCL_LIBRARY_PATH, Tk::TCL_MAJOR_VERSION, Tk::TCL_MINOR_VERSION, Tk::TCL_PACKAGE_PATH, Tk::TCL_PATCHLEVEL, Tk::TCL_PRECISION, Tk::TCL_VERSION, Tk::TK_MAJOR_VERSION, Tk::TK_MINOR_VERSION, Tk::TK_PATCHLEVEL, Tk::TK_VERSION, Tk::Tkextlib_RELEASE_DATE, Tk::TreeCtrl_Widget, Tk::X_Scrollable, Tk::Y_Scrollable

Constants included from TkCore

TkCore::EventFlag, TkCore::INTERP, TkCore::WIDGET_DESTROY_HOOK

Constants included from TkComm

TkComm::GET_CONFIGINFO_AS_ARRAY, TkComm::GET_CONFIGINFOwoRES_AS_ARRAY, TkComm::TkExtlibAutoloadModule, TkComm::Tk_CMDTBL, TkComm::Tk_IDs, TkComm::Tk_WINDOWS, TkComm::USE_TCLs_LIST_FUNCTIONS, TkComm::WidgetClassNames

Constants included from TkUtil

TkUtil::None, TkUtil::RELEASE_DATE

Constants included from Tk::TkDND::Shape

Tk::TkDND::Shape::PACKAGE_NAME

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TkBindCore

bind, bind_append, bind_remove, bindinfo

Methods included from TkWinfo

appname, atom, atomname, cells, children, classname, colormapfull, containing, depth, exist?, fpixels, geometry, height, id, interps, manager, mapped?, parent, pixels, pointerx, pointerxy, pointery, reqheight, reqwidth, rgb, rootx, rooty, screen, screencells, screendepth, screenheight, screenmmheight, screenmmwidth, screenvisual, screenwidth, server, toplevel, viewable, visual, visualid, visualsavailable, vrootheight, vrootwidth, vrootx, vrooty, widget, width, #winfo_appname, #winfo_atom, #winfo_atomname, #winfo_cells, #winfo_children, #winfo_classname, #winfo_colormapfull, #winfo_containing, #winfo_depth, #winfo_exist?, #winfo_fpixels, #winfo_geometry, #winfo_height, #winfo_id, #winfo_interps, #winfo_manager, #winfo_mapped?, #winfo_parent, #winfo_pixels, #winfo_pointerx, #winfo_pointerxy, #winfo_pointery, #winfo_reqheight, #winfo_reqwidth, #winfo_rgb, #winfo_rootx, #winfo_rooty, #winfo_screen, #winfo_screencells, #winfo_screendepth, #winfo_screenheight, #winfo_screenmmheight, #winfo_screenmmwidth, #winfo_screenvisual, #winfo_screenwidth, #winfo_server, #winfo_toplevel, #winfo_viewable, #winfo_visual, #winfo_visualid, #winfo_visualsavailable, #winfo_vrootheight, #winfo_vrootwidth, #winfo_vrootx, #winfo_vrooty, #winfo_widget, #winfo_width, #winfo_x, #winfo_y, x, y

Methods included from Tk

BinaryString, EncodedString, UTF8_String, add_kinsoku, bell, bell_on_display, const_missing, current_grabs, cursor_display, delete_kinsoku, destroy, #encoding, #encoding=, errorCode, errorInfo, exit, focus, focus_lastfor, focus_next, focus_prev, focus_to, fromUTF8, grid, grid_forget, has_mainwindow?, load_tcllibrary, load_tclscript, load_tclscript_rsrc, load_tclscript_rsrcid, lower_window, pack, pack_forget, pkgconfig_get, pkgconfig_list, place, place_forget, raise_window, #root, show_kinsoku, strictMotif, subst_tk_backslash, subst_utf_backslash, tcl_pkgconfig_get, tcl_pkgconfig_list, thread_update, thread_update_idletasks, tk_pkgconfig_get, tk_pkgconfig_list, toUTF8, to_backslash_sequence, ungrid, unload_tcllibrary, unpack, unplace, #update, update, update_idletasks, utf_to_backslash, utf_to_backslash_sequence

Methods included from Tk::Encoding

#encoding, #encoding=, #encoding_convertfrom, #encoding_convertto, #encoding_dirs, #encoding_dirs=, #encoding_names, #encoding_system, #encoding_system=

Methods included from TkCore

#_tk_call_to_list_core, #after, #after_cancel, #after_idle, #appname, #appsend, #appsend_deny, #appsend_displayof, callback, #callback_break, #callback_continue, #callback_return, #chooseColor, #chooseDirectory, #do_one_event, #event_generate, #getMultipleOpenFile, #getMultipleSaveFile, #getOpenFile, #getSaveFile, #get_eventloop_tick, #get_eventloop_weight, #get_no_event_wait, #inactive, #inactive_displayof, #info, #ip_eval, #ip_eval_with_enc, #ip_eval_without_enc, #ip_invoke, #ip_invoke_with_enc, #ip_invoke_without_enc, #is_mainloop?, #load_cmd_on_ip, #mainloop, #mainloop_exist?, #mainloop_thread?, #mainloop_watchdog, #messageBox, #rb_appsend, #rb_appsend_displayof, #reset_inactive, #reset_inactive_displayof, #restart, #scaling, #scaling_displayof, #set_eventloop_tick, #set_eventloop_weight, #set_no_event_wait, #tk_call, #tk_call_to_list, #tk_call_to_list_with_enc, #tk_call_to_list_without_enc, #tk_call_to_simplelist, #tk_call_to_simplelist_with_enc, #tk_call_to_simplelist_without_enc, #tk_call_with_enc, #tk_call_without_enc, #windowingsystem

Methods included from TkComm

#_at, #bind, #bind_all, #bind_append, #bind_append_all, #bind_remove, #bind_remove_all, #bindinfo, #bindinfo_all, #image_obj, #install_cmd, #subst, #uninstall_cmd

Methods included from TkEvent

#install_bind, #install_bind_for_event_class

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

Methods included from Tk::TkDND::Shape

package_name, package_patchlevel, package_version, #shape_bounds, #shape_get, #shape_offset, #shape_set, #shape_update, version

Methods included from Tk::TkDND::DND

#dnd_bindsource, #dnd_bindsource_info, #dnd_bindtarget, #dnd_bindtarget_info, #dnd_clearsource, #dnd_cleartarget, #dnd_drag, version

Methods inherited from TkObject

#epath, #event_generate, #method_missing, #path, #tk_send, #tk_send_to_list, #tk_send_to_list_with_enc, #tk_send_to_list_without_enc, #tk_send_to_simplelist, #tk_send_to_simplelist_with_enc, #tk_send_to_simplelist_without_enc, #tk_send_with_enc, #tk_send_without_enc, #to_eval

Methods included from TkConfigMethod

#[], #[]=, #cget, #config_hash_kv, #configinfo, #configure, #configure_cmd, #current_configinfo

Methods included from TkTreatFont

#font_configinfo, #font_configure, #font_copy, #kanjifont_configure, #kanjifont_copy, #latinfont_configure, #latinfont_copy

Methods inherited from TkKernel

new

Constructor Details

#initialize(parent = nil, keys = nil) ⇒ TkWindow

Returns a new instance of TkWindow.



3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
# File 'lib/tk.rb', line 3988

def initialize(parent=nil, keys=nil)
  if parent.kind_of? Hash
    keys = _symbolkey2str(parent)
    parent = keys.delete('parent')
    widgetname = keys.delete('widgetname')
    install_win(if parent then parent.path end, widgetname)
    without_creating = keys.delete('without_creating')
    # if without_creating && !widgetname 
    #   fail ArgumentError, 
    #        "if set 'without_creating' to true, need to define 'widgetname'"
    # end
  elsif keys
    keys = _symbolkey2str(keys)
    widgetname = keys.delete('widgetname')
    install_win(if parent then parent.path end, widgetname)
    without_creating = keys.delete('without_creating')
    # if without_creating && !widgetname 
    #   fail ArgumentError, 
    #        "if set 'without_creating' to true, need to define 'widgetname'"
    # end
  else
    install_win(if parent then parent.path end)
  end
  if self.method(:create_self).arity == 0
    p 'create_self has no arg' if $DEBUG
    create_self unless without_creating
    if keys
      # tk_call @path, 'configure', *hash_kv(keys)
      configure(keys)
    end
  else
    p 'create_self has args' if $DEBUG
    fontkeys = {}
    methodkeys = {}
    if keys
      #['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
      #  fontkeys[key] = keys.delete(key) if keys.key?(key)
      #}
      __font_optkeys.each{|key|
        fkey = key.to_s
        fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)

        fkey = "kanji#{key}"
        fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)

        fkey = "latin#{key}"
        fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)

        fkey = "ascii#{key}"
        fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
      }

      __methodcall_optkeys.each{|key|
        key = key.to_s
        methodkeys[key] = keys.delete(key) if keys.key?(key)
      }

      __ruby2val_optkeys.each{|key, method|
        key = key.to_s
        keys[key] = method.call(keys[key]) if keys.has_key?(key)
      }
    end
    if without_creating && keys
      #configure(keys)
      configure(__conv_keyonly_opts(keys))
    else
      #create_self(keys)
      create_self(__conv_keyonly_opts(keys))
    end
    font_configure(fontkeys) unless fontkeys.empty?
    configure(methodkeys) unless methodkeys.empty?
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TkObject

Class Method Details

.database_classObject



4101
4102
4103
# File 'lib/tk.rb', line 4101

def self.database_class
  WidgetClassNames[self::WidgetClassName]
end

.database_classnameObject



4098
4099
4100
# File 'lib/tk.rb', line 4098

def self.database_classname
  self::WidgetClassName
end

.to_evalObject

WidgetClassNames = self

> If self is a widget class, entry to the WidgetClassNames table.



3984
3985
3986
# File 'lib/tk.rb', line 3984

def self.to_eval
  self::WidgetClassName
end

Instance Method Details

#bind_classObject



4083
4084
4085
# File 'lib/tk.rb', line 4083

def bind_class
  @db_class || self.class()
end

#bindtags(taglist = nil) ⇒ Object



4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
# File 'lib/tk.rb', line 4550

def bindtags(taglist=nil)
  if taglist
    fail ArgumentError, "taglist must be Array" unless taglist.kind_of? Array
    tk_call('bindtags', path, taglist)
    taglist
  else
    list(tk_call('bindtags', path)).collect{|tag|
      if tag.kind_of?(String) 
        if cls = WidgetClassNames[tag]
          cls
        elsif btag = TkBindTag.id2obj(tag)
          btag
        else
          tag
        end
      else
        tag
      end
    }
  end
end

#bindtags=(taglist) ⇒ Object



4572
4573
4574
4575
# File 'lib/tk.rb', line 4572

def bindtags=(taglist)
  bindtags(taglist)
  taglist
end

#bindtags_shiftObject



4577
4578
4579
4580
4581
4582
# File 'lib/tk.rb', line 4577

def bindtags_shift
  taglist = bindtags
  tag = taglist.shift
  bindtags(taglist)
  tag
end

#bindtags_unshift(tag) ⇒ Object



4584
4585
4586
# File 'lib/tk.rb', line 4584

def bindtags_unshift(tag)
  bindtags(bindtags().unshift(tag))
end

#caret(keys = nil) ⇒ Object



4461
4462
4463
# File 'lib/tk.rb', line 4461

def caret(keys=nil)
  TkXIM.caret(path, keys)
end

#colormodel(model = None) ⇒ Object



4456
4457
4458
4459
# File 'lib/tk.rb', line 4456

def colormodel(model=None)
  tk_call('tk', 'colormodel', path, model)
  self
end

#command(cmd = nil, &b) ⇒ Object



4446
4447
4448
4449
4450
4451
4452
4453
4454
# File 'lib/tk.rb', line 4446

def command(cmd=nil, &b)
  if cmd
    configure_cmd('command', cmd)
  elsif b
    configure_cmd('command', Proc.new(&b))
  else
    cget('command')
  end
end

#cursor_propagate(cursor) ⇒ Object



56
57
58
59
60
# File 'lib/tkextlib/tcllib/cursor.rb', line 56

def cursor_propagate(cursor)
  # Sets the cursor for self and all its descendants to cursor. 
  #tk_call_without_enc('::cursor::propagate', @path, cursor)
  Tk::Tcllib::Cursor.cursor_propagate(self, cursor)
end

#cursor_restore(cursor = None) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/tkextlib/tcllib/cursor.rb', line 61

def cursor_restore(cursor = None)
  # Restore the original or previously set cursor for self and all its 
  # descendants. If cursor is specified, that will be used if on any 
  # widget that did not have a preset cursor (set by a previous call 
  # to TkWindow#cursor_propagate). 
  #tk_call_without_enc('::cursor::restore', @path, cursor)
  Tk::Tcllib::Cursor.cursor_restore(self, cursor)
end

#database_classObject



4090
4091
4092
4093
4094
4095
4096
4097
# File 'lib/tk.rb', line 4090

def database_class
  name = database_classname()
  if WidgetClassNames[name]
    WidgetClassNames[name]
  else
    TkDatabaseClass.new(name)
  end
end

#database_classnameObject



4087
4088
4089
# File 'lib/tk.rb', line 4087

def database_classname
  TkWinfo.classname(self)
end

#destroyObject



4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
# File 'lib/tk.rb', line 4465

def destroy
  super
  children = []
  rexp = /^#{self.path}\.[^.]+$/
  TkCore::INTERP.tk_windows.each{|path, obj|
    children << [path, obj] if path =~ rexp
  }
  if defined?(@cmdtbl)
    for id in @cmdtbl
      uninstall_cmd id
    end
  end

  children.each{|path, obj|
    if defined?(@cmdtbl)
      for id in @cmdtbl
        uninstall_cmd id
      end
    end
    TkCore::INTERP.tk_windows.delete(path)
  }

  begin
    tk_call_without_enc('destroy', epath)
  rescue
  end
  uninstall_win
end

#eventloop_wait_destroyObject Also known as: eventloop_wait_window, eventloop_tkwait_destroy, eventloop_tkwait_window



4532
4533
4534
# File 'lib/tk.rb', line 4532

def eventloop_wait_destroy
  wait_destroy(false)
end

#eventloop_wait_visibilityObject Also known as: eventloop_wait, eventloop_tkwait, eventloop_tkwait_visibility



4505
4506
4507
# File 'lib/tk.rb', line 4505

def eventloop_wait_visibility
  wait_visibility(false)
end

#exist?Boolean

Returns:

  • (Boolean)


4079
4080
4081
# File 'lib/tk.rb', line 4079

def exist?
  TkWinfo.exist?(self)
end

#grab(opt = nil) ⇒ Object



4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
# File 'lib/tk.rb', line 4384

def grab(opt = nil)
  unless opt
    tk_call_without_enc('grab', 'set', path)
    return self
  end

  case opt
  when 'set', :set
    tk_call_without_enc('grab', 'set', path)
    return self
  when 'global', :global
    #return(tk_call('grab', 'set', '-global', path))
    tk_call_without_enc('grab', 'set', '-global', path)
    return self
  when 'release', :release
    #return tk_call('grab', 'release', path)
    tk_call_without_enc('grab', 'release', path)
    return self
  when 'current', :current
    return window(tk_call_without_enc('grab', 'current', path))
  when 'status', :status
    return tk_call_without_enc('grab', 'status', path)
  else
    return tk_call_without_enc('grab', opt, path)
  end
end

#grab_currentObject Also known as: current_grab



4411
4412
4413
# File 'lib/tk.rb', line 4411

def grab_current
  grab('current')
end

#grab_releaseObject Also known as: release_grab



4415
4416
4417
# File 'lib/tk.rb', line 4415

def grab_release
  grab('release')
end

#grab_setObject Also known as: set_grab



4419
4420
4421
# File 'lib/tk.rb', line 4419

def grab_set
  grab('set')
end

#grab_set_globalObject Also known as: set_global_grab



4423
4424
4425
# File 'lib/tk.rb', line 4423

def grab_set_global
  grab('global')
end

#grab_statusObject



4427
4428
4429
# File 'lib/tk.rb', line 4427

def grab_status
  grab('status')
end

#grid(keys = nil) ⇒ Object



4178
4179
4180
4181
4182
4183
4184
4185
4186
# File 'lib/tk.rb', line 4178

def grid(keys = nil)
  #tk_call 'grid', epath, *hash_kv(keys)
  if keys
    TkGrid.configure(self, keys)
  else
    TkGrid.configure(self)
  end
  self
end

#grid_bbox(*args) ⇒ Object



4207
4208
4209
4210
# File 'lib/tk.rb', line 4207

def grid_bbox(*args)
  #list(tk_call('grid', 'bbox', epath, *args))
  TkGrid.bbox(self, *args)
end

#grid_columnconfig(index, keys) ⇒ Object Also known as: grid_columnconfigure



4226
4227
4228
4229
# File 'lib/tk.rb', line 4226

def grid_columnconfig(index, keys)
  #tk_call('grid', 'columnconfigure', epath, index, *hash_kv(keys))
  TkGrid.columnconfigure(self, index, keys)
end

#grid_columnconfiginfo(index, slot = nil) ⇒ Object



4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
# File 'lib/tk.rb', line 4238

def grid_columnconfiginfo(index, slot=nil)
  #if slot
  #  tk_call('grid', 'columnconfigure', epath, index, "-#{slot}").to_i
  #else
  #  ilist = list(tk_call('grid', 'columnconfigure', epath, index))
  #  info = {}
  #  while key = ilist.shift
  #   info[key[1..-1]] = ilist.shift
  #  end
  #  info
  #end
  TkGrid.columnconfiginfo(self, index, slot)
end

#grid_config(slot, value = None) ⇒ Object Also known as: grid_configure



4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
# File 'lib/tk.rb', line 4212

def grid_config(slot, value=None)
  #if slot.kind_of? Hash
  #  tk_call 'grid', 'configure', epath, *hash_kv(slot)
  #else
  #  tk_call 'grid', 'configure', epath, "-#{slot}", value
  #end
  if slot.kind_of? Hash
    TkGrid.configure(self, slot)
  else
    TkGrid.configure(self, slot=>value)
  end
end

#grid_forgetObject Also known as: ungrid



4200
4201
4202
4203
4204
# File 'lib/tk.rb', line 4200

def grid_forget
  #tk_call('grid', 'forget', epath)
  TkGrid.forget(self)
  self
end

#grid_in(target, keys = nil) ⇒ Object



4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
# File 'lib/tk.rb', line 4188

def grid_in(target, keys = nil)
  if keys
    keys = keys.dup
    keys['in'] = target
  else
    keys = {'in'=>target}
  end
  #tk_call 'grid', epath, *hash_kv(keys)
  TkGrid.configure(self, keys)
  self
end

#grid_infoObject



4266
4267
4268
4269
# File 'lib/tk.rb', line 4266

def grid_info()
  #list(tk_call('grid', 'info', epath))
  TkGrid.info(self)
end

#grid_location(x, y) ⇒ Object



4271
4272
4273
4274
# File 'lib/tk.rb', line 4271

def grid_location(x, y)
  #list(tk_call('grid', 'location', epath, x, y))
  TkGrid.location(self, x, y)
end

#grid_propagate(mode = None) ⇒ Object



4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
# File 'lib/tk.rb', line 4276

def grid_propagate(mode=None)
  #if mode == None
  #  bool(tk_call('grid', 'propagate', epath))
  #else
  #  tk_call('grid', 'propagate', epath, mode)
  #  self
  #end
  if mode == None
    TkGrid.propagate(self)
  else
    TkGrid.propagate(self, mode)
    self
  end
end

#grid_removeObject



4291
4292
4293
4294
4295
# File 'lib/tk.rb', line 4291

def grid_remove()
  #tk_call 'grid', 'remove', epath
  TkGrid.remove(self)
  self
end

#grid_rowconfig(index, keys) ⇒ Object Also known as: grid_rowconfigure



4232
4233
4234
4235
# File 'lib/tk.rb', line 4232

def grid_rowconfig(index, keys)
  #tk_call('grid', 'rowconfigure', epath, index, *hash_kv(keys))
  TkGrid.rowconfigure(self, index, keys)
end

#grid_rowconfiginfo(index, slot = nil) ⇒ Object



4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
# File 'lib/tk.rb', line 4252

def grid_rowconfiginfo(index, slot=nil)
  #if slot
  #  tk_call('grid', 'rowconfigure', epath, index, "-#{slot}").to_i
  #else
  #  ilist = list(tk_call('grid', 'rowconfigure', epath, index))
  #  info = {}
  #  while key = ilist.shift
  #   info[key[1..-1]] = ilist.shift
  #  end
  #  info
  #end
  TkGrid.rowconfiginfo(self, index, slot)
end

#grid_sizeObject



4297
4298
4299
4300
# File 'lib/tk.rb', line 4297

def grid_size()
  #list(tk_call('grid', 'size', epath))
  TkGrid.size(self)
end

#grid_slaves(args) ⇒ Object



4302
4303
4304
4305
# File 'lib/tk.rb', line 4302

def grid_slaves(args)
  #list(tk_call('grid', 'slaves', epath, *hash_kv(args)))
  TkGrid.slaves(self, args)
end

#lower(below = None) ⇒ Object Also known as: lower_window



4431
4432
4433
4434
4435
4436
# File 'lib/tk.rb', line 4431

def lower(below=None)
  # below = below.epath if below.kind_of?(TkObject)
  below = _epath(below)
  tk_call 'lower', epath, below
  self
end

#pack(keys = nil) ⇒ Object



4105
4106
4107
4108
4109
4110
4111
4112
4113
# File 'lib/tk.rb', line 4105

def pack(keys = nil)
  #tk_call_without_enc('pack', epath, *hash_kv(keys, true))
  if keys
    TkPack.configure(self, keys)
  else
    TkPack.configure(self)
  end
  self
end

#pack_config(slot, value = None) ⇒ Object Also known as: pack_configure



4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
# File 'lib/tk.rb', line 4134

def pack_config(slot, value=None)
  #if slot.kind_of? Hash
  #  tk_call 'pack', 'configure', epath, *hash_kv(slot)
  #else
  #  tk_call 'pack', 'configure', epath, "-#{slot}", value
  #end
  if slot.kind_of? Hash
    TkPack.configure(self, slot)
  else
    TkPack.configure(self, slot=>value)
  end
end

#pack_forgetObject Also known as: unpack



4127
4128
4129
4130
4131
# File 'lib/tk.rb', line 4127

def pack_forget
  #tk_call_without_enc('pack', 'forget', epath)
  TkPack.forget(self)
  self
end

#pack_in(target, keys = nil) ⇒ Object



4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
# File 'lib/tk.rb', line 4115

def pack_in(target, keys = nil)
  if keys
    keys = keys.dup
    keys['in'] = target
  else
    keys = {'in'=>target}
  end
  #tk_call 'pack', epath, *hash_kv(keys)
  TkPack.configure(self, keys)
  self
end

#pack_infoObject



4148
4149
4150
4151
4152
4153
4154
4155
4156
# File 'lib/tk.rb', line 4148

def pack_info()
  #ilist = list(tk_call('pack', 'info', epath))
  #info = {}
  #while key = ilist.shift
  #  info[key[1..-1]] = ilist.shift
  #end
  #return info
  TkPack.info(self)
end

#pack_propagate(mode = None) ⇒ Object



4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
# File 'lib/tk.rb', line 4158

def pack_propagate(mode=None)
  #if mode == None
  #  bool(tk_call('pack', 'propagate', epath))
  #else
  #  tk_call('pack', 'propagate', epath, mode)
  #  self
  #end
  if mode == None
    TkPack.propagate(self)
  else
    TkPack.propagate(self, mode)
    self
  end
end

#pack_slavesObject



4173
4174
4175
4176
# File 'lib/tk.rb', line 4173

def pack_slaves()
  #list(tk_call('pack', 'slaves', epath))
  TkPack.slaves(self)
end

#place(keys) ⇒ Object



4307
4308
4309
4310
4311
# File 'lib/tk.rb', line 4307

def place(keys)
  #tk_call 'place', epath, *hash_kv(keys)
  TkPlace.configure(self, keys)
  self
end

#place_config(slot, value = None) ⇒ Object Also known as: place_configure



4332
4333
4334
4335
4336
4337
4338
4339
# File 'lib/tk.rb', line 4332

def place_config(slot, value=None)
  #if slot.kind_of? Hash
  #  tk_call 'place', 'configure', epath, *hash_kv(slot)
  #else
  #  tk_call 'place', 'configure', epath, "-#{slot}", value
  #end
  TkPlace.configure(self, slot, value)
end

#place_configinfo(slot = nil) ⇒ Object



4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
# File 'lib/tk.rb', line 4342

def place_configinfo(slot = nil)
  # for >= Tk8.4a2 ?
  #if slot
  #  conf = tk_split_list(tk_call('place', 'configure', epath, "-#{slot}") )
  #  conf[0] = conf[0][1..-1]
  #  conf
  #else
  #  tk_split_simplelist(tk_call('place', 
  #                             'configure', epath)).collect{|conflist|
  #   conf = tk_split_simplelist(conflist)
  #   conf[0] = conf[0][1..-1]
  #   conf
  #  }
  #end
  TkPlace.configinfo(self, slot)
end

#place_forgetObject Also known as: unplace



4325
4326
4327
4328
4329
# File 'lib/tk.rb', line 4325

def  place_forget
  #tk_call 'place', 'forget', epath
  TkPlace.forget(self)
  self
end

#place_in(target, keys = nil) ⇒ Object



4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
# File 'lib/tk.rb', line 4313

def place_in(target, keys = nil)
  if keys
    keys = keys.dup
    keys['in'] = target
  else
    keys = {'in'=>target}
  end
  #tk_call 'place', epath, *hash_kv(keys)
  TkPlace.configure(self, keys)
  self
end

#place_infoObject



4359
4360
4361
4362
4363
4364
4365
4366
4367
# File 'lib/tk.rb', line 4359

def place_info()
  #ilist = list(tk_call('place', 'info', epath))
  #info = {}
  #while key = ilist.shift
  #  info[key[1..-1]] = ilist.shift
  #end
  #return info
  TkPlace.info(self)
end

#place_slavesObject



4369
4370
4371
4372
# File 'lib/tk.rb', line 4369

def place_slaves()
  #list(tk_call('place', 'slaves', epath))
  TkPlace.slaves(self)
end

#raise(above = None) ⇒ Object Also known as: raise_window



4438
4439
4440
4441
4442
4443
# File 'lib/tk.rb', line 4438

def raise(above=None)
  #above = above.epath if above.kind_of?(TkObject)
  above = _epath(above)
  tk_call 'raise', epath, above
  self
end

#set_focus(force = false) ⇒ Object Also known as: focus



4374
4375
4376
4377
4378
4379
4380
4381
# File 'lib/tk.rb', line 4374

def set_focus(force=false)
  if force
    tk_call_without_enc('focus', '-force', path)
  else
    tk_call_without_enc('focus', path)
  end
  self
end

#thread_wait_destroyObject Also known as: thread_wait_window, thread_tkwait_destroy, thread_tkwait_window



4536
4537
4538
# File 'lib/tk.rb', line 4536

def thread_wait_destroy
  wait_destroy(true)
end

#thread_wait_visibilityObject Also known as: thread_wait, thread_tkwait, thread_tkwait_visibility



4508
4509
4510
# File 'lib/tk.rb', line 4508

def thread_wait_visibility
  wait_visibility(true)
end

#tktrans_get_imageObject



37
38
39
# File 'lib/tkextlib/tktrans/tktrans.rb', line 37

def tktrans_get_image()
  tk_send('tktrans::setwidget', @path)
end

#tktrans_set_image(img) ⇒ Object



33
34
35
36
# File 'lib/tkextlib/tktrans/tktrans.rb', line 33

def tktrans_set_image(img)
  tk_send('tktrans::setwidget', @path, img)
  self
end

#wait_destroy(on_thread = true) ⇒ Object Also known as: wait_window, tkwait_destroy, tkwait_window



4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
# File 'lib/tk.rb', line 4520

def wait_destroy(on_thread = true)
  if $SAFE >= 4
    fail SecurityError, "can't wait destroy at $SAFE >= 4"
  end
  on_thread &= (Thread.list.size != 1)
  if on_thread
    INTERP._thread_tkwait('window', epath)
  else
    INTERP._invoke('tkwait', 'window', epath)
  end
end

#wait_visibility(on_thread = true) ⇒ Object Also known as: wait, tkwait



4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
# File 'lib/tk.rb', line 4494

def wait_visibility(on_thread = true)
  if $SAFE >= 4
    fail SecurityError, "can't wait visibility at $SAFE >= 4"
  end
  on_thread &= (Thread.list.size != 1)
  if on_thread
    INTERP._thread_tkwait('visibility', path)
  else
    INTERP._invoke('tkwait', 'visibility', path)
  end
end