home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ctdemo.zip / classes / @CLSLIB1.ZIP / cls / iclui / atxtdlog.cpp < prev   
C/C++ Source or Header  |  1994-10-16  |  3KB  |  140 lines

  1. #ifndef INC_ATEXTDIALOG
  2. #define INC_ATEXTDIALOG
  3.  
  4. #ifndef __FIRST__
  5. #define __FIRST__
  6. #define __IMPL__ATEXTDIALOG
  7. #endif
  8.  
  9. /////V ATextDialog PCM f:\cls_ibm\cls\iclui 0 PM 20.10.94 19:37:13
  10.  
  11. /*
  12. /////H 
  13. 20.10.94 19:37 PM 0 copied from: ATextDialog TOS f:\cls_ibm\cls\iclui 0 PM 19.10.94 00:26:01
  14. 30.03.95 10:34 PM 0 archived: ATextDialog PCM f:\cls_ibm\cls\iclui 0 PM 20.10.94 19:37:13
  15. /////
  16. */
  17.  
  18. /////1
  19. #undef inline
  20.  
  21. #include <bsa.h>
  22.  
  23. /////I iframe.hpp @ @ @ @ pre 
  24. #include <iframe.hpp>
  25.  
  26. /////I icmdhdr.hpp @ @ @ @ pre 
  27. #include <icmdhdr.hpp>
  28.  
  29. /////T Pre pre 
  30. class IEntryField;
  31. /////
  32.  
  33.  
  34. #ifndef __INLINE__
  35. #define inline
  36. #endif
  37.  
  38. /////C ATextDialog @ @ 
  39. class ATextDialog :
  40.  
  41. /////B IFrameWindow @ @ visible extern 
  42. public  IFrameWindow,
  43.  
  44. /////B ICommandHandler @ @ visible extern 
  45. public  ICommandHandler
  46.  
  47. {
  48.  
  49. private:
  50. /////D textField @  @ instance private 
  51.     IEntryField *  textField;
  52.  
  53. /////D textValue @  @ instance private 
  54.     IString &  textValue;
  55.  
  56.  
  57. protected:
  58.     virtual Boolean  command (ICommandEvent&);
  59. public:
  60.     ATextDialog (IString&,IWindow*);
  61.     ~ATextDialog ();
  62. };
  63.  
  64.  
  65. /////2
  66. #undef inline
  67.  
  68.  
  69. #if (defined __INLINE__) || (defined __IMPL__ATEXTDIALOG)
  70.  
  71. #ifndef __INLINE__
  72. #define inline
  73. #endif
  74.  
  75. /////
  76. #endif
  77.  
  78. /////3
  79. #undef inline
  80.  
  81. #ifdef __IMPL__ATEXTDIALOG
  82. /////I ientryfd.hpp @ @ @ @ impl 
  83. #include <ientryfd.hpp>
  84.  
  85. /////I icmdevt.hpp @ @ @ @ impl 
  86. #include <icmdevt.hpp>
  87.  
  88. /////I istring.hpp @ @ @ @ impl 
  89. #include <istring.hpp>
  90.  
  91. /////I ireslib.hpp @ @ @ @ impl 
  92. #include <ireslib.hpp>
  93.  
  94. /////I ahellow5.h @ @ @ @ impl 
  95. #include <ahellow5.h>
  96.  
  97. /////F ATextDialog @ @ instance public 
  98. ATextDialog :: ATextDialog(IString & textString, IWindow * ownerWnd)
  99.              : IFrameWindow(IResourceId(WND_TEXTDIALOG), ownerWnd),
  100.                  textValue(textString)
  101. {
  102.   ICommandHandler::handleEventsFor(this);
  103.  
  104.   textValue=textString ;
  105.   textField=new IEntryField(DID_ENTRY,
  106.     this);
  107.   textField->setText(textString);
  108.   textField->setFocus();
  109.  
  110. }
  111.  
  112. /////F command @ @ terminal protected instance 
  113. Boolean ATextDialog :: command(ICommandEvent& cmdevt)
  114. {
  115.   switch(cmdevt.commandId()) {
  116.     case DID_OK:
  117.       textValue = textField->text();
  118.       dismiss(DID_OK);
  119.       return(true);
  120.       break;
  121.  
  122.     case DID_CANCEL:
  123.       dismiss(DID_CANCEL);
  124.       return(true);
  125.       break;
  126.   }
  127.  
  128.   return(false);
  129. }
  130.  
  131. /////F ~ATextDialog @ @ instance public 
  132. ATextDialog :: ~ATextDialog()
  133. {
  134. }
  135.  
  136. /////
  137. #endif
  138.  
  139. #endif
  140.