2
# tkextlib/iwidgets/tabnotebook.rb
3
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
7
require 'tkextlib/iwidgets.rb'
11
class Tabnotebook < Tk::Itk::Widget
16
class Tk::Iwidgets::Tabnotebook
17
TkCommandNames = ['::iwidgets::tabnotebook'.freeze].freeze
18
WidgetClassName = 'Tabnotebook'.freeze
19
WidgetClassNames[WidgetClassName] = self
21
####################################
23
include TkItemConfigMethod
25
def __item_cget_cmd(id)
26
[self.path, 'pagecget', id]
28
private :__item_cget_cmd
30
def __item_config_cmd(id)
31
[self.path, 'pageconfigure', id]
33
private :__item_config_cmd
35
def __item_strval_optkeys(id)
36
super(id) << 'tabbackground' << 'tabforeground'
38
private :__item_strval_optkeys
41
if tagOrId.kind_of?(Tk::Itk::Component)
44
#_get_eval_string(tagOrId)
49
alias pagecget itemcget
50
alias pageconfigure itemconfigure
51
alias pageconfiginfo itemconfiginfo
52
alias current_pageconfiginfo current_itemconfiginfo
54
private :itemcget, :itemconfigure
55
private :itemconfiginfo, :current_itemconfiginfo
57
####################################
60
super() << 'auto' << 'equaltabs' << 'raiseselect' << 'tabborders'
62
private :__boolval_optkeys
65
super() << 'backdrop' << 'tabbackground' << 'tabforeground'
67
private :__strval_optkeys
71
@tabset = self.component_widget('tabset')
75
window(tk_call(@path, 'add', *hash_kv(keys)))
79
list(tk_call(@path, 'childsite'))
83
window(tk_call(@path, 'childsite', index(idx)))
86
def delete(idx1, idx2=nil)
88
tk_call(@path, 'delete', index(idx1), index(idx2))
90
tk_call(@path, 'delete', index(idx1))
96
#number(tk_call(@path, 'index', tagid(idx)))
97
@tabset.index(tagid(idx))
100
def insert(idx, keys={})
101
window(tk_call(@path, 'insert', index(idx), *hash_kv(keys)))
105
tk_call(@path, 'next')
110
tk_call(@path, 'prev')
115
tk_call(@path, 'select', index(idx))
119
def scrollcommand(cmd=Proc.new)
120
configure_cmd 'scrollcommand', cmd
123
alias xscrollcommand scrollcommand
124
alias yscrollcommand scrollcommand
126
def xscrollbar(bar=nil)
129
@scrollbar.orient 'horizontal'
130
self.scrollcommand {|*arg| @scrollbar.set(*arg)}
131
@scrollbar.command {|*arg| self.xview(*arg)}
132
Tk.update # avoid scrollbar trouble
136
def yscrollbar(bar=nil)
139
@scrollbar.orient 'vertical'
140
self.scrollcommand {|*arg| @scrollbar.set(*arg)}
141
@scrollbar.command {|*arg| self.yview(*arg)}
142
Tk.update # avoid scrollbar trouble
146
alias scrollbar yscrollbar
150
window(tk_send_without_enc('view'))
152
tk_send_without_enc('view', *index)
159
def view_moveto(*index)
160
view('moveto', *index)
162
alias xview_moveto view_moveto
163
alias yview_moveto view_moveto
164
def view_scroll(*index)
165
view('scroll', *index)
167
alias xview_scroll view_scroll
168
alias yview_scroll view_scroll