source: branches/port5/WINDOW/aw_question.hxx

Last change on this file was 5675, checked in by westram, 15 years ago
  • removed automatic timestamps (the best they were good for, were vc-conflicts)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1//  ==================================================================== //
2//                                                                       //
3//    File      : aw_question.hxx                                        //
4//    Purpose   : Functions to ask questions to user                     //
5//                                                                       //
6//                                                                       //
7//  Coded by Ralf Westram (coder@reallysoft.de) in January 2002          //
8//  Copyright Department of Microbiology (Technical University Munich)   //
9//                                                                       //
10//  Visit our web site at: http://www.arb-home.de/                       //
11//                                                                       //
12//                                                                       //
13//  ==================================================================== //
14
15#ifndef AW_QUESTION_HXX
16#define AW_QUESTION_HXX
17
18#ifndef AW_ROOT_HXX
19#include <aw_root.hxx>
20#endif
21#ifndef _STDLIB_H
22#include <stdlib.h>
23#endif
24#ifndef ARBTOOLS_H
25#include <arbtools.h>
26#endif
27
28
29// for simple questions use :  int aw_message(const char *msg, const char *buttons)
30//
31// if you ask the same question in a loop, it is recommended to use AW_repeated_question
32// to avoid asking the same question again and again.
33//
34// Usage : 1. Create a new instance of AW_repeated_question outside the loop
35//         2. call get_answer() inside the loop
36
37class AW_repeated_question : Noncopyable {
38private:
39    int   answer;
40    bool  dont_ask_again;
41    char *buttons_used;
42    char *helpfile;
43
44public:
45    AW_repeated_question(bool dont_ask_again_ = false)
46        : answer(0),
47          dont_ask_again(dont_ask_again_),
48          buttons_used(0),
49          helpfile(0)
50    {}
51    virtual ~AW_repeated_question() {
52        free(buttons_used);
53        free(helpfile);
54    }
55
56    void add_help(const char *help_file); // when called, a help button is added to the prompter
57
58    int get_answer(const char *question, const char *buttons, const char *to_all, bool add_abort);
59    // return 0 for first button, 1 for second button, 2 for third button, ...
60    // the single buttons are seperated by kommas (i.e. "YES,NO")
61    // if add_abort is true an 'ABORT' button is added behind the last
62};
63
64
65#else
66#error aw_question.hxx included twice
67#endif // AW_QUESTION_HXX
68
Note: See TracBrowser for help on using the repository browser.