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.
@@ -0,0 +1,36 @@
1
+ #
2
+ # tkextlib/tcllib/canvas.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # *
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('widget::canvas_sqmap', '0.2')
13
+ TkPackage.require('widget::canvas_sqmap')
14
+
15
+ module Tk::Tcllib
16
+ module Widget
17
+ class Canvas_Sqmap < Canvas
18
+ TkCommandNames = ['::widget::canvas_sqmap'.freeze].freeze
19
+
20
+ def image_set(cell, img)
21
+ tk_send('image', 'set', cell, img)
22
+ self
23
+ end
24
+
25
+ def image_unset(cell)
26
+ tk_send('image', 'unset', cell)
27
+ self
28
+ end
29
+
30
+ def flush
31
+ tk_send('flush')
32
+ self
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,21 @@
1
+ #
2
+ # tkextlib/tcllib/canvas.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # *
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('widget::canvas_zoom', '0.1')
13
+ TkPackage.require('widget::canvas_zoom')
14
+
15
+ module Tk::Tcllib
16
+ module Widget
17
+ class Canvas_Zoom < Canvas
18
+ TkCommandNames = ['::widget::canvas_zoom'.freeze].freeze
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,151 @@
1
+ #
2
+ # tkextlib/tcllib/chatwidget.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * chatwidget - Provides a multi-paned view suitable for display of
7
+ # chat room or irc channel information
8
+ #
9
+
10
+ require 'tk'
11
+ require 'tkextlib/tcllib.rb'
12
+
13
+ # TkPackage.require('chatwidget', '1.1.0')
14
+ TkPackage.require('chatwidget')
15
+
16
+ module Tk::Tcllib
17
+ class ChatWidget < TkText
18
+ PACKAGE_NAME = 'chatwidget'.freeze
19
+ def self.package_name
20
+ PACKAGE_NAME
21
+ end
22
+
23
+ def self.package_version
24
+ begin
25
+ TkPackage.require('chatwidget')
26
+ rescue
27
+ ''
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ class Tk::Tcllib::ChatWidget
34
+ TkCommandNames = ['::chatwidget::chatwidget'.freeze].freeze
35
+
36
+ def show_topic
37
+ tk_send_without_enc('topic', 'show')
38
+ self
39
+ end
40
+
41
+ def hide_topic
42
+ tk_send_without_enc('topic', 'hide')
43
+ self
44
+ end
45
+
46
+ def set_topic(topic)
47
+ tk_send('topic', 'set', topic)
48
+ end
49
+
50
+ def list_name
51
+ tk_split_simplelist(tk_send('name', 'list'))
52
+ end
53
+
54
+ def list_name_full
55
+ tk_split_simplelist(tk_send('name', 'list')).map{|lst|
56
+ nick, *opts = tk_split_simplelist(lst)
57
+ h_opt = {}
58
+ opts.slice(2){|k, v| h_opt[k[1..-1]] = tk_tcl2ruby(v)}
59
+ [nick, h_opt]
60
+ }
61
+ end
62
+
63
+ def add_name(nick, opts={})
64
+ tk_send('name', 'add', nick, *(hash_kv(opts)))
65
+ end
66
+
67
+ def delete_name(nick)
68
+ tk_send('name', 'delete', nick)
69
+ end
70
+
71
+ def get_name(nick)
72
+ lst = tk_send('name', 'get', nick)
73
+ return nil if lst.empty?
74
+ nick, *opts = tk_split_simplelist(lst)
75
+ h_opt = {}
76
+ opts.slice(2){|k, v| h_opt[k[1..-1]] = tk_tcl2ruby(v)}
77
+ [nick, h_opt]
78
+ end
79
+
80
+ def message(msg, opts={})
81
+ tk_send('message', msg, *(hash_kv(opts)))
82
+ self
83
+ end
84
+
85
+ def _parse_hook_list(lst)
86
+ tk_split_simplelist(lst).map{|hook|
87
+ cmd, prior = tk_split_simplelist(hook)
88
+ [procedure(cmd), number(prior)]
89
+ }
90
+ end
91
+ private :_parse_hook_list
92
+
93
+ def hook_add(type, *args, &blk) # args -> [prior, cmd], [prior], [cmd]
94
+ #type -> 'message', 'post', 'names_group', 'names_nick', 'chatstate', 'url'
95
+
96
+ if prior = args.shift
97
+ if !prior.kind_of?(Numeric)
98
+ cmd = prior
99
+ if (prior = args.shift) && !prior.kind_of?(Numeric) # error
100
+ args.unshift(prior)
101
+ end
102
+ args.unshift(cmd)
103
+ end
104
+ prior ||= 50 # default priority
105
+ end
106
+
107
+ cmd = args.shift || blk
108
+
109
+ fail ArgumentError, "invalid arguments" unless args.empty?
110
+ fail ArgumentError, "no callback is given" unless cmd
111
+
112
+ _parse_hook_list(tk_send('hook', 'add', type, cmd, prior))
113
+ end
114
+
115
+ def hook_remove(type, cmd)
116
+ #type -> 'message', 'post', 'names_group', 'names_nick', 'chatstate', 'url'
117
+ _parse_hook_list(tk_send('hook', 'remove', type, cmd))
118
+ end
119
+
120
+ def hook_run(type, *cmd_args)
121
+ #type -> 'message', 'post', 'names_group', 'names_nick', 'chatstate', 'url'
122
+ tk_send('hook', 'run', type, *cmd_args)
123
+ end
124
+
125
+ def hook_list(type)
126
+ #type -> 'message', 'post', 'names_group', 'names_nick', 'chatstate', 'url'
127
+ _parse_hook_list(tk_send('hook', 'list', type))
128
+ end
129
+
130
+ def show_names
131
+ tk_send('names', 'show')
132
+ self
133
+ end
134
+
135
+ def hide_names
136
+ tk_send('names', 'hide')
137
+ self
138
+ end
139
+
140
+ def names_widget
141
+ window(tk_send('names'))
142
+ end
143
+
144
+ def entry_widget
145
+ window(tk_send('entry'))
146
+ end
147
+
148
+ def chat_widget
149
+ window(tk_send('chat'))
150
+ end
151
+ end
@@ -0,0 +1,117 @@
1
+ #
2
+ # tkextlib/tcllib/crosshair.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * Crosshairs for Tk canvas
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('crosshair', '1.0.2')
13
+ TkPackage.require('crosshair')
14
+
15
+ module Tk::Tcllib
16
+ module Crosshair
17
+ PACKAGE_NAME = 'crosshair'.freeze
18
+ def self.package_name
19
+ PACKAGE_NAME
20
+ end
21
+
22
+ def self.package_version
23
+ begin
24
+ TkPackage.require('crosshair')
25
+ rescue
26
+ ''
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ module Tk::Tcllib::Crosshair
33
+ include TkCore
34
+ TkCommandNames = ['::crosshair::crosshair'.freeze].freeze
35
+
36
+ def self.crosshair(w, keys={})
37
+ Tk.tk_call('::crosshair::crosshair', w, *hash_kv(keys))
38
+ w
39
+ end
40
+ def self.on(w, keys={})
41
+ self.crosshair(w, keys)
42
+ end
43
+
44
+ def self.off(w)
45
+ Tk.tk_call('::crosshair::off', w)
46
+ w
47
+ end
48
+
49
+ def self.track_on(w, &b)
50
+ Tk.tk_call('::crosshair::track_on', w, b)
51
+ w
52
+ end
53
+
54
+ def self.track_off(w)
55
+ Tk.tk_call('::crosshair::track_off', w)
56
+ w
57
+ end
58
+ end
59
+
60
+ class << Tk::Tcllib::Crosshair
61
+ include TkComm
62
+ include TkCanvasItemConfig
63
+
64
+ def __item_methodcall_optkeys(id)
65
+ {}
66
+ end
67
+ private :__item_methodcall_optkeys
68
+
69
+ def __item_config_cmd(id)
70
+ # maybe need to override
71
+ ['::crosshair::configure', id]
72
+ end
73
+ private :__item_config_cmd
74
+
75
+ private :itemcget_tkstring, :itemcget, :itemcget_strict
76
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
77
+
78
+ def confugure(w, slot, value=None)
79
+ itemconfigure(w, slot, value)
80
+ end
81
+ def confuginfo(w, slot = nil)
82
+ itemconfiginfo(w, slot)
83
+ end
84
+ def current_configinfo(w, slot = nil)
85
+ current_itemconfiginfo(w, slot)
86
+ end
87
+ def cget(w, slot)
88
+ current_itemconfiginfo(w, slot).values[0]
89
+ end
90
+ end
91
+
92
+ module Tk::Tcllib::Crosshair
93
+ def crosshair_on(keys={})
94
+ Tk::Tcllib::Crosshair.on(self, keys)
95
+ end
96
+ def crosshair_off
97
+ Tk::Tcllib::Crosshair.off(self)
98
+ end
99
+ def crosshair_track_on(&b)
100
+ Tk::Tcllib::Crosshair.track_on(self, &b)
101
+ end
102
+ def crosshair_track_off
103
+ Tk::Tcllib::Crosshair.track_off(self)
104
+ end
105
+ def crosshair_configure(*args)
106
+ Tk::Tcllib::Crosshair.configure(self, *args)
107
+ end
108
+ def crosshair_configinfo(slot = nil)
109
+ Tk::Tcllib::Crosshair.configinfo(self, slot)
110
+ end
111
+ def crosshair_current_configinfo(slot = nil)
112
+ Tk::Tcllib::Crosshair.current_configinfo(self, slot)
113
+ end
114
+ def crosshair_cget(slot)
115
+ Tk::Tcllib::Crosshair.cget(self, slot)
116
+ end
117
+ end
@@ -0,0 +1,62 @@
1
+ #
2
+ # tkextlib/tcllib/dateentry.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * dateentry widget
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('widget::dateentry', '0.91')
13
+ TkPackage.require('widget::dateentry')
14
+
15
+ module Tk::Tcllib
16
+ module Widget
17
+ class Dateentry < Tk::Tile::TEntry
18
+ PACKAGE_NAME = 'widget::dateentry'.freeze
19
+ def self.package_name
20
+ PACKAGE_NAME
21
+ end
22
+
23
+ def self.package_version
24
+ begin
25
+ TkPackage.require('widget::dateentry')
26
+ rescue
27
+ ''
28
+ end
29
+ end
30
+ end
31
+ DateEntry = Dateentry
32
+ end
33
+ end
34
+
35
+ class Tk::Tcllib::Widget::Dateentry
36
+ TkCommandNames = ['::widget::dateentry'.freeze].freeze
37
+
38
+ def __strval_optkeys
39
+ super() << ['dateformat']
40
+ end
41
+ private :__strval_optkeys
42
+
43
+ def create_self(keys)
44
+ if keys and keys != None
45
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
46
+ *hash_kv(keys, true))
47
+ else
48
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
49
+ end
50
+ end
51
+ private :create_self
52
+
53
+ def post
54
+ tk_send('post')
55
+ self
56
+ end
57
+
58
+ def unpost
59
+ tk_send('unpost')
60
+ self
61
+ end
62
+ end
@@ -0,0 +1,224 @@
1
+ #
2
+ # tkextlib/tcllib/diagrams.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * Draw diagrams
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('Diagrams', '0.3')
13
+ TkPackage.require('Diagrams')
14
+
15
+ module Tk::Tcllib
16
+ module Diagrams
17
+ PACKAGE_NAME = 'Diagrams'.freeze
18
+ def self.package_name
19
+ PACKAGE_NAME
20
+ end
21
+
22
+ def self.package_version
23
+ begin
24
+ TkPackage.require('Diagrams')
25
+ rescue
26
+ ''
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ class << Tk::Tcllib::Diagrams
33
+ include TkCore
34
+
35
+ def drawin(canvas)
36
+ tk_call('::Diagrams::drawin', canvas)
37
+ canvas
38
+ end
39
+ alias draw_in drawin
40
+
41
+ def saveps(filename)
42
+ tk_call('::Diagrams::saveps', filename)
43
+ filename
44
+ end
45
+ alias save_ps saveps
46
+
47
+ def direction(dir)
48
+ tk_call('::Diagrams::direction', dir)
49
+ dir
50
+ end
51
+
52
+ def currentpos(pos)
53
+ list(tk_call('::Diagrams::currentpos', pos))
54
+ end
55
+ alias current_pos currentpos
56
+ alias currentpos= currentpos
57
+ alias current_pos= currentpos
58
+
59
+ def getpos(anchor, obj)
60
+ list(tk_call('::Diagrams::getpos', anchor, obj))
61
+ end
62
+ alias get_pos getpos
63
+
64
+ def position(x, y)
65
+ list(tk_call('::Diagrams::position', x, y))
66
+ end
67
+
68
+ def box(text, width=nil, height=nil)
69
+ if width || height
70
+ width = '' unless width
71
+ height = '' unless height
72
+ list(tk_call('::Diagrams::box', text, width, height))
73
+ else
74
+ list(tk_call('::Diagrams::box', text))
75
+ end
76
+ end
77
+
78
+ def plaintext(text, width=nil, height=nil)
79
+ if width || height
80
+ width = '' unless width
81
+ height = '' unless height
82
+ list(tk_call('::Diagrams::plaintext', text, width, height))
83
+ else
84
+ list(tk_call('::Diagrams::plaintext', text))
85
+ end
86
+ end
87
+
88
+ def circle(text, radius=nil)
89
+ if radius
90
+ list(tk_call('::Diagrams::circle', text, radius))
91
+ else
92
+ list(tk_call('::Diagrams::circle', text))
93
+ end
94
+ end
95
+
96
+ def slanted(text, width=nil, height=nil, angle=nil)
97
+ if width || height || angle
98
+ width = '' unless width
99
+ height = '' unless height
100
+ if angle
101
+ list(tk_call('::Diagrams::slanted', text, width, height, angle))
102
+ else
103
+ list(tk_call('::Diagrams::slanted', text, width, height))
104
+ end
105
+ else
106
+ list(tk_call('::Diagrams::slanted', text))
107
+ end
108
+ end
109
+
110
+ def diamond(text, width=nil, height=nil)
111
+ if width || height
112
+ width = '' unless width
113
+ height = '' unless height
114
+ list(tk_call('::Diagrams::diamond', text, width, height))
115
+ else
116
+ list(tk_call('::Diagrams::diamond', text))
117
+ end
118
+ end
119
+
120
+ def drum(text, width=nil, height=nil)
121
+ if width || height
122
+ width = '' unless width
123
+ height = '' unless height
124
+ list(tk_call('::Diagrams::drum', text, width, height))
125
+ else
126
+ list(tk_call('::Diagrams::drum', text))
127
+ end
128
+ end
129
+
130
+ def arrow(text=nil, length=nil, head=nil)
131
+ if length || head
132
+ text = '' unless text
133
+ length = '' unless length
134
+ list(tk_call('::Diagrams::arrow', text, length, head))
135
+ else
136
+ if text
137
+ list(tk_call('::Diagrams::arrow', text))
138
+ else
139
+ list(tk_call('::Diagrams::arrow'))
140
+ end
141
+ end
142
+ end
143
+
144
+ def line(*args)
145
+ ary = []
146
+ args.each{|arg|
147
+ if arg.kind_of?(Array) && arg.length == 2 # [length, angle]
148
+ ary.concat arg
149
+ else # ["POSITION", x, y] or length or angle
150
+ ary << arg
151
+ end
152
+ }
153
+ list(tk_call('::Diagrams::line', *ary))
154
+ end
155
+
156
+ def bracket(dir, dist, from_pos, to_pos)
157
+ list(tk_call('::Diagrams::bracket', dir, dist, from_pos, to_pos))
158
+ end
159
+
160
+ def attach(anchor=None)
161
+ tk_call('::Diagrams::attach', anchor)
162
+ end
163
+
164
+ def color(name=None)
165
+ tk_call('::Diagrams::color', name)
166
+ end
167
+
168
+ def fillcolor(name=None)
169
+ tk_call('::Diagrams::fillcolor', name)
170
+ end
171
+
172
+ def textcolor(name=None)
173
+ tk_call('::Diagrams::textcolor', name)
174
+ end
175
+
176
+ def usegap(mode=None)
177
+ bool(tk_call('::Diagrams::usegap', mode))
178
+ end
179
+ alias use_gap usegap
180
+
181
+ def xgap(val=None)
182
+ number(tk_call('::Diagrams::xgap', val))
183
+ end
184
+
185
+ def ygap(val=None)
186
+ number(tk_call('::Diagrams::ygap', val))
187
+ end
188
+
189
+ def textfont(fnt=None)
190
+ tk_call('::Diagrams::textfont', fnt)
191
+ end
192
+
193
+ def linewidth(pixels=None)
194
+ number(tk_call('::Diagrams::linewidth', pixels))
195
+ end
196
+
197
+ def linestyle(style=None)
198
+ tk_call('::Diagrams::linestyle', style)
199
+ end
200
+
201
+ def pushstate
202
+ tk_call('::Diagrams::pushstate')
203
+ end
204
+ alias push_state pushstate
205
+
206
+ def popstate
207
+ tk_call('::Diagrams::popstate')
208
+ end
209
+ alias pop_state popstate
210
+
211
+ def computepos
212
+ list(tk_call('::Diagrams::computepos'))
213
+ end
214
+ alias compute_pos computepos
215
+
216
+ def boxcoords(x1, y1, x2, y2)
217
+ list(tk_call('::Diagrams::boxcoords', x1, y1, x2, y2))
218
+ end
219
+
220
+ def moveobject(obj)
221
+ list(tk_call('::Diagrams::moveobject', obj))
222
+ end
223
+ alias move_object moveobject
224
+ end