Class: Glimmer::SWT::Custom::Shape::Text

Inherits:
Glimmer::SWT::Custom::Shape show all
Defined in:
lib/glimmer/swt/custom/shape/text.rb

Instance Attribute Summary

Attributes inherited from Glimmer::SWT::Custom::Shape

#args, #name, #options, #parent

Instance Method Summary collapse

Methods inherited from Glimmer::SWT::Custom::Shape

#amend_method_name_options_based_on_properties!, #apply_property_arg_conversions, #apply_shape_arg_conversions!, #apply_shape_arg_defaults!, arg_options, #background_pattern_args, #calculate_paint_args!, create, #dispose, #draw?, #fill?, flyweight_method_names, flyweight_patterns, #foreground_pattern_args, gc_instance_methods, #get_attribute, #gradient?, #has_attribute?, #has_some_background?, #has_some_foreground?, #include?, #initialize, keywords, #method_missing, method_name, #move_by, #paint, #parameter_index, #parameter_name?, pattern, #pattern, #pattern_args, #post_add_content, #respond_to?, #round?, #set_attribute, #tolerate_shape_extra_args!, valid?

Methods included from Properties

attribute_getter, #attribute_getter, attribute_setter, #attribute_setter, normalized_attribute, #normalized_attribute, ruby_attribute_getter, #ruby_attribute_setter, ruby_attribute_setter

Methods included from Packages

included

Constructor Details

This class inherits a constructor from Glimmer::SWT::Custom::Shape

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::SWT::Custom::Shape

Instance Method Details

#parameter_namesObject



36
37
38
# File 'lib/glimmer/swt/custom/shape/text.rb', line 36

def parameter_names
  @parameter_names || text_parameter_names
end

#possible_parameter_namesObject



40
41
42
43
# File 'lib/glimmer/swt/custom/shape/text.rb', line 40

def possible_parameter_names
  # TODO refactor and improve this method through meta-programming (and share across other shapes)
  (text_parameter_names + text_transparent_parameter_names + text_flags_parameter_names).uniq
end

#set_parameter_attribute(attribute_name, *args) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/glimmer/swt/custom/shape/text.rb', line 57

def set_parameter_attribute(attribute_name, *args)
  return super if @parameter_names.to_a.map(&:to_s).include?(attribute_name.to_s)
  if text_parameter_names.map(&:to_s).include?(attribute_name.to_s)
    @parameter_names = text_parameter_names
  elsif text_transparent_parameter_names.map(&:to_s).include?(attribute_name.to_s)
    @parameter_names = text_transparent_parameter_names
  elsif text_flags_parameter_names.map(&:to_s).include?(attribute_name.to_s)
    @parameter_names = text_flags_parameter_names
  end
  super
end

#text_flags_parameter_namesObject



53
54
55
# File 'lib/glimmer/swt/custom/shape/text.rb', line 53

def text_flags_parameter_names
  [:text, :x, :y, :flags]
end

#text_parameter_namesObject



45
46
47
# File 'lib/glimmer/swt/custom/shape/text.rb', line 45

def text_parameter_names
  [:text, :x, :y]
end

#text_transparent_parameter_namesObject



49
50
51
# File 'lib/glimmer/swt/custom/shape/text.rb', line 49

def text_transparent_parameter_names
  [:text, :x, :y, :is_transparent]
end