home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / easygui_os12 / examples / easyplugins / toolbar_os12_demo.e < prev    next >
Encoding:
Text File  |  2000-06-06  |  3.3 KB  |  101 lines

  1.  
  2. /*
  3.  
  4. */
  5.  
  6. OPT PREPROCESS
  7.  
  8. -> RST: Added conditional EASY_OS12 support
  9. #define EASY_OS12
  10.  
  11. #ifdef EASY_OS12
  12.   MODULE 'tools/easygui_os12', 'easyplugins/toolbar_os12', 'hybrid/utility'
  13. #endif
  14. #ifndef EASY_OS12
  15.   OPT OSVERSION=37
  16.   MODULE 'tools/easygui', 'easyplugins/toolbar', 'utility'
  17. #endif
  18.  
  19. MODULE 'utility/tagitem'
  20.  
  21. DEF toolbar_h:PTR TO toolbar_plugin,
  22.     toolbar_v:PTR TO toolbar_plugin,
  23.     toolbar_b:PTR TO toolbar_plugin,
  24.     disabled=FALSE
  25.  
  26. PROC main() HANDLE
  27.  
  28. #ifdef EASY_OS12
  29.     openUtility()
  30. #endif
  31. #ifndef EASY_OS12
  32.     IF (utilitybase:=OpenLibrary('utility.library', 37))=NIL THEN Raise("util")
  33. #endif
  34.  
  35.     NEW toolbar_h.toolbar([PLA_ToolBar_Contents, ['Horizontal,', 'not all gadgets', 'are forced', 'to appear', 'up here.'],
  36.                            PLA_ToolBar_Function, {gadget_pressed},
  37.                            TAG_DONE])
  38.  
  39.     NEW toolbar_v.toolbar([PLA_ToolBar_Contents, ['This is', 'a vertical', 'toolbar,',
  40.                                                   'all gadgets', 'forced to', 'appear.'],
  41.                            PLA_ToolBar_Function, {gadget_pressed},
  42.                            PLA_ToolBar_Vertical, TRUE,
  43.                            PLA_ToolBar_DisplayAll, TRUE,
  44.                            TAG_DONE])
  45.  
  46.     NEW toolbar_b.toolbar([PLA_ToolBar_Contents, ['This is', 'a vertical', 'toolbar,',
  47.                                                   'not all gadgets', 'are forced', 'to appear.',
  48.                                                   'In fact', 'it\as', 'just a waste', 'of space.' ],
  49.                            PLA_ToolBar_Function, {gadget_pressed},
  50.                            PLA_ToolBar_Vertical, TRUE,
  51.                            TAG_DONE])
  52.  
  53.     easyguiA('toolbar_plugin example', [ROWS,
  54.                                            [BEVELR,
  55.                                                [PLUGIN, NIL, toolbar_h, TRUE]
  56.                                            ],
  57.                                            [COLS,
  58.                                                [ROWS,
  59.                                                    [BEVELR,
  60.                                                        [PLUGIN, NIL, toolbar_v, TRUE]
  61.                                                    ],
  62.                                                    [SPACEV]
  63.                                                ],
  64.                                                [BEVELR,
  65.                                                    [PLUGIN, NIL, toolbar_b, TRUE]
  66.                                                ],
  67.                                                [SPACE],
  68.                                                [CHECK, {toggle_disabled}, '_Disabled?', disabled, FALSE, -1, "d"]
  69.                                            ]
  70.                                        ])
  71.  
  72. EXCEPT DO
  73.  
  74.     END toolbar_h, toolbar_v, toolbar_b
  75.  
  76. #ifdef EASY_OS12
  77.     closeUtility()
  78. #endif
  79. #ifndef EASY_OS12
  80.     IF utilitybase THEN CloseLibrary(utilitybase)
  81. #endif
  82.  
  83. ENDPROC
  84.  
  85. PROC toggle_disabled()
  86.  
  87.     IF disabled THEN disabled:=FALSE ELSE disabled:=TRUE
  88.  
  89.     toolbar_h.set(PLA_ToolBar_Disabled, disabled)
  90.     toolbar_v.set(PLA_ToolBar_Disabled, disabled)
  91.     toolbar_b.set(PLA_ToolBar_Disabled, disabled)
  92.  
  93. ENDPROC
  94.  
  95. PROC gadget_pressed(toolbar:PTR TO toolbar_plugin, gad_num)
  96.  
  97.     WriteF('You pressed gadget number \a\d\a on toolbar $\h.\n', gad_num, toolbar)
  98.  
  99. ENDPROC
  100.  
  101.