diff options
Added work from today's practice
1 files changed, 29 insertions, 0 deletions
| -rw-r--r-- | Year 1/Object-oriented Programming/13-Practice-31.05.2022/Form.h | 29 |
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<Control*> 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(); + } +}; |
