Exemplo n.º 1
0
eolSpawn *eol_spawn_create_from_keychain(eolKeychain *conf)
{
  eolSpawn *spawn;
  if (!conf)return NULL;
  spawn = eol_spawn_new();
  if (!spawn)return NULL;
  spawn->keys = eol_keychain_get_hash_value(conf,"keys");
  eol_keychain_get_hash_value_as_orientation(&spawn->ori, conf, "ori");
  eol_keychain_get_hash_value_as_uint(&spawn->id, conf, "id");
  eol_keychain_get_hash_value_as_line(spawn->type, conf, "type");
  return spawn;
}
eolComponent * eol_list_create_from_config(eolRect winRect,eolKeychain *def)
{
  int i;
  eolUint       id;
  eolLine       name;
  eolUint       fontSize = 3;
  eolRectFloat  rect;
  eolUint       listType = 0;
  eolLine       listTypeLine = "text";
  eolKeychain * chain = NULL;
  eolKeychain * item = NULL;
  eolBool       showVslider = eolTrue,showHslider = eolTrue;
  eolVec2D      itemDim = {16,16},itemPadding = {8,8};
  eolComponent * list = NULL;
  eolComponent * itemComp = NULL;
  eolComponentList *listData = NULL;
  if (!def)return NULL;
  eol_keychain_get_hash_value_as_line(name, def, "name");
  
  if (eol_keychain_get_hash_value_as_line(listTypeLine, def, "listType"))
  {
      if (eol_line_cmp(listTypeLine,"text") == 0)
      {
        listType = 0;
      }
      else if (eol_line_cmp(listTypeLine,"lines") == 0)
      {
        listType = 1;
      }
      else if (eol_line_cmp(listTypeLine,"block") == 0)
      {
        listType = 2;
      }
      else if (eol_line_cmp(listTypeLine,"dock") == 0)
      {
        listType = 3;
      }
  }
  
  eol_keychain_get_hash_value_as_uint(&id, def, "id");
  eol_keychain_get_hash_value_as_rectfloat(&rect, def, "rect");
  eol_keychain_get_hash_value_as_bool(&showVslider, def, "showVSlider");
  eol_keychain_get_hash_value_as_bool(&showHslider, def, "showHSlider");
  eol_keychain_get_hash_value_as_uint(&fontSize, def, "fontSize");
  eol_keychain_get_hash_value_as_vec2d(&itemDim, def, "itemDimensions");
  eol_keychain_get_hash_value_as_vec2d(&itemPadding, def, "itemPadding");
  
  list = eol_list_new(
    id,
    name,
    rect,
    winRect,
    listType,
    itemDim,
    itemPadding,
    showVslider,
    showHslider,
    fontSize
  );
  listData = eol_component_get_list_data(list);
  if (!listData)
  {
    eol_component_list_free(list);
    return NULL;
  }
  eol_rect_copy(&listData->itemRect,list->bounds);
  eol_keychain_get_hash_value_as_vec3d(&listData->backgroundColor, def, "backgroundColor");
  eol_keychain_get_hash_value_as_float(&listData->backgroundAlpha, def, "backgroundAlpha");
  eol_keychain_get_hash_value_as_bool(&listData->showBackground, def, "showBackground");
  eol_keychain_get_hash_value_as_bool(&listData->showBoarder, def, "showBoarder");
  eol_keychain_get_hash_value_as_bool(&listData->allowSelection, def, "allowSelection");
  eol_rect_set(&listData->itemRect,0,0,listData->displayItems.x,listData->displayItems.y);
  chain = eol_keychain_get_hash_value(def,"items");
  if (chain)
  {
    if (chain->keyType == eolKeychainList)
    {
      for (i = 0; i < chain->itemCount; i++)
      {
        item = eol_keychain_get_list_nth(chain, i);
        if (item != NULL)
        {
          itemComp = eol_component_make_from_config(item,listData->itemRect);
          if (itemComp )
          {
            eol_list_add_item(list,itemComp );
          }
        }
      }        
    }
  }
  return list;
}
Exemplo n.º 3
0
eolBool eol_config_get_uint_by_tag(eolUint *output, eolConfig *conf, eolLine tag)
{
  g_return_val_if_fail(conf, eolFalse);
  g_return_val_if_fail(output, eolFalse);
  return eol_keychain_get_hash_value_as_uint(output, conf->_node, tag);
}