Module: TkcTagAccess

Includes:
TkComm, TkTreatTagFont
Included in:
TkcItem, TkcTag
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, _callback_entry?, _callback_entry_class?, _curr_cmd_id, _fromUTF8, _genobj_for_tkwidget, _next_cmd_id, _toUTF8, array2tk_list, #bind_all, #bind_append_all, #bind_remove_all, #bindinfo_all, bool, image_obj, install_cmd, #install_cmd, list, num_or_nil, num_or_str, number, procedure, simplelist, slice_ary, string, #subst, tk_tcl2ruby, uninstall_cmd, #uninstall_cmd, window

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_nil, num_or_nil, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd, untrust

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)"


197
198
199
200
201
202
203
# File 'lib/tk/canvastag.rb', line 197

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

#-@Object



221
222
223
# File 'lib/tk/canvastag.rb', line 221

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

#^(tag) ⇒ Object



213
214
215
216
217
218
219
# File 'lib/tk/canvastag.rb', line 213

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



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

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

#cget_strict(option) ⇒ Object



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

def cget_strict(option)
  @c.itemcget_strict(@id, option)
end

#cget_tkstring(option) ⇒ Object



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

def cget_tkstring(option)
  @c.itemcget_tkstring(@id, option)
end

#configinfo(key = nil) ⇒ Object

def configure(keys)

  @c.itemconfigure @id, keys
end


81
82
83
# File 'lib/tk/canvastag.rb', line 81

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

#configure(key, value = None) ⇒ Object



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

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

#coords(*args) ⇒ Object



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

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

#current_configinfo(key = nil) ⇒ Object



85
86
87
# File 'lib/tk/canvastag.rb', line 85

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

#dchars(first, last = None) ⇒ Object



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

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

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



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

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

#findObject Also known as: list



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

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

#focusObject



109
110
111
# File 'lib/tk/canvastag.rb', line 109

def focus
  @c.itemfocus(@id)
end

#gettagsObject



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

def gettags
  @c.gettags(@id)
end

#icursor(index) ⇒ Object



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

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

#imove(idx, x, y) ⇒ Object Also known as: i_move



122
123
124
125
126
# File 'lib/tk/canvastag.rb', line 122

def imove(idx, x, y)
  # Tcl/Tk 8.6 or later
  @c.imove(@id, idx, x, y)
  self
end

#index(idx) ⇒ Object



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

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

#insert(beforethis, string) ⇒ Object



133
134
135
136
# File 'lib/tk/canvastag.rb', line 133

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

#itemtypeObject



186
187
188
# File 'lib/tk/canvastag.rb', line 186

def itemtype
  @c.itemtype(@id)
end

#lower(belowthis = None) ⇒ Object



138
139
140
141
# File 'lib/tk/canvastag.rb', line 138

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

#move(xamount, yamount) ⇒ Object



143
144
145
146
# File 'lib/tk/canvastag.rb', line 143

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

#moveto(x, y) ⇒ Object Also known as: move_to



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

def moveto(x, y)
  # Tcl/Tk 8.6 or later
  @c.moveto(@id, x, y)
  self
end

#raise(abovethis = None) ⇒ Object



155
156
157
158
# File 'lib/tk/canvastag.rb', line 155

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

#rchars(first, last, str_or_coords) ⇒ Object Also known as: replace_chars, replace_coords



165
166
167
168
169
# File 'lib/tk/canvastag.rb', line 165

def rchars(first, last, str_or_coords)
  # Tcl/Tk 8.6 or later
  @c.rchars(@id, first, last, str_or_coords)
  self
end

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



160
161
162
163
# File 'lib/tk/canvastag.rb', line 160

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

#select_adjust(index) ⇒ Object



173
174
175
176
# File 'lib/tk/canvastag.rb', line 173

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

#select_from(index) ⇒ Object



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

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

#select_to(index) ⇒ Object



181
182
183
184
# File 'lib/tk/canvastag.rb', line 181

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

#|(tag) ⇒ Object



205
206
207
208
209
210
211
# File 'lib/tk/canvastag.rb', line 205

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