GUI
CustomWidget.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 by Maciej Wiecierzewski
3  */
4 
5 #include "CustomWidget.h"
6 
7 #include <stdexcpt.h>
8 #include <iostream>
9 
10 #include "GUISystem.h"
11 
12 CustomWidget::CustomWidget(GUISystem *guiSystem, int x, int y) :
13  Button(guiSystem, x, y, 200, 40, "")
14 {
15  this->addEventListener(EventType::MOUSE_BUTTON_UP, static_cast<EventListener::Function>(std::bind(&CustomWidget::onClick, this, std::placeholders::_1)));
16 }
17 
19 {
20  try{
21  this->guiSystem->createEvent(EventType::NONE);
22  }
23  catch(std::exception &e)
24  {
25  this->setText(e.what());
26  }
27 }