Created
August 11, 2016 20:19
-
-
Save willxinc/53b77ccb2648050cfe2d1ef72df522fc 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
#include <nanogui/nanogui.h> | |
#include <iostream> | |
using namespace nanogui; | |
using std::to_string; | |
using std::cout; | |
int main(int /* argc */, char ** /* argv */){ | |
nanogui::init(); | |
Screen *screen = new Screen(Vector2i(500, 500), "Issue Demo"); | |
Window *window = new Window(screen, "VScrollPanel"); | |
window->setLayout(new GroupLayout()); | |
window->setPosition(Vector2i(0, 0)); | |
VScrollPanel *scroll_panel = new VScrollPanel(window); | |
scroll_panel->setFixedSize(Vector2i(125, 200)); | |
Widget *popups = new Widget(scroll_panel); | |
popups->setLayout(new BoxLayout(Orientation::Vertical, Alignment::Minimum, 0, 0)); | |
for (int i = 0; i < 15; i++){ | |
PopupButton* popupButton = new PopupButton(popups, "Popup " + to_string(i)); | |
(new Button(popupButton->popup(), "Click Me!"))->setCallback([i]() { cout << "Clicked Button " << to_string(i) << "\n"; }); | |
} | |
screen->setVisible(true); | |
screen->performLayout(); | |
nanogui::mainloop(); | |
nanogui::shutdown(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment