Class: Clogs::Border
- Inherits:
-
SlotDecoration
- Object
- Shoes::Linkable
- Drawable
- SlotDecoration
- Clogs::Border
- Defined in:
- lib/clogs/drawables/shapes.rb
Instance Attribute Summary
Attributes inherited from Drawable
#abs_x, #abs_y, #children, #height, #parent, #shoes_linkable_id, #styles, #width, #x, #y
Instance Method Summary collapse
Methods inherited from SlotDecoration
Methods inherited from Drawable
#add_child, #app, #clickable?, #contains?, #destroy_self, #draw, #each_peer, #focus_gained, #focus_lost, #focusable?, for_shoes_class, #hidden?, #initialize, #margin, #measure, #needs_layout!, #notify, #on_click, #on_key, #on_mouse_move, #on_release, #paint, #positioned?, #properties_changed, #redraw!, #remove_child, #requested_height, #requested_width, #set_parent, #style
Constructor Details
This class inherits a constructor from Clogs::Drawable
Instance Method Details
#paint_for_slot(painter, x, y, w, h) ⇒ Object
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/clogs/drawables/shapes.rb', line 284 def paint_for_slot(painter, x, y, w, h) @abs_x = x @abs_y = y @width = w @height = h color = Style.color(style(:stroke), [0, 0, 0, 255]) thickness = (style(:strokewidth) || 1).to_i inset = thickness / 2.0 curve = style(:curve).to_i if curve.positive? painter.draw(stroke: color, thickness: thickness) do |p| Clogs.rounded_rect(p, x + inset, y + inset, w - thickness, h - thickness, curve) end else painter.stroke_rect(x + inset, y + inset, w - thickness, h - thickness, color, thickness: thickness) end end |