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


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

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

#-@Object



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

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

#^(tag) ⇒ Object



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

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



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

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

#bboxObject



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

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



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

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



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

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



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

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

#bindinfo(seq = nil) ⇒ Object



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

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

#cget(option) ⇒ Object



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

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

#cget_strict(option) ⇒ Object



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

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

#cget_tkstring(option) ⇒ Object



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

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

#configinfo(key = nil) ⇒ Object

def configure(keys)

  @c.itemconfigure @id, keys
end


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

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

#configure(key, value = None) ⇒ Object



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

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

#coords(*args) ⇒ Object



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

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

#current_configinfo(key = nil) ⇒ Object



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

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

#dchars(first, last = None) ⇒ Object



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

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

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



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

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

#findObject Also known as: list



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

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

#focusObject



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

def focus
  @c.itemfocus(@id)
end

#gettagsObject



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

def gettags
  @c.gettags(@id)
end

#icursor(index) ⇒ Object



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

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

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



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

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

#index(idx) ⇒ Object



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

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

#insert(beforethis, string) ⇒ Object



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

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

#itemtypeObject



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

def itemtype
  @c.itemtype(@id)
end

#lower(belowthis = None) ⇒ Object



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

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

#move(xamount, yamount) ⇒ Object



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

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

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



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

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

#raise(abovethis = None) ⇒ Object



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

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

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



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

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



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

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

#select_adjust(index) ⇒ Object



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

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

#select_from(index) ⇒ Object



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

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

#select_to(index) ⇒ Object



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

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

#|(tag) ⇒ Object



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

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