Class: Zerenity::TextInfo

Inherits:
Base
  • Object
show all
Defined in:
lib/zerenity/textinfo.rb

Overview

:nodoc:

Class Method Summary collapse

Methods inherited from Base

run

Class Method Details

.build(dialog, options) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/zerenity/textinfo.rb', line 31

def self.build(dialog,options)
  super(dialog,options)
  textView = Gtk::TextView.new
  textView.set_size_request(options[:width].to_i,options[:height].to_i) 
  textView.buffer.text = options[:text].to_s
  textView.editable = options[:editable]
  scrolledWindow = Gtk::ScrolledWindow.new
  scrolledWindow.hscrollbar_policy = options[:scrollable] ? Gtk::POLICY_AUTOMATIC : Gtk::POLICY_NEVER
  scrolledWindow.vscrollbar_policy = options[:scrollable] ? Gtk::POLICY_AUTOMATIC : Gtk::POLICY_NEVER 
  scrolledWindow.add(textView)
  dialog.vbox.add(scrolledWindow)
end

.check(options) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/zerenity/textinfo.rb', line 22

def self.check(options)
  super(options)
  options[:editable] ||= false
  options[:scrollable] ||= false
  options[:height] ||= -1
  options[:width] ||= -1
  options[:text] ||= ""
end

.retrieve_selection(dialog, options) ⇒ Object



44
45
46
47
# File 'lib/zerenity/textinfo.rb', line 44

def self.retrieve_selection(dialog,options)
  super(dialog,options)
  return dialog.vbox.children[0].children[0].buffer.text
end