Module: Tk::Tcllib::Diagrams

Extended by:
TkCore
Defined in:
lib/tkextlib/tcllib/diagrams.rb

Constant Summary collapse

PACKAGE_NAME =
'Diagrams'.freeze

Constants included from TkCore

TkCore::EventFlag, TkCore::INTERP, TkCore::INTERP_MUTEX, TkCore::INTERP_ROOT_CHECK, TkCore::INTERP_THREAD, TkCore::INTERP_THREAD_STATUS, TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD, TkCore::WIDGET_DESTROY_HOOK, TkCore::WITH_ENCODING, TkCore::WITH_RUBY_VM

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

Class Method Summary collapse

Methods included from TkCore

_tk_call_to_list_core, after, after_cancel, after_idle, appname, appsend, appsend_deny, appsend_displayof, callback, callback_break, callback_continue, callback_return, chooseColor, chooseDirectory, do_one_event, event_generate, getMultipleOpenFile, getMultipleSaveFile, getOpenFile, getSaveFile, get_eventloop_tick, get_eventloop_weight, get_no_event_wait, inactive, inactive_displayof, info, ip_eval, ip_eval_with_enc, ip_eval_without_enc, ip_invoke, ip_invoke_with_enc, ip_invoke_without_enc, is_mainloop?, load_cmd_on_ip, mainloop, mainloop_exist?, mainloop_thread?, mainloop_watchdog, messageBox, rb_appsend, rb_appsend_displayof, reset_inactive, reset_inactive_displayof, restart, scaling, scaling_displayof, set_eventloop_tick, set_eventloop_weight, set_no_event_wait, tk_call, tk_call_to_list, tk_call_to_list_with_enc, tk_call_to_list_without_enc, tk_call_to_simplelist, tk_call_to_simplelist_with_enc, tk_call_to_simplelist_without_enc, tk_call_with_enc, tk_call_without_enc, windowingsystem

Methods included from TkComm

_at, _callback_entry?, _callback_entry_class?, _curr_cmd_id, _fromUTF8, _genobj_for_tkwidget, _next_cmd_id, _toUTF8, array2tk_list, #bind, #bind_all, #bind_append, #bind_append_all, #bind_remove, #bind_remove_all, #bindinfo, #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

Class Method Details

.arrow(text = nil, length = nil, head = nil) ⇒ Object


131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/tkextlib/tcllib/diagrams.rb', line 131

def arrow(text=nil, length=nil, head=nil)
  if length || head
    text   = '' unless text
    length = '' unless length
    list(tk_call('::Diagrams::arrow', text, length, head))
  else
    if text
      list(tk_call('::Diagrams::arrow', text))
    else
      list(tk_call('::Diagrams::arrow'))
    end
  end
end

.attach(anchor = None) ⇒ Object


161
162
163
# File 'lib/tkextlib/tcllib/diagrams.rb', line 161

def attach(anchor=None)
  tk_call('::Diagrams::attach', anchor)
end

.box(text, width = nil, height = nil) ⇒ Object


69
70
71
72
73
74
75
76
77
# File 'lib/tkextlib/tcllib/diagrams.rb', line 69

def box(text, width=nil, height=nil)
  if width || height
    width  = '' unless width
    height = '' unless height
    list(tk_call('::Diagrams::box', text, width, height))
  else
    list(tk_call('::Diagrams::box', text))
  end
end

.boxcoords(x1, y1, x2, y2) ⇒ Object


217
218
219
# File 'lib/tkextlib/tcllib/diagrams.rb', line 217

def boxcoords(x1, y1, x2, y2)
  list(tk_call('::Diagrams::boxcoords', x1, y1, x2, y2))
end

.bracket(dir, dist, from_pos, to_pos) ⇒ Object


157
158
159
# File 'lib/tkextlib/tcllib/diagrams.rb', line 157

def bracket(dir, dist, from_pos, to_pos)
  list(tk_call('::Diagrams::bracket', dir, dist, from_pos, to_pos))
end

.circle(text, radius = nil) ⇒ Object


89
90
91
92
93
94
95
# File 'lib/tkextlib/tcllib/diagrams.rb', line 89

def circle(text, radius=nil)
  if radius
    list(tk_call('::Diagrams::circle', text, radius))
  else
    list(tk_call('::Diagrams::circle', text))
  end
end

.color(name = None) ⇒ Object


165
166
167
# File 'lib/tkextlib/tcllib/diagrams.rb', line 165

def color(name=None)
  tk_call('::Diagrams::color', name)
end

.computeposObject Also known as: compute_pos


212
213
214
# File 'lib/tkextlib/tcllib/diagrams.rb', line 212

def computepos
  list(tk_call('::Diagrams::computepos'))
end

.currentpos(pos) ⇒ Object Also known as: current_pos, currentpos=, current_pos=


53
54
55
# File 'lib/tkextlib/tcllib/diagrams.rb', line 53

def currentpos(pos)
  list(tk_call('::Diagrams::currentpos', pos))
end

.diamond(text, width = nil, height = nil) ⇒ Object


111
112
113
114
115
116
117
118
119
# File 'lib/tkextlib/tcllib/diagrams.rb', line 111

def diamond(text, width=nil, height=nil)
  if width || height
    width  = '' unless width
    height = '' unless height
    list(tk_call('::Diagrams::diamond', text, width, height))
  else
    list(tk_call('::Diagrams::diamond', text))
  end
end

.direction(dir) ⇒ Object


48
49
50
51
# File 'lib/tkextlib/tcllib/diagrams.rb', line 48

def direction(dir)
  tk_call('::Diagrams::direction', dir)
  dir
end

.drawin(canvas) ⇒ Object Also known as: draw_in


36
37
38
39
# File 'lib/tkextlib/tcllib/diagrams.rb', line 36

def drawin(canvas)
  tk_call('::Diagrams::drawin', canvas)
  canvas
end

.drum(text, width = nil, height = nil) ⇒ Object


121
122
123
124
125
126
127
128
129
# File 'lib/tkextlib/tcllib/diagrams.rb', line 121

def drum(text, width=nil, height=nil)
  if width || height
    width  = '' unless width
    height = '' unless height
    list(tk_call('::Diagrams::drum', text, width, height))
  else
    list(tk_call('::Diagrams::drum', text))
  end
end

.fillcolor(name = None) ⇒ Object


169
170
171
# File 'lib/tkextlib/tcllib/diagrams.rb', line 169

def fillcolor(name=None)
  tk_call('::Diagrams::fillcolor', name)
end

.getpos(anchor, obj) ⇒ Object Also known as: get_pos


60
61
62
# File 'lib/tkextlib/tcllib/diagrams.rb', line 60

def getpos(anchor, obj)
  list(tk_call('::Diagrams::getpos', anchor, obj))
end

.line(*args) ⇒ Object


145
146
147
148
149
150
151
152
153
154
155
# File 'lib/tkextlib/tcllib/diagrams.rb', line 145

def line(*args)
  ary = []
  args.each{|arg|
    if arg.kind_of?(Array) && arg.length == 2  # [length, angle]
      ary.concat arg
    else # ["POSITION", x, y] or length or angle
      ary << arg
    end
  }
  list(tk_call('::Diagrams::line', *ary))
end

.linestyle(style = None) ⇒ Object


198
199
200
# File 'lib/tkextlib/tcllib/diagrams.rb', line 198

def linestyle(style=None)
  tk_call('::Diagrams::linestyle', style)
end

.linewidth(pixels = None) ⇒ Object


194
195
196
# File 'lib/tkextlib/tcllib/diagrams.rb', line 194

def linewidth(pixels=None)
  number(tk_call('::Diagrams::linewidth', pixels))
end

.moveobject(obj) ⇒ Object Also known as: move_object


221
222
223
# File 'lib/tkextlib/tcllib/diagrams.rb', line 221

def moveobject(obj)
  list(tk_call('::Diagrams::moveobject', obj))
end

.package_nameObject


19
20
21
# File 'lib/tkextlib/tcllib/diagrams.rb', line 19

def self.package_name
  PACKAGE_NAME
end

.package_versionObject


23
24
25
26
27
28
29
# File 'lib/tkextlib/tcllib/diagrams.rb', line 23

def self.package_version
  begin
    TkPackage.require('Diagrams')
  rescue
    ''
  end
end

.plaintext(text, width = nil, height = nil) ⇒ Object


79
80
81
82
83
84
85
86
87
# File 'lib/tkextlib/tcllib/diagrams.rb', line 79

def plaintext(text, width=nil, height=nil)
  if width || height
    width  = '' unless width
    height = '' unless height
    list(tk_call('::Diagrams::plaintext', text, width, height))
  else
    list(tk_call('::Diagrams::plaintext', text))
  end
end

.popstateObject Also known as: pop_state


207
208
209
# File 'lib/tkextlib/tcllib/diagrams.rb', line 207

def popstate
  tk_call('::Diagrams::popstate')
end

.position(x, y) ⇒ Object


65
66
67
# File 'lib/tkextlib/tcllib/diagrams.rb', line 65

def position(x, y)
  list(tk_call('::Diagrams::position', x, y))
end

.pushstateObject Also known as: push_state


202
203
204
# File 'lib/tkextlib/tcllib/diagrams.rb', line 202

def pushstate
  tk_call('::Diagrams::pushstate')
end

.saveps(filename) ⇒ Object Also known as: save_ps


42
43
44
45
# File 'lib/tkextlib/tcllib/diagrams.rb', line 42

def saveps(filename)
  tk_call('::Diagrams::saveps', filename)
  filename
end

.slanted(text, width = nil, height = nil, angle = nil) ⇒ Object


97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/tkextlib/tcllib/diagrams.rb', line 97

def slanted(text, width=nil, height=nil, angle=nil)
  if width || height || angle
    width  = '' unless width
    height = '' unless height
    if angle
      list(tk_call('::Diagrams::slanted', text, width, height, angle))
    else
      list(tk_call('::Diagrams::slanted', text, width, height))
    end
  else
    list(tk_call('::Diagrams::slanted', text))
  end
end

.textcolor(name = None) ⇒ Object


173
174
175
# File 'lib/tkextlib/tcllib/diagrams.rb', line 173

def textcolor(name=None)
  tk_call('::Diagrams::textcolor', name)
end

.textfont(fnt = None) ⇒ Object


190
191
192
# File 'lib/tkextlib/tcllib/diagrams.rb', line 190

def textfont(fnt=None)
  tk_call('::Diagrams::textfont', fnt)
end

.usegap(mode = None) ⇒ Object Also known as: use_gap


177
178
179
# File 'lib/tkextlib/tcllib/diagrams.rb', line 177

def usegap(mode=None)
  bool(tk_call('::Diagrams::usegap', mode))
end

.xgap(val = None) ⇒ Object


182
183
184
# File 'lib/tkextlib/tcllib/diagrams.rb', line 182

def xgap(val=None)
  number(tk_call('::Diagrams::xgap', val))
end

.ygap(val = None) ⇒ Object


186
187
188
# File 'lib/tkextlib/tcllib/diagrams.rb', line 186

def ygap(val=None)
  number(tk_call('::Diagrams::ygap', val))
end