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


C++ IupStoreAttribute函数代码示例

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


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

示例1: uiSyncFixed

// naive fixed number of (short) * 0.01
int uiSyncFixed(Ihandle *ih) {
    short *fixedPointer = (short*)IupGetAttribute(ih, SYNCED_VALUE);
    const float maxFixedValue = IupGetFloat(ih, FIXED_MAX);
    const float minFixedValue = IupGetFloat(ih, FIXED_MIN);
    float value = IupGetFloat(ih, "VALUE");
    float newValue = value;
    short fixValue;
    char valueBuf[8];
    if (newValue > maxFixedValue) {
        newValue = maxFixedValue;
    } else if (newValue < minFixedValue) {
        newValue = minFixedValue;
    }

    if (newValue != value && value != 0) {
        sprintf(valueBuf, "%.2f", newValue);
        IupStoreAttribute(ih, "VALUE", valueBuf);
        // put caret at end to enable editing while normalizing
        IupStoreAttribute(ih, "CARET", "10");
    }
    // sync back
    fixValue = newValue / FIXED_EPSILON;
    InterlockedExchange16(fixedPointer, fixValue);
    return IUP_DEFAULT;
}
开发者ID:ngyikp,项目名称:clumsy,代码行数:26,代码来源:utils.c

示例2: motFontDlgShow_CB

static int motFontDlgShow_CB(Ihandle* ih, int state)
{
  if (state == IUP_SHOW)
  {
    Ihandle* sample = IupGetDialogChild(ih, "SAMPLE");
    char* value = iupAttribGet(ih, "PREVIEWTEXT");
    if (value)
      IupStoreAttribute(sample, "TITLE", value);

    value = iupAttribGet(ih, "VALUE");
    if (value)
    {
      IupStoreAttribute(sample, "FONT", value);
      value = IupGetAttribute(sample, "FONTFACE");

      motFontDlgSelectFontFace(ih, value, 1);
    }

    if (!IupGetCallback(ih, "HELP_CB"))
    {
      Ihandle* help_bt = IupGetDialogChild(ih, "HELPBUT");
      IupSetAttribute(help_bt, "VISIBLE", "NO");
    }
  }
  return IUP_DEFAULT;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:26,代码来源:iupmot_fontdlg.c

示例3: adjust_origin

/** 
 * Function used to make a cell the first visible one. 
 */
static int adjust_origin(TCells* obj, char* attr) { 
  char buffer[ 15 ];
  int lin = -9, col = -9;

  /* Scanning the origin */
  iupStrToIntInt(attr, &lin, &col, ':');

  /* 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 <= obj->non_scrollable_lins) {
     IupSetAttribute(obj->self, IUP_POSY, "0"); 
  }
  else if (lin <= get_nlines(obj)) { 
     int ymin_sum = get_ranged_height(obj, obj->non_scrollable_lins+1, lin-1);
     sprintf(buffer, "%d", ymin_sum);
     IupStoreAttribute(obj->self, IUP_POSY, buffer); 
  }

  /* As said before... */
  if (col <= obj->non_scrollable_cols) {
     IupSetAttribute(obj->self, IUP_POSX, "0"); 
  }
  else if (col <= get_ncols(obj)) { 
     int xmin_sum = get_ranged_width(obj, obj->non_scrollable_cols+1, col-1);
     sprintf(buffer, "%d", xmin_sum);
     IupStoreAttribute(obj->self, IUP_POSX, buffer); 
  }

  return 1;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:35,代码来源:iupcells.c

示例4: set_full_visible

/** 
 * Function used to turn a cell visible 
 * @param i cell line number.
 * @param j cell column number.
 */
static void set_full_visible(TCells* obj, int i, int j) {
  char buffer[ 32 ];
  int xmin, xmax, ymin, ymax;
  int posx = IupGetInt(obj->self, IUP_POSX);
  int posy = IupGetInt(obj->self, IUP_POSY);
  int dx = 0, dy = 0;
  
  /* Getting the frontiers positions for the visible cell */
  int min_x = get_ranged_width(obj, 1, obj->non_scrollable_cols);
  int max_y = obj->height - get_ranged_height(obj, 1, obj->non_scrollable_lins); 

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

  /* Adjusting the diference of the scrollbars' position (horizontal) */
  if (xmax > obj->width) dx = xmax - obj->width;
  /* 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 */
  sprintf(buffer, "%.1f", (float)posx);
  IupStoreAttribute(obj->self, IUP_POSX, buffer); 
  sprintf(buffer, "%.1f", (float)posy);
  IupStoreAttribute(obj->self, IUP_POSY, buffer); 
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:39,代码来源:iupcells.c

示例5: IupVal

Ihandle *IupQuakeScale(char *title, float min, float max, float step, char *key, float def)
{
    Ihandle *scale,*label_value,*label_min,*label_max;

    char buf[128];

    scale = IupVal("HORIZONTAL");
    snprintf(buf, 128, "EXPAND=HORIZONTAL, MIN=%.1f, MAX=%.1f, VALUE=%.1f, STEP=0.01", min, max, def);
    IupSetAttributes(scale, buf);
    IupSetCallback(scale, "VALUECHANGED_CB", (Icallback)IupQuakeScaleUpdate);

    snprintf(buf, 16, "%.1f", def);
    label_value = IupLabel(buf);
    IupStoreAttribute(label_value, "EXPAND", "HORIZONTAL");
    IupStoreAttribute(label_value, "ALIGNMENT", "ACENTER:ACENTER");

    snprintf(buf, 16, "%.1f", min);
    label_min = IupLabel(buf);
    IupStoreAttribute(label_min, "ALIGNMENT", "ACENTER:ACENTER");
    snprintf(buf, 16, "%.1f", max);
    label_max = IupLabel(buf);
    IupStoreAttribute(label_max, "ALIGNMENT", "ACENTER:ACENTER");

    return IupVbox(
            IupLabel(title),
            IupHbox(
                label_min,
                label_value,
                label_max,
                NULL
            ),
            scale,
            NULL
    );
}
开发者ID:hifi-unmaintained,项目名称:aq2cfg,代码行数:35,代码来源:mouse.c

示例6: IupButton

Ihandle* IupButton (const char* label, const char* action)
{
  Ihandle *n = iupTreeCreateNode(NULL);
  type(n) = BUTTON_;
  IupStoreAttribute (n,IUP_TITLE,label);
  if (action) IupStoreAttribute (n,IUP_ACTION,action);
  return n;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:8,代码来源:icreate.c

示例7: dial2_btndown_cb

// X zoom
int dial2_btndown_cb(Ihandle *self, double angle)
{
  int ii = tabs_get_index();

  IupStoreAttribute(plot[ii], "OLD_XMIN", IupGetAttribute(plot[ii], "AXS_XMIN"));
  IupStoreAttribute(plot[ii], "OLD_XMAX", IupGetAttribute(plot[ii], "AXS_XMAX"));

  return IUP_DEFAULT;
}
开发者ID:EduardoPataki,项目名称:iup-examples,代码行数:10,代码来源:pplot.cpp

示例8: main

int main(int argc, char **argv)
{
    Ihandle *win,*tabs,*buttons;

    IupOpen(&argc, &argv);      

    tabs = IupTabs(
        IupQuakeBindingLayout(),
        IupQuakeMouseLayout(),
        IupFill(),
        IupFill(),
        IupFill(),
        NULL
    );
    IupStoreAttribute(tabs, "TABTITLE0", "Keyboard");
    IupStoreAttribute(tabs, "TABTITLE1", "Mouse");
    IupStoreAttribute(tabs, "TABTITLE2", "Audio");
    IupStoreAttribute(tabs, "TABTITLE3", "Video");
    IupStoreAttribute(tabs, "TABTITLE4", "Multiplayer");

    IupStoreAttribute(tabs, "MARGIN", "2x2");

    buttons = IupHbox(
        IupSetCallbacks(IupButton("&Quit", "ACTION"), "ACTION", (Icallback)IupExitLoop, NULL),
        IupFill(),
        IupButton("&Save", NULL),
        IupFill(),
        IupButton("&Launch game", NULL),
        NULL
    );

    win = IupDialog(
            IupSetAttributes(
                IupVbox(
                    IupSetAttributes(
                        IupLabel("Action Quake 2 Configuration"),
                        "EXPAND=YES, ALIGNMENT=ACENTER:ACENTER, FONT=\"sans-serif, Bold 18\""
                    ),
                    tabs,
                    //buttons,
                    NULL
                ),
                "GAP=5, MARGIN=3x3"
            )
    );

    IupStoreAttribute(win, "TITLE", "Action Quake 2 Configuration");
    IupStoreAttribute(win, "RESIZE", "NO");

    IupShow(win);

    /* bug? */
    IupStoreAttribute(win, "SIZE", NULL);
    IupRefresh(win);

    IupMainLoop();
}
开发者ID:hifi-unmaintained,项目名称:aq2cfg,代码行数:57,代码来源:main.c

示例9: IupSetAttributeHandle

void IupSetAttributeHandle(Ihandle *ih, const char* name, Ihandle *ih_named)
{
  char* handle_name = IupGetName(ih_named);
  if (handle_name)
    IupStoreAttribute(ih, name, handle_name);
  else
  {
    char str_name[100];
    sprintf(str_name, "_IUP_NAME(%p)", ih_named);
    IupSetHandle(str_name, ih_named);
    IupStoreAttribute(ih, name, str_name);
  }
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:13,代码来源:ienv.c

示例10: SetAttribute

static void SetAttribute(void)
{
  if (lua_isnil(lua_getparam(3)))
    IupSetAttribute(iuplua_checkihandle(1), luaL_check_string(2), NULL);
  else
    IupStoreAttribute(iuplua_checkihandle(1), luaL_check_string(2), luaL_check_string(3));
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:7,代码来源:iuplua_api.c

示例11: IupCanvas

Ihandle* IupCanvas (const char* action)
{
  Ihandle *n = iupTreeCreateNode(NULL);
  type(n) = CANVAS_;
  if (action) IupStoreAttribute (n,IUP_ACTION,action);
  return n;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:7,代码来源:icreate.c

示例12: IupList

Ihandle* IupList (const char* action)
{
  Ihandle *n = iupTreeCreateNode(NULL);
  type(n) = LIST_;
  if (action) IupStoreAttribute (n,IUP_ACTION,action);
  return n;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:7,代码来源:icreate.c

示例13: iupShowError

void iupShowError(Ihandle* parent, const char* message)
{
  Ihandle* dlg = IupMessageDlg();
  char* title = NULL, *str_message;

  if (parent)
  {
    IupSetAttributeHandle(dlg, "PARENTDIALOG", parent);
    title = IupGetAttribute(parent, "TITLE");
  }

  if (!title)
    title = "[email protected]_ERROR";

  IupSetStrAttribute(dlg, "TITLE", title);
  IupSetAttribute(dlg, "DIALOGTYPE", "ERROR");
  IupSetAttribute(dlg, "BUTTONS", "OK");

  str_message = IupGetLanguageString(message);
  if (!str_message)
    str_message = (char*)message;
  IupStoreAttribute(dlg, "VALUE", str_message);

  IupPopup(dlg, IUP_CURRENT, IUP_CURRENT);

  IupDestroy(dlg);
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:27,代码来源:iup_predialogs.c

示例14: iMatrixSetMultilineAttrib

static int iMatrixSetMultilineAttrib(Ihandle* ih, const char* value)
{
  IupStoreAttribute(ih->data->texth, "MULTILINE", value);
  if (iupStrBoolean(value))
    IupSetAttribute(ih->data->texth, "SCROLLBAR", "NO");
  return 1;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:7,代码来源:iupmatrix.c

示例15: IupMatrix

Ihandle *create_mat(void)
{
  int i, j;
  Ihandle *mat = IupMatrix(NULL); 
  
  IupSetAttribute(mat,IUP_NUMCOL,"2"); 
  IupSetAttribute(mat,IUP_NUMLIN,"100"); 
  
  IupSetAttribute(mat,IUP_NUMCOL_VISIBLE,"2") ;
  IupSetAttribute(mat,IUP_NUMLIN_VISIBLE,"20") ;

  for(i = 0; i < 100; i++)
  {
    for(j = 0; j <= 2; j++)
    {
      char pos[10];
      char pos2[10];
      sprintf(pos, "%d:%d", i, j);
      strcpy(pos2, pos);
      IupStoreAttribute(mat, pos, pos2);
    }
  }

  IupSetAttribute(mat,"WIDTHDEF","34");

  return mat;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:27,代码来源:test_del.c


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