Class: Clogs::Progress

Inherits:
Control show all
Defined in:
lib/clogs/drawables/controls.rb

Constant Summary

Constants inherited from Control

Control::PADDING_X, Control::PADDING_Y

Instance Attribute Summary

Attributes inherited from Control

#focused, #hovered, #pressed

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 Control

#label, #on_mouse_enter, #on_mouse_leave, #text_style

Methods inherited from Drawable

#add_child, #app, #contains?, #destroy_self, #each_peer, #focus_gained, #focus_lost, #focusable?, for_shoes_class, #hidden?, #initialize, #margin, #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

#clickable?Boolean

Returns:

  • (Boolean)


172
173
174
# File 'lib/clogs/drawables/controls.rb', line 172

def clickable?
  false
end

#draw(painter, x, y) ⇒ Object



160
161
162
163
164
165
166
167
168
169
170
# File 'lib/clogs/drawables/controls.rb', line 160

def draw(painter, x, y)
  painter.draw(fill: [235, 235, 235, 255], stroke: [180, 180, 180, 255], thickness: 1) do |p|
    Clogs.rounded_rect(p, x + 0.5, y + 0.5, @width - 1, @height - 1, @height / 2.0)
  end
  fraction = style(:fraction).to_f.clamp(0.0, 1.0)
  return if fraction.zero?

  painter.draw(fill: [60, 140, 230, 255]) do |p|
    Clogs.rounded_rect(p, x + 1, y + 1, (@width - 2) * fraction, @height - 2, (@height - 2) / 2.0)
  end
end

#measure(available_width) ⇒ Object



155
156
157
158
# File 'lib/clogs/drawables/controls.rb', line 155

def measure(available_width)
  @width = requested_width(available_width) || [available_width, 200].min
  @height = requested_height(available_width) || 14
end