home *** CD-ROM | disk | FTP | other *** search
-
- // utils.h.dbox
-
- // Dreamscape - C++ class library for RISC OS
- // Copyright (c) 1996 Mark Seaborn <mseaborn@argonet.co.uk>
- //
- // This library is free software; you can redistribute it and/or
- // modify it under the terms of the GNU Library General Public
- // License as published by the Free Software Foundation; either
- // version 2 of the License, or (at your option) any later version.
- // See the Dreamscape documentation for more information.
-
- #ifndef dreamscape_dbox_H
- #define dreamscape_dbox_H
-
- #include "window.h"
- #include "actionbutton.h"
-
- class DialogueBoxHandler {
- public:
- virtual void keep() = 0;
- virtual void revert() = 0;
- virtual void save();
- };
-
- class DialogueBox: public BaseWindow {
- Window *window;
- unsigned owns_window: 1;
- ActionButton *ok, *cancel, *save;
- List<DialogueBoxHandler *> handlers;
-
- class ShowingHandler: public Command {
- DialogueBox *dbox;
- public:
- ShowingHandler(DialogueBox *d): dbox(d) {}
- void execute();
- } showing_handler;
- friend ShowingHandler;
-
- class OKHandler: public ActionButtonClickHandler {
- DialogueBox *dbox;
- public:
- OKHandler(DialogueBox *d): dbox(d) {}
- void action_button_click(const ActionButtonClickInfo &info);
- } ok_handler;
- friend OKHandler;
-
- class CancelHandler: public ActionButtonClickHandler {
- DialogueBox *dbox;
- public:
- CancelHandler(DialogueBox *d): dbox(d) {}
- void action_button_click(const ActionButtonClickInfo &info);
- } cancel_handler;
- friend CancelHandler;
-
- class SaveHandler: public ActionButtonClickHandler {
- DialogueBox *dbox;
- public:
- SaveHandler(DialogueBox *d): dbox(d) {}
- void action_button_click(const ActionButtonClickInfo &info);
- } save_handler;
- friend SaveHandler;
-
- void set_handlers();
-
- public:
- DialogueBox(BaseWindow *window, ActionButton *ok, ActionButton *cancel,
- ActionButton *save = 0);
- enum { has_save_button = 1 };
- DialogueBox(BaseWindow *window, int flags = 0);
- DialogueBox(const char *name, int flags = 0);
- virtual ~DialogueBox();
-
- void add_handler(DialogueBoxHandler *handler);
- void remove_handler(DialogueBoxHandler *handler);
-
- BaseWindow &get_next_window();
- const BaseWindow &get_next_window() const;
- bool has_next_window() const;
- };
-
- #endif
-