1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#
# tkextlib/blt/win_printer.rb
#
# *** Windows only ***
#
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
#
require 'tk'
require 'tkextlib/blt.rb'
module Tk::BLT
class Printer < TkObject
extend TkCore
TkCommandNames = ['::blt::printer'.freeze].freeze
def self.enum(attribute)
simplelist(tk_call('::blt::printer', 'enum', attribute))
end
def self.names(pat=None)
simplelist(tk_call('::blt::printer', 'names', pat))
end
def self.open(printer)
self.new(printer)
end
#################################
def initialize(printer)
@printer_id = tk_call('::blt::printer', 'open', printer)
end
def close
tk_call('::blt::print', 'close', @printer_id)
self
end
def get_attrs(var)
tk_call('::blt::print', 'getattrs', @printer_id, var)
var
end
def set_attrs(var)
tk_call('::blt::print', 'setattrs', @printer_id, var)
self
end
def snap(win)
tk_call('::blt::print', 'snap', @printer_id, win)
self
end
def write(str)
tk_call('::blt::print', 'write', @printer_id, str)
self
end
def write_with_title(title, str)
tk_call('::blt::print', 'write', @printer_id, title, str)
self
end
end
end
|