// Panner Example #include <ivplus/bitmap.h> #include <ivplus/border.h> #include <ivplus/box.h> #include <ivplus/glue.h> #include <ivplus/frame.h> #include <ivplus/message.h> #include <ivplus/panner.h> #include <ivplus/viewport.h> #include <ivplus/world.h> #include <string.h> #include "./bitmaps/escherknot" int main(int argc, char **argv) { // Create the world to get the connection with the display. World* world = new World("MyApp", argc, argv); // Create a bitmap from the escherknot bitmap. Bitmap* bm = new Bitmap(escherknot_bits, escherknot_width, escherknot_height); // Use this bitmap in a message. Message* msg = new Message(bm); // Create a viewport and display a bitmap inside the viewport. // Place the message component at the center of the viewport. Viewport* viewport = new Viewport(msg, Center); // Create a panner of width = 0 (default for reasonable size) and // attach it with the viewport just created. Panner* panner = new Panner(viewport); // Compose interior with boxes, using viewport, glue, and the panner. VBox* vbox = new VBox(new VGlue(4, vfil, vfil), panner, new VGlue(4, vfil, vfil)); // Since the Slider portion of the Panner resizes it’s self by calling // Change() when the viewport’s perspective changes, set propagate false // on the box containing the panner to prevent the application from begin // resized. vbox->Propagate(false); HBox* box = new HBox(viewport, new VBorder(), new HGlue(4, hfil, hfil), vbox, new HGlue(4, hfil, hfil)); // Map the window. world->InsertApplication(new Frame(box, 1, BevelOut)); // Enter the event loop. world->Run(); return 0; }
panner.h panner.C