home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C++ / Snippets / CModalDialog Class / Sample Code / CTextBoxDialog.h < prev    next >
Encoding:
Text File  |  1995-10-11  |  2.0 KB  |  65 lines  |  [TEXT/CWIE]

  1. // CTextBoxDialog.h
  2. //     Copyright © 1995 by Michael F. Kamprath, All rights reserved.
  3. //
  4. // Contact information:
  5. //     mailto:kamprat@leonardo.net
  6. //     http://www.leonardo.net/kamprath
  7. //
  8. // License:
  9. //     This code may be freely used in free and shareware products. Commercial product
  10. //     users must supply me with a free, fully licensed copy of the product this code is
  11. //     used in. In either case, users should notify me of their use of this code.
  12. //
  13. //     This code may be freely distributed in it's non-modified form. It's original archive
  14. //     should be kept intact.
  15. //
  16. // Version History:
  17. //     v1.0.0 - Inititial release. Intended to be an example of how to use CModalDialog, but
  18. //              it is useful in and of itself.
  19. //
  20.  
  21. #pragma once
  22.  
  23. #include "CModalDialog.h"
  24.  
  25. class    CTextBoxDialog    :    public    CModalDialog
  26. {
  27.  
  28. private:
  29.     friend    pascal void        TextBoxItem( WindowPtr theWindow, short itemNo);
  30.     friend    pascal void     TextScrollProc(ControlHandle theControl, ControlPartCode partCode);
  31.  
  32.     enum {
  33.         kOK = 1,
  34.         kScrollBar = 2,
  35.         kTextBox = 3
  36.     };
  37.     
  38.     UserItemUPP            textBoxUPP;
  39.     ControlActionUPP    scrollProcUPP;
  40.     TEHandle            aboutTEH;
  41.     short                lastScrollValue;
  42.     
  43. public:
  44.     // Pass the DLOG resource ID and the resource ID for the TEXT and styl
  45.     // resources (their IDs should be the same) to be displayed to the
  46.     // constructor.
  47.                         CTextBoxDialog( short dlogResID, short textResID );
  48.     virtual                ~CTextBoxDialog();
  49.     
  50.     // These are the filter functions that CTextBoxDialog overrides from CModalDialog
  51.     
  52.     virtual Boolean        KeyDownFilter(        DialogPtr         theDlg, 
  53.                                             EventRecord     *theEvent, 
  54.                                             short             *itemHit);
  55.     virtual    Boolean        MouseDownFilter(    DialogPtr         theDlg, 
  56.                                             EventRecord*     theEvent, 
  57.                                             short*             itemHit );
  58.                                             
  59.     // DisplayTextBoxDialog() is the only function that needs to be called to display
  60.     // a text box dialog with CTextBoxDialog. It handles the calls to
  61.     // CModalDialog::DoOneModalLoop() for you.
  62.     
  63.     void                DisplayTextBoxDialog( void );
  64. };
  65.