// STEP 2 // Creation of a manager, a view, and a graphic object // Add a exit callback and a selection interactor #include #include #include static void Quit(IlvView* view, IlvAny) { delete view->getDisplay();; IlvExit(0); } static void QuitAccel(IlvManager* mgr, IlvView* view, IlvEvent& event, IlvAny userArg) { IlvDisplay* display = mgr->getDisplay(); delete display; IlvExit(0); } int main(int argc, char** argv) { // Creation of the Display IlvDisplay* display = new IlvDisplay("EvalKit1"); // Creation of the Manager IlvManager* manager = new IlvManager(display); // Creation of the first view IlvView* view = new IlvView(display, "View1", "Main View - Step 2", IlvRect(0,0,300,200)); // Attach the view to the manager manager->addView(view); // Creation of a graphic object (a filled rectangle) IlvFilledRectangle* rectangle = new IlvFilledRectangle(display, IlvRect(20,20,40,30)); // Add this object in the manager manager->addObject(rectangle); // Add a selection interactor so that the rectangle can be selected, moved, resized // and destroyed // Creation of the interactor IlvSelectInteractor* selector = new IlvSelectInteractor(manager, view); // Set the interactor on the main view // Every object displayed in this view will be selectable, moveable, resizable manager->setInteractor(selector, view); // Add an user-defined accelerator to quit the application manager->addAccelerator(QuitAccel, IlvKeyDown, 'q'); // Add an exit callback so that the exit button is valid view->setDestroyCallback(Quit); // Run the event loop IlvMainLoop(); return 0; }