Module: TkcTagAccess

Includes:
TkComm, TkTreatTagFont
Defined in:
lib/tk/canvastag.rb,
lib/tk/canvastag.rb

Constant Summary

Constants included from TkComm

TkComm::GET_CONFIGINFO_AS_ARRAY, TkComm::GET_CONFIGINFOwoRES_AS_ARRAY, TkComm::TkExtlibAutoloadModule, TkComm::Tk_CMDTBL, TkComm::Tk_IDs, TkComm::Tk_WINDOWS, TkComm::USE_TCLs_LIST_FUNCTIONS, TkComm::WidgetClassNames

Constants included from TkUtil

TkUtil::None, TkUtil::RELEASE_DATE

Instance Method Summary collapse

Methods included from TkTreatTagFont

#font_configinfo, #font_configure, #font_copy, #kanjifont_configure, #kanjifont_copy, #latinfont_configure, #latinfont_copy

Methods included from TkComm

#_at, #bind_all, #bind_append_all, #bind_remove_all, #bindinfo_all, #image_obj, #install_cmd, #subst, #uninstall_cmd

Methods included from TkEvent

#install_bind, #install_bind_for_event_class

Methods included from TkUtil

_conv_args, #_conv_args, #_fromUTF8, _get_eval_enc_str, #_get_eval_enc_str, #_get_eval_string, _get_eval_string, _symbolkey2str, #_symbolkey2str, #_toUTF8, bool, #bool, callback, eval_cmd, #hash_kv, hash_kv, install_cmd, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd

Instance Method Details

#&(tag) ⇒ Object

Following operators support logical expressions of canvas tags (for Tk8.3+). If tag1.path is 't1' and tag2.path is 't2', then

ltag = tag1 & tag2; ltag.path => "(t1)&&(t2)"
ltag = tag1 | tag2; ltag.path => "(t1)||(t2)"
ltag = tag1 ^ tag2; ltag.path => "(t1)^(t2)"
ltag = - tag1;      ltag.path => "!(t1)"


169
170
171
172
173
174
175
# File 'lib/tk/canvastag.rb', line 169

def & (tag)
  if tag.kind_of? TkObject
    TkcTagString.new(@c, '(' + @id + ')&&(' + tag.path + ')')
  else
    TkcTagString.new(@c, '(' + @id + ')&&(' + tag.to_s + ')')
  end
end

#-@Object



193
194
195
# File 'lib/tk/canvastag.rb', line 193

def -@
  TkcTagString.new(@c, '!(' + @id + ')')
end

#^(tag) ⇒ Object



185
186
187
188
189
190
191
# File 'lib/tk/canvastag.rb', line 185

def ^ (tag)
  if tag.kind_of? TkObject
    TkcTagString.new(@c, '(' + @id + ')^(' + tag.path + ')')
  else
    TkcTagString.new(@c, '(' + @id + ')^(' + tag.to_s + ')')
  end
end

#addtag(tag) ⇒ Object



15
16
17
18
# File 'lib/tk/canvastag.rb', line 15

def addtag(tag)
  @c.addtag(tag, 'withtag', @id)
  self
end

#bboxObject



20
21
22
# File 'lib/tk/canvastag.rb', line 20

def bbox
  @c.bbox(@id)
end

#bind(seq, *args) ⇒ Object

def bind(seq, cmd=Proc.new, *args)

@c.itembind(@id, seq, cmd, *args)
self

end



28
29
30
31
32
33
34
35
36
37
# File 'lib/tk/canvastag.rb', line 28

def bind(seq, *args)
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
  if TkComm._callback_entry?(args[0]) || !block_given?
    cmd = args.shift
  else
    cmd = Proc.new
  end
  @c.itembind(@id, seq, cmd, *args)
  self
end

#bind_append(seq, *args) ⇒ Object

def bind_append(seq, cmd=Proc.new, *args)

@c.itembind_append(@id, seq, cmd, *args)
self

end



43
44
45
46
47
48
49
50
51
52
# File 'lib/tk/canvastag.rb', line 43

def bind_append(seq, *args)
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
  if TkComm._callback_entry?(args[0]) || !block_given?
    cmd = args.shift
  else
    cmd = Proc.new
  end
  @c.itembind_append(@id, seq, cmd, *args)
  self
end

#bind_remove(seq) ⇒ Object



54
55
56
57
# File 'lib/tk/canvastag.rb', line 54

def bind_remove(seq)
  @c.itembind_remove(@id, seq)
  self
end

#bindinfo(seq = nil) ⇒ Object



59
60
61
# File 'lib/tk/canvastag.rb', line 59

def bindinfo(seq=nil)
  @c.itembindinfo(@id, seq)
end

#cget(option) ⇒ Object



63
64
65
# File 'lib/tk/canvastag.rb', line 63

def cget(option)
  @c.itemcget(@id, option)
end

#configinfo(key = nil) ⇒ Object

def configure(keys)

  @c.itemconfigure @id, keys
end


75
76
77
# File 'lib/tk/canvastag.rb', line 75

def configinfo(key=nil)
  @c.itemconfiginfo(@id, key)
end

#configure(key, value = None) ⇒ Object



67
68
69
70
# File 'lib/tk/canvastag.rb', line 67

def configure(key, value=None)
  @c.itemconfigure(@id, key, value)
  self
end

#coords(*args) ⇒ Object



83
84
85
# File 'lib/tk/canvastag.rb', line 83

def coords(*args)
  @c.coords(@id, *args)
end

#current_configinfo(key = nil) ⇒ Object



79
80
81
# File 'lib/tk/canvastag.rb', line 79

def current_configinfo(key=nil)
  @c.current_itemconfiginfo(@id, key)
end

#dchars(first, last = None) ⇒ Object



87
88
89
90
# File 'lib/tk/canvastag.rb', line 87

def dchars(first, last=None)
  @c.dchars(@id, first, last)
  self
end

#dtag(tag_to_del = None) ⇒ Object Also known as: deltag



92
93
94
95
# File 'lib/tk/canvastag.rb', line 92

def dtag(tag_to_del=None)
  @c.dtag(@id, tag_to_del)
  self
end

#findObject Also known as: list



98
99
100
# File 'lib/tk/canvastag.rb', line 98

def find
  @c.find('withtag', @id)
end

#focusObject



103
104
105
# File 'lib/tk/canvastag.rb', line 103

def focus
  @c.itemfocus(@id)
end

#gettagsObject



107
108
109
# File 'lib/tk/canvastag.rb', line 107

def gettags
  @c.gettags(@id)
end

#icursor(index) ⇒ Object



111
112
113
114
# File 'lib/tk/canvastag.rb', line 111

def icursor(index)
  @c.icursor(@id, index)
  self
end

#index(idx) ⇒ Object



116
117
118
# File 'lib/tk/canvastag.rb', line 116

def index(idx)
  @c.index(@id, idx)
end

#insert(beforethis, string) ⇒ Object



120
121
122
123
# File 'lib/tk/canvastag.rb', line 120

def insert(beforethis, string)
  @c.insert(@id, beforethis, string)
  self
end

#itemtypeObject



158
159
160
# File 'lib/tk/canvastag.rb', line 158

def itemtype
  @c.itemtype(@id)
end

#lower(belowthis = None) ⇒ Object



125
126
127
128
# File 'lib/tk/canvastag.rb', line 125

def lower(belowthis=None)
  @c.lower(@id, belowthis)
  self
end

#move(xamount, yamount) ⇒ Object



130
131
132
133
# File 'lib/tk/canvastag.rb', line 130

def move(xamount, yamount)
  @c.move(@id, xamount, yamount)
  self
end

#raise(abovethis = None) ⇒ Object



135
136
137
138
# File 'lib/tk/canvastag.rb', line 135

def raise(abovethis=None)
  @c.raise(@id, abovethis)
  self
end

#scale(xorigin, yorigin, xscale, yscale) ⇒ Object



140
141
142
143
# File 'lib/tk/canvastag.rb', line 140

def scale(xorigin, yorigin, xscale, yscale)
  @c.scale(@id, xorigin, yorigin, xscale, yscale)
  self
end

#select_adjust(index) ⇒ Object



145
146
147
148
# File 'lib/tk/canvastag.rb', line 145

def select_adjust(index)
  @c.select('adjust', @id, index)
  self
end

#select_from(index) ⇒ Object



149
150
151
152
# File 'lib/tk/canvastag.rb', line 149

def select_from(index)
  @c.select('from', @id, index)
  self
end

#select_to(index) ⇒ Object



153
154
155
156
# File 'lib/tk/canvastag.rb', line 153

def select_to(index)
  @c.select('to', @id, index)
  self
end

#|(tag) ⇒ Object



177
178
179
180
181
182
183
# File 'lib/tk/canvastag.rb', line 177

def | (tag)
  if tag.kind_of? TkObject
    TkcTagString.new(@c, '(' + @id + ')||(' + tag.path + ')')
  else
    TkcTagString.new(@c, '(' + @id + ')||(' + tag.to_s + ')')
  end
end