tbx  0.7.5
questionwindow.h
1 /*
2  * tbx RISC OS toolbox library
3  *
4  * Copyright (C) 2012 Alan Buckley All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  *//*
24  * questionwindow.h
25  *
26  * Created on: 8 Mar 2012
27  * Author: alanb
28  */
29 
30 #ifndef TBX_QUESTIONWINDOW_H_
31 #define TBX_QUESTIONWINDOW_H_
32 
33 #include "textdisplaywindow.h"
34 #include "command.h"
35 #include <vector>
36 
37 namespace tbx {
38 
64 {
65  std::vector<tbx::Command *> *_commands_to_delete;
66 public:
67  QuestionWindow(const std::string &question);
68  virtual ~QuestionWindow();
69 
70  void delete_commands();
71 
72  void add_yes_command(tbx::Command *yes_command);
73  void add_no_command(tbx::Command *no_command);
74 };
75 
76 void show_question(const std::string &question, const std::string &title, tbx::Command *yes_command, tbx::Command *no_command = 0, bool delete_commands = false);
77 void show_question_as_menu(const std::string &question, const std::string &title, tbx::Command *yes_command, tbx::Command *no_command = 0, bool delete_commands = false);
78 
79 } /* namespace tbx */
80 
81 #endif /* TBX_QUESTIONWINDOW_H_ */
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:34
Class to show some text in a window in the centre of the screen, with an icon to the left and one or ...
Definition: textdisplaywindow.h:58
Base class for commands in tbx.
Definition: command.h:36
QuestionWindow(const std::string &question)
Construct a question window with the give question.
Definition: questionwindow.cc:95
void delete_commands()
Delete all commands added when dialog exits.
Definition: questionwindow.cc:123
void add_no_command(tbx::Command *no_command)
Add a command to be run if the no button is selected.
Definition: questionwindow.cc:145
void show_question_as_menu(const std::string &question, const std::string &title, tbx::Command *yes_command, tbx::Command *no_command, bool delete_commands)
Show a question in a window centred in the screen.
Definition: questionwindow.cc:79
void title(const std::string &title)
Set the title for the text display window.
Definition: textdisplaywindow.cc:90
void add_yes_command(tbx::Command *yes_command)
Add a command to be run if the yes button is selected.
Definition: questionwindow.cc:133
void show_question(const std::string &question, const std::string &title, tbx::Command *yes_command, tbx::Command *no_command, bool delete_commands)
Show a question in a window centred in the screen.
Definition: questionwindow.cc:50
Class to show a question in a window in the centre of the screen, resizing the window to fit the ques...
Definition: questionwindow.h:63