/* * This file illustrates how to bring up a top-level interactor window in the * world, followed by a second top-level interactor placed relative to the * first, where placement of the first window is selected by the user via * mouse click. */ #include #include #include main() { World* w = new World(); Message* m1 = new Message("Window 1"); Message* m2 = new Message("Window 2"); Coord x,y; /* * Insert the first message as a top-level interactor. With only one * parameter, World::InsertApplication will prompt the user for placement * of the window in which the top-level interactor will appear. */ w->InsertApplication(m1); /* * Get the x,y coorinate position of the first window, relative to the * lower left corner of the screen. Interactor::GetRelative takes * call-by-reference x,y coordinate parameters. Note that these parameters * should be intialized to 0 before calling. */ x = 0; y = 0; m1->GetRelative(x, y); /* * Insert the second message as a top-level interactor, below the first * window. With three or four parameters, World::InsertApplication places * the window at the x,y coordinate position specified in the 2nd and 3rd * parameters, where the position is the lower left corner of the window. * The 4th parameter specfies the alignment relative to the overall screen. * The default alignment is BottomLeft. To place a window below another * default-aligned window, use an alignment of TopLeft as illustrated * below. */ w->InsertApplication(m2, x, y - m1->GetShape()->height, TopLeft); w->Run(); }