Beispiel #1
0
static PangoLayout* gtkFontGetWidgetPangoLayout(Ihandle *ih)
{
  int inherit;
  char *def_value;
  /* only check the  native implementation */
  return (PangoLayout*)iupClassObjectGetAttribute(ih, "PANGOLAYOUT", &def_value, &inherit);
}
Beispiel #2
0
char* IupGetAttribute(Ihandle *ih, const char* name)
{
  iupASSERT(name!=NULL);
  if (!name)
    return NULL;

  if (!ih)
    return IupGetGlobal(name);

  iupASSERT(iupObjectCheck(ih));
  if (!iupObjectCheck(ih))
    return NULL;

  if (iupATTRIB_ISINTERNAL(name))
    return iupAttribGet(ih, name);
  else
  {
    int inherit;
    char *value, *def_value;

    value = iupClassObjectGetAttribute(ih, name, &def_value, &inherit);

    if (!value)
      value = iupAttribGet(ih, name);

    if (!value && inherit)
    {
      while (!value)
      {
        ih = ih->parent;
        if (!ih)
          break;

        value = iupAttribGet(ih, name);
      }
    }

    if (!value)
      value = def_value;

    return value;
  }
}
Beispiel #3
0
char* iupAttribGetLocal(Ihandle* ih, const char* name)
{
  char* value;
  if (!ih || !name)
    return NULL;

  value = iupTableGet(ih->attrib, name);

  if (!value && !iupATTRIB_ISINTERNAL(name))
  {
    int inherit;
    char *def_value;
    value = iupClassObjectGetAttribute(ih, name, &def_value, &inherit);

    if (!value)
      value = def_value;
  }

  return value;
}
void IupSaveClassAttributes(Ihandle* ih)
{
  int has_attrib_id, start_id = 0;
  Iclass* ic;
  char *name;

  iupASSERT(iupObjectCheck(ih));
  if (!iupObjectCheck(ih))
    return;

  ic = ih->iclass;

  has_attrib_id = ic->has_attrib_id;
  if (iupClassMatch(ic, "tree") || /* tree can only set id attributes after map, so they can not be saved */
      iupClassMatch(ic, "cells")) /* cells does not have any saveable id attributes */
    has_attrib_id = 0;  

  if (iupClassMatch(ic, "list"))
    start_id = 1;

  name = iupTableFirst(ic->attrib_func);
  while (name)
  {
    IattribFunc* afunc = (IattribFunc*)iupTableGet(ic->attrib_func, name);
    if (afunc && !(afunc->flags & IUPAF_NO_STRING) &&  /* is a string */
                 !(afunc->flags & IUPAF_READONLY) &&   /* not read-only */
                 !(afunc->flags & IUPAF_WRITEONLY) &&  /* not write-only */
                 !(afunc->flags & IUPAF_CALLBACK))     /* not a callback */
    {
      if ((afunc->flags&IUPAF_NO_SAVE) && iupBaseNoSaveCheck(ih, name))  /* can not be saved */
      {
        name = iupTableNext(ic->attrib_func);
        continue;
      }

      if (!(afunc->flags & IUPAF_HAS_ID))     /* no ID */
      {
        int inherit;
        char *def_value;
        char *value = iupClassObjectGetAttribute(ih, name, &def_value, &inherit);
        if (value && value[0])    /* NOT NULL and not empty */
        {
          if ((def_value && iupStrEqualNoCase(def_value, value)) ||  /* equal to the default value */
              (!def_value && iupStrFalse(value)))   /* default=NULL and value=NO */
          {
            name = iupTableNext(ic->attrib_func);
            continue;
          }

          if (!iupStrEqualNoCase(value, iupAttribGet(ih, name)))     /* NOT already stored */
            iupAttribSetStr(ih, name, value);
        }
      }
      else if (has_attrib_id)
      {
        char *value;

        if (iupStrEqual(name, "IDVALUE"))
          name = "";

        if (afunc->flags&IUPAF_HAS_ID2)
        {
          int lin, col, 
              numcol = IupGetInt(ih, "NUMCOL")+1,
              numlin = IupGetInt(ih, "NUMLIN")+1;
          for (lin=0; lin<numlin; lin++)
          {
            for (col=0; col<numcol; col++)
            {
              value = iupClassObjectGetAttributeId2(ih, name, lin, col);
              if (value && value[0])  /* NOT NULL and not empty */
              {
                if (!iupStrEqualNoCase(value, iupAttribGetId2(ih, name, lin, col)))     /* NOT already stored */
                  iupAttribSetStrId2(ih, name, lin, col, value);
              }
            }
          }
        }
        else
        {
          int id, count = IupGetInt(ih, "COUNT");
          for (id=start_id; id<count+start_id; id++)
          {
            value = iupClassObjectGetAttributeId(ih, name, id);
            if (value && value[0])  /* NOT NULL and not empty */
            {
              if (!iupStrEqualNoCase(value, iupAttribGetId(ih, name, id)))     /* NOT already stored */
                iupAttribSetStrId(ih, name, id, value);
            }
          }
        }
      }
    }

    name = iupTableNext(ic->attrib_func);
  }
}