void iupClassObjectEnsureDefaultAttributes(Ihandle* ih)
{
  Iclass* ic;
  char *name;

  ic = ih->iclass;

  name = iupTableFirst(ic->attrib_func);
  while (name)
  {
    IattribFunc* afunc = (IattribFunc*)iupTableGetCurr(ic->attrib_func);
    if (afunc && afunc->set && 
        (afunc->default_value || afunc->system_default) &&
        !(afunc->flags & IUPAF_NO_DEFAULTVALUE) &&   /* can has default */
        !(afunc->flags & IUPAF_NO_STRING) &&       /* is a string */
        !(afunc->flags & IUPAF_HAS_ID))
    {
      if ((!iupStrEqualNoCase(afunc->default_value, afunc->system_default)) || 
          (afunc->call_global_default && iupGlobalDefaultColorChanged(afunc->default_value)))
      {
        if ((!ih->handle && (afunc->flags & IUPAF_NOT_MAPPED)) ||
            (ih->handle && !(afunc->flags & IUPAF_NOT_MAPPED)))
        {
          char* value = iupAttribGet(ih, name);
          if (!value)  /* if set will be updated later */
            afunc->set(ih, iClassGetDefaultValue(afunc));
        }
      }
    }

    name = iupTableNext(ic->attrib_func);
  }
}
Beispiel #2
0
void iupGlobalSetDefaultColorAttrib(const char* name, int r, int g, int b)
{
  if (!iupGlobalDefaultColorChanged(name))
  {
    char value[50];
    sprintf(value, "%d %d %d", r, g, b);
    iupTableSet(iglobal_table, name, (void*)value, IUPTABLE_STRING);
  }
}