home *** CD-ROM | disk | FTP | other *** search
- //
- // The Fusion Library Interface for DOS
- // Version 1.02
- // Copyright (C) 1990, 1991
- // Software Dimensions
- //
- // Dialog Development System
- //
-
- #include "elements.h"
- #include "mask.h"
- #include "colors.h"
-
- const layoutContinue=30000;
- const layoutCancel=30001;
-
- //-------------------------------------------------------------------------
- //
- // This is the event handler for the push button dialog
- //
- //-------------------------------------------------------------------------
-
- int PushDialog::EventHandler(int Event)
- {
- if (Event==kbEsc ||
- Event==kbCr ||
- Event==CloseEvent ||
- Event==OutsideEvent ||
- Event==layoutContinue ||
- Event==layoutCancel)
- return StopEvent;
- return CompleteEvent;
- }
-
- //-------------------------------------------------------------------------
- //
- // Allocate and display the push button creation dialog
- //
- //-------------------------------------------------------------------------
-
-
- PushDialog::PushDialog(int Gp,int Hs,int Sl) :
- DialogClass(78,19,"Button Specifications")
- {
- PushText[0]=0;
- HotKeyDefine[0]=0;
- Constant[0]=0;
- HelpLine[0]=0;
- DerivedClass[0]=0;
-
- GroupingCode=Gp;
- HelpScreen=Hs;
- SetForLiving=Sl;
-
- Blaze.Box(1,1,57,7,Colors.DiaInterior);
- Blaze.Box(1,8,57,5,Colors.DiaInterior);
- Blaze.Box(1,13,74,3,Colors.DiaInterior);
-
- GroupHeading(18,1,1,"Element ~Characteristics",kbAltC);
- GroupHeading(18,8,2,"~Derivision Characteristics",kbAltD);
- GroupHeading(30,13,3,"Help/Prompt ~Line",kbAltL);
-
- GroupElement(1,new DiaChar(15,2,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",PushText));
- Help("Enter the text to place on the button");
- HotKey(3,2,"~Button Text",kbAltB);
-
- GroupElement(1,new DiaChar(17,4,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",Constant));
- Help("Enter the name that will be used for this constant");
- HotKey(3,4,"~Constant Name",kbAltC);
-
- GroupElement(1,new DiaChar(11,6,"xxxxxxxxxxxxx",HotKeyDefine));
- Help("Enter the hot key #define to assign to this element");
- HotKey(3,6,"~Hot Key",kbAltH);
-
- GroupElement(1,new DiaInt(39,6,"#####",GroupingCode));
- Help("Enter the group to assign this element to (0 for none)");
- HotKey(25,6,"~Grouping Code",kbAltG);
-
- GroupElement(1,new DiaInt(51,6,"#####",HelpScreen));
- Help("Enter the help screen for this element");
- HotKey(45,6,"~Event",kbAltE);
-
- GroupElement(2,new DiaHorizRadio(17,9,SetForLiving,0,0));
- (*this) + "Do Not Derive!" + "Derive a Class";
- Help("Should a derived class be created for this element?");
- HotKey(3,9,"~Derived Class",kbAltD);
-
- GroupElement(2,new DiaChar(19,11,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",DerivedClass));
- Help("Enter the name of the derived class");
- HotKey(3,11,"~Name of Derived",kbAltN);
-
- GroupElement(3,new DiaChar(13,14,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",HelpLine));
- Help("Help that you would like to appear at the bottom of the screen");
- HotKey(3,14,"Help ~Line",kbAltL);
-
- Element(new DiaPushButton(62,5,"Continue",layoutContinue,0,1));
- Help("Accept this title and continue");
-
- Element(new DiaPushButton(63,8,"Cancel",layoutCancel));
- Help("Do not accept this title");
- }
-
- //-------------------------------------------------------------------------
- //
- // Call up the dialog and request user intervention
- //
- //-------------------------------------------------------------------------
-
- int PushDialog::GetPush()
- {
- DoAgain:
-
- int Save=UseDialog();
-
- if (Save==kbCr || Save==layoutContinue)
- {
- if (!PushText[0])
- {
- InfoBox NotValid;
-
- NotValid
- + "Sorry, you must define the text"
- + "to describe the push button!";
-
- NotValid.Title("Need a Description");
- NotValid.UseInfoBox();
-
- goto DoAgain;
- }
- if (!HelpScreen)
- {
- InfoBox NotValid;
-
- NotValid
- + "Sorry, you MUST define the event"
- + "code to use for this push button.";
-
- NotValid.Title("Need an Event");
- NotValid.UseInfoBox();
-
- goto DoAgain;
- }
- if (HelpScreen && (HelpScreen<1000 || HelpScreen>32000))
- {
- InfoBox NotValid;
-
- NotValid
- + "Sorry, the event code that you"
- + "specified is invalid. It must"
- + "be between 1000 and 32000.";
-
- NotValid.Title("Incorrect Event");
- NotValid.UseInfoBox();
-
- goto DoAgain;
- }
- if (!Constant[0])
- {
- InfoBox NotValid;
-
- NotValid
- + "Sorry, you MUST define the name"
- + "of the constant that will be"
- + "used when this button is"
- + "placed in the generated code.";
-
- NotValid.Title("Need a Constant");
- NotValid.UseInfoBox();
-
- goto DoAgain;
- }
- if (SetForLiving && !DerivedClass[0])
- {
- InfoBox NotValid;
-
- NotValid
- + "Sorry, a name for the derived"
- + "class must be specified.";
-
- NotValid.Title("Missing Derived");
- NotValid.UseInfoBox();
-
- goto DoAgain;
- }
- return 1;
- }
-
- return 0;
- }
-