14std::map<ControlledObjectStatus, std::string> status_to_string{
15 {ControlledObjectStatus::IS_WAITING,
"IS_WAITING"},
16 {ControlledObjectStatus::HAS_FOCUS,
"HAS_FOCUS"},
17 {ControlledObjectStatus::IS_ACTIVE,
"IS_ACTIVE"}};
19TestCursorWidgetWithIncrementalValue::TestCursorWidgetWithIncrementalValue(
TestIncrementalValue *_actual_displayed_object)
20 :
UIWidget(nullptr, 128, 8, 0, 0, false)
22 this->set_displayed_model(_actual_displayed_object);
23 this->actual_displayed_object = _actual_displayed_object;
25 char_position_slope = (max_line_width - 1.) / (actual_displayed_object->get_max_value() - actual_displayed_object->get_min_value());
26 char_position_offset = 1 - char_position_slope * actual_displayed_object->
get_min_value();
29TestCursorWidgetWithIncrementalValue::~TestCursorWidgetWithIncrementalValue()
38 this->actual_displayed_object->clear_change_flag();
42int TestCursorWidgetWithIncrementalValue::value_to_char_position()
44 return (char_position_slope * actual_displayed_object->
get_value() + char_position_offset);
47void TestCursorWidgetWithIncrementalValue::draw()
51 case ControlledObjectStatus::IS_WAITING:
52 printf(
"[%s] %s with value=%d\n",
53 actual_displayed_object->get_name().c_str(), status_to_string[actual_displayed_object->
get_status()].c_str(), actual_displayed_object->
get_value());
55 case ControlledObjectStatus::HAS_FOCUS:
56 printf(
"[%s] %s with value=%d\n",
57 actual_displayed_object->get_name().c_str(), status_to_string[actual_displayed_object->
get_status()].c_str(), actual_displayed_object->
get_value());
59 case ControlledObjectStatus::IS_ACTIVE:
60 printf(
"[%s] %s with value= %d %*c\n",
61 actual_displayed_object->get_name().c_str(), status_to_string[actual_displayed_object->
get_status()].c_str(), actual_displayed_object->
get_value(), value_to_char_position(),
'|');
68void TestObjectManagerWidget::draw()
70 std::string text =
"manager " + status_to_string[actual_displayed_object->
get_status()] +
" with value=" + std::to_string(actual_displayed_object->
get_value()) +
"\n";
74TestObjectManagerWidget::TestObjectManagerWidget(
Test_Manager *_manager)
75 :
UIWidget(nullptr, 128, 8, 0, 0, false)
78 this->actual_displayed_object = _manager;
81TestObjectManagerWidget::~TestObjectManagerWidget()
90 this->actual_displayed_object->clear_change_flag();
94void TestSetOfWidget::draw()
98TestSetOfWidget::TestSetOfWidget()
99 :
UIWidget(nullptr, 128, 8, 0, 0, false)
103TestSetOfWidget::~TestSetOfWidget()
int get_min_value()
Get the min value object.
int get_value()
Get the value object.
ControlledObjectStatus get_status()
Get the status object.