コード例 #1
0
ファイル: iup_cells.c プロジェクト: Vulcanior/IUP
/* Function used to make a cell the first visible one */
static void iCellsAdjustOrigin(Ihandle* ih, int lin, int col)
{ 
  int xmin_sum, ymin_sum;

  /* If the origin line is a non-scrollable one, the scrollbar position is
   * set to zero. Otherwise, the sum of the previous widths will be
   * set to the scrollbar position. This algorithm is applied to both
   * scrollbars */
  if (lin <= ih->data->non_scrollable_lins)
  {
     IupSetAttribute(ih, "POSY", "0"); 
  }
  else if (lin <= iCellsGetNLines(ih))
  { 
     ymin_sum = iCellsGetRangedHeight(ih, ih->data->non_scrollable_lins+1, lin-1);
     IupSetInt(ih, "POSY", ymin_sum); 
  }

  /* As said before... */
  if (col <= ih->data->non_scrollable_cols)
  {
     IupSetAttribute(ih, "POSX", "0"); 
  }
  else if (col <= iCellsGetNCols(ih))
  { 
     xmin_sum = iCellsGetRangedWidth(ih, ih->data->non_scrollable_cols+1, col-1);
     IupSetInt(ih, "POSX", xmin_sum); 
  }
}
コード例 #2
0
ファイル: iup_colordlg.c プロジェクト: mwoz/Hildim.Source
static int iColorDlgColorCnvButton_CB(Ihandle* ih, int b, int press, int x, int y)
{
  IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");
  int width;
  (void)y;

  if (b != IUP_BUTTON1 || !press)
    return IUP_DEFAULT;

  width = colordlg_data->color_cnv->currentwidth;

  if (x < width/2)
  {
    /* reset color to previous */
    colordlg_data->red = iupDrawRed(colordlg_data->previous_color);
    colordlg_data->green = iupDrawGreen(colordlg_data->previous_color);
    colordlg_data->blue = iupDrawBlue(colordlg_data->previous_color);
    colordlg_data->alpha = iupDrawAlpha(colordlg_data->previous_color);

    IupSetInt(colordlg_data->alpha_txt, "VALUE", (int)colordlg_data->alpha);
    IupSetInt(colordlg_data->alpha_val, "VALUE", (int)colordlg_data->alpha);

    iColorDlgRGB_TXT_Update(colordlg_data);
    iColorDlgRGBChanged(colordlg_data);
  }

  return IUP_DEFAULT;
}
コード例 #3
0
ファイル: iup_scrollbox.c プロジェクト: defdef/iup
static void iScrollBoxUpdateVisibleArea(Ihandle* ih, int xmax, int ymax)
{
  int width = ih->currentwidth,
    height = ih->currentheight;

  /* if child is greater than scrollbox in one direction,
  then it has scrollbars
  but this affects the opposite direction */

  if (xmax > ih->currentwidth)
    height -= iupdrvGetScrollbarSize();

  if (ymax > ih->currentheight)
    width -= iupdrvGetScrollbarSize();

  if (xmax <= ih->currentwidth && xmax > width)
    height -= iupdrvGetScrollbarSize();

  if (ymax <= ih->currentheight && ymax > height)
    width -= iupdrvGetScrollbarSize();

  if (width < 0) width = 0;
  if (height < 0) height = 0;

  IupSetInt(ih, "DX", width);
  IupSetInt(ih, "DY", height);
}
コード例 #4
0
static int iColorBrowserDlgColorCnvButton_CB(Ihandle* ih, int b, int press, int x, int y)
{
  IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");
  int width;
  (void)y;

  if (b != IUP_BUTTON1 || !press || !colordlg_data->cd_canvas_color)
    return IUP_DEFAULT;

  cdCanvasGetSize(colordlg_data->cd_canvas_color, &width, NULL, NULL, NULL);

  if (x < width/2)
  {
    /* reset color to previous */
    colordlg_data->red = cdRed(colordlg_data->previous_color);
    colordlg_data->green = cdGreen(colordlg_data->previous_color);
    colordlg_data->blue = cdBlue(colordlg_data->previous_color);
    colordlg_data->alpha = cdAlpha(colordlg_data->previous_color);

    IupSetInt(colordlg_data->alpha_txt, "VALUE", (int)colordlg_data->alpha);
    IupSetInt(colordlg_data->alpha_val, "VALUE", (int)colordlg_data->alpha);

    iColorBrowserDlgRGB_TXT_Update(colordlg_data);
    iColorBrowserDlgRGBChanged(colordlg_data);
  }

  return IUP_DEFAULT;
}
コード例 #5
0
ファイル: example3_4.c プロジェクト: sanikoyes/iup
int item_goto_action_cb(Ihandle* item_goto)
{
  Ihandle* multitext = IupGetDialogChild(item_goto, "MULTITEXT");
  Ihandle *dlg, *box, *bt_ok, *bt_cancel, *txt, *lbl;

  int line_count = IupGetInt(multitext, "LINECOUNT");

  lbl = IupLabel(NULL);
  IupSetfAttribute(lbl, "TITLE", "Line Number [1-%d]:", line_count);
  txt = IupText(NULL);
  IupSetAttribute(txt, "MASK", IUP_MASK_UINT);  /* unsigned integer numbers only */
  IupSetAttribute(txt, "NAME", "LINE_TEXT");
  IupSetAttribute(txt, "VISIBLECOLUMNS", "20");
  bt_ok = IupButton("OK", NULL);
  IupSetInt(bt_ok, "TEXT_LINECOUNT", line_count);
  IupSetAttribute(bt_ok, "PADDING", "10x2");
  IupSetCallback(bt_ok, "ACTION", (Icallback)goto_ok_action_cb);
  bt_cancel = IupButton("Cancel", NULL);
  IupSetCallback(bt_cancel, "ACTION", (Icallback)goto_cancel_action_cb);
  IupSetAttribute(bt_cancel, "PADDING", "10x2");

  box = IupVbox(
    lbl,
    txt,
    IupSetAttributes(IupHbox(
      IupFill(),
      bt_ok,
      bt_cancel,
      NULL), "NORMALIZESIZE=HORIZONTAL"),
    NULL);
  IupSetAttribute(box, "MARGIN", "10x10");
  IupSetAttribute(box, "GAP", "5");

  dlg = IupDialog(box);
  IupSetAttribute(dlg, "TITLE", "Go To Line");
  IupSetAttribute(dlg, "DIALOGFRAME", "Yes");
  IupSetAttributeHandle(dlg, "DEFAULTENTER", bt_ok);
  IupSetAttributeHandle(dlg, "DEFAULTESC", bt_cancel);
  IupSetAttributeHandle(dlg, "PARENTDIALOG", IupGetDialog(item_goto));

  IupPopup(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);

  if (IupGetInt(dlg, "STATUS") == 1)
  {
    int line = IupGetInt(txt, "VALUE");
    int pos;
    IupTextConvertLinColToPos(multitext, line, 0, &pos);
    IupSetInt(multitext, "CARETPOS", pos);
    IupSetInt(multitext, "SCROLLTOPOS", pos);
  }

  IupDestroy(dlg);

  return IUP_DEFAULT;
}
コード例 #6
0
ファイル: iup_scrollbox.c プロジェクト: defdef/iup
static void iScrollBoxSetChildrenCurrentSizeMethod(Ihandle* ih, int shrink)
{
  Ihandle* child = ih->firstchild;

  if (child)
  {
    int w, h, has_sb_horiz=0, has_sb_vert=0;

    /* If child is greater than scrollbox area, use child natural size,
       else use current scrollbox size;
       So this will let the child be greater than the scrollbox,
       or let the child expand to the scrollbox.  */

    if (child->naturalwidth > ih->currentwidth)
    {
      w = child->naturalwidth;
      has_sb_horiz = 1;
    }
    else
      w = ih->currentwidth;  /* expand space */

    if (child->naturalheight > ih->currentheight)
    {
      h = child->naturalheight;
      has_sb_vert = 1;
    }
    else
      h = ih->currentheight; /* expand space */

    if (!has_sb_horiz && has_sb_vert)
      w -= iupdrvGetScrollbarSize();  /* reduce expand space */

    if (has_sb_horiz && !has_sb_vert)
      h -= iupdrvGetScrollbarSize();  /* reduce expand space */

    /* Now w and h is a possible child size */
    iupBaseSetCurrentSize(child, w, h, shrink);

    /* Now we use the actual child size as the virtual area */
    IupSetInt(ih, "XMAX", child->currentwidth);
    IupSetInt(ih, "YMAX", child->currentheight);

    /* Finally update the visible area */
    iScrollBoxUpdateVisibleArea(ih, child->currentwidth, child->currentheight);
  }
  else
  {
    IupSetAttribute(ih, "XMAX", "0");
    IupSetAttribute(ih, "YMAX", "0");
    IupSetAttribute(ih, "DX", "0");
    IupSetAttribute(ih, "DY", "0");
  }
}
コード例 #7
0
ファイル: iup_cells.c プロジェクト: Vulcanior/IUP
/* Function used for the scrollbar's update; usually needed when the
 * object has modified its size or the cells sizes has changed.   */
static void iCellsAdjustScroll(Ihandle* ih, int canvas_w, int canvas_h)
{ 
  int virtual_height, virtual_width;

  /* Getting the virtual size */
  iCellsGetVirtualSize(ih, &virtual_width, &virtual_height); 

  IupSetInt(ih, "XMAX", virtual_width);
  IupSetInt(ih, "YMAX", virtual_height);

  /* Setting the object scrollbar position */
  IupSetInt(ih, "DX", canvas_w);
  IupSetInt(ih, "DY", canvas_h);
}
コード例 #8
0
ファイル: iup_matrixlist.c プロジェクト: Vulcanior/IUP
static int iMatrixListSetDelLinAttrib(Ihandle* ih, const char* value)
{
  int base, count, lines_num = ih->data->lines.num;
  ImatrixListData* mtxList;

  if (!ih->handle)  /* do not do the action before map */
    return 0;       /* allowing this method to be called before map will avoid its storage in the hash table */

  if (!iupMatrixGetStartEnd(value, &base, &count, lines_num, 1))
    return 0;

  iupMatrixSetDelLinAttrib(ih, value);

  if (base < lines_num)  /* If before the last line. (always true when deleting) */
    iMatrixListUpdateLineAttributes(ih, base, count, 0);

  iMatrixListUpdateLastLineAttributes(ih, lines_num);

  lines_num = ih->data->lines.num;
  mtxList = (ImatrixListData*)iupAttribGet(ih, "_IUPMTXLIST_DATA");
  if (mtxList->editable && lines_num==1)
    IupSetInt(ih, "NUMLIN", 1);  /* reserve space for the empty line */

  IupSetAttribute(ih, "REDRAW", "ALL");

  return 0;
}
コード例 #9
0
ファイル: iup_list.c プロジェクト: Vulcanior/IUP
static int iListDragData_CB(Ihandle *ih, char* type, void *data, int len)
{
  int pos = iupAttribGetInt(ih, "_IUP_LIST_SOURCEPOS");
  if (pos < 1)
    return IUP_DEFAULT;

  if (ih->data->is_multiple)
  {
    char *buffer = IupGetAttribute(ih, "VALUE");

    /* It will not drag all selected items only
       when the user begins to drag an item not selected.
       In this case, unmark all and mark only this item.  */
    if(buffer[pos-1] == '-')
    {
      int len = (int)strlen(buffer);
      IupSetAttribute(ih, "SELECTION", "NONE");
      memset(buffer, '-', len);
      buffer[pos-1] = '+';
      IupSetAttribute(ih, "VALUE", buffer);
    }
  }
  else
  {
    /* Single selection */
    IupSetInt(ih, "VALUE", pos);
  }

  /* Copy source handle */
  memcpy(data, (void*)&ih, len);
 
  (void)type;
  return IUP_DEFAULT;
}
コード例 #10
0
ファイル: progressdlg.c プロジェクト: svn2github/iup-github
static void counter_start(int totalcount)
{
  if (!counter_dlg)
  {
    counter_dlg = IupProgressDlg();

    //  IupSetAttribute(counter_dlg, "PARENTDIALOG", "MainWindow");
    IupSetAttribute(counter_dlg, "TITLE", "Long Processing Test");
    IupSetAttribute(counter_dlg, "DESCRIPTION", "Description first line\nSecond Line");
    IupSetCallback(counter_dlg, "CANCEL_CB", cancel_cb);
    IupSetInt(counter_dlg, "TOTALCOUNT", totalcount);
    IupSetAttribute(counter_dlg, "RESIZE", "YES");
//    IupSetAttribute(counter_dlg, "MINCLOCK", "500");
//    IupSetAttribute(counter_dlg, "MINPERCENT", "20");
  }

  IupSetAttribute(counter_dlg, "STATE", NULL);

  IupShow(counter_dlg);

  IupSetAttribute(counter_dlg, "SIMULATEMODAL", "Yes");

//  Ihandle* main_window = IupGetHandle("MainWindow");
//  IupSetAttribute(main_window, "TASKBARPROGRESSSTATE", "NORMAL");
//  IupSetAttribute(main_window, "TASKBARPROGRESSVALUE", "0");

  printf("Start\n");
}
コード例 #11
0
ファイル: flattabs.c プロジェクト: svn2github/iup-github
static int cbTest(Ihandle* ih)
{
  Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS");

#if 1
  int count = IupGetInt(tabs, "COUNT");
  IupSetInt(tabs, "VALUEPOS", count - 1);
#endif

#if 0
  char att[50];
  int m_handle_id = 1;
  char* title;
  sprintf(att, "TABTITLE%d", m_handle_id);
  {
    Ihandle* child = IupGetChild(tabs, 1);
    title = IupGetAttribute(child, "TABTITLE");
    printf("%s=%s\n", att, title);
  }
  title = IupGetAttribute(tabs, att);
  printf("%s=%s\n", att, title);
#endif

#if 0
  IupSetAttribute(tabs, "VALUEPOS", "0");
  IupSetAttribute(tabs, "TABTITLE0", "1asdasd");
  printf("VALUE=%s\n", IupGetAttribute(tabs, "VALUE"));
  if (IupGetInt(tabs, "TABVISIBLE2"))
    IupSetAttribute(tabs, "TABVISIBLE2", "No");
  else
    IupSetAttribute(tabs, "TABVISIBLE2", "Yes");
#endif

  return IUP_DEFAULT;
}
コード例 #12
0
ファイル: iup_scrollbox.c プロジェクト: defdef/iup
static int iScrollBoxMotion_CB(Ihandle *ih, int x, int y, char* status)
{
  if (iup_isbutton1(status) &&
      iupAttribGet(ih, "_IUP_DRAG_SB"))
  {
    int start_x = iupAttribGetInt(ih, "_IUP_START_X");
    int start_y = iupAttribGetInt(ih, "_IUP_START_Y");
    int dx = x - start_x;
    int dy = y - start_y;
    int posx = iupAttribGetInt(ih, "_IUP_START_POSX");
    int posy = iupAttribGetInt(ih, "_IUP_START_POSY");
    IupSetInt(ih, "POSX", posx-dx);  /* drag direction is oposite to scrollbar */
    IupSetInt(ih, "POSY", posy-dy);
    iScrollBoxScroll_CB(ih, 0, IupGetFloat(ih, "POSX"), IupGetFloat(ih, "POSY"));
  }
  return IUP_DEFAULT;
}
コード例 #13
0
void status_bar_count(int iterations)
{
	if(done)
		return;

	IupSetInt(status_prog, "MAX", iterations);
	IupLoopStep();
}
コード例 #14
0
void status_bar_inc()
{
	if(done)
		return;

	IupSetInt(status_prog, "VALUE", IupGetInt(status_prog, "VALUE")+1);
	IupLoopStep();
}
コード例 #15
0
ファイル: iupgtk_open.c プロジェクト: sanikoyes/iup
static void gtkSetGlobalAttrib(void)
{
  GdkDisplay* display = gdk_display_get_default();
  Display* xdisplay = GDK_DISPLAY_XDISPLAY(display);
  IupSetGlobal("XDISPLAY", (char*)xdisplay);
  IupSetGlobal("XSCREEN", (char*)XDefaultScreen(xdisplay));
  IupSetGlobal("XSERVERVENDOR", ServerVendor(xdisplay));
  IupSetInt(NULL, "XVENDORRELEASE", VendorRelease(xdisplay));
}
コード例 #16
0
static int iColorBrowserDlgSetAlphaAttrib(Ihandle* ih, const char* value)
{
  IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");
  int alpha;
  if (iupStrToInt(value, &alpha))
  {
    colordlg_data->alpha = (unsigned char)alpha;
    IupSetInt(colordlg_data->alpha_txt, "VALUE", (int)colordlg_data->alpha);
    IupSetInt(colordlg_data->alpha_val, "VALUE", (int)colordlg_data->alpha);

    colordlg_data->color = cdEncodeAlpha(colordlg_data->color, colordlg_data->alpha);
    colordlg_data->previous_color = cdEncodeAlpha(colordlg_data->previous_color, colordlg_data->alpha);
    iColorBrowserDlgColorCnvRepaint(colordlg_data);

    if (!ih->handle)  /* do it only before map */
      IupSetAttribute(ih, "SHOWALPHA", "YES");
  }
 
  return 1;
}
コード例 #17
0
ファイル: iup_key.c プロジェクト: defdef/iup
void iupKeySetMnemonic(Ihandle* ih, int code, int pos)
{
  Ihandle* ih_dialog = IupGetDialog(ih);
  char attrib[16] = "_IUP_MNEMONIC_ ";
  attrib[14] = (char)code;
  iupStrUpper(attrib, attrib);

  IupSetAttribute(ih_dialog, attrib, (char*)ih);
  if (IupClassMatch(ih, "tabs"))
    IupSetInt(ih, attrib, pos);
}
コード例 #18
0
ファイル: iup_cells.c プロジェクト: Vulcanior/IUP
static int iCellsResize_CB(Ihandle* ih, int w, int h)
{
  /* recalculate scrollbars limits */
  iCellsAdjustScroll(ih, w, h);  

  /* This could have changed the scrollbar visibility, 
     so the canvas client size can change, so updated it twice. */
  IupGetIntInt(ih, "DRAWSIZE", &w, &h);
  IupSetInt(ih, "DX", w);
  IupSetInt(ih, "DY", h);

  /* update canvas size */
  cdCanvasActivate(ih->data->cd_canvas);
  cdCanvasGetSize(ih->data->cd_canvas, &ih->data->w, &ih->data->h, NULL, NULL);

  /* update render */
  iCellsRenderCells(ih);

  return IUP_DEFAULT;
}
コード例 #19
0
ファイル: iup_colordlg.c プロジェクト: mwoz/Hildim.Source
static int iColorDlgSetAlphaAttrib(Ihandle* ih, const char* value)
{
  IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");
  int alpha;
  if (iupStrToInt(value, &alpha))
  {
    colordlg_data->alpha = (unsigned char)alpha;
    IupSetInt(colordlg_data->alpha_txt, "VALUE", (int)colordlg_data->alpha);
    IupSetInt(colordlg_data->alpha_val, "VALUE", (int)colordlg_data->alpha);

    colordlg_data->color = iupDrawColor(colordlg_data->red, colordlg_data->green, colordlg_data->blue, colordlg_data->alpha);
    colordlg_data->previous_color = iupDrawColor(iupDrawRed(colordlg_data->previous_color), iupDrawGreen(colordlg_data->previous_color), iupDrawBlue(colordlg_data->previous_color), colordlg_data->alpha);
    IupUpdate(colordlg_data->color_cnv);

    if (!ih->handle)  /* do it only before map */
      IupSetAttribute(ih, "SHOWALPHA", "YES");
  }
 
  return 1;
}
コード例 #20
0
static int iMatrixExUndoListAction_CB(Ihandle* ih_list, char *text, int item, int state)
{
  if (state==1)
  {
    ImatExData* matex_data = (ImatExData*)IupGetAttribute(ih_list, "MATRIX_EX_DATA");
    int pos = item-1;

    if (pos != matex_data->undo_stack_pos)
    {
      if (pos < matex_data->undo_stack_pos)
        IupSetInt(matex_data->ih, "UNDO", matex_data->undo_stack_pos-pos);
      else if (pos > matex_data->undo_stack_pos)
        IupSetInt(matex_data->ih, "REDO", pos-matex_data->undo_stack_pos);

      iMatrixUndoListUpdate(matex_data, ih_list);
    }
  }

  (void)text;
  return IUP_DEFAULT;
}
コード例 #21
0
ファイル: iuplua.c プロジェクト: mwoz/Hildim.Source
void iuplua_plugstate(lua_State *L, Ihandle *ih)
{
  IupSetAttribute(ih, "_IUPLUA_STATE_CONTEXT",(char *) L);

  if (IupGetGlobal("IUPLUA_THREADED"))
  {
    int ref;
    lua_pushthread(L);
    ref = luaL_ref(L, LUA_REGISTRYINDEX);   /* keep ref for L, L maybe a thread */
    IupSetInt(ih, "_IUPLUA_STATE_THREAD", ref);
  }
}
コード例 #22
0
ファイル: iup_colordlg.c プロジェクト: mwoz/Hildim.Source
static int iColorDlgAlphaSpin_CB(Ihandle* ih, int vi) 
{
  IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");

  colordlg_data->alpha = (unsigned char)vi;
  IupSetInt(colordlg_data->alpha_val, "VALUE", (int)colordlg_data->alpha);

  colordlg_data->color = iupDrawColor(colordlg_data->red, colordlg_data->green, colordlg_data->blue, colordlg_data->alpha);
  IupUpdate(colordlg_data->color_cnv);

  return IUP_DEFAULT;
}
コード例 #23
0
static int iColorBrowserDlgAlphaSpin_CB(Ihandle* ih, int vi) 
{
  IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");

  colordlg_data->alpha = (unsigned char)vi;
  IupSetInt(colordlg_data->alpha_val, "VALUE", (int)colordlg_data->alpha);

  colordlg_data->color = cdEncodeAlpha(colordlg_data->color, colordlg_data->alpha);
  iColorBrowserDlgColorCnvRepaint(colordlg_data);

  return IUP_DEFAULT;
}
コード例 #24
0
ファイル: example3_11.c プロジェクト: svn2github/iup-github
int find_next_action_cb(Ihandle* bt_next)
{
  Ihandle* multitext = (Ihandle*)IupGetAttribute(bt_next, "MULTITEXT");
  char* str = IupGetAttribute(multitext, "VALUE");
  int find_pos = IupGetInt(multitext, "FIND_POS");

  Ihandle* txt = IupGetDialogChild(bt_next, "FIND_TEXT");
  char* str_to_find = IupGetAttribute(txt, "VALUE");

  Ihandle* find_case = IupGetDialogChild(bt_next, "FIND_CASE");
  int casesensitive = IupGetInt(find_case, "VALUE");

  int pos = str_find(str + find_pos, str_to_find, casesensitive);
  if (pos >= 0)
    pos += find_pos;
  else if (find_pos > 0)
    pos = str_find(str, str_to_find, casesensitive);  /* try again from the start */

  if (pos >= 0)
  {
    int lin, col, 
      end_pos = pos + (int)strlen(str_to_find);

    IupSetInt(multitext, "FIND_POS", end_pos);

    IupSetFocus(multitext);
    IupSetfAttribute(multitext, "SELECTIONPOS", "%d:%d", pos, end_pos);

    IupTextConvertPosToLinCol(multitext, pos, &lin, &col);
    IupTextConvertLinColToPos(multitext, lin, 0, &pos);  /* position at col=0, just scroll lines */
    IupSetInt(multitext, "SCROLLTOPOS", pos);
  }
  else
    IupMessage("Warning", "Text not found.");




  return IUP_DEFAULT;
}
コード例 #25
0
ファイル: iup_cells.c プロジェクト: Vulcanior/IUP
/* Function used to turn a cell visible  */
static void iCellsSetFullVisible(Ihandle* ih, int i, int j)
{
  int xmin, xmax, ymin, ymax;
  int posx = IupGetInt(ih, "POSX");
  int posy = IupGetInt(ih, "POSY");
  int dx = 0;
  int dy = 0;
  
  /* Getting the frontiers positions for the visible cell */
  int min_x = iCellsGetRangedWidth(ih, 1, ih->data->non_scrollable_cols);
  int max_y = ih->data->h - iCellsGetRangedHeight(ih, 1, ih->data->non_scrollable_lins); 

  /* Getting the cell's area limit */
  iCellsGetLimits(ih, i, j, &xmin, &xmax, &ymin, &ymax);

  /* Adjusting the diference of the scrollbars' position (horizontal) */
  if (xmax > ih->data->w)
    dx = xmax - ih->data->w;

  /* Giving priority to xmin position. This can be seen by the usage
   * of dx at the left part of the expression (using the last dx).
   * This is the case wher the cell cannot be fitted. */
  if (xmin - dx < min_x)
    dx = - (min_x - xmin); 

  /* Adjusting the diference of the scrollbars' position (horizontal) */
  if (ymax > max_y)
    dy = - (ymax - max_y);
  if (ymin < 0)
    dy = -ymin;

  /* Adding the diference to scrollbars' position */
  posx += dx;
  posy += dy;

  /* Setting iup scrollbars' attributes */
  IupSetInt(ih, "POSX", posx); 
  IupSetInt(ih, "POSY", posy); 
}
コード例 #26
0
ファイル: iup_colordlg.c プロジェクト: mwoz/Hildim.Source
static int iColorDlgSetValueAttrib(Ihandle* ih, const char* value)
{
  IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");
  int ret = iStrToRGBA(value, &colordlg_data->red, &colordlg_data->green, &colordlg_data->blue, &colordlg_data->alpha);
  if (!ret)
    return 0;
  
  colordlg_data->previous_color = iupDrawColor(colordlg_data->red, colordlg_data->green, colordlg_data->blue, colordlg_data->alpha);

  if (ret == 4)
  {
    IupSetInt(colordlg_data->alpha_txt, "VALUE", (int)colordlg_data->alpha);
    IupSetInt(colordlg_data->alpha_val, "VALUE", (int)colordlg_data->alpha);

    if (!ih->handle)  /* do it only before map */
      IupSetAttribute(ih, "SHOWALPHA", "YES");
  }

  iColorDlgRGB_TXT_Update(colordlg_data);
  iColorDlgRGBChanged(colordlg_data);

  return 0;
}
コード例 #27
0
ファイル: iuplua.c プロジェクト: mwoz/Hildim.Source
/* iup.SetWidget(ih, widget) */
static int SetWidget(lua_State *L)
{
  /* Saves the Lua object reference as an attribute, 
     i.e. associates a Lua object with the Ihandle*.
     Used by the "iupWidget" constructor and by RegisterHandle */
  Ihandle * ih = iuplua_checkihandle(L, 1);
  char* sref = IupGetAttribute(ih, "_IUPLUA_WIDGET_TABLE_REF");
  if (!sref)
  {
    int ref = luaL_ref(L, LUA_REGISTRYINDEX);
    IupSetInt(ih, "_IUPLUA_WIDGET_TABLE_REF", ref);
    IupSetCallback(ih, "LDESTROY_CB", il_destroy_cb);
  }
  return 0;
}
コード例 #28
0
ファイル: progressdlg.c プロジェクト: svn2github/iup-github
static void counter_stop(void)
{
  // force one last update
  IupSetInt(counter_dlg, "COUNT", IupGetInt(counter_dlg, "TOTALCOUNT"));

  IupSetAttribute(counter_dlg, "SIMULATEMODAL", "No");

  IupHide(counter_dlg);

//  Ihandle* main_window = IupGetHandle("MainWindow");
//  IupSetAttribute(main_window, "TASKBARPROGRESSVALUE", "100");
//  IupSetAttribute(main_window, "TASKBARPROGRESSSTATE", "NOPROGRESS");

  printf("Stop\n");
}
コード例 #29
0
ファイル: iup_colordlg.c プロジェクト: mwoz/Hildim.Source
static int iColorDlgAlphaAction_CB(Ihandle* ih, int c, char* value) 
{
  IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");
  int vi;

  if (iupStrToInt(value, &vi))
  {
    colordlg_data->alpha = (unsigned char)vi;
    IupSetInt(colordlg_data->alpha_val, "VALUE", (int)colordlg_data->alpha);

    colordlg_data->color = iupDrawColor(colordlg_data->red, colordlg_data->green, colordlg_data->blue, colordlg_data->alpha);
    IupUpdate(colordlg_data->color_cnv);
  }

  (void)c;
  return IUP_DEFAULT;
}
コード例 #30
0
ファイル: tabs.c プロジェクト: DavidPhillipOster/IupCocoa
static int cbTabRightButton(Ihandle* ih, int pos)
{
  Ihandle* menu = IupMenu(IupItem("Add Tab", "cbAddTab"),
                          IupItem("Insert Tab", "cbInsertTab"),
                          IupItem("Remove Current Tab", "cbRemoveTab"),
                          IupItem("Remove This", "cbRemoveThisTab"), 
                          IupItem("Hide This", "cbHideThisTab"),
                          NULL);
  
  IupSetAttribute(menu, "APP_TABS", IupGetAttribute(ih, "APP_TABS"));
  IupSetInt(menu, "APP_THISTAB", pos);

  IupPopup(menu, IUP_MOUSEPOS, IUP_MOUSEPOS);
  IupDestroy(menu);

  return IUP_DEFAULT;
}