mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/lib/tk.rb: widget configuration by TkWindow#method_missing
returns proper object. "widget.option = val" returns val, and "widget.option(val)" returns self. * ext/tk/lib/tk/font.rb: TkFont#replace accepts only one font argument. * ext/tk/lib/tk/radiobutton.rb: add TkRadiobutton#value and value=(val). * ext/tk/lib/tk/spinbox.rb: callback substitution support on command option. * ext/tk/sample/demos-en/widget: bug fix (wrong image height) * ext/tk/sample/demos-jp/widget: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4c10b035ef
commit
697908d0d4
7 changed files with 89 additions and 5 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
Fri Dec 3 01:55:24 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tk.rb: widget configuration by TkWindow#method_missing
|
||||
returns proper object. "widget.option = val" returns val, and
|
||||
"widget.option(val)" returns self.
|
||||
|
||||
* ext/tk/lib/tk/font.rb: TkFont#replace accepts only one font argument.
|
||||
|
||||
* ext/tk/lib/tk/radiobutton.rb: add TkRadiobutton#value and
|
||||
TkRadiobutton#value=(val).
|
||||
|
||||
* ext/tk/lib/tk/spinbox.rb: callback substitution support on
|
||||
command option.
|
||||
|
||||
* ext/tk/sample/demos-en/widget: bug fix (wrong image height)
|
||||
|
||||
* ext/tk/sample/demos-jp/widget: ditto.
|
||||
|
||||
Thu Dec 2 15:13:53 2004 Michael Neumann <mneumann@ruby-lang.org>
|
||||
|
||||
* test/xmlrpc/test_parser.rb, test/xmlrpc/data/*.expected: Expected
|
||||
|
|
|
@ -3186,8 +3186,10 @@ class TkObject<TkKernel
|
|||
when 1
|
||||
if name[-1] == ?=
|
||||
configure name[0..-2], args[0]
|
||||
args[0]
|
||||
else
|
||||
configure name, args[0]
|
||||
self
|
||||
end
|
||||
when 0
|
||||
begin
|
||||
|
|
|
@ -1362,7 +1362,8 @@ class TkFont
|
|||
end
|
||||
end
|
||||
|
||||
def replace(ltn, knj)
|
||||
def replace(ltn, knj=None)
|
||||
knj = ltn if knj == None
|
||||
latin_replace(ltn)
|
||||
kanji_replace(knj)
|
||||
self
|
||||
|
|
|
@ -28,5 +28,24 @@ class TkRadioButton<TkButton
|
|||
def variable(v)
|
||||
configure 'variable', tk_trace_variable(v)
|
||||
end
|
||||
|
||||
def value
|
||||
var = tk_send_without_enc('cget', '-variable')
|
||||
if TkVariable::USE_TCLs_SET_VARIABLE_FUNCTIONS
|
||||
_fromUTF8(INTERP._get_global_var(var))
|
||||
else
|
||||
INTERP._eval(Kernel.format('global %s; set %s', var, var))
|
||||
end
|
||||
end
|
||||
|
||||
def value=(val)
|
||||
var = tk_send_without_enc('cget', '-variable')
|
||||
if TkVariable::USE_TCLs_SET_VARIABLE_FUNCTIONS
|
||||
_fromUTF8(INTERP._set_global_var(var, _get_eval_string(val, true)))
|
||||
else
|
||||
s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
|
||||
INTERP._eval(Kernel.format('global %s; set %s %s', var, var, s))
|
||||
end
|
||||
end
|
||||
end
|
||||
TkRadiobutton = TkRadioButton
|
||||
|
|
|
@ -11,6 +11,50 @@ class TkSpinbox<TkEntry
|
|||
WidgetClassName = 'Spinbox'.freeze
|
||||
WidgetClassNames[WidgetClassName] = self
|
||||
|
||||
class SpinCommand < TkValidateCommand
|
||||
class ValidateArgs < TkUtil::CallbackSubst
|
||||
KEY_TBL = [
|
||||
[ ?d, ?s, :direction ],
|
||||
[ ?s, ?e, :current ],
|
||||
[ ?W, ?w, :widget ],
|
||||
nil
|
||||
]
|
||||
|
||||
PROC_TBL = [
|
||||
[ ?s, TkComm.method(:string) ],
|
||||
[ ?w, TkComm.method(:window) ],
|
||||
|
||||
[ ?e, proc{|val|
|
||||
enc = Tk.encoding
|
||||
if enc
|
||||
Tk.fromUTF8(TkComm::string(val), enc)
|
||||
else
|
||||
TkComm::string(val)
|
||||
end
|
||||
}
|
||||
],
|
||||
|
||||
nil
|
||||
]
|
||||
|
||||
_setup_subst_table(KEY_TBL, PROC_TBL);
|
||||
|
||||
def self.ret_val(val)
|
||||
(val)? '1': '0'
|
||||
end
|
||||
end
|
||||
|
||||
def self._config_keys
|
||||
['command']
|
||||
end
|
||||
end
|
||||
|
||||
def __validation_class_list
|
||||
super << SpinCommand
|
||||
end
|
||||
|
||||
Tk::ValidateConfigure.__def_validcmd(binding, SpinCommand)
|
||||
|
||||
#def create_self(keys)
|
||||
# tk_call_without_enc('spinbox', @path)
|
||||
# if keys and keys != None
|
||||
|
|
|
@ -72,7 +72,7 @@ EOD
|
|||
end
|
||||
|
||||
if $tk_major_ver >= 8
|
||||
$image['print'] = TkPhotoImage.new(:height=>16, :format=>'GIF', :data=><<EOD)
|
||||
$image['print'] = TkPhotoImage.new(:height=>19, :format=>'GIF', :data=><<EOD)
|
||||
R0lGODlhGgATAPcAACEQOTEpQjEpUkIpc0IxY0I5c0oxjEo5SlJCY1JCe1JK
|
||||
UlpChFpCjFpGkFpSc1paa2NKc2NKnGNja2tapWtjc29KnHNanHNjc3NjrXNr
|
||||
jHNrnHNzc3tjpXtrtXtzhICAgIRzvYSEjIZzqox7tYyEnIyMjJSEtZSEvZSM
|
||||
|
@ -780,7 +780,7 @@ end
|
|||
#
|
||||
def aboutBox
|
||||
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
|
||||
'message'=>"Ruby/Tk widget demonstration Ver.1.4.3-en\n\n" +
|
||||
'message'=>"Ruby/Tk widget demonstration Ver.1.4.4-en\n\n" +
|
||||
"based on demos of Tk8.1 -- 8.5 " +
|
||||
"( Copyright:: " +
|
||||
"(c) 1996-1997 Sun Microsystems, Inc. / " +
|
||||
|
|
|
@ -86,7 +86,7 @@ EOD
|
|||
end
|
||||
|
||||
if $tk_major_ver >= 8
|
||||
$image['print'] = TkPhotoImage.new(:height=>16, :format=>'GIF', :data=><<EOD)
|
||||
$image['print'] = TkPhotoImage.new(:height=>19, :format=>'GIF', :data=><<EOD)
|
||||
R0lGODlhGgATAPcAACEQOTEpQjEpUkIpc0IxY0I5c0oxjEo5SlJCY1JCe1JK
|
||||
UlpChFpCjFpGkFpSc1paa2NKc2NKnGNja2tapWtjc29KnHNanHNjc3NjrXNr
|
||||
jHNrnHNzc3tjpXtrtXtzhICAgIRzvYSEjIZzqox7tYyEnIyMjJSEtZSEvZSM
|
||||
|
@ -807,7 +807,7 @@ end
|
|||
#
|
||||
def aboutBox
|
||||
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
|
||||
'message'=>"Ruby/Tk ウィジェットデモ Ver.1.4.3-jp\n\n" +
|
||||
'message'=>"Ruby/Tk ウィジェットデモ Ver.1.4.4-jp\n\n" +
|
||||
"based on demos of Tk8.1 -- 8.5 " +
|
||||
"( Copyright:: " +
|
||||
"(c) 1996-1997 Sun Microsystems, Inc. / " +
|
||||
|
|
Loading…
Reference in a new issue