// Slider Example #include <ivplus/box.h> #include <ivplus/frame.h> #include <ivplus/glue.h> #include <ivplus/panner.h> #include <ivplus/shape.h> #include <ivplus/textbuffer.h> #include <ivplus/mltexteditor.h> #include <ivplus/world.h> #include <string.h> static const char* sample = "Slider Example Line1\n This is Line 2\nThis is Line 3\nThis is Line 4\n IntCoord top)" This is Line 5\nThis is Line 6\nThis is Line 7\n IntCoord top)" This is Line 8\nThis is Line 9\nThis is Line 10\n IntCoord top)" This is Line 11\nThis is Line 12\nThis is Line 13\n IntCoord top)" This is a very loooooooooooooooooooooooooooooooong line line Line 14"; int main(int argc, char **argv) { const int BuffSize = 512; char* buf = new char[BuffSize]; // Create the world to get the connection with the display. World* world = new World("MyApp", argc, argv); // Create a text editor to give Slider a perspective strcpy(buf, sample); TextBuffer* tbuf= new TextBuffer(buf, strlen(buf), BuffSize); // Create a text editor with 10 rows, 25 cols, and tabsize=8. MLTextEditor* tedit = new MLTextEditor(10, 25, 8); tedit->Edit(tbuf); // Create a slider with tedit as Interactor to manipulate. Slider* slider = new Slider(tedit); // Create a new shape of width=100, height=150. Shape shape; shape.width = 100; shape.height = 150; // Set the horizontal and vertical shrinkability to 10, // horizontal and vertical stretchability to maximum. shape.Rigid(10, hfil, 10, vfil); // Set the slider’s shape to the one just created. slider->Reshape(shape); // Compose an hbox with this text editor, glue, and the slider. HBox* appbox = new HBox(tedit, new HGlue(4, 0, 0), new VBox(new VGlue,slider)); // Map the window. world->InsertApplication(new Frame(appbox, 1, BevelOut)); // Enter the event loop. world->Run(); return 0; }
panner.h panner.C