home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Enlightenment / enl14.tgz / enl14.tar / enl14 / main.c < prev    next >
C/C++ Source or Header  |  1997-11-21  |  2KB  |  68 lines

  1. #include "enl.h"
  2.  
  3. void func();
  4. void func2();
  5. void func3();
  6.  
  7. void func()
  8. {
  9.     printf("Callback function for internal button called!!!!!!\n");
  10.     FreeButton((Button *)DelItem("OK_BUTTON",LIST_TYPE_BUTTON));
  11.     ShowButton(MakeButton("OK_BUTTON","DEFAULT_OK",350,400,48,48));
  12.     AddButtonActionCallback(FindItem("OK_BUTTON",LIST_TYPE_BUTTON),
  13.                                     "mouse up any 1",func2);
  14. }
  15.  
  16. void func2()
  17. {
  18.     printf("Callback function2 for internal button called!!!!!!\n");
  19.     FreeButton((Button *)DelItem("OK_BUTTON",LIST_TYPE_BUTTON));
  20.     ShowButton(MakeButton("OK_BUTTON","DEFAULT_OK",400,400,32,32));
  21.     AddButtonActionCallback(FindItem("OK_BUTTON",LIST_TYPE_BUTTON),
  22.                                     "mouse up any 1",func3);
  23. }
  24.  
  25. void func3()
  26. {
  27.     printf("Callback function3 for internal button called!!!!!!\n");
  28.     FreeButton((Button *)DelItem("OK_BUTTON",LIST_TYPE_BUTTON));
  29.     ShowButton(MakeButton("OK_BUTTON","DEFAULT_OK",300,400,64,64));
  30.     AddButtonActionCallback(FindItem("OK_BUTTON",LIST_TYPE_BUTTON),
  31.                                     "mouse up any 1",func);
  32. }
  33.  
  34. int main(int argc, char **argv)
  35. {
  36.    char **s;
  37.    int num,i;
  38.    
  39.    SetupVars();
  40.    SetupSignals();
  41.    SetupX();
  42.    CfgLoad(argv[1]);
  43.    DrawStrip(FindItem("STRIP_1",LIST_TYPE_STRIP));
  44.    ShowStrip(FindItem("STRIP_1",LIST_TYPE_STRIP));
  45.    DrawButton(FindItem("B4",LIST_TYPE_BUTTON));
  46.    ShowButton(FindItem("B4",LIST_TYPE_BUTTON));
  47.     /* Test INTERNAL button creation routines. OK_BUTTON is my test button */
  48.     /* Create and show the button (ax x,y 300,400, size 64x64 (0x0 = original */
  49.     /* imageclass image size) using an imageclass called DEFAULT_OK */
  50.     ShowButton(MakeButton("OK_BUTTON","DEFAULT_OK",300,400,64,64));
  51.     /* add a callback for mouse, up, any modifiers button 1 */
  52.     AddButtonActionCallback(FindItem("OK_BUTTON",LIST_TYPE_BUTTON),
  53.                                     "mouse up any 1",func);
  54.     /* add another action - button 3 up with any modifierd delets the button */
  55.     AddButtonAction(FindItem("OK_BUTTON",LIST_TYPE_BUTTON),
  56.                          "mouse up any 3 delete_button");
  57.    s=ListItems(&num,LIST_TYPE_ANY);
  58.    printf("Items in Database List:\nNumber:%i\n",num);
  59.    for(i=0;i<num;i++) printf("\tname:\t %s\n",s[i]);
  60.    freestrlist(s,num);
  61.    for (;;)
  62.      {
  63.          XEvent ev;
  64.          XNextEvent(disp,&ev);
  65.          HandleEvent(&ev);
  66.      }
  67. }
  68.