-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen.h
83 lines (76 loc) · 2.23 KB
/
screen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// Created by phtran on 14/05/2016.
//
#ifndef FRONTEND_SCREEN_H
#define FRONTEND_SCREEN_H
#include <vector>
#include <list>
#include "screenform.h"
#include "basescreenvalidator.h"
#include "topline.h"
#include <iostream>
namespace UI
{
class Screen : public Component
{
public:
class WarningException;
class UserConfirmationException;
class ValidationException;
class EndUserInputEventHandler;
using value_type = std::shared_ptr<ScreenField>;
using Fields = std::vector<value_type>;
using iterator = Fields::iterator;
using const_iterator = Fields::const_iterator;
Screen();
Screen(const std::string&);
ScreenField& operator[] (const unsigned int);
const ScreenField& operator[] (const unsigned int) const;
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
iterator cursor();
const_iterator cursor() const;
iterator focus();
const_iterator focus() const;
iterator focus( iterator );
iterator firstEditable();
iterator stepForward();
iterator stepBackward();
virtual void draw() const;
void drawForm() const;
void drawFields() const;
void drawMessages() const;
void clearFields();
void title( const std::string& );
const std::string& title() const;
const ScreenForm& form() const { return frameWork_; }
virtual Screen* clone() const {
return new Screen( *this );
}
void validate();
void validateNoWarnings();
void addValidator( const BaseScreenValidator& );
void addWarningValidator( const BaseScreenValidator& );
virtual std::string name() const;
virtual std::shared_ptr<BaseEventHandler> endUserInputEventHandler();
private:
void notifyNoRecurse(iterator, const BaseEvent&);
void validateFields();
iterator cursor(iterator);
void load(const std::string&);
void drawTitle() const;
std::shared_ptr<TopLine> topLine_;
ScreenForm frameWork_;
std::string title_;
Fields fields_;
iterator focus_;
iterator cursor_;
using ValidatorPtr = std::shared_ptr<BaseScreenValidator>;
using Validators = std::list<ValidatorPtr>;
Validators validators_;
Validators warningValidators_;
};
}
#endif //FRONTEND_SCREEN_H