当前位置: 首页>>代码示例>>C++>>正文


C++ IupGetInt函数代码示例

本文整理汇总了C++中IupGetInt函数的典型用法代码示例。如果您正苦于以下问题:C++ IupGetInt函数的具体用法?C++ IupGetInt怎么用?C++ IupGetInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IupGetInt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: goto_ok_action_cb

int goto_ok_action_cb(Ihandle* bt_ok)
{
  int line_count = IupGetInt(bt_ok, "TEXT_LINECOUNT");
  Ihandle* txt = IupGetDialogChild(bt_ok, "LINE_TEXT");
  int line = IupGetInt(txt, "VALUE");
  if (line < 1 || line >= line_count)
  {
    IupMessage("Error", "Invalid line number.");
    return IUP_DEFAULT;
  }

  IupSetAttribute(IupGetDialog(bt_ok), "STATUS", "1");
  return IUP_CLOSE;
}
开发者ID:carblue,项目名称:iup,代码行数:14,代码来源:example3_6.c

示例2: iupmotCBcaret

void iupmotCBcaret (Widget w, XtPointer client_data, XtPointer call_data)
{
   IFnii cb;
   Iwidgetdata *d = NULL;
   Ihandle *n;
   XmTextVerifyCallbackStruct* textverify = (XmTextVerifyCallbackStruct*)call_data;

   if (iupmot_incallback) return;

   XtVaGetValues (w, XmNuserData, &d, NULL);
   if (!d) return;
   n = d->ihandle;

   if (n == NULL) return;
   cb = (IFnii) IupGetCallback(n, "CARET_CB");
   if (cb)
   {
      int old_col, old_row, col, row=1;
      long int pos;

      pos = textverify->newInsert;

      if (type(n) == TEXT_ || (type(n) == LIST_ && iupCheck(n, "EDITBOX")==YES))
      {
        col = pos+1;
      }
      else /* MULTILINE_ */
      {
        long int linText, colText;
        char *str = XmTextGetString((Widget)handle(n));
        iupmotLincol( str, pos, &linText, &colText );
        row = linText;
        col = colText;
      }

      old_col = IupGetInt(n, "_IUPMOT_CARETCOL");
      old_row = IupGetInt(n, "_IUPMOT_CARETROW");
      if (row != old_row || col != old_col)
      {
        IupSetfAttribute(n, "_IUPMOT_CARETCOL", "%d", col);
        IupSetfAttribute(n, "_IUPMOT_CARETROW", "%d", row);

        iupmot_incallback = TRUE;
        if (cb(n, row, col) == IUP_CLOSE) 
          iupmot_exitmainloop = 1;
        iupmot_incallback = FALSE;
      }
   }
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:49,代码来源:motproc.c

示例3: iMatrixDrawFeedbackImage

static void iMatrixDrawFeedbackImage(Ihandle* ih, int x1, int x2, int y1, int y2, int lin, int col, int active, int marked, const char*name, unsigned char* alpha)
{
  int x, y;
  Ihandle* image = IupGetHandle(name);
  if (image)
  {
    long bgcolor;
    int image_width = IupGetInt(image, "WIDTH");
    int image_height = IupGetInt(image, "HEIGHT");
    unsigned char r = 255, g = 255, b = 255;
    iupMatrixGetBgRGB(ih, lin, col, &r, &g, &b, marked, active);
    bgcolor = cdEncodeColor(r, g, b);

    y = (y2 + y1 + image_height) / 2;
    x = (x2 + x1 - image_width) / 2;

    cdIupDrawImage(ih->data->cd_canvas, image, x, iupMATRIX_INVERTYAXIS(ih, y), 0, 0, !active, bgcolor);
  }
  else
  {
    static unsigned char red[IMAT_FEEDBACK_SIZE * IMAT_FEEDBACK_SIZE];
    static unsigned char green[IMAT_FEEDBACK_SIZE * IMAT_FEEDBACK_SIZE];
    static unsigned char blue[IMAT_FEEDBACK_SIZE * IMAT_FEEDBACK_SIZE];
    static unsigned char last_r = 0, last_g = 0, last_b = 0;
    static int first = 1;

    unsigned char r = 0, g = 0, b = 0;
    iupMatrixGetFgRGB(ih, lin, col, &r, &g, &b, marked, active);

    if (first || last_r != r || last_g != g || last_b != b)
    {
      int count = IMAT_FEEDBACK_SIZE * IMAT_FEEDBACK_SIZE;

      memset(red, r, count);
      memset(green, g, count);
      memset(blue, b, count);

      last_r = r;
      last_g = g;
      last_b = b;
      first = 0;
    }

    y = (y2 + y1 + IMAT_FEEDBACK_SIZE) / 2;
    x = (x2 + x1 - IMAT_FEEDBACK_SIZE) / 2;

    cdCanvasPutImageRectRGBA(ih->data->cd_canvas, IMAT_FEEDBACK_SIZE, IMAT_FEEDBACK_SIZE, red, green, blue, alpha, x, iupMATRIX_INVERTYAXIS(ih, y), IMAT_FEEDBACK_SIZE, IMAT_FEEDBACK_SIZE, 0, 0, 0, 0);
  }
}
开发者ID:ivanceras,项目名称:iup-mirror,代码行数:49,代码来源:iupmat_draw.c

示例4: iCellsGetLimits

/* Function used to calculate a cell limits */
static int iCellsGetLimits(Ihandle* ih, int i, int j, int* xmin, int* xmax, int* ymin, int* ymax)
{
  int result = 1;
  int xmin_sum = 0;
  int ymin_sum = 0;
  int w = ih->data->w;
  int h = ih->data->h;
  int _xmin, _xmax, _ymin, _ymax;

  /* Adjusting the inital position according to the cell's type. If it
   * is non-scrollable, the origin is always zero, otherwise the origin 
   * is the scrollbar position */
  int posx = (j <= ih->data->non_scrollable_cols)? 0: IupGetInt(ih, "POSX");
  int posy = (i <= ih->data->non_scrollable_lins)? 0: IupGetInt(ih, "POSY");
  int idx;

  /* Adding to the origin, the cells' width and height */
  for (idx = 1; idx < j; idx++)
    xmin_sum += iCellsGetWidth(ih, idx);
  
  for (idx = 1; idx < i; idx++)
    ymin_sum += iCellsGetHeight(ih, idx);

  /* Finding the cell origin */
  _xmin = xmin_sum - posx;
  _ymax = h - (ymin_sum - posy) - 1;

  /* Computing the cell limit, based on its origin and size */
  _xmax = _xmin + iCellsGetWidth(ih, j);
  _ymin = _ymax - iCellsGetHeight(ih, i);

  /* Checking if the cell is visible */
  if (_xmax < 0 || _xmin > w || _ymin > h || _ymax < 0)
    result = 0;

  if (xmin != NULL)
    *xmin = _xmin;

  if (xmax != NULL)
    *xmax = _xmax;

  if (ymin != NULL)
    *ymin = _ymin;

  if (ymax != NULL)
    *ymax = _ymax;

  return result;
}
开发者ID:Vulcanior,项目名称:IUP,代码行数:50,代码来源:iup_cells.c

示例5: iScrollBoxScroll_CB

static int iScrollBoxScroll_CB(Ihandle *ih, int op, float posx, float posy)
{
  if (ih->firstchild)
  {
    if (IupGetInt(ih, "DX") > IupGetInt(ih, "XMAX")-iupdrvGetScrollbarSize())
      posx = 0;
    if (IupGetInt(ih, "DY") > IupGetInt(ih, "YMAX")-iupdrvGetScrollbarSize())
      posy = 0;

    iupBaseSetPosition(ih->firstchild, -(int)posx, -(int)posy);
    iupLayoutUpdate(ih->firstchild);
  }
  (void)op;
  return IUP_DEFAULT;
}
开发者ID:defdef,项目名称:iup,代码行数:15,代码来源:iup_scrollbox.c

示例6: iScrollBoxButton_CB

static int iScrollBoxButton_CB(Ihandle *ih, int but, int pressed, int x, int y, char* status)
{
  if (but==IUP_BUTTON1 && pressed)
  {
    iupAttribSetInt(ih, "_IUP_START_X", x);
    iupAttribSetInt(ih, "_IUP_START_Y", y);
    iupAttribSetInt(ih, "_IUP_START_POSX", IupGetInt(ih, "POSX"));
    iupAttribSetInt(ih, "_IUP_START_POSY", IupGetInt(ih, "POSY"));
    iupAttribSet(ih, "_IUP_DRAG_SB", "1");
  }
  if (but==IUP_BUTTON1 && !pressed)
    iupAttribSet(ih, "_IUP_DRAG_SB", NULL);
  (void)status;
  return IUP_DEFAULT;
}
开发者ID:defdef,项目名称:iup,代码行数:15,代码来源:iup_scrollbox.c

示例7: iPlayTimer_CB

static int iPlayTimer_CB(Ihandle* timer)
{
  FILE* file = (FILE*)IupGetAttribute(timer, "_IUP_PLAYFILE");
  if(feof(file) || ferror(file))
  {
    fclose(file);
    IupSetAttribute(timer, "RUN", "NO");
    IupDestroy(timer);
    IupSetGlobal("_IUP_PLAYTIMER", NULL);
    return IUP_IGNORE;
  }
  else
  {
    int cont = 1;
    int mode = IupGetInt(timer, "_IUP_PLAYMODE");

/*    while (cont)    //did not work, menus do not receive the click, why? */
    {
      cont = iPlayAction(file, mode);

      if (cont == -1)  /* error */
      {
        fclose(file);
        IupSetAttribute(timer, "RUN", "NO");
        IupDestroy(timer);
        IupSetGlobal("_IUP_PLAYTIMER", NULL);
        return IUP_IGNORE;
      }
    }

    IupFlush();
  }

  return IUP_DEFAULT;
}
开发者ID:Archs,项目名称:iup-aio,代码行数:35,代码来源:iup_recplay.c

示例8: new_color

static void new_color(void)
{
  Ihandle* dlg = IupColorDlg();

  IupSetAttribute(dlg, "PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  IupSetAttribute(dlg, "VALUE", "128 0 255");
  IupSetAttribute(dlg, "ALPHA", "142");
  //IupSetAttribute(dlg, "COLORTABLE", ";;177 29 234;;;0 0 23;253 20 119");
  IupSetAttribute(dlg, "SHOWHEX", "YES");
  IupSetAttribute(dlg, "SHOWCOLORTABLE", "YES");
  //IupSetAttribute(dlg, "SHOWALPHA", "YES");
  IupSetAttribute(dlg, "TITLE", "IupColorDlg Test");
  IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb);

  IupPopup(dlg, IUP_CURRENT, IUP_CURRENT);

  if (IupGetInt(dlg, "STATUS"))
  {
    printf("OK\n");
    printf("  VALUE(%s)\n", IupGetAttribute(dlg, "VALUE"));
    printf("  COLORTABLE(%s)\n", IupGetAttribute(dlg, "COLORTABLE"));
  }
  else
    printf("CANCEL\n");

  IupDestroy(dlg);
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:27,代码来源:predialogs.c

示例9: edit_menu_open_cb

int edit_menu_open_cb(Ihandle* ih)
{
  Ihandle *clipboard = IupClipboard(); 

  Ihandle *item_paste = IupGetDialogChild(ih, "ITEM_PASTE");
  Ihandle *item_cut = IupGetDialogChild(ih, "ITEM_CUT");
  Ihandle *item_delete = IupGetDialogChild(ih, "ITEM_DELETE");
  Ihandle *item_copy = IupGetDialogChild(ih, "ITEM_COPY");
  Ihandle* multitext = IupGetDialogChild(ih, "MULTITEXT");

  if (!IupGetInt(clipboard, "TEXTAVAILABLE"))
    IupSetAttribute(item_paste, "ACTIVE", "NO");
  else
    IupSetAttribute(item_paste, "ACTIVE", "YES");

  if (!IupGetAttribute(multitext, "SELECTEDTEXT")) 
  {
    IupSetAttribute(item_cut, "ACTIVE", "NO");
    IupSetAttribute(item_delete, "ACTIVE", "NO");
    IupSetAttribute(item_copy, "ACTIVE", "NO");
  }
  else 
  {
    IupSetAttribute(item_cut, "ACTIVE", "YES");
    IupSetAttribute(item_delete, "ACTIVE", "YES");
    IupSetAttribute(item_copy, "ACTIVE", "YES");
  }

  IupDestroy(clipboard);
  return IUP_DEFAULT;
}
开发者ID:carblue,项目名称:iup,代码行数:31,代码来源:example3_11.c

示例10: select_file

int select_file(Ihandle* parent_dlg, int is_open)
{
  Ihandle* config = (Ihandle*)IupGetAttribute(parent_dlg, "CONFIG");
  Ihandle* canvas = IupGetDialogChild(parent_dlg, "CANVAS");
  const char* dir = IupConfigGetVariableStr(config, "MainWindow", "LastDirectory");

  Ihandle* filedlg = IupFileDlg();
  if (is_open)
    IupSetAttribute(filedlg, "DIALOGTYPE", "OPEN");
  else
  {
    IupSetAttribute(filedlg, "DIALOGTYPE", "SAVE");
    IupSetStrAttribute(filedlg, "FILE", IupGetAttribute(canvas, "FILENAME"));
  }
  IupSetAttribute(filedlg, "EXTFILTER", "Image Files|*.bmp;*.jpg;*.png;*.tif;*.tga|All Files|*.*|");
  IupSetStrAttribute(filedlg, "DIRECTORY", dir);
  IupSetAttributeHandle(filedlg, "PARENTDIALOG", parent_dlg);

  IupPopup(filedlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
  if (IupGetInt(filedlg, "STATUS") != -1)
  {
    char* filename = IupGetAttribute(filedlg, "VALUE");
    if (is_open)
      open_file(parent_dlg, filename);
    else
      saveas_file(canvas, filename);

    dir = IupGetAttribute(filedlg, "DIRECTORY");
    IupConfigSetVariableStr(config, "MainWindow", "LastDirectory", dir);
  }

  IupDestroy(filedlg);
  return IUP_DEFAULT;
}
开发者ID:sanikoyes,项目名称:iup,代码行数:34,代码来源:example4_2.c

示例11: nodeinfo

static int nodeinfo(Ihandle* ih)
{
  char attr[50], *kind;
  Ihandle* tree = IupGetHandle("tree");
  int branch = 0, id = IupGetInt(tree, "VALUE");
  printf("\nTree Info:\n");
  printf("  TOTALCOUNT=%s\n", IupGetAttribute(tree, "COUNT"));
  printf("Node Info:\n");
  printf("  ID=%d\n", id);
  printf("  TITLE=%s\n", IupGetAttribute(tree, "TITLE"));
  printf("  DEPTH=%s\n", IupGetAttribute(tree, "DEPTH"));
  sprintf(attr, "KIND%d", id);
  kind = IupGetAttribute(tree, "KIND");
  printf("  KIND=%s\n", kind);
  if (strcmp(kind, "BRANCH")==0) branch = 1;
  if (branch)
    printf("  STATE=%s\n", IupGetAttribute(tree, "STATE"));
  printf("  IMAGE=%s\n", IupGetAttribute(tree, "IMAGE"));
  if (branch)
    printf("  IMAGEBRANCHEXPANDED=%s\n", IupGetAttribute(tree, "IMAGEBRANCHEXPANDED"));
  printf("  MARKED=%s\n", IupGetAttribute(tree, "MARKED"));
  printf("  COLOR=%s\n", IupGetAttribute(tree, "COLOR"));
  printf("  PARENT=%s\n", IupGetAttribute(tree, "PARENT"));
  printf("  COUNT=%s\n", IupGetAttribute(tree, "CHILDCOUNT"));
  printf("  USERDATA=%p\n", IupGetAttribute(tree, "USERDATA"));
  return IUP_DEFAULT;
}
开发者ID:Airr,项目名称:iup_mac,代码行数:27,代码来源:tree.c

示例12: coordinates

/* Change the cursor when it passes over a group of the column titles.
   -> x,y : mouse coordinates (canvas coordinates)
*/
void iupMatrixColResChangeCursor(Ihandle* ih, int x, int y)
{
  int ativo = IupGetInt(ih, "RESIZEMATRIX");

  if(ih->data->lin.titlewh && y < ih->data->lin.titlewh && ativo)
  {
    /* It is in the column titles area and the resize mode is on */
    int found = 0, width = ih->data->col.titlewh, col;

    if(abs(width - x) < IMAT_TOL)
      found = 1;    /* line titles */
    else
    {
      for(col = ih->data->col.first; col <= ih->data->col.last && !found; col++)
      {
        width += ih->data->col.wh[col];
        if(abs(width - x) < IMAT_TOL)
          found = 1;
      }
    }

    if (found)
    {
      iupAttribStoreStr(ih, "_IUPMAT_CURSOR", iupAttribGetStr(ih, "CURSOR"));
      IupSetAttribute(ih, "CURSOR", "RESIZE_W");
    }
    else /* It is in the empty area after the last column */
      iMatrixColResResetMatrixCursor(ih); 
  }
  else
    iMatrixColResResetMatrixCursor(ih);
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:35,代码来源:iupmat_colres.c

示例13: cbHideThisTab

static int cbHideThisTab(Ihandle* ih)
{
  Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS");
  int pos = IupGetInt(ih, "APP_THISTAB");
  IupSetAttributeId(tabs, "TABVISIBLE", pos, "No");
  return IUP_DEFAULT;
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:7,代码来源:tabs.c

示例14: item_open_action_cb

int item_open_action_cb(Ihandle* item_open)
{
  Ihandle* multitext = IupGetDialogChild(item_open, "MULTITEXT");
  Ihandle *filedlg = IupFileDlg();
  IupSetAttribute(filedlg, "DIALOGTYPE", "OPEN");
  IupSetAttribute(filedlg, "FILTER", "*.txt");
  IupSetAttribute(filedlg, "FILTERINFO", "Text Files");
  IupSetAttributeHandle(filedlg, "PARENTDIALOG", IupGetDialog(item_open));

  IupPopup(filedlg, IUP_CENTERPARENT, IUP_CENTERPARENT);

  if (IupGetInt(filedlg, "STATUS") != -1)
  {
    char* filename = IupGetAttribute(filedlg, "VALUE");
    char* str = read_file(filename);
    if (str)
    {
      IupSetStrAttribute(multitext, "VALUE", str);
      free(str);
    }
  }

  IupDestroy(filedlg);
  return IUP_DEFAULT;
}
开发者ID:carblue,项目名称:iup,代码行数:25,代码来源:example3_6.c

示例15: iupdrvActivate

void iupdrvActivate(Ihandle* ih)
{
  int is_toggle = IupClassMatch(ih, "toggle");
  int is_radio = 0;
  if (is_toggle)
    is_radio = IupGetInt(ih, "RADIO");

  /* do not use BM_CLICK because it changes the focus 
     and does not animates the button press */

  /* draw highlight */
  SendMessage(ih->handle, BM_SETSTATE, TRUE, 0);
  IupFlush();
  Sleep(150);

  /* must force a toggle change */
  if (is_toggle && !is_radio)
    IupSetAttribute(ih, "VALUE", "TOGGLE");

  /* notify */
  SendMessage(GetParent(ih->handle), WM_COMMAND, MAKEWPARAM(0, BN_CLICKED), (LPARAM)ih->handle);

  /* remove highlight */
  SendMessage(ih->handle, BM_SETSTATE, FALSE, 0);

  /* must force a radio change */
  if (is_toggle && is_radio)
    IupSetAttribute(ih, "VALUE", "TOGGLE");
}
开发者ID:Vulcanior,项目名称:IUP,代码行数:29,代码来源:iupwin_common.c


注:本文中的IupGetInt函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。