* ext/tk/lib/tk.rb, ext/tk/lib/*: make default widget set
switchable between Tk (standard Tcl/Tk widget set) and Ttk (Tile). Initial default widget set is Tk. Now, toplevel widget classes are removed and defined as aliases. For example, "TkButton" is an alias of the "Tk::Button" class. Those aliases are replaced when switching default widget set. "Tk.default_widget_set=" is the method for switching default widget set. "Tk.default_widget_set = :Ttk" defines Ttk (Tile) widget set as default. It means that "TkButton" denotes "Tk::Tile::Button" class. And then, "TkButton.new" creates a Tk::Tile::Button widget. Of course, you can back to use standard Tk widgets as the default widget set by calling "Tk.default_widget_set = :Tk", whenever you want. Based on thie feature, you can use Ttk widget styling engine on your old Ruby/Tk application without modifying its source, if you don'tuse widget options unsupported on Ttk widgets (At first, call "Tk.default_widget_set = :Ttk", and next load and run your application). This is one step for supporting Tcl/Tk8.5 features. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4dd9fd71b3
commit
ee695fb164
24
ChangeLog
24
ChangeLog
@ -1,3 +1,25 @@
|
|||||||
|
Thu Feb 28 03:03:32 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* ext/tk/lib/tk.rb, ext/tk/lib/*: make default widget set
|
||||||
|
switchable between Tk (standard Tcl/Tk widget set) and
|
||||||
|
Ttk (Tile). Initial default widget set is Tk. Now, toplevel
|
||||||
|
widget classes are removed and defined as aliases.
|
||||||
|
For example, "TkButton" is an alias of the "Tk::Button" class.
|
||||||
|
Those aliases are replaced when switching default widget set.
|
||||||
|
"Tk.default_widget_set=" is the method for switching default
|
||||||
|
widget set. "Tk.default_widget_set = :Ttk" defines Ttk (Tile)
|
||||||
|
widget set as default. It means that "TkButton" denotes
|
||||||
|
"Tk::Tile::Button" class. And then, "TkButton.new" creates
|
||||||
|
a Tk::Tile::Button widget. Of course, you can back to use
|
||||||
|
standard Tk widgets as the default widget set by calling
|
||||||
|
"Tk.default_widget_set = :Tk", whenever you want. Based on
|
||||||
|
thie feature, you can use Ttk widget styling engine on your
|
||||||
|
old Ruby/Tk application without modifying its source, if you
|
||||||
|
don'tuse widget options unsupported on Ttk widgets (At first,
|
||||||
|
call "Tk.default_widget_set = :Ttk", and next load and run
|
||||||
|
your application).
|
||||||
|
This is one step for supporting Tcl/Tk8.5 features.
|
||||||
|
|
||||||
Wed Feb 27 22:55:42 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
Wed Feb 27 22:55:42 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_coderange_scan_restartable): coderange scaning
|
* string.c (rb_str_coderange_scan_restartable): coderange scaning
|
||||||
@ -5079,7 +5101,7 @@ Fri Dec 21 18:40:54 2007 Koichi Sasada <ko1@atdot.net>
|
|||||||
|
|
||||||
* bootstraptest/test_io.rb, test_knownbug.rb: move a fixed test.
|
* bootstraptest/test_io.rb, test_knownbug.rb: move a fixed test.
|
||||||
|
|
||||||
Fri Dec 21 17:56:30 2007 <nagai@orca16.orcabay.ddo.jp>
|
Fri Dec 21 17:56:30 2007 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/tcltklib.c: provisional support on Ruby-VM.
|
* ext/tk/tcltklib.c: provisional support on Ruby-VM.
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ module TkComm
|
|||||||
|
|
||||||
def _bindinfo(what, context=nil)
|
def _bindinfo(what, context=nil)
|
||||||
if context
|
if context
|
||||||
tk_call_without_enc(*what+["<#{tk_event_sequence(context)}>"]) .collect {|cmdline|
|
tk_call_without_enc(*what+["<#{tk_event_sequence(context)}>"]).each_line.collect {|cmdline|
|
||||||
=begin
|
=begin
|
||||||
if cmdline =~ /^rb_out\S* (c(?:_\d+_)?\d+)\s+(.*)$/
|
if cmdline =~ /^rb_out\S* (c(?:_\d+_)?\d+)\s+(.*)$/
|
||||||
#[Tk_CMDTBL[$1], $2]
|
#[Tk_CMDTBL[$1], $2]
|
||||||
@ -4102,6 +4102,14 @@ class TkWindow<TkObject
|
|||||||
include TkWinfo
|
include TkWinfo
|
||||||
extend TkBindCore
|
extend TkBindCore
|
||||||
|
|
||||||
|
@@WIDGET_INSPECT_FULL = false
|
||||||
|
def TkWindow._widget_inspect_full_?
|
||||||
|
@@WIDGET_INSPECT_FULL
|
||||||
|
end
|
||||||
|
def TkWindow._widget_inspect_full_=(mode)
|
||||||
|
@@WIDGET_INSPECT_FULL = (mode && true) || false
|
||||||
|
end
|
||||||
|
|
||||||
TkCommandNames = [].freeze
|
TkCommandNames = [].freeze
|
||||||
## ==> If TkCommandNames[0] is a string (not a null string),
|
## ==> If TkCommandNames[0] is a string (not a null string),
|
||||||
## assume the string is a Tcl/Tk's create command of the widget class.
|
## assume the string is a Tcl/Tk's create command of the widget class.
|
||||||
@ -4204,8 +4212,12 @@ class TkWindow<TkObject
|
|||||||
private :create_self
|
private :create_self
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
str = super
|
if @@WIDGET_INSPECT_FULL
|
||||||
str[0..(str.index(' '))] << '@path=' << @path.inspect << '>'
|
super
|
||||||
|
else
|
||||||
|
str = super
|
||||||
|
str[0..(str.index(' '))] << '@path=' << @path.inspect << '>'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def exist?
|
def exist?
|
||||||
@ -4717,6 +4729,7 @@ class TkWindow<TkObject
|
|||||||
bindtags(bindtags().unshift(tag))
|
bindtags(bindtags().unshift(tag))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TkWidget = TkWindow
|
||||||
|
|
||||||
# freeze core modules
|
# freeze core modules
|
||||||
#TclTkLib.freeze
|
#TclTkLib.freeze
|
||||||
|
@ -1,21 +1,7 @@
|
|||||||
#
|
#
|
||||||
# autoload
|
# autoload
|
||||||
#
|
#
|
||||||
major, minor, type, type_name, patchlevel = TclTkLib.get_version
|
############################################
|
||||||
|
|
||||||
######################################
|
|
||||||
# depend on version of Tcl/Tk
|
|
||||||
if major > 8 ||
|
|
||||||
(major == 8 && minor > 5) ||
|
|
||||||
(major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA)
|
|
||||||
# Tcl/Tk 8.5 beta or later
|
|
||||||
autoload :Ttk, 'tkextlib/tile'
|
|
||||||
module Tk
|
|
||||||
autoload :Tile, 'tkextlib/tile'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# geometry manager
|
# geometry manager
|
||||||
module Tk
|
module Tk
|
||||||
autoload :Grid, 'tk/grid'
|
autoload :Grid, 'tk/grid'
|
||||||
@ -38,12 +24,7 @@ autoload :TkPlace, 'tk/place'
|
|||||||
def TkPlace(*args); TkPlace.configure(*args); end
|
def TkPlace(*args); TkPlace.configure(*args); end
|
||||||
|
|
||||||
|
|
||||||
######################################
|
############################################
|
||||||
# Ttk (Tile) support
|
|
||||||
require 'tk/ttk_selector'
|
|
||||||
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# classes on Tk module
|
# classes on Tk module
|
||||||
module Tk
|
module Tk
|
||||||
autoload :Button, 'tk/button'
|
autoload :Button, 'tk/button'
|
||||||
@ -66,12 +47,15 @@ module Tk
|
|||||||
|
|
||||||
autoload :Menu, 'tk/menu'
|
autoload :Menu, 'tk/menu'
|
||||||
autoload :MenuClone, 'tk/menu'
|
autoload :MenuClone, 'tk/menu'
|
||||||
|
autoload :CloneMenu, 'tk/menu'
|
||||||
autoload :SystemMenu, 'tk/menu'
|
autoload :SystemMenu, 'tk/menu'
|
||||||
autoload :SysMenu_Help, 'tk/menu'
|
autoload :SysMenu_Help, 'tk/menu'
|
||||||
autoload :SysMenu_System, 'tk/menu'
|
autoload :SysMenu_System, 'tk/menu'
|
||||||
autoload :SysMenu_Apple, 'tk/menu'
|
autoload :SysMenu_Apple, 'tk/menu'
|
||||||
autoload :Menubutton, 'tk/menu'
|
autoload :Menubutton, 'tk/menu'
|
||||||
|
autoload :MenuButton, 'tk/menu'
|
||||||
autoload :OptionMenubutton, 'tk/menu'
|
autoload :OptionMenubutton, 'tk/menu'
|
||||||
|
autoload :OptionMenBbutton, 'tk/menu'
|
||||||
|
|
||||||
autoload :Message, 'tk/message'
|
autoload :Message, 'tk/message'
|
||||||
|
|
||||||
@ -97,7 +81,7 @@ module Tk
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
######################################
|
############################################
|
||||||
# sub-module of Tk
|
# sub-module of Tk
|
||||||
module Tk
|
module Tk
|
||||||
autoload :Clock, 'tk/clock'
|
autoload :Clock, 'tk/clock'
|
||||||
@ -129,184 +113,287 @@ module Tk
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
######################################
|
|
||||||
# toplevel classes/modules
|
|
||||||
autoload_list = {
|
|
||||||
:TkBgError => 'tk/bgerror',
|
|
||||||
|
|
||||||
:TkBindTag => 'tk/bindtag',
|
############################################
|
||||||
:TkBindTagAll => 'tk/bindtag',
|
# toplevel classes/modules (fixed)
|
||||||
:TkDatabaseClass => 'tk/bindtag',
|
autoload :TkBgError, 'tk/bgerror'
|
||||||
|
|
||||||
:TkButton => 'tk/button',
|
autoload :TkBindTag, 'tk/bindtag'
|
||||||
|
autoload :TkBindTagAll, 'tk/bindtag'
|
||||||
|
autoload :TkDatabaseClass, 'tk/bindtag'
|
||||||
|
|
||||||
:TkCanvas => 'tk/canvas',
|
autoload :TkConsole, 'tk/console'
|
||||||
|
|
||||||
:TkcItem => 'tk/canvas',
|
autoload :TkcItem, 'tk/canvas'
|
||||||
:TkcArc => 'tk/canvas',
|
autoload :TkcArc, 'tk/canvas'
|
||||||
:TkcBitmap => 'tk/canvas',
|
autoload :TkcBitmap, 'tk/canvas'
|
||||||
:TkcImage => 'tk/canvas',
|
autoload :TkcImage, 'tk/canvas'
|
||||||
:TkcLine => 'tk/canvas',
|
autoload :TkcLine, 'tk/canvas'
|
||||||
:TkcOval => 'tk/canvas',
|
autoload :TkcOval, 'tk/canvas'
|
||||||
:TkcPolygon => 'tk/canvas',
|
autoload :TkcPolygon, 'tk/canvas'
|
||||||
:TkcRectangle => 'tk/canvas',
|
autoload :TkcRectangle, 'tk/canvas'
|
||||||
:TkcText => 'tk/canvas',
|
autoload :TkcText, 'tk/canvas'
|
||||||
:TkcWindow => 'tk/canvas',
|
autoload :TkcWindow, 'tk/canvas'
|
||||||
|
|
||||||
:TkcTagAccess => 'tk/canvastag',
|
autoload :TkcTagAccess, 'tk/canvastag'
|
||||||
:TkcTag => 'tk/canvastag',
|
autoload :TkcTag, 'tk/canvastag'
|
||||||
:TkcTagString => 'tk/canvastag',
|
autoload :TkcTagString, 'tk/canvastag'
|
||||||
:TkcNamedTag => 'tk/canvastag',
|
autoload :TkcNamedTag, 'tk/canvastag'
|
||||||
:TkcTagAll => 'tk/canvastag',
|
autoload :TkcTagAll, 'tk/canvastag'
|
||||||
:TkcTagCurrent => 'tk/canvastag',
|
autoload :TkcTagCurrent, 'tk/canvastag'
|
||||||
:TkcTagGroup => 'tk/canvastag',
|
autoload :TkcTagGroup, 'tk/canvastag'
|
||||||
|
|
||||||
:TkCheckButton => 'tk/checkbutton',
|
autoload :TkClipboard, 'tk/clipboard'
|
||||||
:TkCheckbutton => 'tk/checkbutton',
|
|
||||||
|
|
||||||
:TkClipboard => 'tk/clipboard',
|
autoload :TkComposite, 'tk/composite'
|
||||||
|
|
||||||
:TkComposite => 'tk/composite',
|
autoload :TkConsole, 'tk/console'
|
||||||
|
|
||||||
:TkConsole => 'tk/console',
|
autoload :TkDialog, 'tk/dialog'
|
||||||
|
autoload :TkDialog2, 'tk/dialog'
|
||||||
|
autoload :TkDialogObj, 'tk/dialog'
|
||||||
|
autoload :TkWarning, 'tk/dialog'
|
||||||
|
autoload :TkWarning2, 'tk/dialog'
|
||||||
|
autoload :TkWarningObj, 'tk/dialog'
|
||||||
|
|
||||||
:TkDialog => 'tk/dialog',
|
autoload :TkEvent, 'tk/event'
|
||||||
:TkDialog2 => 'tk/dialog',
|
|
||||||
:TkDialogObj => 'tk/dialog',
|
|
||||||
:TkWarning => 'tk/dialog',
|
|
||||||
:TkWarning2 => 'tk/dialog',
|
|
||||||
:TkWarningObj => 'tk/dialog',
|
|
||||||
|
|
||||||
:TkEntry => 'tk/entry',
|
autoload :TkFont, 'tk/font'
|
||||||
|
autoload :TkTreatTagFont, 'tk/font'
|
||||||
|
|
||||||
:TkEvent => 'tk/event',
|
autoload :TkImage, 'tk/image'
|
||||||
|
autoload :TkBitmapImage, 'tk/image'
|
||||||
|
autoload :TkPhotoImage, 'tk/image'
|
||||||
|
|
||||||
:TkFont => 'tk/font',
|
autoload :TkItemConfigMethod, 'tk/itemconfig'
|
||||||
:TkTreatTagFont => 'tk/font',
|
|
||||||
|
|
||||||
:TkFrame => 'tk/frame',
|
autoload :TkTreatItemFont, 'tk/itemfont'
|
||||||
|
|
||||||
:TkImage => 'tk/image',
|
autoload :TkKinput, 'tk/kinput'
|
||||||
:TkBitmapImage => 'tk/image',
|
|
||||||
:TkPhotoImage => 'tk/image',
|
|
||||||
|
|
||||||
:TkItemConfigMethod => 'tk/itemconfig',
|
autoload :TkSystemMenu, 'tk/menu'
|
||||||
|
|
||||||
:TkTreatItemFont => 'tk/itemfont',
|
autoload :TkMenubar, 'tk/menubar'
|
||||||
|
|
||||||
:TkKinput => 'tk/kinput',
|
autoload :TkMenuSpec, 'tk/menuspec'
|
||||||
|
|
||||||
:TkLabel => 'tk/label',
|
autoload :TkManageFocus, 'tk/mngfocus'
|
||||||
|
|
||||||
:TkLabelFrame => 'tk/labelframe',
|
autoload :TkMsgCatalog, 'tk/msgcat'
|
||||||
:TkLabelframe => 'tk/labelframe',
|
autoload :TkMsgCat, 'tk/msgcat'
|
||||||
|
|
||||||
:TkListbox => 'tk/listbox',
|
autoload :TkNamespace, 'tk/namespace'
|
||||||
|
|
||||||
:TkMacResource => 'tk/macpkg',
|
autoload :TkOptionDB, 'tk/optiondb'
|
||||||
|
autoload :TkOption, 'tk/optiondb'
|
||||||
|
autoload :TkResourceDB, 'tk/optiondb'
|
||||||
|
|
||||||
:TkMenu => 'tk/menu',
|
autoload :TkPackage, 'tk/package'
|
||||||
:TkMenuClone => 'tk/menu',
|
|
||||||
:TkSystemMenu => 'tk/menu',
|
|
||||||
:TkSysMenu_Help => 'tk/menu',
|
|
||||||
:TkSysMenu_System => 'tk/menu',
|
|
||||||
:TkSysMenu_Apple => 'tk/menu',
|
|
||||||
:TkMenubutton => 'tk/menu',
|
|
||||||
:TkOptionMenubutton => 'tk/menu',
|
|
||||||
|
|
||||||
:TkMenubar => 'tk/menubar',
|
autoload :TkPalette, 'tk/palette'
|
||||||
|
|
||||||
:TkMenuSpec => 'tk/menuspec',
|
autoload :TkScrollbox, 'tk/scrollbox'
|
||||||
|
|
||||||
:TkMessage => 'tk/message',
|
autoload :TkSelection, 'tk/selection'
|
||||||
|
|
||||||
:TkManageFocus => 'tk/mngfocus',
|
autoload :TkTreatTagFont, 'tk/tagfont'
|
||||||
|
|
||||||
:TkMsgCatalog => 'tk/msgcat',
|
autoload :TkTextImage, 'tk/textimage'
|
||||||
:TkMsgCat => 'tk/msgcat',
|
autoload :TktImage, 'tk/textimage'
|
||||||
|
|
||||||
:TkNamespace => 'tk/namespace',
|
autoload :TkTextMark, 'tk/textmark'
|
||||||
|
autoload :TkTextNamedMark, 'tk/textmark'
|
||||||
|
autoload :TkTextMarkInsert, 'tk/textmark'
|
||||||
|
autoload :TkTextMarkCurrent, 'tk/textmark'
|
||||||
|
autoload :TkTextMarkAnchor, 'tk/textmark'
|
||||||
|
autoload :TktMark, 'tk/textmark'
|
||||||
|
autoload :TktNamedMark, 'tk/textmark'
|
||||||
|
autoload :TktMarkInsert, 'tk/textmark'
|
||||||
|
autoload :TktMarkCurrent, 'tk/textmark'
|
||||||
|
autoload :TktMarkAnchor, 'tk/textmark'
|
||||||
|
|
||||||
:TkOptionDB => 'tk/optiondb',
|
autoload :TkTextTag, 'tk/texttag'
|
||||||
:TkOption => 'tk/optiondb',
|
autoload :TkTextNamedTag, 'tk/texttag'
|
||||||
:TkResourceDB => 'tk/optiondb',
|
autoload :TkTextTagSel, 'tk/texttag'
|
||||||
|
autoload :TktTag, 'tk/texttag'
|
||||||
|
autoload :TktNamedTag, 'tk/texttag'
|
||||||
|
autoload :TktTagSel, 'tk/texttag'
|
||||||
|
|
||||||
:TkPackage => 'tk/package',
|
autoload :TkTextWindow, 'tk/textwindow'
|
||||||
|
autoload :TktWindow, 'tk/textwindow'
|
||||||
|
|
||||||
:TkPalette => 'tk/palette',
|
autoload :TkAfter, 'tk/timer'
|
||||||
|
autoload :TkTimer, 'tk/timer'
|
||||||
|
autoload :TkRTTimer, 'tk/timer'
|
||||||
|
|
||||||
:TkPanedWindow => 'tk/panedwindow',
|
autoload :TkTextWin, 'tk/txtwin_abst'
|
||||||
:TkPanedwindow => 'tk/panedwindow',
|
|
||||||
|
|
||||||
:TkRadioButton => 'tk/radiobutton',
|
autoload :TkValidation, 'tk/validation'
|
||||||
:TkRadiobutton => 'tk/radiobutton',
|
autoload :TkValidateCommand, 'tk/validation'
|
||||||
|
|
||||||
:TkRoot => 'tk/root',
|
autoload :TkVariable, 'tk/variable'
|
||||||
|
autoload :TkVarAccess, 'tk/variable'
|
||||||
|
|
||||||
:TkScale => 'tk/scale',
|
autoload :TkVirtualEvent, 'tk/virtevent'
|
||||||
|
autoload :TkNamedVirtualEvent,'tk/virtevent'
|
||||||
|
|
||||||
:TkScrollbar => 'tk/scrollbar',
|
autoload :TkWinfo, 'tk/winfo'
|
||||||
:TkXScrollbar => 'tk/scrollbar',
|
|
||||||
:TkYScrollbar => 'tk/scrollbar',
|
|
||||||
|
|
||||||
:TkScrollbox => 'tk/scrollbox',
|
autoload :TkXIM, 'tk/xim'
|
||||||
|
|
||||||
:TkSelection => 'tk/selection',
|
|
||||||
|
|
||||||
:TkSpinbox => 'tk/spinbox',
|
############################################
|
||||||
|
# toplevel classes/modules (switchable)
|
||||||
|
module Tk
|
||||||
|
@TOPLEVEL_ALIAS_TABLE = {}
|
||||||
|
@TOPLEVEL_ALIAS_TABLE[:Tk] = {
|
||||||
|
:TkButton => 'tk/button',
|
||||||
|
|
||||||
:TkTreatTagFont => 'tk/tagfont',
|
:TkCanvas => 'tk/canvas',
|
||||||
|
|
||||||
:TkText => 'tk/text',
|
:TkCheckButton => 'tk/checkbutton',
|
||||||
|
:TkCheckbutton => 'tk/checkbutton',
|
||||||
|
|
||||||
:TkTextImage => 'tk/textimage',
|
# :TkDialog => 'tk/dialog',
|
||||||
:TktImage => 'tk/textimage',
|
# :TkDialog2 => 'tk/dialog',
|
||||||
|
# :TkDialogObj => 'tk/dialog',
|
||||||
|
# :TkWarning => 'tk/dialog',
|
||||||
|
# :TkWarning2 => 'tk/dialog',
|
||||||
|
# :TkWarningObj => 'tk/dialog',
|
||||||
|
|
||||||
:TkTextMark => 'tk/textmark',
|
:TkEntry => 'tk/entry',
|
||||||
:TkTextNamedMark => 'tk/textmark',
|
|
||||||
:TkTextMarkInsert => 'tk/textmark',
|
|
||||||
:TkTextMarkCurrent => 'tk/textmark',
|
|
||||||
:TkTextMarkAnchor => 'tk/textmark',
|
|
||||||
:TktMark => 'tk/textmark',
|
|
||||||
:TktNamedMark => 'tk/textmark',
|
|
||||||
:TktMarkInsert => 'tk/textmark',
|
|
||||||
:TktMarkCurrent => 'tk/textmark',
|
|
||||||
:TktMarkAnchor => 'tk/textmark',
|
|
||||||
|
|
||||||
:TkTextTag => 'tk/texttag',
|
:TkFrame => 'tk/frame',
|
||||||
:TkTextNamedTag => 'tk/texttag',
|
|
||||||
:TkTextTagSel => 'tk/texttag',
|
|
||||||
:TktTag => 'tk/texttag',
|
|
||||||
:TktNamedTag => 'tk/texttag',
|
|
||||||
:TktTagSel => 'tk/texttag',
|
|
||||||
|
|
||||||
:TkTextWindow => 'tk/textwindow',
|
:TkLabel => 'tk/label',
|
||||||
:TktWindow => 'tk/textwindow',
|
|
||||||
|
|
||||||
:TkAfter => 'tk/timer',
|
:TkLabelFrame => 'tk/labelframe',
|
||||||
:TkTimer => 'tk/timer',
|
:TkLabelframe => 'tk/labelframe',
|
||||||
:TkRTTimer => 'tk/timer',
|
|
||||||
|
|
||||||
:TkToplevel => 'tk/toplevel',
|
:TkListbox => 'tk/listbox',
|
||||||
|
|
||||||
:TkTextWin => 'tk/txtwin_abst',
|
:TkMacResource => 'tk/macpkg',
|
||||||
|
|
||||||
:TkValidation => 'tk/validation',
|
:TkMenu => 'tk/menu',
|
||||||
|
:TkMenuClone => 'tk/menu',
|
||||||
|
:TkCloneMenu => 'tk/menu',
|
||||||
|
# :TkSystemMenu => 'tk/menu',
|
||||||
|
:TkSysMenu_Help => 'tk/menu',
|
||||||
|
:TkSysMenu_System => 'tk/menu',
|
||||||
|
:TkSysMenu_Apple => 'tk/menu',
|
||||||
|
:TkMenubutton => 'tk/menu',
|
||||||
|
:TkMenuButton => 'tk/menu',
|
||||||
|
:TkOptionMenubutton => 'tk/menu',
|
||||||
|
:TkOptionMenuButton => 'tk/menu',
|
||||||
|
|
||||||
:TkVariable => 'tk/variable',
|
:TkMessage => 'tk/message',
|
||||||
:TkVarAccess => 'tk/variable',
|
|
||||||
|
|
||||||
:TkVirtualEvent => 'tk/virtevent',
|
:TkPanedWindow => 'tk/panedwindow',
|
||||||
:TkNamedVirtualEvent => 'tk/virtevent',
|
:TkPanedwindow => 'tk/panedwindow',
|
||||||
|
|
||||||
:TkWinfo => 'tk/winfo',
|
:TkRadioButton => 'tk/radiobutton',
|
||||||
|
:TkRadiobutton => 'tk/radiobutton',
|
||||||
|
|
||||||
:TkWinDDE => 'tk/winpkg',
|
:TkRoot => 'tk/root',
|
||||||
:TkWinRegistry => 'tk/winpkg',
|
|
||||||
|
|
||||||
:TkXIM => 'tk/xim',
|
:TkScale => 'tk/scale',
|
||||||
}
|
|
||||||
autoload_list.each{|mod, lib|
|
:TkScrollbar => 'tk/scrollbar',
|
||||||
#autoload mod, lib unless
|
:TkXScrollbar => 'tk/scrollbar',
|
||||||
autoload mod, lib unless (Object.const_defined? mod) && (autoload? mod)
|
:TkYScrollbar => 'tk/scrollbar',
|
||||||
}
|
|
||||||
|
:TkSpinbox => 'tk/spinbox',
|
||||||
|
|
||||||
|
:TkText => 'tk/text',
|
||||||
|
|
||||||
|
:TkToplevel => 'tk/toplevel',
|
||||||
|
|
||||||
|
:TkWinDDE => 'tk/winpkg',
|
||||||
|
:TkWinRegistry => 'tk/winpkg',
|
||||||
|
}
|
||||||
|
|
||||||
|
@TOPLEVEL_ALIAS_SETUP_PROC = {}
|
||||||
|
|
||||||
|
@current_default_widget_set = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
############################################
|
||||||
|
|
||||||
|
class << Tk
|
||||||
|
def default_widget_set
|
||||||
|
@current_default_widget_set
|
||||||
|
end
|
||||||
|
|
||||||
|
def default_widget_set=(target)
|
||||||
|
target = target.to_sym
|
||||||
|
return target if target == @current_default_widget_set
|
||||||
|
|
||||||
|
if (cmd = @TOPLEVEL_ALIAS_SETUP_PROC[target])
|
||||||
|
cmd.call(target)
|
||||||
|
end
|
||||||
|
|
||||||
|
_replace_toplevel_aliases(target)
|
||||||
|
end
|
||||||
|
|
||||||
|
def __set_toplevel_aliases__(target, obj, *symbols)
|
||||||
|
@TOPLEVEL_ALIAS_TABLE[target = target.to_sym] ||= {}
|
||||||
|
symbols.each{|sym|
|
||||||
|
@TOPLEVEL_ALIAS_TABLE[target][sym = sym.to_sym] = obj
|
||||||
|
if @current_default_widget_set == target
|
||||||
|
Object.class_eval{remove_const sym} if Object.const_defined?(sym)
|
||||||
|
Object.const_set(sym, obj)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
###################################
|
||||||
|
private
|
||||||
|
def _replace_toplevel_aliases(target)
|
||||||
|
# check already autoloaded
|
||||||
|
if (table = @TOPLEVEL_ALIAS_TABLE[current = @current_default_widget_set])
|
||||||
|
table.each{|sym, file|
|
||||||
|
if !Object.autoload?(sym) && Object.const_defined?(sym) &&
|
||||||
|
@TOPLEVEL_ALIAS_TABLE[current][sym].kind_of?(String)
|
||||||
|
# autoload -> class
|
||||||
|
@TOPLEVEL_ALIAS_TABLE[current][sym] = Object.const_get(sym)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# setup autoloads
|
||||||
|
@TOPLEVEL_ALIAS_TABLE[target].each{|sym, file|
|
||||||
|
Object.class_eval{remove_const sym} if Object.const_defined?(sym)
|
||||||
|
if file.kind_of?(String)
|
||||||
|
# file => autoload target file
|
||||||
|
Object.autoload(sym, file)
|
||||||
|
else
|
||||||
|
# file => loaded class object
|
||||||
|
Object.const_set(sym, file)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
# update current alias
|
||||||
|
@current_default_widget_set = target
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# setup default widget set => :Tk
|
||||||
|
Tk.default_widget_set = :Tk
|
||||||
|
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# depend on the version of Tcl/Tk
|
||||||
|
major, minor, type, type_name, patchlevel = TclTkLib.get_version
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# Ttk (Tile) support
|
||||||
|
if major > 8 ||
|
||||||
|
(major == 8 && minor > 5) ||
|
||||||
|
(major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA)
|
||||||
|
# Tcl/Tk 8.5 beta or later
|
||||||
|
Object.autoload :Ttk, 'tkextlib/tile'
|
||||||
|
Tk.autoload :Tile, 'tkextlib/tile'
|
||||||
|
|
||||||
|
require 'tk/ttk_selector'
|
||||||
|
end
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
require 'tk'
|
require 'tk'
|
||||||
require 'tk/label'
|
require 'tk/label'
|
||||||
|
|
||||||
class Tk::Button<TkLabel
|
class Tk::Button<Tk::Label
|
||||||
TkCommandNames = ['button'.freeze].freeze
|
TkCommandNames = ['button'.freeze].freeze
|
||||||
WidgetClassName = 'Button'.freeze
|
WidgetClassName = 'Button'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
@ -26,4 +26,5 @@ class Tk::Button<TkLabel
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkButton = Tk::Button unless Object.const_defined? :TkButton
|
#TkButton = Tk::Button unless Object.const_defined? :TkButton
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Button, :TkButton)
|
||||||
|
@ -572,7 +572,8 @@ class Tk::Canvas<TkWindow
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkCanvas = Tk::Canvas unless Object.const_defined? :TkCanvas
|
#TkCanvas = Tk::Canvas unless Object.const_defined? :TkCanvas
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Canvas, :TkCanvas)
|
||||||
|
|
||||||
|
|
||||||
class TkcItem<TkObject
|
class TkcItem<TkObject
|
||||||
@ -660,8 +661,8 @@ class TkcItem<TkObject
|
|||||||
########################################
|
########################################
|
||||||
|
|
||||||
def initialize(parent, *args)
|
def initialize(parent, *args)
|
||||||
#unless parent.kind_of?(TkCanvas)
|
#unless parent.kind_of?(Tk::Canvas)
|
||||||
# fail ArgumentError, "expect TkCanvas for 1st argument"
|
# fail ArgumentError, "expect Tk::Canvas for 1st argument"
|
||||||
#end
|
#end
|
||||||
@parent = @c = parent
|
@parent = @c = parent
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
require 'tk'
|
require 'tk'
|
||||||
require 'tk/radiobutton'
|
require 'tk/radiobutton'
|
||||||
|
|
||||||
class Tk::CheckButton<TkRadioButton
|
class Tk::CheckButton<Tk::RadioButton
|
||||||
TkCommandNames = ['checkbutton'.freeze].freeze
|
TkCommandNames = ['checkbutton'.freeze].freeze
|
||||||
WidgetClassName = 'Checkbutton'.freeze
|
WidgetClassName = 'Checkbutton'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
@ -24,5 +24,7 @@ class Tk::CheckButton<TkRadioButton
|
|||||||
end
|
end
|
||||||
|
|
||||||
Tk::Checkbutton = Tk::CheckButton
|
Tk::Checkbutton = Tk::CheckButton
|
||||||
TkCheckButton = Tk::CheckButton unless Object.const_defined? :TkCheckButton
|
#TkCheckButton = Tk::CheckButton unless Object.const_defined? :TkCheckButton
|
||||||
TkCheckbutton = Tk::Checkbutton unless Object.const_defined? :TkCheckbutton
|
#TkCheckbutton = Tk::Checkbutton unless Object.const_defined? :TkCheckbutton
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::CheckButton,
|
||||||
|
:TkCheckButton, :TkCheckbutton)
|
||||||
|
@ -34,7 +34,8 @@ module TkComposite
|
|||||||
|
|
||||||
if klass
|
if klass
|
||||||
# WidgetClassName is a known class
|
# WidgetClassName is a known class
|
||||||
if klass <= TkFrame || klass < TkComposite
|
#if klass <= TkFrame || klass < TkComposite
|
||||||
|
if klass <= TkFrame || klass < Tk::Frame || klass < TkComposite
|
||||||
# klass is valid for the base frame
|
# klass is valid for the base frame
|
||||||
if self.class <= klass
|
if self.class <= klass
|
||||||
# use my classname
|
# use my classname
|
||||||
@ -50,7 +51,8 @@ module TkComposite
|
|||||||
|
|
||||||
else
|
else
|
||||||
# klass is invalid for the base frame
|
# klass is invalid for the base frame
|
||||||
if self.class < TkFrame || self.class.superclass < TkComposite
|
#if self.class < TkFrame || self.class.superclass < TkComposite
|
||||||
|
if self.class < TkFrame || self.class.superclass < Tk::Frame || self.class.superclass < TkComposite
|
||||||
# my class name is valid for the base frame -> use my classname
|
# my class name is valid for the base frame -> use my classname
|
||||||
base_class_name = self.class.name
|
base_class_name = self.class.name
|
||||||
if base_class_name == ''
|
if base_class_name == ''
|
||||||
@ -69,7 +71,8 @@ module TkComposite
|
|||||||
|
|
||||||
else
|
else
|
||||||
# no valid WidgetClassName
|
# no valid WidgetClassName
|
||||||
if self.class < TkFrame || self.class.superclass < TkComposite
|
#if self.class < TkFrame || self.class.superclass < TkComposite
|
||||||
|
if self.class < TkFrame || self.class.superclass < Tk::Frame || self.class.superclass < TkComposite
|
||||||
# my class name is valid for the base frame -> use my classname
|
# my class name is valid for the base frame -> use my classname
|
||||||
base_class_name = self.class.name
|
base_class_name = self.class.name
|
||||||
if base_class_name == ''
|
if base_class_name == ''
|
||||||
@ -108,8 +111,12 @@ module TkComposite
|
|||||||
end
|
end
|
||||||
|
|
||||||
if base_class_name
|
if base_class_name
|
||||||
|
# @frame = Tk::Frame.new(parent, :class=>base_class_name)
|
||||||
|
# --> use current TkFrame class
|
||||||
@frame = TkFrame.new(parent, :class=>base_class_name)
|
@frame = TkFrame.new(parent, :class=>base_class_name)
|
||||||
else
|
else
|
||||||
|
# @frame = Tk::Frame.new(parent)
|
||||||
|
# --> use current TkFrame class
|
||||||
@frame = TkFrame.new(parent)
|
@frame = TkFrame.new(parent)
|
||||||
end
|
end
|
||||||
@path = @epath = @frame.path
|
@path = @epath = @frame.path
|
||||||
|
@ -7,7 +7,7 @@ require 'tk/label'
|
|||||||
require 'tk/scrollable'
|
require 'tk/scrollable'
|
||||||
require 'tk/validation'
|
require 'tk/validation'
|
||||||
|
|
||||||
class Tk::Entry<TkLabel
|
class Tk::Entry<Tk::Label
|
||||||
include X_Scrollable
|
include X_Scrollable
|
||||||
include TkValidation
|
include TkValidation
|
||||||
|
|
||||||
@ -115,4 +115,5 @@ class Tk::Entry<TkLabel
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkEntry = Tk::Entry unless Object.const_defined? :TkEntry
|
#TkEntry = Tk::Entry unless Object.const_defined? :TkEntry
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Entry, :TkEntry)
|
||||||
|
@ -15,6 +15,8 @@ require 'tk'
|
|||||||
module TkEvent
|
module TkEvent
|
||||||
class Event < TkUtil::CallbackSubst
|
class Event < TkUtil::CallbackSubst
|
||||||
module Grp
|
module Grp
|
||||||
|
major, minor, type, type_name, patchlevel = TclTkLib.get_version
|
||||||
|
|
||||||
KEY = 0x1
|
KEY = 0x1
|
||||||
BUTTON = 0x2
|
BUTTON = 0x2
|
||||||
MOTION = 0x4
|
MOTION = 0x4
|
||||||
@ -39,7 +41,7 @@ module TkEvent
|
|||||||
RESIZEREQ = 0x200000
|
RESIZEREQ = 0x200000
|
||||||
CIRCREQ = 0x400000
|
CIRCREQ = 0x400000
|
||||||
|
|
||||||
MWHEEL = 0x10000000
|
MWHEEL = KEY
|
||||||
|
|
||||||
ALL = 0xFFFFFFFF
|
ALL = 0xFFFFFFFF
|
||||||
|
|
||||||
@ -298,31 +300,54 @@ module TkEvent
|
|||||||
[ ?b, ?n, :num ],
|
[ ?b, ?n, :num ],
|
||||||
[ ?c, ?n, :count ],
|
[ ?c, ?n, :count ],
|
||||||
[ ?d, ?s, :detail ],
|
[ ?d, ?s, :detail ],
|
||||||
|
# ?e
|
||||||
[ ?f, ?b, :focus ],
|
[ ?f, ?b, :focus ],
|
||||||
|
# ?g
|
||||||
[ ?h, ?n, :height ],
|
[ ?h, ?n, :height ],
|
||||||
[ ?i, ?s, :win_hex ],
|
[ ?i, ?s, :win_hex ],
|
||||||
|
# ?j
|
||||||
[ ?k, ?n, :keycode ],
|
[ ?k, ?n, :keycode ],
|
||||||
|
# ?l
|
||||||
[ ?m, ?s, :mode ],
|
[ ?m, ?s, :mode ],
|
||||||
|
# ?n
|
||||||
[ ?o, ?b, :override ],
|
[ ?o, ?b, :override ],
|
||||||
[ ?p, ?s, :place ],
|
[ ?p, ?s, :place ],
|
||||||
|
# ?q
|
||||||
|
# ?r
|
||||||
[ ?s, ?x, :state ],
|
[ ?s, ?x, :state ],
|
||||||
[ ?t, ?n, :time ],
|
[ ?t, ?n, :time ],
|
||||||
|
# ?u
|
||||||
|
[ ?v, ?n, :value_mask ],
|
||||||
[ ?w, ?n, :width ],
|
[ ?w, ?n, :width ],
|
||||||
[ ?x, ?n, :x ],
|
[ ?x, ?n, :x ],
|
||||||
[ ?y, ?n, :y ],
|
[ ?y, ?n, :y ],
|
||||||
|
# ?z
|
||||||
[ ?A, ?s, :char ],
|
[ ?A, ?s, :char ],
|
||||||
[ ?B, ?n, :borderwidth ],
|
[ ?B, ?n, :borderwidth ],
|
||||||
|
# ?C
|
||||||
[ ?D, ?n, :wheel_delta ],
|
[ ?D, ?n, :wheel_delta ],
|
||||||
[ ?E, ?b, :send_event ],
|
[ ?E, ?b, :send_event ],
|
||||||
|
# ?F
|
||||||
|
# ?G
|
||||||
|
# ?H
|
||||||
|
# ?I
|
||||||
|
# ?J
|
||||||
[ ?K, ?s, :keysym ],
|
[ ?K, ?s, :keysym ],
|
||||||
|
# ?L
|
||||||
|
# ?M
|
||||||
[ ?N, ?n, :keysym_num ],
|
[ ?N, ?n, :keysym_num ],
|
||||||
|
# ?O
|
||||||
[ ?P, ?s, :property ],
|
[ ?P, ?s, :property ],
|
||||||
|
# ?Q
|
||||||
[ ?R, ?s, :rootwin_id ],
|
[ ?R, ?s, :rootwin_id ],
|
||||||
[ ?S, ?s, :subwindow ],
|
[ ?S, ?s, :subwindow ],
|
||||||
[ ?T, ?n, :type ],
|
[ ?T, ?n, :type ],
|
||||||
|
# ?U
|
||||||
|
# ?V
|
||||||
[ ?W, ?w, :widget ],
|
[ ?W, ?w, :widget ],
|
||||||
[ ?X, ?n, :x_root ],
|
[ ?X, ?n, :x_root ],
|
||||||
[ ?Y, ?n, :y_root ],
|
[ ?Y, ?n, :y_root ],
|
||||||
|
# ?Z
|
||||||
nil
|
nil
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -899,13 +899,15 @@ class TkFont
|
|||||||
if key.include?(';')
|
if key.include?(';')
|
||||||
win, tag, optkey = key.split(';')
|
win, tag, optkey = key.split(';')
|
||||||
winobj = tk_tcl2ruby(win)
|
winobj = tk_tcl2ruby(win)
|
||||||
if winobj.kind_of? TkText
|
#if winobj.kind_of? TkText
|
||||||
|
if winobj.kind_of?(TkText) || winobj.kind_of?(Tk::Text)
|
||||||
if optkey
|
if optkey
|
||||||
ret.push([winobj, winobj.tagid2obj(tag), optkey])
|
ret.push([winobj, winobj.tagid2obj(tag), optkey])
|
||||||
else
|
else
|
||||||
ret.push([winobj, winobj.tagid2obj(tag)])
|
ret.push([winobj, winobj.tagid2obj(tag)])
|
||||||
end
|
end
|
||||||
elsif winobj.kind_of? TkCanvas
|
#elsif winobj.kind_of? TkCanvas
|
||||||
|
elsif winobj.kind_of?(TkCanvas) || winobj.kind_of?(Tk::Canvas)
|
||||||
if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
|
if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
|
||||||
if optkey
|
if optkey
|
||||||
ret.push([winobj, tagobj, optkey])
|
ret.push([winobj, tagobj, optkey])
|
||||||
@ -925,7 +927,8 @@ class TkFont
|
|||||||
ret.push([winobj, tag])
|
ret.push([winobj, tag])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif winobj.kind_of? TkMenu
|
#elsif winobj.kind_of? TkMenu
|
||||||
|
elsif winobj.kind_of?(TkMenu) || winobj.kind_of?(Tk::Menu)
|
||||||
if optkey
|
if optkey
|
||||||
ret.push([winobj, tag, optkey])
|
ret.push([winobj, tag, optkey])
|
||||||
else
|
else
|
||||||
@ -1504,11 +1507,14 @@ module TkFont::CoreMethods
|
|||||||
optkey = 'font' if optkey == nil || optkey == ''
|
optkey = 'font' if optkey == nil || optkey == ''
|
||||||
winobj = tk_tcl2ruby(win)
|
winobj = tk_tcl2ruby(win)
|
||||||
# winobj.tagfont_configure(tag, {'font'=>@latinfont})
|
# winobj.tagfont_configure(tag, {'font'=>@latinfont})
|
||||||
if winobj.kind_of? TkText
|
#if winobj.kind_of? TkText
|
||||||
|
if winobj.kind_of?(TkText) || winobj.kind_of?(Tk::Text)
|
||||||
tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @latinfont)
|
tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @latinfont)
|
||||||
elsif winobj.kind_of? TkCanvas
|
#elsif winobj.kind_of? TkCanvas
|
||||||
|
elsif winobj.kind_of?(TkCanvas) || winobj.kind_of?(Tk::Canvas)
|
||||||
tk_call(win, 'itemconfigure', tag, "-#{optkey}", @latinfont)
|
tk_call(win, 'itemconfigure', tag, "-#{optkey}", @latinfont)
|
||||||
elsif winobj.kind_of? TkMenu
|
#elsif winobj.kind_of? TkMenu
|
||||||
|
elsif winobj.kind_of?(TkMenu) || winobj.kind_of?(Tk::Menu)
|
||||||
tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
|
tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
|
||||||
else
|
else
|
||||||
raise RuntimeError, "unknown widget type"
|
raise RuntimeError, "unknown widget type"
|
||||||
@ -1539,11 +1545,14 @@ module TkFont::CoreMethods
|
|||||||
optkey = 'kanjifont' unless optkey
|
optkey = 'kanjifont' unless optkey
|
||||||
winobj = tk_tcl2ruby(win)
|
winobj = tk_tcl2ruby(win)
|
||||||
# winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
|
# winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
|
||||||
if winobj.kind_of? TkText
|
#if winobj.kind_of? TkText
|
||||||
|
if winobj.kind_of?(TkText) || winobj.kind_of?(Tk::Text)
|
||||||
tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @kanjifont)
|
tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @kanjifont)
|
||||||
elsif winobj.kind_of? TkCanvas
|
#elsif winobj.kind_of? TkCanvas
|
||||||
|
elsif winobj.kind_of?(TkCanvas) || winobj.kind_of?(Tk::Canvas)
|
||||||
tk_call(win, 'itemconfigure', tag, "-#{optkey}", @kanjifont)
|
tk_call(win, 'itemconfigure', tag, "-#{optkey}", @kanjifont)
|
||||||
elsif winobj.kind_of? TkMenu
|
#elsif winobj.kind_of? TkMenu
|
||||||
|
elsif winobj.kind_of?(TkMenu) || winobj.kind_of?(Tk::Menu)
|
||||||
tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
|
tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
|
||||||
else
|
else
|
||||||
raise RuntimeError, "unknown widget type"
|
raise RuntimeError, "unknown widget type"
|
||||||
|
@ -127,4 +127,5 @@ class Tk::Frame<TkWindow
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkFrame = Tk::Frame unless Object.const_defined? :TkFrame
|
#TkFrame = Tk::Frame unless Object.const_defined? :TkFrame
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Frame, :TkFrame)
|
||||||
|
@ -17,4 +17,5 @@ class Tk::Label<TkWindow
|
|||||||
#private :create_self
|
#private :create_self
|
||||||
end
|
end
|
||||||
|
|
||||||
TkLabel = Tk::Label unless Object.const_defined? :TkLabel
|
#TkLabel = Tk::Label unless Object.const_defined? :TkLabel
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Label, :TkLabel)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
require 'tk'
|
require 'tk'
|
||||||
require 'tk/frame'
|
require 'tk/frame'
|
||||||
|
|
||||||
class Tk::LabelFrame<TkFrame
|
class Tk::LabelFrame<Tk::Frame
|
||||||
TkCommandNames = ['labelframe'.freeze].freeze
|
TkCommandNames = ['labelframe'.freeze].freeze
|
||||||
WidgetClassName = 'Labelframe'.freeze
|
WidgetClassName = 'Labelframe'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
@ -23,6 +23,7 @@ class Tk::LabelFrame<TkFrame
|
|||||||
private :__val2ruby_optkeys
|
private :__val2ruby_optkeys
|
||||||
end
|
end
|
||||||
|
|
||||||
Tk::Labelframe = TkLabelFrame
|
Tk::Labelframe = Tk::LabelFrame
|
||||||
TkLabelFrame = Tk::LabelFrame unless Object.const_defined? :TkLabelFrame
|
#TkLabelFrame = Tk::LabelFrame unless Object.const_defined? :TkLabelFrame
|
||||||
TkLabelframe = Tk::Labelframe unless Object.const_defined? :TkLabelframe
|
#TkLabelframe = Tk::Labelframe unless Object.const_defined? :TkLabelframe
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::LabelFrame, :TkLabelFrame, :TkLabelframe)
|
||||||
|
@ -278,4 +278,5 @@ class Tk::Listbox<TkTextWin
|
|||||||
=end
|
=end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkListbox = Tk::Listbox unless Object.const_defined? :TkListbox
|
#TkListbox = Tk::Listbox unless Object.const_defined? :TkListbox
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Listbox, :TkListbox)
|
||||||
|
@ -22,7 +22,8 @@ end
|
|||||||
|
|
||||||
module Tk::MacResource
|
module Tk::MacResource
|
||||||
end
|
end
|
||||||
TkMacResource = Tk::MacResource
|
#TkMacResource = Tk::MacResource
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::MacResource, :TkMacResource)
|
||||||
|
|
||||||
module Tk::MacResource
|
module Tk::MacResource
|
||||||
extend Tk
|
extend Tk
|
||||||
|
@ -140,9 +140,9 @@ class Tk::Menu<TkWindow
|
|||||||
type = keys.delete('type') if keys.has_key?('type')
|
type = keys.delete('type') if keys.has_key?('type')
|
||||||
|
|
||||||
if keys.empty?
|
if keys.empty?
|
||||||
TkMenuClone.new(self, parent, type)
|
Tk::MenuClone.new(self, parent, type)
|
||||||
else
|
else
|
||||||
TkMenuClone.new(self, parent, type, keys)
|
Tk::MenuClone.new(self, parent, type, keys)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -381,10 +381,11 @@ class Tk::Menu<TkWindow
|
|||||||
=end
|
=end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkMenu = Tk::Menu unless Object.const_defined? :TkMenu
|
#TkMenu = Tk::Menu unless Object.const_defined? :TkMenu
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Menu, :TkMenu)
|
||||||
|
|
||||||
|
|
||||||
class Tk::MenuClone<TkMenu
|
class Tk::MenuClone<Tk::Menu
|
||||||
=begin
|
=begin
|
||||||
def initialize(parent, type=None)
|
def initialize(parent, type=None)
|
||||||
widgetname = nil
|
widgetname = nil
|
||||||
@ -439,10 +440,11 @@ class Tk::MenuClone<TkMenu
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
Tk::CloneMenu = Tk::MenuClone
|
Tk::CloneMenu = Tk::MenuClone
|
||||||
TkMenuClone = Tk::MenuClone unless Object.const_defined? :TkMenuClone
|
#TkMenuClone = Tk::MenuClone unless Object.const_defined? :TkMenuClone
|
||||||
TkCloneMenu = Tk::CloneMenu unless Object.const_defined? :TkCloneMenu
|
#TkCloneMenu = Tk::CloneMenu unless Object.const_defined? :TkCloneMenu
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::MenuClone, :TkMenuClone, :TkCloneMenu)
|
||||||
|
|
||||||
module TkSystemMenu
|
module Tk::SystemMenu
|
||||||
def initialize(parent, keys=nil)
|
def initialize(parent, keys=nil)
|
||||||
if parent.kind_of? Hash
|
if parent.kind_of? Hash
|
||||||
keys = _symbolkey2str(parent)
|
keys = _symbolkey2str(parent)
|
||||||
@ -465,33 +467,37 @@ module TkSystemMenu
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TkSystemMenu = Tk::SystemMenu
|
||||||
|
|
||||||
|
|
||||||
class Tk::SysMenu_Help<TkMenu
|
class Tk::SysMenu_Help<Tk::Menu
|
||||||
# for all platform
|
# for all platform
|
||||||
include TkSystemMenu
|
include Tk::SystemMenu
|
||||||
SYSMENU_NAME = 'help'
|
SYSMENU_NAME = 'help'
|
||||||
end
|
end
|
||||||
TkSysMenu_Help = Tk::SysMenu_Help unless Object.const_defined? :TkSysMenu_Help
|
#TkSysMenu_Help = Tk::SysMenu_Help unless Object.const_defined? :TkSysMenu_Help
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::SysMenu_Help, :TkSysMenu_Help)
|
||||||
|
|
||||||
|
|
||||||
class Tk::SysMenu_System<TkMenu
|
class Tk::SysMenu_System<Tk::Menu
|
||||||
# for Windows
|
# for Windows
|
||||||
include TkSystemMenu
|
include Tk::SystemMenu
|
||||||
SYSMENU_NAME = 'system'
|
SYSMENU_NAME = 'system'
|
||||||
end
|
end
|
||||||
TkSysMenu_System = Tk::SysMenu_System unless Object.const_defined? :TkSysMenu_System
|
#TkSysMenu_System = Tk::SysMenu_System unless Object.const_defined? :TkSysMenu_System
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::SysMenu_System, :TkSysMenu_System)
|
||||||
|
|
||||||
|
|
||||||
class Tk::SysMenu_Apple<TkMenu
|
class Tk::SysMenu_Apple<Tk::Menu
|
||||||
# for Machintosh
|
# for Machintosh
|
||||||
include TkSystemMenu
|
include Tk::SystemMenu
|
||||||
SYSMENU_NAME = 'apple'
|
SYSMENU_NAME = 'apple'
|
||||||
end
|
end
|
||||||
TkSysMenu_Apple = Tk::SysMenu_Apple unless Object.const_defined? :TkSysMenu_Apple
|
#TkSysMenu_Apple = Tk::SysMenu_Apple unless Object.const_defined? :TkSysMenu_Apple
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::SysMenu_Apple, :TkSysMenu_Apple)
|
||||||
|
|
||||||
|
|
||||||
class Tk::Menubutton<TkLabel
|
class Tk::Menubutton<Tk::Label
|
||||||
TkCommandNames = ['menubutton'.freeze].freeze
|
TkCommandNames = ['menubutton'.freeze].freeze
|
||||||
WidgetClassName = 'Menubutton'.freeze
|
WidgetClassName = 'Menubutton'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
@ -514,11 +520,12 @@ class Tk::Menubutton<TkLabel
|
|||||||
|
|
||||||
end
|
end
|
||||||
Tk::MenuButton = Tk::Menubutton
|
Tk::MenuButton = Tk::Menubutton
|
||||||
TkMenubutton = Tk::Menubutton unless Object.const_defined? :TkMenubutton
|
#TkMenubutton = Tk::Menubutton unless Object.const_defined? :TkMenubutton
|
||||||
TkMenuButton = Tk::MenuButton unless Object.const_defined? :TkMenuButton
|
#TkMenuButton = Tk::MenuButton unless Object.const_defined? :TkMenuButton
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Menubutton, :TkMenubutton, :TkMenuButton)
|
||||||
|
|
||||||
|
|
||||||
class Tk::OptionMenubutton<TkMenubutton
|
class Tk::OptionMenubutton<Tk::Menubutton
|
||||||
TkCommandNames = ['tk_optionMenu'.freeze].freeze
|
TkCommandNames = ['tk_optionMenu'.freeze].freeze
|
||||||
|
|
||||||
class OptionMenu<TkMenu
|
class OptionMenu<TkMenu
|
||||||
@ -640,5 +647,7 @@ class Tk::OptionMenubutton<TkMenubutton
|
|||||||
end
|
end
|
||||||
|
|
||||||
Tk::OptionMenuButton = Tk::OptionMenubutton
|
Tk::OptionMenuButton = Tk::OptionMenubutton
|
||||||
TkOptionMenubutton = Tk::OptionMenubutton unless Object.const_defined? :TkOptionMenubutton
|
#TkOptionMenubutton = Tk::OptionMenubutton unless Object.const_defined? :TkOptionMenubutton
|
||||||
TkOptionMenuButton = Tk::OptionMenuButton unless Object.const_defined? :TkOptionMenuButton
|
#TkOptionMenuButton = Tk::OptionMenuButton unless Object.const_defined? :TkOptionMenuButton
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton,
|
||||||
|
:TkOptionMenubutton, :TkOptionMenuButton)
|
||||||
|
@ -89,7 +89,7 @@ require 'tk/frame'
|
|||||||
require 'tk/composite'
|
require 'tk/composite'
|
||||||
require 'tk/menuspec'
|
require 'tk/menuspec'
|
||||||
|
|
||||||
class TkMenubar<TkFrame
|
class TkMenubar<Tk::Frame
|
||||||
include TkComposite
|
include TkComposite
|
||||||
include TkMenuSpec
|
include TkMenuSpec
|
||||||
|
|
||||||
|
@ -61,8 +61,12 @@ module TkMenuSpec
|
|||||||
tearoff = orig_opts.delete('tearoff') if orig_opts.key?('tearoff')
|
tearoff = orig_opts.delete('tearoff') if orig_opts.key?('tearoff')
|
||||||
|
|
||||||
if menu_name
|
if menu_name
|
||||||
|
#menu = Tk::Menu.new(parent, :widgetname=>menu_name, :tearoff=>tearoff)
|
||||||
|
# --> use current TkMenu class
|
||||||
menu = TkMenu.new(parent, :widgetname=>menu_name, :tearoff=>tearoff)
|
menu = TkMenu.new(parent, :widgetname=>menu_name, :tearoff=>tearoff)
|
||||||
else
|
else
|
||||||
|
#menu = Tk::Menu.new(parent, :tearoff=>tearoff)
|
||||||
|
# --> use current TkMenu class
|
||||||
menu = TkMenu.new(parent, :tearoff=>tearoff)
|
menu = TkMenu.new(parent, :tearoff=>tearoff)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -150,7 +154,7 @@ module TkMenuSpec
|
|||||||
|
|
||||||
def _use_menubar?(parent)
|
def _use_menubar?(parent)
|
||||||
use_menubar = false
|
use_menubar = false
|
||||||
if parent.kind_of?(TkRoot) || parent.kind_of?(TkToplevel)
|
if parent.kind_of?(Tk::Root) || parent.kind_of?(Tk::Toplevel)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -164,7 +168,11 @@ module TkMenuSpec
|
|||||||
private :_use_menubar?
|
private :_use_menubar?
|
||||||
|
|
||||||
def _create_menu_for_menubar(parent)
|
def _create_menu_for_menubar(parent)
|
||||||
unless (mbar = parent.menu).kind_of?(TkMenu)
|
#unless (mbar = parent.menu).kind_of?(TkMenu)
|
||||||
|
# --> use current TkMenu class
|
||||||
|
mbar = parent.menu
|
||||||
|
unless parent.menu.kind_of?(Tk::Menu) || parent.menu.kind_of?(TkMenu)
|
||||||
|
#mbar = Tk::Menu.new(parent, :tearoff=>false)
|
||||||
mbar = TkMenu.new(parent, :tearoff=>false)
|
mbar = TkMenu.new(parent, :tearoff=>false)
|
||||||
parent.menu(mbar)
|
parent.menu(mbar)
|
||||||
end
|
end
|
||||||
@ -221,6 +229,8 @@ module TkMenuSpec
|
|||||||
|
|
||||||
else
|
else
|
||||||
# menubar by menubuttons
|
# menubar by menubuttons
|
||||||
|
#mbtn = Tk::Menubutton.new(parent)
|
||||||
|
# --> use current TkMenubutton class
|
||||||
mbtn = TkMenubutton.new(parent)
|
mbtn = TkMenubutton.new(parent)
|
||||||
|
|
||||||
menu_name = nil
|
menu_name = nil
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
require 'tk'
|
require 'tk'
|
||||||
require 'tk/label'
|
require 'tk/label'
|
||||||
|
|
||||||
class Tk::Message<TkLabel
|
class Tk::Message<Tk::Label
|
||||||
TkCommandNames = ['message'.freeze].freeze
|
TkCommandNames = ['message'.freeze].freeze
|
||||||
WidgetClassName = 'Message'.freeze
|
WidgetClassName = 'Message'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
@ -18,4 +18,5 @@ class Tk::Message<TkLabel
|
|||||||
private :create_self
|
private :create_self
|
||||||
end
|
end
|
||||||
|
|
||||||
TkMessage = Tk::Message unless Object.const_defined? :TkMessage
|
#TkMessage = Tk::Message unless Object.const_defined? :TkMessage
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Message, :TkMessage)
|
||||||
|
@ -362,7 +362,7 @@ module TkOptionDB
|
|||||||
|
|
||||||
def new_proc_class_random(klass, func, safe = 4, add = false, &b)
|
def new_proc_class_random(klass, func, safe = 4, add = false, &b)
|
||||||
eval_under_random_base(){
|
eval_under_random_base(){
|
||||||
TkOption.new_proc_class(klass, func, safe, add, self, &b)
|
TkOptionDB.new_proc_class(klass, func, safe, add, self, &b)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
module_function :new_proc_class_random
|
module_function :new_proc_class_random
|
||||||
|
@ -231,5 +231,7 @@ class Tk::PanedWindow<TkWindow
|
|||||||
end
|
end
|
||||||
|
|
||||||
Tk::Panedwindow = Tk::PanedWindow
|
Tk::Panedwindow = Tk::PanedWindow
|
||||||
TkPanedWindow = Tk::PanedWindow unless Object.const_defined? :TkPanedWindow
|
#TkPanedWindow = Tk::PanedWindow unless Object.const_defined? :TkPanedWindow
|
||||||
TkPanedwindow = Tk::Panedwindow unless Object.const_defined? :TkPanedwindow
|
#TkPanedwindow = Tk::Panedwindow unless Object.const_defined? :TkPanedwindow
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::PanedWindow,
|
||||||
|
:TkPanedWindow, :TkPanedwindow)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
require 'tk'
|
require 'tk'
|
||||||
require 'tk/button'
|
require 'tk/button'
|
||||||
|
|
||||||
class Tk::RadioButton<TkButton
|
class Tk::RadioButton<Tk::Button
|
||||||
TkCommandNames = ['radiobutton'.freeze].freeze
|
TkCommandNames = ['radiobutton'.freeze].freeze
|
||||||
WidgetClassName = 'Radiobutton'.freeze
|
WidgetClassName = 'Radiobutton'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
@ -65,5 +65,7 @@ class Tk::RadioButton<TkButton
|
|||||||
end
|
end
|
||||||
|
|
||||||
Tk::Radiobutton = Tk::RadioButton
|
Tk::Radiobutton = Tk::RadioButton
|
||||||
TkRadioButton = Tk::RadioButton unless Object.const_defined? :TkRadioButton
|
#TkRadioButton = Tk::RadioButton unless Object.const_defined? :TkRadioButton
|
||||||
TkRadiobutton = Tk::Radiobutton unless Object.const_defined? :TkRadiobutton
|
#TkRadiobutton = Tk::Radiobutton unless Object.const_defined? :TkRadiobutton
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::RadioButton,
|
||||||
|
:TkRadioButton, :TkRadiobutton)
|
||||||
|
@ -14,28 +14,7 @@ class Tk::Root<TkWindow
|
|||||||
end
|
end
|
||||||
private :__methodcall_optkeys
|
private :__methodcall_optkeys
|
||||||
|
|
||||||
=begin
|
def Root.new(keys=nil, &b)
|
||||||
ROOT = []
|
|
||||||
def TkRoot.new(keys=nil)
|
|
||||||
if ROOT[0]
|
|
||||||
Tk_WINDOWS["."] = ROOT[0]
|
|
||||||
return ROOT[0]
|
|
||||||
end
|
|
||||||
new = super(:without_creating=>true, :widgetname=>'.')
|
|
||||||
if keys # wm commands
|
|
||||||
keys.each{|k,v|
|
|
||||||
if v.kind_of? Array
|
|
||||||
new.send(k,*v)
|
|
||||||
else
|
|
||||||
new.send(k,v)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
ROOT[0] = new
|
|
||||||
Tk_WINDOWS["."] = new
|
|
||||||
end
|
|
||||||
=end
|
|
||||||
def TkRoot.new(keys=nil, &b)
|
|
||||||
unless TkCore::INTERP.tk_windows['.']
|
unless TkCore::INTERP.tk_windows['.']
|
||||||
TkCore::INTERP.tk_windows['.'] =
|
TkCore::INTERP.tk_windows['.'] =
|
||||||
super(:without_creating=>true, :widgetname=>'.'){}
|
super(:without_creating=>true, :widgetname=>'.'){}
|
||||||
@ -102,9 +81,10 @@ class Tk::Root<TkWindow
|
|||||||
self.menu
|
self.menu
|
||||||
end
|
end
|
||||||
|
|
||||||
def TkRoot.destroy
|
def Root.destroy
|
||||||
TkCore::INTERP._invoke('destroy', '.')
|
TkCore::INTERP._invoke('destroy', '.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkRoot = Tk::Root unless Object.const_defined? :TkRoot
|
#TkRoot = Tk::Root unless Object.const_defined? :TkRoot
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Root, :TkRoot)
|
||||||
|
@ -85,4 +85,5 @@ class Tk::Scale<TkWindow
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkScale = Tk::Scale unless Object.const_defined? :TkScale
|
#TkScale = Tk::Scale unless Object.const_defined? :TkScale
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Scale, :TkScale)
|
||||||
|
@ -105,10 +105,11 @@ class Tk::Scrollbar<TkWindow
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkScrollbar = Tk::Scrollbar unless Object.const_defined? :TkScrollbar
|
#TkScrollbar = Tk::Scrollbar unless Object.const_defined? :TkScrollbar
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Scrollbar, :TkScrollbar)
|
||||||
|
|
||||||
|
|
||||||
class Tk::XScrollbar<TkScrollbar
|
class Tk::XScrollbar<Tk::Scrollbar
|
||||||
def create_self(keys)
|
def create_self(keys)
|
||||||
keys = {} unless keys
|
keys = {} unless keys
|
||||||
keys['orient'] = 'horizontal'
|
keys['orient'] = 'horizontal'
|
||||||
@ -117,10 +118,11 @@ class Tk::XScrollbar<TkScrollbar
|
|||||||
private :create_self
|
private :create_self
|
||||||
end
|
end
|
||||||
|
|
||||||
TkXScrollbar = Tk::XScrollbar unless Object.const_defined? :TkXScrollbar
|
#TkXScrollbar = Tk::XScrollbar unless Object.const_defined? :TkXScrollbar
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::XScrollbar, :TkXScrollbar)
|
||||||
|
|
||||||
|
|
||||||
class Tk::YScrollbar<TkScrollbar
|
class Tk::YScrollbar<Tk::Scrollbar
|
||||||
def create_self(keys)
|
def create_self(keys)
|
||||||
keys = {} unless keys
|
keys = {} unless keys
|
||||||
keys['orient'] = 'vertical'
|
keys['orient'] = 'vertical'
|
||||||
@ -129,4 +131,5 @@ class Tk::YScrollbar<TkScrollbar
|
|||||||
private :create_self
|
private :create_self
|
||||||
end
|
end
|
||||||
|
|
||||||
TkYScrollbar = Tk::YScrollbar unless Object.const_defined? :TkYScrollbar
|
#TkYScrollbar = Tk::YScrollbar unless Object.const_defined? :TkYScrollbar
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::YScrollbar, :TkYScrollbar)
|
||||||
|
@ -6,10 +6,14 @@
|
|||||||
require 'tk'
|
require 'tk'
|
||||||
require 'tk/listbox'
|
require 'tk/listbox'
|
||||||
|
|
||||||
class TkScrollbox<TkListbox
|
class TkScrollbox<Tk::Listbox
|
||||||
include TkComposite
|
include TkComposite
|
||||||
def initialize_composite(keys=nil)
|
def initialize_composite(keys=nil)
|
||||||
|
#list = Tk::Listbox.new(@frame)
|
||||||
|
# -> use current TkListbox class
|
||||||
list = TkListbox.new(@frame)
|
list = TkListbox.new(@frame)
|
||||||
|
#scroll = Tk::Scrollbar.new(@frame)
|
||||||
|
# -> use current TkScrollbar class
|
||||||
scroll = TkScrollbar.new(@frame)
|
scroll = TkScrollbar.new(@frame)
|
||||||
@path = list.path
|
@path = list.path
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
require 'tk'
|
require 'tk'
|
||||||
require 'tk/entry'
|
require 'tk/entry'
|
||||||
|
|
||||||
class Tk::Spinbox<TkEntry
|
class Tk::Spinbox<Tk::Entry
|
||||||
TkCommandNames = ['spinbox'.freeze].freeze
|
TkCommandNames = ['spinbox'.freeze].freeze
|
||||||
WidgetClassName = 'Spinbox'.freeze
|
WidgetClassName = 'Spinbox'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
@ -97,4 +97,5 @@ class Tk::Spinbox<TkEntry
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkSpinbox = Tk::Spinbox unless Object.const_defined? :TkSpinbox
|
#TkSpinbox = Tk::Spinbox unless Object.const_defined? :TkSpinbox
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Spinbox, :TkSpinbox)
|
||||||
|
@ -73,9 +73,9 @@ class Tk::Text<TkTextWin
|
|||||||
|
|
||||||
mod = mod.to_s
|
mod = mod.to_s
|
||||||
if mod =~ /^\s*[+-]?\d/
|
if mod =~ /^\s*[+-]?\d/
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod)
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod)
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod)
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -84,20 +84,20 @@ class Tk::Text<TkTextWin
|
|||||||
|
|
||||||
mod = mod.to_s
|
mod = mod.to_s
|
||||||
if mod =~ /^\s*[+-]?\d/
|
if mod =~ /^\s*[+-]?\d/
|
||||||
TkText::IndexString.new(String.new(id) << ' - ' << mod)
|
Tk::Text::IndexString.new(String.new(id) << ' - ' << mod)
|
||||||
elsif mod =~ /^\s*[-]\s+(\d.*)$/
|
elsif mod =~ /^\s*[-]\s+(\d.*)$/
|
||||||
TkText::IndexString.new(String.new(id) << ' - -' << $1)
|
Tk::Text::IndexString.new(String.new(id) << ' - -' << $1)
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod)
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def chars(mod)
|
def chars(mod)
|
||||||
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
||||||
if mod < 0
|
if mod < 0
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' chars')
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' chars')
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' chars')
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' chars')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias char chars
|
alias char chars
|
||||||
@ -106,9 +106,9 @@ class Tk::Text<TkTextWin
|
|||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
||||||
if mod < 0
|
if mod < 0
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display chars')
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display chars')
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display chars')
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display chars')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias display_char display_chars
|
alias display_char display_chars
|
||||||
@ -117,9 +117,9 @@ class Tk::Text<TkTextWin
|
|||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
||||||
if mod < 0
|
if mod < 0
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any chars')
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any chars')
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any chars')
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any chars')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias any_char any_chars
|
alias any_char any_chars
|
||||||
@ -128,9 +128,9 @@ class Tk::Text<TkTextWin
|
|||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
||||||
if mod < 0
|
if mod < 0
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' indices')
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' indices')
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' indices')
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' indices')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -138,9 +138,9 @@ class Tk::Text<TkTextWin
|
|||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
||||||
if mod < 0
|
if mod < 0
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display indices')
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display indices')
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display indices')
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display indices')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -148,18 +148,18 @@ class Tk::Text<TkTextWin
|
|||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
||||||
if mod < 0
|
if mod < 0
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any indices')
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any indices')
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any indices')
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any indices')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def lines(mod)
|
def lines(mod)
|
||||||
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
||||||
if mod < 0
|
if mod < 0
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' lines')
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' lines')
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' lines')
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' lines')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias line lines
|
alias line lines
|
||||||
@ -168,9 +168,9 @@ class Tk::Text<TkTextWin
|
|||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
||||||
if mod < 0
|
if mod < 0
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display_lines')
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display_lines')
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display lines')
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display lines')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias display_line display_lines
|
alias display_line display_lines
|
||||||
@ -179,43 +179,43 @@ class Tk::Text<TkTextWin
|
|||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
|
||||||
if mod < 0
|
if mod < 0
|
||||||
TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any_lines')
|
Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any_lines')
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any lines')
|
Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any lines')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias any_line any_lines
|
alias any_line any_lines
|
||||||
|
|
||||||
def linestart
|
def linestart
|
||||||
TkText::IndexString.new(String.new(id) << ' linestart')
|
Tk::Text::IndexString.new(String.new(id) << ' linestart')
|
||||||
end
|
end
|
||||||
def lineend
|
def lineend
|
||||||
TkText::IndexString.new(String.new(id) << ' lineend')
|
Tk::Text::IndexString.new(String.new(id) << ' lineend')
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_linestart
|
def display_linestart
|
||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
TkText::IndexString.new(String.new(id) << ' display linestart')
|
Tk::Text::IndexString.new(String.new(id) << ' display linestart')
|
||||||
end
|
end
|
||||||
def display_lineend
|
def display_lineend
|
||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
TkText::IndexString.new(String.new(id) << ' display lineend')
|
Tk::Text::IndexString.new(String.new(id) << ' display lineend')
|
||||||
end
|
end
|
||||||
|
|
||||||
def wordstart
|
def wordstart
|
||||||
TkText::IndexString.new(String.new(id) << ' wordstart')
|
Tk::Text::IndexString.new(String.new(id) << ' wordstart')
|
||||||
end
|
end
|
||||||
def wordend
|
def wordend
|
||||||
TkText::IndexString.new(String.new(id) << ' wordend')
|
Tk::Text::IndexString.new(String.new(id) << ' wordend')
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_wordstart
|
def display_wordstart
|
||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
TkText::IndexString.new(String.new(id) << ' display wordstart')
|
Tk::Text::IndexString.new(String.new(id) << ' display wordstart')
|
||||||
end
|
end
|
||||||
def display_wordend
|
def display_wordend
|
||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
TkText::IndexString.new(String.new(id) << ' display wordend')
|
Tk::Text::IndexString.new(String.new(id) << ' display wordend')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -284,16 +284,16 @@ class Tk::Text<TkTextWin
|
|||||||
private :__strval_optkeys
|
private :__strval_optkeys
|
||||||
|
|
||||||
def self.at(x, y)
|
def self.at(x, y)
|
||||||
TkText::IndexString.at(x, y)
|
Tk::Text::IndexString.at(x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
def at(x, y)
|
def at(x, y)
|
||||||
TkText::IndexString.at(x, y)
|
Tk::Text::IndexString.at(x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
def index(idx)
|
def index(idx)
|
||||||
TkText::IndexString.new(tk_send_without_enc('index',
|
Tk::Text::IndexString.new(tk_send_without_enc('index',
|
||||||
_get_eval_enc_str(idx)))
|
_get_eval_enc_str(idx)))
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_displaychars(*index)
|
def get_displaychars(*index)
|
||||||
@ -967,7 +967,7 @@ class Tk::Text<TkTextWin
|
|||||||
false, true)
|
false, true)
|
||||||
r = []
|
r = []
|
||||||
while key=l.shift
|
while key=l.shift
|
||||||
r.push [TkText::IndexString.new(key), TkText::IndexString.new(l.shift)]
|
r.push [Tk::Text::IndexString.new(key), Tk::Text::IndexString.new(l.shift)]
|
||||||
end
|
end
|
||||||
r
|
r
|
||||||
end
|
end
|
||||||
@ -977,7 +977,7 @@ class Tk::Text<TkTextWin
|
|||||||
_get_eval_enc_str(tag),
|
_get_eval_enc_str(tag),
|
||||||
_get_eval_enc_str(first),
|
_get_eval_enc_str(first),
|
||||||
_get_eval_enc_str(last))).collect{|idx|
|
_get_eval_enc_str(last))).collect{|idx|
|
||||||
TkText::IndexString.new(idx)
|
Tk::Text::IndexString.new(idx)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -986,7 +986,7 @@ class Tk::Text<TkTextWin
|
|||||||
_get_eval_enc_str(tag),
|
_get_eval_enc_str(tag),
|
||||||
_get_eval_enc_str(first),
|
_get_eval_enc_str(first),
|
||||||
_get_eval_enc_str(last))).collect{|idx|
|
_get_eval_enc_str(last))).collect{|idx|
|
||||||
TkText::IndexString.new(idx)
|
Tk::Text::IndexString.new(idx)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1236,7 +1236,7 @@ class Tk::Text<TkTextWin
|
|||||||
if ret == ""
|
if ret == ""
|
||||||
nil
|
nil
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(ret)
|
Tk::Text::IndexString.new(ret)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1271,7 +1271,7 @@ class Tk::Text<TkTextWin
|
|||||||
if ret == ""
|
if ret == ""
|
||||||
nil
|
nil
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(ret)
|
Tk::Text::IndexString.new(ret)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1460,10 +1460,10 @@ class Tk::Text<TkTextWin
|
|||||||
# retrieve index
|
# retrieve index
|
||||||
idx = str.index(/ /, i)
|
idx = str.index(/ /, i)
|
||||||
if idx
|
if idx
|
||||||
result.push(TkText::IndexString.new(str[i..(idx-1)]))
|
result.push(Tk::Text::IndexString.new(str[i..(idx-1)]))
|
||||||
i = idx + 1
|
i = idx + 1
|
||||||
else
|
else
|
||||||
result.push(TkText::IndexString.new(str[i..-1]))
|
result.push(Tk::Text::IndexString.new(str[i..-1]))
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1531,15 +1531,16 @@ class Tk::Text<TkTextWin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkText = Tk::Text unless Object.const_defined? :TkText
|
#TkText = Tk::Text unless Object.const_defined? :TkText
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Text, :TkText)
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
class TkText::Peer < TkText
|
class Tk::Text::Peer < Tk::Text
|
||||||
# Tk8.5 feature
|
# Tk8.5 feature
|
||||||
def initialize(text, parent=nil, keys={})
|
def initialize(text, parent=nil, keys={})
|
||||||
unless text.kind_of?(TkText)
|
unless text.kind_of?(Tk::Text)
|
||||||
fail ArgumentError, "TkText is expected for 1st argument"
|
fail ArgumentError, "TkText is expected for 1st argument"
|
||||||
end
|
end
|
||||||
@src_text = text
|
@src_text = text
|
||||||
|
@ -5,11 +5,11 @@ require 'tk'
|
|||||||
require 'tk/text'
|
require 'tk/text'
|
||||||
|
|
||||||
class TkTextImage<TkObject
|
class TkTextImage<TkObject
|
||||||
include TkText::IndexModMethods
|
include Tk::Text::IndexModMethods
|
||||||
|
|
||||||
def initialize(parent, index, keys)
|
def initialize(parent, index, keys)
|
||||||
#unless parent.kind_of?(TkText)
|
#unless parent.kind_of?(Tk::Text)
|
||||||
# fail ArgumentError, "expect TkText for 1st argument"
|
# fail ArgumentError, "expect Tk::Text for 1st argument"
|
||||||
#end
|
#end
|
||||||
@t = parent
|
@t = parent
|
||||||
if index == 'end' || index == :end
|
if index == 'end' || index == :end
|
||||||
@ -34,7 +34,7 @@ class TkTextImage<TkObject
|
|||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
TkText::IndexString.new(@id)
|
Tk::Text::IndexString.new(@id)
|
||||||
end
|
end
|
||||||
def mark
|
def mark
|
||||||
@path
|
@path
|
||||||
|
@ -5,7 +5,7 @@ require 'tk'
|
|||||||
require 'tk/text'
|
require 'tk/text'
|
||||||
|
|
||||||
class TkTextMark<TkObject
|
class TkTextMark<TkObject
|
||||||
include TkText::IndexModMethods
|
include Tk::Text::IndexModMethods
|
||||||
|
|
||||||
TMarkID_TBL = TkCore::INTERP.create_table
|
TMarkID_TBL = TkCore::INTERP.create_table
|
||||||
Tk_TextMark_ID = ['mark'.freeze, '00000'.taint].freeze
|
Tk_TextMark_ID = ['mark'.freeze, '00000'.taint].freeze
|
||||||
@ -19,8 +19,8 @@ class TkTextMark<TkObject
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize(parent, index)
|
def initialize(parent, index)
|
||||||
#unless parent.kind_of?(TkText)
|
#unless parent.kind_of?(Tk::Text)
|
||||||
# fail ArgumentError, "expect TkText for 1st argument"
|
# fail ArgumentError, "expect Tk::Text for 1st argument"
|
||||||
#end
|
#end
|
||||||
@parent = @t = parent
|
@parent = @t = parent
|
||||||
@tpath = parent.path
|
@tpath = parent.path
|
||||||
@ -36,7 +36,7 @@ class TkTextMark<TkObject
|
|||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
TkText::IndexString.new(@id)
|
Tk::Text::IndexString.new(@id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def exist?
|
def exist?
|
||||||
@ -49,15 +49,15 @@ class TkTextMark<TkObject
|
|||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
# move to TkText::IndexModMethods module
|
# move to Tk::Text::IndexModMethods module
|
||||||
def +(mod)
|
def +(mod)
|
||||||
return chars(mod) if mod.kind_of?(Numeric)
|
return chars(mod) if mod.kind_of?(Numeric)
|
||||||
|
|
||||||
mod = mod.to_s
|
mod = mod.to_s
|
||||||
if mod =~ /^\s*[+-]?\d/
|
if mod =~ /^\s*[+-]?\d/
|
||||||
TkText::IndexString.new(@id + ' + ' + mod)
|
Tk::Text::IndexString.new(@id + ' + ' + mod)
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(@id + ' ' + mod)
|
Tk::Text::IndexString.new(@id + ' ' + mod)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -66,11 +66,11 @@ class TkTextMark<TkObject
|
|||||||
|
|
||||||
mod = mod.to_s
|
mod = mod.to_s
|
||||||
if mod =~ /^\s*[+-]?\d/
|
if mod =~ /^\s*[+-]?\d/
|
||||||
TkText::IndexString.new(@id + ' - ' + mod)
|
Tk::Text::IndexString.new(@id + ' - ' + mod)
|
||||||
elsif mod =~ /^\s*[-]\s+(\d.*)$/
|
elsif mod =~ /^\s*[-]\s+(\d.*)$/
|
||||||
TkText::IndexString.new(@id + ' - -' + $1)
|
Tk::Text::IndexString.new(@id + ' - -' + $1)
|
||||||
else
|
else
|
||||||
TkText::IndexString.new(@id + ' ' + mod)
|
Tk::Text::IndexString.new(@id + ' ' + mod)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
=end
|
=end
|
||||||
@ -133,8 +133,8 @@ class TkTextNamedMark<TkTextMark
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize(parent, name, index=nil)
|
def initialize(parent, name, index=nil)
|
||||||
#unless parent.kind_of?(TkText)
|
#unless parent.kind_of?(Tk::Text)
|
||||||
# fail ArgumentError, "expect TkText for 1st argument"
|
# fail ArgumentError, "expect Tk::Text for 1st argument"
|
||||||
#end
|
#end
|
||||||
@parent = @t = parent
|
@parent = @t = parent
|
||||||
@tpath = parent.path
|
@tpath = parent.path
|
||||||
|
@ -7,7 +7,7 @@ require 'tk/tagfont'
|
|||||||
|
|
||||||
class TkTextTag<TkObject
|
class TkTextTag<TkObject
|
||||||
include TkTreatTagFont
|
include TkTreatTagFont
|
||||||
include TkText::IndexModMethods
|
include Tk::Text::IndexModMethods
|
||||||
|
|
||||||
TTagID_TBL = TkCore::INTERP.create_table
|
TTagID_TBL = TkCore::INTERP.create_table
|
||||||
Tk_TextTag_ID = ['tag'.freeze, '00000'.taint].freeze
|
Tk_TextTag_ID = ['tag'.freeze, '00000'.taint].freeze
|
||||||
@ -47,7 +47,7 @@ class TkTextTag<TkObject
|
|||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
TkText::IndexString.new(@id)
|
Tk::Text::IndexString.new(@id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def exist?
|
def exist?
|
||||||
@ -60,11 +60,11 @@ class TkTextTag<TkObject
|
|||||||
end
|
end
|
||||||
|
|
||||||
def first
|
def first
|
||||||
TkText::IndexString.new(@id + '.first')
|
Tk::Text::IndexString.new(@id + '.first')
|
||||||
end
|
end
|
||||||
|
|
||||||
def last
|
def last
|
||||||
TkText::IndexString.new(@id + '.last')
|
Tk::Text::IndexString.new(@id + '.last')
|
||||||
end
|
end
|
||||||
|
|
||||||
def add(*indices)
|
def add(*indices)
|
||||||
@ -83,7 +83,7 @@ class TkTextTag<TkObject
|
|||||||
l = tk_split_simplelist(tk_call_without_enc(@t.path, 'tag', 'ranges', @id))
|
l = tk_split_simplelist(tk_call_without_enc(@t.path, 'tag', 'ranges', @id))
|
||||||
r = []
|
r = []
|
||||||
while key=l.shift
|
while key=l.shift
|
||||||
r.push [TkText::IndexString.new(key), TkText::IndexString.new(l.shift)]
|
r.push [Tk::Text::IndexString.new(key), Tk::Text::IndexString.new(l.shift)]
|
||||||
end
|
end
|
||||||
r
|
r
|
||||||
end
|
end
|
||||||
@ -92,7 +92,7 @@ class TkTextTag<TkObject
|
|||||||
simplelist(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id,
|
simplelist(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id,
|
||||||
_get_eval_enc_str(first),
|
_get_eval_enc_str(first),
|
||||||
_get_eval_enc_str(last))).collect{|idx|
|
_get_eval_enc_str(last))).collect{|idx|
|
||||||
TkText::IndexString.new(idx)
|
Tk::Text::IndexString.new(idx)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ class TkTextTag<TkObject
|
|||||||
simplelist(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id,
|
simplelist(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id,
|
||||||
_get_eval_enc_str(first),
|
_get_eval_enc_str(first),
|
||||||
_get_eval_enc_str(last))).collect{|idx|
|
_get_eval_enc_str(last))).collect{|idx|
|
||||||
TkText::IndexString.new(idx)
|
Tk::Text::IndexString.new(idx)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -248,8 +248,8 @@ class TkTextNamedTag<TkTextTag
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize(parent, name, *args)
|
def initialize(parent, name, *args)
|
||||||
#unless parent.kind_of?(TkText)
|
#unless parent.kind_of?(Tk::Text)
|
||||||
# fail ArgumentError, "expect TkText for 1st argument"
|
# fail ArgumentError, "expect Tk::Text for 1st argument"
|
||||||
#end
|
#end
|
||||||
@parent = @t = parent
|
@parent = @t = parent
|
||||||
@tpath = parent.path
|
@tpath = parent.path
|
||||||
|
@ -5,11 +5,11 @@ require 'tk'
|
|||||||
require 'tk/text'
|
require 'tk/text'
|
||||||
|
|
||||||
class TkTextWindow<TkObject
|
class TkTextWindow<TkObject
|
||||||
include TkText::IndexModMethods
|
include Tk::Text::IndexModMethods
|
||||||
|
|
||||||
def initialize(parent, index, keys = {})
|
def initialize(parent, index, keys = {})
|
||||||
#unless parent.kind_of?(TkText)
|
#unless parent.kind_of?(Tk::Text)
|
||||||
# fail ArgumentError, "expect TkText for 1st argument"
|
# fail ArgumentError, "expect Tk::Text for 1st argument"
|
||||||
#end
|
#end
|
||||||
@t = parent
|
@t = parent
|
||||||
if index == 'end' || index == :end
|
if index == 'end' || index == :end
|
||||||
@ -55,7 +55,7 @@ class TkTextWindow<TkObject
|
|||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
TkText::IndexString.new(_epath(@id))
|
Tk::Text::IndexString.new(_epath(@id))
|
||||||
end
|
end
|
||||||
def mark
|
def mark
|
||||||
@path
|
@path
|
||||||
|
@ -258,4 +258,5 @@ class Tk::Toplevel<TkWindow
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TkToplevel = Tk::Toplevel unless Object.const_defined? :TkToplevel
|
#TkToplevel = Tk::Toplevel unless Object.const_defined? :TkToplevel
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::Toplevel, :TkToplevel)
|
||||||
|
@ -1,55 +1,67 @@
|
|||||||
#
|
#
|
||||||
# ttk_selector
|
# ttk_selector
|
||||||
#
|
#
|
||||||
module Ttk_Selector
|
######################################
|
||||||
@TTK_CLASS_NAMES = {}
|
# toplevel classes/modules
|
||||||
|
module Tk
|
||||||
|
@TOPLEVEL_ALIAS_TABLE[:Ttk] = {
|
||||||
|
:TkButton => 'tkextlib/tile/tbutton',
|
||||||
|
|
||||||
def self.use_ttk_as_default(mode = true)
|
:TkCheckbutton => 'tkextlib/tile/tcheckbutton',
|
||||||
if mode # Use Ttk widgets
|
:TkCheckButton => 'tkextlib/tile/tcheckbutton',
|
||||||
@TTK_CLASS_NAMES.each{|name, status|
|
|
||||||
eval("::Tk#{name} = ::Tk::#{(status)? 'Tile::': '::'}#{name}",
|
# :TkDialog => 'tkextlib/tile/dialog',
|
||||||
TOPLEVEL_BINDING)
|
|
||||||
}
|
:TkEntry => 'tkextlib/tile/tentry',
|
||||||
else # Use standard Tk widagets
|
|
||||||
@TTK_CLASS_NAMES.each{|name, status|
|
:TkCombobox => 'tkextlib/tile/tcombobox',
|
||||||
eval("::Tk#{name} = ::Tk::#{name}", TOPLEVEL_BINDING)
|
|
||||||
}
|
:TkFrame => 'tkextlib/tile/tframe',
|
||||||
|
|
||||||
|
:TkLabel => 'tkextlib/tile/tlabel',
|
||||||
|
|
||||||
|
:TkLabelframe => 'tkextlib/tile/tlabelframe',
|
||||||
|
:TkLabelFrame => 'tkextlib/tile/tlabelframe',
|
||||||
|
|
||||||
|
:TkMenubutton => 'tkextlib/tile/tmenubutton',
|
||||||
|
:TkMenuButton => 'tkextlib/tile/tmenubutton',
|
||||||
|
|
||||||
|
:TkNotebook => 'tkextlib/tile/tnotebook',
|
||||||
|
|
||||||
|
# :TkPaned => 'tkextlib/tile/tpaned',
|
||||||
|
:TkPanedwindow => 'tkextlib/tile/tpaned',
|
||||||
|
:TkPanedWindow => 'tkextlib/tile/tpaned',
|
||||||
|
|
||||||
|
:TkProgressbar => 'tkextlib/tile/tprogressbar',
|
||||||
|
|
||||||
|
:TkRadiobutton => 'tkextlib/tile/tradiobutton',
|
||||||
|
:TkRadioButton => 'tkextlib/tile/tradiobutton',
|
||||||
|
|
||||||
|
:TkScale => 'tkextlib/tile/tscale',
|
||||||
|
# :TkProgress => 'tkextlib/tile/tscale',
|
||||||
|
|
||||||
|
:TkScrollbar => 'tkextlib/tile/tscrollbar',
|
||||||
|
:TkXScrollbar => 'tkextlib/tile/tscrollbar',
|
||||||
|
:TkYScrollbar => 'tkextlib/tile/tscrollbar',
|
||||||
|
|
||||||
|
:TkSeparator => 'tkextlib/tile/tseparator',
|
||||||
|
|
||||||
|
:TkSizeGrip => 'tkextlib/tile/sizegrip',
|
||||||
|
:TkSizegrip => 'tkextlib/tile/sizegrip',
|
||||||
|
|
||||||
|
# :TkSquare => 'tkextlib/tile/tsquare',
|
||||||
|
|
||||||
|
:TkTreeview => 'tkextlib/tile/treeview',
|
||||||
|
}
|
||||||
|
@TOPLEVEL_ALIAS_TABLE[:Tile] = @TOPLEVEL_ALIAS_TABLE[:Ttk]
|
||||||
|
|
||||||
|
################################################
|
||||||
|
|
||||||
|
@TOPLEVEL_ALIAS_SETUP_PROC[:Tile] =
|
||||||
|
@TOPLEVEL_ALIAS_SETUP_PROC[:Ttk] = proc{|mod|
|
||||||
|
unless Tk.autoload?(:Tile) || Tk.const_defined?(:Tile)
|
||||||
|
Object.autoload :Ttk, 'tkextlib/tile'
|
||||||
|
Tk.autoload :Tile, 'tkextlib/tile'
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
|
|
||||||
def self.add(name)
|
|
||||||
@TTK_CLASS_NAMES[name] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.remove(name)
|
|
||||||
@TTK_CLASS_NAMES[name] = false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
|
||||||
|
|
||||||
Ttk_Selector.add('Button')
|
|
||||||
Ttk_Selector.add('Checkbutton')
|
|
||||||
Ttk_Selector.add('Entry')
|
|
||||||
##(ttk only) Ttk_Selector.add('Combobox')
|
|
||||||
##(ttk only) Ttk_Selector.add('Dialog')
|
|
||||||
Ttk_Selector.add('Frame')
|
|
||||||
Ttk_Selector.add('Label')
|
|
||||||
Ttk_Selector.add('Labelframe')
|
|
||||||
##(std only) Ttk_Selector.add('Listbox')
|
|
||||||
Ttk_Selector.add('Menubutton')
|
|
||||||
##(ttk only) Ttk_Selector.add('Notebook')
|
|
||||||
Ttk_Selector.add('Panedwindow')
|
|
||||||
##(ttk only) Ttk_Selector.add('Progressbar')
|
|
||||||
Ttk_Selector.add('Radiobutton')
|
|
||||||
Ttk_Selector.add('Scale')
|
|
||||||
##(ttk only) Ttk_Selector.add('Progress')
|
|
||||||
Ttk_Selector.add('Scrollbar')
|
|
||||||
Ttk_Selector.add('XScrollbar')
|
|
||||||
Ttk_Selector.add('YScrollbar')
|
|
||||||
##(ttk only) Ttk_Selector.add('Separator')
|
|
||||||
##(ttk only) Ttk_Selector.add('SizeGrip')
|
|
||||||
##(ttk only) Ttk_Selector.add('Square')
|
|
||||||
##(ttk only) Ttk_Selector.add('Treeview')
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
|
||||||
|
@ -20,7 +20,7 @@ class TkVariable
|
|||||||
|
|
||||||
#TkCore::INTERP.add_tk_procs('rb_var', 'args',
|
#TkCore::INTERP.add_tk_procs('rb_var', 'args',
|
||||||
# "ruby [format \"TkVariable.callback %%Q!%s!\" $args]")
|
# "ruby [format \"TkVariable.callback %%Q!%s!\" $args]")
|
||||||
TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
|
TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
|
||||||
if {[set st [catch {eval {ruby_cmd TkVariable callback} $args} ret]] != 0} {
|
if {[set st [catch {eval {ruby_cmd TkVariable callback} $args} ret]] != 0} {
|
||||||
set idx [string first "\n\n" $ret]
|
set idx [string first "\n\n" $ret]
|
||||||
if {$idx > 0} {
|
if {$idx > 0} {
|
||||||
|
@ -9,7 +9,8 @@ require 'tk'
|
|||||||
|
|
||||||
module Tk::WinDDE
|
module Tk::WinDDE
|
||||||
end
|
end
|
||||||
TkWinDDE = Tk::WinDDE
|
#TkWinDDE = Tk::WinDDE
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::WinDDE, :TkWinDDE)
|
||||||
|
|
||||||
module Tk::WinDDE
|
module Tk::WinDDE
|
||||||
extend Tk
|
extend Tk
|
||||||
@ -91,7 +92,8 @@ end
|
|||||||
|
|
||||||
module Tk::WinRegistry
|
module Tk::WinRegistry
|
||||||
end
|
end
|
||||||
TkWinRegistry = Tk::WinRegistry
|
#TkWinRegistry = Tk::WinRegistry
|
||||||
|
Tk.__set_toplevel_aliases__(:Tk, Tk::WinRegistry, :TkWinRegistry)
|
||||||
|
|
||||||
module Tk::WinRegistry
|
module Tk::WinRegistry
|
||||||
extend Tk
|
extend Tk
|
||||||
|
@ -19,7 +19,7 @@ module Tk::BLT
|
|||||||
class Shield < TkWindow
|
class Shield < TkWindow
|
||||||
def self.shield_path(win)
|
def self.shield_path(win)
|
||||||
win = window(win) unless win.kind_of?(TkWindow)
|
win = window(win) unless win.kind_of?(TkWindow)
|
||||||
if win.kind_of?(TkToplevel)
|
if win.kind_of?(Tk::Toplevel)
|
||||||
win.path + '._Busy'
|
win.path + '._Busy'
|
||||||
else
|
else
|
||||||
win.path + '_Busy'
|
win.path + '_Busy'
|
||||||
|
@ -14,7 +14,7 @@ module Tk::BLT
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkCanvas
|
class Tk::Canvas
|
||||||
alias __BLT_EPS_item_strval_optkeys __item_strval_optkeys
|
alias __BLT_EPS_item_strval_optkeys __item_strval_optkeys
|
||||||
def __item_strval_optkeys(id)
|
def __item_strval_optkeys(id)
|
||||||
__BLT_EPS_item_strval_optkeys(id) + [
|
__BLT_EPS_item_strval_optkeys(id) + [
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/blt/tile.rb'
|
|||||||
|
|
||||||
module Tk::BLT
|
module Tk::BLT
|
||||||
module Tile
|
module Tile
|
||||||
class Button < TkButton
|
class Button < Tk::Button
|
||||||
TkCommandNames = ['::blt::tile::button'.freeze].freeze
|
TkCommandNames = ['::blt::tile::button'.freeze].freeze
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/blt/tile.rb'
|
|||||||
|
|
||||||
module Tk::BLT
|
module Tk::BLT
|
||||||
module Tile
|
module Tile
|
||||||
class CheckButton < TkCheckButton
|
class CheckButton < Tk::CheckButton
|
||||||
TkCommandNames = ['::blt::tile::checkbutton'.freeze].freeze
|
TkCommandNames = ['::blt::tile::checkbutton'.freeze].freeze
|
||||||
end
|
end
|
||||||
Checkbutton = CheckButton
|
Checkbutton = CheckButton
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/blt/tile.rb'
|
|||||||
|
|
||||||
module Tk::BLT
|
module Tk::BLT
|
||||||
module Tile
|
module Tile
|
||||||
class Frame < TkFrame
|
class Frame < Tk::Frame
|
||||||
TkCommandNames = ['::blt::tile::frame'.freeze].freeze
|
TkCommandNames = ['::blt::tile::frame'.freeze].freeze
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/blt/tile.rb'
|
|||||||
|
|
||||||
module Tk::BLT
|
module Tk::BLT
|
||||||
module Tile
|
module Tile
|
||||||
class Label < TkLabel
|
class Label < Tk::Label
|
||||||
TkCommandNames = ['::blt::tile::label'.freeze].freeze
|
TkCommandNames = ['::blt::tile::label'.freeze].freeze
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/blt/tile.rb'
|
|||||||
|
|
||||||
module Tk::BLT
|
module Tk::BLT
|
||||||
module Tile
|
module Tile
|
||||||
class RadioButton < TkRadioButton
|
class RadioButton < Tk::RadioButton
|
||||||
TkCommandNames = ['::blt::tile::radiobutton'.freeze].freeze
|
TkCommandNames = ['::blt::tile::radiobutton'.freeze].freeze
|
||||||
end
|
end
|
||||||
Radiobutton = RadioButton
|
Radiobutton = RadioButton
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/blt/tile.rb'
|
|||||||
|
|
||||||
module Tk::BLT
|
module Tk::BLT
|
||||||
module Tile
|
module Tile
|
||||||
class Scrollbar < TkScrollbar
|
class Scrollbar < Tk::Scrollbar
|
||||||
TkCommandNames = ['::blt::tile::scrollbar'.freeze].freeze
|
TkCommandNames = ['::blt::tile::scrollbar'.freeze].freeze
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/blt/tile.rb'
|
|||||||
|
|
||||||
module Tk::BLT
|
module Tk::BLT
|
||||||
module Tile
|
module Tile
|
||||||
class Toplevel < TkToplevel
|
class Toplevel < Tk::Toplevel
|
||||||
TkCommandNames = ['::blt::tile::toplevel'.freeze].freeze
|
TkCommandNames = ['::blt::tile::toplevel'.freeze].freeze
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/bwidget.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module BWidget
|
module BWidget
|
||||||
class Button < TkButton
|
class Button < Tk::Button
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -31,7 +31,7 @@ class Tk::BWidget::ButtonBox
|
|||||||
name = tagOrId[:name]
|
name = tagOrId[:name]
|
||||||
return index(name) unless name.empty?
|
return index(name) unless name.empty?
|
||||||
end
|
end
|
||||||
if tagOrId.kind_of?(TkButton)
|
if tagOrId.kind_of?(Tk::Button)
|
||||||
return index(tagOrId[:text])
|
return index(tagOrId[:text])
|
||||||
end
|
end
|
||||||
# index(tagOrId.to_s)
|
# index(tagOrId.to_s)
|
||||||
@ -54,7 +54,7 @@ class Tk::BWidget::ButtonBox
|
|||||||
name = idx[:name]
|
name = idx[:name]
|
||||||
idx = name unless name.empty?
|
idx = name unless name.empty?
|
||||||
end
|
end
|
||||||
if idx.kind_of?(TkButton)
|
if idx.kind_of?(Tk::Button)
|
||||||
idx = idx[:text]
|
idx = idx[:text]
|
||||||
end
|
end
|
||||||
number(tk_send('index', idx.to_s))
|
number(tk_send('index', idx.to_s))
|
||||||
|
@ -103,7 +103,7 @@ class Tk::BWidget::Dialog
|
|||||||
name = tagOrId[:name]
|
name = tagOrId[:name]
|
||||||
return index(name) unless name.empty?
|
return index(name) unless name.empty?
|
||||||
end
|
end
|
||||||
if tagOrId.kind_of?(TkButton)
|
if tagOrId.kind_of?(Tk::Button)
|
||||||
return index(tagOrId[:text])
|
return index(tagOrId[:text])
|
||||||
end
|
end
|
||||||
# index(tagOrId.to_s)
|
# index(tagOrId.to_s)
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/bwidget.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module BWidget
|
module BWidget
|
||||||
class Entry < TkEntry
|
class Entry < Tk::Entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ require 'tkextlib/bwidget.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module BWidget
|
module BWidget
|
||||||
class Label < TkLabel
|
class Label < Tk::Label
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,7 +11,7 @@ require 'tkextlib/bwidget/entry'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module BWidget
|
module BWidget
|
||||||
class LabelEntry < TkEntry
|
class LabelEntry < Tk::Entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -10,7 +10,7 @@ require 'tkextlib/bwidget/entry'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module BWidget
|
module BWidget
|
||||||
class SpinBox < TkEntry
|
class SpinBox < Tk::Entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -156,7 +156,7 @@ module Tk
|
|||||||
master = master.to_s
|
master = master.to_s
|
||||||
end
|
end
|
||||||
return id unless ComponentID_TBL.key?(master)
|
return id unless ComponentID_TBL.key?(master)
|
||||||
(ComponentID_TBL.key?(id))? ComponentID_TBL[master][id]: id
|
(ComponentID_TBL[master].key?(id))? ComponentID_TBL[master][id]: id
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new(master, component=nil)
|
def self.new(master, component=nil)
|
||||||
|
@ -85,12 +85,24 @@ class Tk::Iwidgets::Checkbox
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(idx)
|
def get_tags
|
||||||
simplelist(tk_call(@path, 'get', index(idx))).collect{|id|
|
simplelist(tk_call_without_enc(@path, 'get'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_objs
|
||||||
|
simplelist(tk_call_without_enc(@path, 'get')).collect{|id|
|
||||||
Tk::Itk::Component.id2obj(self, id)
|
Tk::Itk::Component.id2obj(self, id)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get(idx=nil)
|
||||||
|
if idx
|
||||||
|
bool(tk_call_without_enc(@path, 'get', index(idx)))
|
||||||
|
else
|
||||||
|
get_tags
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def index(idx)
|
def index(idx)
|
||||||
number(tk_call(@path, 'index', tagid(idx)))
|
number(tk_call(@path, 'index', tagid(idx)))
|
||||||
end
|
end
|
||||||
|
@ -207,7 +207,7 @@ class Tk::Iwidgets::Hierarchy
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
# based on TkText widget
|
# based on Tk::Text widget
|
||||||
|
|
||||||
def bbox(index)
|
def bbox(index)
|
||||||
list(tk_send_without_enc('bbox', _get_eval_enc_str(index)))
|
list(tk_send_without_enc('bbox', _get_eval_enc_str(index)))
|
||||||
|
@ -146,7 +146,12 @@ class Tk::Iwidgets::Notebook
|
|||||||
|
|
||||||
def view(*idxs)
|
def view(*idxs)
|
||||||
if idxs.size == 0
|
if idxs.size == 0
|
||||||
window(tk_send_without_enc('view'))
|
idx = num_or_str(tk_send_without_enc('view'))
|
||||||
|
if idx.kind_of?(Fixnum) && idx < 0
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
idx
|
||||||
|
end
|
||||||
else
|
else
|
||||||
tk_send_without_enc('view', *idxs)
|
tk_send_without_enc('view', *idxs)
|
||||||
self
|
self
|
||||||
@ -160,8 +165,8 @@ class Tk::Iwidgets::Notebook
|
|||||||
end
|
end
|
||||||
alias xview_moveto view_moveto
|
alias xview_moveto view_moveto
|
||||||
alias yview_moveto view_moveto
|
alias yview_moveto view_moveto
|
||||||
def view_scroll(*idxs)
|
def view_scroll(index, what='pages')
|
||||||
view('scroll', *idxs)
|
view('scroll', index, what)
|
||||||
end
|
end
|
||||||
alias xview_scroll view_scroll
|
alias xview_scroll view_scroll
|
||||||
alias yview_scroll view_scroll
|
alias yview_scroll view_scroll
|
||||||
|
@ -85,10 +85,13 @@ class Tk::Iwidgets::Radiobox
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(idx)
|
def get_tag
|
||||||
simplelist(tk_call(@path, 'get', index(idx))).collect{|id|
|
((tag = tk_call_without_enc(@path, 'get')).empty?)? nil: tag
|
||||||
Tk::Itk::Component.id2obj(self, id)
|
end
|
||||||
}
|
alias get get_tag
|
||||||
|
|
||||||
|
def get_obj
|
||||||
|
(tag = get_tag)? Tk::Itk::Component.id2obj(self, tag): nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def index(idx)
|
def index(idx)
|
||||||
|
@ -59,7 +59,7 @@ class Tk::Iwidgets::Selectionbox
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
# based on TkListbox ( and TkTextWin )
|
# based on Tk::Listbox ( and TkTextWin )
|
||||||
def curselection
|
def curselection
|
||||||
list(tk_send_without_enc('curselection'))
|
list(tk_send_without_enc('curselection'))
|
||||||
end
|
end
|
||||||
|
@ -49,7 +49,7 @@ class Tk::Iwidgets::Selectiondialog
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
# based on TkListbox ( and TkTextWin )
|
# based on Tk::Listbox ( and TkTextWin )
|
||||||
def curselection
|
def curselection
|
||||||
list(tk_send_without_enc('curselection'))
|
list(tk_send_without_enc('curselection'))
|
||||||
end
|
end
|
||||||
|
@ -116,6 +116,11 @@ class Tk::Iwidgets::Tabnotebook
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show_tab(idx)
|
||||||
|
@tabset.show_tab(idx)
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
def scrollcommand(cmd=Proc.new)
|
def scrollcommand(cmd=Proc.new)
|
||||||
configure_cmd 'scrollcommand', cmd
|
configure_cmd 'scrollcommand', cmd
|
||||||
self
|
self
|
||||||
@ -147,7 +152,12 @@ class Tk::Iwidgets::Tabnotebook
|
|||||||
|
|
||||||
def view(*index)
|
def view(*index)
|
||||||
if index.size == 0
|
if index.size == 0
|
||||||
window(tk_send_without_enc('view'))
|
idx = num_or_str(tk_send_without_enc('view'))
|
||||||
|
if idx.kind_of?(Fixnum) && idx < 0
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
idx
|
||||||
|
end
|
||||||
else
|
else
|
||||||
tk_send_without_enc('view', *index)
|
tk_send_without_enc('view', *index)
|
||||||
self
|
self
|
||||||
@ -161,8 +171,8 @@ class Tk::Iwidgets::Tabnotebook
|
|||||||
end
|
end
|
||||||
alias xview_moveto view_moveto
|
alias xview_moveto view_moveto
|
||||||
alias yview_moveto view_moveto
|
alias yview_moveto view_moveto
|
||||||
def view_scroll(*index)
|
def view_scroll(index, what='pages')
|
||||||
view('scroll', *index)
|
view('scroll', index, what)
|
||||||
end
|
end
|
||||||
alias xview_scroll view_scroll
|
alias xview_scroll view_scroll
|
||||||
alias yview_scroll view_scroll
|
alias yview_scroll view_scroll
|
||||||
|
@ -96,4 +96,48 @@ class Tk::Iwidgets::Tabset
|
|||||||
tk_call(@path, 'select', index(idx))
|
tk_call(@path, 'select', index(idx))
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show_tab(idx)
|
||||||
|
if index(idx) == 0
|
||||||
|
self.start = 0
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
reutrn unless @canvas ||= self.winfo_children[0]
|
||||||
|
|
||||||
|
delta = 1 if (delta = cget(:gap)) == 'overlap' ||
|
||||||
|
(delta = self.winfo_pixels(delta) + 1) <= 0
|
||||||
|
|
||||||
|
case cget(:tabpos)
|
||||||
|
when 's', 'n'
|
||||||
|
if (head = tabcget(idx, :left)) < 0
|
||||||
|
self.start -= head
|
||||||
|
return
|
||||||
|
end
|
||||||
|
tabs_size = @canvas.winfo_width
|
||||||
|
tab_start, tab_end = @canvas .
|
||||||
|
find_overlapping(head, 0, head + delta, @canvas.winfo_height) .
|
||||||
|
find_all{|id| @canvas.itemtype(id) == TkcPolygon} .
|
||||||
|
map!{|id| bbox = @canvas.bbox(id); [bbox[0], bbox[2]]} . max
|
||||||
|
|
||||||
|
when 'e', 'w'
|
||||||
|
if (head = tabcget(idx, :top)) < 0
|
||||||
|
self.start -= head
|
||||||
|
return
|
||||||
|
end
|
||||||
|
tabs_size = @canvas.winfo_height
|
||||||
|
tab_start, tab_end = @canvas .
|
||||||
|
find_overlapping(0, head, @canvas.winfo_width, head + delta) .
|
||||||
|
find_all{|id| @canvas.itemtype(id) == TkcPolygon} .
|
||||||
|
map!{|id| bbox = @canvas.bbox(id); [bbox[1], bbox[3]]} . max
|
||||||
|
end
|
||||||
|
|
||||||
|
if (size = tab_end - tab_start + 1) > tabs_size
|
||||||
|
self.start -= tab_start
|
||||||
|
elsif head + size > tabs_size
|
||||||
|
self.start -= head + size - tabs_size
|
||||||
|
end
|
||||||
|
|
||||||
|
self
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -108,7 +108,7 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkScrollbar
|
class Tk::Scrollbar
|
||||||
def autoscroll
|
def autoscroll
|
||||||
# Arranges for the already existing scrollbar to be mapped
|
# Arranges for the already existing scrollbar to be mapped
|
||||||
# and unmapped as needed.
|
# and unmapped as needed.
|
||||||
|
@ -15,7 +15,7 @@ TkPackage.require('ctext')
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tcllib
|
module Tcllib
|
||||||
class CText < TkText
|
class CText < Tk::Text
|
||||||
PACKAGE_NAME = 'ctext'.freeze
|
PACKAGE_NAME = 'ctext'.freeze
|
||||||
def self.package_name
|
def self.package_name
|
||||||
PACKAGE_NAME
|
PACKAGE_NAME
|
||||||
|
@ -24,7 +24,7 @@ TkPackage.require('datefield')
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tcllib
|
module Tcllib
|
||||||
class Datefield < TkEntry
|
class Datefield < Tk::Entry
|
||||||
PACKAGE_NAME = 'datefield'.freeze
|
PACKAGE_NAME = 'datefield'.freeze
|
||||||
def self.package_name
|
def self.package_name
|
||||||
PACKAGE_NAME
|
PACKAGE_NAME
|
||||||
|
@ -18,7 +18,7 @@ TkPackage.require('ipentry')
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tcllib
|
module Tcllib
|
||||||
class IP_Entry < TkEntry
|
class IP_Entry < Tk::Entry
|
||||||
PACKAGE_NAME = 'ipentry'.freeze
|
PACKAGE_NAME = 'ipentry'.freeze
|
||||||
def self.package_name
|
def self.package_name
|
||||||
PACKAGE_NAME
|
PACKAGE_NAME
|
||||||
|
@ -225,7 +225,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
end
|
end
|
||||||
|
|
||||||
############################
|
############################
|
||||||
class XYPlot < TkCanvas
|
class XYPlot < Tk::Canvas
|
||||||
include ChartMethod
|
include ChartMethod
|
||||||
|
|
||||||
TkCommandNames = [
|
TkCommandNames = [
|
||||||
@ -247,7 +247,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
@xaxis = args.shift
|
@xaxis = args.shift
|
||||||
@yaxis = args.shift
|
@yaxis = args.shift
|
||||||
|
|
||||||
if parent.kind_of?(TkCanvas)
|
if parent.kind_of?(Tk::Canvas)
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
else
|
else
|
||||||
super(parent, *args) # create canvas widget
|
super(parent, *args) # create canvas widget
|
||||||
@ -337,7 +337,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
end
|
end
|
||||||
|
|
||||||
############################
|
############################
|
||||||
class PolarPlot < TkCanvas
|
class PolarPlot < Tk::Canvas
|
||||||
include ChartMethod
|
include ChartMethod
|
||||||
|
|
||||||
TkCommandNames = [
|
TkCommandNames = [
|
||||||
@ -356,7 +356,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
|
|
||||||
@radius_data = args.shift
|
@radius_data = args.shift
|
||||||
|
|
||||||
if parent.kind_of?(TkCanvas)
|
if parent.kind_of?(Tk::Canvas)
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
else
|
else
|
||||||
super(parent, *args) # create canvas widget
|
super(parent, *args) # create canvas widget
|
||||||
@ -395,7 +395,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
Polarplot = PolarPlot
|
Polarplot = PolarPlot
|
||||||
|
|
||||||
############################
|
############################
|
||||||
class IsometricPlot < TkCanvas
|
class IsometricPlot < Tk::Canvas
|
||||||
include ChartMethod
|
include ChartMethod
|
||||||
|
|
||||||
TkCommandNames = [
|
TkCommandNames = [
|
||||||
@ -430,7 +430,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
@stepsize = args.shift
|
@stepsize = args.shift
|
||||||
end
|
end
|
||||||
|
|
||||||
if parent.kind_of?(TkCanvas)
|
if parent.kind_of?(Tk::Canvas)
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
else
|
else
|
||||||
super(parent, *args) # create canvas widget
|
super(parent, *args) # create canvas widget
|
||||||
@ -475,7 +475,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
Isometricplot = IsometricPlot
|
Isometricplot = IsometricPlot
|
||||||
|
|
||||||
############################
|
############################
|
||||||
class Plot3D < TkCanvas
|
class Plot3D < Tk::Canvas
|
||||||
include ChartMethod
|
include ChartMethod
|
||||||
|
|
||||||
TkCommandNames = [
|
TkCommandNames = [
|
||||||
@ -500,7 +500,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
@yaxis = args.shift
|
@yaxis = args.shift
|
||||||
@zaxis = args.shift
|
@zaxis = args.shift
|
||||||
|
|
||||||
if parent.kind_of?(TkCanvas)
|
if parent.kind_of?(Tk::Canvas)
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
else
|
else
|
||||||
super(parent, *args) # create canvas widget
|
super(parent, *args) # create canvas widget
|
||||||
@ -557,7 +557,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
end
|
end
|
||||||
|
|
||||||
############################
|
############################
|
||||||
class Piechart < TkCanvas
|
class Piechart < Tk::Canvas
|
||||||
include ChartMethod
|
include ChartMethod
|
||||||
|
|
||||||
TkCommandNames = [
|
TkCommandNames = [
|
||||||
@ -566,7 +566,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
def initialize(*args) # args := ([parent] [, keys])
|
def initialize(*args) # args := ([parent] [, keys])
|
||||||
if args[0].kind_of?(TkCanvas)
|
if args[0].kind_of?(Tk::Canvas)
|
||||||
parent = args.shift
|
parent = args.shift
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
else
|
else
|
||||||
@ -588,7 +588,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
end
|
end
|
||||||
|
|
||||||
############################
|
############################
|
||||||
class Barchart < TkCanvas
|
class Barchart < Tk::Canvas
|
||||||
include ChartMethod
|
include ChartMethod
|
||||||
|
|
||||||
TkCommandNames = [
|
TkCommandNames = [
|
||||||
@ -626,7 +626,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
@series_size = args.shift
|
@series_size = args.shift
|
||||||
end
|
end
|
||||||
|
|
||||||
if parent.kind_of?(TkCanvas)
|
if parent.kind_of?(Tk::Canvas)
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
else
|
else
|
||||||
super(parent, *args) # create canvas widget
|
super(parent, *args) # create canvas widget
|
||||||
@ -672,7 +672,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
end
|
end
|
||||||
|
|
||||||
############################
|
############################
|
||||||
class Timechart < TkCanvas
|
class Timechart < Tk::Canvas
|
||||||
include ChartMethod
|
include ChartMethod
|
||||||
|
|
||||||
TkCommandNames = [
|
TkCommandNames = [
|
||||||
@ -699,7 +699,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
@time_end = args.shift
|
@time_end = args.shift
|
||||||
@items = args.shift
|
@items = args.shift
|
||||||
|
|
||||||
if parent.kind_of?(TkCanvas)
|
if parent.kind_of?(Tk::Canvas)
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
else
|
else
|
||||||
super(parent, *args) # create canvas widget
|
super(parent, *args) # create canvas widget
|
||||||
@ -733,7 +733,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
end
|
end
|
||||||
|
|
||||||
############################
|
############################
|
||||||
class Gnattchart < TkCanvas
|
class Gnattchart < Tk::Canvas
|
||||||
include ChartMethod
|
include ChartMethod
|
||||||
|
|
||||||
TkCommandNames = [
|
TkCommandNames = [
|
||||||
@ -772,7 +772,7 @@ module Tk::Tcllib::Plotchart
|
|||||||
@text_width = None
|
@text_width = None
|
||||||
end
|
end
|
||||||
|
|
||||||
if parent.kind_of?(TkCanvas)
|
if parent.kind_of?(Tk::Canvas)
|
||||||
@path = parent.path
|
@path = parent.path
|
||||||
else
|
else
|
||||||
super(parent, *args) # create canvas widget
|
super(parent, *args) # create canvas widget
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
require 'tk'
|
require 'tk'
|
||||||
|
require 'tk/ttk_selector'
|
||||||
|
|
||||||
# call setup script for general 'tkextlib' libraries
|
# call setup script for general 'tkextlib' libraries
|
||||||
require 'tkextlib/setup.rb'
|
require 'tkextlib/setup.rb'
|
||||||
@ -262,6 +263,9 @@ module Tk
|
|||||||
autoload :TSquare, 'tkextlib/tile/tsquare'
|
autoload :TSquare, 'tkextlib/tile/tsquare'
|
||||||
autoload :Square, 'tkextlib/tile/tsquare'
|
autoload :Square, 'tkextlib/tile/tsquare'
|
||||||
|
|
||||||
|
autoload :SizeGrip, 'tkextlib/tile/sizegrip'
|
||||||
|
autoload :Sizegrip, 'tkextlib/tile/sizegrip'
|
||||||
|
|
||||||
autoload :Treeview, 'tkextlib/tile/treeview'
|
autoload :Treeview, 'tkextlib/tile/treeview'
|
||||||
|
|
||||||
autoload :Style, 'tkextlib/tile/style'
|
autoload :Style, 'tkextlib/tile/style'
|
||||||
|
@ -9,9 +9,13 @@ module Tk
|
|||||||
module Tile
|
module Tile
|
||||||
class SizeGrip < TkWindow
|
class SizeGrip < TkWindow
|
||||||
end
|
end
|
||||||
|
Sizegrip = SizeGrip
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Sizegrip, :TkSizegrip, :TkSizeGrip)
|
||||||
|
|
||||||
|
|
||||||
class Tk::Tile::SizeGrip < TkWindow
|
class Tk::Tile::SizeGrip < TkWindow
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
|
@ -52,11 +52,29 @@ class << Tk::Tile::Style
|
|||||||
style = '.' unless style
|
style = '.' unless style
|
||||||
|
|
||||||
if keys && keys != None
|
if keys && keys != None
|
||||||
tk_call(TkCommandNames[0], 'map', style, *hash_kv(keys))
|
if keys.kind_of?(Hash)
|
||||||
|
tk_call(TkCommandNames[0], 'map', style, *hash_kv(keys))
|
||||||
|
else
|
||||||
|
simplelist(tk_call(TkCommandNames[0], 'map', style, '-' << keys.to_s))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
tk_call(TkCommandNames[0], 'map', style)
|
ret = {}
|
||||||
|
Hash[*(simplelist(tk_call(TkCommandNames[0], 'map', style)))].each{|k, v|
|
||||||
|
ret[k[1..-1]] = list(v)
|
||||||
|
}
|
||||||
|
ret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
alias map_configure map
|
||||||
|
|
||||||
|
def map_configinfo(style=nil, key=None)
|
||||||
|
style = '.' unless style
|
||||||
|
map(style, key)
|
||||||
|
end
|
||||||
|
|
||||||
|
def map_default_configinfo(key=None)
|
||||||
|
map('.', key)
|
||||||
|
end
|
||||||
|
|
||||||
def lookup(style, opt, state=None, fallback_value=None)
|
def lookup(style, opt, state=None, fallback_value=None)
|
||||||
tk_call(TkCommandNames[0], 'lookup', style,
|
tk_call(TkCommandNames[0], 'lookup', style,
|
||||||
@ -92,16 +110,20 @@ class << Tk::Tile::Style
|
|||||||
end
|
end
|
||||||
|
|
||||||
def theme_create(name, keys=nil)
|
def theme_create(name, keys=nil)
|
||||||
|
name = name.to_s
|
||||||
if keys && keys != None
|
if keys && keys != None
|
||||||
tk_call(TkCommandNames[0], 'theme', 'create', name, *hash_kv(keys))
|
tk_call(TkCommandNames[0], 'theme', 'create', name, *hash_kv(keys))
|
||||||
else
|
else
|
||||||
tk_call(TkCommandNames[0], 'theme', 'create', name)
|
tk_call(TkCommandNames[0], 'theme', 'create', name)
|
||||||
end
|
end
|
||||||
|
name
|
||||||
end
|
end
|
||||||
|
|
||||||
def theme_settings(name, cmd=nil, &b)
|
def theme_settings(name, cmd=nil, &b)
|
||||||
|
name = name.to_s
|
||||||
cmd = Proc.new(&b) if !cmd && b
|
cmd = Proc.new(&b) if !cmd && b
|
||||||
tk_call(TkCommandNames[0], 'theme', 'settings', name, cmd)
|
tk_call(TkCommandNames[0], 'theme', 'settings', name, cmd)
|
||||||
|
name
|
||||||
end
|
end
|
||||||
|
|
||||||
def theme_names()
|
def theme_names()
|
||||||
@ -109,6 +131,8 @@ class << Tk::Tile::Style
|
|||||||
end
|
end
|
||||||
|
|
||||||
def theme_use(name)
|
def theme_use(name)
|
||||||
|
name = name.to_s
|
||||||
tk_call(TkCommandNames[0], 'theme', 'use', name)
|
tk_call(TkCommandNames[0], 'theme', 'use', name)
|
||||||
|
name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -7,13 +7,16 @@ require 'tkextlib/tile.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TButton < TkButton
|
class TButton < Tk::Button
|
||||||
end
|
end
|
||||||
Button = TButton
|
Button = TButton
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Tk::Tile::TButton < TkButton
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Button, :TkButton)
|
||||||
|
|
||||||
|
|
||||||
|
class Tk::Tile::TButton < Tk::Button
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
if Tk::Tile::USE_TTK_NAMESPACE
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
@ -7,7 +7,7 @@ require 'tkextlib/tile.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TCheckButton < TkCheckButton
|
class TCheckButton < Tk::CheckButton
|
||||||
end
|
end
|
||||||
TCheckbutton = TCheckButton
|
TCheckbutton = TCheckButton
|
||||||
CheckButton = TCheckButton
|
CheckButton = TCheckButton
|
||||||
@ -15,7 +15,11 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Tk::Tile::TCheckButton < TkCheckButton
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Checkbutton,
|
||||||
|
:TkCheckbutton, :TkCheckButton)
|
||||||
|
|
||||||
|
|
||||||
|
class Tk::Tile::TCheckButton < Tk::CheckButton
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
if Tk::Tile::USE_TTK_NAMESPACE
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
@ -13,6 +13,9 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Combobox, :TkCombobox)
|
||||||
|
|
||||||
|
|
||||||
class Tk::Tile::TCombobox < Tk::Tile::TEntry
|
class Tk::Tile::TCombobox < Tk::Tile::TEntry
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
|
@ -7,13 +7,16 @@ require 'tkextlib/tile.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TEntry < TkEntry
|
class TEntry < Tk::Entry
|
||||||
end
|
end
|
||||||
Entry = TEntry
|
Entry = TEntry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Tk::Tile::TEntry < TkEntry
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Entry, :TkEntry)
|
||||||
|
|
||||||
|
|
||||||
|
class Tk::Tile::TEntry < Tk::Entry
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
if Tk::Tile::USE_TTK_NAMESPACE
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
@ -7,13 +7,16 @@ require 'tkextlib/tile.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TFrame < TkFrame
|
class TFrame < Tk::Frame
|
||||||
end
|
end
|
||||||
Frame = TFrame
|
Frame = TFrame
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Tk::Tile::TFrame < TkFrame
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Frame, :TkFrame)
|
||||||
|
|
||||||
|
|
||||||
|
class Tk::Tile::TFrame < Tk::Frame
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
if Tk::Tile::USE_TTK_NAMESPACE
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
@ -7,13 +7,16 @@ require 'tkextlib/tile.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TLabel < TkLabel
|
class TLabel < Tk::Label
|
||||||
end
|
end
|
||||||
Label = TLabel
|
Label = TLabel
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Tk::Tile::TLabel < TkLabel
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Label, :TkLabel)
|
||||||
|
|
||||||
|
|
||||||
|
class Tk::Tile::TLabel < Tk::Label
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
if Tk::Tile::USE_TTK_NAMESPACE
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
@ -9,10 +9,16 @@ module Tk
|
|||||||
module Tile
|
module Tile
|
||||||
class TLabelframe < Tk::Tile::TFrame
|
class TLabelframe < Tk::Tile::TFrame
|
||||||
end
|
end
|
||||||
Labelframe = TLabelframe
|
TLabelFrame = TLabelframe
|
||||||
|
Labelframe = TLabelframe
|
||||||
|
LabelFrame = TLabelframe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Labelframe,
|
||||||
|
:TkLabelframe, :TkLabelFrame)
|
||||||
|
|
||||||
|
|
||||||
class Tk::Tile::TLabelframe < Tk::Tile::TFrame
|
class Tk::Tile::TLabelframe < Tk::Tile::TFrame
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
|
@ -7,13 +7,19 @@ require 'tkextlib/tile.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TMenubutton < TkMenubutton
|
class TMenubutton < Tk::Menubutton
|
||||||
end
|
end
|
||||||
Menubutton = TMenubutton
|
TMenuButton = TMenubutton
|
||||||
|
Menubutton = TMenubutton
|
||||||
|
MenuButton = TMenubutton
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Tk::Tile::TMenubutton < TkMenubutton
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Menubutton,
|
||||||
|
:TkMenubutton, :TkMenuButton)
|
||||||
|
|
||||||
|
|
||||||
|
class Tk::Tile::TMenubutton < Tk::Menubutton
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
if Tk::Tile::USE_TTK_NAMESPACE
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
@ -13,6 +13,9 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Notebook, :TkNotebook)
|
||||||
|
|
||||||
|
|
||||||
class Tk::Tile::TNotebook < TkWindow
|
class Tk::Tile::TNotebook < TkWindow
|
||||||
################################
|
################################
|
||||||
include TkItemConfigMethod
|
include TkItemConfigMethod
|
||||||
|
@ -13,6 +13,10 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Panedwindow,
|
||||||
|
:TkPanedwindow, :TkPanedWindow)
|
||||||
|
|
||||||
|
|
||||||
class Tk::Tile::TPaned < TkWindow
|
class Tk::Tile::TPaned < TkWindow
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Progressbar, :TkProgressbar)
|
||||||
|
|
||||||
|
|
||||||
class Tk::Tile::TProgressbar
|
class Tk::Tile::TProgressbar
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ require 'tkextlib/tile.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TRadioButton < TkRadioButton
|
class TRadioButton < Tk::RadioButton
|
||||||
end
|
end
|
||||||
TRadiobutton = TRadioButton
|
TRadiobutton = TRadioButton
|
||||||
RadioButton = TRadioButton
|
RadioButton = TRadioButton
|
||||||
@ -15,7 +15,11 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Tk::Tile::TRadioButton < TkRadioButton
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Radiobutton,
|
||||||
|
:TkRadiobutton, :TkRadioButton)
|
||||||
|
|
||||||
|
|
||||||
|
class Tk::Tile::TRadioButton < Tk::RadioButton
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
if Tk::Tile::USE_TTK_NAMESPACE
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
@ -12,6 +12,9 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Treeview, :TkTreeview)
|
||||||
|
|
||||||
|
|
||||||
module Tk::Tile::TreeviewConfig
|
module Tk::Tile::TreeviewConfig
|
||||||
include TkItemConfigMethod
|
include TkItemConfigMethod
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ require 'tkextlib/tile.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TScale < TkScale
|
class TScale < Tk::Scale
|
||||||
end
|
end
|
||||||
Scale = TScale
|
Scale = TScale
|
||||||
|
|
||||||
@ -17,7 +17,10 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Tk::Tile::TScale < TkScale
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scale, :TkScale)
|
||||||
|
|
||||||
|
|
||||||
|
class Tk::Tile::TScale < Tk::Scale
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
if Tk::Tile::USE_TTK_NAMESPACE
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
@ -7,13 +7,16 @@ require 'tkextlib/tile.rb'
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TScrollbar < TkScrollbar
|
class TScrollbar < Tk::Scrollbar
|
||||||
end
|
end
|
||||||
Scrollbar = TScrollbar
|
Scrollbar = TScrollbar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Tk::Tile::TScrollbar < TkScrollbar
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scrollbar, :TkScrollbar)
|
||||||
|
|
||||||
|
|
||||||
|
class Tk::Tile::TScrollbar < Tk::Scrollbar
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
if Tk::Tile::USE_TTK_NAMESPACE
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
@ -47,3 +50,5 @@ class Tk::Tile::YScrollbar < Tk::Tile::TScrollbar
|
|||||||
private :create_self
|
private :create_self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::XScrollbar, :TkXScrollbar)
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::YScrollbar, :TkYScrollbar)
|
||||||
|
@ -13,6 +13,9 @@ module Tk
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Separator, :TkSeparator)
|
||||||
|
|
||||||
|
|
||||||
class Tk::Tile::TSeparator < TkWindow
|
class Tk::Tile::TSeparator < TkWindow
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class TkWindow
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkRoot
|
class Tk::Root
|
||||||
undef tktrans_set_image, tktrans_get_image
|
undef tktrans_set_image, tktrans_get_image
|
||||||
|
|
||||||
def tktrans_set_image(img)
|
def tktrans_set_image(img)
|
||||||
@ -51,7 +51,7 @@ class TkRoot
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkToplevel
|
class Tk::Toplevel
|
||||||
undef tktrans_set_image, tktrans_get_image
|
undef tktrans_set_image, tktrans_get_image
|
||||||
|
|
||||||
def tktrans_set_image(img)
|
def tktrans_set_image(img)
|
||||||
|
@ -17,6 +17,6 @@ end
|
|||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Vu
|
module Vu
|
||||||
Spinbox = TkSpinbox
|
Spinbox = Tk::Spinbox
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4,6 +4,18 @@
|
|||||||
# Demonstration of custom widget styles.
|
# Demonstration of custom widget styles.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set tile_ver [package require tile]
|
||||||
|
if {[package vcompare $tile_ver 0.8] >= 0} {
|
||||||
|
set style ::ttk::style
|
||||||
|
} {
|
||||||
|
set style style
|
||||||
|
}
|
||||||
|
if {[package vcompare $tile_ver 0.7] >= 0} {
|
||||||
|
set conf_subcmd configure
|
||||||
|
} {
|
||||||
|
set conf_subcmd default
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# ~ BACKGROUND
|
# ~ BACKGROUND
|
||||||
#
|
#
|
||||||
@ -42,7 +54,8 @@
|
|||||||
# style; see demo.tcl.)
|
# style; see demo.tcl.)
|
||||||
#
|
#
|
||||||
|
|
||||||
style theme settings "step" {
|
#$style theme settings "step" {
|
||||||
|
$style theme settings "alt" {
|
||||||
|
|
||||||
#
|
#
|
||||||
# First, we use [style layout] to define what elements to
|
# First, we use [style layout] to define what elements to
|
||||||
@ -51,7 +64,7 @@ style theme settings "step" {
|
|||||||
# and a label. (See also the TScrollbar layout definition
|
# and a label. (See also the TScrollbar layout definition
|
||||||
# in demos/blue.tcl for a more complicated layout spec.)
|
# in demos/blue.tcl for a more complicated layout spec.)
|
||||||
#
|
#
|
||||||
style layout Toolbutton {
|
$style layout Toolbutton {
|
||||||
Toolbutton.background
|
Toolbutton.background
|
||||||
Toolbutton.border -children {
|
Toolbutton.border -children {
|
||||||
Toolbutton.padding -children {
|
Toolbutton.padding -children {
|
||||||
@ -68,7 +81,7 @@ style theme settings "step" {
|
|||||||
# For many options (like -background), the defaults
|
# For many options (like -background), the defaults
|
||||||
# inherited from the parent style are sufficient.
|
# inherited from the parent style are sufficient.
|
||||||
#
|
#
|
||||||
style default Toolbutton -width 0 -padding 1 -relief flat -borderwidth 2
|
$style $conf_subcmd Toolbutton -width 0 -padding 1 -relief flat -borderwidth 2
|
||||||
|
|
||||||
#
|
#
|
||||||
# Finally, use [style map] to specify state-specific
|
# Finally, use [style map] to specify state-specific
|
||||||
@ -78,7 +91,7 @@ style theme settings "step" {
|
|||||||
# over the widget). Each state-value pair is checked
|
# over the widget). Each state-value pair is checked
|
||||||
# in order, and the first matching state takes precedence.
|
# in order, and the first matching state takes precedence.
|
||||||
#
|
#
|
||||||
style map Toolbutton -relief {
|
$style map Toolbutton -relief {
|
||||||
disabled flat
|
disabled flat
|
||||||
selected sunken
|
selected sunken
|
||||||
pressed sunken
|
pressed sunken
|
||||||
@ -93,19 +106,19 @@ style theme settings "step" {
|
|||||||
# design decisions from an aesthetic standpoint.)
|
# design decisions from an aesthetic standpoint.)
|
||||||
#
|
#
|
||||||
if {![catch {package require tile::theme::blue}]} {
|
if {![catch {package require tile::theme::blue}]} {
|
||||||
style theme settings "blue" {
|
$style theme settings "blue" {
|
||||||
|
|
||||||
#
|
#
|
||||||
# Default values:
|
# Default values:
|
||||||
#
|
#
|
||||||
style default Toolbutton \
|
$style $conf_subcmd Toolbutton \
|
||||||
-width 0 -relief flat -borderwidth 2 \
|
-width 0 -relief flat -borderwidth 2 \
|
||||||
-background #6699CC -foreground #000000 ;
|
-background #6699CC -foreground #000000 ;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Configure state-specific values for -relief, as before:
|
# Configure state-specific values for -relief, as before:
|
||||||
#
|
#
|
||||||
style map Toolbutton -relief {
|
$style map Toolbutton -relief {
|
||||||
disabled flat
|
disabled flat
|
||||||
selected sunken
|
selected sunken
|
||||||
pressed sunken
|
pressed sunken
|
||||||
@ -116,8 +129,8 @@ style theme settings "blue" {
|
|||||||
# Adjust the -padding at the same time, to enhance
|
# Adjust the -padding at the same time, to enhance
|
||||||
# the raised/sunken illusion:
|
# the raised/sunken illusion:
|
||||||
#
|
#
|
||||||
style default Toolbutton -padding 4
|
$style $conf_subcmd Toolbutton -padding 4
|
||||||
style map Toolbutton -padding {
|
$style map Toolbutton -padding {
|
||||||
disabled {4}
|
disabled {4}
|
||||||
selected {6 6 2 2}
|
selected {6 6 2 2}
|
||||||
pressed {6 6 2 2}
|
pressed {6 6 2 2}
|
||||||
@ -128,7 +141,7 @@ style theme settings "blue" {
|
|||||||
# ... and change the foreground and background colors
|
# ... and change the foreground and background colors
|
||||||
# when the mouse cursor is over the widget:
|
# when the mouse cursor is over the widget:
|
||||||
#
|
#
|
||||||
style map Toolbutton -background {
|
$style map Toolbutton -background {
|
||||||
active #008800
|
active #008800
|
||||||
} -foreground {
|
} -foreground {
|
||||||
active #FFFFFF
|
active #FFFFFF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user