home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / i / iv26_w_3.zip / EXAMPLES / IDRAW / DIALOGBO.H < prev    next >
C/C++ Source or Header  |  1991-12-20  |  5KB  |  175 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: dialogbox.h,v 1.12 90/01/25 16:29:11 interran Exp $
  24. // declares class DialogBox and DialogBox subclasses.
  25.  
  26. #ifndef dialogbox_h
  27. #define dialogbox_h
  28.  
  29. #include <InterViews/filechooser.h>
  30.  
  31. // Declare imported types.
  32.  
  33. class ButtonState;
  34. class IMessage;
  35. class StringEditor;
  36.  
  37. // A DialogBox knows how to set its message and warning text and how
  38. // to pop up itself over the underlying Interactor.
  39.  
  40. class DialogB : public MonoScene {
  41. public:
  42.  
  43.     void SetMessage(const char* = nil, const char* = nil);
  44.     void SetWarning(const char* = nil, const char* = nil);
  45.     void SetUnderlying(Interactor*);
  46.  
  47. protected:
  48.  
  49.     DialogB(Interactor*, const char* = nil);
  50.  
  51.     void PopUp();
  52.     void Disappear();
  53.  
  54.     IMessage* message;        // displays message text
  55.     IMessage* warning;        // displays warning text
  56.     Interactor* underlying;    // we'll insert ourselves into its parent
  57.  
  58. };
  59.  
  60. // A Messager displays a message until it's acknowledged.
  61.  
  62. class Messager : public DialogB {
  63. public:
  64.  
  65.     Messager(Interactor*, const char* = nil);
  66.     ~Messager();
  67.  
  68.     void Display();
  69.  
  70. protected:
  71.  
  72.     void Init();
  73.     void Reconfig();
  74.  
  75.     ButtonState* ok;        // stores status of "ok" button
  76.     Interactor* okbutton;    // displays "ok" button
  77.  
  78. };
  79.  
  80. // A Confirmer displays a message until it's confirmed or cancelled.
  81.  
  82. class Confirmer : public DialogB {
  83. public:
  84.  
  85.     Confirmer(Interactor*, const char* = nil);
  86.     ~Confirmer();
  87.  
  88.     char Confirm();
  89.  
  90. protected:
  91.  
  92.     void Init();
  93.     void Reconfig();
  94.  
  95.     ButtonState* yes;        // stores status of "yes" button
  96.     ButtonState* no;        // stores status of "no" button
  97.     ButtonState* cancel;    // stores status of "cancel" button
  98.     Interactor* yesbutton;    // displays "yes" button
  99.     Interactor* nobutton;    // displays "no" button
  100.     Interactor* cancelbutton;    // displays "cancel" button
  101.  
  102. };
  103.  
  104. // A Namer displays a string until it's edited or cancelled.
  105.  
  106. class Namer : public DialogB {
  107. public:
  108.  
  109.     Namer(Interactor*, const char* = nil);
  110.     ~Namer();
  111.  
  112.     char* Edit(const char*);
  113.  
  114. protected:
  115.  
  116.     void Init();
  117.     void Reconfig();
  118.  
  119.     ButtonState* accept;    // stores status of "accept" button
  120.     ButtonState* cancel;    // stores status of "cancel" button
  121.     Interactor* acceptbutton;    // displays "accept" button
  122.     Interactor* cancelbutton;    // displays "cancel" button
  123.     StringEditor* stringeditor;    // displays and edits a string
  124.  
  125. };
  126.  
  127. // A NamerNUnit displays a string until it's edited or cancelled and
  128. // appends an unit to the string when returning the string.
  129.  
  130. class NamerNUnit : public DialogB {
  131. public:
  132.  
  133.     NamerNUnit(Interactor*, const char*, const char*, const char*);
  134.     ~NamerNUnit();
  135.  
  136.     char* Edit(const char*);
  137.  
  138. protected:
  139.  
  140.     void Init();
  141.     void Reconfig();
  142.  
  143.     ButtonState* accept;    // stores status of "accept" button
  144.     ButtonState* cancel;    // stores status of "cancel" button
  145.     ButtonState* unit;        // stores current unit
  146.     Interactor* acceptbutton;    // displays "accept" button
  147.     Interactor* cancelbutton;    // displays "cancel" button
  148.     Interactor* unit1button;    // displays first unit button
  149.     Interactor* unit2button;    // displays second unit button
  150.     StringEditor* stringeditor;    // displays and edits a string
  151.  
  152. };
  153.  
  154. // A Finder browses the file system and returns a file name.
  155.  
  156. class Finder : public FileChooser {
  157. public:
  158.  
  159.     Finder(Interactor*, const char*);
  160.  
  161.     const char* Find();
  162.  
  163. protected:
  164.  
  165.     Interactor* Interior();
  166.     boolean Popup(Event&, boolean = true);
  167.  
  168. protected:
  169.  
  170.     Interactor* underlying;    // we'll insert ourselves into its parent
  171.  
  172. };
  173.  
  174. #endif
  175.