Last change
on this file since ff1812 was 4fc41a, checked in by Tillmann Crueger <crueger@…>, 15 years ago |
Made the UIFactory an instance of the Singleton Pattern
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | #include "Actions/small_actions.hpp"
|
---|
2 |
|
---|
3 | #include <iostream>
|
---|
4 | #include <string>
|
---|
5 |
|
---|
6 | using namespace std;
|
---|
7 |
|
---|
8 | #include "UIElements/UIFactory.hpp"
|
---|
9 | #include "UIElements/Dialog.hpp"
|
---|
10 |
|
---|
11 | #include "atom.hpp"
|
---|
12 | #include "molecule.hpp"
|
---|
13 |
|
---|
14 | /****** ChangeMoleculeNameAction *****/
|
---|
15 |
|
---|
16 | char ChangeMoleculeNameAction::NAME[] = "Change filename of Molecule";
|
---|
17 |
|
---|
18 | ChangeMoleculeNameAction::ChangeMoleculeNameAction(MoleculeListClass *_molecules) :
|
---|
19 | Action(NAME),
|
---|
20 | molecules(_molecules)
|
---|
21 | {}
|
---|
22 |
|
---|
23 | ChangeMoleculeNameAction::~ChangeMoleculeNameAction()
|
---|
24 | {}
|
---|
25 |
|
---|
26 | void ChangeMoleculeNameAction::call() {
|
---|
27 | string filename;
|
---|
28 | molecule *mol = NULL;
|
---|
29 | Dialog *dialog = UIFactory::getInstance().makeDialog();
|
---|
30 |
|
---|
31 | dialog->queryMolecule("Enter index of molecule: ",&mol,molecules);
|
---|
32 | dialog->queryString("Enter name: ",&filename);
|
---|
33 | if(dialog->display()) {
|
---|
34 | mol->setName(filename);
|
---|
35 | }
|
---|
36 |
|
---|
37 | delete dialog;
|
---|
38 | }
|
---|
39 |
|
---|
40 | void ChangeMoleculeNameAction::undo() {
|
---|
41 |
|
---|
42 | }
|
---|
43 |
|
---|
44 | bool ChangeMoleculeNameAction::canUndo() {
|
---|
45 | return false;
|
---|
46 | }
|
---|
47 |
|
---|
48 | bool ChangeMoleculeNameAction::shouldUndo() {
|
---|
49 | return true;
|
---|
50 | }
|
---|
51 |
|
---|
52 | const string ChangeMoleculeNameAction::getName() {
|
---|
53 | return NAME;
|
---|
54 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.