## ExpStyle core

Core Module - ExpStyle

### Dependencies

expcore.gui
gui.concept.frame
gui.concept.flow
gui.concept.table
gui.concept.scroll
expcore.common

### Elements

alignment | A flow which can be used to align text and other elements
container | A container frame that can be used to add a boader around your content
data_label | A label pair which has a static label and a data label which can be changed
footer | A frame that acts as a footer to a section of content
header | A frame that acts as a header to a section of content
scroll_table | A table that is inside a vertical scroll area
time_label | A label that show time in a nice, user friendly way
toggle_button | A button that will toggle its caption each time it is pressed
unit_label | A label triplet which has a static label, a data label which can be changed, and a unit label

### Functions

data_label:update_data_element(element, data) | Updates the caption and tooltip of the data label using the data format function
data_label:update_from_parent(parent, data) | Updates the caption and tooltip of the data label using the data format function, given the parent of the data label
time_label:update_time(element, time) | Updates the time that is on a label
unit_label:update_data_element(element, data) | Updates the caption and tooltip and unit of the data label using the data format function
unit_label:update_from_parent(parent, data) | Updates the caption and tooltip and unit of the unit label using the data format function, given the parent of the unit label

### Dependencies

# expcore.gui
# gui.concept.frame
# gui.concept.flow
# gui.concept.table
# gui.concept.scroll
# expcore.common

### Elements

# alignment

  A flow which can be used to align text and other elements

  See also:
  - Gui.flow
  Usage:

      -- Concept Structure
      -- Root
      --> [alignment] - the alignment area
      Gui.new_concept('alignment')
      :set_horizontal_align('center')

# container

  A container frame that can be used to add a boader around your content

  See also:
  - Gui.frame
  Usage:

      -- Concept Structure
      -- Root
      --> [container] - the outer frame
      -->> container - the content area
      Gui.new_concept('container')

# data_label

  A label pair which has a static label and a data label which can be changed

  See also:
  - Gui.label
  Usage:

      -- Concept Structure
      -- Root
      --> [data_label] - the static label
      --> [properties.data_name] - the data label which can be updated
      Gui.new_concept('data_label')
      :set_data_label_name('game_ticks')
      :set_data_caption('0')
      :set_data_format(function(concept,element,data,...)
          -- This is used with update_data_element and update_from_parent
          local caption = tostirng('data')
          local tooltip = 'This game has beeing running for: '..caption..' ticks'
          return caption, tooltip
      end)

# footer

  A frame that acts as a footer to a section of content

  Properties / Events:
  - tooltip : (string) the tooltip to show on the title
  See also:
  - Gui.frame
  Usage:

      -- Concept Structure
      -- Root
      --> [footer] - the footer frame
      -->> footer_caption - the lable with the title in it
      -->> footer_content - the area to contain butons
      Gui.new_concept('footer')
      :set_title('Example Footer')

# header

  A frame that acts as a header to a section of content

  Properties / Events:
  - tooltip : (string) the tooltip to show on the title
  See also:
  - Gui.frame
  Usage:

      -- Concept Structure
      -- Root
      --> [header] - the header frame
      -->> header_caption - the lable with the title in it
      -->> header_content - the area to contain butons
      Gui.new_concept('header')
      :set_title('Example Header')

# scroll_table

  A table that is inside a vertical scroll area

  Properties / Events:
  - hight : (number) the max hight of the scroll area
  See also:
  - Gui.table
  Usage:

      -- Concept Structure
      -- Root
      --> [scroll_table] - the scroll area
      -->> table - the table area
      Gui.new_concept('scroll_table')
      :set_height(200)
      :set_column_count(2)

# time_label

  A label that show time in a nice, user friendly way

  Properties / Events:
  - time : (number) the time to display in tick
  Usage:

      -- Concept Structure
      -- Root
      --> [time_label] - the label with the time
      local time_label =
      Gui.new_concept('time_label')
      :set_use_hours(true)
      :set_time(game.tick)

      time_label:update_time(element,game.tick)

# toggle_button

  A button that will toggle its caption each time it is pressed

  Properties / Events:
  - alt_caption : (string) the caption to show on the button in its true state
  - alt_tooltip : (string) the tooltip to show on the button in its true state
  See also:
  - Gui.button
  Usage:

      -- Concept Structure
      -- Root
      --> [toggle_button] - the header button
      Gui.new_concept('toggle_button')
      :set_caption('<')
      :set_tooltip('Press to close.')
      :set_alt_caption('>')
      :set_alt_tooltip('Press to open.')
      :on_click(function(event)
          local state = event.state and 'close' or 'open'
          event.player.print('Toggle button is now: '..state)
      end)

# unit_label

  A label triplet which has a static label, a data label which can be changed, and a unit label

  See also:
  - Gui.label
  - data_label
  Usage:

      -- Concept Structure
      -- Root
      --> [unit_label] - the static label
      --> [properties.data_name] - the data label which can be updated
      --> [properties.data_name..'_unit'] - the data label unit which can be updated
      Gui.new_concept('unit_label')
      :set_data_label_name('game_ticks')
      :set_data_caption('0')
      :set_data_unit('ticks')
      :set_data_format(function(concept,element,data,...)
          -- This is used with update_data_element and update_from_parent
          local caption = tostirng(data)
          local unit = data > 1 and 'ticks' or 'tick'
          local tooltip = 'This game has beeing running for: '..caption..' ticks'
          return caption, unit, tooltip
      end)

### Functions

# data_label:update_data_element(element, data)

  Updates the caption and tooltip of the data label using the data format function

  Parameters:
  - element : (LuaGuiElement) the data label element that you want to update
  - data : (any) the data that you want to pass to the format function
  Usage:

      -- Updating the data to the current game tick
      data_label:update_data_element(element,game.tick)

# data_label:update_from_parent(parent, data)

  Updates the caption and tooltip of the data label using the data format function, given the parent of the data label

  Parameters:
  - parent : (LuaGuiElement) the parent element to the data label element that you want to update
  - data : (any) the data that you want to pass to the format function
  Usage:

      -- Updating the data to the current game tick
      data_label:update_from_parent(parent,game.tick)

# time_label:update_time(element, time)

  Updates the time that is on a label

  Parameters:
  - element : (LuaGuiElement) the label that you want to update
  - time : (number) the number of tick you want it to show
  Usage:

      -- Update the time to show game time
      time_label:update_time(element,game.time)

# unit_label:update_data_element(element, data)

  Updates the caption and tooltip and unit of the data label using the data format function

  Parameters:
  - element : (LuaGuiElement) the unit label element that you want to update
  - data : (any) the data that you want to pass to the format function
  Usage:

      -- Updating the data to the current game tick
      unit_label:update_data_element(element,game.tick)

# unit_label:update_from_parent(parent, data)

  Updates the caption and tooltip and unit of the unit label using the data format function, given the parent of the unit label

  Parameters:
  - parent : (LuaGuiElement) the parent element to the unit label element that you want to update
  - data : (any) the data that you want to pass to the format function
  Usage:

      -- Updating the data to the current game tick
      unit_label:update_from_parent(parent,game.tick)