#include <ilviews/gadgets/button.h> #include <ilviews/gadgets/gadcont.h> void Quit(IlvGraphic*, IlAny arg) { IlvDisplay* display = (IlvDisplay*)arg; delete display; IlvExit(0); } int main(int argc, char* argv[]) { // Create the display. IlvDisplay* display = new IlvDisplay("Hello", "", argc, argv); if(!display) return 0; if(display->isBad()){ delete display; return 1; } // Create the container. IlvGadgetContainer* cont = new IlvGadgetContainer(display, "Hello", "Hello", IlvRect(0,0,100,100)); cont->moveToScreen(IlvCenter); // Add the button. IlvButton* button = new IlvButton(display, IlvPoint(30, 30), "Click Me !"); button->addCallback(Quit, display); cont->addObject(button); // Show the container and run the event loop. cont->show(); IlvMainLoop(); return 0; } |