本文整理汇总了C++中IupSetfAttribute函数的典型用法代码示例。如果您正苦于以下问题:C++ IupSetfAttribute函数的具体用法?C++ IupSetfAttribute怎么用?C++ IupSetfAttribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IupSetfAttribute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _run_geocode
// Runs geocode hostip callback
static int _run_geocode(/*@[email protected]*/ Ihandle *ih)
{
float lat,lon;
char city[100];
// Check if controls have been created
if( (lbl_status==NULL)
|| (list_method==NULL)
|| (edt_lat==NULL)
|| (edt_lon==NULL) ) {
LOG(LOGERR,_("Function called without GUI!"));
return IUP_DEFAULT;
}
LOG(LOGVERBOSE,_("Running geocode subfunction."));
IupSetAttribute(run_task,"RUN","NO");
IupSetAttribute(list_method,"VISIBLE","YES");
IupSetAttribute(list_method,"VALUE","0");
if(!location_geocode_hostip(&lat,&lon,city,100)) {
IupSetAttribute(lbl_status,"APPEND",_("Unable to download data"));
return IUP_DEFAULT;
}
IupSetfAttribute(lbl_status,"APPEND",_("city: %s"),city);
IupSetfAttribute(lbl_status,"APPEND",_("lat/lon: %.2f,%.2f"),lat,lon);
IupSetAttribute(lbl_status,"APPEND",_("Go to http://www.hostip.info/ to correct"));
IupSetfAttribute(edt_lat,"VALUE","%f",lat);
IupSetfAttribute(edt_lon,"VALUE","%f",lon);
return IUP_DEFAULT;
}
示例2: iupdrvOpen
int iupdrvOpen(int *argc, char ***argv)
{
char* value;
if (!gtk_init_check(argc, argv))
return IUP_ERROR;
#if defined(IUPGTK_DEBUG)
g_log_set_default_handler(iupgtk_log, NULL);
#endif
IupSetGlobal("DRIVER", "GTK");
IupStoreGlobal("SYSTEMLANGUAGE", pango_language_to_string(gtk_get_default_language()));
/* driver system version */
IupSetfAttribute(NULL, "GTKVERSION", "%d.%d.%d", gtk_major_version,
gtk_minor_version,
gtk_micro_version);
IupSetfAttribute(NULL, "GTKDEVVERSION", "%d.%d.%d", GTK_MAJOR_VERSION,
GTK_MINOR_VERSION,
GTK_MICRO_VERSION);
gtkSetGlobalAttrib();
gtkSetGlobalColors();
IupSetGlobal("SHOWMENUIMAGES", "YES");
value = getenv("UBUNTU_MENUPROXY"); /* for now only in Ubuntu */
if (value && (iupStrEqualNoCase(value, "libappmenu.so") || iupStrEqualNoCase(value, "1")))
IupSetGlobal("GLOBALMENU", "Yes");
return IUP_NOERROR;
}
示例3: iScrollBoxLayoutUpdate
static void iScrollBoxLayoutUpdate(Ihandle* ih)
{
int dx = ih->currentwidth,
dy = ih->currentheight;
/* already updated the canvas layout,
so just have to update the scrollbars and child. */
/* if child is greater than scrollbox, has scrollbars
but this affects the oposite direction */
if (ih->firstchild->currentwidth > ih->currentwidth)
dy -= iupdrvGetScrollbarSize();
if (ih->firstchild->currentheight > ih->currentheight)
dx -= iupdrvGetScrollbarSize();
IupSetfAttribute(ih, "DX", "%d", dx);
IupSetfAttribute(ih, "DY", "%d", dy);
if (ih->firstchild)
{
iScrollBoxUpdatePosition(ih, IupGetFloat(ih, "POSX"), IupGetFloat(ih, "POSY"));
iupLayoutUpdate(ih->firstchild);
}
}
示例4: iValSetTypeAttrib
static int iValSetTypeAttrib(Ihandle* ih, const char *value)
{
int min_w, min_h;
/* valid only before map */
if (ih->handle)
return 0;
iupdrvValGetMinSize(ih, &min_w, &min_h);
if (iupStrEqualNoCase(value, "VERTICAL"))
{
/* val natural vertical size is MinWx100 */
IupSetfAttribute(ih, "RASTERSIZE", "%dx%d", min_w, 100);
ih->data->type = IVAL_VERTICAL;
}
else /* "HORIZONTAL" */
{
/* val natural horizontal size is 100xMinH */
IupSetfAttribute(ih, "RASTERSIZE", "%dx%d", 100, min_h);
ih->data->type = IVAL_HORIZONTAL;
}
return 0; /* do not store value in hash table */
}
示例5: iupdrvOpen
int iupdrvOpen(int *argc, char ***argv)
{
GtkStyle* style;
if (!gtk_init_check(argc, argv))
return IUP_ERROR;
IupSetGlobal("DRIVER", "GTK");
IupStoreGlobal("SYSTEMLANGUAGE", pango_language_to_string(gtk_get_default_language()));
/* driver system version */
IupSetfAttribute(NULL, "GTKVERSION", "%d.%d.%d", gtk_major_version,
gtk_minor_version,
gtk_micro_version);
IupSetfAttribute(NULL, "GTKDEVVERSION", "%d.%d.%d", GTK_MAJOR_VERSION,
GTK_MINOR_VERSION,
GTK_MICRO_VERSION);
gtkSetDrvGlobalAttrib();
style = gtk_style_new();
iupgtkUpdateGlobalColors(style);
IupSetGlobal("_IUP_RESET_GLOBALCOLORS", "YES"); /* will update the global colors when the first dialog is mapped */
g_object_unref(style);
return IUP_NOERROR;
}
示例6: _address_lookup
// Address lookup function
static int _address_lookup(/*@[email protected]*/ Ihandle *ih) {
char *result = IupGetAttribute(edt_address,"VALUE");
float lat,lon;
char city[100];
int rescode;
if( result == NULL )
return IUP_DEFAULT;
IupSetAttribute(list_method,"VISIBLE","YES");
IupSetAttribute(list_method,"VALUE","0");
IupSetAttribute(lbl_status,"VALUE","");
IupSetfAttribute(lbl_status,"APPEND",
_("Downloading info, this may be slow..."));
rescode=location_address_lookup(result,&lat,&lon,city,100);
// Destroy address box
if( hbox_address )
IupDestroy(hbox_address);
hbox_address = btn_address = edt_address = NULL;
if( dialog_location )
IupRefresh(dialog_location);
if(!rescode) {
IupSetAttribute(lbl_status,"APPEND",_("Unable to download data"));
return IUP_DEFAULT;
}
IupSetfAttribute(lbl_status,"APPEND",_("city: %s"),city);
IupSetfAttribute(lbl_status,"APPEND",_("lat/lon: %.2f,%.2f"),lat,lon);
IupSetfAttribute(edt_lat,"VALUE","%f",lat);
IupSetfAttribute(edt_lon,"VALUE","%f",lon);
return IUP_DEFAULT;
}
示例7: IupImage
Ihandle* IupImage (int width, int height, const unsigned char *pixmap)
{
Ihandle *n = iupTreeCreateNode(NULL);
type(n) = IMAGE_;
IupSetfAttribute(n,IUP_WIDTH,"%u", width);
IupSetfAttribute(n,IUP_HEIGHT,"%u", height);
IupSetAttribute(n,"BPP","8");
IupSetAttribute(n,"CHANNELS","1");
image_data(n) = (char *) malloc (width*height);
if (image_data(n) && pixmap)
memcpy (image_data(n),pixmap,width*height);
return n;
}
示例8: save_image_cb
int save_image_cb(void)
{
if(gc.image == NULL) {
IupSetfAttribute(gc.msgbar, "TITLE", "There's no image to save");
return IUP_DEFAULT;
}
image_copy = imgCopy(gc.image);
IupSetfAttribute(gc.msgbar, "TITLE", "State of the image saved");
return IUP_DEFAULT;
}
示例9: time_cb
int time_cb(void)
{
float value = IupGetFloat(progressbar1, "VALUE");
value += increment;
if (value > 1) value = 0; /* start over */
IupSetfAttribute(progressbar1, "VALUE", "%g", (double)value);
value = IupGetFloat(progressbar2, "VALUE");
value += increment*50;
if (value > 50) value = 0; /* start over */
IupSetfAttribute(progressbar2, "VALUE", "%g", (double)value);
return IUP_DEFAULT;
}
示例10: iScrollBoxLayoutUpdate
static void iScrollBoxLayoutUpdate(Ihandle* ih)
{
int w, h;
IupGetIntInt(ih, "DRAWSIZE", &w, &h);
IupSetfAttribute(ih, "DX", "%d", w);
IupSetfAttribute(ih, "DY", "%d", h);
if (ih->firstchild)
{
iScrollBoxUpdatePosition(ih, IupGetFloat(ih, "POSX"), IupGetFloat(ih, "POSY"));
iupLayoutUpdate(ih->firstchild);
}
}
示例11: resize_cb
int resize_cb(Ihandle *ih, int w, int h)
{
/* update page size, it is always the client size of the canvas */
IupSetfAttribute(ih, "DX", "%d", w);
IupSetfAttribute(ih, "DY", "%d", h);
if (!cdcanvas)
return IUP_DEFAULT;
/* update CD canvas size */
cdCanvasActivate(cdcanvas);
return IUP_DEFAULT;
}
示例12: print_value
static void print_value(Ihandle *ih, double a)
{
char *type = IupGetAttribute(ih, "TYPE");
switch(type[0])
{
case 'V':
IupSetfAttribute(lbl_v, "TITLE", "VALUE=%.2f", a);
break;
case 'H':
IupSetfAttribute(lbl_h, "TITLE", "VALUE=%.2f", a);
break;
}
}
示例13: load_image_cb
int load_image_cb(void) {
if(image_copy == NULL) {
IupSetfAttribute(gc.msgbar, "TITLE", "There's no copy of image saved");
return IUP_DEFAULT;
}
gc.image = imgCopy(image_copy);
repaint_cb(gc.canvas);
IupSetfAttribute(gc.msgbar, "TITLE", "Last state saved is loaded");
return IUP_DEFAULT;
}
示例14: _list_method_cb
// List method changes
static int _list_method_cb(/*@[email protected]*/ Ihandle *ih,
/*@[email protected]*/ char *text, int pos, int state) {
if( state == 0 )
return IUP_DEFAULT;
if( !run_task )
run_task = IupSetAtt(NULL,IupTimer(),"TIME","100",NULL);
switch(pos) {
case 1:
LOG(LOGVERBOSE,_("Running geocode with hostip"));
IupSetAttribute(lbl_status,"VALUE","");
IupSetfAttribute(lbl_status,"APPEND",
_("Downloading info, this may be slow..."));
(void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geocode);
IupSetAttribute(run_task,"RUN","YES");
IupSetAttribute(list_method,"VISIBLE","NO");
break;
case 2:
LOG(LOGVERBOSE,_("Running geocode with geobytes"));
IupSetAttribute(lbl_status,"VALUE","");
IupSetfAttribute(lbl_status,"APPEND",
_("Downloading info, this may be slow..."));
(void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geobytes);
IupSetAttribute(run_task,"RUN","YES");
IupSetAttribute(list_method,"VISIBLE","NO");
break;
case 3: {
edt_address = IupSetAtt(NULL,IupText(NULL),
"VALUE","Enter Address...",
"EXPAND","HORIZONTAL",NULL);
(void)IupSetCallback(edt_address,"GETFOCUS_CB",(Icallback)_address_clear);
btn_address = IupSetAtt(NULL,IupButton(_("Lookup"),NULL),NULL);
(void)IupSetCallback(btn_address,"ACTION",(Icallback)_address_lookup);
hbox_address = IupHbox(edt_address,btn_address,NULL);
if( (vbox_method!=NULL)
&& (hbox_address!=NULL)
&& (lbl_status!=NULL) )
(void)IupInsert(vbox_method,lbl_status,hbox_address);
else {
LOG(LOGERR,_("Location search controls not created!"));
return IUP_DEFAULT;
}
IupSetAttribute(list_method,"VISIBLE","NO");
(void)IupMap(hbox_address);
IupRefresh(hbox_address);
break;
}
};
return IUP_DEFAULT;
}
示例15: 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;
}
}
}