[Lldb-commits] [PATCH] D104395: [LLDB][GUI] Add initial forms support
Omar Emara via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 16 09:21:32 PDT 2021
OmarEmaraDev added a comment.
Herald added a subscriber: JDevlieghere.
An example form:
F17429353: 20210616-174753.mp4 <https://reviews.llvm.org/F17429353>
class TestFormDelegate : public FormDelegate {
public:
TestFormDelegate() {
m_path_field = AddTextField("Path", 20, Point(4, 2), "/tmp/a.out");
m_number_field = AddIntegerField("Number", 20, Point(4, 5), 5);
m_bool_field = AddBooleanField("Boolean", Point(5, 8), true);
std::vector<std::string> choices;
choices.push_back(std::string("Choice 1"));
choices.push_back(std::string("Choice 2"));
choices.push_back(std::string("Choice 3"));
choices.push_back(std::string("Choice 4"));
choices.push_back(std::string("Choice 5"));
m_choices_field = AddChoicesField("Choices", 20, 5, Point(30, 2), choices);
}
bool FormDelegateSubmit() override {
std::string path = m_path_field->GetText();
int number = m_number_field->GetInteger();
bool boolean = m_bool_field->GetBoolean();
// Do something with the data.
if (everything_is_correct)
return true;
if (there_is_an_error) {
m_has_error = true;
m_error =
std::string("An error occured! Check the validity of the inputs.");
return false;
}
}
protected:
TextFieldDelegate *m_path_field;
IntegerFieldDelegate *m_number_field;
BooleanFieldDelegate *m_bool_field;
ChoicesFieldDelegate *m_choices_field;
};
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104395/new/
https://reviews.llvm.org/D104395
More information about the lldb-commits
mailing list