Inheritance diagram for ExitTool:
Public Methods | |
ExitTool () | |
void | save_and_exit () |
Prompts the user and terminates the program. | |
void | start () |
When the user selects this tool, just calls save_and_exit. | |
int | mouseClick (const Position &) |
If the user clicks on the canvas, again just call save_and_exit. | |
void | stop () |
called when another tool is selected | |
Static Public Attributes | |
ExitTool::Factory | factory |
|
00013 : Tool("exit-button.bmp") {} |
|
If the user clicks on the canvas, again just call save_and_exit.
Implements Tool.
00052 { 00053 save_and_exit(); 00054 return 1; 00055 } |
|
Prompts the user and terminates the program. First, the user is asked for a filename to save the drawing. Saving isn't implemented, so this automatically fails; after a second confirmation, the program is terminated with the Terminate() function.
00021 { 00022 // We try to be friendly: 00023 // If someone doesn't actually want to quit, we 00024 // given them a way out. 00025 // If the filename doesn't work, we see 00026 // if they still want to quit. 00027 cout << "Filename to write to [don't quit] "; 00028 string filename; 00029 getline(cin,filename); 00030 if (filename.empty()) return; 00031 if (DrawFile::write_file(filename,drawing)) { 00032 Terminate(); 00033 //NB: The terminate command doesn't immediately quit. 00034 return; 00035 } 00036 cout << "File '" << filename << 00037 "' cannot be written." << endl; 00038 cout << "Quit anyway ? [no] "; 00039 string response; 00040 getline(cin,response); 00041 response = Utilities::lower_case(response); 00042 if (response == "y" || response == "yes") Terminate(); 00043 else cout << "Continuing..." << endl; 00044 } |
|
When the user selects this tool, just calls save_and_exit.
Implements Tool.
00047 { 00048 save_and_exit(); 00049 } |
|
called when another tool is selected
Implements Tool.
00057 {} |
|
|