本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 */
}
示例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;
}
示例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);
}
}
示例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 */
}
示例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;
}
示例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);
}
示例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;
}