home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / optima / samples.z / WCMUtil.wxc < prev    next >
Encoding:
Text File  |  1996-05-05  |  4.2 KB  |  191 lines

  1. Save Format v1.3
  2. @begin ClassFile "WCMUtil"
  3.  Exported 0;
  4.  
  5.  @begin UserFunction "WCMUtil()"
  6.   GencodeSrcLine 15;
  7.   FunctionName "WCMUtil::WCMUtil()";
  8.  @end;
  9.  
  10.  @begin UserFunction "Prototype for WCMUtil()"
  11.   Private 1;
  12.   GencodeSrcLine 22;
  13.   FunctionName "WCMUtil::Prototype for WCMUtil()";
  14.  @end;
  15.  
  16.  @begin UserFunction "~WCMUtil()"
  17.   GencodeSrcLine 19;
  18.   FunctionName "WCMUtil::~WCMUtil()";
  19.  @end;
  20.  
  21.  @begin UserFunction "Prototype for ~WCMUtil()"
  22.   Private 1;
  23.   GencodeSrcLine 24;
  24.   FunctionName "WCMUtil::Prototype for ~WCMUtil()";
  25.  @end;
  26.  
  27.  @begin UserFunction "SetAllChangeEvents( WForm * form, WEventHandler func )"
  28.   GencodeSrcLine 23;
  29.   FunctionName "WCMUtil::SetAllChangeEvents( WForm * form, WEventHandler func )";
  30.  @end;
  31.  
  32.  @begin UserFunction "Prototype for SetAllChangeEvents( WForm * form, WEventHandler func )"
  33.   Private 1;
  34.   GencodeSrcLine 26;
  35.   FunctionName "WCMUtil::Prototype for SetAllChangeEvents( WForm * form, WEventHandler func )";
  36.  @end;
  37.  
  38.  @begin UserFunction "SetAllTextReadOnly( WForm * form )"
  39.   GencodeSrcLine 52;
  40.   FunctionName "WCMUtil::SetAllTextReadOnly( WForm * form )";
  41.  @end;
  42.  
  43.  @begin UserFunction "Prototype for SetAllTextReadOnly( WForm * form )"
  44.   Private 1;
  45.   GencodeSrcLine 28;
  46.   FunctionName "WCMUtil::Prototype for SetAllTextReadOnly( WForm * form )";
  47.  @end;
  48.  
  49.  @begin HPPPrefixBlock
  50. @begin-code HPPPrefix
  51.  
  52. // Declarations added here will be included at the top of the .HPP file
  53.  
  54. @end-code;
  55.   GencodeSrcLine 11;
  56.  @end;
  57.  
  58.  @begin CPPPrefixBlock
  59. @begin-code CPPPrefix
  60.  
  61. // Code added here will be included at the top of the .CPP file
  62.  
  63. //  Include definitions for resources.
  64. #include "WRes.h"
  65.  
  66. @end-code;
  67.   GencodeSrcLine 11;
  68.  @end;
  69.  
  70.  @begin ClassContentsBlock
  71. @begin-code ClassContents
  72.  
  73.     public:
  74.         // add your public instance data here
  75.     private:
  76.         // add your private instance data here
  77.     protected:
  78.         // add your protected instance data here
  79.  
  80. @end-code;
  81.   GencodeSrcLine 16;
  82.  @end;
  83.  
  84. @begin-code GeneratedClassContents
  85.  
  86.  
  87. @end-code;
  88.  
  89. @begin-code Code "WCMUtil::WCMUtil()"
  90.  
  91. WCMUtil::WCMUtil()
  92. {
  93.     
  94. }
  95.  
  96. @end-code;
  97.  
  98. @begin-code Code "WCMUtil::Prototype for WCMUtil()"
  99.  
  100.     public:
  101.         WCMUtil();
  102.  
  103. @end-code;
  104.  
  105. @begin-code Code "WCMUtil::~WCMUtil()"
  106.  
  107. WCMUtil::~WCMUtil()
  108. {
  109.     
  110. }
  111.  
  112. @end-code;
  113.  
  114. @begin-code Code "WCMUtil::Prototype for ~WCMUtil()"
  115.  
  116.     public:
  117.         ~WCMUtil();
  118.  
  119. @end-code;
  120.  
  121. @begin-code Code "WCMUtil::SetAllChangeEvents( WForm * form, WEventHandler func )"
  122.  
  123. // SetAllChangeEvents
  124.  
  125. // Install a change event routine on every control on a form.  (Controls
  126. // that don't have a change event will just fail on the set).
  127.  
  128. // Define a change event handler as a member of the your form:
  129. //
  130. //  WBool control_Change( WObject *, WEventData * )
  131. //  {
  132. //      _changed = TRUE;    
  133. //      return( FALSE );
  134. //  }
  135.  
  136. // Install the change events:
  137. //
  138. //  WCMUtil::SetAllChangeEvents( this, (WEventHandler)&Form1::control_Change );
  139.  
  140.  
  141.  
  142. static void WCMUtil::SetAllChangeEvents( WForm * form, WEventHandler func )
  143. {
  144.     WInt                    i;
  145.     WControl *              ctrl;
  146.  
  147.     for( i = 0; i < form->GetControlCount(); i ++ ) {
  148.         ctrl = form->GetControl( i );
  149.         ctrl->SetEventHandler( WChangeEvent, form, func );
  150.     }
  151. }
  152.  
  153. @end-code;
  154.  
  155. @begin-code Code "WCMUtil::Prototype for SetAllChangeEvents( WForm * form, WEventHandler func )"
  156.  
  157.     public:
  158.         static void SetAllChangeEvents( WForm * form, WEventHandler func );
  159.  
  160. @end-code;
  161.  
  162. @begin-code Code "WCMUtil::SetAllTextReadOnly( WForm * form )"
  163.  
  164. // SetAllTextReadOnly
  165.  
  166. // Set all WTextBox and WRichTextBox controls on a form to read-only.
  167.  
  168. static void WCMUtil::SetAllTextReadOnly( WForm * form )
  169. {
  170.     WInt                    i;
  171.     WControl *              ctrl;
  172.     
  173.     for( i = 0; i < form->GetControlCount(); i ++ ) {
  174.         ctrl = form->GetControl( i );
  175.         if( ctrl->IsDerivedFrom( WTextBox::ClassID() ) ){
  176.             ((WTextBox *)ctrl)->SetReadOnly( true );
  177.         }
  178.     }
  179.  
  180. }
  181.  
  182. @end-code;
  183.  
  184. @begin-code Code "WCMUtil::Prototype for SetAllTextReadOnly( WForm * form )"
  185.  
  186.     public:
  187.         static void SetAllTextReadOnly( WForm * form );
  188.  
  189. @end-code;
  190. @end;
  191.