PageRenderTime 77ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/html/examples/tests/predialogs.c

https://gitlab.com/willemmali-c/iup
C | 624 lines | 504 code | 91 blank | 29 comment | 27 complexity | fba97189b83c8be6e20f7b073e1b064a MD5 | raw file
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "iup.h"
  5. #include "iupkey.h"
  6. #include "iupcontrols.h"
  7. #define USE_IUPDRAW
  8. //#define USE_GDK
  9. //#define USE_CD
  10. //#define USE_OPENGL
  11. #ifdef USE_NATIVE
  12. #ifdef USE_GDK
  13. #include <gtk/gtk.h>
  14. #ifdef USE_GTK3
  15. static void drawTest(Ihandle *ih)
  16. {
  17. cairo_t* cr = (cairo_t*)IupGetAttribute(ih, "CAIRO_CR");
  18. int w = IupGetInt(ih, "PREVIEWWIDTH");
  19. int h = IupGetInt(ih, "PREVIEWHEIGHT");
  20. cairo_set_source_rgba(cr, 1.0, 0, 0, 1.0);
  21. cairo_move_to(cr, 0, 0);
  22. cairo_line_to(cr, w-1, h-1);
  23. cairo_move_to(cr, 0, h-1);
  24. cairo_line_to(cr, w-1, 0);
  25. cairo_stroke(cr);
  26. }
  27. #else
  28. static void drawTest(Ihandle *ih)
  29. {
  30. GdkWindow* wnd = (GdkWindow*)IupGetAttribute(ih, "DRAWABLE");
  31. GdkGC* gc = gdk_gc_new(wnd);
  32. int w = IupGetInt(ih, "PREVIEWWIDTH");
  33. int h = IupGetInt(ih, "PREVIEWHEIGHT");
  34. GdkColor color;
  35. color.red = 65535; color.green = 0; color.blue = 0;
  36. gdk_gc_set_rgb_fg_color(gc, &color);
  37. gdk_draw_line(wnd, gc, 0, 0, w-1, h-1);
  38. gdk_draw_line(wnd, gc, 0, h-1, w-1, 0);
  39. g_object_unref(gc);
  40. }
  41. #endif
  42. #else
  43. #ifdef WIN32
  44. #undef _WIN32_WINNT
  45. #define _WIN32_WINNT 0x0500
  46. #include <windows.h>
  47. static void drawTest(Ihandle* ih)
  48. {
  49. RECT rect;
  50. HPEN oldPen;
  51. HDC hDC = (HDC)IupGetAttribute(ih, "PREVIEWDC");
  52. int w = IupGetInt(ih, "PREVIEWWIDTH");
  53. int h = IupGetInt(ih, "PREVIEWHEIGHT");
  54. SetRect(&rect, 0, 0, w, h);
  55. FillRect(hDC, &rect, GetStockObject(WHITE_BRUSH));
  56. oldPen = SelectObject(hDC, GetStockObject(DC_PEN));
  57. SetDCPenColor(hDC, RGB(255, 0, 0));
  58. MoveToEx(hDC, 0, 0, NULL);
  59. LineTo(hDC, w-1, h-1);
  60. MoveToEx(hDC, 0, h-1, NULL);
  61. LineTo(hDC, w-1, 0);
  62. SelectObject(hDC, oldPen);
  63. }
  64. #else
  65. #include <X11/Xlib.h>
  66. #define xCOLOR8TO16(_x) (_x*257) /* 65535/255 = 257 */
  67. static unsigned long xGetPixel(Display* dpy, unsigned char cr, unsigned char cg, unsigned char cb)
  68. {
  69. XColor xc;
  70. xc.red = xCOLOR8TO16(cr);
  71. xc.green = xCOLOR8TO16(cg);
  72. xc.blue = xCOLOR8TO16(cb);
  73. xc.flags = DoRed | DoGreen | DoBlue;
  74. XAllocColor(dpy, DefaultColormap(dpy, XDefaultScreen(dpy)), &xc);
  75. return xc.pixel;
  76. }
  77. static void drawTest(Ihandle* ih)
  78. {
  79. GC gc = (GC)IupGetAttribute(ih, "PREVIEWDC");
  80. Display* dpy = (Display*)IupGetAttribute(ih, "XDISPLAY");
  81. Drawable wnd = (Drawable)IupGetAttribute(ih, "XWINDOW");
  82. int w = IupGetInt(ih, "PREVIEWWIDTH");
  83. int h = IupGetInt(ih, "PREVIEWHEIGHT");
  84. XSetForeground(dpy, gc, xGetPixel(dpy, 255, 255, 255));
  85. XFillRectangle(dpy, wnd, gc, 0, 0, w, h);
  86. XSetForeground(dpy, gc, xGetPixel(dpy, 255, 0, 0));
  87. XDrawLine(dpy, wnd, gc, 0, 0, w-1, h-1);
  88. XDrawLine(dpy, wnd, gc, 0, h-1, w-1, 0);
  89. }
  90. #endif
  91. #endif
  92. #endif
  93. #ifdef USE_OPENGL
  94. #ifdef WIN32
  95. #include <windows.h>
  96. #endif
  97. #include <GL/gl.h>
  98. #include "iupgl.h"
  99. static void drawTestGL(Ihandle* ih)
  100. {
  101. Ihandle* glcanvas = IupGetAttributeHandle(ih, "PREVIEWGLCANVAS");
  102. if (glcanvas)
  103. {
  104. int w = IupGetInt(ih, "PREVIEWWIDTH");
  105. int h = IupGetInt(ih, "PREVIEWHEIGHT");
  106. IupGLMakeCurrent(glcanvas);
  107. glViewport(0,0,w,h);
  108. glClearColor(1.0, 0.0, 1.0, 1.f); /* pink */
  109. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  110. glColor3f(1.0,0.0,0.0); /* red */
  111. glBegin(GL_QUADS);
  112. glVertex2f(0.9f,0.9f);
  113. glVertex2f(0.9f,-0.9f);
  114. glVertex2f(-0.9f,-0.9f);
  115. glVertex2f(-0.9f,0.9f);
  116. glEnd();
  117. IupGLSwapBuffers(glcanvas);
  118. }
  119. }
  120. #endif
  121. #ifdef USE_CD
  122. #include <cd.h>
  123. #include <cdiup.h>
  124. static void drawTest(Ihandle* ih)
  125. {
  126. cdCanvas* canvas = cdCreateCanvas(CD_IUP, ih);
  127. cdCanvasGetSize(canvas, &w, &h, NULL, NULL);
  128. cdCanvasClear(canvas);
  129. cdCanvasForeground(canvas, cdEncodeColor(255, 0 , 0));
  130. cdCanvasLine(canvas, 0, 0, w-1, h-1);
  131. cdCanvasLine(canvas, 0, h-1, w-1, 0);
  132. cdKillCanvas(canvas);
  133. }
  134. #endif
  135. #ifdef USE_IUPDRAW
  136. #include <iupdraw.h>
  137. static void drawTest(Ihandle *ih)
  138. {
  139. int w, h;
  140. IupDrawBegin(ih);
  141. IupDrawGetSize(ih, &w, &h);
  142. /* white background */
  143. IupSetAttribute(ih, "DRAWCOLOR", "255 255 255");
  144. IupSetAttribute(ih, "DRAWSTYLE", "FILL");
  145. IupDrawRectangle(ih, 0, 0, w, h);
  146. /* red X */
  147. IupSetAttribute(ih, "DRAWCOLOR", "255 0 0");
  148. IupDrawLine(ih, 0, 0, w-1, h-1);
  149. IupDrawLine(ih, 0, h-1, w-1, 0);
  150. IupDrawEnd(ih);
  151. }
  152. #endif
  153. static int close_cb(Ihandle *ih)
  154. {
  155. IupDestroy(ih);
  156. return IUP_IGNORE;
  157. }
  158. static int help_cb(Ihandle* ih)
  159. {
  160. (void)ih;
  161. printf("HELP_CB\n");
  162. return IUP_DEFAULT;
  163. }
  164. static int button_cb(Ihandle *ih, int but, int pressed, int x, int y, char* status)
  165. {
  166. printf("BUTTON_CB(but=%c (%d), x=%d, y=%d [%s])\n", (char)but, pressed, x, y, status);
  167. return IUP_DEFAULT;
  168. }
  169. static int wheel_cb(Ihandle *ih, float delta, int x, int y, char* status)
  170. {
  171. printf("WHEEL_CB(delta=%.2f, x=%d, y=%d [%s])\n", delta, x, y, status);
  172. return IUP_DEFAULT;
  173. }
  174. static int motion_cb(Ihandle *ih, int x, int y, char* status)
  175. {
  176. printf("MOTION_CB(x=%d, y=%d [%s])\n", x, y, status);
  177. return IUP_DEFAULT;
  178. }
  179. static int file_cb(Ihandle* ih, const char* filename, const char* status)
  180. {
  181. (void)ih;
  182. printf("FILE_CB(%s - %s)\n", status, filename);
  183. if (strcmp(status, "PAINT")==0)
  184. {
  185. Ihandle* glcanvas = IupGetAttributeHandle(ih, "PREVIEWGLCANVAS");
  186. printf(" SIZE(%s x %s)\n", IupGetAttribute(ih, "PREVIEWWIDTH"), IupGetAttribute(ih, "PREVIEWHEIGHT"));
  187. #ifdef USE_OPENGL
  188. if (glcanvas)
  189. drawTestGL(ih);
  190. else
  191. #endif
  192. drawTest(ih);
  193. }
  194. else if (strcmp(status, "FILTER")==0)
  195. {
  196. //IupSetAttribute(ih, "FILE", "test");
  197. //return IUP_CONTINUE;
  198. }
  199. else if (strcmp(status, "OK")==0)
  200. {
  201. // IupSetAttribute(ih, "FILE", "test");
  202. // return IUP_CONTINUE;
  203. }
  204. return IUP_DEFAULT;
  205. }
  206. static void new_message(char* type, char* buttons)
  207. {
  208. Ihandle* dlg = IupMessageDlg();
  209. if (strcmp(type, "ERROR")!=0)
  210. IupSetAttribute(dlg, "PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  211. IupSetAttribute(dlg, "DIALOGTYPE", type);
  212. IupSetAttribute(dlg, "TITLE", "IupMessageDlg Test");
  213. IupSetAttribute(dlg, "BUTTONS", buttons);
  214. IupSetAttribute(dlg, "VALUE", "Message Text\nSecond Line");
  215. if (strcmp(type, "WARNING")==0)
  216. IupSetAttribute(dlg, "BUTTONDEFAULT", "2");
  217. if (strcmp(type, "INFORMATION")!=0)
  218. IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb);
  219. IupPopup(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
  220. printf("BUTTONRESPONSE(%s)\n", IupGetAttribute(dlg, "BUTTONRESPONSE"));
  221. IupDestroy(dlg);
  222. }
  223. static void new_color(void)
  224. {
  225. Ihandle* dlg = IupColorDlg();
  226. IupSetAttribute(dlg, "PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  227. IupSetAttribute(dlg, "VALUE", "128 0 255");
  228. IupSetAttribute(dlg, "ALPHA", "142");
  229. //IupSetAttribute(dlg, "COLORTABLE", ";;177 29 234;;;0 0 23;253 20 119");
  230. IupSetAttribute(dlg, "SHOWHEX", "YES");
  231. IupSetAttribute(dlg, "SHOWCOLORTABLE", "YES");
  232. //IupSetAttribute(dlg, "SHOWALPHA", "YES");
  233. IupSetAttribute(dlg, "TITLE", "IupColorDlg Test");
  234. IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb);
  235. IupPopup(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
  236. if (IupGetInt(dlg, "STATUS"))
  237. {
  238. printf("OK\n");
  239. printf(" VALUE(%s)\n", IupGetAttribute(dlg, "VALUE"));
  240. printf(" COLORTABLE(%s)\n", IupGetAttribute(dlg, "COLORTABLE"));
  241. }
  242. else
  243. printf("CANCEL\n");
  244. IupDestroy(dlg);
  245. }
  246. static void new_font(void)
  247. {
  248. Ihandle* dlg = IupFontDlg();
  249. IupSetAttribute(dlg, "PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  250. IupSetAttribute(dlg, "COLOR", "128 0 255");
  251. // IupSetAttribute(dlg, "BGCOLOR", "173 177 194"); // Motif BGCOLOR for documentation
  252. IupSetAttribute(dlg, "VALUE", "Times, Bold 20");
  253. IupSetAttribute(dlg, "TITLE", "IupFontDlg Test");
  254. IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb);
  255. IupPopup(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
  256. if (IupGetInt(dlg, "STATUS"))
  257. {
  258. printf("OK\n");
  259. printf(" VALUE(%s)\n", IupGetAttribute(dlg, "VALUE"));
  260. printf(" COLOR(%s)\n", IupGetAttribute(dlg, "COLOR"));
  261. }
  262. else
  263. printf("CANCEL\n");
  264. IupDestroy(dlg);
  265. }
  266. static void new_file(char* dialogtype, int preview)
  267. {
  268. Ihandle *dlg = IupFileDlg();
  269. IupSetAttribute(dlg, "PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  270. IupSetAttribute(dlg, "DIALOGTYPE", dialogtype);
  271. IupSetAttribute(dlg, "TITLE", "IupFileDlg Test");
  272. IupSetAttribute(dlg, "DIRECTORY", "d:/tecgraf/iup");
  273. if (strcmp(dialogtype, "DIR")!=0)
  274. {
  275. // IupSetAttributes(dlg, "FILTER = \"*.bmp\", FILTERINFO = \"Bitmap Files\"");
  276. // IupSetAttribute(dlg, "FILTER", "*.jpg;*.jpeg;*.bmp;*.gif;*.tif;*.tiff;*.png");
  277. // IupSetAttribute(dlg, "EXTFILTER", "Text files|*.txt;*.doc|Image files|*.jpg;*.bmp;*.gif|");
  278. // IupSetAttribute(dlg, "FILE", "/tecgraf/im/test.bmp");
  279. // IupSetAttribute(dlg, "FILE", "test.bmp");
  280. // IupSetAttribute(dlg, "FILTER", "*.txt");
  281. // IupSetAttribute(dlg, "FILTER", "*.bmp;*.jpg");
  282. // IupSetAttribute(dlg, "EXTFILTER", "TEXT|*.txt|");
  283. // IupSetAttribute(dlg, "EXTFILTER", "BMP FILES|*.bmp|JPEG FILES|*.jpg|");
  284. IupSetAttribute(dlg, "EXTFILTER", "All Files|*.*|Image Files|*.bmp;*.jpg|Text Files|*.txt|");
  285. }
  286. IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb);
  287. IupSetAttribute(dlg, "FILE", "test.bmp");
  288. // IupSetAttributes(dlg, "FILE = \"\\tecgraf\\iup\\test.bmp\""); // OK
  289. // IupSetAttributes(dlg, "FILE = \"/tecgraf/iup/test.bmp\""); // OK
  290. // IupSetAttributes(dlg, "FILE = \"test.bmp\", DIRECTORY = \"/tecgraf/iup\""); // OK
  291. // IupSetAttributes(dlg, "FILE = \"test.bmp\", DIRECTORY = \"\\tecgraf\\iup\""); // OK
  292. IupSetAttribute(dlg, "NOCHANGEDIR", "YES");
  293. if (strcmp(dialogtype, "OPEN") == 0) IupSetAttribute(dlg, "MULTIPLEFILES", "YES");
  294. // IupSetAttribute(dlg, "RASTERSIZE", "800x600");
  295. IupSetCallback(dlg, "FILE_CB", (Icallback)file_cb);
  296. IupSetAttribute(dlg, "EXTDEFAULT", "txt");
  297. // IupSetAttribute(dlg, "MULTIVALUEPATH", "Yes");
  298. if (preview)
  299. {
  300. IupSetAttribute(dlg, "SHOWPREVIEW", "YES");
  301. IupSetAttribute(dlg, "PREVIEWATRIGHT", "Yes");
  302. // IupSetAttribute(dlg, "PREVIEWWIDTH", "600"); /* work only in GTK */
  303. IupSetCallback(dlg, "BUTTON_CB", (Icallback)button_cb);
  304. IupSetCallback(dlg, "MOTION_CB", (Icallback)motion_cb);
  305. IupSetCallback(dlg, "WHEEL_CB", (Icallback)wheel_cb);
  306. #ifdef USE_OPENGL
  307. if (preview==2)
  308. {
  309. Ihandle* glcanvas = IupGLCanvas(NULL);
  310. IupSetAttribute(glcanvas, "BUFFER", "DOUBLE");
  311. IupSetAttributeHandle(dlg, "PREVIEWGLCANVAS", glcanvas);
  312. }
  313. #endif
  314. }
  315. IupPopup(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
  316. switch(IupGetInt(dlg, "STATUS"))
  317. {
  318. case 1:
  319. printf("OK\n");
  320. printf(" New file - VALUE(%s)\n", IupGetAttribute(dlg, "VALUE"));
  321. printf(" DIRECTORY(%s)\n", IupGetAttribute(dlg, "DIRECTORY"));
  322. break;
  323. case 0 :
  324. printf("OK\n");
  325. printf(" File exists - VALUE(%s)\n", IupGetAttribute(dlg, "VALUE"));
  326. printf(" DIRECTORY(%s)\n", IupGetAttribute(dlg, "DIRECTORY"));
  327. if (IupGetInt(dlg, "MULTIPLEFILES"))
  328. {
  329. int i, count = IupGetInt(dlg, "MULTIVALUECOUNT");
  330. printf(" MULTIVALUECOUNT(%d)\n", count);
  331. for (i = 0; i < count; i++)
  332. printf(" MULTIVALUE%d = %s\n", i, IupGetAttributeId(dlg, "MULTIVALUE", i));
  333. }
  334. break;
  335. case -1 :
  336. printf("CANCEL\n");
  337. break;
  338. }
  339. IupDestroy(dlg);
  340. }
  341. static void new_alarm(void)
  342. {
  343. int ret;
  344. IupSetGlobal("PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  345. ret = IupAlarm ("IupAlarm Test", "Message Text\nSecond Line", "But 1", "Button 2", "B3");
  346. IupSetGlobal("PARENTDIALOG", NULL);
  347. //int ret = IupAlarm ("IupAlarm Test", "Message Text\nSecond Line\nVery long long long long long long long long long long long long text", "But 1", "Button 2", "B3");
  348. printf("Button(%d)\n", ret);
  349. }
  350. static void new_gettext(void)
  351. {
  352. int ret;
  353. char text[1024] = "text first line\nsecond line";
  354. IupSetGlobal("PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  355. ret = IupGetText("IupGetText Text", text, 1024);
  356. IupSetGlobal("PARENTDIALOG", NULL);
  357. if (ret)
  358. {
  359. printf("OK\n");
  360. printf("Text(%s)\n", text);
  361. }
  362. else
  363. printf("CANCEL\n");
  364. }
  365. static void new_getfile(void)
  366. {
  367. int ret;
  368. char filename[1024] = "*.*";
  369. IupSetGlobal("PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  370. ret = IupGetFile(filename);
  371. IupSetGlobal("PARENTDIALOG", NULL);
  372. if (ret!=-1)
  373. {
  374. printf("OK\n");
  375. if (ret == 0)
  376. printf("File(%s)\n", filename);
  377. else
  378. printf("New File(%s)\n", filename);
  379. }
  380. else
  381. printf("CANCEL\n");
  382. }
  383. static void new_list(void)
  384. {
  385. int ret;
  386. int size = 8 ;
  387. int marks[8] = { 0,0,0,0,1,1,0,0 };
  388. const char *options[] = {
  389. "Blue" ,
  390. "Red" ,
  391. "Green" ,
  392. "Yellow" ,
  393. "Black" ,
  394. "White" ,
  395. "Gray" ,
  396. "Brown" } ;
  397. IupSetGlobal("PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  398. ret = IupListDialog(2,"IupListDialog Test",size,options,0,8,5,marks);
  399. IupSetGlobal("PARENTDIALOG", NULL);
  400. if (ret == -1)
  401. {
  402. printf("CANCEL\n");
  403. }
  404. else
  405. {
  406. int i;
  407. char selection[80] = "";
  408. printf("OK\n");
  409. for(i = 0 ; i < size ; i++)
  410. {
  411. if(marks[i])
  412. {
  413. char temp[10];
  414. sprintf(temp,"%s\n",options[i]);
  415. strcat(selection,temp);
  416. }
  417. }
  418. printf(" Options (%s)\n", selection);
  419. }
  420. }
  421. static int k_any(Ihandle *ih, int c)
  422. {
  423. switch(c)
  424. {
  425. case K_m:
  426. IupSetGlobal("PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  427. IupMessage("IupMessage Test", "Message Text\nSecond Line.");
  428. IupSetGlobal("PARENTDIALOG", NULL);
  429. break;
  430. case K_e:
  431. new_message("ERROR", NULL);
  432. break;
  433. case K_i:
  434. new_message("INFORMATION", NULL);
  435. break;
  436. case K_w:
  437. new_message("WARNING", "OKCANCEL");
  438. break;
  439. case K_q:
  440. new_message("QUESTION", "YESNO");
  441. break;
  442. case K_c:
  443. new_color();
  444. break;
  445. case K_f:
  446. new_font();
  447. break;
  448. case K_o:
  449. new_file("OPEN", 0);
  450. break;
  451. case K_O:
  452. new_file("OPEN", 1);
  453. break;
  454. case K_G:
  455. new_file("OPEN", 2);
  456. break;
  457. case K_s:
  458. new_file("SAVE", 0);
  459. break;
  460. case K_d:
  461. new_file("DIR", 0);
  462. break;
  463. case K_a:
  464. new_alarm();
  465. break;
  466. case K_y:
  467. IupShow(IupLayoutDialog(NULL));
  468. break;
  469. case K_g:
  470. new_getfile();
  471. break;
  472. case K_t:
  473. new_gettext();
  474. break;
  475. case K_l:
  476. new_list();
  477. break;
  478. case K_ESC:
  479. IupDestroy(ih);
  480. return IUP_IGNORE;
  481. }
  482. return IUP_DEFAULT;
  483. }
  484. void PreDialogsTest(void)
  485. {
  486. char* msg = "Press a key for a pre-defined dialog:\n"
  487. "e = IupMessageDlg(ERROR)\n"
  488. "i = IupMessageDlg(INFORMATION)\n"
  489. "w = IupMessageDlg(WARNING)\n"
  490. "q = IupMessageDlg(QUESTION)\n"
  491. "--------------------\n"
  492. "o = IupFileDlg(OPEN)\n"
  493. "O = IupFileDlg(OPEN+PREVIEW)\n"
  494. "G = IupFileDlg(OPEN+PREVIEW+OPENGL)\n"
  495. "s = IupFileDlg(SAVE)\n"
  496. "d = IupFileDlg(DIR)\n"
  497. "--------------------\n"
  498. "c = IupColorDlg\n"
  499. "f = IupFontDlg\n"
  500. "--------------------\n"
  501. "m = IupMessage\n"
  502. "a = IupAlarm\n"
  503. "t = IupGetText\n"
  504. "g = IupGetFile\n"
  505. "l = IupListDialog\n"
  506. "y = IupLayoutDialog\n"
  507. "--------------------\n"
  508. "Esc = quit";
  509. Ihandle *dlg = IupDialog(IupVbox(IupLabel(msg), NULL));
  510. #ifdef USE_OPENGL
  511. IupGLCanvasOpen();
  512. #endif
  513. IupSetHandle("_MAIN_DIALOG_TEST_", dlg);
  514. IupSetAttribute(dlg, "TITLE", "Pre-defined Dialogs Test");
  515. IupSetAttribute(dlg, "MARGIN", "10x10");
  516. IupSetCallback(dlg, "K_ANY", (Icallback)k_any);
  517. IupSetCallback(dlg, "CLOSE_CB", (Icallback)close_cb);
  518. IupShow(dlg);
  519. }
  520. #ifndef BIG_TEST
  521. int main(int argc, char* argv[])
  522. {
  523. IupOpen(&argc, &argv);
  524. IupControlsOpen();
  525. #ifdef USE_OPENGL
  526. IupGLCanvasOpen();
  527. #endif
  528. PreDialogsTest();
  529. IupMainLoop();
  530. IupClose();
  531. return EXIT_SUCCESS;
  532. }
  533. #endif