Class: Glimmer::LibUI::ColorButtonProxy
- Inherits:
-
ControlProxy
- Object
- ControlProxy
- Glimmer::LibUI::ColorButtonProxy
- Defined in:
- lib/glimmer/libui/color_button_proxy.rb
Overview
Proxy for LibUI color button objects
Follows the Proxy Design Pattern
Constant Summary
Constants inherited from ControlProxy
Glimmer::LibUI::ControlProxy::BOOLEAN_PROPERTIES, Glimmer::LibUI::ControlProxy::STRING_PROPERTIES
Instance Attribute Summary
Attributes inherited from ControlProxy
#args, #block, #keyword, #libui, #parent_proxy
Instance Method Summary collapse
Methods inherited from ControlProxy
#append_properties, #append_property, boolean_to_integer, #can_handle_listener?, #content, control_proxies, create, #default_destroy, #destroy_child, #enabled, exists?, #handle_listener, image_proxies, #initialize, integer_to_boolean, #libui_api_keyword, main_window_proxy, menu_proxies, #method_missing, new_control, #post_add_content, #post_initialize_child, #respond_to?, #respond_to_libui?, #send_to_libui, #visible, widget_proxy_class, #window_proxy
Constructor Details
This class inherits a constructor from Glimmer::LibUI::ControlProxy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Glimmer::LibUI::ControlProxy
Instance Method Details
#alpha ⇒ Object
51 52 53 |
# File 'lib/glimmer/libui/color_button_proxy.rb', line 51 def alpha color[3] end |
#blue ⇒ Object
47 48 49 |
# File 'lib/glimmer/libui/color_button_proxy.rb', line 47 def blue color[2] end |
#color ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/glimmer/libui/color_button_proxy.rb', line 30 def color @red ||= Fiddle::Pointer.malloc(8) # double @green ||= Fiddle::Pointer.malloc(8) # double @blue ||= Fiddle::Pointer.malloc(8) # double @alpha ||= Fiddle::Pointer.malloc(8) # double ::LibUI.(@libui, @red, @green, @blue, @alpha) [@red[0, 8].unpack1('d') * 255.0, @green[0, 8].unpack1('d') * 255.0, @blue[0, 8].unpack1('d') * 255.0, @alpha[0, 8].unpack1('d')] end |
#destroy ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/glimmer/libui/color_button_proxy.rb', line 55 def destroy Fiddle.free @red unless @red.nil? Fiddle.free @green unless @green.nil? Fiddle.free @blue unless @blue.nil? Fiddle.free @alpha unless @alpha.nil? super end |
#green ⇒ Object
43 44 45 |
# File 'lib/glimmer/libui/color_button_proxy.rb', line 43 def green color[1] end |
#red ⇒ Object
39 40 41 |
# File 'lib/glimmer/libui/color_button_proxy.rb', line 39 def red color[0] end |