UPLOAD - DOSUIT07.ZIP - ALERT.HPP

 
Output of file : ALERT.HPP contained in archive : DOSUIT07.ZIP

// Alert boxes, confirm dialogs etc.
#ifndef ALERT_HPP
#define ALERT_HPP
#include "vobject.hpp"

extern ColorSet alertColors; // Used for alert & confirm boxes.
extern ColorSet defaultColors; // Used when no specific colors specified.
class Command;

/*
Place an Alert Dialog containing the text (which may contain
embedded newlines), and an "O.K." button, on the screen. Control
does not return to the caller until the user presses the button. The
dialog is automatically removed from the screen.
*/
extern void alert(const char *text,const ColorSet &c = alertColors);

/*
Place a Confirmation Dialog on the screen. The dialog contains the
text (which may contain embedded newlines), and "Yes" and "No"
buttons. Return value is 1 if the user pressed the "Yes" button, 0
for the "No" button. The dialog is automatically removed from the
screen.
*/
extern int confirm(const char *text,
const char *yestext = "~Yes",const char *notext = "~No",
const ColorSet &c = alertColors);

/*
Place a Selection Dialog on the screen. The dialog contains the text
(which may contain embedded newlines), and buttons for each option.
If an option button is pressed, the corresponding Command is
executed. Additional options and Commands are supplied in sequence
(command, option, command, option, ...). Control returns to the
caller immediately. The dialog is automatically removed from the
screen after the user presses one of the buttons.
*/
extern void select(const char *text,Command *cmd,
const char *option,...);

/*
A Window containing a message to the user is popped up on the screen.
The window will be removed next time control returns to the
Application message loop.
*/
class Message {
public:
Message(const char *text,int width = -1,AlignFlag alignment = AFcenter,
BorderFlag border = BFdouble,const ColorSet &c = defaultColors);
// The constructor gives full control over the size, relative position,
// color and border of the Message, but the default values are for the
// size to be the length of the string, the single box to be centered
// on the screen, and for the default color to be used.

~Message();

private:
class Window *w;
};

// Display a moving bar indicating how a long job is progressing.
class ProgressBox : public VObject {
long total, done;
long calculateScale() const;
public:
ProgressBox(long max, const char *name = "");
// Max is an estimate, in arbitrary units, of the length of the job.
void refresh(long howmuch);
// Howmuch is how the job has progressed so far, in the same units as max.
virtual coord maxwidth() const;
virtual coord minwidth() const;
virtual void paint(Rectangle r);
};

#endif