From ccedf6f5d89f375580ff6af40296aab953f9cd09 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 31 May 2022 20:52:26 +0300 Subject: Added work from today's practice --- .../13-Practice-31.05.2022/Form.h | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Year 1/Object-oriented Programming/13-Practice-31.05.2022/Form.h (limited to 'Year 1/Object-oriented Programming/13-Practice-31.05.2022/Form.h') diff --git a/Year 1/Object-oriented Programming/13-Practice-31.05.2022/Form.h b/Year 1/Object-oriented Programming/13-Practice-31.05.2022/Form.h new file mode 100644 index 0000000..7818d58 --- /dev/null +++ b/Year 1/Object-oriented Programming/13-Practice-31.05.2022/Form.h @@ -0,0 +1,29 @@ +#include "String.h" +#include "List.hpp" +#include "Control.h" +#include "Size.h" + +class Form { + Size size; + String name; + List controls; + +public: + void addControl(Control& newControl) { + controls.add(&newControl); + } + void changeSize(Size newSize); + Control& operator[](unsigned index) { + return *controls[index]; + } + bool changeControlLocation(unsigned index, Location newLoc) { + if (newLoc.x >= 0 && newLoc.x <= size.width && newLoc.y >= 0 && newLoc.y <= size.height) { + controls[index]->get_loc() = newLoc; + return true; + } + return false; + } + void change(unsigned index) { + controls[index]->setDataDialog(); + } +}; -- cgit v1.3.1-26-gb76a