Class: GuindillaGUI::Box

Inherits:
Element show all
Defined in:
lib/guindilla_gui/guindilla_classes.rb

Overview

—————————————————————————-#

Box                                         #

—————————————————————————-#

Instance Attribute Summary collapse

Attributes inherited from Element

#attributes, #id

Attributes inherited from Guindilla

#active_id, #blocks, #elements, #inputs, #socket

Instance Method Summary collapse

Methods inherited from Element

#get_position

Methods inherited from Guindilla

#after, #alert, #align, #append, #attributes, #audio_out, #background, #border, #border_color, #border_radius, #border_width, #bullet_list, #button, #canvas, #chart, #checkbox, #circle, #color, #color_input, #container, #display, #every, #file_input, #font, #font_family, #font_size, #h_box, #h_rule, #heading, #height, #hide, #image, #justify, #line_break, #link, #margin, #move_to, #number_input, #on_click, #on_hover, #on_leave, #on_mouse_move, #opacity, #ordered_list, #padding, #para, #polygon, #radio_button, #range_slider, #rectangle, #rotate, #show, #size, #source, #square, #style, #sub_script, #sup_script, #text, #text_align, #text_input, #toggle, #transition, #triangle, #url_input, #v_box, #video_out, #web_frame, #width

Constructor Details

#initialize(direction, attributes, &block) ⇒ Box

Returns a new instance of Box.



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/guindilla_gui/guindilla_classes.rb', line 221

def initialize(direction, attributes, &block)
  attributes[:justify_content] = attributes[:justify] if attributes[:justify]
  attributes[:align_items] = attributes[:align] if attributes [:align]
  super("div", attributes)

  unless direction == nil
    send_js(%Q~
      #{self.id}.style.display = 'flex';
      #{self.id}.style.flexFlow = '#{direction} wrap';
    ~)
  end

  last_active_id = @@gui.active_id
  @@gui.active_id = self.id
  if block_given?
    block.call
  end
  @@gui.active_id = last_active_id
# HACK: return self (?)  # hmm, here?, in methods? nowhere?
end

Instance Attribute Details

#directionObject (readonly)

Returns the value of attribute direction.



219
220
221
# File 'lib/guindilla_gui/guindilla_classes.rb', line 219

def direction
  @direction
end