Class: Shoes::Oval
- Defined in:
- lacci/lib/shoes/drawables/oval.rb
Overview
Constant Summary
Constants inherited from Drawable
Constants included from Log
Log::DEFAULT_COMPONENT, Log::DEFAULT_DEBUG_LOG_CONFIG, Log::DEFAULT_LOG_CONFIG
Instance Attribute Summary
Attributes inherited from Drawable
#debug_id, #destroyed, #parent
Attributes inherited from Linkable
Instance Method Summary collapse
-
#initialize(*args, **options) ⇒ Oval
constructor
A new instance of Oval.
Methods inherited from Drawable
allocate_drawable_id, #app, #banner, #caption, convert_to_float, convert_to_integer, #destroy, #download, drawable_by_id, drawable_class_by_name, dsl_name, #event, expects_parent?, feature_for_shoes_style, get_shoes_events, #hide, #hover, init_args, #inscription, #inspect, is_widget_class?, #leave, #method_missing, #motion, opt_init_args, optional_init_args, register_drawable_id, registered_shoes_events?, required_init_args, #respond_to_missing?, #set_parent, shoes_events, shoes_style, shoes_style_hashes, shoes_style_name?, shoes_style_names, #shoes_style_values, shoes_styles, #show, #style, #subtitle, #tagline, #title, #toggle, unregister_drawable_id, use_current_app, validate_as, with_current_app
Methods included from MarginHelper
Methods included from Colors
Methods included from Log
configure_logger, #log_init, logger
Methods inherited from Linkable
#bind_shoes_event, #send_self_event, #send_shoes_event, #unsub_all_shoes_events, #unsub_shoes_event
Constructor Details
#initialize(*args, **options) ⇒ Oval
Returns a new instance of Oval.
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 |
# File 'lacci/lib/shoes/drawables/oval.rb', line 20 def initialize(*args, **) super # Parse any positional or keyword args @draw_context = @app.current_draw_context unless @left && @top && (@width || @height || @radius) raise Shoes::Errors::InvalidAttributeValueError, "Oval requires left, top and one of (width, height, radius) to be specified!" end # Calzini expects "radius" to mean the x-axis-aligned radius, not y-axis-aligned. # For an axis-aligned oval the two may be different. # If we have no width, but a radius, default the width to be the radius * 2 @width ||= @radius * 2 if @radius # We now know we have width or height, but maybe not both. # Default to a circle - set height from width or vice-versa @width ||= @height @height ||= @width # If we don't have radius yet, set it from width @radius ||= @width / 2 create_display_drawable end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Shoes::Drawable