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,68 @@
1
+ #
2
+ # tkextlib/tcllib/khim.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * Kevin's Hacky Input Method
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('khim', '1.0')
13
+ TkPackage.require('khim')
14
+
15
+ module Tk::Tcllib
16
+ class KHIM < TkToplevel
17
+ PACKAGE_NAME = 'khim'.freeze
18
+ def self.package_name
19
+ PACKAGE_NAME
20
+ end
21
+
22
+ def self.package_version
23
+ begin
24
+ TkPackage.require('khim')
25
+ rescue
26
+ ''
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ class Tk::Tcllib::KHIM
33
+ TkCommandNames = ['::khim::getOptions'.freeze].freeze
34
+
35
+ def self.get_options(parent='')
36
+ path = parent + '.tcllib_widget_khim_dialog'
37
+ self.new(:widgetname => path)
38
+ end
39
+
40
+ def self.get_config #=> cmd_string
41
+ Tk.tk_call_without_enc('::khim::getConfig')
42
+ end
43
+
44
+ def self.set_config(*args)
45
+ if args.length == 1
46
+ # cmd_string generated by
47
+ #Tk.ip_eval_without_enc(cmd_string)
48
+ Tk.ip_eval(cmd_string)
49
+ else
50
+ # args for setConfig command
51
+ #Tk.tk_call_without_enc('::khim::setConfig', *args)
52
+ Tk.tk_call('::khim::setConfig', *args)
53
+ end
54
+ end
55
+
56
+ def self.showHelp
57
+ Tk::Tcllib::KHIM::Help.new
58
+ end
59
+
60
+ def create_self(keys=None)
61
+ @db_class = @classname = nil
62
+ super(None) # ignore keys
63
+ end
64
+ end
65
+
66
+ class Tk::Tcllib::KHIM::Help < TkToplevel
67
+ TkCommandNames = ['::khim::showHelp'.freeze].freeze
68
+ end
@@ -0,0 +1,47 @@
1
+ #
2
+ # tkextlib/tcllib/menuentry.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * menuentry widget
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('widget::menuentry', '1.0')
13
+ TkPackage.require('widget::menuentry')
14
+
15
+ module Tk::Tcllib
16
+ module Widget
17
+ class Menuentry < Tk::Tile::TEntry
18
+ PACKAGE_NAME = 'widget::menuentry'.freeze
19
+ def self.package_name
20
+ PACKAGE_NAME
21
+ end
22
+
23
+ def self.package_version
24
+ begin
25
+ TkPackage.require('widget::menuentry')
26
+ rescue
27
+ ''
28
+ end
29
+ end
30
+ end
31
+ MenuEntry = Menuentry
32
+ end
33
+ end
34
+
35
+ class Tk::Tcllib::Widget::Menuentry
36
+ TkCommandNames = ['::widget::menuentry'.freeze].freeze
37
+
38
+ def create_self(keys)
39
+ if keys and keys != None
40
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
41
+ *hash_kv(keys, true))
42
+ else
43
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
44
+ end
45
+ end
46
+ private :create_self
47
+ end
@@ -0,0 +1,146 @@
1
+ #
2
+ # tkextlib/tcllib/ntext.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * Ntext bindtag
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('ntext', '0.81')
13
+ TkPackage.require('ntext')
14
+
15
+ module Tk::Tcllib
16
+ Ntext = TkBindTag.new_by_name('Ntext')
17
+ end
18
+
19
+ # variables
20
+ Tk::Tcllib::Ntext.instance_eval{
21
+ # boolean
22
+ @classicAnchor = TkVarAccess.new('::ntext::classicAnchor')
23
+ @classicExtras = TkVarAccess.new('::ntext::classicExtras')
24
+ @classicMouseSelect = TkVarAccess.new('::ntext::classicMouseSelect')
25
+ @classicWordBreak = TkVarAccess.new('::ntext::classicWordBreak')
26
+ @classicWrap = TkVarAccess.new('::ntext::classicWrap')
27
+ @overwrite = TkVarAccess.new('::ntext::overwrite')
28
+
29
+ # regexp
30
+ @newWrapRegexp = TkVarAccess.new('::ntext::newWrapRegexp')
31
+
32
+ # variables (advanced use)
33
+ @tcl_match_wordBreakAfter = TkVarAccess.new('::ntext::tcl_match_wordBreakAfter')
34
+ @tcl_match_wordBreakBefore = TkVarAccess.new('::ntext::tcl_match_wordBreakBefore')
35
+ @tcl_match_endOfWord = TkVarAccess.new('::ntext::tcl_match_endOfWord')
36
+ @tcl_match_startOfNextWord = TkVarAccess.new('::ntext::tcl_match_startOfNextWord')
37
+ @tcl_match_startOfPreviousWord = TkVarAccess.new('::ntext::tcl_match_startOfPreviousWord')
38
+ }
39
+
40
+ class << Tk::Tcllib::Ntext
41
+ def wrapIndent(txt, *args)
42
+ TK.tk_call('::next::wrapIndent', txt, *args)
43
+ end
44
+
45
+ def initializeMatchPatterns
46
+ TK.tk_call('::next::initializeMatchPatterns')
47
+ self
48
+ end
49
+
50
+ def createMatchPatterns(*args)
51
+ TK.tk_call('::next::createMatchPatterns', *args)
52
+ self
53
+ end
54
+
55
+ # functions (advanced use)
56
+ #ntext::new_wordBreakAfter
57
+ #ntext::new_wordBreakBefore
58
+ #ntext::new_endOfWord
59
+ #ntext::new_startOfNextWord
60
+ #ntext::new_startOfPreviousWord
61
+
62
+ # accessor
63
+ def classicAnchor
64
+ @classicAnchor.bool
65
+ end
66
+ def classicAnchor=(mode)
67
+ @classicAnchor.bool = mode
68
+ end
69
+
70
+ def classicExtras
71
+ @classicExtras.bool
72
+ end
73
+ def classicExtras=(mode)
74
+ @classicExtras.bool = mode
75
+ end
76
+
77
+ def classicMouseSelect
78
+ @classicMouseSelect.bool
79
+ end
80
+ def classicMouseSelect=(mode)
81
+ @classicMouseSelect.bool = mode
82
+ end
83
+
84
+ def classicWordBreak
85
+ @classicWordBreak.bool
86
+ end
87
+ def classicWordBreak=(mode)
88
+ @classicWordBreak.bool = mode
89
+ end
90
+
91
+ def classicWrap
92
+ @classicWrap.bool
93
+ end
94
+ def classicWrap=(mode)
95
+ @classicWrap.bool = mode
96
+ end
97
+
98
+ def overwrite
99
+ @overwrite.bool
100
+ end
101
+ def overwrite=(mode)
102
+ @classic.bool = mode
103
+ end
104
+
105
+ def newWrapRegexp
106
+ @newWrapRegexp.value
107
+ end
108
+ def newWrapRegexp=(val)
109
+ @newWrapRegexp.value = val
110
+ end
111
+
112
+ def tcl_match_wordBreakAfter
113
+ @tcl_match_wordBreakAfter.value
114
+ end
115
+ def tcl_match_wordBreakAfter=(val)
116
+ @tcl_match_wordBreakAfter.value = val
117
+ end
118
+
119
+ def tcl_match_wordBreakBefore
120
+ @tcl_match_wordBreakBefore.value
121
+ end
122
+ def tcl_match_wordBreakBefore=(val)
123
+ @tcl_match_wordBreakBefore.value = val
124
+ end
125
+
126
+ def tcl_match_endOfWord
127
+ @tcl_match_endOfWord.value
128
+ end
129
+ def tcl_match_endOfWord=(val)
130
+ @tcl_match_endOfWord.value = val
131
+ end
132
+
133
+ def tcl_match_startOfNextWord
134
+ @tcl_match_startOfNextWord.value
135
+ end
136
+ def tcl_match_startOfNextWord=(val)
137
+ @tcl_match_startOfNextWord.value = val
138
+ end
139
+
140
+ def tcl_match_startOfPreviousWord
141
+ @tcl_match_startOfPreviousWord.value
142
+ end
143
+ def tcl_match_startOfPreviousWord=(val)
144
+ @tcl_match_startOfPreviousWord.value = val
145
+ end
146
+ end
@@ -0,0 +1,57 @@
1
+ #
2
+ # tkextlib/tcllib/scrolledwindow.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * scrolledwindow widget
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('widget::scrolledwindow', '1.2')
13
+ TkPackage.require('widget::scrolledwindow')
14
+
15
+ module Tk::Tcllib
16
+ module Widget
17
+ class Scrolledwindow < Tk::Tile::TFrame
18
+ PACKAGE_NAME = 'widget::scrolledwindow'.freeze
19
+ def self.package_name
20
+ PACKAGE_NAME
21
+ end
22
+
23
+ def self.package_version
24
+ begin
25
+ TkPackage.require('widget::scrolledwindow')
26
+ rescue
27
+ ''
28
+ end
29
+ end
30
+ end
31
+ ScrolledWindow = Scrolledwindow
32
+ end
33
+ end
34
+
35
+ class Tk::Tcllib::Widget::ScrolledWindow
36
+ TkCommandNames = ['::widget::scrolledwindow'.freeze].freeze
37
+
38
+ def create_self(keys)
39
+ if keys and keys != None
40
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
41
+ *hash_kv(keys, true))
42
+ else
43
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
44
+ end
45
+ end
46
+ private :create_self
47
+
48
+ def getframe
49
+ window(tk_send_without_enc('getframe'))
50
+ end
51
+ alias get_frame getframe
52
+
53
+ def setwidget(w)
54
+ window(tk_send_without_enc('setwidget', w))
55
+ end
56
+ alias set_widget setwidget
57
+ end
@@ -0,0 +1,79 @@
1
+ #
2
+ # tkextlib/tcllib/statusbar.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * statusbar widget
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('widget::statusbar', '1.2')
13
+ TkPackage.require('widget::statusbar')
14
+
15
+ module Tk::Tcllib
16
+ module Widget
17
+ class Statusbar < Tk::Tile::TFrame
18
+ PACKAGE_NAME = 'widget::statusbar'.freeze
19
+ def self.package_name
20
+ PACKAGE_NAME
21
+ end
22
+
23
+ def self.package_version
24
+ begin
25
+ TkPackage.require('widget::statusbar')
26
+ rescue
27
+ ''
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ class Tk::Tcllib::Widget::Statusbar
35
+ TkCommandNames = ['::widget::statusbar'.freeze].freeze
36
+
37
+ def __boolval_optkeys
38
+ super() << 'separator' << 'resize' << 'resizeseparator'
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 getframe
53
+ window(tk_send_without_enc('getframe'))
54
+ end
55
+ alias get_frame getframe
56
+
57
+ def add(w, keys={})
58
+ window(tk_send_without_enc('setwidget', *(hash_kv(keys))))
59
+ end
60
+
61
+ def remove(*wins)
62
+ tk_send_without_enc('remove', *wins)
63
+ self
64
+ end
65
+
66
+ def remove_with_destroy(*wins)
67
+ tk_send_without_enc('remove', '-destroy', *wins)
68
+ self
69
+ end
70
+
71
+ def delete(*wins)
72
+ tk_send_without_enc('delete', *wins)
73
+ self
74
+ end
75
+
76
+ def items(pat=None)
77
+ tk_split_list(tk_send('items', pat))
78
+ end
79
+ end
@@ -0,0 +1,175 @@
1
+ #
2
+ # tkextlib/tcllib/toolbar.rb
3
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4
+ #
5
+ # * Part of tcllib extension
6
+ # * toolbar widget
7
+ #
8
+
9
+ require 'tk'
10
+ require 'tkextlib/tcllib.rb'
11
+
12
+ # TkPackage.require('widget::toolbar', '1.2')
13
+ TkPackage.require('widget::toolbar')
14
+
15
+ module Tk::Tcllib
16
+ module Widget
17
+ class Toolbar < TkWindow
18
+ PACKAGE_NAME = 'widget::toolbar'.freeze
19
+ def self.package_name
20
+ PACKAGE_NAME
21
+ end
22
+
23
+ def self.package_version
24
+ begin
25
+ TkPackage.require('widget::toolbar')
26
+ rescue
27
+ ''
28
+ end
29
+ end
30
+ end
31
+
32
+ module ToolbarItemConfig
33
+ include TkItemConfigMethod
34
+ end
35
+ end
36
+ end
37
+
38
+
39
+ class Tk::Tcllib::Widget::ToolbarItem < TkObject
40
+ include TkTreatTagFont
41
+
42
+ ToolbarItemID_TBL = TkCore::INTERP.create_table
43
+
44
+ TkCore::INTERP.init_ip_env{
45
+ TTagID_TBL.mutex.synchronize{ TTagID_TBL.clear }
46
+ }
47
+
48
+ def ToolbarItem.id2obj(tbar, id)
49
+ tpath = tbar.path
50
+ ToolbarItemID_TBL.mutex.synchronize{
51
+ if ToolbarItemID_TBL[tpath]
52
+ ToolbarItemID_TBL[tpath][id]? ToolbarItemID_TBL[tpath][id]: id
53
+ else
54
+ id
55
+ end
56
+ }
57
+ end
58
+
59
+ def initaialize(parent, *args)
60
+ @parent = @t = parent
61
+ @tpath = parent.path
62
+
63
+ @path = @id = @t.tk_send('add', *args)
64
+ # A same id is rejected by the Tcl function.
65
+
66
+ ToolbarItemID_TBL.mutex.synchronize{
67
+ ToolbarItemID_TBL[@id] = self
68
+ ToolbarItemID_TBL[@tpath] = {} unless ToolbarItemID_TBL[@tpath]
69
+ ToolbarItemID_TBL[@tpath][@id] = self
70
+ }
71
+ end
72
+
73
+ def [](key)
74
+ cget key
75
+ end
76
+
77
+ def []=(key,val)
78
+ configure key, val
79
+ val
80
+ end
81
+
82
+ def cget_tkstring(option)
83
+ @t.itemcget_tkstring(@id, option)
84
+ end
85
+ def cget(option)
86
+ @t.itemcget(@id, option)
87
+ end
88
+ def cget_strict(option)
89
+ @t.itemcget_strict(@id, option)
90
+ end
91
+
92
+ def configure(key, value=None)
93
+ @t.itemconfigure(@id, key, value)
94
+ self
95
+ end
96
+
97
+ def configinfo(key=nil)
98
+ @t.itemconfiginfo(@id, key)
99
+ end
100
+
101
+ def current_configinfo(key=nil)
102
+ @t.current_itemconfiginfo(@id, key)
103
+ end
104
+
105
+ def delete
106
+ @t.delete(@id)
107
+ end
108
+
109
+ def itemid
110
+ @t.itemid(@id)
111
+ end
112
+
113
+ def remove
114
+ @t.remove(@id)
115
+ end
116
+ def remove_with_destroy
117
+ @t.remove_with_destroy(@id)
118
+ end
119
+ end
120
+
121
+ class Tk::Tcllib::Widget::Toolbar
122
+ include Tk::Tcllib::Widget::ToolbarItemConfig
123
+
124
+ TkCommandNames = ['::widget::toolbar'.freeze].freeze
125
+
126
+ def __destroy_hook__
127
+ Tk::Tcllib::Widget::ToolbarItem::ToolbarItemID_TBL.mutex.synchronize{
128
+ Tk::Tcllib::Widget::ToolbarItem::ToolbarItemID_TBL.delete(@path)
129
+ }
130
+ end
131
+
132
+ def create_self(keys)
133
+ if keys and keys != None
134
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
135
+ *hash_kv(keys, true))
136
+ else
137
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
138
+ end
139
+ end
140
+ private :create_self
141
+
142
+ def getframe
143
+ window(tk_send('getframe'))
144
+ end
145
+ alias get_frame getframe
146
+
147
+ def add(*args)
148
+ Tk::Tcllib::Widget::Toolbar.new(self, *args)
149
+ end
150
+
151
+ def itemid(item)
152
+ window(tk_send('itemid'))
153
+ end
154
+
155
+ def items(pattern)
156
+ tk_split_simplelist(tk_send('items', pattern)).map{|id|
157
+ Tk::Tcllib::Widget::ToolbarItem.id2obj(self, id)
158
+ }
159
+ end
160
+
161
+ def remove(*items)
162
+ tk_send('remove', *items)
163
+ self
164
+ end
165
+
166
+ def remove_with_destroy(*items)
167
+ tk_send('remove', '-destroy', *items)
168
+ self
169
+ end
170
+
171
+ def delete(*items)
172
+ tk_send('delete', *items)
173
+ self
174
+ end
175
+ end