/* * This is a simple example that defines the three browser goodies at the top * of a month view: * * 1. StringEditor to type in month name * 2. An up button to go to prev month * 3. A down button to go to next month */ #include #include #include #include #include #include #include #include #include class UpButton : public PushButton { public: UpButton(); protected: virtual void Press(); }; UpButton::UpButton() : PushButton(" Up ", new ButtonState(), 1) {} void UpButton::Press() { printf("Hi, I'm the Up button :)\n"); } class DownButton : public PushButton { public: DownButton(); protected: virtual void Press(); }; DownButton::DownButton() : PushButton(" Down ", new ButtonState(), 1) {} void DownButton::Press() { printf("Hi, I'm the Down button :)\n"); } class MonthNameEditor : public StringEditor { public: MonthNameEditor(char* monthstr); }; MonthNameEditor::MonthNameEditor(char* monthstr) : StringEditor(new ButtonState(), monthstr) {} /* * Quick and dirty to build the View only. */ main(int argc, char** argv) { World* world = new World("Month Goodies", argc, argv); HBox* allguts = new HBox(); VBox* buttons = new VBox(); buttons->Align(Center); buttons->Insert(new UpButton()); buttons->Insert(new VGlue(5)); buttons->Insert(new DownButton()); allguts->Align(Center); allguts->Insert(new HGlue(5)); allguts->Insert(new MonthNameEditor("Jan 1995 ")); allguts->Insert(new HGlue(5)); allguts->Insert(buttons); allguts->Insert(new HGlue(5)); world->InsertApplication( new Tray( new VBox( new VGlue(5), allguts, new VGlue(5) ) ) ); world->Run(); }