Module: TkcTagAccess

Includes:
TkComm, TkTreatTagFont
Included in:
TkcItem, TkcTag
Defined in:
ext/lib/tk/canvastag.rb,
ext/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_str, number, procedure, simplelist, string, #subst, tk_tcl2ruby, uninstall_cmd, #uninstall_cmd, window

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

Methods included from TkEvent

#install_bind, #install_bind_for_event_class

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


172
173
174
175
176
177
178
# File 'ext/lib/tk/canvastag.rb', line 172

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

#-@Object



196
197
198
# File 'ext/lib/tk/canvastag.rb', line 196

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

#^(tag) ⇒ Object



188
189
190
191
192
193
194
# File 'ext/lib/tk/canvastag.rb', line 188

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 'ext/lib/tk/canvastag.rb', line 15

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

#bboxObject



20
21
22
# File 'ext/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 'ext/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 'ext/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 'ext/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 'ext/lib/tk/canvastag.rb', line 59

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

#cget(option) ⇒ Object



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

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

#cget_strict(option) ⇒ Object



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

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

#configinfo(key = nil) ⇒ Object

end



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

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

#configure(key, value = None) ⇒ Object



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

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

#coords(*args) ⇒ Object



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

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

#current_configinfo(key = nil) ⇒ Object



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

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

#dchars(first, last = None) ⇒ Object



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

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

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



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

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

#findObject Also known as: list



101
102
103
# File 'ext/lib/tk/canvastag.rb', line 101

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

#focusObject



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

def focus
  @c.itemfocus(@id)
end

#gettagsObject



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

def gettags
  @c.gettags(@id)
end

#icursor(index) ⇒ Object



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

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

#index(idx) ⇒ Object



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

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

#insert(beforethis, string) ⇒ Object



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

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

#itemtypeObject



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

def itemtype
  @c.itemtype(@id)
end

#lower(belowthis = None) ⇒ Object



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

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

#move(xamount, yamount) ⇒ Object



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

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

#raise(abovethis = None) ⇒ Object



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

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

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



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

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

#select_adjust(index) ⇒ Object



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

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

#select_from(index) ⇒ Object



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

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

#select_to(index) ⇒ Object



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

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

#|(tag) ⇒ Object



180
181
182
183
184
185
186
# File 'ext/lib/tk/canvastag.rb', line 180

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