Example #1
0
VALUE rb_IupTreeGetInt(VALUE node,VALUE v_a,VALUE v_id)
{
    const char* a = RSTRING_PTR(v_a);
    int id = NUM2INT(v_id);
    int v;
    VALUE v_ih = rb_iv_get(node,"@ihandle");
    v = IupTreeGetInt((Ihandle*)NUM2ULONG(v_ih),a,id);
    return INT2FIX((int)v);
}
Example #2
0
void iupTreeSelectLastCollapsedBranch(Ihandle* ih, int *last_id)
{
  /* if last selected item is a branch, then select its children */
  if (iupStrEqual(IupTreeGetAttribute(ih, "KIND", *last_id), "BRANCH") && 
      iupStrEqual(IupTreeGetAttribute(ih, "STATE", *last_id), "COLLAPSED"))
  {
    int childcount = IupTreeGetInt(ih, "CHILDCOUNT", *last_id);
    if (childcount > 0)
    {
      int start = *last_id + 1;
      int end = *last_id + childcount;
      IupSetfAttribute(ih, "MARK", "%d-%d", start, end);
      *last_id = *last_id + childcount;
    }
  }
}