home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / MUI / MUIBuilder22.lha / MUIBuilder / MB / E / DemoGenCodeE / GUI.e < prev    next >
Encoding:
Text File  |  1995-02-05  |  5.8 KB  |  188 lines

  1. OPT MODULE
  2. OPT PREPROCESS
  3.  
  4.  
  5. ->/////////////////////////////////////////////////////////////////////////////
  6. ->////////////////////////////////////////////////////// External modules /////
  7. ->/////////////////////////////////////////////////////////////////////////////
  8. MODULE 'muimaster' , 'libraries/mui'
  9. MODULE 'tools/boopsi'
  10. MODULE 'utility/tagitem' , 'utility/hooks'
  11.  
  12.  
  13. ->/////////////////////////////////////////////////////////////////////////////
  14. ->//////////////////////////////////////////////////// Object definitions /////
  15. ->/////////////////////////////////////////////////////////////////////////////
  16. EXPORT OBJECT app_arexx
  17.     commands :    PTR TO mui_command
  18.     error    :    hook
  19. ENDOBJECT
  20.  
  21. EXPORT OBJECT app_display
  22.     button_pressed          :    hook
  23. ENDOBJECT
  24.  
  25. EXPORT OBJECT app_obj
  26.     app                     :    PTR TO LONG
  27.     wi_the_window           :    PTR TO LONG
  28.     bt_put_constant_string  :    PTR TO LONG
  29.     bt_put_variable         :    PTR TO LONG
  30.     bt_return_id            :    PTR TO LONG
  31.     bt_call_hook            :    PTR TO LONG
  32.     tx_result               :    PTR TO LONG
  33.     bt_quit                 :    PTR TO LONG
  34.     stR_TX_result           :    PTR TO CHAR
  35. ENDOBJECT
  36.  
  37.  
  38. ->/////////////////////////////////////////////////////////////////////////////
  39. ->////////////////////////////////////////////////// Constant definitions /////
  40. ->/////////////////////////////////////////////////////////////////////////////
  41. EXPORT ENUM
  42.     ID_BUTTON_PRESSED = 1
  43.  
  44.  
  45. ->/////////////////////////////////////////////////////////////////////////////
  46. ->/////////////////////////////////////////// Global variable definitions /////
  47. ->/////////////////////////////////////////////////////////////////////////////
  48. EXPORT DEF string_var
  49.  
  50.  
  51. ->/////////////////////////////////////////////////////////////////////////////
  52. ->/////////// Creates one instance of one object or the whole application /////
  53. ->/////////////////////////////////////////////////////////////////////////////
  54. PROC create( display : PTR TO app_display ,
  55.              icon  = NIL ,
  56.              arexx = NIL : PTR TO app_arexx ,
  57.              menu  = NIL ) OF app_obj
  58.  
  59.     DEF grOUP_ROOT_0C , gr_grp_0 , gr_grp_1 , la_result , gr_grp_2
  60.  
  61.     self.stR_TX_result           := 'Zzzzzzzzzzzzz'
  62.  
  63.     self.bt_put_constant_string := SimpleButton( 'Put _Constant String' )
  64.  
  65.     self.bt_put_variable := SimpleButton( 'Put _Variable' )
  66.  
  67.     self.bt_return_id := SimpleButton( '_Return ID' )
  68.  
  69.     self.bt_call_hook := SimpleButton( 'Call _Hook' )
  70.  
  71.     la_result := Label( 'Result' )
  72.  
  73.     self.tx_result := TextObject ,
  74.         MUIA_HelpNode , 'TX_result' ,
  75.         MUIA_Background , MUII_TextBack ,
  76.         MUIA_Frame , MUIV_Frame_Text ,
  77.         MUIA_Text_Contents , self.stR_TX_result ,
  78.         MUIA_Text_PreParse , '\el' ,
  79.         MUIA_Text_SetMin , MUI_TRUE ,
  80.     End
  81.  
  82.     gr_grp_1 := GroupObject ,
  83.         MUIA_Group_Horiz , MUI_TRUE ,
  84.         Child , la_result ,
  85.         Child , self.tx_result ,
  86.     End
  87.  
  88.     gr_grp_0 := GroupObject ,
  89.         MUIA_Frame , MUIV_Frame_Group ,
  90.         MUIA_FrameTitle , 'Click !' ,
  91.         Child , self.bt_put_constant_string ,
  92.         Child , self.bt_put_variable ,
  93.         Child , self.bt_return_id ,
  94.         Child , self.bt_call_hook ,
  95.         Child , gr_grp_1 ,
  96.     End
  97.  
  98.     self.bt_quit := SimpleButton( '_Quit' )
  99.  
  100.     gr_grp_2 := GroupObject ,
  101.         Child , self.bt_quit ,
  102.     End
  103.  
  104.     grOUP_ROOT_0C := GroupObject ,
  105.         Child , gr_grp_0 ,
  106.         Child , gr_grp_2 ,
  107.     End
  108.  
  109.     self.wi_the_window := WindowObject ,
  110.         MUIA_Window_Title , 'The window !' ,
  111.         MUIA_HelpNode , 'WI_the_window' ,
  112.         MUIA_Window_ID , "0WIN" ,
  113.         WindowContents , grOUP_ROOT_0C ,
  114.     End
  115.  
  116.     self.app := ApplicationObject ,
  117.         ( IF icon THEN MUIA_Application_DiskObject ELSE TAG_IGNORE ) , icon ,
  118.         ( IF arexx THEN MUIA_Application_Commands ELSE TAG_IGNORE ) , ( IF arexx THEN arexx.commands ELSE NIL ) ,
  119.         ( IF arexx THEN MUIA_Application_RexxHook ELSE TAG_IGNORE ) , ( IF arexx THEN arexx.error ELSE NIL ) ,
  120.         ( IF menu THEN MUIA_Application_Menu ELSE TAG_IGNORE ) , menu ,
  121.         MUIA_Application_Author , 'Lionel Vintenat' ,
  122.         MUIA_Application_Base , 'DEMOGENCODEE' ,
  123.         MUIA_Application_Title , 'DemoGenCodeE' ,
  124.         MUIA_Application_Version , '$VER: DemoGenCodeE 1.0 (01.09.94)' ,
  125.         MUIA_Application_Copyright , 'Public Domain !' ,
  126.         MUIA_Application_Description , 'Application example for GenCodeE' ,
  127.         SubWindow , self.wi_the_window ,
  128.     End
  129.  
  130. ENDPROC self.app
  131.  
  132.  
  133. ->/////////////////////////////////////////////////////////////////////////////
  134. ->////////////////////////// Disposes the object or the whole application /////
  135. ->/////////////////////////////////////////////////////////////////////////////
  136. PROC dispose() OF app_obj IS ( IF self.app THEN Mui_DisposeObject( self.app ) ELSE NIL )
  137.  
  138.  
  139. ->/////////////////////////////////////////////////////////////////////////////
  140. ->/////////////////////// Initializes all the notifications of one object /////
  141. ->/////////////////////////////////////////// or of the whole application /////
  142. ->/////////////////////////////////////////////////////////////////////////////
  143. PROC init_notifications( display : PTR TO app_display ) OF app_obj
  144.  
  145.     domethod( self.bt_put_constant_string , [
  146.         MUIM_Notify , MUIA_Pressed , FALSE ,
  147.         self.tx_result ,
  148.         3 ,
  149.         MUIM_Set , MUIA_Text_Contents , 'Constant string put !' ] )
  150.  
  151.     domethod( self.bt_put_variable , [
  152.         MUIM_Notify , MUIA_Pressed , FALSE ,
  153.         self.tx_result ,
  154.         3 ,
  155.         MUIM_Set , MUIA_Text_Contents , string_var ] )
  156.  
  157.     domethod( self.bt_return_id , [
  158.         MUIM_Notify , MUIA_Pressed , FALSE ,
  159.         self.app ,
  160.         2 ,
  161.         MUIM_Application_ReturnID , ID_BUTTON_PRESSED ] )
  162.  
  163.     domethod( self.bt_call_hook , [
  164.         MUIM_Notify , MUIA_Pressed , FALSE ,
  165.         self.app ,
  166.         2 ,
  167.         MUIM_CallHook , display.button_pressed ] )
  168.  
  169.     domethod( self.bt_quit , [
  170.         MUIM_Notify , MUIA_Pressed , FALSE ,
  171.         self.app ,
  172.         2 ,
  173.         MUIM_Application_ReturnID , MUIV_Application_ReturnID_Quit ] )
  174.  
  175.     domethod( self.wi_the_window , [
  176.         MUIM_Window_SetCycleChain , self.bt_put_constant_string ,
  177.         self.bt_put_variable ,
  178.         self.bt_return_id ,
  179.         self.bt_call_hook ,
  180.         self.bt_quit ,
  181.         0 ] )
  182.  
  183.     set( self.wi_the_window ,MUIA_Window_Open , MUI_TRUE )
  184.  
  185. ENDPROC
  186.  
  187.  
  188.