From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/ext/tk/lib/tkextlib/blt/win_printer.rb | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 jni/ruby/ext/tk/lib/tkextlib/blt/win_printer.rb (limited to 'jni/ruby/ext/tk/lib/tkextlib/blt/win_printer.rb') diff --git a/jni/ruby/ext/tk/lib/tkextlib/blt/win_printer.rb b/jni/ruby/ext/tk/lib/tkextlib/blt/win_printer.rb new file mode 100644 index 0000000..7ac6a0d --- /dev/null +++ b/jni/ruby/ext/tk/lib/tkextlib/blt/win_printer.rb @@ -0,0 +1,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 -- cgit v1.2.3