StandardWindow::StandardWindow() :IFrameWindow( "NewShow: A C++ Dive class sample.", 1001 ) { pDiveWindow = new DiveWindow( 1002, this, this ); setClient( pDiveWindow ); sizeTo( frameRectFor(IRectangle(pDiveWindow->getSize().width(), pDiveWindow->getSize().height())).size() ); setFocus(); show(); sendEvent( IEvent(pDiveWindow, WM_VRNENABLED, 0, 0) ); }
//************************************************************************** // AServerWindow :: AServerWindow - Constructor for our main window //************************************************************************** AServerWindow :: AServerWindow(unsigned long windowId) : IFrameWindow (windowId), //Call IFrameWindow constructor statusLine(WND_STATUS, this, this), //Create status line todoStatus(WND_TODOSTA, &statusLine,//Create todo status line &statusLine), workStatus(WND_WORKSTA, &statusLine,//Create work status line &statusLine), doneStatus(WND_DONESTA, &statusLine,//Create done status line &statusLine), cArea(WND_CAREA, this, this), //Create Client Area dArea(WND_DAREA, &cArea, this), //Create Data Area Cannvas todoList(WND_TODO, &dArea, this, //Create todo list IRectangle(), // (IListBox::defaultStyle() // Use default style with | IListBox::noAdjustPosition)), // Canvas controling size workList(WND_WORK, &dArea, this, //Create working list IRectangle(), // (IListBox::defaultStyle() // | IListBox::noAdjustPosition)), // Allow the Canvas to control size doneList(WND_DONE, &dArea, this, //Create done list IRectangle(), // (IListBox::defaultStyle() // Use default style with | IListBox::noAdjustPosition)), // Canvas controling size mle(WND_MLE, &cArea, &cArea), //Create MLE to display DDE activities infoArea(this), //Create Information Area resLib(), //Resource library server(resLib.loadString( MI_APP ), //Create DDE Server (application name, resLib.loadString( MI_TOPIC ), // topic name, window) this ) { hot=0; //Hot link not active cArea.setOrientation( //Set the orientation ISplitCanvas::horizontalSplit); // to horizontal setIcon( id() ); //Set the icon setClient(&cArea); //Set Client to cArea addExtension(&statusLine, //Add Status Line above the client IFrameWindow::aboveClient, // and specify the height IFont(&statusLine).maxCharHeight());// and specify height setExtensionSize(&infoArea, // IFont(&infoArea).maxCharHeight());//and specify height infoArea.setDefaultText(STR_HOTNO); //Set information area text from RC sizeTo(ISize(600,400)); //Set the size of main window moreTodo(); //Initialize the todo list updateStatus(); //Update status line setFocus(); //Set Focus to main window show(); } /* end AServerWindow :: AServerWindow(...) */
NextLevelDialog(GameControl* game) : Dialog("BRAVO!!!",Event::NOP,Event::MENU), m_game(game) { rightControl()->text("<--"); char buf[32]; const GameStats& stats = m_game->stats(); int time = (stats.endTime - stats.startTime)/1000; int h = time/60/60; int m = time/60 - h*60; int s = time - m*60; Box *vbox = new VBox(); vbox->add(new Spacer(),10,1); if (h > 0) { sprintf(buf,"time: %dh %dm %ds",m,h,s); } else if (m > 0) { int m = time/60/1000; sprintf(buf,"time: %dm %ds",m,s); } else { sprintf(buf,"time: %ds",s); } vbox->add(new Label(buf),20,0); sprintf(buf,"%d stroke%s",stats.strokeCount,stats.strokeCount==1?"":"s"); vbox->add(new Label(buf),20,0); if (stats.pausedStrokes) { sprintf(buf," (%d while paused)",stats.pausedStrokes); vbox->add(new Label(buf),20,0); } sprintf(buf,"%d undo%s",stats.undoCount,stats.undoCount==1?"":"s"); vbox->add(new Label(buf),20,0); vbox->add(new Spacer(),10,1); Box *hbox2 = new HBox(); hbox2->add(new Spacer(),20,0); hbox2->add(new Button("review",Event(Event::REPLAY,game->m_level)),BUTTON_WIDTH,0); hbox2->add(new Spacer(),1,1); hbox2->add(new Button("again",Event::RESET),BUTTON_WIDTH,0); hbox2->add(new Spacer(),1,1); hbox2->add(new Button("next",Event::NEXT),BUTTON_WIDTH,0); hbox2->add(new Spacer(),20,0); vbox->add(hbox2,BUTTON_HEIGHT,0); vbox->add(new Spacer(),10,0); content()->add(vbox,0,0); m_targetPos = Vec2( 150, 70); sizeTo(Vec2(500,240)); }
ColourDialog( int num, const int* cols ) : MenuDialog(this,"pen"), m_colours(cols) { m_columns = 4; m_buttonDim = Vec2(BUTTON_HEIGHT, BUTTON_HEIGHT); for (int i=0; i<num; i++) { switch(i) { case 0: addItem( MenuItem("O",Event(Event::SELECT,1,i)) ); break; case 1: addItem( MenuItem("X",Event(Event::SELECT,1,i)) ); break; default: addItem( MenuItem("/",Event(Event::SELECT,1,i)) ); break; } } Vec2 size = m_buttonDim*5; sizeTo(size); m_targetPos = Vec2(SCREEN_WIDTH - m_pos.width(),0); }
/****************************************************************************** * Class AListBox :: AListBox - constructor for main window * * * * Define itself as an IFrame Window * * Create a listbox. * * Create the trace listbox. * * Create the info area, the status line, and the menu bar. * ******************************************************************************/ AListBox :: AListBox(unsigned long windowId) : IFrameWindow( IFrameWindow::defaultStyle() | IFrameWindow::accelerator | IFrameWindow::minimizedIcon, windowId), listbox(WND_HELLO, this, this, IRectangle(), //Create listbox (IListBox::defaultStyle() | IListBox::multipleSelect) & ~IListBox::horizontalScroll), listbox2(WND_HELLO, this, this, IRectangle(), //Create trace listbox IListBox::defaultStyle() & ~IListBox::horizontalScroll), infoArea(this), statusLine(WND_STATUS, this, this), menuBar(WND_MAIN, this), commandhandler(this,&listbox) { /*----------------------------------------------------------------------------| | Set the alignment of the status line and add it to the frame extension. | -----------------------------------------------------------------------------*/ statusLine.setAlignment( IStaticText::centerLeft); addExtension(&statusLine, IFrameWindow::aboveClient, 30UL); setStatus(); /*----------------------------------------------------------------------------| | Add the listbox as an extension 1/2 the size of the client and set the | | trace listbox as the rest of the client space. | -----------------------------------------------------------------------------*/ addExtension(&listbox, IFrameWindow::leftOfClient, 0.5); setClient(&listbox2); commandhandler.handleEventsFor(this); /*----------------------------------------------------------------------------| | Set the size of the main window, update the main window, set focus and then | | show the main window. | -----------------------------------------------------------------------------*/ sizeTo(ISize(400,300)); update(); setFocus(); show(); } /* end AListBox :: AListBox(...) */
/////F AHelloWindow5 @ @ instance public AHelloWindow5 :: AHelloWindow5(unsigned long windowId) : IFrameWindow ( IFrameWindow::defaultStyle() | IFrameWindow::minimizedIcon | IFrameWindow::menuBar | IFrameWindow::accelerator, windowId) { setupClient(); setupStatusArea(); setupInfoArea(); setupButtons(); setupMenuBar(); setupHelp(); sizeTo(ISize(400,300)); setFocus(); show(); }
EditDoneDialog(GameControl* game) : Dialog("Exit Editor",Event::NOP,Event::CLOSE), m_game(game) { Box *vbox = new VBox(); vbox->add(new Spacer(),10,1); vbox->add(new Label("Save level?"),20,0); vbox->add(new Spacer(),10,1); Box *hbox2 = new HBox(); hbox2->add(new Spacer(),20,0); hbox2->add(new Button("cancel",Event::CLOSE),BUTTON_WIDTH,0); hbox2->add(new Spacer(),1,1); hbox2->add(new Button("exit",Event::EDIT),BUTTON_WIDTH,0); hbox2->add(new Spacer(),1,1); hbox2->add(new Button("save",Event::SAVE),BUTTON_WIDTH,0); hbox2->add(new Spacer(),20,0); vbox->add(hbox2,BUTTON_HEIGHT,0); vbox->add(new Spacer(),10,0); content()->add(vbox,0,0); m_targetPos = Vec2( 150, 70); sizeTo(Vec2(500,240)); }
void BasicScreenObject::sizeTo(float _width, float _height, float _time, float (ofxTransitions::*ease) (float,float,float,float)) { sizeTo(_width, _height, _time, ease, 0); }
void BasicScreenObject::sizeTo(float _width, float _height, float _time){ sizeTo(_width, _height, _time, &ofxTransitions::easeInOutCubic, 0); }