diff options
author | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-16 18:49:26 +0900 |
---|---|---|
committer | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-30 00:39:06 +0900 |
commit | fcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch) | |
tree | 64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/ext/tk/sample/tkextlib/iwidgets |
Fresh start
Diffstat (limited to 'jni/ruby/ext/tk/sample/tkextlib/iwidgets')
80 files changed, 1506 insertions, 0 deletions
diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt new file mode 100644 index 0000000..8392da7 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt @@ -0,0 +1,42 @@ + + ####################################################################### + ### The following text is the original 'license.terms' of iwidgets ### + ### extension. ### + ### Original Tcl source files are not include in this directory, ### + ### because of all of them are rewritten to Ruby files. ### + ### However, the image data files in the 'images' directory are ### + ### quoted from iwidgets source archive. ### + ####################################################################### + + +This software is copyrighted by DSC Technologies and private individual +contributors. The copyright holder is specifically listed in the header +of each file. The following terms apply to all files associated with the +software unless explicitly disclaimed in individual files by private +contributors. + +Copyright 1997 DSC Technologies Corporation + +Permission to use, copy, modify, distribute and license this software and +its documentation for any purpose, and without fee or written agreement +with DSC, is hereby granted, provided that the above copyright notice +appears in all copies and that both the copyright notice and warranty +disclaimer below appear in supporting documentation, and that the names of +DSC Technologies Corporation or DSC Communications Corporation not be used +in advertising or publicity pertaining to the software without specific, +written prior permission. + +DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-INFRINGEMENT. +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND +DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, +ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL DSC BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +RESTRICTED RIGHTS: Use, duplication or disclosure by the government +is subject to the restrictions as set forth in subparagraph (c) (1) (ii) +of the Rights in Technical Data and Computer Software Clause as DFARS +252.227-7013 and FAR 52.227-19. diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/box.xbm b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/box.xbm new file mode 100644 index 0000000..7498e15 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/box.xbm @@ -0,0 +1,14 @@ +#define Tool_32_box_width 32 +#define Tool_32_box_height 32 +static unsigned char Tool_32_box_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x0f, 0x20, 0x00, 0x00, 0x08, + 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, + 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, + 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, + 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, + 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, + 0xe0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/clear.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/clear.gif Binary files differnew file mode 100644 index 0000000..bd45628 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/clear.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/close.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/close.gif Binary files differnew file mode 100644 index 0000000..f91b9e9 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/close.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/copy.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/copy.gif Binary files differnew file mode 100644 index 0000000..7319f1d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/copy.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/cut.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/cut.gif Binary files differnew file mode 100644 index 0000000..4258b17 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/cut.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/exit.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/exit.gif Binary files differnew file mode 100644 index 0000000..e462be0 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/exit.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/find.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/find.gif Binary files differnew file mode 100644 index 0000000..dddcb80 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/find.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/help.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/help.gif Binary files differnew file mode 100644 index 0000000..bc8f18c --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/help.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/line.xbm b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/line.xbm new file mode 100644 index 0000000..4622ae9 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/line.xbm @@ -0,0 +1,14 @@ +#define lineOp_width 32 +#define lineOp_height 32 +static unsigned char lineOp_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, + 0x80, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, + 0x00, 0x3c, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, + 0x00, 0xe0, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3c, 0x00, + 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xe0, 0x01, + 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/mag.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/mag.gif Binary files differnew file mode 100644 index 0000000..4a5be66 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/mag.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/new.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/new.gif Binary files differnew file mode 100644 index 0000000..9c68ad3 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/new.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/open.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/open.gif Binary files differnew file mode 100644 index 0000000..bed862c --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/open.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/oval.xbm b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/oval.xbm new file mode 100644 index 0000000..856bd43 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/oval.xbm @@ -0,0 +1,14 @@ +#define ovalOp_width 32 +#define ovalOp_height 32 +static unsigned char ovalOp_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, + 0x00, 0x1c, 0x70, 0x00, 0x00, 0x03, 0x80, 0x01, 0x80, 0x00, 0x00, 0x02, + 0x40, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x10, + 0x10, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, + 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x10, + 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x04, + 0x80, 0x00, 0x00, 0x02, 0x00, 0x03, 0x80, 0x01, 0x00, 0x1c, 0x70, 0x00, + 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/paste.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/paste.gif Binary files differnew file mode 100644 index 0000000..9974f23 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/paste.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/points.xbm b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/points.xbm new file mode 100644 index 0000000..c50aa4c --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/points.xbm @@ -0,0 +1,14 @@ +#define dotPencilOp_width 32 +#define dotPencilOp_height 32 +static unsigned char dotPencilOp_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x12, 0x00, + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x80, 0x04, 0x00, + 0x00, 0x80, 0x04, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x20, 0x01, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, + 0x00, 0x90, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, + 0x00, 0x24, 0x00, 0x18, 0x00, 0x24, 0x00, 0x18, 0x00, 0x12, 0x00, 0x00, + 0x00, 0x12, 0x00, 0x30, 0x00, 0x0e, 0x00, 0x30, 0x00, 0x06, 0x00, 0x00, + 0x00, 0x06, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x30, 0xa0, 0x01, + 0x00, 0x60, 0xb0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/poly.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/poly.gif Binary files differnew file mode 100644 index 0000000..2b595bb --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/poly.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/print.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/print.gif Binary files differnew file mode 100644 index 0000000..d321f17 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/print.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/ruler.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/ruler.gif Binary files differnew file mode 100644 index 0000000..00d26fe --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/ruler.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/save.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/save.gif Binary files differnew file mode 100644 index 0000000..d1ceb1a --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/save.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/select.gif b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/select.gif Binary files differnew file mode 100644 index 0000000..f885c9c --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/select.gif diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/text.xbm b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/text.xbm new file mode 100644 index 0000000..ffb0686 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/text.xbm @@ -0,0 +1,14 @@ +#define font_edit_width 32 +#define font_edit_height 32 +static unsigned char font_edit_bits[] = { + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1c, + 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x80, 0x7b, + 0x00, 0x00, 0x80, 0x7e, 0x00, 0x00, 0xc0, 0xfd, 0x00, 0x00, 0x60, 0xfb, + 0x00, 0x00, 0xb0, 0xf7, 0x00, 0x00, 0xd0, 0xef, 0x00, 0x00, 0xf8, 0xdf, + 0x00, 0x00, 0xd4, 0x7f, 0x00, 0x00, 0xaa, 0x1f, 0x00, 0x00, 0x15, 0x0f, + 0x00, 0x80, 0x82, 0x06, 0x03, 0x40, 0x01, 0x01, 0x07, 0xa0, 0x80, 0x00, + 0x0f, 0x10, 0x40, 0x00, 0x1f, 0x08, 0x20, 0x00, 0x3b, 0xe4, 0x1f, 0x00, + 0x73, 0x1a, 0x00, 0x00, 0xe3, 0x07, 0x00, 0x00, 0xc3, 0x01, 0x00, 0x00, + 0xe3, 0x03, 0x00, 0x00, 0x7b, 0x07, 0x00, 0x00, 0x1f, 0x06, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb new file mode 100644 index 0000000..2b7cd45 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +# sample 1 +p bb1 = Tk::Iwidgets::Buttonbox.new +p bb1.add('Yes', :text=>'Yes', :command=>proc{puts 'Yes'}) +p bb1.add('No', :text=>'No', :command=>proc{puts 'No'}) +p bb1.add('Maybe', :text=>'Maybe', :command=>proc{puts 'Maybe'}) +bb1.default('Yes') +bb1.pack(:expand=>true, :fill=>:both, :pady=>5) +print "\n" + +# sample 2 +p bb2 = Tk::Iwidgets::Buttonbox.new +p btn1 = bb2.add(:text=>'Yes', :command=>proc{puts 'Yes'}) +p btn2 = bb2.add(:text=>'No', :command=>proc{puts 'No'}) +p btn3 = bb2.add(:text=>'Maybe', :command=>proc{puts 'Maybe'}) +bb2.default(btn1) +bb2.pack(:expand=>true, :fill=>:both, :pady=>5) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb new file mode 100644 index 0000000..bb09b4d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Calendar.new(:command=>proc{|arg| puts(arg.date)}, + :weekendbackground=>'mistyrose', + :weekdaybackground=>'ghostwhite', + :outline=>'black', :startday=>'wednesday', + :days=>%w(We Th Fr Sa Su Mo Tu)).pack +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb new file mode 100644 index 0000000..c7c0430 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Canvasprintbox.new(:orient=>:landscape, :stretch=>1) \ + .pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb new file mode 100644 index 0000000..ea8d63e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Canvasprintdialog.new.activate + +Tk.mainloop + diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb new file mode 100644 index 0000000..bae0eba --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +cb = Tk::Iwidgets::Checkbox.new +cb.add('bold', :text=>'Bold') +cb.add('italic', :text=>'Italic') +cb.add('underline', :text=>'Underline') +cb.select('underline') +cb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb new file mode 100644 index 0000000..3684753 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +# +# Non-editable Dropdown Combobox +# +cb1 = Tk::Iwidgets::Combobox.new(:labeltext=>'Month:', + :selectioncommand=>proc{ + puts(cb1.get_curselection) + }, + :editable=>false, :listheight=>185, + :popupcursor=>'hand1') + +cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec)) + + +# +# Editable Dropdown Combobox +# +cb2 = Tk::Iwidgets::Combobox.new(:labeltext=>'Operating System:', + :selectioncommand=>proc{ + puts(cb2.get_curselection) + }) + +cb2.insert_list('end', *%w(Linux HP-UX SunOS Solaris Irix)) +cb2.insert_entry('end', 'L') + +cb1.pack(:padx=>10, :pady=>10, :fill=>:x) +cb2.pack(:padx=>10, :pady=>10, :fill=>:x) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb new file mode 100644 index 0000000..5727879 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Dateentry.new.pack + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb new file mode 100644 index 0000000..12d4982 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +df = Tk::Iwidgets::Datefield.new(:command=>proc{puts(df.get)}) +df.pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb new file mode 100644 index 0000000..3449cd4 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Thread.new{Tk.mainloop} + +d = Tk::Iwidgets::Dialog.new(:modality=>:application) + +d.buttonconfigure('OK', :command=>proc{puts 'OK'; d.deactivate true}) +d.buttonconfigure('Apply', :command=>proc{puts 'Apply'}) +d.buttonconfigure('Cancel', :command=>proc{puts 'Cancel'; d.deactivate false}) +d.buttonconfigure('Help', :command=>proc{puts 'Help'}) + +TkListbox.new(d.child_site, :relief=>:sunken).pack(:expand=>true, :fill=>:both) + +if TkComm.bool(d.activate) + puts "Exit via OK button" +else + puts "Exit via Cancel button" +end diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb new file mode 100644 index 0000000..00ee997 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +ds = Tk::Iwidgets::Dialogshell.new(:modality=>:none) + +ds.add('OK', :text=>'OK', :command=>proc{puts 'OK'; ds.deactivate}) +ds.add('Cancel', :text=>'Cancel', :command=>proc{puts 'Cancel'; ds.deactivate}) +ds.default('OK') + +TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, + :command=>proc{puts ds.activate}).pack(:padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb new file mode 100644 index 0000000..682c853 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +djl = Tk::Iwidgets::Disjointlistbox.new.pack(:fill=>:both, :expand=>true, + :padx=>10, :pady=>10) +djl.set_lhs(*[0,2,4,5]) +djl.set_rhs(3,6) + +djl.insert_lhs(1,7,8) +djl.insert_rhs(9) + +p djl.get_lhs +p djl.get_rhs + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb new file mode 100644 index 0000000..8563a08 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb @@ -0,0 +1,39 @@ +#!/usr/bin/env ruby +######################################################### +# +# use Tk::UTF8_String() for a utf8 charecter +# +######################################################### +require 'tk' +require 'tkextlib/iwidgets' + +TkOption.add('*textBackground', 'white') + +ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) + +fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', + :fixed=>10, :width=>12) + +nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', + :validate=>:numeric, :width=>12) + +aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', + :validate=>:alphabetic, :width=>12, + :invalid=>proc{ + puts "Alphabetic contents invalid" + }) + +pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, + :show=>Tk::UTF8_String("\267"), + ## <=== utf8 character + :command=>proc{puts "Return Pressed"}) + +Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef) + +ef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +fef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +nef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +aef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +pef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb new file mode 100644 index 0000000..d8ccdf8 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb @@ -0,0 +1,44 @@ +#!/usr/bin/env ruby +######################################################### +# +# set $KCODE to 'utf' for a utf8 charecter +# +######################################################### +unless defined?(::Encoding.default_external) + $KCODE='utf' +else + DEFAULT_TK_ENCODING = 'UTF-8' +end + +require 'tk' +require 'tkextlib/iwidgets' + +TkOption.add('*textBackground', 'white') + +ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) + +fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', + :fixed=>10, :width=>12) + +nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', + :validate=>:numeric, :width=>12) + +aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', + :validate=>:alphabetic, :width=>12, + :invalid=>proc{ + puts "Alphabetic contents invalid" + }) + +pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, + :show=>"\267", ## <=== utf8 character + :command=>proc{puts "Return Pressed"}) + +Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef) + +ef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +fef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +nef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +aef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +pef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb new file mode 100644 index 0000000..327f908 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb @@ -0,0 +1,40 @@ +#!/usr/bin/env ruby +######################################################### +# +# set Tk.encoding = 'utf-8' for a utf8 charecter +# +######################################################### +require 'tk' +require 'tkextlib/iwidgets' + +Tk.encoding = 'utf-8' + +TkOption.add('*textBackground', 'white') + +ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) + +fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', + :fixed=>10, :width=>12) + +nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', + :validate=>:numeric, :width=>12) + +aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', + :validate=>:alphabetic, :width=>12, + :invalid=>proc{ + puts "Alphabetic contents invalid" + }) + +pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, + :show=>"\267", ## <=== utf8 character + :command=>proc{puts "Return Pressed"}) + +Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef) + +ef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +fef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +nef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +aef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) +pef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb new file mode 100644 index 0000000..4944c72 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info', + :background=>'bisque', :activeforeground=>'red', + :bitmapforeground=>'blue', :defaultring=>true, + :command=>proc{ + puts "Bisque is beautiful" + }).pack(:expand=>true) + +#img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../../../images/earthris.gif')) +img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/clear.gif')) + +Tk::Iwidgets::Extbutton.new(:text=>'Image example', :relief=>:ridge, + :image=>img, :imagepos=>:e, :font=>'9x15bold', + :activebackground=>'lightyellow', + :background=>'lightgreen').pack(:expand=>true) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb new file mode 100644 index 0000000..63e4be2 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Extfileselectionbox.new.pack(:padx=>10, :pady=>10, + :fill=>:both, :expand=>true) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb new file mode 100644 index 0000000..c1a9b3d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mainloop = Thread.new{Tk.mainloop} + +# +# Non-modal example +# +nmfsd = Tk::Iwidgets::Extfileselectiondialog.new(:title=>'Non-Modal') +nmfsd.buttonconfigure('OK', :command=>proc{ + puts "You selected #{nmfsd.get}" + nmfsd.deactivate + }) +nmfsd.activate + +# +# Modal example +# +mfsd = Tk::Iwidgets::Extfileselectiondialog.new(:modality=>:application) +mfsd.center +if TkComm.bool(mfsd.activate) + puts "You selected #{mfsd.get}" +else + puts "You cancelled the dialog" +end + + +mainloop.join diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb new file mode 100644 index 0000000..7b87a02 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Feedback.new(:labeltext=>'Status', :steps=>20){|fb| + pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) + TkTimer.new(500, 20, proc{fb.step}).start(2500) +} + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb new file mode 100644 index 0000000..3a5b513 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Fileselectionbox.new.pack(:padx=>10, :pady=>10, + :fill=>:both, :expand=>true) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb new file mode 100644 index 0000000..ff22b2f --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mainloop = Thread.new{Tk.mainloop} + +# +# Non-modal example +# +nmfsd = Tk::Iwidgets::Fileselectiondialog.new(:title=>'Non-Modal') +nmfsd.buttonconfigure('OK', :command=>proc{ + puts "You selected #{nmfsd.get}" + nmfsd.deactivate + }) +nmfsd.activate + +# +# Modal example +# +mfsd = Tk::Iwidgets::Fileselectiondialog.new(:modality=>:application) +mfsd.center +if TkComm.bool(mfsd.activate) + puts "You selected #{mfsd.get}" +else + puts "You cancelled the dialog" +end + +mainloop.join diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb new file mode 100644 index 0000000..110efb9 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mainloop = Thread.new{Tk.mainloop} + +st = Tk::Iwidgets::Scrolledtext.new.pack +st.insert('end', "Now is the time for all good men\n") +st.insert('end', "to come to the aid of their country") + +fd = Tk::Iwidgets::Finddialog.new(:textwidget=>st) +fd.center(st) +fd.activate + +mainloop.join diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb new file mode 100644 index 0000000..085070e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +def get_files(file) + dir = (file.empty?)? ENV['HOME'] : TkComm._fromUTF8(file) + Dir.chdir(dir) rescue return '' + Dir['*'].sort.collect{|f| + [TkComm._toUTF8(File.join(dir, f)), TkComm._toUTF8(f)] + } +end + +Tk::Iwidgets::Hierarchy.new(:querycommand=>proc{|arg| get_files(arg.node)}, + :visibleitems=>'30x15', + :labeltext=>ENV['HOME']).pack(:side=>:left, + :expand=>true, + :fill=>:both) + +# Tk::Iwidgets::Hierarchy.new(:querycommand=>[proc{|n| get_files(n)}, '%n'], +# :visibleitems=>'30x15', +# :labeltext=>ENV['HOME']).pack(:side=>:left, +# :expand=>true, +# :fill=>:both) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/hyperhelp.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/hyperhelp.rb new file mode 100644 index 0000000..f9c92bf --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/hyperhelp.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mainloop = Thread.new{Tk.mainloop} + +dir = '/usr/local/ActiveTcl/demos/IWidgets/html/' +href = [ 'hyperhelp.n', 'buttonbox.n', 'calendar.n' ] + +hh = Tk::Iwidgets::Hyperhelp.new(:topics=>href, :helpdir=>dir) +hh.show_topic('hyperhelp.n') +hh.activate + +mainloop.join diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb new file mode 100644 index 0000000..4e2e21e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +lf = Tk::Iwidgets::Labeledframe.new(:labeltext=>'Entry Frame', :labelpos=>:n) +lf.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10) + +cs = lf.child_site + +Tk::Iwidgets::Entryfield.new(cs, :labeltext=>'Name:').pack(:side=>:top, :fill=>:x) +Tk::Iwidgets::Spinint.new(cs, :labeltext=>'Number:').pack(:side=>:top, :fill=>:x) +Tk::Iwidgets::Pushbutton.new(cs, :text=>'Details:').pack(:side=>:top, :fill=>:x) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb new file mode 100644 index 0000000..577550a --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +lw = Tk::Iwidgets::Labeledwidget.new(:labeltext=>'Canvas Widget', + :labelpos=>:s) +lw.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10) + +cw = TkCanvas.new(lw.child_site, :relief=>:raised, :width=>200, :height=>200, + :borderwidth=>3, :background=>:white) +cw.pack(:padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb new file mode 100644 index 0000000..c9677f2 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb @@ -0,0 +1,64 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mw = Tk::Iwidgets::Mainwindow.new + +mw.menubar.add(:menubutton, 'file', :text=>'File', :underline=>0, + :padx=>8, :pady=>2, :menu=>[ + [:options, {:tearoff=>false}], + + [:command, 'new', { + :label=>'New', :underline=>0, + :helpstr=>'Create a new file' + } + ], + + [:command, 'open', { + :label=>'Open ...', :underline=>0, + :helpstr=>'Open an existing file' + } + ], + + [:command, 'save', { + :label=>'Save', :underline=>0, + :helpstr=>'Save the current file' + } + ], + + [:command, 'saveas', { + :label=>'Save As', :underline=>5, + :helpstr=>'Save the file as a different name' + } + ], + + [:command, 'print', { + :label=>'Print', :underline=>0, + :helpstr=>'Print the file' + } + ], + + [:separator, 'sep1'], + + [:command, 'close', { + :label=>'Close', :underline=>0, + :helpstr=>'Close the file' + } + ], + + [:separator, 'sep2'], + + [:command, 'exit', { + :label=>'Exit', :underline=>1, + :helpstr=>'Exit this application' + } + ], + + nil + ]) + +Tk::Iwidgets::Scrolledtext.new(mw.child_site).pack(:fill=>:both, :expand=>true) + +mw.activate + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb new file mode 100644 index 0000000..e012752 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb @@ -0,0 +1,124 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +helpvar = TkVariable.new +viewmode = TkVariable.new + +menu_spec = [ + [:menubutton, 'file', { + :text=>'File', :menu=>[ + [:options, {:tearoff=>false}], + + [:command, 'new', { + :label=>'New', :helpstr=>'Open new document', + :command=>proc{puts 'NEW'} + } + ], + + [:command, 'close', { + :label=>'Close', :helpstr=>'Close current document', + :command=>proc{puts 'CLOSE'} + } + ], + + [:separator, 'sep1'], + + [:command, 'exit', { + :label=>'Exit', :helpstr=>'Exit application', + :command=>proc{exit} + } + ] + ] + } + ], + + [:menubutton, 'edit', { + :text=>'Edit', :menu=>[ + [:options, {:tearoff=>false}], + + [:command, 'undo', { + :label=>'Undo', :underline=>0, + :helpstr=>'Undo last command', + :command=>proc{puts 'UNDO'} + } + ], + + [:separator, 'sep2'], + + [:command, 'cut', { + :label=>'Cut', :underline=>1, + :helpstr=>'Cut selection to clipboard', + :command=>proc{puts 'CUT'} + } + ], + + [:command, 'copy', { + :label=>'Copy', :underline=>1, + :helpstr=>'Copy selection to clipboard', + :command=>proc{puts 'COPY'} + } + ], + + [:command, 'paste', { + :label=>'Paste', :underline=>0, + :helpstr=>'Paste clipboard contents', + :command=>proc{puts 'PASTE'} + } + ] + ] + } + ], + + [:menubutton, 'options', { + :text=>'Options', :menu=>[ + [:options, {:tearoff=>false, :selectcolor=>'blue'}], + + [:radiobutton, 'byName', { + :variable=>viewmode, :value=>'NAME', + :label=>'by Name', :helpstr=>'View files by name order', + :command=>proc{puts 'NAME'} + } + ], + + [:radiobutton, 'byDate', { + :variable=>viewmode, :value=>'DATE', + :label=>'by Date', :helpstr=>'View files by date order', + :command=>proc{puts 'DATE'} + } + ], + + [:cascade, 'prefs', { + :label=>'Preferences', :menu=>[ + [:command, 'colors', { + :label=>'Colors...', :helpstr=>'Change text colors', + :command=>proc{puts 'COLORS'} + } + ], + + [:command, 'fonts', { + :label=>'Fonts...', :helpstr=>'Change text font', + :command=>proc{puts 'COLORS'} + } + ] + ] + } + ] + ] + } + ] +] + +#mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar, +# :menubuttons=>menu_spec) +mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar) +mb.configure(:menubuttons=>menu_spec) + +fr = TkFrame.new(:width=>300, :height=>300) +ef = TkEntry.new(:textvariable=>helpvar) + +mb.pack(:anchor=>:nw, :fill=>:x, :expand=>true) +fr.pack(:fill=>:both, :expand=>true) +ef.pack(:anchor=>:sw, :fill=>:x, :expand=>true) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb new file mode 100644 index 0000000..477c916 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb @@ -0,0 +1,44 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +helpvar = TkVariable.new +viewmode = TkVariable.new + +mb = Tk::Iwidgets::Menubar.new +mb.menubuttons = [ + [:menubutton, 'file', { + :text=>'File', :menu=>[ + [:command, 'new', {:label=>'New'}], + [:command, 'close', {:label=>'Close'}], + [:separator, 'sep1'], + [:command, 'quit', {:label=>'Quit'}] + ] + } + ], + [:menubutton, 'edit', {:text=>'Edit'}] +] + +mb.add(:command, '.edit.undo', :label=>'Undo', :underline=>0) +mb.add(:separator, '.edit.sep2') +mb.add(:command, '.edit.cut', :label=>'Cut', :underline=>1) +mb.add(:command, '.edit.copy', :label=>'Copy', :underline=>1) +mb.add(:command, '.edit.paste', :label=>'Paste', :underline=>0) + +mb.add(:menubutton, '.options', :text=>'Options', :menu=>[ + [:radiobutton, 'byName', { + :variable=>viewmode, :value=>'NAME', :label=>'by Name'} + ], + [:radiobutton, 'byDate', { + :variable=>viewmode, :value=>'DATE', :label=>'by Date'} + ] + ]) + +mb.add(:cascade, '.options.prefs', :label=>'Preferences', :menu=>[ + [:command, 'colors', {:label=>'Colors...'}], + [:command, 'fonts', {:label=>'Fonts...'}] + ]) + +mb.pack(:side=>:left, :anchor=>:nw, :fill=>:x, :expand=>true) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb new file mode 100644 index 0000000..87b2d38 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, + :labeltext=>'Messages', :labelpos=>:n, + :height=>120, :width=>550, + :savedir=>'/tmp', :textbackground=>'#d9d9d9') +mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true) + +mb.type_add('ERROR', :background=>'red', :foreground=>'white', :bell=>true) +mb.type_add('WARNING', :background=>'yellow', :foreground=>'black') +mb.type_add('INFO', :background=>'white', :foreground=>'black') + +mb.issue('This is an error message in red with a beep', 'ERROR') +mb.issue('This warning message in yellow', 'WARNING') +mb.issue('This is an informational message', 'INFO') + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb new file mode 100644 index 0000000..5278883 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, + :labeltext=>'Messages', :labelpos=>:n, + :height=>120, :width=>550, + :savedir=>'/tmp', :textbackground=>'#d9d9d9') +mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true) + +error = mb.type_add(:background=>'red', :foreground=>'white', :bell=>true) +warning = mb.type_add(:background=>'yellow', :foreground=>'black') +info = mb.type_add(:background=>'white', :foreground=>'black') + +mb.issue('This is an error message in red with a beep', error) +mb.issue('This warning message in yellow', warning) +mb.issue('This is an informational message', info) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb new file mode 100644 index 0000000..52799f2 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb @@ -0,0 +1,44 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mainloop = Thread.new{Tk.mainloop} + +# +# Standard question message dialog used for confirmation. +# +md = Tk::Iwidgets::Messagedialog.new(:title=>'Message Dialog', + :text=>'Are you sure ? ', + :bitmap=>'questhead', :modality=>:global) + +md.buttonconfigure('OK', :text=>'Yes') +md.buttonconfigure('Cancel', :text=>'No') + +if TkComm.bool(md.activate) + md.text('Are you really sure ? ') + if TkComm.bool(md.activate) + puts 'Yes' + else + puts 'No' + end +else + puts 'No' +end + +md.destroy + +# +# Copyright notice with automatic deactivation. +# +bmp = '@' + File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/text.xbm') + +cr = Tk::Iwidgets::Messagedialog.new(:title=>'Copyright', + :bitmap=>bmp, :imagepos=>:n, + :text=>"Copyright 200x XXX Corporation\nAll rights reserved") + +cr.hide('Cancel') + +cr.activate +Tk.after(7000, proc{cr.deactivate; Tk.root.destroy}) + +mainloop.join diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb new file mode 100644 index 0000000..4d460e8 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +# Create the tabnotebook widget and pack it. +nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100) +nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, + :side=>:left, :padx=>10, :pady=>10) + +# Add two pages to the tabnotebook, +# labelled "Page One" and "Page Two" +nb.add(:label=>'Page One') +nb.add(:label=>'Page Two') + +# Get the child site frames of these two pages. +page1CS = nb.child_site(0) +page2CS = nb.child_site('Page Two') + +# Create buttons on each page of the tabnotebook. +TkButton.new(page1CS, :text=>'Button One').pack +TkButton.new(page2CS, :text=>'Button Two').pack + +# Select the first page of the tabnotebook. +nb.select(0) + +# Create the scrollbar and associate the scrollbar +# and the notebook together, then pack the scrollbar +nb.scrollbar(TkScrollbar.new).pack(:fill=>:y, :expand=>true, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb new file mode 100644 index 0000000..576a9c1 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +# Create the tabnotebook widget and pack it. +nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100) +nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, + :side=>:top, :padx=>10, :pady=>0) + +# Add two pages to the tabnotebook, +# labelled "Page One" and "Page Two" +nb.add(:label=>'Page One') +nb.add(:label=>'Page Two') + +# Get the child site frames of these two pages. +page1CS = nb.child_site(0) +page2CS = nb.child_site('Page Two') + +# Create buttons on each page of the tabnotebook. +TkButton.new(page1CS, :text=>'Button One').pack +TkButton.new(page2CS, :text=>'Button Two').pack + +# Select the first page of the tabnotebook. +nb.select(0) + +# Create the scrollbar and associate the scrollbar +# and the notebook together, then pack the scrollbar +nb.xscrollbar(TkScrollbar.new).pack(:fill=>:x, :expand=>true, :padx=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb new file mode 100644 index 0000000..2b921ff --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +om = Tk::Iwidgets::Optionmenu.new(:labelmargin=>5, :labelpos=>:w, + :labeltext=>"Operating System :") + +om.insert('end', 'Unix', 'VMS', 'Linux', 'OS/2', 'Windows NT', 'DOS') +om.sort_ascending +om.select('Linux') + +om.pack(:padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb new file mode 100644 index 0000000..88fc401 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +pw = Tk::Iwidgets::Panedwindow.new(:width=>300, :height=>300) + +pw.add('top') +pw.add('middle', :margin=>10) +pw.add('bottom', :margin=>10, :minimum=>10) + +pw.pack(:fill=>:both, :expand=>true) + +pw.child_site_list.each{|pane| + TkButton.new(pane, :text=>pane.path, :relief=>:raised, + :borderwidth=>2).pack(:fill=>:both, :expand=>true) +} + +pw.fraction(50,30,20) +pw.paneconfigure(0, :minimum=>20) +pw.paneconfigure('bottom', :margin=>15) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb new file mode 100644 index 0000000..96987d5 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +pw = Tk::Iwidgets::Panedwindow.new(:width=>300, :height=>300) + +top = pw.add +middle = pw.add(:margin=>10) +bottom = pw.add(:margin=>10, :minimum=>10) + +pw.pack(:fill=>:both, :expand=>true) + +pw.child_site_list.each{|pane| + TkButton.new(pane, :text=>pane.path, :relief=>:raised, + :borderwidth=>2).pack(:fill=>:both, :expand=>true) +} + +pw.fraction(50,30,20) +pw.paneconfigure(0, :minimum=>20) # 0 == pw.index(top) +pw.paneconfigure(bottom, :margin=>15) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb new file mode 100644 index 0000000..d92a26e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mainloop = Thread.new{Tk.mainloop} + +TkOption.add('*textBackground', 'white') + +pd = Tk::Iwidgets::Promptdialog.new(:modality=>:global, :title=>'Password', + :labeltext=>'Password:', :show=>'*') +pd.hide('Apply') + +if TkComm.bool(pd.activate) + puts "Password entered: #{pd.get}" +else + puts "Password prompt cancelled" +end diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb new file mode 100644 index 0000000..e76dda8 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Pushbutton.new(:text=>'Hello', + :command=>proc{puts 'Hello World'}, + :defaultring=>true).pack(:padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb new file mode 100644 index 0000000..9cd6a00 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +rb = Tk::Iwidgets::Radiobox.new(:labeltext=>'Fonts') +rb.add('times', :text=>'Times') +rb.add('helvetica', :text=>'Helvetica') +rb.add('courier', :text=>'Courier') +rb.add('symbol', :text=>'Symbol') +rb.select('courier') +rb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb new file mode 100644 index 0000000..92c94b9 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +sc = Tk::Iwidgets::Scrolledcanvas.new + +sc.create(TkcRectangle, 100, 100, 400, 400, :fill=>'red') +TkcRectangle.new(sc, 300, 300, 600, 600, :fill=>'green') +TkcRectangle.new(sc, [[200, 200], [500, 500]], :fill=>'blue') + +sc.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb new file mode 100644 index 0000000..e5bd90a --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +sf = Tk::Iwidgets::Scrolledframe.new(:width=>150, :height=>180, + :labeltext=>'scrolledframe') +cs = sf.child_site + +TkButton.new(cs, :text=>'Hello').pack(:pady=>10) +TkButton.new(cs, :text=>'World').pack(:pady=>10) +TkButton.new(cs, :text=>'This is a test').pack(:pady=>10) +TkButton.new(cs, :text=>'This is a really big button').pack(:pady=>10) +TkButton.new(cs, :text=>'This is another really big button').pack(:pady=>10) +TkButton.new(cs, :text=>'This is the last really big button').pack(:pady=>10) + +sf.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb new file mode 100644 index 0000000..2b675f8 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +TkOption.add('*textBackground', 'white') + +sh = Tk::Iwidgets::Scrolledhtml.new(:fontname=>'helvetica', + :linkcommand=>proc{|href| + sh.import_link(href) + }) +sh.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) + +sh.import(Tk.getOpenFile(:title=>'select HTML document')) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb new file mode 100644 index 0000000..bf2c601 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +TkOption.add('*textBackground', 'white') + +slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single, + :vscrollmode=>:static, + :hscrollmode=>:dynamic, + :labeltext=>'List', + :selectioncommand=>proc{ + puts(slb.get_curselection) + }, + :dblclickcommand=>proc{ + puts('Double Click') + puts(slb.get_curselection) + }) +slb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) + +slb.insert('end', *['Hello', 'Out There', 'World']) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb new file mode 100644 index 0000000..41498e6 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +st = Tk::Iwidgets::Scrolledtext.new(:hscrollmode=>:dynamic, :wrap=>:none, + :labeltext=>'Password File') +st.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) + +st.import('/etc/passwd') + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb new file mode 100644 index 0000000..7468497 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +TkOption.add('*textBackground', 'white') + +sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10, + :fill=>:both, :expand=>true) + +sb.insert_items('end', *['Hello', 'Out There', 'World']) + +TkLabel.new(sb.child_site, + :text=>'Child Site is Here').pack(:fill=>:x, :padx=>10, :pady=>10) + +sb.insert_items(2, 'Cruel Cruel') + +sb.selection_set(1) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb new file mode 100644 index 0000000..d53391f --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +mainloop = Thread.new{Tk.mainloop} + +TkButton.new(:text=>'QUIT', + :command=>proc{Tk.root.destroy}).pack(:padx=>10, :pady=>10) + +Tk::Iwidgets::Selectiondialog.new.activate + +mainloop.join diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb new file mode 100644 index 0000000..6d01280 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +sh = Tk::Iwidgets::Shell.new(:modality=>:application, + :padx=>20, :pady=>20, :title=>'Shell') + +TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, + :command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10) + +TkLabel.new(sh.child_site, :text=>'SHELL').pack +TkButton.new(sh.child_site, :text=>'YES', + :command=>proc{sh.deactivate 'press YES'}).pack(:fill=>:x) +TkButton.new(sh.child_site, :text=>'NO', + :command=>proc{sh.deactivate 'press NO'}).pack(:fill=>:x) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb new file mode 100644 index 0000000..17197a6 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Spindate.new.pack(:padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb new file mode 100644 index 0000000..e2dde01 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +TkOption.add('*textBackground', 'white') + +Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5, + :fixed=>true, :range=>[32, 212]).pack(:pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb new file mode 100644 index 0000000..6a20b0e --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +class Spinner_demo < TkWindow + Months = %w(January February March April May June July August September October November December) + + def block_input(c) + false + end + + def spin_month(step) + index = Months.index(@spinner.get) + step + index = 11 if index < 0 + index = 0 if index > 11 + + @spinner.value = Months[index] + end + + def initialize(parent=nil) + @spinner = Tk::Iwidgets::Spinner.new(parent, :labeltext=>'Month : ', + :width=>10, :fixed=>10, + :validate=>proc{|c| block_input}, + :decrement=>proc{spin_month -1}, + :increment=>proc{spin_month 1}) + @path = @spinner + @spinner.insert(0, Months[0]) + end +end + +Spinner_demo.new.pack(:padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb new file mode 100644 index 0000000..2c13884 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Spintime.new.pack(:padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb new file mode 100644 index 0000000..382b34d --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb @@ -0,0 +1,26 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +# Create the tabnotebook widget and pack it. +tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100) +tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, + :side=>:left, :padx=>10, :pady=>10) + +# Add two pages to the tabnotebook, +# labelled "Page One" and "Page Two" +tn.add(:label=>'Page One') +tn.add(:label=>'Page Two') + +# Get the child site frames of these two pages. +page1CS = tn.child_site(0) +page2CS = tn.child_site('Page Two') + +# Create buttons on each page of the tabnotebook. +TkButton.new(page1CS, :text=>'Button One').pack +TkButton.new(page2CS, :text=>'Button Two').pack + +# Select the first page of the tabnotebook. +tn.select(0) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb new file mode 100644 index 0000000..2689759 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +# Create the tabnotebook widget and pack it. +tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100) +tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, + :side=>:top, :padx=>10, :pady=>0) + +# Add two pages to the tabnotebook, +# labelled "Page One" and "Page Two" +tn.add(:label=>'Page One') +tn.add(:label=>'Page Two') + +# Get the child site frames of these two pages. +page1CS = tn.child_site(0) +page2CS = tn.child_site('Page Two') + +# Create buttons on each page of the tabnotebook. +TkButton.new(page1CS, :text=>'Button One').pack +TkButton.new(page2CS, :text=>'Button Two').pack + +# Select the first page of the tabnotebook. +tn.select(0) + +# Create the scrollbar +# and the notebook together, then pack the scrollbar +tn.xscrollbar(TkScrollbar.new).pack(:fill=>:x, :expand=>true, :padx=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb new file mode 100644 index 0000000..90be46b --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +# Create a listbox with two items (one and two) +l = TkListbox.new(:selectmode=>:single, :exportselection=>false).pack +l.insert('end', 'one') +l.insert('end', 'two') +l.selection_set(0) + +# Define a proc that knows how to select an item +# from a list given an index from the tabset -command callback. +selectItem = proc{|item| + l.selection_clear(l.curselection) + l.selection_set(item) + l.see(item) +} + +# Create a tabset, set its -command to call selectItem +# Add two labels to the tabset (one and two). +ts = Tk::Iwidgets::Tabset.new(:command=>selectItem) +ts.add(:label=>1) +ts.add(:label=>2) +ts.select(0) +ts.pack(:fill=>:x, :expand=>true) + +# Define a proc that knows how to select a tab +# given a y pixel coordinate from the list.. +selectTab = proc{|y| ts.select(l.nearest(y)) } + +# bind button 1 press to the selectTab procedure. +l.bind('ButtonPress-1', proc{|y| selectTab.call(y) }, '%y') + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/timeentry.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/timeentry.rb new file mode 100644 index 0000000..4659399 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/timeentry.rb @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Tk::Iwidgets::Timeentry.new.pack + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/timefield.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/timefield.rb new file mode 100644 index 0000000..bb59450 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/timefield.rb @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +tf = Tk::Iwidgets::Timefield.new(:command=>proc{puts(tf.get)}) +tf.pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>10) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb new file mode 100644 index 0000000..608efd0 --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb @@ -0,0 +1,152 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +########################################## +# icon images +editcopy22 = TkPhotoImage.new(:data=><<'EOD') + R0lGODlhFgAWAIUAAPwCBBQSFPz+/DQyNISChDw6PMzKzMTGxERGRIyKjFxa + XMTCvKSmpHR2dPz6/Pz29PTq3MS2rPz69MTCxFxWVHx6dJyWjNzSzPz27Pzy + 7Pzu5PTm3NTKvIR+fJyGfHxuZHxqXNTCtPTq5PTi1PTezNS+rExOTFRORMyy + lPTaxOzWxOzSvNze3NTOxMy2nMyulMyqjAQCBAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAWABYAAAbY + QIBwSCwahYGkUnk0BgTQ6IAQaBKfUWhBYKhaAU+CgXAQIAyChLeJzSIQhcH6 + GFaM0QtGY5kstqEODw8QEQELAhJTc08KBBMEFBUWDRcBE1pca20SGBkaEBsc + AY5maFRIAgoLHRQRHh8gIQFlZnByqA8ZGSIQIyQjJQEmYgJ5p2ACrK4gJx4g + KIZZAgdeAQ4ZI9kjKSor0AwEjeAs1S0cHAslLi4vMDDRWeRIfEsxMeET4ATy + VoYLC5fizXEiAR84BeMG+pEm8EsAFhAjSlR4hR6fLxiF0AkCACH+aENyZWF0 + ZWQgYnkgQk1QVG9HSUYgUHJvIHZlcnNpb24gMi41DQqpIERldmVsQ29yIDE5 + OTcsMTk5OC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4NCmh0dHA6Ly93d3cuZGV2 + ZWxjb3IuY29tADs= +EOD + +editcut22 = TkPhotoImage.new(:data=><<'EOD') + R0lGODlhFgAWAIMAAPwCBAQCBAwCBPz+/OTi5JyanOzq7DQyNGxqbAAAAAAA + AAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAWABYAAARbEMhJq704gxBE + 0Bf3cZo4kRJqBQNRfBucyudgvJS6VaxLzyMa6/bLiWA9HOg4VIIkL5vzuRkc + pkvRIIAorphJLzBW84WEuRZWp6uaT7J2Sh1Hit3OY/ZO7WvsEQAh/mhDcmVh + dGVkIGJ5IEJNUFRvR0lGIFBybyB2ZXJzaW9uIDIuNQ0KqSBEZXZlbENvciAx + OTk3LDE5OTguIEFsbCByaWdodHMgcmVzZXJ2ZWQuDQpodHRwOi8vd3d3LmRl + dmVsY29yLmNvbQA7 +EOD + +editpaste22 = TkPhotoImage.new(:data=><<'EOD') + R0lGODlhFgAWAIYAAPwCBBQWFDw6FHRuFGRaBFxSBAQCBAQKBCQiBIx6HPz6 + /NTOfKyiXDQuFOTm5Pz+/Ozu7PTq5Pz63PTyxNTOjKSeRExGLMTGxMzKzNTS + 1NTW1Dw2NKSmpKyqrKSipJyanNzWlLy6ZLSuVIx6FISChIyKhJSSlCQiJLS2 + tDw6NDQyNCQiFCQmHBQSDGRiZHRydGxubHx6dGxqbFxeXGRmZFxaXCwuLOzq + 7KyurHx+fDwmFEQuFCweFCQWDBQODBwaHBweHKSinJSWlOTi5JyepHR2dDw6 + PBQSFNze3ERGRIyKjIyOjISGhPz29Pzy7MS2rMzOzFRWVHx2dHxybDQiFPz2 + 7Pzu5PTq3PTm1NTCtJyGdHxuZHxqXPzq3PTaxNS6pFxWVFRKRNS2nPTi1PTS + tNSulNzOxNSynMymhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAA + LAAAAAAWABYAAAf/gACCgwABAgMEBYSLggaOjgcICQoLDA2Pj4MGDg8QEZ4F + DxITFBUWFxcYGRobjQ8cHR4fCQ8gCyEiFSMWJCUkJieNEB4dKB4pKissK8wr + LS4vMDHBAAYQHx8dFx0fJDIzNDU0M+IyHzaNNyg43Ng5Ojs7Ojw9Pj9AMkCN + DiZB/h9CSOx4QLCgihItqBkYgqIDESElitAYWJCgkQcXjjRCgi1Ihw4BB5LA + QOLCgyQYHihpUU3DBw5ElpAgAYNixSRJjKjQaECDCRPZPDB5IbIGSQwKLnh4 + wbInLA4kmJB4oaPiAwVNnER40hRK1BIAaVatUZJEFCkmpmjgCeWDCalFe4q4 + oFKwSRUrEa5gycLzwq8lUnPQ4PEgSpYcUZ5o2cIlS1O/JHLEDdfjQZMIVrpg + weLFy5e+M6WSmBGlxYMYYBRzCaOFi5imHWBIfOEiShLTVjaP6eyFTBmN1TA5 + OvLDjJksWb58OVMGDRqWjAYdmU79SIvpjqJr104nEAAh/mhDcmVhdGVkIGJ5 + IEJNUFRvR0lGIFBybyB2ZXJzaW9uIDIuNQ0KqSBEZXZlbENvciAxOTk3LDE5 + OTguIEFsbCByaWdodHMgcmVzZXJ2ZWQuDQpodHRwOi8vd3d3LmRldmVsY29y + LmNvbQA7 +EOD + +editdelete22 = TkPhotoImage.new(:data=><<'EOD') + R0lGODlhFgAWAIYAAASC/FRSVExKTERCRDw6PDQyNCwuLBweHBwaHAwODAwK + DAQCBExOTNze3NTW1MTGxLS2tJyanPz+/Ozu7BQSFCwqLDw+POTi5PTu7MzK + xIR+fCQmJPz6/Oze1NTGvPz69Pzy7Pz29LyyrPy+vPyupPTm1BQWFIQCBPwC + BMS6rPzSzNTOxPTi1NS+rPTezNzOxPTizOzWxMy2pOzaxMy2nPTaxOzOtMyy + nOzSvMyqjPx+fOzGpMSihPTq3OzKrOTCpNzKxNTCtAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAA + LAAAAAAWABYAAAf8gACCAQIDBAUGBwgJCgsLgpCRAAwNlZYODxALEY+SkAMN + EqKjEw0UD5yegqCjrRMVEqidkgWhraMWF7GptLa3EgEWFRSOnhW+vxgZEBqz + kBvItxwdHryRCNGjHyAhHSLOgtgSI60c2yQjJd+eJqEnKK0hJCgnJSngAO0S + F+8qEvL0VrBogW+BLX4oVKgIyMIFQU8KfDV4R+8FDBcxZBREthAFiRIsOsyg + sVEUh4Un3pGoUcPGjZInK65QicPlxg8oX5RwqNJGjo0hdJwQ6EIkjRM6dvDY + CKIHSBc1Ztjw4eOH0oIrsgIJEqSFDBo0cuTgsdSTo7No0xYTZCcQACH+aENy + ZWF0ZWQgYnkgQk1QVG9HSUYgUHJvIHZlcnNpb24gMi41DQqpIERldmVsQ29y + IDE5OTcsMTk5OC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4NCmh0dHA6Ly93d3cu + ZGV2ZWxjb3IuY29tADs= +EOD + +text22 = TkPhotoImage.new(:data=><<'EOD') + R0lGODlhFgAWAIQAAPwCBAQCBBwaHAwKDBQSFLy+vLS2tJSWlBQWFKyqrFRS + VCwqLDQyNNTS1GxqbFxaXJyanIyOjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAWABYAAAVcICCOZGmK + QSoMaZsShBsQBdAapHvgaIDUqUPJlRjSbAoT0fRDKgODRbF0PLUYjZO2F2Bs + t9evNix+dsvDlGKK5jraudQb7qbX6a2HEJ+ycyF+LRE8ZTI+fX5oGCEAIf5o + Q3JlYXRlZCBieSBCTVBUb0dJRiBQcm8gdmVyc2lvbiAyLjUNCqkgRGV2ZWxD + b3IgMTk5NywxOTk4LiBBbGwgcmlnaHRzIHJlc2VydmVkLg0KaHR0cDovL3d3 + dy5kZXZlbGNvci5jb20AOw== +EOD + +########################################## + +bmp_dir = File.join(File.dirname(File.expand_path(__FILE__)), + '../catalog_demo/images') + +########################################## + +status_var = TkVariable.new +radio_var = TkVariable.new +check_var1 = TkVariable.new +check_var2 = TkVariable.new + +tb = Tk::Iwidgets::Toolbar.new(:helpvariable=>status_var) + +########################################## + +tb.add(:button, :helpstr=>'Copy It', :image=>editcopy22, + :balloonstr=>'Copy', :command=>proc{puts 'Copy It'}) + +tb.add(:button, :helpstr=>'Cut It', :image=>editcut22, + :balloonstr=>'Cut', :command=>proc{puts 'Cut It'}) + +tb.add(:button, :helpstr=>'Paste It', :image=>editpaste22, + :balloonstr=>'Paste', :command=>proc{puts 'Paste It'}) + +tb.add(:button, :helpstr=>'Delete It', :image=>editdelete22, + :balloonstr=>'Delete', :command=>proc{puts 'Delete It'}) + +#-------------------------------- + +tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10) + +#-------------------------------- + +tb.add(:radiobutton, :variable=>radio_var, :value=>'Box', + :bitmap=>"@#{bmp_dir}/box.xbm", + :helpstr=>'Radio Button #1', :balloonstr=>'Radio', + :command=>proc{puts 'Radio Button "Box"'}) + +tb.add(:radiobutton, :variable=>radio_var, :value=>'Line', + :bitmap=>"@#{bmp_dir}/line.xbm", + :helpstr=>'Radio Button #2', :balloonstr=>'Radio', + :command=>proc{puts 'Radio Button "Line"'}) + +tb.add(:radiobutton, :variable=>radio_var, :value=>'Oval', + :bitmap=>"@#{bmp_dir}/oval.xbm", + :helpstr=>'Radio Button #3', :balloonstr=>'Radio', + :command=>proc{puts 'Radio Button "Oval"'}) + +#-------------------------------- + +tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10) + +#-------------------------------- + +tb.add(:checkbutton, :variable=>check_var1, :onvalue=>'yes', :offvalue=>'no', + :image=>text22, :command=>proc{puts 'Checkbutton 1'}) + +tb.add(:checkbutton, :variable=>check_var2, :onvalue=>'yes', :offvalue=>'no', + :bitmap=>"@#{bmp_dir}/points.xbm", :command=>proc{puts 'Checkbutton 2'}) + +tb.pack(:side=>:top, :anchor=>:nw) + +Tk.mainloop diff --git a/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb new file mode 100644 index 0000000..2af53ba --- /dev/null +++ b/jni/ruby/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby +require 'tk' +require 'tkextlib/iwidgets' + +Thread.new{ + trap('INT') {puts 'catch SIGINT'} + sleep 5 + trap('INT', 'DEFAULT') +} + +Tk::Iwidgets::Watch.new(:state=>:disabled, :showampm=>:no, + :width=>155, :height=>155){|w| + w.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) + # TkTimer.new(1000, -1, proc{w.show; Tk.update}).start + TkTimer.new(25, -1, proc{w.show; Tk.update}).start +} + +Tk.mainloop |