Class: Gtk2AppLib::Widgets::Label

Inherits:
Object
  • Object
show all
Defined in:
lib/gtk2applib/widgets/label.rb

Overview

I'm a label

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/gtk2applib/widgets/label.rb', line 6

def empty?
  self.text == ''
end

#set_markup(txt, alt = self.text, font = self.options[:modify_font]) ⇒ Object

Tries to set a marked up label, and on failure reverts to a regular label.

Parameters:

  • txt (String)
  • alt (String) (defaults to: self.text)
  • font (Font) (defaults to: self.options[:modify_font])


16
17
18
19
20
# File 'lib/gtk2applib/widgets/label.rb', line 16

def set_markup(txt, alt=self.text, font=self.options[:modify_font])
  super(txt)
  self.text = alt if empty?
  self.modify_font(font) if !font.nil?
end

#set_text(txt, font = self.options[:modify_font]) ⇒ Object

Parameters:

  • txt (String)
  • font (Font) (defaults to: self.options[:modify_font])


24
25
26
27
# File 'lib/gtk2applib/widgets/label.rb', line 24

def set_text(txt, font=self.options[:modify_font])
  self.text = txt
  self.modify_font(font) if !font.nil?
end