diff options
Diffstat (limited to 'jni/ruby/ext/tk/sample/tkextlib/tile')
115 files changed, 2303 insertions, 0 deletions
diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/Orig_LICENSE.txt b/jni/ruby/ext/tk/sample/tkextlib/tile/Orig_LICENSE.txt new file mode 100644 index 0000000..2326ef2 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/Orig_LICENSE.txt @@ -0,0 +1,30 @@ + + ###################################################################### + ### The following text is the original 'license.terms' of tile ### + ### extension. ### + ###################################################################### + + +LICENSE ("MIT-style") + +This software is Copyright (C) 2003 Joe English and other parties. + +The following terms apply to all files associated with this software +unless explicitly disclaimed in individual files. + +The author(s) hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS for a PARTICULAR PURPOSE. IN NO EVENT +shall the AUTHORS of THIS SOFTWARE be LIABLE to ANY PARTY for +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, or CONSEQUENTIAL DAMAGES +arising out of the USE of THIS SOFTWARE and its DOCUMENTATION. diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/demo.rb b/jni/ruby/ext/tk/sample/tkextlib/tile/demo.rb new file mode 100644 index 0000000..260ca00 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/demo.rb @@ -0,0 +1,983 @@ +#!/usr/bin/env ruby +# +# Demo for 'tile' package. +# +require 'tk' + +demodir = File.dirname($0) +themesdir = File.join(demodir, 'themes') +Tk::AUTO_PATH.lappend('.', demodir, themesdir) + +Dir.foreach(themesdir){|name| + next if name == '.' || name == '..' + dir = File.join(themesdir, name) + Tk::AUTO_PATH.lappend(dir) if File.directory?(dir) +} + +require 'tkextlib/tile' + +def version?(ver) + TkPackage.vcompare(Tk::Tile.package_version, ver) >= 0 +end + +# define Tcl/Tk procedures for compatibility +Tk::Tile.__define_LoadImages_proc_for_compatibility__! +Tk::Tile::Style.__define_wrapper_proc_for_compatibility__! + +unless Tk::Tile::Style.theme_names.include?('step') + Tk::Tile::Style.theme_create('step') +end + +Tk.load_tclscript(File.join(demodir, 'toolbutton.tcl')) +Tk.load_tclscript(File.join(demodir, 'repeater.tcl')) + +# This forces an update of the available packages list. It's required +# for package names to find the themes in demos/themes/*.tcl +## Tk.tk_call(TkPackage.unknown_proc, 'Tcl', TkPackage.provide('Tcl')) +## --> This doesn't work. +## Because, unknown_proc may be "command + some arguments". +Tk.ip_eval("#{TkPackage.unknown_proc} Tcl #{TkPackage.provide('Tcl')}") + +TkRoot.new{ + title 'Tile demo' + iconname 'Tile demo' +} + +# The descriptive names of the builtin themes. +$THEMELIST = [ + ['default', 'Default'], + ['classic', 'Classic'], + ['alt', 'Revitalized'], + ['winnative', 'Windows native'], + ['xpnative', 'XP Native'], + ['aqua', 'Aqua'], +] + +$V = TkVariable.new_hash(:THEME => 'default', + :COMPOUND => 'top', + :CONSOLE => false, + :MENURADIO1 => 'One', + :MENUCHECK1 => true, + :PBMODE => 'determinate', + :SELECTED => true, + :CHOICE => 2) + +# Add in any available loadable themes. +TkPackage.names.find_all{|n| n =~ /^(tile|ttk)::theme::/}.each{|pkg| + name = pkg.split('::')[-1] + unless $THEMELIST.assoc(name) + $THEMELIST << [name, Tk.tk_call('string', 'totitle', name)] + end +} + +# Add theme definition written by ruby +$RUBY_THEMELIST = [] +begin + load(File.join(demodir, 'themes', 'kroc.rb'), true) +rescue => e +raise e + $RUBY_THEMELIST << ['kroc-rb', 'Kroc (by Ruby)', false] +else + $RUBY_THEMELIST << ['kroc-rb', 'Kroc (by Ruby)', true] +end + +def makeThemeControl(parent) + c = Tk::Tile::Labelframe.new(parent, :text=>'Theme') + $THEMELIST.each{|theme, name| + b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, + :variable=>$V.ref(:THEME), + :command=>proc{setTheme(theme)}) + b.grid(:sticky=>:ew) + unless (TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) + b.ttk_state(:disabled) + end + } + $RUBY_THEMELIST.each{|theme, name, available| + b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, + :variable=>$V.ref(:THEME), + :command=>proc{setTheme(theme)}) + b.grid(:sticky=>:ew) + b.ttk_state(:disabled) unless available + } + c +end + +def makeThemeMenu(parent) + m = TkMenu.new(parent) + $THEMELIST.each{|theme, name| + m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), + :value=>theme, :command=>proc{setTheme(theme)}) + unless (TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) + m.entryconfigure(:end, :state=>:disabled) + end + } + $RUBY_THEMELIST.each{|theme, name, available| + m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), + :value=>theme, :command=>proc{setTheme(theme)}) + m.entryconfigure(:end, :state=>:disabled) unless available + } + m +end + +def setTheme(theme) + if (pkg = TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) + unless Tk::Tile::Style.theme_names.find{|n| n == theme} + TkPackage.require(pkg) + end + end + Tk::Tile::Style.theme_use(theme) +end + +# +# Load icons... +# +$BUTTONS = ['open', 'new', 'save'] +$CHECKBOXES = ['bold', 'italic'] +$ICON = {} + +def loadIcons(file) + Tk.load_tclscript(file) + img_data = TkVarAccess.new('ImgData') + img_data.keys.each{|icon| + $ICON[icon] = TkPhotoImage.new(:data=>img_data[icon]) + } +end + +loadIcons(File.join(demodir, 'iconlib.tcl')) + +# +# Utilities: +# +def foreachWidget(wins, cmd) + wins.each{|w| + cmd.call(w) + foreachWidget(w.winfo_children, cmd) + } +end + +# sbstub +# Used as the :command option for a scrollbar, +# updates the scrollbar's position. +# +def sbstub(sb, cmd, num, units = 'units') + num = TkComm.number(num) + case cmd.to_s + when 'moveto' + sb.set(num, num+0.5) + + when 'scroll' + if units.to_s == 'pages' + delta = 0.2 + else + delta = 0.05 + end + current = sb.get + sb.set(current[0] + delta * num, current[1] + delta * num) + end +end + +# ... for debugging: +TkBindTag::ALL.bind('ButtonPress-3', proc{|w| $W = w}, '%W') +TkBindTag::ALL.bind('Control-ButtonPress-3', proc{|w| w.set_focus}, '%W') + +def showHelp() + Tk.messageBox(:message=>'No help yet...') +end + +# +# See toolbutton.tcl. +TkOption.add('*Toolbar.relief', :groove) +TkOption.add('*Toolbar.borderWidth', 2) + +TkOption.add('*Toolbar.Button.Pad', 2) + +$ROOT = Tk.root +$BASE = $ROOT +Tk.destroy(*($ROOT.winfo_children)) + +$TOOLBARS = [] + +# +# Toolbar button standard vs. tile comparison: +# +def makeToolbars + # + # Tile toolbar: + # + tb = Tk::Tile::Frame.new($BASE, :class=>'Toolbar') + $TOOLBARS << tb + i = 0 + $BUTTONS.each{|icon| + i += 1 + Tk::Tile::Button.new(tb, :text=>icon, :image=>$ICON[icon], + :compound=>$V[:COMPOUND], + :style=>:Toolbutton).grid(:row=>0, :column=>i, + :sticky=>:news) + } + $CHECKBOXES.each{|icon| + i += 1 + Tk::Tile::Checkbutton.new(tb, :text=>icon, :image=>$ICON[icon], + :variable=>$V.ref(icon), + :compound=>$V[:COMPOUND], + :style=>:Toolbutton).grid(:row=>0, :column=>i, + :sticky=>:news) + } + + mb = Tk::Tile::Menubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], + :compound=>$V[:COMPOUND]) + mb.configure(:menu=>makeCompoundMenu(mb)) + i += 1 + mb.grid(:row=>0, :column=>i, :sticky=>:news) + + i += 1 + tb.grid_columnconfigure(i, :weight=>1) + + # + # Standard toolbar: + # + tb = TkFrame.new($BASE, :class=>'Toolbar') + $TOOLBARS << tb + i = 0 + $BUTTONS.each{|icon| + i += 1 + TkButton.new(tb, :text=>icon, :image=>$ICON[icon], + :compound=>$V[:COMPOUND], :relief=>:flat, + :overrelief=>:raised).grid(:row=>0, :column=>i, + :sticky=>:news) + } + $CHECKBOXES.each{|icon| + i += 1 + TkCheckbutton.new(tb, :text=>icon, :image=>$ICON[icon], + :variable=>$V.ref(icon), :compound=>$V[:COMPOUND], + :indicatoron=>false, :selectcolor=>'', :relief=>:flat, + :overrelief=>:raised).grid(:row=>0, :column=>i, + :sticky=>:news) + } + + mb = TkMenubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], + :compound=>$V[:COMPOUND]) + mb.configure(:menu=>makeCompoundMenu(mb)) + i += 1 + mb.grid(:row=>0, :column=>i, :sticky=>:news) + + i += 1 + tb.grid_columnconfigure(i, :weight=>1) +end + +# +# Toolbar :compound control: +# +def makeCompoundMenu(mb) + menu = TkMenu.new(mb) + %w(text image none top bottom left right center).each{|str| + menu.add(:radiobutton, :label=>Tk.tk_call('string', 'totitle', str), + :variable=>$V.ref(:COMPOUND), :value=>str, + :command=>proc{ changeToolbars() }) + } + menu +end + +makeToolbars() + +## CONTROLS +control = Tk::Tile::Frame.new($BASE) + +# +# Overall theme control: +# +makeThemeControl(control).grid(:sticky=>:news, :padx=>6, :ipadx=>6) +control.grid_rowconfigure(99, :weight=>1) + +def changeToolbars + foreachWidget($TOOLBARS, + proc{|w| + begin + w.compound($V[:COMPOUND]) + rescue + end + }) +end + +def scrolledWidget(parent, klass, themed, *args) + if themed + f = Tk::Tile::Frame.new(parent) + t = klass.new(f, *args) + vs = Tk::Tile::Scrollbar.new(f) + hs = Tk::Tile::Scrollbar.new(f) + else + f = TkFrame.new(parent) + t = klass.new(f, *args) + vs = TkScrollbar.new(f) + hs = TkScrollbar.new(f) + end + t.yscrollbar(vs) + t.xscrollbar(hs) + + TkGrid.configure(t, vs, :sticky=>:news) + TkGrid.configure(hs, 'x', :sticky=>:news) + TkGrid.rowconfigure(f, 0, :weight=>1) + TkGrid.columnconfigure(f, 0, :weight=>1) + + [f, t] +end + +# +# Notebook demonstration: +# +def makeNotebook + nb = Tk::Tile::Notebook.new($BASE, :padding=>6) + nb.enable_traversal + client = Tk::Tile::Frame.new(nb) + nb.add(client, :text=>'Demo', :underline=>0) + nb.select(client) + + scales = Tk::Tile::Frame.new(nb) + nb.add(scales, :text=>'Scales') + combo = Tk::Tile::Frame.new(nb) + nb.add(combo, :text=>'Combobox', :underline=>7) + tree = Tk::Tile::Frame.new(nb) + nb.add(tree, :text=>'Tree') + others = Tk::Tile::Frame.new(nb) + nb.add(others, :text=>'Others', :underline=>4) + + [nb, client, scales, combo, tree, others] +end + +nb, client, scales, combo, tree, others = makeNotebook() + +# +# Side-by side check, radio, and menu button comparison: +# +def fillMenu(menu) + %w(above below left right flush).each{|dir| + menu.add(:command, :label=>Tk.tk_call('string', 'totitle', dir), + :command=>proc{ menu.winfo_parent.direction(dir) }) + } + menu.add(:cascade, :label=>'Submenu', :menu=>(submenu = TkMenu.new(menu))) + submenu.add(:command, :label=>'Subcommand 1') + submenu.add(:command, :label=>'Subcommand 2') + submenu.add(:command, :label=>'Subcommand 3') + + menu.add(:separator) + menu.add(:command, :label=>'Quit', :command=>proc{Tk.root.destroy}) +end + +l = Tk::Tile::Labelframe.new(client, :text=>'Themed', :padding=>6) +r = TkLabelframe.new(client, :text=>'Standard', :padx=>6, :pady=>6) + +## Styled frame +cb = Tk::Tile::Checkbutton.new(l, :text=>'Checkbutton', + :variable=>$V.ref(:SELECTED), :underline=>2) +rb1 = Tk::Tile::Radiobutton.new(l, :text=>'One', :variable=>$V.ref(:CHOICE), + :value=>1, :underline=>0) +rb2 = Tk::Tile::Radiobutton.new(l, :text=>'Two', :variable=>$V.ref(:CHOICE), + :value=>2) +rb3 = Tk::Tile::Radiobutton.new(l, :text=>'Three', + :variable=>$V.ref(:CHOICE), + :value=>3, :underline=>0) +btn = Tk::Tile::Button.new(l, :text=>'Button', :underline=>0) + +mb = Tk::Tile::Menubutton.new(l, :text=>'Menubutton', :underline=>2) +m = TkMenu.new(mb) +mb.menu(m) +fillMenu(m) + +$entryText = TkVariable.new('Entry widget') +e = Tk::Tile::Entry.new(l, :textvariable=>$entryText) +e.selection_range(6, :end) + +ltext_f, ltext = scrolledWidget(l, TkText, true, + :width=>12, :height=>5, :wrap=>:none) +# NOTE TO MAINTAINERS: +# The checkbuttons are -sticky ew / -expand x on purpose: +# it demonstrates one of the differences between TCheckbuttons +# and standard checkbuttons. +# +Tk.grid(cb, :sticky=>:ew) +Tk.grid(rb1, :sticky=>:ew) +Tk.grid(rb2, :sticky=>:ew) +Tk.grid(rb3, :sticky=>:ew) +Tk.grid(btn, :sticky=>:ew, :padx=>2, :pady=>2) +Tk.grid(mb, :sticky=>:ew, :padx=>2, :pady=>2) +Tk.grid(e, :sticky=>:ew, :padx=>2, :pady=>2) +Tk.grid(ltext_f, :sticky=>:news) + +TkGrid.columnconfigure(l, 0, :weight=>1) +TkGrid.rowconfigure(l, 7, :weight=>1) # text widget (grid is a PITA) + +## Orig frame +cb = TkCheckbutton.new(r, :text=>'Checkbutton', :variable=>$V.ref(:SELECTED)) +rb1 = TkRadiobutton.new(r, :text=>'One', + :variable=>$V.ref(:CHOICE), :value=>1) +rb2 = TkRadiobutton.new(r, :text=>'Two', :variable=>$V.ref(:CHOICE), + :value=>2, :underline=>1) +rb3 = TkRadiobutton.new(r, :text=>'Three', + :variable=>$V.ref(:CHOICE), :value=>3) +btn = TkButton.new(r, :text=>'Button') + +mb = TkMenubutton.new(r, :text=>'Menubutton', :underline=>3, :takefocus=>true) +m = TkMenu.new(mb) +mb.menu(m) +$V[:rmbIndicatoron] = mb.indicatoron +m.add(:checkbutton, :label=>'Indicator?', #' + :variable=>$V.ref(:rmbIndicatoron), + :command=>proc{mb.indicatoron($V[:rmbIndicatoron])}) +m.add(:separator) +fillMenu(m) + +e = TkEntry.new(r, :textvariable=>$entryText) + +rtext_f, rtext = scrolledWidget(r, TkText, false, + :width=>12, :height=>5, :wrap=>:none) + +Tk.grid(cb, :sticky=>:ew) +Tk.grid(rb1, :sticky=>:ew) +Tk.grid(rb2, :sticky=>:ew) +Tk.grid(rb3, :sticky=>:ew) +Tk.grid(btn, :sticky=>:ew, :padx=>2, :pady=>2) +Tk.grid(mb, :sticky=>:ew, :padx=>2, :pady=>2) +Tk.grid(e, :sticky=>:ew, :padx=>2, :pady=>2) +Tk.grid(rtext_f, :sticky=>:news) + +TkGrid.columnconfigure(l, 0, :weight=>1) +TkGrid.rowconfigure(l, 7, :weight=>1) # text widget (grid is a PITA) + +Tk.grid(l, r, :sticky=>:news, :padx=>6, :pady=>6) +TkGrid.rowconfigure(client, 0, :weight=>1) +TkGrid.columnconfigure(client, [0, 1], :weight=>1) + +# +# Add some text to the text boxes: +# +msgs = [ +"The cat crept into the crypt, crapped and crept out again", +"Peter Piper picked a peck of pickled peppers", +"How much wood would a woodchuck chuck if a woodchuck could chuck wood", +"He thrusts his fists against the posts and still insists he sees the ghosts", +"Who put the bomb in the bom-b-bom-b-bom,", +"Is this your sister's sixth zither, sir?", +"Who put the ram in the ramalamadingdong?", +"I am not the pheasant plucker, I'm the pheasant plucker's mate." +] + +nmsgs = msgs.size +(0...50).each{|n| + msg = msgs[n % nmsgs] + ltext.insert(:end, "#{n}: #{msg}\n") + rtext.insert(:end, "#{n}: #{msg}\n") +} +# +# Scales and sliders pane: +# +l = Tk::Tile::Labelframe.new(scales, :text=>'Themed', :padding=>6) +r = TkLabelframe.new(scales, :text=>'Standard', :padx=>6, :pady=>6) + +if version?('0.6') + + # thremed frame + scale = Tk::Tile::Scale.new(l, :orient=>:horizontal, :from=>0, :to=>100, + :variable=>$V.ref(:SCALE)) + vscale = Tk::Tile::Scale.new(l, :orient=>:vertical, :from=>0, :to=>100, + :variable=>$V.ref(:VSCALE)) + progress = Tk::Tile::Progressbar.new(l, :orient=>:horizontal, :maximum=>100) + vprogress = Tk::Tile::Progressbar.new(l, :orient=>:vertical, :maximum=>100) + + if true + def progress.inverted(w, value) + if w.mode == 'indeterminate' + w.value(value) + else + w.value(w.maximum - value) + end + end + scale.command {|value| progress.value(value)} + vscale.command {|value| progress.inverted(vprogress, value) } + else + # This would also work, but the Tk scale widgets + # in the right hand pane cause some interference when + # in autoincrement/indeterminate mode. + # + progress.variable $V.ref(:SCALE) + vprogress.variable $V.ref(:VSCALE) + end + + scale.set(50) + vscale.set(50) + + lmode = Tk::Tile::Label.new(l, :text=>'Progress bar mode') + pbmode0 = Tk::Tile::Radiobutton.new(l, :variable=>$V.ref(:PBMODE), + :text=>'determinate', :value=>'determinate', + :command=>proc{pbMode(progress, vprogress)}) + pbmode1 = Tk::Tile::Radiobutton.new(l, :variable=>$V.ref(:PBMODE), + :text=>'indeterminate', :value=>'indeterminate', + :command=>proc{pbMode(progress, vprogress)}) + def pbMode(progress, vprogress) + if vprogress.mode != $V[:PBMODE] + vprogress.value(vprogress.maximum - vprogress.value) + end + + progress.mode $V[:PBMODE] + vprogress.mode $V[:PBMODE] + end + + start = Tk::Tile::Button.new(l, :text=>"Start", + :command=>proc{pbStart(progress, vprogress)}) + def pbStart(progress, vprogress) + # $V[:PBMODE] = 'indeterminate' + pbMode(progress, vprogress) + progress.start 10 + vprogress.start + end + + stop = Tk::Tile::Button.new(l, :text=>'Stop', + :command=>proc{pbStop(progress, vprogress)}) + def pbStop(progress, vprogress) + progress.stop + vprogress.stop + end + + Tk.grid(scale, :columnspan=>2, :sticky=>'ew') + Tk.grid(progress, :columnspan=>2, :sticky=>'ew') + Tk.grid(vscale, vprogress, :sticky=>'nws') + + Tk.grid(lmode, :sticky=>'we', :columnspan=>2) + Tk.grid(pbmode0, :sticky=>'we', :columnspan=>2) + Tk.grid(pbmode1, :sticky=>'we', :columnspan=>2) + Tk.grid(start, :sticky=>'we', :columnspan=>2) + Tk.grid(stop, :sticky=>'we', :columnspan=>2) + + l.grid_columnconfigure(0, :weight=>1) + l.grid_columnconfigure(1, :weight=>1) + l.grid_rowconfigure(99, :weight=>1) + + # standard frame + TkScale.new(r, :orient=>:horizontal, :from=>0, :to=>100, + :variable=>$V.ref(:SCALE)).grid(:sticky=>'news') + TkScale.new(r, :orient=>:vertical, :from=>0, :to=>100, + :variable=>$V.ref(:VSCALE)).grid(:sticky=>'nws') + + r.grid_columnconfigure(0, :weight=>1) + r.grid_columnconfigure(1, :weight=>1) + r.grid_rowconfigure(99, :weight=>1) + +else # tile 0.5 or earlier + + # themed frame + scale = Tk::Tile::Scale.new(l, :variable=>$V.ref(:SCALE), + :orient=>:horizontal, :from=>0, :to=>100) + vscale = Tk::Tile::Scale.new(l, :variable=>$V.ref(:VSCALE), + :orient=>:vertical, :from=>-25, :to=>25) + + progress = Tk::Tile::Progress.new(l, + :orient=>:horizontal, :from=>0, :to=>100) + vprogress = Tk::Tile::Progress.new(l, + :orient=>:vertical, :from=>-25, :to=>25) + + if true + scale.command{|value| progress.set(value)} + vscale.command{|value| vprogress.set(value)} + else # this would also work. (via TkVariable#trace) + v1 = scale.variable + v2 = vscale.variable + v1.trace('w', proc{ progress.set(v1.value) }) + v2.trace('w', proc{ vprogress.set(v2.value) }) + end + + Tk.grid(scale, :columnspan=>2, :sticky=>:ew) + Tk.grid(progress, :columnspan=>2, :sticky=>:ew) + Tk.grid(vscale, vprogress, :sticky=>:nws) + TkGrid.columnconfigure(l, 0, :weight=>1) + TkGrid.columnconfigure(l, 1, :weight=>1) + + # standard frame + TkScale.new(r, :variable=>$V.ref(:SCALE), + :orient=>:horizontal, :from=>0, :to=>100).grid(:sticky=>'news') + TkScale.new(r, :variable=>$V.ref(:VSCALE), + :orient=>:vertical, :from=>-25, :to=>25).grid(:sticky=>'nws') + + TkGrid.columnconfigure(r, 0, :weight=>1) + TkGrid.columnconfigure(r, 1, :weight=>1) +end + +# layout frames +Tk.grid(l, r, :sticky=>'nwes', :padx=>6, :pady=>6) +scales.grid_columnconfigure(0, :weight=>1) +scales.grid_columnconfigure(1, :weight=>1) +scales.grid_rowconfigure(0, :weight=>1) + +# +# Command box: +# +cmd = Tk::Tile::Frame.new($BASE) +b_close = Tk::Tile::Button.new(cmd, :text=>'Close', + :underline=>0, :default=>:normal, + :command=>proc{Tk.root.destroy}) +b_help = Tk::Tile::Button.new(cmd, :text=>'Help', :underline=>0, + :default=>:normal, :command=>proc{showHelp()}) +Tk.grid('x', b_close, b_help, :pady=>[6, 4], :padx=>4) +TkGrid.columnconfigure(cmd, 0, :weight=>1) + +# +# Set up accelerators: +# +$ROOT.bind('KeyPress-Escape', proc{Tk.event_generate(b_close, '<Invoke>')}) +$ROOT.bind('<Help>', proc{Tk.event_generate(b_help, '<Invoke>')}) +Tk::Tile::KeyNav.enableMnemonics($ROOT) +Tk::Tile::KeyNav.defaultButton(b_help) + +Tk.grid($TOOLBARS[0], '-', :sticky=>:ew) +Tk.grid($TOOLBARS[1], '-', :sticky=>:ew) +Tk.grid(control, nb, :sticky=>:news) +Tk.grid(cmd, '-', :sticky=>:ew) +TkGrid.columnconfigure($ROOT, 1, :weight=>1) +TkGrid.rowconfigure($ROOT, 2, :weight=>1) + +# +# Add a menu +# +menu = TkMenu.new($BASE) +$ROOT.menu(menu) +m_file = TkMenu.new(menu, :tearoff=>0) +menu.add(:cascade, :label=>'File', :underline=>0, :menu=>m_file) +m_file.add(:command, :label=>'Open', :underline=>0, + :compound=>:left, :image=>$ICON['open']) +m_file.add(:command, :label=>'Save', :underline=>0, + :compound=>:left, :image=>$ICON['save']) +m_file.add(:separator) +m_f_test = TkMenu.new(menu, :tearoff=>0) +m_file.add(:cascade, :label=>'Test submenu', :underline=>0, :menu=>m_f_test) +m_file.add(:checkbutton, :label=>'Text check', :underline=>5, + :variable=>$V.ref(:MENUCHECK1)) +m_file.insert(:end, :separator) + +if Tk.windowingsystem != 'x11' + TkConsole.create + m_file.insert(:end, :checkbutton, :label=>'Console', :underline=>5, + :variable=>$V.ref(:CONSOLE), :command=>proc{toggle_console()}) + def toggle_console + if TkComm.bool($V[:CONSOLE]) + TkConsole.show + else + TkConsole.hide + end + end +end + +m_file.add(:command, :label=>'Exit', :underline=>1, + :command=>proc{Tk.event_generate(b_close, '<Invoke>')}) + +%w(One Two Three Four).each{|lbl| + m_f_test.add(:radiobutton, :label=>lbl, :variable=>$V.ref(:MENURADIO1)) +} + +# Add Theme menu. +# +menu.add(:cascade, :label=>'Theme', :underline=>3, + :menu=>makeThemeMenu(menu)) + +setTheme($V[:THEME]) + +# +# Combobox demo pane: +# +values = %w(list abc def ghi jkl mno pqr stu vwx yz) +2.times {|i| + cb = Tk::Tile::Combobox.new( + combo, :values=>values, :textvariable=>$V.ref(:COMBO)) + cb.pack(:side=>:top, :padx=>2, :pady=>2, :expand=>false, :fill=>:x) + if i == 1 + cb.ttk_state :readonly + begin + cb.current = 3 # ignore if unsupported (tile0.4) + rescue + end + end +} + +# +# Treeview widget demo pane: +# +if version?('0.5') + + treeview = nil # avoid 'undefined' error + scrollbar = Tk::Tile::Scrollbar.new(tree, + :command=>proc{|*args| treeview.yview(*args)}) + treeview = Tk::Tile::Treeview.new(tree, :columns=>%w(Class), :padding=>4, + :yscrollcommand=>proc{|*args| scrollbar.set(*args)}) + + Tk.grid(treeview, scrollbar, :sticky=>'news') + tree.grid_columnconfigure(0, :weight=>1) + tree.grid_rowconfigure(0, :weight=>1) + tree.grid_propagate(0) + + # Add initial tree node: + # Later nodes will be added in <<TreeviewOpen>> binding. + treeview.insert('', 0, :id=>'.', :text=>'Main Window', :open=>false, + :values=>[TkWinfo.classname('.')]) + treeview.headingconfigure('#0', :text=>'Widget') + treeview.headingconfigure('Class', :text=>'Class') + treeview.bind('<TreeviewOpen>', proc{fillTree(treeview)}) + + def fillTree(treeview) + id = treeview.focus_item + unless TkWinfo.exist?(id) + treeview.delete(id) + end + # Replace tree item children with current list of child windows. + treeview.delete(treeview.children(id)) + for child in TkWinfo.children(id) + treeview.insert(id, :end, :id=>child, :text=>TkWinfo.appname(child), + :open=>false, :values=>[TkWinfo.classname(child)]) + unless TkWinfo.children(child).empty? + # insert dummy child to show [+] indicator + treeview.insert(child, :end) + end + end + end + +else + Tk::Tile::Label.new(tree, + :text=>'Treeview is supported on tile 0.5 or later...').pack +end + +# +# Other demos: +# +$Timers = {:StateMonitor=>nil, :FocusMonitor=>nil} + +begin + msg = Tk::Tile::Label.new(others, :justify=>:left, :wraplength=>300) +rescue + msg = TkMessage.new(others, :aspect=>200) +end + +$Desc = {} + +showDescription = TkBindTag.new +showDescription.bind('Enter', proc{|w| msg.text($Desc[w.path])}, '%W') +showDescription.bind('Leave', proc{|w| msg.text('')}, '%W') + +[ + [ :trackStates, "Widget states...", + "Display/modify widget state bits" ], + + [ :scrollbarResizeDemo, "Scrollbar resize behavior...", + "Shows how Tile and standard scrollbars differ when they're sized too large" ], + + [ :trackFocus, "Track keyboard focus..." , + "Display the name of the widget that currently has focus" ], + + [ :repeatDemo, "Repeating buttons...", + "Demonstrates custom classes (see demos/repeater.tcl)" ] + +].each{|demo_cmd, label, description| + b = Tk::Tile::Button.new(others, :text=>label, + :command=>proc{ self.__send__(demo_cmd) }) + $Desc[b.path] = description + b.bindtags <<= showDescription + + b.pack(:side=>:top, :expand=>false, :fill=>:x, :padx=>6, :pady=>6) +} + +msg.pack(:side=>:bottom, :expand=>true, :fill=>:both) + + +# +# Scrollbar resize demo: +# +$scrollbars = nil + +def scrollbarResizeDemo + if $scrollbars + begin + $scrollbars.destroy + rescue + end + end + $scrollbars = TkToplevel.new(:title=>'Scrollbars', :geometry=>'200x200') + f = TkFrame.new($scrollbars, :height=>200) + tsb = Tk::Tile::Scrollbar.new(f, :command=>proc{|*args| sbstub(tsb, *args)}) + sb = TkScrollbar.new(f, :command=>proc{|*args| sbstub(sb, *args)}) + Tk.grid(tsb, sb, :sticky=>:news) + + sb.set(0, 0.5) # prevent backwards-compatibility mode for old SB + + f.grid_columnconfigure(0, :weight=>1) + f.grid_columnconfigure(1, :weight=>1) + f.grid_rowconfigure(0, :weight=>1) + + f.pack(:expand=>true, :fill=>:both) +end + +# +# Track focus demo: +# +$FocusInf = TkVariable.new_hash +$focus = nil + +def trackFocus + if $focus + begin + $focus.destroy + rescue + end + end + $focus = TkToplevel.new(:title=>'Keyboard focus') + i = 0 + [ + ["Focus widget:", :Widget], + ["Class:", :WidgetClass], + ["Next:", :WidgetNext], + ["Grab:", :Grab], + ["Status:", :GrabStatus] + ].each{|label, var_index| + Tk.grid(Tk::Tile::Label.new($focus, :text=>label, :anchor=>:e), + Tk::Tile::Label.new($focus, + :textvariable=>$FocusInf.ref(var_index), + :width=>40, :anchor=>:w, :relief=>:groove), + :sticky=>:ew) + i += 1 + } + $focus.grid_columnconfigure(1, :weight=>1) + $focus.grid_rowconfigure(i, :weight=>1) + + $focus.bind('Destroy', proc{Tk.after_cancel($Timers[:FocusMonitor])}) + focusMonitor +end + +def focusMonitor + $FocusInf[:Widget] = focus_win = Tk.focus + if focus_win + $FocusInf[:WidgetClass] = focus_win.winfo_classname + $FocusInf[:WidgetNext] = Tk.focus_next(focus_win) + else + $FocusInf[:WidgetClass] = $FocusInf[:WidgetNext] = '' + end + + $FocusInf[:Grab] = grab_wins = Tk.current_grabs + unless grab_wins.empty? + $FocusInf[:GrabStatus] = grab_wins[0].grab_status + else + $FocusInf[:GrabStatus] = '' + end + + $Timers[:FocusMonitor] = Tk.after(200, proc{ focusMonitor() }) +end + +# +# Widget state demo: +# +$Widget = TkVariable.new + +TkBindTag::ALL.bind('Control-Shift-ButtonPress-1', + proc{|w| + $Widget.value = w + updateStates() + Tk.callback_break + }, '%W') +$states_list = %w(active disabled focus pressed selected + background indeterminate invalid default) +$states_btns = {} +$states = nil + +$State = TkVariable.new_hash + +def trackStates + if $states + begin + $state.destroy + rescue + end + end + $states = TkToplevel.new(:title=>'Widget states') + + l_inf = Tk::Tile::Label.new($states, :text=>"Press Control-Shift-Button-1 on any widget") + + l_lw = Tk::Tile::Label.new($states, :text=>'Widget:', + :anchor=>:e, :relief=>:groove) + l_w = Tk::Tile::Label.new($states, :textvariable=>$Widget, + :anchor=>:w, :relief=>:groove) + + Tk.grid(l_inf, '-', :sticky=>:ew, :padx=>6, :pady=>6) + Tk.grid(l_lw, l_w, :sticky=>:ew) + + $states_list.each{|st| + cb = Tk::Tile::Checkbutton.new($states, :text=>st, + :variable=>$State.ref(st), + :command=>proc{ changeState(st) }) + $states_btns[st] = cb + Tk.grid('x', cb, :sticky=>:nsew) + } + + $states.grid_columnconfigure(1, :weight=>1) + + f_cmd = Tk::Tile::Frame.new($states) + Tk.grid('x', f_cmd, :sticky=>:nse) + + b_close = Tk::Tile::Button.new(f_cmd, :text=>'Close', + :command=>proc{ $states.destroy }) + Tk.grid('x', b_close, :padx=>4, :pady=>[6,4]) + f_cmd.grid_columnconfigure(0, :weight=>1) + + $states.bind('KeyPress-Escape', proc{Tk.event_generate(b_close, '<Invoke>')}) + + $states.bind('Destroy', proc{Tk.after_cancel($Timers[:StateMonitor])}) + stateMonitor() +end + +def stateMonitor + updateStates() if $Widget.value != '' + $Timers[:StateMonitor] = Tk.after(200, proc{ stateMonitor() }) +end + +def updateStates + $states_list.each{|st| + begin + $State[st] = $Widget.window.ttk_instate(st) + rescue + $states_btns[st].ttk_state('disabled') + else + $states_btns[st].ttk_state('!disabled') + end + } +end + +def changeState(st) + if $Widget.value != '' + if $State.bool_element(st) + $Widget.window.ttk_state(st) + else + $Widget.window.ttk_state("!#{st}") + end + end +end + +# +# Repeating buttons demo: +# +def repeatDemo + if defined?($repeatDemo) && $repeatDemo.exist? + $repeatDemo.deiconify; return + end + $repeatDemo = TkToplevel.new(:title=>'Repeating button') + + f = Tk::Tile::Frame.new($repeatDemo) + b = Tk::Tile::Button.new(f, :class=>'Repeater', :text=>'Press and hold') + if version?('0.6') + p = Tk::Tile::Progressbar.new(f, :orient=>:horizontal, :maximum=>10) + else # progressbar is not supported + p = Tk::Tile::Progress.new(f, :orient=>:horizontal, :from=>0, :to=>10) + def p.step + i = self.get + 1 + i = self.from if i > self.to + self.set(i) + end + end + b.command {p.step} + + b.pack(:side=>:left, :expand=>false, :fill=>:none, :padx=>6, :pady=>6) + p.pack(:side=>:right, :expand=>true, :fill=>:x, :padx=>6, :pady=>6) + f.pack(:expand=>true, :fill=>:both) +end + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/iconlib.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/iconlib.tcl new file mode 100644 index 0000000..9a93ece --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/iconlib.tcl @@ -0,0 +1,110 @@ +array set ImgData { +bold {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAI6hI+py60U3wj+ +RYQFJYRvEWFBCeFbRFhQQvhG8YPgX0RYUEL4FhEWlBC+RYQFJYQPFN8IPqYut/8hBQA7} +copy {R0lGODlhEAAQAJEAANnZ2QAAAP///wAAhCH5BAEAAAAALAAAAAAQABAAAAJUhI8JFJ/gY4iI +UEL4FyIiFIXgW0iEUDgfACBI9pzMAAGRiIghWSMDECR7JEKGtkFIRFBG+TIQKDQxtgzcDcmX +IfgwQrFlCD4MyZch+EDzj+Bj6mYBADs=} +cut {R0lGODlhEAAQAJEAANnZ2QAAAAAAhP///yH5BAEAAAAALAAAAAAQABAAAAJFhI+pcUHwEeIi +E0gACIKPEAFBIXy0gMg8EhM+YmQiKSL4eAIiJMI/EQEhQGYGYiQIQAg+iAkIATIzECMBIgT/ +RBARERlSADs=} +dragfile {R0lGODlhGAAYAKIAANnZ2TMzM////wAAAJmZmf///////////yH5BAEAAAAALAAAAAAYABgA +AAPACBi63IqgC4GiyxwogaAbKLrMgSKBoBoousyBogEACIGiyxwoKgGAECI4uiyCExMTOACB +osuNpDoAGCI4uiyCIkREOACBosutSDoAgSI4usyCIjQAGCi63Iw0ACEoOLrMgiI0ABgoutyM +NAAhKDi6zIIiNAAYKLrcjDQAISg4usyCIjQAGCi63Iw0AIGiiqPLIyhCA4CBosvNSAMQKKo4 +ujyCIjQAGCi63Iw0AIGiy81IAxCBpMu9GAMAgKPL3QgJADs=} +dragicon {R0lGODlhGAAYALMAANnZ2TMzM/////8zM8zMzGYAAAAAAJmZmQCZMwAzZgCZzGZmZv////// +/////////yH5BAEAAAAALAAAAAAYABgAAAT/EMAgJ60SAjlBgEJOSoMIEMgZoJCT0iADBFIG +KOSkNMwAAABhwiHnIEKIIIQQAQIZhBBwyDmKEMIEE0yABoAghIBDzlGEENDIaQAIQgg45BwF +CinPOccAECYcUiKEEBFCiHPgMQAEIcQYYyABBUGIQCHlMQCEScZAAhKEEApCECGOARAEIQQp +BRGIpAyCJCGOASBAISdEcqJAVBLiGABggELOAJGUKyiVhDgGABigkJMEhNAKSqkEhTgGgCCl +FCQEGIJSSiUhjgEgQCEnJVBJmYQ4BoAAhZyTQCVnEuIYAAIUckoCk5xSiGMACFDISSs9BoBg +rRXQMQAEKOSklR4DEUAI8MhJ6wwGAACgkZNWCkAEADs=} +error {R0lGODlhIAAgAKIAANnZ2YQAAP8AAISEhP///////////////yH5BAEAAAAALAAAAAAgACAA +AAP/CLoMGLqKoMvtGIqiqxEYCLrcioGiyxwIusyBgaLLLRiBoMsQKLrcjYGgu4Giy+2CAkFX +A0WX2wXFIOgGii7trkCEohsDCACBoktEKLpKhISiGwAIECiqSKooukiqKKoxgACBooukKiIo +SKooujGDECi6iqQqsopEV2MQAkV3kXQZRXdjEAJFl5F0FUWXY3ACRZcFSRdFlyVwJlB0WZB0 +UXRZAmcCRZeRdBVFl2NwAkV3kXQZRXdjcAJFV5FURVaR6GoMDgSKLpKqiKAgqaLoxgwOBIoq +kiqKLpIqimrM4ECg6BIRiq4SIaHoxgyCBoou7a5AhKIbMzgAAIGiy+2CTWJmBhAAAkWX2wXF +zCDoBooud2PMDIKuRqDocgtGzMwg6O4Eii5z4Kgi6DIMhqLoagQGjiqCLvPgYOgqji6CLrfi +6DIj6HI7jq4i6DIkADs=} +file {R0lGODlhCwANAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAALAA0AAAIyhI9G8Q0AguSH +AMQdxQgxEyEFQfItICQokYgEBMm3gBCKLRIQJN8CQii2SECQfAug+FgAOw==} +folder {R0lGODlhEAANAKIAANnZ2YSEhMbGxv//AP///wAAAP///////yH5BAEAAAAALAAAAAAQAA0A +AANjCIqhiqDLITgyEgi6GoIjIyMYugCBpMsaWBA0giMjIzgyUYBBMjIoIyODEgVBODIygiMj +E1gQJIMyMjIoI1GAQSMjODIyghMFQSgjI4MyMhJYEDSCIyMjODJRgKHLXAiApcucADs=} +hourglass {R0lGODlhIAAgAKIAANnZ2YAAAAAAAP8AAP///8DAwICAgP///yH5BAEAAAAALAAAAAAgACAA +AAPZCLrc/jDKSau9OGcUuqyCoMvNGENVhaMrCLrcjaLLgqDL7WhFVIVVZoKgy+1oRUSFVWaC +oMvtaEVEhVVmgqDL7WhFRIVVZoKgy+1oVVaCJWaCoMvtgKxISrBMEHS5fZEVSRkKgi63NzIq +EwRdbndkVCYIutzeyIqqDAVBl9sXWRFJYZkg6HI7ICsiKqwyEwRdbkcrIhKsMhMEXW5HKyIp +lDITBF1uRysyEiwxEwRdbkcrIyuUEhMEXW5H0WVB0OVujKGqwtEVBF1uRtHlRdDl9odRTlrt +xRmjBAA7} +info {R0lGODlhIAAgAKIAANnZ2YSEhMbGxv///wAA/wAAAP///////yH5BAEAAAAALAAAAAAgACAA +AAP/CLoMGLqKoMvtGCo4uhKBgaDLDRghOLqsghEIuryBgqPLPSiBoMsQOLojhEQkOLpTCLob +OLqKpIujq4WgC4Gju0i6OLpbCKohOLorhEQkOLorhaAQOLrc3qgCIARHl9sbSQUEji4j6RKO +Lk9hQODosiKp4ujyFIbi6LIiqeLo8hSG4uiyIqni6PIUhuLosiKp4ujyFIYKji4PkiqOLkth +BASOLg+SKo4uV2AEhODoMpIqju5KYShA4Ogqku7i6E4FRgAAYOHocvugiohAUC0cXe7GiohA +0IUSHF3uQamICATdrULB0WUVrIqIQNBlCCwVHF2pwsJQRdDlDYyoKsHRPMLQDQRdbsDQqBmc +wlBF0OV2jJqZwggEXW5vVDMVgaDL7Y5qKgJBl9sfVUUg6HL7AxSKoMvtr1AEgi5DAgA7} +italic {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAIrhI+py+1A4hN8 +hIjINBITPlpEZBqJCR8tIjKNxISPFhGZQOITfExdbv9FCgA7} +new {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAJFhI95FN8IvgXJ +jyD4ECQ/JAh+kPyICIIdJP+CYAfJvyDYQfIvCHaQ/AuCHST/gmAHyb8g2EHyLwh2kPwLgk3x +MQg+pu4WADs=} +open {R0lGODlhEAAQAKIAANnZ2QAAAP//AP///4SEAP///////////yH5BAEAAAAALAAAAAAQABAA +AANZCLrczigUQZc1EDQgEHSZAwMgIhB0NQIDQkYwdANBNUZwZGQEJxBUQwZlZGRQAkE1RnAE +Q5dVcCSQdDcAYySQdDcAISSQdDcAASKQdDcAAQBDlwNBl9sfApQAOw==} +openfold {R0lGODlhEAANAKIAANnZ2YSEhP///8bGxv//AAAAAP///////yH5BAEAAAAALAAAAAAQAA0A +AANgCIqhiqDLgaIaCLoagkNDIxi6AIFCQ0M4KKpRgCFDQzg0NIQThaHLSxgVKLochRMVMkhD +Q4M0VBFYEDKEQ0NDOFFRgCE0NEhDQ4MVBRAoNDSEQ0NRWAAYuqyFBQBYurwJADs=} +overstrike {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAI3hI+py80Uh+Aj +RFhQCP8iMILgWwRGEHyLwAiCbxEYQfCB4iPBhwiMIPgXYREEHyEiguBj6nI7FQA7} +palette {R0lGODlhEAAQAKIAANnZ2QAAAP//AP////8A/4QAhP8AAAD//yH5BAEAAAAALAAAAAAQABAA +AANtCLrcjqGBoMsRKCMTgaALMSgDAYMSCKoxgAFBITgSAIAQEhUIARCAEgAQOBAwghMQEwga +MoIjIxAIEgCAEBEyKBAgg4GgGxAIYTGCgaALcRgQIIGgCwEYICODgaALITgyEoGguxiqCLrc +/lChBAA7} +passwd {R0lGODlhIAAgAMQAANnZ2QAAAICAgICAAP///7CwsMDAwMjIAPjIAOjo6Pj4AODg4HBwcMj4 +ANjY2JiYANDQ0MjIyPj4yKCgoMiYAMjImDAwAMjIMJiYmJCQkP////////////////////// +/yH5BAEAAAAALAAAAAAgACAAAAX/ICCOIhiIIgiII1maZSCMQnCeJyAIQiAIAiAMwxCcJwkk +EAQRCIUwGMSBDEEAAuJIlgKRJEEgGAMRBIGiDENQlqNAJAsYCEwgEEEgBAHSIEMAAuJIAgKR +LEsgGEMgCEJgBMqhHENQlgJILMsSCMRABEFgGAESHMcRgIA4kgKxOIsTBAOhKAITKEGDHMhD +kqIAEqAjisJAgIooBkpwNMcTgIA4jgLhOBAkEAOhKIoSKEGDIMcTkKQICgQEQQIxEIqiBEpw +IMdxPAEIiCMJCEQUMUQ0EIqiHIfSIM3xBGUpCiABCUQyEMqhHMiBHMjxBCAgjuQoEAKxRANB +HMqhHM1x/zxDUJajQIACsUTDQBAEIR3IcQRDAALiSIoCYQiEE03gII7HQR3BEICAOJICYRSC +QDjRNE1CAAzVQR3WE5AkAAqEUQiFQEARBAUAAAzHQR3BEICAOI4CUQhFIBAREwXjUFUHdQRD +QJJAABbCFAhEJBgBAADAMAwXdQRDAALiCAhEIRQCYRiCEZDjUFFHMAQkIBAFOAmTQBiFUAQg +II7AUFXUEQwBCQjEJExBkBRCEZCjMIBD9RxDAALiGEzCFBBYIRTBOI7AQB1DMIoCMQkYGAjL +JEwBCIgjOVDDEJCAQGACJiTTJEwBSY5BEJAiSCCwTAiCZBKmAATEkSzNQBCCYCDBJgELTNMk +g0AMEgwTAhAQR7I0zYARgvM8TyAIznMMAQA7} +paste {R0lGODlhEAAQAKIAANnZ2QAAAP//AISEAISEhP///wAAhP///yH5BAEAAAAALAAAAAAQABAA +AANwCLrcjqGBoKsYqiKrCDSGBkMiJJCGAgCDKBB0gwYDIKYwdJUIAyBokIaGBmloAhBiaAgH +TdcCEIKGBsmwVM0AIYaGcAxL1coQgoYGySoisMzMAoeGxrB01QJpaMiwMHTLAEPVsHTVEHTR +dBlBlxswAQA7} +print {R0lGODlhEAAQAKIAANnZ2QAAAP///4SEhP//AP///////////yH5BAEAAAAALAAAAAAQABAA +AANZCLrcjqG7CLqBoquBoBuCoSqBoBsouhoIuiEYqrKBoIGiqwEYEIChyxAIEYGgywEYgKHL +DAgRCLozgwABARgIukSEABEBGLq8gAEQCLobgAEAgKHLgaDLzZgAOw==} +question {R0lGODlhIAAgAKIAANnZ2YSEhMbGxv///wAAAAAA/////////yH5BAEAAAAALAAAAAAgACAA +AAP/CLoMGLqKoMvtGCo4uhKBgaDLDRghOLqsghEIuryBgqPLPSiBoMsQOLrcjYSgu4GjO4Kl +Kzi6Qwi6EDi6I4UyU1VYgqM7hKAagqM7VTg6VYWFoztCCAqBo6tVWDVThVU4ukqBACE4ulqF +VSNVWIWjq0IYEDi6K4UlU1VYOLpMgRA4uryCpTi6PIShOLq8hVU4uqyEoTi6vIUlOLqshKE4 +uryFhaPLSxgqOLrc3kgoAgJHl0ewSnB0eQhDIQRHl6uwCkeXhTAUIHB0uQqrcHSZAiMAAJBw +dFcKS3B0lwIjAkGVcHS5GykiAkEXSHB0uQeFIiIQdJcIBUeXVZAoIgJBT5chkFRwdIUICUMV +QZc3MIKIBEcJQzcQdLkBQ4NmcAhDFUGX2zFoZggjEHS5vRHNUASCLrc7oqEIBF1uf0QUgaDL +7Q9QKIIut79CEQi6DAkAOw==} +redo {R0lGODlhEAAQAJEAANnZ2QAAhP///////yH5BAEAAAAALAAAAAAQABAAAAIvhI+py+1vSByC +jxAYQXDMwsyAggQAQBB8iwgMgg8REQgUwqbYBDsIPqYutz+MgBQAOw==} +save {R0lGODlhEAAQAJEAANnZ2QAAAISEAP///yH5BAEAAAAALAAAAAAQABAAAAJWhI9pFB8RIIRC ++BYQFqQQvkWEBSmEbyFhQQrhW0hYkEL4FhIWpBC+hYQFSYxvIgFAoXy0AAiSGP8kAIIkxgcI +CSBEQvEBQgIIkVB8gJAAAhgfj+BjWgEAOw==} +underline {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAI3hI+py60UBy4I +vkVcBMG/iIsg+BdxEQT/Ii6C4F/ERRD8i7gIgn8RF0HwkWITfExFin8EH1OXCwA7} +undo {R0lGODlhEAAQAJEAANnZ2QAAhP///////yH5BAEAAAAALAAAAAAQABAAAAIuhI+py+2vSByC +HxdxQCHsCIg7oAAAEUHwLTAiKIQPgRSbYMfd3VEIH1OX2x8mUgA7} +warning {R0lGODlhIAAgAKIAANnZ2YSEAP//AMbGxgAAAISEhP///////yH5BAEAAAAALAAAAAAgACAA +AAP/CLq8gREIutz+KESGEHS5vVGIiAxSIehy+6JAUaUqBF1uBxQoukOFhaDL7RgoukKFhaDL +3RgoujqEVQi63IyBortUWAi63IuBostDWIWgy60YIjKERCMiSFUIutyAISKCpCoiOFSFoMsd +KCpIqiKCQlUIusyBooqkKiIoQ1UIuryBooqkiqJKVQi6rIGii6SKojpUWAi6DIGiG0RIgaJL +VQi6HCi6MoREg6I7VFgIuhsoukqEhKKrVFgIuhoouhuEgaKrQ1iFoAuBortDOCi6S4WFoBso +uiyEostDWIWgGii63K6IqgAAIVB0WQaJBkV3h7AKAAJFl4WQiFB0mQoLRyBQdFkJiQhFl4ew +CgJFl3WQaFB0WQirIFB0ud0RVVWg6HJ7o6GqAgwUXW5fNFRVhQCBpMvti0oVABCwdLndEehi +6XI7I4AEADs=} +} diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/readme.txt b/jni/ruby/ext/tk/sample/tkextlib/tile/readme.txt new file mode 100644 index 0000000..6c4a5cf --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/readme.txt @@ -0,0 +1,2 @@ +All of *.tcl and under themes/ directory (except kroc.rb) are +quoted from Tcl/Tk's Tile extension. Please read Orig_LICENSE.txt. diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/repeater.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/repeater.tcl new file mode 100644 index 0000000..5a7d82f --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/repeater.tcl @@ -0,0 +1,117 @@ +# +# $Id: repeater.tcl 31689 2011-05-22 09:26:02Z nobu $ +# +# Demonstration of custom classes. +# +# The Tile button doesn't have built-in support for autorepeat. +# Instead of adding -repeatdelay and -repeatinterval options, +# and all the extra binding scripts required to deal with them, +# we create a custom widget class for autorepeating buttons. +# +# Usage: +# ttk::button .b -class Repeater [... other options ...] +# +# TODO: +# Use system settings for repeat interval and initial delay. +# +# Notes: +# Repeater buttons work more like scrollbar arrows than +# Tk repeating buttons: they fire once immediately when +# first pressed, and $State(delay) specifies the initial +# interval before the button starts autorepeating. +# + +namespace eval tile::Repeater { + variable State + set State(timer) {} ;# [after] id of repeat script + set State(interval) 100 ;# interval between repetitions + set State(delay) 300 ;# delay after initial invocation +} + +### Class bindings. +# + +bind Repeater <Enter> { %W state active } +bind Repeater <Leave> { %W state !active } + +bind Repeater <Key-space> { tile::Repeater::Activate %W } +bind Repeater <<Invoke>> { tile::Repeater::Activate %W } + +bind Repeater <ButtonPress-1> { tile::Repeater::Press %W } +bind Repeater <ButtonRelease-1> { tile::Repeater::Release %W } +bind Repeater <B1-Leave> { tile::Repeater::Pause %W } +bind Repeater <B1-Enter> { tile::Repeater::Resume %W } ;# @@@ see below + +# @@@ Workaround for metacity-induced bug: +bind Repeater <B1-Enter> \ + { if {"%d" ne "NotifyUngrab"} { tile::Repeater::Resume %W } } + +### Binding procedures. +# + +## Activate -- Keyboard activation binding. +# Simulate clicking the button, and invoke the command once. +# +proc tile::Repeater::Activate {w} { + $w instate disabled { return } + set oldState [$w state pressed] + update idletasks; after 100 + $w state $oldState + after idle [list $w invoke] +} + +## Press -- ButtonPress-1 binding. +# Invoke the command once and start autorepeating after +# $State(delay) milliseconds. +# +proc tile::Repeater::Press {w} { + variable State + $w instate disabled { return } + $w state pressed + $w invoke + after cancel $State(timer) + set State(timer) [after $State(delay) [list tile::Repeater::Repeat $w]] +} + +## Release -- ButtonRelease binding. +# Stop repeating. +# +proc tile::Repeater::Release {w} { + variable State + $w state !pressed + after cancel $State(timer) +} + +## Pause -- B1-Leave binding +# Temporarily suspend autorepeat. +# +proc tile::Repeater::Pause {w} { + variable State + $w state !pressed + after cancel $State(timer) +} + +## Resume -- B1-Enter binding +# Resume autorepeat. +# +proc tile::Repeater::Resume {w} { + variable State + $w instate disabled { return } + $w state pressed + $w invoke + after cancel $State(timer) + set State(timer) [after $State(interval) [list tile::Repeater::Repeat $w]] +} + +## Repeat -- Timer script +# Invoke the command and reschedule another repetition +# after $State(interval) milliseconds. +# +proc tile::Repeater::Repeat {w} { + variable State + $w instate disabled { return } + $w invoke + set State(timer) [after $State(interval) [list tile::Repeater::Repeat $w]] +} + +#*EOF* diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue.tcl new file mode 100644 index 0000000..68733e8 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue.tcl @@ -0,0 +1,149 @@ +# blue.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net> +# +# blue.tcl,v 1.27 2005/10/08 14:56:57 jenglish Exp +# +# + +namespace eval tile::theme::blue { + + package provide tile::theme::blue 0.7 + + set imgdir [file join [file dirname [info script]] blue] + array set I [tile::LoadImages $imgdir *.gif] + + array set colors { + -frame "#6699cc" + -lighter "#bcd2e8" + -window "#e6f3ff" + -selectbg "#ffff33" + -selectfg "#000000" + -disabledfg "#666666" + } + + style theme create blue -settings { + + style default . \ + -borderwidth 1 \ + -background $colors(-frame) \ + -fieldbackground $colors(-window) \ + -troughcolor $colors(-lighter) \ + -selectbackground $colors(-selectbg) \ + -selectforeground $colors(-selectfg) \ + ; + style map . -foreground [list disabled $colors(-disabledfg)] + + ## Buttons. + # + style default TButton -padding "10 0" + style layout TButton { + Button.button -children { + Button.focus -children { + Button.padding -children { + Button.label + } + } + } + } + + style element create button image $I(button-n) \ + -map [list pressed $I(button-p) active $I(button-h)] \ + -border 4 -sticky ew + + style element create Checkbutton.indicator image $I(check-nu) \ + -width 24 -sticky w -map [list \ + {!disabled active selected} $I(check-hc) \ + {!disabled active} $I(check-hu) \ + {!disabled selected} $I(check-nc) ] + + style element create Radiobutton.indicator image $I(radio-nu) \ + -width 24 -sticky w -map [list \ + {!disabled active selected} $I(radio-hc) \ + {!disabled active} $I(radio-hu) \ + selected $I(radio-nc) ] + + style default TMenubutton -relief raised -padding {10 2} + + ## Toolbar buttons. + # + style default Toolbutton \ + -width 0 -relief flat -borderwidth 2 -padding 4 \ + -background $colors(-frame) -foreground #000000 ; + style map Toolbutton -background [list active $colors(-selectbg)] + style map Toolbutton -foreground [list active $colors(-selectfg)] + style map Toolbutton -relief { + disabled flat + selected sunken + pressed sunken + active raised + } + + ## Entry widgets. + # + style default TEntry \ + -selectborderwidth 1 -padding 2 -insertwidth 2 -font TkTextFont + style default TCombobox \ + -selectborderwidth 1 -padding 2 -insertwidth 2 -font TkTextFont + + ## Notebooks. + # + style default TNotebook.Tab -padding {4 2 4 2} + style map TNotebook.Tab \ + -background \ + [list selected $colors(-frame) active $colors(-lighter)] \ + -padding [list selected {4 4 4 2}] + + ## Labelframes. + # + style default TLabelframe -borderwidth 2 -relief groove + + ## Scrollbars. + # + style layout Vertical.TScrollbar { + Scrollbar.trough -children { + Scrollbar.uparrow -side top + Scrollbar.downarrow -side bottom + Scrollbar.uparrow -side bottom + Vertical.Scrollbar.thumb -side top -expand true -sticky ns + } + } + + style layout Horizontal.TScrollbar { + Scrollbar.trough -children { + Scrollbar.leftarrow -side left + Scrollbar.rightarrow -side right + Scrollbar.leftarrow -side right + Horizontal.Scrollbar.thumb -side left -expand true -sticky we + } + } + + style element create Horizontal.Scrollbar.thumb image $I(sb-thumb) \ + -map [list {pressed !disabled} $I(sb-thumb-p)] -border 3 + + style element create Vertical.Scrollbar.thumb image $I(sb-vthumb) \ + -map [list {pressed !disabled} $I(sb-vthumb-p)] -border 3 + + foreach dir {up down left right} { + style element create ${dir}arrow image $I(arrow${dir}) \ + -map [list \ + disabled $I(arrow${dir}) \ + pressed $I(arrow${dir}-p) \ + active $I(arrow${dir}-h)] \ + -border 1 -sticky {} + } + + ## Scales. + # + style element create Scale.slider \ + image $I(slider) -map [list {pressed !disabled} $I(slider-p)] + + style element create Vertical.Scale.slider \ + image $I(vslider) -map [list {pressed !disabled} $I(vslider-p)] + + style element create Horizontal.Progress.bar \ + image $I(sb-thumb) -border 2 + style element create Vertical.Progress.bar \ + image $I(sb-vthumb) -border 2 + + } +} + diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gif Binary files differnew file mode 100644 index 0000000..3c1be9d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gif Binary files differnew file mode 100644 index 0000000..1cb36ec --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown.gif Binary files differnew file mode 100644 index 0000000..e363c36 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gif Binary files differnew file mode 100644 index 0000000..cbc3db2 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gif Binary files differnew file mode 100644 index 0000000..14d541b --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft.gif Binary files differnew file mode 100644 index 0000000..32584a3 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gif Binary files differnew file mode 100644 index 0000000..913e9da --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gif Binary files differnew file mode 100644 index 0000000..d02208f --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright.gif Binary files differnew file mode 100644 index 0000000..2b0f1fd --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gif Binary files differnew file mode 100644 index 0000000..6059bae --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gif Binary files differnew file mode 100644 index 0000000..20b6a82 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup.gif Binary files differnew file mode 100644 index 0000000..5857616 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-h.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-h.gif Binary files differnew file mode 100644 index 0000000..0947f43 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-h.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.gif Binary files differnew file mode 100644 index 0000000..d984528 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.xcf b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.xcf Binary files differnew file mode 100644 index 0000000..e38ed19 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.xcf diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-p.gif Binary files differnew file mode 100644 index 0000000..e819b1b --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hc.gif Binary files differnew file mode 100644 index 0000000..b753aea --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hu.gif Binary files differnew file mode 100644 index 0000000..74dbb79 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nc.gif Binary files differnew file mode 100644 index 0000000..8f3d911 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nu.gif Binary files differnew file mode 100644 index 0000000..6f360ff --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hc.gif Binary files differnew file mode 100644 index 0000000..f7c21fb --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hu.gif Binary files differnew file mode 100644 index 0000000..a006630 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nc.gif Binary files differnew file mode 100644 index 0000000..0281de3 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nu.gif Binary files differnew file mode 100644 index 0000000..58ec60c --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gif Binary files differnew file mode 100644 index 0000000..6cfaa41 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gif Binary files differnew file mode 100644 index 0000000..d9bfc0a --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gif Binary files differnew file mode 100644 index 0000000..930d7fd --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gif Binary files differnew file mode 100644 index 0000000..060be5d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider-p.gif Binary files differnew file mode 100644 index 0000000..c1c089d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider.gif Binary files differnew file mode 100644 index 0000000..1805c2d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider-p.gif Binary files differnew file mode 100644 index 0000000..bc37b31 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider.gif Binary files differnew file mode 100644 index 0000000..d3745c7 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/pkgIndex.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/pkgIndex.tcl new file mode 100644 index 0000000..4facac7 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/blue/pkgIndex.tcl @@ -0,0 +1,6 @@ +# Package index for tile demo pixmap themes. + +if {[file isdirectory [file join $dir blue]]} { + package ifneeded tile::theme::blue 0.7 \ + [list source [file join $dir blue.tcl]] +} diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik.tcl new file mode 100644 index 0000000..6513a2f --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik.tcl @@ -0,0 +1,194 @@ +# keramik.tcl - +# +# A sample pixmap theme for the tile package. +# +# Copyright (c) 2004 Googie +# Copyright (c) 2004 Pat Thoyts <patthoyts@users.sourceforge.net> +# +# $Id: keramik.tcl 31689 2011-05-22 09:26:02Z nobu $ + +package require Tk 8.4; # minimum version for Tile +package require tile 0.5; # depends upon tile 0.5 + +namespace eval tile { + namespace eval theme { + namespace eval keramik { + variable version 0.3.2 + } + } +} + +namespace eval tile::theme::keramik { + + variable imgdir [file join [file dirname [info script]] keramik] + variable I + array set I [tile::LoadImages $imgdir *.gif] + + variable colors + array set colors { + -frame "#cccccc" + -lighter "#cccccc" + -window "#ffffff" + -selectbg "#eeeeee" + -selectfg "#000000" + -disabledfg "#aaaaaa" + } + + style theme create keramik -parent alt -settings { + + + # ----------------------------------------------------------------- + # Theme defaults + # + style default . \ + -borderwidth 1 \ + -background $colors(-frame) \ + -troughcolor $colors(-lighter) \ + -font TkDefaultFont \ + ; + + style map . -foreground [list disabled $colors(-disabledfg)] + + # ----------------------------------------------------------------- + # Button elements + # - the button has a large rounded border and needs a bit of + # horizontal padding. + # - the checkbutton and radiobutton have the focus drawn around + # the whole widget - hence the new layouts. + # + style layout TButton { + Button.background + Button.button -children { + Button.focus -children { + Button.label + } + } + } + style layout Toolbutton { + Toolbutton.background + Toolbutton.button -children { + Toolbutton.focus -children { + Toolbutton.label + } + } + } + style element create button image $I(button-n) \ + -border {8 6 8 16} -padding {6 6} -sticky news \ + -map [list {pressed !disabled} $I(button-p) \ + {active !selected} $I(button-h) \ + selected $I(button-s) \ + disabled $I(button-d)] + style default TButton -padding {10 6} + + style element create Toolbutton.button image $I(tbar-n) \ + -border {2 8 2 16} -padding {2 2} -sticky news \ + -map [list {pressed !disabled} $I(tbar-p) \ + {active !selected} $I(tbar-a) \ + selected $I(tbar-p)] + + style element create Checkbutton.indicator image $I(check-u) \ + -width 20 -sticky w \ + -map [list selected $I(check-c)] + + style element create Radiobutton.indicator image $I(radio-u) \ + -width 20 -sticky w \ + -map [list selected $I(radio-c)] + + # The layout for the menubutton is modified to have a button element + # drawn on top of the background. This means we can have transparent + # pixels in the button element. Also, the pixmap has a special + # region on the right for the arrow. So we draw the indicator as a + # sibling element to the button, and draw it after (ie on top of) the + # button image. + style layout TMenubutton { + Menubutton.background + Menubutton.button -children { + Menubutton.focus -children { + Menubutton.padding -children { + Menubutton.label -side left -expand true + } + } + } + Menubutton.indicator -side right + } + style element create Menubutton.button image $I(mbut-n) \ + -map [list {active !disabled} $I(mbut-a) \ + {pressed !disabled} $I(mbut-a) \ + {disabled} $I(mbut-d)] \ + -border {7 10 29 15} -padding {7 4 29 4} -sticky news + style element create Menubutton.indicator image $I(mbut-arrow-n) \ + -width 11 -sticky w -padding {0 0 18 0} + + # ----------------------------------------------------------------- + # Scrollbars, scale and progress elements + # - the scrollbar has three arrow buttons, two at the bottom and + # one at the top. + # + style layout Vertical.TScrollbar { + Scrollbar.background + Scrollbar.trough -children { + Scrollbar.uparrow -side top + Scrollbar.downarrow -side bottom + Scrollbar.uparrow -side bottom + Vertical.Scrollbar.thumb -side top -expand true -sticky ns + } + } + + style layout Horizontal.TScrollbar { + Scrollbar.background + Scrollbar.trough -children { + Scrollbar.leftarrow -side left + Scrollbar.rightarrow -side right + Scrollbar.leftarrow -side right + Horizontal.Scrollbar.thumb -side left -expand true -sticky we + } + } + + style default TScrollbar -width 16 + + style element create Horizontal.Scrollbar.thumb image $I(hsb-n) \ + -border {6 4} -width 15 -height 16 -sticky news \ + -map [list {pressed !disabled} $I(hsb-p)] + + style element create Vertical.Scrollbar.thumb image $I(vsb-n) \ + -border {4 6} -width 16 -height 15 -sticky news \ + -map [list {pressed !disabled} $I(vsb-p)] + + style element create Scale.slider image $I(hslider-n) \ + -border 3 + + style element create Vertical.Scale.slider image $I(vslider-n) \ + -border 3 + + style element create Horizontal.Progress.bar image $I(hsb-n) \ + -border {6 4} + + style element create Vertical.Progress.bar image $I(vsb-n) \ + -border {4 6} + + style element create uparrow image $I(arrowup-n) \ + -map [list {pressed !disabled} $I(arrowup-p)] + + style element create downarrow image $I(arrowdown-n) \ + -map [list {pressed !disabled} $I(arrowdown-p)] + + style element create rightarrow image $I(arrowright-n) \ + -map [list {pressed !disabled} $I(arrowright-p)] + + style element create leftarrow image $I(arrowleft-n) \ + -map [list {pressed !disabled} $I(arrowleft-p)] + + # ----------------------------------------------------------------- + # Notebook elements + # + style element create tab image $I(tab-n) \ + -map [list selected $I(tab-p) active $I(tab-p)] \ + -border {6 6 6 2} -height 12 + + ## Labelframes. + # + style default TLabelframe -borderwidth 2 -relief groove + } +} + +package provide tile::theme::keramik $::tile::theme::keramik::version diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gif Binary files differnew file mode 100644 index 0000000..2d84f29 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gif Binary files differnew file mode 100644 index 0000000..52ee752 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gif Binary files differnew file mode 100644 index 0000000..ff309c5 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gif Binary files differnew file mode 100644 index 0000000..2159f27 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gif Binary files differnew file mode 100644 index 0000000..905fa7e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gif Binary files differnew file mode 100644 index 0000000..0323332 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gif Binary files differnew file mode 100644 index 0000000..20dcadb --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gif Binary files differnew file mode 100644 index 0000000..129169e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-d.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-d.gif Binary files differnew file mode 100644 index 0000000..fe9bf98 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-d.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-h.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-h.gif Binary files differnew file mode 100644 index 0000000..210734d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-h.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-n.gif Binary files differnew file mode 100644 index 0000000..5e1eafa --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-p.gif Binary files differnew file mode 100644 index 0000000..bfd7488 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-s.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-s.gif Binary files differnew file mode 100644 index 0000000..1095ed7 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-s.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-c.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-c.gif Binary files differnew file mode 100644 index 0000000..06e8795 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-c.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-u.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-u.gif Binary files differnew file mode 100644 index 0000000..3c02fcb --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-u.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gif Binary files differnew file mode 100644 index 0000000..1d93973 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gif Binary files differnew file mode 100644 index 0000000..18fbae0 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gif Binary files differnew file mode 100644 index 0000000..334e8e4 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gif Binary files differnew file mode 100644 index 0000000..2e2f1c2 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gif Binary files differnew file mode 100644 index 0000000..48197cb --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gif Binary files differnew file mode 100644 index 0000000..4a294b4 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gif Binary files differnew file mode 100644 index 0000000..65c0e4e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gif Binary files differnew file mode 100644 index 0000000..c8257c9 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gif Binary files differnew file mode 100644 index 0000000..215a738 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gif Binary files differnew file mode 100644 index 0000000..03099a9 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gif Binary files differnew file mode 100644 index 0000000..abec6ab --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gif Binary files differnew file mode 100644 index 0000000..2c223ba --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gif Binary files differnew file mode 100644 index 0000000..77ef8a2 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gif Binary files differnew file mode 100644 index 0000000..3179b87 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gif Binary files differnew file mode 100644 index 0000000..be01e4a --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gif Binary files differnew file mode 100644 index 0000000..0bb39e9 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gif Binary files differnew file mode 100644 index 0000000..cf03d7f --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl new file mode 100644 index 0000000..e9e3dc2 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl @@ -0,0 +1,15 @@ +# pkgIndex.tcl for additional tile pixmap themes. +# +# We don't provide the package is the image subdirectory isn't present, +# or we don't have the right version of Tcl/Tk +# +# To use this automatically within tile, the tile-using application should +# use tile::availableThemes and tile::setTheme +# +# $Id: pkgIndex.tcl 31689 2011-05-22 09:26:02Z nobu $ + +if {![file isdirectory [file join $dir keramik]]} { return } +if {![package vsatisfies [package provide Tcl] 8.4]} { return } + +package ifneeded tile::theme::keramik 0.3.2 \ + [list source [file join $dir keramik.tcl]] diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc.rb b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc.rb new file mode 100644 index 0000000..72a7c69 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc.rb @@ -0,0 +1,226 @@ +# +# kroc.rb +# +# based on: +# >> kroc.tcl - Copyright (C) 2004 David Zolli <kroc@kroc.tk> +# + +imgdir = File.join(File.dirname(__FILE__), 'kroc', 'kroc') +$images = Tk::Tile.load_images(imgdir, '*.gif') + +if TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0 + $TNotebook_Tab = Tk::Tile::TNotebook.style('Tab') +else + $TNotebook_Tab = 'Tab.TNotebook' +end + +def kroc_rb_settings + # Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F', + # :troughcolor=>'#F8C278', :borderwidth=>1) + # or + # Tk::Tile::Style.default(Tk.root, :background=>'#FCB64F', + # :troughcolor=>'#F8C278', :borderwidth=>1) + # or + # Tk::Tile::Style.default('.', :background=>'#FCB64F', + # :troughcolor=>'#F8C278', :borderwidth=>1) + # or + # Tk::Tile::Style.default(nil, :background=>'#FCB64F', + # :troughcolor=>'#F8C278', :borderwidth=>1) + # or + Tk::Tile::Style.default(:background=>'#FCB64F', :troughcolor=>'#F8C278', + :borderwidth=>1) + # Tk::Tile::Style.default(TkRoot, :font=>Tk::Tile::Font::Default, + # :borderwidth=>1) + # or + # Tk::Tile::Style.default(Tk.root, :font=>Tk::Tile::Font::Default, + # :borderwidth=>1) + # or + # Tk::Tile::Style.default('.', :font=>Tk::Tile::Font::Default, + # :borderwidth=>1) + # or + # Tk::Tile::Style.default(nil, :font=>Tk::Tile::Font::Default, + # :borderwidth=>1) + # or + Tk::Tile::Style.default(:font=>Tk::Tile::Font::Default, :borderwidth=>1) + + # Tk::Tile::Style.map(TkRoot, :background=>[:active, '#694418']) + # or + # Tk::Tile::Style.map(Tk.root, :background=>[:active, '#694418']) + # or + # Tk::Tile::Style.map('.', :background=>[:active, '#694418']) + # or + # Tk::Tile::Style.map(nil, :background=>[:active, '#694418']) + # or + Tk::Tile::Style.map(:background=>[:active, '#694418']) + Tk::Tile::Style.map(:foreground=>[:disabled, '#B2B2B2', :active, '#FFE7CB']) + + # Tk::Tile::Style.default('TButton', :padding=>[10,4]) + Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4]) + + # Tk::Tile::Style.default('TNotebook.Tab', + Tk::Tile::Style.default($TNotebook_Tab, + :padding=>[10, 3], :font=>Tk::Tile::Font::Default) + # Tk::Tile::Style.map('TNotebook.Tab', + Tk::Tile::Style.map($TNotebook_Tab, + :background=>[:selected, '#FCB64F', '', '#FFE6BA'], + :foreground=>['', 'black'], + :padding=>[:selected, [10, 6, 10, 3]]) + + # Tk::Tile::Style.map('TScrollbar', + Tk::Tile::Style.map(Tk::Tile::TScrollbar, + :background=>[:pressed, '#694418'], + :arrowcolor=>[:pressed, '#FEF7CB'], + :relief=>[:pressed, :sunken]) + + # Tk::Tile::Style.layout('Vertical.TScrollbar', + Tk::Tile::Style.layout(Tk::Tile.style('Vertical', Tk::Tile::TScrollbar), + ['Scrollbar.trough', {:children=>[ + 'Scrollbar.uparrow', {:side=>:top}, + 'Scrollbar.downarrow', {:side=>:bottom}, + 'Scrollbar.uparrow', {:side=>:bottom}, + 'Scrollbar.thumb', {:side=>:top, :expand=>true} + ]} + ]) + + # Tk::Tile::Style.layout('Horizontal.TScrollbar', + Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', Tk::Tile::TScrollbar), + ['Scrollbar.trough', {:children=>[ + 'Scrollbar.leftarrow', {:side=>:left}, + 'Scrollbar.rightarrow', {:side=>:right}, + 'Scrollbar.leftarrow', {:side=>:right}, + 'Scrollbar.thumb', {:side=>:left, :expand=>true} + ]} + ]) + + # + # Elements: + # + if Tk::Tile::TILE_SPEC_VERSION_ID >= 8 + Tk::Tile::Style.element_create('Button.button', + :image, + [ $images['button-n'], + :pressed, $images['button-p'], + :active, $images['button-h'], + ], :border=>3, :sticky=>:ew) + + Tk::Tile::Style.element_create('Checkbutton.indicator', + :image, + [ $images['check-nu'], + [:pressed, :selected],$images['check-nc'], + :pressed, $images['check-nu'], + [:active, :selected], $images['check-hc'], + :active, $images['check-hu'], + :selected, $images['check-nc'], + ], :sticky=>:w) + + Tk::Tile::Style.element_create('Radiobutton.indicator', + :image, + [ $images['radio-nu'], + [:pressed,:selected],$images['radio-nc'], + :pressed, $images['radio-nu'], + [:active,:selected], $images['radio-hc'], + :active, $images['radio-hu'], + :selected, $images['radio-nc'], + ], :sticky=>:w) + + elsif TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0 + Tk::Tile::Style.element_create('Button.button', + :image, $images['button-n'], + :map=>[ + :pressed, $images['button-p'], + :active, $images['button-h'], + ], :border=>3, :sticky=>:ew) + + Tk::Tile::Style.element_create('Checkbutton.indicator', + :image, $images['check-nu'], + :map=>[ + [:pressed, :selected],$images['check-nc'], + :pressed, $images['check-nu'], + [:active, :selected], $images['check-hc'], + :active, $images['check-hu'], + :selected, $images['check-nc'], + ], :sticky=>:w) + + Tk::Tile::Style.element_create('Radiobutton.indicator', + :image, $images['radio-nu'], + :map=>[ + [:pressed, :selected],$images['radio-nc'], + :pressed, $images['radio-nu'], + [:active, :selected], $images['radio-hc'], + :active, $images['radio-hu'], + :selected, $images['radio-nc'], + ], :sticky=>:w) + + else # tile 0.4 or earlier + Tk::Tile::Style.element_create('Button.button', :pixmap, + :images=>[ + :pressed, $images['button-p'], + :active, $images['button-h'], + '', $images['button-n'] + ], :border=>3, :tiling=>:tile) + + Tk::Tile::Style.element_create('Checkbutton.indicator', :pixmap, + :images=>[ + [:pressed, :selected],$images['check-nc'], + :pressed, $images['check-nu'], + [:active, :selected], $images['check-hc'], + :active, $images['check-hu'], + :selected, $images['check-nc'], + '', $images['check-nu'], + ], :tiling=>:fixed) + + Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap, + :images=>[ + [:pressed, :selected],$images['radio-nc'], + :pressed, $images['radio-nu'], + [:active, :selected], $images['radio-hc'], + :active, $images['radio-hu'], + :selected, $images['radio-nc'], + '', $images['radio-nu'], + ], :tiling=>:fixed) + + end + + # + # Settings: + # + # Tk::Tile::Style.layout(Tk::Tile::TButton, + Tk::Tile::Style.layout('TButton', [ + 'Button.button', {:children=>[ + 'Button.focus', {:children=>[ + 'Button.padding', {:children=>[ + 'Button.label', {:expand=>true, :sticky=>''} + ]} + ]} + ]} + ]) + + # Tk::Tile::Style.layout(Tk::Tile::TCheckbutton, + Tk::Tile::Style.layout('TCheckbutton', [ + 'Checkbutton.background', # this is not needed in tile 0.5 or later + 'Checkbutton.border', {:children=>[ + 'Checkbutton.padding', {:children=>[ + 'Checkbutton.indicator', {:side=>:left}, + 'Checkbutton.focus', {:side=>:left, :children=>[ + 'Checkbutton.label' + ]} + ]} + ]} + ]) + + # Tk::Tile::Style.layout(Tk::Tile::TRadiobutton, + Tk::Tile::Style.layout('TRadiobutton', [ + 'Radiobutton.background', # this is not needed in tile 0.5 or later + 'Radiobutton.border', {:children=>[ + 'Radiobutton.padding', {:children=>[ + 'Radiobutton.indicator', {:side=>:left}, + 'Radiobutton.focus', {:expand=>true, :sticky=>:w, :children=>[ + 'Radiobutton.label', {:side=>:right, :expand=>true} + ]} + ]} + ]} + ]) +end + +Tk::Tile::Style.theme_create('kroc-rb', :parent=>'alt', + :settings=>proc{ kroc_rb_settings() }) diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc.tcl new file mode 100644 index 0000000..b2cd796 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc.tcl @@ -0,0 +1,163 @@ +# kroc.tcl - Copyright (C) 2004 David Zolli <kroc@kroc.tk> +# +# A sample pixmap theme for the tile package. + +#package require tile::pixmap + +namespace eval tile { + namespace eval kroc { + variable version 0.0.1 + } +} + +namespace eval tile::kroc { + + set imgdir [file join [file dirname [info script]] kroc] + array set Images [tile::LoadImages $imgdir *.gif] + + if {[package vsatisfies [package provide tile] 0.5]} { + set TNoteBook_Tab TNotebook.Tab + } else { + set TNoteBook_Tab Tab.TNotebook + } + + style theme create kroc -parent alt -settings { + + style default . -background #FCB64F -troughcolor #F8C278 -borderwidth 1 + style default . -font TkDefaultFont -borderwidth 1 + style map . -background [list active #694418] + style map . -foreground [list disabled #B2B2B2 active #FFE7CB] + + style default TButton -padding "10 4" + + style default $TNoteBook_Tab -padding {10 3} -font TkDefaultFont + style map $TNoteBook_Tab \ + -background [list selected #FCB64F {} #FFE6BA] \ + -foreground [list {} black] \ + -padding [list selected {10 6 10 3}] + + style map TScrollbar \ + -background { pressed #694418} \ + -arrowcolor { pressed #FFE7CB } \ + -relief { pressed sunken } \ + ; + + style layout Vertical.TScrollbar { + Scrollbar.trough -children { + Scrollbar.uparrow -side top + Scrollbar.downarrow -side bottom + Scrollbar.uparrow -side bottom + Scrollbar.thumb -side top -expand true + } + } + + style layout Horizontal.TScrollbar { + Scrollbar.trough -children { + Scrollbar.leftarrow -side left + Scrollbar.rightarrow -side right + Scrollbar.leftarrow -side right + Scrollbar.thumb -side left -expand true + } + } + + # + # Elements: + # + if {[package vsatisfies [package provide tile] 0.5]} { + + style element create Button.button image $Images(button-n) \ + -map [list \ + pressed $Images(button-p) \ + active $Images(button-h) \ + ] -border 3 -sticky ew + + style element create Checkbutton.indicator image $Images(check-nu) \ + -map [list \ + {pressed selected} $Images(check-nc) \ + pressed $Images(check-nu) \ + {active selected} $Images(check-hc) \ + active $Images(check-hu) \ + selected $Images(check-nc) \ + ] -sticky w + + style element create Radiobutton.indicator image $Images(radio-nu) \ + -map [list \ + {pressed selected} $Images(radio-nc) \ + pressed $Images(radio-nu) \ + {active selected} $Images(radio-hc) \ + active $Images(radio-hu) \ + selected $Images(radio-nc) \ + ] -sticky w + + } else { + + style element create Button.button pixmap -images [list \ + pressed $Images(button-p) \ + active $Images(button-h) \ + {} $Images(button-n) \ + ] -border 3 -tiling tile + + style element create Checkbutton.indicator pixmap -images [list \ + {pressed selected} $Images(check-nc) \ + pressed $Images(check-nu) \ + {active selected} $Images(check-hc) \ + active $Images(check-hu) \ + selected $Images(check-nc) \ + {} $Images(check-nu) \ + ] -tiling fixed + + style element create Radiobutton.indicator pixmap -images [list \ + {pressed selected} $Images(radio-nc) \ + pressed $Images(radio-nu) \ + {active selected} $Images(radio-hc) \ + active $Images(radio-hu) \ + selected $Images(radio-nc) \ + {} $Images(radio-nu) \ + ] -tiling fixed + + } + + # + # Settings: (*button.background is not needed in tile 0.5 or above) + # + style layout TButton { + Button.button -children { + Button.focus -children { + Button.padding -children { + Button.label -expand true -sticky {} + } + } + } + } + + style layout TCheckbutton { + Checkbutton.border -children { + Checkbutton.background + Checkbutton.padding -children { + Checkbutton.indicator -side left + Checkbutton.focus -side left -children { + Checkbutton.label + } + } + } + } + + style layout TRadiobutton { + Radiobutton.border -children { + Radiobutton.background + Radiobutton.padding -children { + Radiobutton.indicator -side left + Radiobutton.focus -expand true -sticky w -children { + Radiobutton.label -side right -expand true + } + } + } + } + + } } + +# ------------------------------------------------------------------------- + +package provide tile::theme::kroc $::tile::kroc::version + +# ------------------------------------------------------------------------- diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif Binary files differnew file mode 100644 index 0000000..e7a140d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif Binary files differnew file mode 100644 index 0000000..78b506d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif Binary files differnew file mode 100644 index 0000000..a5a4e90 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif Binary files differnew file mode 100644 index 0000000..41503c5 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif Binary files differnew file mode 100644 index 0000000..b3e512c --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif Binary files differnew file mode 100644 index 0000000..a28c288 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif Binary files differnew file mode 100644 index 0000000..5c23931 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif Binary files differnew file mode 100644 index 0000000..359fe1c --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif Binary files differnew file mode 100644 index 0000000..9f46b37 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif Binary files differnew file mode 100644 index 0000000..6437f33 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif Binary files differnew file mode 100644 index 0000000..2d2aac8 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl new file mode 100644 index 0000000..95c3d57 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl @@ -0,0 +1,15 @@ +# pkgIndex.tcl for additional tile pixmap themes. +# +# We don't provide the package is the image subdirectory isn't present, +# or we don't have the right version of Tcl/Tk +# +# To use this automatically within tile, the tile-using application should +# use tile::availableThemes and tile::setTheme +# +# $Id: pkgIndex.tcl 31689 2011-05-22 09:26:02Z nobu $ + +if {![file isdirectory [file join $dir kroc]]} { return } +if {![package vsatisfies [package provide Tcl] 8.4]} { return } + +package ifneeded tile::theme::kroc 0.0.1 \ + [list source [file join $dir kroc.tcl]] diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl new file mode 100644 index 0000000..4441b79 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl @@ -0,0 +1,16 @@ +# pkgIndex.tcl for additional tile pixmap themes. +# +# We don't provide the package is the image subdirectory isn't present, +# or we don't have the right version of Tcl/Tk +# +# To use this automatically within tile, the tile-using application should +# use tile::availableThemes and tile::setTheme +# +# $Id: pkgIndex.tcl 31689 2011-05-22 09:26:02Z nobu $ + +if {![file isdirectory [file join $dir plastik]]} { return } +if {![package vsatisfies [package provide Tcl] 8.4]} { return } + +package ifneeded tile::theme::plastik 0.3.1 \ + [list source [file join $dir plastik.tcl]] + diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik.tcl new file mode 100644 index 0000000..cba5ebd --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik.tcl @@ -0,0 +1,125 @@ +# plastik.tcl - Copyright (C) 2004 Googie +# +# A sample pixmap theme for the tile package. +# +# Copyright (c) 2004 Googie +# Copyright (c) 2005 Pat Thoyts <patthoyts@users.sourceforge.net> +# +# $Id: plastik.tcl 25189 2009-10-02 12:04:37Z akr $ + +package require Tk 8.4 +package require tile 0.5 + +namespace eval tile::theme::plastik { + + variable version 0.3.1 + package provide tile::theme::plastik $version + + variable imgdir [file join [file dirname [info script]] plastik] + variable Images; + array set Images [tile::LoadImages $imgdir *.gif] + + variable colors + array set colors { + -frame "#cccccc" + -disabledfg "#aaaaaa" + -selectbg "#657a9e" + -selectfg "#ffffff" + } + +style theme create plastik -parent default -settings { + style default . \ + -background $colors(-frame) \ + -troughcolor $colors(-frame) \ + -selectbackground $colors(-selectbg) \ + -selectforeground $colors(-selectfg) \ + -font TkDefaultFont \ + -borderwidth 1 \ + ; + + style map . -foreground [list disabled $colors(-disabledfg)] + + # + # Layouts: + # + style layout Vertical.TScrollbar { + Scrollbar.background + Scrollbar.trough -children { + Scrollbar.uparrow -side top + Scrollbar.downarrow -side bottom + Scrollbar.uparrow -side bottom + Vertical.Scrollbar.thumb -side top -expand true -sticky ns + } + } + + style layout Horizontal.TScrollbar { + Scrollbar.background + Scrollbar.trough -children { + Scrollbar.leftarrow -side left + Scrollbar.rightarrow -side right + Scrollbar.leftarrow -side right + Horizontal.Scrollbar.thumb -side left -expand true -sticky we + } + } + + style layout TButton { + Button.button -children { + Button.focus -children { + Button.padding -children { + Button.label -side left -expand true + } + } + } + } + + # + # Elements: + # + style element create Button.button image $Images(button-n) \ + -border 4 -sticky ew \ + -map [list pressed $Images(button-p) active $Images(button-h)] + + style element create Checkbutton.indicator image $Images(check-nu) \ + -sticky {} -map [list \ + {active selected} $Images(check-hc) \ + {pressed selected} $Images(check-pc) \ + active $Images(check-hu) \ + selected $Images(check-nc) \ + ] + + style element create Radiobutton.indicator image $Images(radio-nu) \ + -sticky {} -map [list \ + {active selected} $Images(radio-hc) \ + {pressed selected} $Images(radio-pc) \ + active $Images(radio-hu) \ + selected $Images(radio-nc) \ + ] + + style element create Horizontal.Scrollbar.thumb \ + image $Images(hsb-n) -border 3 -sticky ew + style element create Vertical.Scrollbar.thumb \ + image $Images(vsb-n) -border 3 -sticky ns + + style element create Scale.slider \ + image $Images(hslider-n) -sticky {} + style element create Vertical.Scale.slider \ + image $Images(vslider-n) -sticky {} + + style element create Scrollbar.uparrow image $Images(arrowup-n) \ + -map [list pressed $Images(arrowup-p)] -sticky {} + style element create Scrollbar.downarrow image $Images(arrowdown-n) \ + -map [list pressed $Images(arrowdown-p)] -sticky {} + style element create Scrollbar.leftarrow image $Images(arrowleft-n) \ + -map [list pressed $Images(arrowleft-p)] -sticky {} + style element create Scrollbar.rightarrow image $Images(arrowright-n) \ + -map [list pressed $Images(arrowright-p)] -sticky {} + + # + # Settings: + # + style default TButton -width -10 + style default TNotebook.Tab -padding {6 2 6 2} + style default TLabelframe -borderwidth 2 -relief groove + +} } + diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gif Binary files differnew file mode 100644 index 0000000..d914e7a --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gif Binary files differnew file mode 100644 index 0000000..abffaa4 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gif Binary files differnew file mode 100644 index 0000000..9939ae1 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gif Binary files differnew file mode 100644 index 0000000..1a45ef2 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gif Binary files differnew file mode 100644 index 0000000..f4b563f --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gif Binary files differnew file mode 100644 index 0000000..5459d5e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gif Binary files differnew file mode 100644 index 0000000..118290c --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gif Binary files differnew file mode 100644 index 0000000..89f9b38 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-h.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-h.gif Binary files differnew file mode 100644 index 0000000..548f376 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-h.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-n.gif Binary files differnew file mode 100644 index 0000000..49a2590 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-p.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-p.gif Binary files differnew file mode 100644 index 0000000..e83f7ed --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-p.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gif Binary files differnew file mode 100644 index 0000000..b279fa5 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gif Binary files differnew file mode 100644 index 0000000..5b4fb4f --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gif Binary files differnew file mode 100644 index 0000000..b139e02 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gif Binary files differnew file mode 100644 index 0000000..fbe391f --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gif Binary files differnew file mode 100644 index 0000000..75a3bd6 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gif Binary files differnew file mode 100644 index 0000000..b8ea07e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gif Binary files differnew file mode 100644 index 0000000..ce8f284 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gif Binary files differnew file mode 100644 index 0000000..3391771 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gif Binary files differnew file mode 100644 index 0000000..88925d0 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gif Binary files differnew file mode 100644 index 0000000..f8723d3 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gif Binary files differnew file mode 100644 index 0000000..fb5140e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gif Binary files differnew file mode 100644 index 0000000..176225d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gif Binary files differnew file mode 100644 index 0000000..85bac45 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gif b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gif Binary files differnew file mode 100644 index 0000000..cf887f9 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/tile/toolbutton.tcl b/jni/ruby/ext/tk/sample/tkextlib/tile/toolbutton.tcl new file mode 100644 index 0000000..a8d9080 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/tile/toolbutton.tcl @@ -0,0 +1,152 @@ +# +# $Id: toolbutton.tcl 31689 2011-05-22 09:26:02Z nobu $ +# +# Demonstration of custom widget styles. +# + +# +# ~ BACKGROUND +# +# Checkbuttons in toolbars have a very different appearance +# than regular checkbuttons: there's no indicator, they +# "pop up" when the mouse is over them, and they appear sunken +# when selected. +# +# Tk added partial support for toolbar-style buttons in 8.4 +# with the "-overrelief" option, and TIP #82 added further +# support with the "-offrelief" option. So to get a toolbar-style +# checkbutton, you can configure it with: +# +# checkbutton .cb \ +# -indicatoron false -selectcolor {} -relief flat -overrelief raised +# +# Behind the scenes, Tk has a lot of rather complicated logic +# to implement this checkbutton style; see library/button.tcl, +# generic/tkButton.c, and the platform-specific files unix/tkUnixButton.c +# et al. for the full details. +# +# The tile widget set has a better way: custom styles. +# Since the appearance is completely controlled by the theme engine, +# we can define a new "Toolbutton" style and just use: +# +# checkbutton .cb -style Toolbutton +# +# +# ~ DEMONSTRATION +# +# The tile built-in themes (default, "alt", windows, and XP) +# already include Toolbutton styles. This script will add +# them to the "step" and "blue" themes as a demonstration. +# +# (Note: Pushbuttons and radiobuttons can also use the "Toolbutton" +# style; see demo.tcl.) +# + +style theme settings "step" { + +# +# First, we use [style layout] to define what elements to +# use and how they're arranged. Toolbuttons are pretty +# simple, consisting of a border, some internal padding, +# and a label. (See also the TScrollbar layout definition +# in demos/blue.tcl for a more complicated layout spec.) +# + style layout Toolbutton { + Toolbutton.background + Toolbutton.border -children { + Toolbutton.padding -children { + Toolbutton.label + } + } + } + +# (Actually the above isn't strictly necessary, since the same layout +# is defined in the default theme; we could have inherited it +# instead.) +# +# Next, specify default values for element options. +# For many options (like -background), the defaults +# inherited from the parent style are sufficient. +# + style default Toolbutton -width 0 -padding 1 -relief flat -borderwidth 2 + +# +# Finally, use [style map] to specify state-specific +# resource values. We want a flat relief if the widget is +# disabled, sunken if it's selected (on) or pressed, +# and raised when it's active (the mouse pointer is +# over the widget). Each state-value pair is checked +# in order, and the first matching state takes precedence. +# + style map Toolbutton -relief { + disabled flat + selected sunken + pressed sunken + active raised + } +} + +# +# Now for the "blue" theme. (Since the purpose of this +# theme is to show what *can* be done, not necessarily what +# *should* be done, the following makes some questionable +# design decisions from an aesthetic standpoint.) +# +if {![catch {package require tile::theme::blue}]} { +style theme settings "blue" { + + # + # Default values: + # + style default Toolbutton \ + -width 0 -relief flat -borderwidth 2 \ + -background #6699CC -foreground #000000 ; + + # + # Configure state-specific values for -relief, as before: + # + style map Toolbutton -relief { + disabled flat + selected sunken + pressed sunken + active raised + } + + # + # Adjust the -padding at the same time, to enhance + # the raised/sunken illusion: + # + style default Toolbutton -padding 4 + style map Toolbutton -padding { + disabled {4} + selected {6 6 2 2} + pressed {6 6 2 2} + active {2 2 6 6} + } + + # + # ... and change the foreground and background colors + # when the mouse cursor is over the widget: + # + style map Toolbutton -background { + active #008800 + } -foreground { + active #FFFFFF + } +} + +} + +# +# ~ A final note: +# +# TIP #82 also says: "When -indicatoron is off and the button itself +# is on, the relief continues to be hard-coded to sunken. For symmetry, +# we might consider adding another -onrelief option to cover this +# case. But it is difficult to imagine ever wanting to change the +# value of -onrelief so it has been omitted from this TIP. +# If there as strong desire to have -onrelief, it can be added later." +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# The Tile project aims to make sure that this never needs to happen. +# |