AdvisorsWindow::AdvisorsWindow( Widget* parent, int id ) : Widget( parent, id, Rect( Point(0, 0), parent->getSize() ) ), _d( new Impl ) { // use some clipping to remove the right and bottom areas _d->background.reset( Picture::create( getSize() ) ); _d->advisorPanel = 0; Picture& backgr = Picture::load( "senate", 1 ); _d->background->draw( backgr, Rect( Point( 0, 0), backgr.getSize() ), Rect( Point( 0,0), getSize() ) ); Point tabButtonPos( (getWidth() - 636) / 2, getHeight() / 2 + 192); _d->background->draw( Picture::load( ResourceGroup::menuMiddleIcons, 14 ), tabButtonPos.getX(), tabButtonPos.getY() ); addButton( ADV_EMPLOYERS, 255 ); addButton( ADV_LEGION, 256 ); addButton( ADV_EMPIRE, 257 ); addButton( ADV_RATINGS, 258 ); addButton( ADV_TRADING, 259 ); addButton( ADV_POPULATION, 260 ); addButton( ADV_HEALTH, 261 ); addButton( ADV_EDUCATION, 262 ); addButton( ADV_ENTERTAINMENT, 263 ); addButton( ADV_RELIGION, 264 ); addButton( ADV_FINANCE, 265 ); addButton( ADV_MAIN, 266 ); PushButton* btn = addButton( ADV_COUNT, 609 ); btn->setIsPushButton( false ); CONNECT( btn, onClicked(), this, AdvisorsWindow::deleteLater ); }
PushButton* AdvisorsWindow::addButton( const int pos, const int picId ) { Point tabButtonPos( (getWidth() - 636) / 2 + 10, getHeight() / 2 + 192 + 10); PushButton* btn = new TexturedButton( this, tabButtonPos + Point( 48, 0 ) * pos, Size( 40 ), pos, picId, picId, picId + 13 ); btn->setIsPushButton( true ); return btn; }