]> git.tdb.fi Git - r2c2.git/blob - source/engineer/userinterface.h
Move user interface code to its own class
[r2c2.git] / source / engineer / userinterface.h
1 #ifndef USERINTERFACE_H_
2 #define USERINTERFACE_H_
3
4 #include <msp/gltk/resources.h>
5 #include <msp/gltk/root.h>
6 #include "libr2c2/driver.h"
7 #include "libr2c2/train.h"
8 #include "libr2c2/zone.h"
9 #include "mainwindow.h"
10
11 class DynamicDialog;
12
13 class UserInterface
14 {
15 private:
16         Engineer &engineer;
17         Msp::GLtk::Resources resources;
18         Msp::GLtk::Root root;
19         Msp::GLtk::Arrangement *root_arrangement;
20
21         MainWindow main_wnd;
22         std::list<DynamicDialog *> dyn_dialogs;
23         bool import_active;
24
25         Msp::Time::TimeStamp status_timeout;
26
27 public:
28         UserInterface(Engineer &, Msp::Graphics::Window &, Msp::Input::Keyboard &, Msp::Input::Mouse &);
29         ~UserInterface();
30
31         const Msp::GLtk::Resources &get_resources() const { return resources; }
32
33         void set_status(const std::string &);
34         void add_dynamic_dialog(DynamicDialog &);
35         void remove_dynamic_dialog(DynamicDialog &);
36
37         void show_train(R2C2::Train &);
38         void show_zone(R2C2::Zone &);
39 private:
40         void locomotive_detected(const R2C2::Driver::DetectedLocomotive &);
41         void import_finished(int);
42
43 public:
44         void tick();
45         void render() const;
46 };
47
48 #endif