Esempio n. 1
0
void Dialog::setLayout(Widget * contents, Widget * buttons) {
	LinearContainer * container = new LinearContainer();
	container->setVertical();
	container->setSpacing(8);
	container->addWidget(contents);
	container->addWidget(buttons);

	setPadding(8);

	setContent(container);
}
Esempio n. 2
0
Widget * Dialog::setTextMessage(std::string message) {
	LinearContainer * text = new LinearContainer();
	text->setSpacing(4);
	text->setVertical();

	size_t index = 0;

	while ((index = message.find('\n')) != std::string::npos) {
		text->addWidget(new TextWidget(message.substr(0, index), 0, 0));
		message.erase(0, index + 1);
	}

	text->addWidget(new TextWidget(message.substr(0, message.length()), 0, 0));
	return text;
}
Esempio n. 3
0
Dialog::Dialog(std::string id, std::string message, std::string positiveButton, std::string negativeButton, std::string neutralButton) : _id(id) {
	LinearContainer * buttons = new LinearContainer();
	buttons->setHorizontal();

	buttonPositive = new ButtonWidget(new TextWidget(positiveButton, 0, 0));
	buttons->addWidget(buttonPositive);
	buttonNegative = new ButtonWidget(new TextWidget(negativeButton, 0, 0));
	buttons->addWidget(buttonNegative);
	buttonNeutral = new ButtonWidget(new TextWidget(neutralButton, 0, 0));
	buttons->addWidget(buttonNeutral);

	setLayout(setTextMessage(message), buttons);

	_ct = -getWidth();
}
Esempio n. 4
0
Dialog::Dialog(std::string id, std::string message) : _id(id) {
	LinearContainer * buttons = new LinearContainer();
	buttons->setHorizontal();

	buttonOk = new ButtonWidget(new TextWidget("Ok", 0, 0));
	buttons->addWidget(buttonOk);

	setLayout(setTextMessage(message), buttons);

	_ct = -getWidth();
}