home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / c / fli106c / examples / layout.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-25  |  2.2 KB  |  91 lines

  1. //
  2. // The Fusion Library Interface for DOS
  3. // Version 1.02
  4. // Copyright (C) 1990, 1991
  5. // Software Dimensions
  6. //
  7. // Dialog Development System
  8. //
  9.  
  10. #include "fli.h"
  11. #include "elements.h"
  12. #include "colors.h"
  13. #include "fliwin.h"
  14. #include "dds.h"
  15.  
  16. #include <string.h>
  17.  
  18. //-------------------------------------------------------------------------
  19. //
  20. // Dialog specifications and layout class
  21. //
  22. //-------------------------------------------------------------------------
  23.  
  24. const layoutContinue=10000;
  25. const layoutCancel=10002;
  26.  
  27. class LayOutDialog : public DialogClass
  28. {
  29. public:
  30.  
  31.     LayOutDialog() : DialogClass(57,9,"Dialog Specifications") { }
  32.  
  33.     int EventHandler(int Event)
  34.   {
  35.     if (Event==kbEsc ||
  36.         Event==kbCr ||
  37.         Event==CloseEvent ||
  38.         Event==OutsideEvent ||
  39.         Event==layoutContinue ||
  40.         Event==layoutCancel)
  41.       return StopEvent;
  42.     return CompleteEvent;
  43.   }
  44. };
  45.  
  46. //-------------------------------------------------------------------------
  47. //
  48. // Layout dialog construction
  49. //
  50. //-------------------------------------------------------------------------
  51.  
  52. void DialogWindow::LayOut()
  53. {
  54.   LayOutDialog &LayUp = *new LayOutDialog();
  55.  
  56.     char *DerivedSaved=new char[50];
  57.     char *Saved=new char[50];
  58.   if (Title)
  59.       strcpy(Saved,Title);
  60.   else
  61.     strcpy(Saved,"UnNamed Dialog");
  62.   strcpy(DerivedSaved,DerivedClass);
  63.  
  64.     LayUp.Element(new DiaChar(14,1,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",Saved));
  65.     LayUp.Help("Enter the title for this dialog box");
  66.     LayUp.HotKey(1,1,"~Dialog Title",kbAltD);
  67.  
  68.     LayUp.Element(new DiaChar(15,3,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",DerivedSaved));
  69.   LayUp.Help("The derived class name for this dialog box");
  70.     LayUp.HotKey(1,3,"D~erived Class",kbAltE);
  71.  
  72.   LayUp.Element(new DiaPushButton(15,5,"Continue",layoutContinue,0,1));
  73.     LayUp.Help("Accept this title and continue");
  74.  
  75.     LayUp.Element(new DiaPushButton(31,5,"Cancel",layoutCancel));
  76.     LayUp.Help("Do not accept this title");
  77.  
  78.     int Save=LayUp.UseDialog();
  79.  
  80.     if (Save==kbCr || Save==layoutContinue)
  81.   {
  82.     if (Title)
  83.       delete Title;
  84.     Title=Saved;
  85.     strcpy(DerivedClass,DerivedSaved);
  86.   }
  87.  
  88.     delete DerivedSaved;
  89.     delete &LayUp;
  90. }
  91.