Ejemplo n.º 1
0
static int MatStoreAttribute(lua_State *L)
{
  Ihandle *ih = iuplua_checkihandle(L,1);
  const char *a = luaL_checkstring(L,2);
  int lin = luaL_checkint(L,3);
  int col = luaL_checkint(L,4);

  if (lua_isnil(L,5)) 
    IupSetAttributeId2(ih,a,lin, col,NULL);
  else 
  {
    const char *v;
    if(lua_isuserdata(L,5)) 
    {
      v = lua_touserdata(L,5);
      IupSetAttributeId2(ih,a,lin, col,v);
    }
    else 
    {
      v = luaL_checkstring(L,5);
      IupStoreAttributeId2(ih,a,lin, col,v);
    }
  }
  return 0;
}
Ejemplo n.º 2
0
int iupmaskMatSet(Ihandle* ih, const char* mask_str, int autofill, int casei, int lin, int col)
{
  (void)autofill;
  IupSetAttributeId2(ih,"MASKCASEI", lin, col, casei?"YES":"NO");
  IupSetAttributeId2(ih,"MASK", lin, col, (char*)mask_str);
  if (iupStrEqual(mask_str, IupGetAttributeId2(ih,"MASK", lin, col)))
    return 1;
  else
    return 0;
}
Ejemplo n.º 3
0
static int enteritem_cb(Ihandle *ih, int lin, int col)
{
  IupSetAttribute(ih,"MARKED", NULL);  /* clear all marks */
  IupSetAttributeId2(ih,"MARK", lin, 0, "1");
  IupSetfAttribute(ih,"REDRAW", "L%d", lin);
  return IUP_DEFAULT;
}
Ejemplo n.º 4
0
static int click(Ihandle *self, int lin, int col)
{
  printf("click_cb(%d, %d)\n", lin, col);
  IupSetAttribute(self,"MARKED", NULL);  /* clear all marks */
  IupSetAttributeId2(self,"MARK", lin, 0, "1");
  IupSetfAttribute(self,"REDRAW", "L%d", lin);
  return IUP_DEFAULT;
}
Ejemplo n.º 5
0
static void iMatrixListAddLineAttributes(Ihandle* ih, int base, int count)
{
  int lin;
  for(lin = base; lin < base+count; lin++)
  {
    /* all bottom horizontal lines transparent, except title and the last one */
    if (lin!=0 && lin!=ih->data->lines.num-1)
      IupSetAttributeId2(ih, "FRAMEHORIZCOLOR", lin, IUP_INVALID_ID, "BGCOLOR");
  }
}
Ejemplo n.º 6
0
static int StoreAttributeId2(lua_State *L)
{
  int store;
  Ihandle *ih = iuplua_checkihandle(L, 1);
  const char *a = luaL_checkstring(L,2);
  int lin = (int)luaL_checkinteger(L,3);
  int col = (int)luaL_checkinteger(L,4);
  const char* v = iuplua_checkvalue(L, 5, &store);
  if (store)
    IupStoreAttributeId2(ih, a, lin, col, v);
  else
    IupSetAttributeId2(ih, a, lin, col, v);
  return 0;
}
Ejemplo n.º 7
0
static void iMatrixListInitializeAttributes(Ihandle* ih, ImatrixListData* mtxList)
{
  int num_lin, col;

  for(col = 1; col < ih->data->columns.num; col++)
  {
    /* all right vertical lines transparent, except the last one */
    if (col != ih->data->columns.num-1)
      IupSetAttributeId2(ih, "FRAMEVERTCOLOR", IUP_INVALID_ID, col, "BGCOLOR");
  }

  num_lin = ih->data->lines.num-1;  /* remove the title line count, even if not visible */
  if (mtxList->editable)
    IupSetInt(ih, "NUMLIN", num_lin+1);  /* reserve space for the empty line */

  /* Set the text alignment for the item column */
  if (mtxList->label_col)
    IupSetAttributeId(ih, "ALIGNMENT", mtxList->label_col, "ALEFT");
}
Ejemplo n.º 8
0
static void iMatrixListUpdateLastLineAttributes(Ihandle* ih, int lines_num)
{
  if (lines_num < ih->data->lines.num && lines_num > 1)
    IupSetAttributeId2(ih, "FRAMEHORIZCOLOR", lines_num-1, IUP_INVALID_ID, "BGCOLOR");
  IupSetAttributeId2(ih, "FRAMEHORIZCOLOR", ih->data->lines.num-1, IUP_INVALID_ID, NULL);
}
Ejemplo n.º 9
0
static Ihandle* create_matrix(void)
{
  Ihandle* mat = IupMatrix(NULL); 
  int lin, col;
  
#ifdef BIG_MATRIX
  IupSetAttribute(mat, "NUMCOL", "20"); 
  IupSetAttribute(mat, "NUMLIN", "5000"); 
#else
  IupSetAttribute(mat, "NUMCOL", "3"); 
  IupSetAttribute(mat, "NUMLIN", "3"); 
#endif
  
  IupSetAttribute(mat, "NUMCOL_VISIBLE", "3");
  IupSetAttribute(mat, "NUMLIN_VISIBLE", "3");
  
//  IupSetAttribute(mat, "WIDTH2", "90");
//  IupSetAttribute(mat, "HEIGHT2", "30");
//  IupSetAttribute(mat, "WIDTHDEF", "34");
//  IupSetAttribute(mat,"RESIZEMATRIX", "YES");
  IupSetAttribute(mat,"SCROLLBAR", "YES");
  IupSetCallback(mat,"VALUE_CB",(Icallback)value_cb);
//  IupSetCallback(mat,"VALUE_EDIT_CB",(Icallback)value_edit_cb);
//  IupSetCallback(mat,"EDITION_CB",(Icallback)edition_cb);
  
//  IupSetCallback(mat, "DROPCHECK_CB", (Icallback)dropcheck_cb);
//  IupSetCallback(mat,"DROP_CB",(Icallback)drop);

#ifdef BIG_MATRIX
  IupSetAttribute(mat, "HEIGHT0", "10");
  IupSetAttribute(mat, "WIDTH0", "90");
#endif
//  IupSetAttribute(mat,"MARKMODE","LIN");
//  IupSetAttribute(mat,"MARKMULTIPLE","NO");
  IupSetAttribute(mat,"MARKMODE","CELL");
  IupSetAttribute(mat,"MARKMULTIPLE","YES");
//  IupSetAttribute(mat,"USETITLESIZE","YES");
//  IupSetAttribute(mat, "NUMCOL_NOSCROLL", "1");

//  IupSetAttribute(mat,"RASTERSIZE","x200");
//  IupSetAttribute(mat,"FITTOSIZE","LINES");

  //IupSetAttribute(mat, "NUMCOL_VISIBLE_LAST", "YES");
  //IupSetAttribute(mat, "NUMLIN_VISIBLE_LAST", "YES");
//  IupSetAttribute(mat, "WIDTHDEF", "15");

  IupSetAttribute(mat,"FRAMEVERTCOLOR1:2","BGCOLOR");
  IupSetAttribute(mat,"FRAMEHORIZCOLOR2:1","BGCOLOR");
//  IupSetAttribute(mat,"FRAMEVERTCOLOR1:2","255 255 255");
//  IupSetAttribute(mat,"FRAMEHORIZCOLOR2:1","255 255 255");

#ifdef XXXBIG_MATRIX
  for (lin = 0; lin < 3000; lin++)
  {
    for (col = 0; col < 20; col++)
    {
      IupSetAttributeId2(mat,"BGCOLOR", lin, col, "192 192 192");
      IupSetAttributeId2(mat,"FGCOLOR", lin, col, "1 1 1");
    }
  }
#endif

  return mat;
}
Ejemplo n.º 10
0
void IupMatSetAttribute(Ihandle* ih, const char* name, int lin, int col, const char* value)
{
  IupSetAttributeId2(ih, name, lin, col, value);
}
Ejemplo n.º 11
0
void iupmaskMatRemove(Ihandle *ih, int lin, int col)
{
  IupSetAttributeId2(ih,"MASK", lin, col, NULL);
}