mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/sample/tkextlib/tile/demo.rb: followed previous changes.
* ext/tk/lib/tkextlib/tile/t*.rb: aliased class names starting with 'T' to non 'T' ones. (ie. Tk::Tile::TButton -> Tk::Tile::Button) [ruby-dev:26724] * ext/tk/lib/tkextlib/tile.rb: ditto. (autoload support) (Written by Hidetoshi NAGAI) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
53b4c2b87a
commit
7b1bdb68e9
20 changed files with 118 additions and 59 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2005-08-04 ocean <ocean@ruby-lang.org>
|
||||||
|
|
||||||
|
* sample/tkextlib/tile/demo.rb: followed previous changes.
|
||||||
|
|
||||||
|
2005-08-04 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* lib/tkextlib/tile/t*.rb: aliased class names starting with 'T'
|
||||||
|
to non 'T' ones. (ie. Tk::Tile::TButton -> Tk::Tile::Button)
|
||||||
|
[ruby-dev:26724]
|
||||||
|
|
||||||
|
* lib/tkextlib/tile.rb: ditto. (autoload support)
|
||||||
|
|
||||||
2005-08-04 ocean <ocean@ruby-lang.org>
|
2005-08-04 ocean <ocean@ruby-lang.org>
|
||||||
|
|
||||||
* sample/tkextlib/tile/demo.rb: fixed: Tk::Tile::TProgressbar is
|
* sample/tkextlib/tile/demo.rb: fixed: Tk::Tile::TProgressbar is
|
||||||
|
|
|
@ -110,39 +110,63 @@ module Tk
|
||||||
######################################
|
######################################
|
||||||
|
|
||||||
autoload :TButton, 'tkextlib/tile/tbutton'
|
autoload :TButton, 'tkextlib/tile/tbutton'
|
||||||
|
autoload :Button, 'tkextlib/tile/tbutton'
|
||||||
|
|
||||||
autoload :TCheckButton, 'tkextlib/tile/tcheckbutton'
|
autoload :TCheckButton, 'tkextlib/tile/tcheckbutton'
|
||||||
|
autoload :CheckButton, 'tkextlib/tile/tcheckbutton'
|
||||||
autoload :TCheckbutton, 'tkextlib/tile/tcheckbutton'
|
autoload :TCheckbutton, 'tkextlib/tile/tcheckbutton'
|
||||||
|
autoload :Checkbutton, 'tkextlib/tile/tcheckbutton'
|
||||||
|
|
||||||
autoload :TEntry, 'tkextlib/tile/tentry'
|
autoload :TEntry, 'tkextlib/tile/tentry'
|
||||||
|
autoload :Entry, 'tkextlib/tile/tentry'
|
||||||
|
|
||||||
autoload :TCombobox, 'tkextlib/tile/tcombobox'
|
autoload :TCombobox, 'tkextlib/tile/tcombobox'
|
||||||
|
autoload :Combobox, 'tkextlib/tile/tcombobox'
|
||||||
|
|
||||||
autoload :TFrame, 'tkextlib/tile/tframe'
|
autoload :TFrame, 'tkextlib/tile/tframe'
|
||||||
|
autoload :Frame, 'tkextlib/tile/tframe'
|
||||||
|
|
||||||
autoload :TLabelframe, 'tkextlib/tile/tlabelframe'
|
autoload :TLabelframe, 'tkextlib/tile/tlabelframe'
|
||||||
|
autoload :Labelframe, 'tkextlib/tile/tlabelframe'
|
||||||
|
|
||||||
autoload :TLabel, 'tkextlib/tile/tlabel'
|
autoload :TLabel, 'tkextlib/tile/tlabel'
|
||||||
|
autoload :Label, 'tkextlib/tile/tlabel'
|
||||||
|
|
||||||
autoload :TMenubutton, 'tkextlib/tile/tmenubutton'
|
autoload :TMenubutton, 'tkextlib/tile/tmenubutton'
|
||||||
|
autoload :Menubutton, 'tkextlib/tile/tmenubutton'
|
||||||
|
|
||||||
autoload :TNotebook, 'tkextlib/tile/tnotebook'
|
autoload :TNotebook, 'tkextlib/tile/tnotebook'
|
||||||
|
autoload :Notebook, 'tkextlib/tile/tnotebook'
|
||||||
|
|
||||||
autoload :TPaned, 'tkextlib/tile/tpaned'
|
autoload :TPaned, 'tkextlib/tile/tpaned'
|
||||||
|
autoload :Paned, 'tkextlib/tile/tpaned'
|
||||||
|
|
||||||
autoload :TProgressbar, 'tkextlib/tile/tprogressbar'
|
autoload :TProgressbar, 'tkextlib/tile/tprogressbar'
|
||||||
|
autoload :Progressbar, 'tkextlib/tile/tprogressbar'
|
||||||
|
|
||||||
autoload :TRadioButton, 'tkextlib/tile/tradiobutton'
|
autoload :TRadioButton, 'tkextlib/tile/tradiobutton'
|
||||||
|
autoload :RadioButton, 'tkextlib/tile/tradiobutton'
|
||||||
autoload :TRadiobutton, 'tkextlib/tile/tradiobutton'
|
autoload :TRadiobutton, 'tkextlib/tile/tradiobutton'
|
||||||
|
autoload :Radiobutton, 'tkextlib/tile/tradiobutton'
|
||||||
|
|
||||||
autoload :TScale, 'tkextlib/tile/tscale'
|
autoload :TScale, 'tkextlib/tile/tscale'
|
||||||
|
autoload :Scale, 'tkextlib/tile/tscale'
|
||||||
autoload :TProgress, 'tkextlib/tile/tscale'
|
autoload :TProgress, 'tkextlib/tile/tscale'
|
||||||
|
autoload :Progress, 'tkextlib/tile/tscale'
|
||||||
|
|
||||||
autoload :TScrollbar, 'tkextlib/tile/tscrollbar'
|
autoload :TScrollbar, 'tkextlib/tile/tscrollbar'
|
||||||
|
autoload :Scrollbar, 'tkextlib/tile/tscrollbar'
|
||||||
|
|
||||||
autoload :TSeparator, 'tkextlib/tile/tseparator'
|
autoload :TSeparator, 'tkextlib/tile/tseparator'
|
||||||
|
autoload :Separator, 'tkextlib/tile/tseparator'
|
||||||
|
|
||||||
autoload :TSquare, 'tkextlib/tile/tsquare'
|
autoload :TSquare, 'tkextlib/tile/tsquare'
|
||||||
|
autoload :Square, 'tkextlib/tile/tsquare'
|
||||||
|
|
||||||
|
autoload :TTreeview, 'tkextlib/tile/treeview'
|
||||||
autoload :Treeview, 'tkextlib/tile/treeview'
|
autoload :Treeview, 'tkextlib/tile/treeview'
|
||||||
|
autoload :TTreeView, 'tkextlib/tile/treeview'
|
||||||
|
autoload :TreeView, 'tkextlib/tile/treeview'
|
||||||
|
|
||||||
autoload :Style, 'tkextlib/tile/style'
|
autoload :Style, 'tkextlib/tile/style'
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TButton < TkButton
|
class TButton < TkButton
|
||||||
end
|
end
|
||||||
|
Button = TButton
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ module Tk
|
||||||
class TCheckButton < TkCheckButton
|
class TCheckButton < TkCheckButton
|
||||||
end
|
end
|
||||||
TCheckbutton = TCheckButton
|
TCheckbutton = TCheckButton
|
||||||
|
CheckButton = TCheckButton
|
||||||
|
Checkbutton = TCheckButton
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TCombobox < Tk::Tile::TEntry
|
class TCombobox < Tk::Tile::TEntry
|
||||||
end
|
end
|
||||||
|
Combobox = TCombobox
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TEntry < TkEntry
|
class TEntry < TkEntry
|
||||||
end
|
end
|
||||||
|
Entry = TEntry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TFrame < TkFrame
|
class TFrame < TkFrame
|
||||||
end
|
end
|
||||||
|
Frame = TFrame
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TLabel < TkLabel
|
class TLabel < TkLabel
|
||||||
end
|
end
|
||||||
|
Label = TLabel
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TLabelframe < Tk::Tile::TFrame
|
class TLabelframe < Tk::Tile::TFrame
|
||||||
end
|
end
|
||||||
|
Labelframe = TLabelframe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TMenubutton < TkMenubutton
|
class TMenubutton < TkMenubutton
|
||||||
end
|
end
|
||||||
|
Menubutton = TMenubutton
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TNotebook < TkWindow
|
class TNotebook < TkWindow
|
||||||
end
|
end
|
||||||
|
Notebook = TNotebook
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TPaned < TkWindow
|
class TPaned < TkWindow
|
||||||
end
|
end
|
||||||
|
Paned = TPaned
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TProgressbar < TkWindow
|
class TProgressbar < TkWindow
|
||||||
end
|
end
|
||||||
|
Progressbar = TProgressbar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ module Tk
|
||||||
class TRadioButton < TkRadioButton
|
class TRadioButton < TkRadioButton
|
||||||
end
|
end
|
||||||
TRadiobutton = TRadioButton
|
TRadiobutton = TRadioButton
|
||||||
|
RadioButton = TRadioButton
|
||||||
|
Radiobutton = TRadioButton
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,9 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class Treeview < TkWindow
|
class Treeview < TkWindow
|
||||||
end
|
end
|
||||||
|
TTreeview = Treeview
|
||||||
|
TTreeView = Treeview
|
||||||
|
TreeView = Treeview
|
||||||
|
|
||||||
module TreeviewConfig
|
module TreeviewConfig
|
||||||
include TkItemConfigMethod
|
include TkItemConfigMethod
|
||||||
|
|
|
@ -9,8 +9,11 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TScale < TkScale
|
class TScale < TkScale
|
||||||
end
|
end
|
||||||
|
Scale = TScale
|
||||||
|
|
||||||
class TProgress < TScale
|
class TProgress < TScale
|
||||||
end
|
end
|
||||||
|
Progress = TProgress
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TScrollbar < TkScrollbar
|
class TScrollbar < TkScrollbar
|
||||||
end
|
end
|
||||||
|
Scrollbar = TScrollbar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TSeparator < TkWindow
|
class TSeparator < TkWindow
|
||||||
end
|
end
|
||||||
|
Separator = TSeparator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Tk
|
||||||
module Tile
|
module Tile
|
||||||
class TSquare < TkWindow
|
class TSquare < TkWindow
|
||||||
end
|
end
|
||||||
|
Square = TSquare
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,9 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
def makeThemeControl(parent)
|
def makeThemeControl(parent)
|
||||||
c = Tk::Tile::TLabelframe.new(parent, :text=>'Theme')
|
c = Tk::Tile::Labelframe.new(parent, :text=>'Theme')
|
||||||
$THEMELIST.each{|theme, name|
|
$THEMELIST.each{|theme, name|
|
||||||
b = Tk::Tile::TRadiobutton.new(c, :text=>name, :value=>theme,
|
b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme,
|
||||||
:variable=>$V.ref(:THEME),
|
:variable=>$V.ref(:THEME),
|
||||||
:command=>proc{setTheme(theme)})
|
:command=>proc{setTheme(theme)})
|
||||||
b.grid(:sticky=>:ew)
|
b.grid(:sticky=>:ew)
|
||||||
|
@ -76,7 +76,7 @@ def makeThemeControl(parent)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
$RUBY_THEMELIST.each{|theme, name, available|
|
$RUBY_THEMELIST.each{|theme, name, available|
|
||||||
b = Tk::Tile::TRadiobutton.new(c, :text=>name, :value=>theme,
|
b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme,
|
||||||
:variable=>$V.ref(:THEME),
|
:variable=>$V.ref(:THEME),
|
||||||
:command=>proc{setTheme(theme)})
|
:command=>proc{setTheme(theme)})
|
||||||
b.grid(:sticky=>:ew)
|
b.grid(:sticky=>:ew)
|
||||||
|
@ -185,26 +185,26 @@ def makeToolbars
|
||||||
#
|
#
|
||||||
# Tile toolbar:
|
# Tile toolbar:
|
||||||
#
|
#
|
||||||
tb = Tk::Tile::TFrame.new($BASE, :class=>'Toolbar')
|
tb = Tk::Tile::Frame.new($BASE, :class=>'Toolbar')
|
||||||
$TOOLBARS << tb
|
$TOOLBARS << tb
|
||||||
i = 0
|
i = 0
|
||||||
$BUTTONS.each{|icon|
|
$BUTTONS.each{|icon|
|
||||||
i += 1
|
i += 1
|
||||||
Tk::Tile::TButton.new(tb, :text=>icon, :image=>$ICON[icon],
|
Tk::Tile::Button.new(tb, :text=>icon, :image=>$ICON[icon],
|
||||||
:compound=>$V[:COMPOUND],
|
:compound=>$V[:COMPOUND],
|
||||||
:style=>:Toolbutton).grid(:row=>0, :column=>i,
|
:style=>:Toolbutton).grid(:row=>0, :column=>i,
|
||||||
:sticky=>:news)
|
:sticky=>:news)
|
||||||
}
|
}
|
||||||
$CHECKBOXES.each{|icon|
|
$CHECKBOXES.each{|icon|
|
||||||
i += 1
|
i += 1
|
||||||
Tk::Tile::TCheckbutton.new(tb, :text=>icon, :image=>$ICON[icon],
|
Tk::Tile::Checkbutton.new(tb, :text=>icon, :image=>$ICON[icon],
|
||||||
:variable=>$V.ref(icon),
|
:variable=>$V.ref(icon),
|
||||||
:compound=>$V[:COMPOUND],
|
:compound=>$V[:COMPOUND],
|
||||||
:style=>:Toolbutton).grid(:row=>0, :column=>i,
|
:style=>:Toolbutton).grid(:row=>0, :column=>i,
|
||||||
:sticky=>:news)
|
:sticky=>:news)
|
||||||
}
|
}
|
||||||
|
|
||||||
mb = Tk::Tile::TMenubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'],
|
mb = Tk::Tile::Menubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'],
|
||||||
:compound=>$V[:COMPOUND])
|
:compound=>$V[:COMPOUND])
|
||||||
mb.configure(:menu=>makeCompoundMenu(mb))
|
mb.configure(:menu=>makeCompoundMenu(mb))
|
||||||
i += 1
|
i += 1
|
||||||
|
@ -261,7 +261,7 @@ end
|
||||||
makeToolbars()
|
makeToolbars()
|
||||||
|
|
||||||
## CONTROLS
|
## CONTROLS
|
||||||
control = Tk::Tile::TFrame.new($BASE)
|
control = Tk::Tile::Frame.new($BASE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Overall theme control:
|
# Overall theme control:
|
||||||
|
@ -281,10 +281,10 @@ end
|
||||||
|
|
||||||
def scrolledWidget(parent, klass, themed, *args)
|
def scrolledWidget(parent, klass, themed, *args)
|
||||||
if themed
|
if themed
|
||||||
f = Tk::Tile::TFrame.new(parent)
|
f = Tk::Tile::Frame.new(parent)
|
||||||
t = klass.new(f, *args)
|
t = klass.new(f, *args)
|
||||||
vs = Tk::Tile::TScrollbar.new(f)
|
vs = Tk::Tile::Scrollbar.new(f)
|
||||||
hs = Tk::Tile::TScrollbar.new(f)
|
hs = Tk::Tile::Scrollbar.new(f)
|
||||||
else
|
else
|
||||||
f = TkFrame.new(parent)
|
f = TkFrame.new(parent)
|
||||||
t = klass.new(f, *args)
|
t = klass.new(f, *args)
|
||||||
|
@ -306,19 +306,19 @@ end
|
||||||
# Notebook demonstration:
|
# Notebook demonstration:
|
||||||
#
|
#
|
||||||
def makeNotebook
|
def makeNotebook
|
||||||
nb = Tk::Tile::TNotebook.new($BASE, :padding=>6)
|
nb = Tk::Tile::Notebook.new($BASE, :padding=>6)
|
||||||
nb.enable_traversal
|
nb.enable_traversal
|
||||||
client = Tk::Tile::TFrame.new(nb)
|
client = Tk::Tile::Frame.new(nb)
|
||||||
nb.add(client, :text=>'Demo', :underline=>0)
|
nb.add(client, :text=>'Demo', :underline=>0)
|
||||||
nb.select(client)
|
nb.select(client)
|
||||||
|
|
||||||
scales = Tk::Tile::TFrame.new(nb)
|
scales = Tk::Tile::Frame.new(nb)
|
||||||
nb.add(scales, :text=>'Scales')
|
nb.add(scales, :text=>'Scales')
|
||||||
combo = Tk::Tile::TFrame.new(nb)
|
combo = Tk::Tile::Frame.new(nb)
|
||||||
nb.add(combo, :text=>'Combobox', :underline=>7)
|
nb.add(combo, :text=>'Combobox', :underline=>7)
|
||||||
tree = Tk::Tile::TFrame.new(nb)
|
tree = Tk::Tile::Frame.new(nb)
|
||||||
nb.add(tree, :text=>'Tree')
|
nb.add(tree, :text=>'Tree')
|
||||||
others = Tk::Tile::TFrame.new(nb)
|
others = Tk::Tile::Frame.new(nb)
|
||||||
nb.add(others, :text=>'Others', :underline=>4)
|
nb.add(others, :text=>'Others', :underline=>4)
|
||||||
|
|
||||||
[nb, client, scales, combo, tree, others]
|
[nb, client, scales, combo, tree, others]
|
||||||
|
@ -343,28 +343,28 @@ def fillMenu(menu)
|
||||||
menu.add(:command, :label=>'Quit', :command=>proc{Tk.root.destroy})
|
menu.add(:command, :label=>'Quit', :command=>proc{Tk.root.destroy})
|
||||||
end
|
end
|
||||||
|
|
||||||
l = Tk::Tile::TLabelframe.new(client, :text=>'Themed', :padding=>6)
|
l = Tk::Tile::Labelframe.new(client, :text=>'Themed', :padding=>6)
|
||||||
r = TkLabelframe.new(client, :text=>'Standard', :padx=>6, :pady=>6)
|
r = TkLabelframe.new(client, :text=>'Standard', :padx=>6, :pady=>6)
|
||||||
|
|
||||||
## Styled frame
|
## Styled frame
|
||||||
cb = Tk::Tile::TCheckbutton.new(l, :text=>'Checkbutton',
|
cb = Tk::Tile::Checkbutton.new(l, :text=>'Checkbutton',
|
||||||
:variable=>$V.ref(:SELECTED), :underline=>2)
|
:variable=>$V.ref(:SELECTED), :underline=>2)
|
||||||
rb1 = Tk::Tile::TRadiobutton.new(l, :text=>'One', :variable=>$V.ref(:CHOICE),
|
rb1 = Tk::Tile::Radiobutton.new(l, :text=>'One', :variable=>$V.ref(:CHOICE),
|
||||||
:value=>1, :underline=>0)
|
:value=>1, :underline=>0)
|
||||||
rb2 = Tk::Tile::TRadiobutton.new(l, :text=>'Two', :variable=>$V.ref(:CHOICE),
|
rb2 = Tk::Tile::Radiobutton.new(l, :text=>'Two', :variable=>$V.ref(:CHOICE),
|
||||||
:value=>2)
|
:value=>2)
|
||||||
rb3 = Tk::Tile::TRadiobutton.new(l, :text=>'Three',
|
rb3 = Tk::Tile::Radiobutton.new(l, :text=>'Three',
|
||||||
:variable=>$V.ref(:CHOICE),
|
:variable=>$V.ref(:CHOICE),
|
||||||
:value=>3, :underline=>0)
|
:value=>3, :underline=>0)
|
||||||
btn = Tk::Tile::TButton.new(l, :text=>'Button', :underline=>0)
|
btn = Tk::Tile::Button.new(l, :text=>'Button', :underline=>0)
|
||||||
|
|
||||||
mb = Tk::Tile::TMenubutton.new(l, :text=>'Menubutton', :underline=>2)
|
mb = Tk::Tile::Menubutton.new(l, :text=>'Menubutton', :underline=>2)
|
||||||
#m = TkMenu.new(mb)
|
#m = TkMenu.new(mb)
|
||||||
#mb.menu(m)
|
#mb.menu(m)
|
||||||
#fillMenu(m)
|
#fillMenu(m)
|
||||||
|
|
||||||
$entryText = TkVariable.new('Entry widget')
|
$entryText = TkVariable.new('Entry widget')
|
||||||
e = Tk::Tile::TEntry.new(l, :textvariable=>$entryText)
|
e = Tk::Tile::Entry.new(l, :textvariable=>$entryText)
|
||||||
e.selection_range(6, :end)
|
e.selection_range(6, :end)
|
||||||
|
|
||||||
ltext_f, ltext = scrolledWidget(l, TkText, true,
|
ltext_f, ltext = scrolledWidget(l, TkText, true,
|
||||||
|
@ -450,18 +450,18 @@ nmsgs = msgs.size
|
||||||
#
|
#
|
||||||
# Scales and sliders pane:
|
# Scales and sliders pane:
|
||||||
#
|
#
|
||||||
l = Tk::Tile::TLabelframe.new(scales, :text=>'Themed', :padding=>6)
|
l = Tk::Tile::Labelframe.new(scales, :text=>'Themed', :padding=>6)
|
||||||
r = TkLabelframe.new(scales, :text=>'Standard', :padx=>6, :pady=>6)
|
r = TkLabelframe.new(scales, :text=>'Standard', :padx=>6, :pady=>6)
|
||||||
|
|
||||||
if version?('0.6')
|
if version?('0.6')
|
||||||
|
|
||||||
# thremed frame
|
# thremed frame
|
||||||
scale = Tk::Tile::TScale.new(l, :orient=>:horizontal, :from=>0, :to=>100,
|
scale = Tk::Tile::Scale.new(l, :orient=>:horizontal, :from=>0, :to=>100,
|
||||||
:variable=>$V.ref(:SCALE))
|
:variable=>$V.ref(:SCALE))
|
||||||
vscale = Tk::Tile::TScale.new(l, :orient=>:vertical, :from=>0, :to=>100,
|
vscale = Tk::Tile::Scale.new(l, :orient=>:vertical, :from=>0, :to=>100,
|
||||||
:variable=>$V.ref(:VSCALE))
|
:variable=>$V.ref(:VSCALE))
|
||||||
progress = Tk::Tile::TProgressbar.new(l, :orient=>:horizontal, :maximum=>100)
|
progress = Tk::Tile::Progressbar.new(l, :orient=>:horizontal, :maximum=>100)
|
||||||
vprogress = Tk::Tile::TProgressbar.new(l, :orient=>:vertical, :maximum=>100)
|
vprogress = Tk::Tile::Progressbar.new(l, :orient=>:vertical, :maximum=>100)
|
||||||
|
|
||||||
if true
|
if true
|
||||||
def progress.inverted(w, value)
|
def progress.inverted(w, value)
|
||||||
|
@ -481,11 +481,11 @@ if version?('0.6')
|
||||||
scale.set(50)
|
scale.set(50)
|
||||||
vscale.set(50)
|
vscale.set(50)
|
||||||
|
|
||||||
lmode = Tk::Tile::TLabel.new(l, :text=>'Progress bar mode')
|
lmode = Tk::Tile::Label.new(l, :text=>'Progress bar mode')
|
||||||
pbmode0 = Tk::Tile::TRadiobutton.new(l, :variable=>$V.ref(:PBMODE),
|
pbmode0 = Tk::Tile::Radiobutton.new(l, :variable=>$V.ref(:PBMODE),
|
||||||
:text=>'determinate', :value=>'determinate',
|
:text=>'determinate', :value=>'determinate',
|
||||||
:command=>proc{pbMode(progress, vprogress)})
|
:command=>proc{pbMode(progress, vprogress)})
|
||||||
pbmode1 = Tk::Tile::TRadiobutton.new(l, :variable=>$V.ref(:PBMODE),
|
pbmode1 = Tk::Tile::Radiobutton.new(l, :variable=>$V.ref(:PBMODE),
|
||||||
:text=>'indeterminate', :value=>'indeterminate',
|
:text=>'indeterminate', :value=>'indeterminate',
|
||||||
:command=>proc{pbMode(progress, vprogress)})
|
:command=>proc{pbMode(progress, vprogress)})
|
||||||
def pbMode(progress, vprogress)
|
def pbMode(progress, vprogress)
|
||||||
|
@ -493,7 +493,7 @@ if version?('0.6')
|
||||||
vprogress.mode $V[:PBMODE]
|
vprogress.mode $V[:PBMODE]
|
||||||
end
|
end
|
||||||
|
|
||||||
start = Tk::Tile::TButton.new(l, :text=>"Start",
|
start = Tk::Tile::Button.new(l, :text=>"Start",
|
||||||
:command=>proc{pbStart(progress, vprogress)})
|
:command=>proc{pbStart(progress, vprogress)})
|
||||||
def pbStart(progress, vprogress)
|
def pbStart(progress, vprogress)
|
||||||
$V[:PBMODE] = 'indeterminate'; pbMode(progress, vprogress)
|
$V[:PBMODE] = 'indeterminate'; pbMode(progress, vprogress)
|
||||||
|
@ -501,7 +501,7 @@ if version?('0.6')
|
||||||
vprogress.start
|
vprogress.start
|
||||||
end
|
end
|
||||||
|
|
||||||
stop = Tk::Tile::TButton.new(l, :text=>'Stop',
|
stop = Tk::Tile::Button.new(l, :text=>'Stop',
|
||||||
:command=>proc{pbStop(progress, vprogress)})
|
:command=>proc{pbStop(progress, vprogress)})
|
||||||
def pbStop(progress, vprogress)
|
def pbStop(progress, vprogress)
|
||||||
progress.stop
|
progress.stop
|
||||||
|
@ -535,14 +535,14 @@ if version?('0.6')
|
||||||
else # tile 0.5 or earlier
|
else # tile 0.5 or earlier
|
||||||
|
|
||||||
# themed frame
|
# themed frame
|
||||||
scale = Tk::Tile::TScale.new(l, :variable=>$V.ref(:SCALE),
|
scale = Tk::Tile::Scale.new(l, :variable=>$V.ref(:SCALE),
|
||||||
:orient=>:horizontal, :from=>0, :to=>100)
|
:orient=>:horizontal, :from=>0, :to=>100)
|
||||||
vscale = Tk::Tile::TScale.new(l, :variable=>$V.ref(:VSCALE),
|
vscale = Tk::Tile::Scale.new(l, :variable=>$V.ref(:VSCALE),
|
||||||
:orient=>:vertical, :from=>-25, :to=>25)
|
:orient=>:vertical, :from=>-25, :to=>25)
|
||||||
|
|
||||||
progress = Tk::Tile::TProgress.new(l,
|
progress = Tk::Tile::Progress.new(l,
|
||||||
:orient=>:horizontal, :from=>0, :to=>100)
|
:orient=>:horizontal, :from=>0, :to=>100)
|
||||||
vprogress = Tk::Tile::TProgress.new(l,
|
vprogress = Tk::Tile::Progress.new(l,
|
||||||
:orient=>:vertical, :from=>-25, :to=>25)
|
:orient=>:vertical, :from=>-25, :to=>25)
|
||||||
|
|
||||||
if true
|
if true
|
||||||
|
@ -580,11 +580,11 @@ scales.grid_rowconfigure(0, :weight=>1)
|
||||||
#
|
#
|
||||||
# Command box:
|
# Command box:
|
||||||
#
|
#
|
||||||
cmd = Tk::Tile::TFrame.new($BASE)
|
cmd = Tk::Tile::Frame.new($BASE)
|
||||||
b_close = Tk::Tile::TButton.new(cmd, :text=>'Close',
|
b_close = Tk::Tile::Button.new(cmd, :text=>'Close',
|
||||||
:underline=>0, :default=>:normal,
|
:underline=>0, :default=>:normal,
|
||||||
:command=>proc{Tk.root.destroy})
|
:command=>proc{Tk.root.destroy})
|
||||||
b_help = Tk::Tile::TButton.new(cmd, :text=>'Help', :underline=>0,
|
b_help = Tk::Tile::Button.new(cmd, :text=>'Help', :underline=>0,
|
||||||
:default=>:normal, :command=>proc{showHelp()})
|
:default=>:normal, :command=>proc{showHelp()})
|
||||||
Tk.grid('x', b_close, b_help, :pady=>[6, 4], :padx=>4)
|
Tk.grid('x', b_close, b_help, :pady=>[6, 4], :padx=>4)
|
||||||
TkGrid.columnconfigure(cmd, 0, :weight=>1)
|
TkGrid.columnconfigure(cmd, 0, :weight=>1)
|
||||||
|
@ -654,7 +654,7 @@ setTheme($V[:THEME])
|
||||||
#
|
#
|
||||||
values = %w(list abc def ghi jkl mno pqr stu vwx yz)
|
values = %w(list abc def ghi jkl mno pqr stu vwx yz)
|
||||||
2.times {|i|
|
2.times {|i|
|
||||||
cb = Tk::Tile::TCombobox.new(
|
cb = Tk::Tile::Combobox.new(
|
||||||
combo, :values=>values, :textvariable=>$V.ref(:COMBO))
|
combo, :values=>values, :textvariable=>$V.ref(:COMBO))
|
||||||
cb.pack(:side=>:top, :padx=>2, :pady=>2, :expand=>false, :fill=>:x)
|
cb.pack(:side=>:top, :padx=>2, :pady=>2, :expand=>false, :fill=>:x)
|
||||||
if i == 1
|
if i == 1
|
||||||
|
@ -672,7 +672,7 @@ values = %w(list abc def ghi jkl mno pqr stu vwx yz)
|
||||||
if version?('0.5')
|
if version?('0.5')
|
||||||
|
|
||||||
treeview = nil # avoid 'undefined' error
|
treeview = nil # avoid 'undefined' error
|
||||||
scrollbar = Tk::Tile::TScrollbar.new(tree,
|
scrollbar = Tk::Tile::Scrollbar.new(tree,
|
||||||
:command=>proc{|*args| treeview.yview(*args)})
|
:command=>proc{|*args| treeview.yview(*args)})
|
||||||
treeview = Tk::Tile::Treeview.new(tree, :columns=>%w(Class), :padding=>4,
|
treeview = Tk::Tile::Treeview.new(tree, :columns=>%w(Class), :padding=>4,
|
||||||
:yscrollcommand=>proc{|*args| scrollbar.set(*args)})
|
:yscrollcommand=>proc{|*args| scrollbar.set(*args)})
|
||||||
|
@ -708,7 +708,7 @@ if version?('0.5')
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
Tk::Tile::TLabel.new(tree,
|
Tk::Tile::Label.new(tree,
|
||||||
:text=>'Treeview is supported on tile 0.5 or later...').pack
|
:text=>'Treeview is supported on tile 0.5 or later...').pack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ showDescription.bind('Leave', proc{|w| msg.text('')}, '%W')
|
||||||
"Demonstrates custom classes (see demos/repeater.tcl)" ]
|
"Demonstrates custom classes (see demos/repeater.tcl)" ]
|
||||||
|
|
||||||
].each{|demo_cmd, label, description|
|
].each{|demo_cmd, label, description|
|
||||||
b = Tk::Tile::TButton.new(others, :text=>label,
|
b = Tk::Tile::Button.new(others, :text=>label,
|
||||||
:command=>proc{ self.__send__(demo_cmd) })
|
:command=>proc{ self.__send__(demo_cmd) })
|
||||||
$Desc[b.path] = description
|
$Desc[b.path] = description
|
||||||
b.bindtags <<= showDescription
|
b.bindtags <<= showDescription
|
||||||
|
@ -764,7 +764,7 @@ def scrollbarResizeDemo
|
||||||
end
|
end
|
||||||
$scrollbars = TkToplevel.new(:title=>'Scrollbars', :geometry=>'200x200')
|
$scrollbars = TkToplevel.new(:title=>'Scrollbars', :geometry=>'200x200')
|
||||||
f = TkFrame.new($scrollbars, :height=>200)
|
f = TkFrame.new($scrollbars, :height=>200)
|
||||||
tsb = Tk::Tile::TScrollbar.new(f, :command=>proc{|*args| sbstub(tsb, *args)})
|
tsb = Tk::Tile::Scrollbar.new(f, :command=>proc{|*args| sbstub(tsb, *args)})
|
||||||
sb = TkScrollbar.new(f, :command=>proc{|*args| sbstub(sb, *args)})
|
sb = TkScrollbar.new(f, :command=>proc{|*args| sbstub(sb, *args)})
|
||||||
Tk.grid(tsb, sb, :sticky=>:news)
|
Tk.grid(tsb, sb, :sticky=>:news)
|
||||||
|
|
||||||
|
@ -799,8 +799,8 @@ def trackFocus
|
||||||
["Grab:", :Grab],
|
["Grab:", :Grab],
|
||||||
["Status:", :GrabStatus]
|
["Status:", :GrabStatus]
|
||||||
].each{|label, var_index|
|
].each{|label, var_index|
|
||||||
Tk.grid(Tk::Tile::TLabel.new($focus, :text=>label, :anchor=>:e),
|
Tk.grid(Tk::Tile::Label.new($focus, :text=>label, :anchor=>:e),
|
||||||
Tk::Tile::TLabel.new($focus,
|
Tk::Tile::Label.new($focus,
|
||||||
:textvariable=>$FocusInf.ref(var_index),
|
:textvariable=>$FocusInf.ref(var_index),
|
||||||
:width=>40, :anchor=>:w, :relief=>:groove),
|
:width=>40, :anchor=>:w, :relief=>:groove),
|
||||||
:sticky=>:ew)
|
:sticky=>:ew)
|
||||||
|
@ -859,18 +859,18 @@ def trackStates
|
||||||
end
|
end
|
||||||
$states = TkToplevel.new(:title=>'Widget states')
|
$states = TkToplevel.new(:title=>'Widget states')
|
||||||
|
|
||||||
l_inf = Tk::Tile::TLabel.new($states, :text=>"Press Control-Shift-Button-1 on any widget")
|
l_inf = Tk::Tile::Label.new($states, :text=>"Press Control-Shift-Button-1 on any widget")
|
||||||
|
|
||||||
l_lw = Tk::Tile::TLabel.new($states, :text=>'Widget:',
|
l_lw = Tk::Tile::Label.new($states, :text=>'Widget:',
|
||||||
:anchor=>:e, :relief=>:groove)
|
:anchor=>:e, :relief=>:groove)
|
||||||
l_w = Tk::Tile::TLabel.new($states, :textvariable=>$Widget,
|
l_w = Tk::Tile::Label.new($states, :textvariable=>$Widget,
|
||||||
:anchor=>:w, :relief=>:groove)
|
:anchor=>:w, :relief=>:groove)
|
||||||
|
|
||||||
Tk.grid(l_inf, '-', :sticky=>:ew, :padx=>6, :pady=>6)
|
Tk.grid(l_inf, '-', :sticky=>:ew, :padx=>6, :pady=>6)
|
||||||
Tk.grid(l_lw, l_w, :sticky=>:ew)
|
Tk.grid(l_lw, l_w, :sticky=>:ew)
|
||||||
|
|
||||||
$states_list.each{|st|
|
$states_list.each{|st|
|
||||||
cb = Tk::Tile::TCheckbutton.new($states, :text=>st,
|
cb = Tk::Tile::Checkbutton.new($states, :text=>st,
|
||||||
:variable=>$State.ref(st),
|
:variable=>$State.ref(st),
|
||||||
:command=>proc{ changeState(st) })
|
:command=>proc{ changeState(st) })
|
||||||
$states_btns[st] = cb
|
$states_btns[st] = cb
|
||||||
|
@ -879,10 +879,10 @@ def trackStates
|
||||||
|
|
||||||
$states.grid_columnconfigure(1, :weight=>1)
|
$states.grid_columnconfigure(1, :weight=>1)
|
||||||
|
|
||||||
f_cmd = Tk::Tile::TFrame.new($states)
|
f_cmd = Tk::Tile::Frame.new($states)
|
||||||
Tk.grid('x', f_cmd, :sticky=>:nse)
|
Tk.grid('x', f_cmd, :sticky=>:nse)
|
||||||
|
|
||||||
b_close = Tk::Tile::TButton.new(f_cmd, :text=>'Close',
|
b_close = Tk::Tile::Button.new(f_cmd, :text=>'Close',
|
||||||
:command=>proc{ $states.destroy })
|
:command=>proc{ $states.destroy })
|
||||||
Tk.grid('x', b_close, :padx=>4, :pady=>[6,4])
|
Tk.grid('x', b_close, :padx=>4, :pady=>[6,4])
|
||||||
f_cmd.grid_columnconfigure(0, :weight=>1)
|
f_cmd.grid_columnconfigure(0, :weight=>1)
|
||||||
|
@ -929,12 +929,12 @@ def repeatDemo
|
||||||
end
|
end
|
||||||
$repeatDemo = TkToplevel.new(:title=>'Repeating button')
|
$repeatDemo = TkToplevel.new(:title=>'Repeating button')
|
||||||
|
|
||||||
f = Tk::Tile::TFrame.new($repeatDemo)
|
f = Tk::Tile::Frame.new($repeatDemo)
|
||||||
b = Tk::Tile::TButton.new(f, :class=>'Repeater', :text=>'Press and hold')
|
b = Tk::Tile::Button.new(f, :class=>'Repeater', :text=>'Press and hold')
|
||||||
if version?('0.6')
|
if version?('0.6')
|
||||||
p = Tk::Tile::TProgressbar.new(f, :orient=>:horizontal, :maximum=>10)
|
p = Tk::Tile::Progressbar.new(f, :orient=>:horizontal, :maximum=>10)
|
||||||
else # progressbar is not supported
|
else # progressbar is not supported
|
||||||
p = Tk::Tile::TProgress.new(f, :orient=>:horizontal, :from=>0, :to=>10)
|
p = Tk::Tile::Progress.new(f, :orient=>:horizontal, :from=>0, :to=>10)
|
||||||
def p.step
|
def p.step
|
||||||
i = self.get + 1
|
i = self.get + 1
|
||||||
i = self.from if i > self.to
|
i = self.from if i > self.to
|
||||||
|
|
Loading…
Add table
Reference in a new issue