home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / CFGED1B.ZIP / CFGEDSRC.ZIP / PROMPTER.CC < prev    next >
C/C++ Source or Header  |  1992-08-29  |  3KB  |  97 lines

  1. // this might look like 'C', but it's really  -*-c++-*-
  2. /* prompter.cc
  3.  *
  4.  * Declaration of class PrompterDlg for CFGED
  5.  *
  6.  * Language        : C++
  7.  * Operating System: OS/2 V2.0 and higher
  8.  * Compiler        : GNU GCC V2.1 and higher
  9.  *
  10.  *
  11.  * $Id: prompter.cc,v 1.3 1992/08/29 16:12:07 gruen Exp $
  12.  * $Log: prompter.cc,v $
  13. // Revision 1.3  1992/08/29  16:12:07  gruen
  14. // Fixed several bugs. This will become the official beta-release.
  15. //
  16. // Revision 1.2  1992/08/09  21:55:35  gruen
  17. // beta release 1.0 of cfged. Changed the architecture: now using a dialog
  18. // box as main window. As an result the accelerators now work. As goodie
  19. // there is a new special-browser for HELP and last but not least the
  20. // warning at the end of the program occures only if there not saved
  21. // changes to the configuration.
  22. //
  23. // Revision 1.1  1992/07/17  00:23:38  gruen
  24. // Initial revision
  25. //
  26.  *
  27.  * Copyright (c) 1992 Lutz Grueneberg
  28.  *
  29.  * This library is free software; you can redistribute it and/or modify
  30.  * it under the terms of the GNU Library General Public License as
  31.  * published by the Free Software Foundation; either version 2 of the
  32.  * License, or (at your option) any later version.  This library is
  33.  * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  34.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  35.  * A PARTICULAR PURPOSE.  See the GNU Library General Public License for
  36.  * more details. You should have received a copy of the GNU Library
  37.  * General Public License along with this library; if not, write to the
  38.  * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  39.  */
  40. #define INCL_PM
  41. #include <os2.h>
  42. #include <pmviews/pmviews.h>
  43. #include <Regx.h>
  44. #include <Strng.h>
  45. #include "maindlg.h"
  46. #include "prompter.h"
  47. #include "pmctool.h"
  48.  
  49.      PrompterDlg::PrompterDlg( HWND hwndOwnerNew, 
  50.                   USHORT  idResNew) 
  51. :( hwndOwnerNew, idResNew) {
  52.   pComment  = new StaticText( this, PR_COMMENT);
  53.   pef       = new EntryField( this, PR_EDIT_FIELD);
  54.   pbtOK     = new CntrlWindow( this, PR_OK_BUTT);
  55.   pbtCancel = new CntrlWindow( this, PR_CANCEL_BUTT);
  56.   pbtHelp   = new CntrlWindow( this, PR_HELP_BUTT);
  57.   pStrg     = NULL;
  58.   pszComment= NULL;
  59. }
  60.  
  61.  
  62. MRESULT PrompterDlg::msgInitDlg( HWND hwnd, USHORT msg, 
  63.                 MPARAM mp1, MPARAM mp2, BOOL *fDoDefault) {
  64.   pComment->setText( pszComment);
  65.   pef     ->setTextLimit( 512);
  66.   pef     ->setText( (char *)*pStrg);
  67.   pbtHelp ->enable( FALSE);
  68.   fChanged = FALSE;        // initial instance value is no change
  69.   return 0;
  70. }
  71.  
  72. MRESULT PrompterDlg::msgCommand( HWND hwnd, USHORT msg, 
  73.                    MPARAM mp1, MPARAM mp2, BOOL *fDoDefault) {
  74.   USHORT usID;
  75.  
  76.   usID = SHORT1FROMMP(mp1);    // the resource id of the sender
  77.   if( SHORT1FROMMP( mp2) == CMDSRC_PUSHBUTTON) {   
  78.     switch (SHORT1FROMMP(mp1)) {   
  79.     case PR_OK_BUTT:        // OK Button Pressed
  80.       //DosBeep( 100, 100);
  81.       pef->queryText( szBuf, 512);
  82.       if( strcmp( (char*)*pStrg, szBuf)) // record change of contents
  83.     fChanged = TRUE;
  84.       *pStrg = szBuf;
  85.       //PmUserMessage( HWND_DESKTOP, "%s", (const char *)pStrg);
  86.       fDoDefault = FALSE;
  87.       destroy();
  88.       break;
  89.     case PR_CANCEL_BUTT:
  90.       fDoDefault = FALSE;
  91.       destroy();
  92.       break;
  93.     }
  94.   }
  95.   return 0;
  96. }
  97.