tk-win 0.2.1-x86-mingw32 → 0.2.2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +11 -10
- data/VERSION +1 -1
- data/lib/multi-tk.rb +3740 -0
- data/lib/remote-tk.rb +530 -0
- data/lib/tk/busy.rb +118 -0
- data/lib/tk/fontchooser.rb +176 -0
- data/lib/tkextlib/tcllib/README +135 -0
- data/lib/tkextlib/tcllib/calendar.rb +55 -0
- data/lib/tkextlib/tcllib/canvas_sqmap.rb +36 -0
- data/lib/tkextlib/tcllib/canvas_zoom.rb +21 -0
- data/lib/tkextlib/tcllib/chatwidget.rb +151 -0
- data/lib/tkextlib/tcllib/crosshair.rb +117 -0
- data/lib/tkextlib/tcllib/dateentry.rb +62 -0
- data/lib/tkextlib/tcllib/diagrams.rb +224 -0
- data/lib/tkextlib/tcllib/khim.rb +68 -0
- data/lib/tkextlib/tcllib/menuentry.rb +47 -0
- data/lib/tkextlib/tcllib/ntext.rb +146 -0
- data/lib/tkextlib/tcllib/scrolledwindow.rb +57 -0
- data/lib/tkextlib/tcllib/statusbar.rb +79 -0
- data/lib/tkextlib/tcllib/toolbar.rb +175 -0
- data/lib/tkextlib/tile/tspinbox.rb +107 -0
- data/lib/tkextlib/tkimg/README +26 -0
- data/tk-win.gemspec +26 -6
- metadata +27 -8
data/lib/tk/busy.rb
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
#
|
2
|
+
# tk/busy.rb: support 'tk busy' command (Tcl/Tk8.6 or later)
|
3
|
+
#
|
4
|
+
require 'tk'
|
5
|
+
|
6
|
+
module Tk::Busy
|
7
|
+
include TkCore
|
8
|
+
extend TkCore
|
9
|
+
extend TkItemConfigMethod
|
10
|
+
end
|
11
|
+
|
12
|
+
class << Tk::Busy
|
13
|
+
def __item_cget_cmd(win)
|
14
|
+
# maybe need to override
|
15
|
+
['tk', 'busy', 'cget', win.path]
|
16
|
+
end
|
17
|
+
private :__item_cget_cmd
|
18
|
+
|
19
|
+
def __item_config_cmd(win)
|
20
|
+
# maybe need to override
|
21
|
+
['tk', 'busy', 'configure', win.path]
|
22
|
+
end
|
23
|
+
private :__item_config_cmd
|
24
|
+
|
25
|
+
def __item_confinfo_cmd(win)
|
26
|
+
# maybe need to override
|
27
|
+
__item_config_cmd(win)
|
28
|
+
end
|
29
|
+
private :__item_confinfo_cmd
|
30
|
+
|
31
|
+
alias cget_tkstring itemcget_tkstring
|
32
|
+
alias cget itemcget
|
33
|
+
alias cget_strict itemcget_strict
|
34
|
+
alias configure itemconfigure
|
35
|
+
alias configinfo itemconfiginfo
|
36
|
+
alias current_configinfo current_itemconfiginfo
|
37
|
+
|
38
|
+
private :itemcget_tkstring, :itemcget, :itemcget_strict
|
39
|
+
private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
|
40
|
+
|
41
|
+
def method_missing(id, *args)
|
42
|
+
name = id.id2name
|
43
|
+
case args.length
|
44
|
+
when 1
|
45
|
+
if name[-1] == ?=
|
46
|
+
configure name[0..-2], args[0]
|
47
|
+
args[0]
|
48
|
+
else
|
49
|
+
configure name, args[0]
|
50
|
+
self
|
51
|
+
end
|
52
|
+
when 0
|
53
|
+
begin
|
54
|
+
cget(name)
|
55
|
+
rescue
|
56
|
+
super(id, *args)
|
57
|
+
end
|
58
|
+
else
|
59
|
+
super(id, *args)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def hold(win, keys={})
|
64
|
+
tk_call_without_enc('tk', 'busy', 'hold', win, *hash_kv(keys))
|
65
|
+
win
|
66
|
+
end
|
67
|
+
|
68
|
+
def forget(*wins)
|
69
|
+
tk_call_without_enc('tk', 'busy', 'forget', *wins)
|
70
|
+
self
|
71
|
+
end
|
72
|
+
|
73
|
+
def current(pat=None)
|
74
|
+
list(tk_call('tk', 'busy', 'current', pat))
|
75
|
+
end
|
76
|
+
|
77
|
+
def status(win)
|
78
|
+
bool(tk_call_without_enc('tk', 'busy', 'status', win))
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
module Tk::Busy
|
83
|
+
def busy_configinfo(option=nil)
|
84
|
+
Tk::Busy.configinfo(self, option)
|
85
|
+
end
|
86
|
+
|
87
|
+
def busy_current_configinfo(option=nil)
|
88
|
+
Tk::Busy.current_configinfo(self, option)
|
89
|
+
end
|
90
|
+
|
91
|
+
def busy_configure(option, value=None)
|
92
|
+
Tk::Busy.configure(self, option, value)
|
93
|
+
self
|
94
|
+
end
|
95
|
+
|
96
|
+
def busy_cget(option)
|
97
|
+
Tk::Busy.configure(self, option)
|
98
|
+
end
|
99
|
+
|
100
|
+
def busy(keys={})
|
101
|
+
Tk::Busy.hold(self, keys)
|
102
|
+
self
|
103
|
+
end
|
104
|
+
alias busy_hold busy
|
105
|
+
|
106
|
+
def busy_forget
|
107
|
+
Tk::Busy.forget(self)
|
108
|
+
self
|
109
|
+
end
|
110
|
+
|
111
|
+
def busy_current?
|
112
|
+
! Tk::Busy.current(self.path).empty?
|
113
|
+
end
|
114
|
+
|
115
|
+
def busy_status
|
116
|
+
Tk::Busy.status(self)
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
#
|
2
|
+
# tk/fontchooser.rb -- "tk fontchooser" support (Tcl/Tk8.6 or later)
|
3
|
+
#
|
4
|
+
require 'tk'
|
5
|
+
require 'tk/font'
|
6
|
+
|
7
|
+
module TkFont::Chooser
|
8
|
+
extend TkCore
|
9
|
+
end
|
10
|
+
|
11
|
+
class << TkFont::Chooser
|
12
|
+
def method_missing(id, *args)
|
13
|
+
name = id.id2name
|
14
|
+
case args.length
|
15
|
+
when 1
|
16
|
+
if name[-1] == ?=
|
17
|
+
configure name[0..-2], args[0]
|
18
|
+
args[0]
|
19
|
+
else
|
20
|
+
configure name, args[0]
|
21
|
+
self
|
22
|
+
end
|
23
|
+
when 0
|
24
|
+
begin
|
25
|
+
cget(name)
|
26
|
+
rescue
|
27
|
+
super(id, *args)
|
28
|
+
end
|
29
|
+
else
|
30
|
+
super(id, *args)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def __configinfo_value(key, val)
|
35
|
+
case key
|
36
|
+
when 'parent'
|
37
|
+
window(val)
|
38
|
+
when 'title'
|
39
|
+
val
|
40
|
+
when 'font'
|
41
|
+
if (lst = tk_split_simplelist(val)).size == 1
|
42
|
+
lst[0]
|
43
|
+
else
|
44
|
+
lst.map{|elem| num_or_str(elem)}
|
45
|
+
end
|
46
|
+
when 'command'
|
47
|
+
tk_tcl2ruby(val)
|
48
|
+
when 'visible'
|
49
|
+
bool(val)
|
50
|
+
else # unkown
|
51
|
+
val
|
52
|
+
end
|
53
|
+
end
|
54
|
+
private :__configinfo_value
|
55
|
+
|
56
|
+
def configinfo(option=nil)
|
57
|
+
if !option && TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
|
58
|
+
lst = tk_split_simplelist(tk_call('tk', 'fontchooser', 'configure'))
|
59
|
+
ret = []
|
60
|
+
TkComm.slice_ary(lst, 2){|k, v|
|
61
|
+
k = k[1..-1]
|
62
|
+
ret << [k, __configinfo_value(k, v)]
|
63
|
+
}
|
64
|
+
ret
|
65
|
+
else
|
66
|
+
current_configinfo(option)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def current_configinfo(option=nil)
|
71
|
+
if option
|
72
|
+
opt = option.to_s
|
73
|
+
fail ArgumentError, "Invalid option `#{option.inspect}'" if opt.empty?
|
74
|
+
__configinfo_value(option.to_s, tk_call('tk','fontchooser',
|
75
|
+
'configure',"-#{opt}"))
|
76
|
+
else
|
77
|
+
lst = tk_split_simplelist(tk_call('tk', 'fontchooser', 'configure'))
|
78
|
+
ret = {}
|
79
|
+
TkComm.slice_ary(lst, 2){|k, v|
|
80
|
+
k = k[1..-1]
|
81
|
+
ret[k] = __configinfo_value(k, v)
|
82
|
+
}
|
83
|
+
ret
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def configure(option, value=None)
|
88
|
+
if option.kind_of? Hash
|
89
|
+
tk_call('tk', 'fontchooser', 'configure',
|
90
|
+
*hash_kv(_symbolkey2str(option)))
|
91
|
+
else
|
92
|
+
opt = option.to_s
|
93
|
+
fail ArgumentError, "Invalid option `#{option.inspect}'" if opt.empty?
|
94
|
+
tk_call('tk', 'fontchooser', 'configure', "-#{opt}", value)
|
95
|
+
end
|
96
|
+
self
|
97
|
+
end
|
98
|
+
|
99
|
+
def configure_cmd(slot, value)
|
100
|
+
configure(slot, install_cmd(value))
|
101
|
+
end
|
102
|
+
|
103
|
+
def command(cmd=nil, &b)
|
104
|
+
if cmd
|
105
|
+
configure_cmd('command', cmd)
|
106
|
+
elsif b
|
107
|
+
configure_cmd('command', Proc.new(&b))
|
108
|
+
else
|
109
|
+
cget('command')
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def cget(slot)
|
114
|
+
configinfo slot
|
115
|
+
end
|
116
|
+
|
117
|
+
def [](slot)
|
118
|
+
cget slot
|
119
|
+
end
|
120
|
+
|
121
|
+
def []=(slot, val)
|
122
|
+
configure slot, val
|
123
|
+
val
|
124
|
+
end
|
125
|
+
|
126
|
+
def show
|
127
|
+
tk_call('tk', 'fontchooser', 'show')
|
128
|
+
self
|
129
|
+
end
|
130
|
+
|
131
|
+
def hide
|
132
|
+
tk_call('tk', 'fontchooser', 'hide')
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
def toggle
|
137
|
+
cget(:visible) ? hide: show
|
138
|
+
self
|
139
|
+
end
|
140
|
+
|
141
|
+
def set_for(target, title="Font")
|
142
|
+
if target.kind_of? TkFont
|
143
|
+
configs = {
|
144
|
+
:font=>target.actual_hash,
|
145
|
+
:command=>proc{|fnt, *args|
|
146
|
+
target.configure(TkFont.actual_hash(fnt))
|
147
|
+
}
|
148
|
+
}
|
149
|
+
elsif target.kind_of? Hash
|
150
|
+
# key=>value list or OptionObj
|
151
|
+
fnt = target[:font] rescue ''
|
152
|
+
fnt = fnt.actual_hash if fnt.kind_of?(TkFont)
|
153
|
+
configs = {
|
154
|
+
:font => fnt,
|
155
|
+
:command=>proc{|fnt, *args|
|
156
|
+
target[:font] = TkFont.actual_hash(fnt)
|
157
|
+
}
|
158
|
+
}
|
159
|
+
else
|
160
|
+
configs = {
|
161
|
+
:font=>target.cget_tkstring(:font),
|
162
|
+
:command=>proc{|fnt, *args|
|
163
|
+
target.font = TkFont.actual_hash_displayof(fnt, target)
|
164
|
+
}
|
165
|
+
}
|
166
|
+
end
|
167
|
+
|
168
|
+
configs[:title] = title if title
|
169
|
+
configure(configs)
|
170
|
+
target
|
171
|
+
end
|
172
|
+
|
173
|
+
def unset
|
174
|
+
configure(:command, nil)
|
175
|
+
end
|
176
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
|
2
|
+
[ tcllib extension support files ]
|
3
|
+
|
4
|
+
Tcllib includes many utilities. But currently, supports TKLib part
|
5
|
+
only (see the following 'tcllib contents').
|
6
|
+
|
7
|
+
If you request to support others, please send your message to one of
|
8
|
+
ruby-talk/ruby-list/ruby-dev/ruby-ext mailing lists.
|
9
|
+
|
10
|
+
-----<from "What is tcllib?">----------------------------
|
11
|
+
Tcllib is a collection of utility modules for Tcl. These modules provide
|
12
|
+
a wide variety of functionality, from implementations of standard data
|
13
|
+
structures to implementations of common networking protocols. The intent
|
14
|
+
is to collect commonly used function into a single library, which users
|
15
|
+
can rely on to be available and stable.
|
16
|
+
---------------------------------------------------------
|
17
|
+
|
18
|
+
-----< tcllib contents (based on tcllib-1.6.1) >---------
|
19
|
+
Programming tools
|
20
|
+
* cmdline - Procedures to process command lines and options.
|
21
|
+
* comm - A remote communications facility for Tcl (7.6, 8.0, and later)
|
22
|
+
* control - Procedures for control flow structures.
|
23
|
+
* fileutil - Procedures implementing some file utilities
|
24
|
+
* log - Procedures to log messages of libraries and applications.
|
25
|
+
* logger - System to control logging of events.
|
26
|
+
* multiplexer - One-to-many communication with sockets.
|
27
|
+
* snit - Snit's Not Incr Tcl
|
28
|
+
* snitfaq - Snit Frequently Asked Questions
|
29
|
+
* stooop - Object oriented extension.
|
30
|
+
* stoop - Simple Tcl Only Object Oriented Programming
|
31
|
+
* switched - stooop switched class
|
32
|
+
* profiler - Tcl source code profiler
|
33
|
+
|
34
|
+
Mathematics
|
35
|
+
* math::statistics - Basic statistical functions and procedures
|
36
|
+
* math::calculus - Integration and ordinary differential equations
|
37
|
+
* math::optimize - Optimisation routines
|
38
|
+
* math::fuzzy - Fuzzy comparison of floating-point numbers
|
39
|
+
* counter - Procedures for counters and histograms
|
40
|
+
* combinatorics - Combinatorial functions in the Tcl Math Library
|
41
|
+
|
42
|
+
Data structures
|
43
|
+
* struct::list - Procedures for manipulating lists
|
44
|
+
* struct::set - Procedures for manipulating sets
|
45
|
+
* struct::stack - Create and manipulate stack objects
|
46
|
+
* struct::queue - Create and manipulate queue objects
|
47
|
+
* struct::prioqueue - Create and manipulate prioqueue objects
|
48
|
+
* struct::skiplist - Create and manipulate skiplists
|
49
|
+
* struct::tree - Create and manipulate tree objects
|
50
|
+
* struct::graph - Create and manipulate directed graph objects
|
51
|
+
* struct::record - Define and create records (similar to 'C' structures)
|
52
|
+
* struct::matrix - Create and manipulate matrix objects
|
53
|
+
* struct::pool - Create and manipulate pool objects (of discrete items)
|
54
|
+
* report - Create and manipulate report objects
|
55
|
+
|
56
|
+
Text processing
|
57
|
+
* expander - Procedures to process templates and expand text.
|
58
|
+
* base64 - Procedures to encode and decode base64
|
59
|
+
* yencode - encode/decoding a binary file
|
60
|
+
* uuencode - encode/decoding a binary file
|
61
|
+
* csv - Procedures to handle CSV data.
|
62
|
+
* inifile - Parsing of Windows INI files
|
63
|
+
* htmlparse - Procedures to parse HTML strings
|
64
|
+
* mime - Manipulation of MIME body parts
|
65
|
+
* Tcl MIME - generates and parses MIME body parts
|
66
|
+
* textutil - Procedures to manipulate texts and strings.
|
67
|
+
* exif - Tcl EXIF extracts and parses EXIF fields from digital images
|
68
|
+
* EXIF - extract and parse EXIF fields from digital images
|
69
|
+
|
70
|
+
Hashes, checksums, and encryption
|
71
|
+
* cksum - calculate a cksum(1) compatible checksum
|
72
|
+
* crc16 - Perform a 16bit Cyclic Redundancy Check
|
73
|
+
* crc32 - Perform a 32bit Cyclic Redundancy Check
|
74
|
+
* des - Perform DES encryption of Tcl data
|
75
|
+
* md4 - MD4 Message-Digest Algorithm
|
76
|
+
* md5 - MD5 Message-Digest Algorithm
|
77
|
+
* ripemd160 - RIPEMD-160 Message-Digest Algorithm
|
78
|
+
* ripemd128 - RIPEMD-128 Message-Digest Algorithm
|
79
|
+
* md5crypt - MD5-based password encryption
|
80
|
+
* sha1 - Perform sha1 hashing
|
81
|
+
* sum - calculate a sum(1) compatible checksum
|
82
|
+
* soundex - Soundex
|
83
|
+
|
84
|
+
Documentation tools
|
85
|
+
* mpexpand - Markup processor
|
86
|
+
* doctools - Create and manipulate doctools converter object
|
87
|
+
* doctoc_fmt - Specification of simple tcl markup for table of contents
|
88
|
+
* doctools_api - Interface specification for formatter code
|
89
|
+
* doctools_fmt - Specification of simple tcl markup for manpages
|
90
|
+
* docidx - Create and manipulate docidx converter objects
|
91
|
+
* docidx_api - Interface specification for index formatting code
|
92
|
+
* docidx_fmt - Specification of simple tcl markup for an index
|
93
|
+
* doctoc - Create and manipulate doctoc converter objects
|
94
|
+
* doctoc_api - Interface specification for toc formatting code
|
95
|
+
* doctools::changelog - Handle text in Emacs ChangeLog format
|
96
|
+
* doctools::cvs - Handle text in 'cvs log' format
|
97
|
+
|
98
|
+
Networking
|
99
|
+
* uri - URI utilities
|
100
|
+
* dns - Tcl Domain Name Service Client
|
101
|
+
* ntp_time - Tcl Time Service Client
|
102
|
+
* nntp - Tcl client for the NNTP protocol
|
103
|
+
* pop3 - Tcl client for POP3 email protocol
|
104
|
+
* pop3d - Tcl POP3 server implementation
|
105
|
+
* pop3d::udb - Simple user database for pop3d
|
106
|
+
* pop3d::dbox - Simple mailbox database for pop3d
|
107
|
+
* ftp - Client-side tcl implementation of the ftp protocol
|
108
|
+
* ftp - Client-side tcl implementation of the ftp protocol
|
109
|
+
* ftpd - Tcl FTP server implementation
|
110
|
+
* smtp - Client-side tcl implementation of the smtp protocol
|
111
|
+
* smtpd - Tcl SMTP server implementation
|
112
|
+
* irc - Create IRC connection and interface.
|
113
|
+
|
114
|
+
CGI programming
|
115
|
+
* ncgi - Procedures to manipulate CGI values.
|
116
|
+
* html - Procedures to generate HTML structures
|
117
|
+
* javascript - Procedures to generate HTML and Java Script structures.
|
118
|
+
|
119
|
+
Grammars and finite automata
|
120
|
+
* grammar::fa - Create and manipulate finite automatons
|
121
|
+
* grammar::fa::op - Operations on finite automatons
|
122
|
+
* grammar::dacceptor - Create and use deterministic acceptors
|
123
|
+
* grammar::dexec - Execute deterministic finite automatons
|
124
|
+
|
125
|
+
TKLib
|
126
|
+
* Plotchart - Simple plotting and charting package
|
127
|
+
* autoscroll - Provides for a scrollbar to automatically mapped and
|
128
|
+
unmapped as needed
|
129
|
+
* ctext - An extended text widget with customizable Syntax highlighting
|
130
|
+
* cursor - Procedures to handle CURSOR data
|
131
|
+
* datefield - Tk datefield widget
|
132
|
+
* style - Changes default Tk look&feel
|
133
|
+
* ipentry - An IP address entry widget
|
134
|
+
* tkpiechart - Creates and dynamically updates 2D or 3D pie charts
|
135
|
+
---------------------------------------------------------
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#
|
2
|
+
# tkextlib/tcllib/calendar.rb
|
3
|
+
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
4
|
+
#
|
5
|
+
# * Part of tcllib extension
|
6
|
+
# * calendar widget
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'tk'
|
10
|
+
require 'tkextlib/tcllib.rb'
|
11
|
+
|
12
|
+
# TkPackage.require('widget::calendar', '0.9')
|
13
|
+
TkPackage.require('widget::calendar')
|
14
|
+
|
15
|
+
module Tk::Tcllib
|
16
|
+
module Widget
|
17
|
+
class Calendar < TkCanvas
|
18
|
+
PACKAGE_NAME = 'widget::calendar'.freeze
|
19
|
+
def self.package_name
|
20
|
+
PACKAGE_NAME
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.package_version
|
24
|
+
begin
|
25
|
+
TkPackage.require('widget::calendar')
|
26
|
+
rescue
|
27
|
+
''
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class Tk::Tcllib::Widget::Calendar
|
35
|
+
TkCommandNames = ['::widget::calendar'.freeze].freeze
|
36
|
+
|
37
|
+
def __boolval_optkeys
|
38
|
+
super() << 'showpast'
|
39
|
+
end
|
40
|
+
private :__boolval_optkeys
|
41
|
+
|
42
|
+
def create_self(keys)
|
43
|
+
if keys and keys != None
|
44
|
+
tk_call_without_enc(self.class::TkCommandNames[0], @path,
|
45
|
+
*hash_kv(keys, true))
|
46
|
+
else
|
47
|
+
tk_call_without_enc(self.class::TkCommandNames[0], @path)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
private :create_self
|
51
|
+
|
52
|
+
def get(what = 'all')
|
53
|
+
tk_send('get', what)
|
54
|
+
end
|
55
|
+
end
|