1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include "tpi-image-builder.h"
#include <QObject>
#include <QRect>
#include <Tui/ZDialog.h>
#include <Tui/ZInputBox.h>
#include <Tui/ZRoot.h>
#include <Tui/ZTerminal.h>
void inputBox() {
Tui::ZTerminal terminal (Tui::ZTerminal::OffScreen(40, 40));
Tui::ZRoot root;
terminal.setMainWidget(&root);
Tui::ZDialog dialog(&root);
dialog.setGeometry({0, 0, 12, 10});
dialog.setFocus();
dialog.setBorderEdges({});
// default
{
Tui::ZInputBox inputbox(&dialog);
inputbox.setGeometry({1, 1, 10, 1});
inputbox.setText("InputBox");
export_tpi(&terminal, "inputbox", 0, 0, 12, 3);
}
// focus
{
Tui::ZInputBox inputbox(&dialog);
inputbox.setGeometry({1, 1, 10, 1});
inputbox.setText("InputBox");
inputbox.setFocus();
export_tpi(&terminal, "inputbox-focus", 0, 0, 12, 3);
}
// disabled
{
Tui::ZInputBox inputbox(&dialog);
inputbox.setGeometry({1, 1, 10, 1});
inputbox.setText("InputBox");
inputbox.setEnabled(false);
export_tpi(&terminal, "inputbox-disabled", 0, 0, 12, 3);
}
// password
{
Tui::ZInputBox inputbox(&dialog);
inputbox.setGeometry({1, 1, 10, 1});
inputbox.setText("InputBox");
inputbox.setEchoMode(Tui::ZInputBox::Password);
export_tpi(&terminal, "inputbox-password", 0, 0, 12, 3);
}
// embedded newline
{
Tui::ZInputBox inputbox(&dialog);
inputbox.setGeometry({1, 1, 10, 1});
inputbox.setText("one\ntwo");
export_tpi(&terminal, "inputbox-newline", 0, 0, 12, 3);
}
}
|