Last active
December 25, 2015 16:19
-
-
Save mvidner/7004734 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/libyui/libyui/issues/61 | |
// g++ -std=c++11 $(pkg-config --cflags --libs libyui) -o a.out libyui-61-deletechildren.cc | |
#include "YUI.h" | |
#include "YWidgetFactory.h" | |
#include "YDialog.h" | |
#include "YLayoutBox.h" | |
#include "YSpacing.h" | |
#include "YLabel.h" | |
#include "YPushButton.h" | |
#include "YEvent.h" | |
#include "YDialogSpy.h" | |
#include "YReplacePoint.h" | |
int main(int argc, char **argv) | |
{ | |
/***************************************************************************************/ | |
auto wf = YUI::widgetFactory(); | |
auto mainDialog = wf->createMainDialog(); | |
auto rp = wf->createReplacePoint(mainDialog); | |
auto mainVBox = wf->createVBox(rp); | |
auto mainLabel = wf->createLabel(mainVBox, "Hello world!"); | |
wf->createVSpacing(mainVBox); | |
auto mainButton = wf->createPushButton(mainVBox, "Close"); | |
mainDialog->pollEvent(); | |
YDialogSpy::showDialogSpy(); | |
while (true) { | |
auto event = mainDialog->waitForEvent(); | |
if (event) | |
if (event->eventType() == YEvent::CancelEvent || event->widget() == mainButton) | |
break; | |
} | |
rp->deleteChildren(); | |
/*****************************************************************************************/ | |
mainVBox = wf->createVBox(rp); | |
mainLabel = wf->createLabel(mainVBox, "Hello world #2!"); | |
wf->createVSpacing(mainVBox); | |
mainButton = wf->createPushButton(mainVBox, "Close #2"); | |
rp->showChild(); | |
mainDialog->recalcLayout(); | |
mainDialog->pollEvent(); | |
YDialogSpy::showDialogSpy(); | |
while (true) { | |
auto event = mainDialog->waitForEvent(); | |
if (event) | |
if (event->eventType() == YEvent::CancelEvent || event->widget() == mainButton) | |
break; | |
} | |
mainDialog->destroy(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment