本文整理汇总了C++中IupDestroy函数的典型用法代码示例。如果您正苦于以下问题:C++ IupDestroy函数的具体用法?C++ IupDestroy怎么用?C++ IupDestroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IupDestroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: motListSetClipboardAttrib
static int motListSetClipboardAttrib(Ihandle *ih, const char *value)
{
Widget cbedit;
if (!ih->data->has_editbox)
return 0;
XtVaGetValues(ih->handle, XmNtextField, &cbedit, NULL);
if (iupStrEqualNoCase(value, "COPY"))
{
Ihandle* clipboard;
char *str = XmTextFieldGetSelection(cbedit);
if (!str) return 0;
clipboard = IupClipboard();
IupSetAttribute(clipboard, "TEXT", str);
IupDestroy(clipboard);
XtFree(str);
}
else if (iupStrEqualNoCase(value, "CUT"))
{
Ihandle* clipboard;
char *str = XmTextFieldGetSelection(cbedit);
if (!str) return 0;
clipboard = IupClipboard();
IupSetAttribute(clipboard, "TEXT", str);
IupDestroy(clipboard);
XtFree(str);
/* disable callbacks */
iupAttribSet(ih, "_IUPMOT_DISABLE_TEXT_CB", "1");
XmTextFieldRemove(cbedit);
iupAttribSet(ih, "_IUPMOT_DISABLE_TEXT_CB", NULL);
}
else if (iupStrEqualNoCase(value, "PASTE"))
{
Ihandle* clipboard;
char *str;
clipboard = IupClipboard();
str = IupGetAttribute(clipboard, "TEXT");
/* disable callbacks */
iupAttribSet(ih, "_IUPMOT_DISABLE_TEXT_CB", "1");
XmTextFieldRemove(cbedit);
XmTextFieldInsert(cbedit, XmTextFieldGetInsertionPosition(cbedit), str);
iupAttribSet(ih, "_IUPMOT_DISABLE_TEXT_CB", NULL);
}
else if (iupStrEqualNoCase(value, "CLEAR"))
{
/* disable callbacks */
iupAttribSet(ih, "_IUPMOT_DISABLE_TEXT_CB", "1");
XmTextFieldRemove(cbedit);
iupAttribSet(ih, "_IUPMOT_DISABLE_TEXT_CB", NULL);
}
return 0;
}
示例3: cleanup
void cleanup() {
if(timeout) { IupDestroy(timeout); }
if(timer) { IupDestroy(timer); }
IupClose();
endTimePeriod(); // try close if not closing
}
示例4: main
int main(int argc, char **argv)
{
IupOpen(&argc, &argv);
IupControlsOpen();
func_1();
IupShowXY(IupGetHandle("dlg"),IUP_CENTER,IUP_CENTER);
IupMainLoop();
IupDestroy(IupGetHandle("img1"));
IupDestroy(IupGetHandle("img2"));
IupDestroy(IupGetHandle("dlg"));
IupControlsClose();
IupClose();
return 0;
}
示例5: 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;
}
示例6: main
int main(int argc, char **argv)
{
Ihandle *dialog, *canvas;
IupOpen(&argc, &argv);
canvas = IupCanvas(NULL);
IupSetAttribute(canvas, "RASTERSIZE", "300x200"); /* initial size */
IupSetAttribute(canvas, "SCROLLBAR", "YES");
IupSetAttribute(canvas, "XMAX", "599");
IupSetAttribute(canvas, "YMAX", "399");
IupSetCallback(canvas, "SCROLL_CB", (Icallback)scroll_cb);
IupSetCallback(canvas, "RESIZE_CB", (Icallback)resize_cb);
IupSetCallback(canvas, "ACTION", (Icallback)action);
dialog = IupDialog(canvas);
IupSetAttribute(dialog, "TITLE", "Scrollbar Test");
IupMap(dialog);
cdcanvas = cdCreateCanvas(CD_IUP, canvas);
IupSetAttribute(canvas, "RASTERSIZE", NULL); /* release the minimum limitation */
IupShowXY(dialog,IUP_CENTER,IUP_CENTER);
IupMainLoop();
cdKillCanvas(cdcanvas);
IupDestroy(dialog);
IupClose();
return EXIT_SUCCESS;
}
示例7: iupTextUpdateFormatTags
void iupTextUpdateFormatTags(Ihandle* ih)
{
/* called when the element is mapped */
int i, count = iupArrayCount(ih->data->formattags);
Ihandle** tag_array = (Ihandle**)iupArrayGetData(ih->data->formattags);
/* must update VALUE before updating the format */
iTextUpdateValueAttrib(ih);
for (i = 0; i < count; i++)
{
char* bulk = iupAttribGet(tag_array[i], "BULK");
if (bulk && iupStrBoolean(bulk))
{
Ihandle* child;
void* state = iupdrvTextAddFormatTagStartBulk(ih);
char* cleanout = iupAttribGet(tag_array[i], "CLEANOUT");
if (cleanout && iupStrBoolean(cleanout))
IupSetAttribute(ih, "REMOVEFORMATTING", "ALL");
for (child = tag_array[i]->firstchild; child; child = child->brother)
iupdrvTextAddFormatTag(ih, child, 1);
iupdrvTextAddFormatTagStopBulk(ih, state);
}
else
iupdrvTextAddFormatTag(ih, tag_array[i], 0);
IupDestroy(tag_array[i]);
}
iupArrayDestroy(ih->data->formattags);
ih->data->formattags = NULL;
}
示例8: main
/* main program */
int main(int argc, char **argv)
{
char *error=NULL;
/* IUP initialization */
IupOpen(&argc, &argv);
IupControlsOpen () ;
/* loads LED */
if((error = IupLoad("vbox.led")))
{
IupMessage("LED error", error);
return 1 ;
}
dlg = IupGetHandle("Alinhav");
/* sets callbacks */
// IupSetFunction( "acao_pausa", (Icallback) btn_pause_cb );
/* shows dialog */
// IupShowXY(dlg,IUP_CENTER,IUP_CENTER);
IupShow(dlg);
/* main loop */
IupMainLoop();
IupDestroy(dlg);
/* ends IUP */
IupControlsClose() ;
IupClose();
return 0 ;
}
示例9: main
int main(int argc, char **argv)
{
IupOpen(&argc, &argv);
memset(password, 0, 100);
text = IupText(NULL);
IupSetAttribute(text, "SIZE", "200x");
IupSetCallback(text, "ACTION", (Icallback) action);
IupSetCallback(text, "K_ANY", (Icallback) k_any);
pwd = IupText(NULL);
IupSetAttribute(pwd, "READONLY", "YES");
IupSetAttribute(pwd, "SIZE", "200x");
dlg = IupDialog(IupVbox(text, pwd, NULL));
IupSetAttribute(dlg, "TITLE", "IupText");
IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
IupMainLoop();
IupDestroy(dlg);
IupClose();
return 0;
}
示例10: main
int main(int argc, char **argv)
{
Ihandle *dlg, *bt, *box, *lbl, *ml, *vbox;
IupOpen(&argc, &argv);
bt = IupButton("Button", NULL);
//IupSetAttribute(bt, "EXPAND", "VERTICAL"); /* This is the only necessary EXPAND */
IupSetAttribute(bt, "EXPAND", "YES");
box = IupSbox(bt);
IupSetAttribute(box, "DIRECTION", "SOUTH"); /* place at the bottom of the button */
// IupSetAttribute(box, "COLOR", "0 255 0");
ml = IupMultiLine(NULL);
IupSetAttribute(ml, "EXPAND", "YES");
IupSetAttribute(ml, "VISIBLELINES", "5");
vbox = IupVbox(box, ml, NULL);
lbl = IupLabel("Label");
IupSetAttribute(lbl, "EXPAND", "VERTICAL");
dlg = IupDialog(IupHbox(vbox, lbl, NULL));
IupSetAttribute(dlg, "TITLE", "IupSbox Example");
IupSetAttribute(dlg, "MARGIN", "10x10");
IupSetAttribute(dlg, "GAP", "10");
IupShow(dlg);
IupMainLoop();
IupDestroy(dlg);
IupClose();
return 1;
}
示例11: winDialogUnMapMethod
static void winDialogUnMapMethod(Ihandle* ih)
{
if (ih->data->menu)
{
ih->data->menu->handle = NULL; /* the dialog will destroy the native menu */
IupDestroy(ih->data->menu);
}
if (iupAttribGet(ih, "_IUPDLG_HASTRAY"))
winDialogSetTrayAttrib(ih, NULL);
iupwinTipsDestroy(ih);
iupwinDestroyDragDrop(ih);
/* remove the association before destroying */
iupwinHandleRemove(ih->handle);
/* Destroys the window, so we can destroy the class */
if (iupAttribGetBoolean(ih, "MDICHILD"))
{
/* for MDICHILDs must send WM_MDIDESTROY, instead of calling DestroyWindow */
Ihandle* client = (Ihandle*)iupAttribGet(ih, "MDICLIENT_HANDLE");
SendMessage(client->handle, WM_MDIDESTROY, (WPARAM)ih->handle, 0);
winDialogMDIRefreshMenu(ih);
}
else
DestroyWindow(ih->handle); /* this will destroy the Windows children also. */
/* but IupDestroy already destroyed the IUP children */
/* so it is safe to call DestroyWindow */
}
示例12: iupTextSetAddFormatTagHandleAttrib
int iupTextSetAddFormatTagHandleAttrib(Ihandle* ih, const char* value)
{
Ihandle* formattag = (Ihandle*)value;
if (!iupObjectCheck(formattag))
return 0;
if (ih->handle)
{
/* must update VALUE before updating the format */
iTextUpdateValueAttrib(ih);
iupdrvTextAddFormatTag(ih, formattag);
IupDestroy(formattag);
}
else
{
Ihandle** tag_array;
int i;
if (!ih->data->formattags)
ih->data->formattags = iupArrayCreate(10, sizeof(Ihandle*));
i = iupArrayCount(ih->data->formattags);
tag_array = (Ihandle**)iupArrayInc(ih->data->formattags);
tag_array[i] = formattag;
}
return 0;
}
示例13: item_saveas_action_cb
int item_saveas_action_cb(Ihandle* item_saveas)
{
Ihandle* multitext = IupGetDialogChild(item_saveas, "MULTITEXT");
Ihandle *filedlg = IupFileDlg();
IupSetAttribute(filedlg, "DIALOGTYPE", "SAVE");
IupSetAttribute(filedlg, "FILTER", "*.txt");
IupSetAttribute(filedlg, "FILTERINFO", "Text Files");
IupSetAttributeHandle(filedlg, "PARENTDIALOG", IupGetDialog(item_saveas));
IupPopup(filedlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
if (IupGetInt(filedlg, "STATUS") != -1)
{
Ihandle* config = (Ihandle*)IupGetAttribute(multitext, "CONFIG");
char* filename = IupGetAttribute(filedlg, "VALUE");
char* str = IupGetAttribute(multitext, "VALUE");
int count = IupGetInt(multitext, "COUNT");
write_file(filename, str, count);
IupConfigRecentUpdate(config, filename);
}
IupDestroy(filedlg);
return IUP_DEFAULT;
}
示例14: iupwinVersion
void iupwinVersion(void)
{
Ihandle* dial, *ok;
dial = IupDialog(IupVbox(IupFrame(IupVbox(
IupLabel(IupVersion()),
IupLabel(IUP_VERSION_DATE),
IupLabel(IUP_COPYRIGHT),
NULL)),
ok = IupButton("Ok", NULL),
NULL));
IupSetCallback(ok, "ACTION", (Icallback)ok_cb);
IupSetAttribute(dial,IUP_TITLE,"IUP");
IupSetAttribute(dial,IUP_MENUBOX,IUP_NO);
IupSetAttribute(dial,IUP_MINBOX,IUP_NO);
IupSetAttribute(dial,IUP_MAXBOX,IUP_NO);
IupSetAttribute(dial,IUP_RESIZE,IUP_NO);
IupSetAttribute(dial,"GAP","5");
IupSetAttribute(dial,"MARGIN","5");
IupPopup(dial, IUP_CENTER, IUP_CENTER);
IupDestroy(dial);
}
示例15: iMatrixExSetPasteAttrib
static int iMatrixExSetPasteAttrib(Ihandle *ih, const char* value)
{
int lin=0, col=0;
Ihandle* clipboard = IupClipboard();
char* data = IupGetAttribute(clipboard, "TEXT");
IupDestroy(clipboard);
if (iupStrEqualNoCase(value, "FOCUS"))
IupGetIntInt(ih, "FOCUS_CELL", &lin, &col);
else if (iupStrEqualNoCase(value, "MARKED"))
{
char *marked = IupGetAttribute(ih,"MARKED");
if (marked)
{
int num_lin = IupGetInt(ih, "NUMLIN");
int num_col = IupGetInt(ih, "NUMCOL");
iMatrixExCellMarkedStart(marked, num_lin, num_col, &lin, &col);
}
}
else
{
if (iupStrToIntInt(value, &lin, &col, ':')!=2)
return 0;
}
iMatrixExPasteData(ih, data, lin, col, "PASTECLIP");
return 0;
}