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


C++ IupGetAttribute函数代码示例

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


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

示例1: edition_cb

static int edition_cb(Ihandle *self, int lin, int col, int mode, int update)
{
  if (mode == 0)
  {
    char* value = IupGetAttribute(self, "VALUE");
#ifndef BIG_MATRIX
    if (value && strcmp(value, data[lin-1][col-1])!=0)
#else
    char* cell = IupGetAttributeId2(self, "", lin, col);
    if (value && cell && strcmp(value, cell)!=0)
#endif
      return IUP_IGNORE;
  }
  return IUP_DEFAULT;
}
开发者ID:defdef,项目名称:iup,代码行数:15,代码来源:matrix_cbmode.c

示例2: get_nc

static char* get_nc(Ihandle *n)
{
   if (type(n) == TEXT_ || (type(n) == LIST_ && iupCheck(n, "EDITBOX")==YES))
   {
      char *nc = getBuffer();
      int max;
      Widget w = (Widget)handle(n);
      if (type(n) == LIST_)
        w = (Widget)IupGetAttribute(n, "_IUPMOT_EDITBOX");
      XtVaGetValues(w, XmNmaxLength, &max, NULL);
      sprintf(nc, "%d", max);
      return nc;
   }
   return NULL;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:15,代码来源:motget.c

示例3: GetAttribute

static void GetAttribute(void)
{
  char *name = luaL_check_string(2);
  Ihandle* ih = iuplua_checkihandle(1);
  char *value = IupGetAttribute(ih, name);
  if (!value || iupATTRIB_ISINTERNAL(name))
    lua_pushnil();
  else
  {
    if (iupAttribIsPointer(ih, name))
      lua_pushuserdata((void*)value);
    else
      lua_pushstring(value);
  }
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:15,代码来源:iuplua_api.c

示例4: iupdrvDialogGetDecoration

void iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu)
{
    if (ih->data->menu)
        *menu = iupdrvMenuGetMenuBarSize(ih->data->menu);
    else
        *menu = 0;

    if (ih->handle)
    {
        winDialogGetWindowDecor(ih, border, caption);

        if (*menu)
            *caption -= *menu;
    }
    else
    {
        int has_titlebar = iupAttribGetBoolean(ih, "MAXBOX")  ||
                           iupAttribGetBoolean(ih, "MINBOX")  ||
                           iupAttribGetBoolean(ih, "MENUBOX") ||
                           IupGetAttribute(ih, "TITLE");  /* must use IupGetAttribute to check from the native implementation */

        *caption = 0;
        if (has_titlebar)
        {
            if (iupAttribGetBoolean(ih, "TOOLBOX") && iupAttribGet(ih, "PARENTDIALOG"))
                *caption = GetSystemMetrics(SM_CYSMCAPTION); /* tool window */
            else
                *caption = GetSystemMetrics(SM_CYCAPTION);   /* normal window */
        }

        *border = 0;
        if (iupAttribGetBoolean(ih, "RESIZE"))
        {
            /* has_border */
            *border = GetSystemMetrics(SM_CXFRAME);     /* Thickness of the sizing border around the perimeter of a window  */
        }                                             /* that can be resized, in pixels.                                  */
        else if (has_titlebar)
        {
            /* has_border */
            *border = GetSystemMetrics(SM_CXFIXEDFRAME);  /* Thickness of the frame around the perimeter of a window        */
        }                                               /* that has a caption but is not sizable, in pixels.              */
        else if (iupAttribGetBoolean(ih, "BORDER"))
        {
            /* has_border */
            *border = GetSystemMetrics(SM_CXBORDER);
        }
    }
}
开发者ID:xubingyue,项目名称:iup,代码行数:48,代码来源:iupwin_dialog.c

示例5: IupGetFile

int IupGetFile(char* file)
{
  Ihandle *dlg = 0;
  int i,ret,n;
  char filter[4096] = "*.*";
  char dir[4096];

  if (!file) return -1;

  dlg = IupFileDlg();

  n = strlen(file);

  /* Look for last folder separator and split filter from directory */
  for (i=n-1;i>=0; i--)
  {
    if (file[i] == '\\' || file[i] == '/') 
    {
      strncpy(dir, file, i+1);
      dir[i+1] = 0;   

      strcpy(filter, file+i+1);
      filter[n-i] = 0;

      break;
    }
  }

  IupSetAttribute(dlg, "FILTER", filter);
  IupSetAttribute(dlg, "DIRECTORY", dir);
  IupSetAttribute(dlg, "ALLOWNEW", "YES");
  IupSetAttribute(dlg, "NOCHANGEDIR", "YES");
  IupSetAttribute(dlg, "PARENTDIALOG", IupGetGlobal("PARENTDIALOG"));
  IupSetAttribute(dlg, "ICON", IupGetGlobal("ICON"));

  IupPopup(dlg, IUP_CENTER, IUP_CENTER);

  ret = IupGetInt(dlg, "STATUS");
  if (ret != -1)
  {
    char* value = IupGetAttribute(dlg, "VALUE");
    if (value) strcpy(file, value);
  }

  IupDestroy(dlg);

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

示例6: iTreeGetSB

/* Verifies which scrolling bars have been defined
   sbv: =0 doesn't have vertical scrolling bar
        =1         has  vertical scrolling bar
   sbh: =0 doesn't have horizontal scrolling bar
        =1         has horizontal scrolling bar    */
static void iTreeGetSB(Ihandle* ih, int* sbh, int* sbv)
{
  char* sb = IupGetAttribute(ih, "SCROLLBAR");

  if(sb == NULL)
    sb = "YES";

  *sbh = *sbv = 0;

  if(iupStrEqualNoCase(sb, "YES") || iupStrEqualNoCase(sb, "ON"))
    *sbh = *sbv = 1;
  else if(iupStrEqualNoCase (sb, "VERTICAL"))
    *sbv = 1;
  else if(iupStrEqualNoCase (sb, "HORIZONTAL"))
    *sbh = 1;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:21,代码来源:iuptree.c

示例7: iDialRedraw_CB

static int iDialRedraw_CB(Ihandle* ih)
{
  if (!ih->data->cd_canvas)
    return IUP_DEFAULT;

  /* update display */
  cdCanvasFlush(ih->data->cd_canvas);

  if (ih->data->has_focus)
  {
    cdCanvas* cd_canvas_front = (cdCanvas*)IupGetAttribute(ih, "_CD_CANVAS");  /* front buffer canvas */
    IupCdDrawFocusRect(ih, cd_canvas_front, 0, 0, ih->data->w - 1, ih->data->h - 1);
  }

  return IUP_DEFAULT;
}
开发者ID:Vulcanior,项目名称:IUP,代码行数:16,代码来源:iup_dial.c

示例8: k_any

static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%d = %s \'%c\')\n", c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%d = %s)\n", c, iupKeyCodeToName(c));
  printf("  CARET(%s)\n", IupGetAttribute(ih, "CARET"));
  if (c == K_cA)
    return IUP_IGNORE;   // Sound a beep in Windows
  if (c == K_cP)
  {
    file_open();
    return IUP_IGNORE;   // Sound a beep in Windows
  }
  return IUP_CONTINUE;
}
开发者ID:sanikoyes,项目名称:iup,代码行数:16,代码来源:text.c

示例9: wGLCanvasUnMapMethod

static void wGLCanvasUnMapMethod(Ihandle* ih)
{
  if (ih->data->context)
  {
    if (ih->data->context == wglGetCurrentContext())
      wglMakeCurrent(NULL, NULL);

    wglDeleteContext(ih->data->context);
  }

  if (ih->data->palette)
    DeleteObject((HGDIOBJ)ih->data->palette);

  if (ih->data->device)
    ReleaseDC((HWND)IupGetAttribute(ih, "HWND"), ih->data->device);  /* can not use ih->handle, because it should work with GTK also */
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:16,代码来源:iup_glcanvas_win.c

示例10: cbAddTab

static int cbAddTab(Ihandle* ih)
{
  Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS");
  Ihandle *vbox;

  vbox = IupFrame(IupVbox(IupLabel("Label XXX"), IupButton("Button XXX", "cbChildButton"), NULL));
  IupSetAttribute(vbox, "TABTITLE", "XXX");
  IupSetAttribute(vbox, "TITLE", "TABS XXX");

  IupAppend(tabs, vbox);
  IupMap(vbox);

  IupRefresh(tabs); /* update children layout */

  return IUP_DEFAULT;
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:16,代码来源:tabs.c

示例11: IupGLPalette

void IupGLPalette (Ihandle* self, int index, float r, float g, float b)
{
  GLData* d = (GLData*)IupGetAttribute(self,"_IUPGL_DATA");
  if (d && d->palette)
  {
    PALETTEENTRY entry;
    entry.peRed    = (BYTE)(r*255);
    entry.peGreen  = (BYTE)(g*255);
    entry.peBlue   = (BYTE)(b*255);
    entry.peFlags  = PC_NOCOLLAPSE;
    SetPaletteEntries(d->palette,index,1,&entry);
    UnrealizeObject(d->device);
    SelectPalette(d->device,d->palette,FALSE);
    RealizePalette(d->device);
  }
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:16,代码来源:iupglw.c

示例12: ShowImage

static void ShowImage(char* file_name, Ihandle* iup_dialog)
{
  int error;
  imImage* image = (imImage*)IupGetAttribute(iup_dialog, "imImage");
  if (image) imImageDestroy(image);
  IupSetAttribute(iup_dialog, "imImage", NULL);

  image = imFileImageLoadBitmap(file_name, 0, &error);
  if (error) PrintError(error);
  if (!image) return;

  IupSetAttribute(iup_dialog, "imImage", (char*)image);
  IupStoreAttribute(iup_dialog, "TITLE", file_name);

  cbCanvasRepaint(iup_dialog); /* we can do this because canvas inherit attributes from the dialog */
}
开发者ID:friends-of-iup,项目名称:im,代码行数:16,代码来源:im_view.c

示例13: app_open_cb

int app_open_cb(Ihandle* self)
{
  imFile* ifile;             /* file input */
  int ret, error;
  unsigned char* gl_data = (unsigned char*)IupGetAttribute(self, "APP_GL_DATA");
  char filename[1024] = ".\\*.*";

  /* get a file name */
  ret = IupGetFile(filename);
  if (ret == -1)
    return IUP_DEFAULT;

  ifile = imFileOpen(filename, &error);
  if (!ifile)
  {
    IupMessage("Error", "Error reading image file.");
    return IUP_DEFAULT;
  }

  {
    int width = 0, height = 0, file_color_mode, color_space;
    Ihandle* dialog = IupGetDialog(self);
    imFileReadImageInfo(ifile, 0, &width, &height, &file_color_mode, NULL);

    /* alocates the buffers */
    if (gl_data) free(gl_data);
    gl_data = malloc(width*height*3);
    IupSetAttribute(dialog, "APP_GL_DATA", gl_data);
    IupSetfAttribute(dialog, "APP_GL_WIDTH", "%d", width);
    IupSetfAttribute(dialog, "APP_GL_HEIGHT", "%d", height);

    imFileReadImageData(ifile, gl_data, 1, IM_PACKED);

    color_space = imColorModeSpace(file_color_mode);
    if (color_space == IM_MAP || color_space == IM_GRAY || color_space == IM_BINARY)
    {
      long palette[256];
      int palette_count;
      imFileGetPalette(ifile, palette, &palette_count);
      ConvertMapToGLData(gl_data, width*height, 3, palette, palette_count);
    }
  }

  imFileClose(ifile);

  return IUP_DEFAULT;
}
开发者ID:LuaDist,项目名称:im,代码行数:47,代码来源:iupglview.c

示例14: motDialogSetWindowManagerStyle

static void motDialogSetWindowManagerStyle(Ihandle* ih)
{
  MwmHints hints;
  static Atom xwmhint = 0;
  if (!xwmhint)
    xwmhint = XmInternAtom(iupmot_display, "_MOTIF_WM_HINTS", False);

  hints.flags = (MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS);
  hints.functions = 0;
  hints.decorations = 0;
  hints.input_mode = 0;
  hints.status = 0;

  if (IupGetAttribute(ih, "TITLE")) {  /* must use IupGetAttribute to check from the native implementation */
    hints.functions   |= MWM_FUNC_MOVE;
    hints.decorations |= MWM_DECOR_TITLE;
  }

  if (iupAttribGetInt(ih, "MENUBOX")) {
    hints.functions   |= MWM_FUNC_CLOSE;
    hints.decorations |= MWM_DECOR_MENU;
  }

  if (iupAttribGetInt(ih, "MINBOX")) {
    hints.functions   |= MWM_FUNC_MINIMIZE;
    hints.decorations |= MWM_DECOR_MINIMIZE;
  }

  if (iupAttribGetInt(ih, "MAXBOX")) {
    hints.functions   |= MWM_FUNC_MAXIMIZE;
    hints.decorations |= MWM_DECOR_MAXIMIZE;
  }

  if (iupAttribGetInt(ih, "RESIZE")) {
    hints.functions   |= MWM_FUNC_RESIZE;
    hints.decorations |= MWM_DECOR_RESIZEH;
  }

  if (iupAttribGetInt(ih, "BORDER"))
    hints.decorations |= MWM_DECOR_BORDER;

  XChangeProperty(iupmot_display, XtWindow(ih->handle),
      xwmhint, xwmhint,
      32, PropModeReplace,
      (const unsigned char *) &hints,
      PROP_MOTIF_WM_HINTS_ELEMENTS);
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:47,代码来源:iupmot_dialog.c

示例15: IupGetFile

int IupGetFile( char* file )
{
  Ihandle *gf = 0;
  int i,ret,n;
  char *value;
  char filter[4096] = "*.*";
  char dir[4096];

  if (!file) return -3;

  gf = IupFileDlg();
  if (!gf) return -2;

  n = strlen(file);

  /* Look for last folder separator and split filter from directory */
  for(i=n-1;i>=0; i--)
  {
    if (file[i] == '\\' || file[i] == '/') 
    {
      strncpy(dir, file, i+1);
      dir[i+1] = 0;   

      strcpy(filter, file+i+1);
      filter[n-i] = 0;

      break;
    }
  }

  IupSetAttribute(gf, IUP_FILTER, filter);
  IupSetAttribute(gf, IUP_DIRECTORY, dir);
  IupSetAttribute(gf, IUP_ALLOWNEW, IUP_YES );
  IupSetAttribute(gf, IUP_NOCHANGEDIR, IUP_YES);
  IupSetAttribute(gf, IUP_PARENTDIALOG, IupGetGlobal(IUP_PARENTDIALOG));
  IupSetAttribute(gf, IUP_ICON, IupGetGlobal(IUP_ICON));

  IupPopup( gf, IUP_CENTER, IUP_CENTER );

  value = IupGetAttribute( gf, IUP_VALUE );
  if (value) strcpy( file, value );
  ret = IupGetInt( gf, IUP_STATUS );

  IupDestroy(gf);

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


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