Example #1
0
MainPage::MainPage( const WEnvironment& env)    
    : WApplication(env)
{

    setTitle("Main page");

    this->useStyleSheet(AppPaths::cssFile);

    // Remove this 2 lines???
    userList = new WContainerWidget(root());
    userList->setStyleClass("list");


    // Remove it?
    WContainerWidget *t = new WContainerWidget();
    t->setInline(false);
    t->show();
    t->setStyleClass("big");    

    // Remove it?
    WStackedWidget *main = new WStackedWidget(root());
    main->setStyleClass("");    

    root()->removeWidget(main);




    Wt::WHBoxLayout *loginLayout = new Wt::WHBoxLayout(root());
    LoginWidget *login = new LoginWidget();
    loginLayout->addWidget(login);
    login->loggedIn().connect(this,&MainPage::setMainPage);
}
Example #2
0
void AuthWidget::createOAuthLoginView()
{
  if (!model_->oAuth().empty()) {
    setCondition("if:oauth", true);

    WContainerWidget *icons = new WContainerWidget();
    icons->setInline(isInline());

    for (unsigned i = 0; i < model_->oAuth().size(); ++i) {
      const OAuthService *auth = model_->oAuth()[i];

      WImage *w = new WImage("css/oauth-" + auth->name() + ".png", icons);
      w->setToolTip(auth->description());
      w->setStyleClass("Wt-auth-icon");
      w->setVerticalAlignment(AlignMiddle);

      OAuthProcess *const process 
	= auth->createProcess(auth->authenticationScope());
#ifndef WT_TARGET_JAVA
      w->clicked().connect(process, &OAuthProcess::startAuthenticate);
#else
      process->connectStartAuthenticate(w->clicked());
#endif

      process->authenticated().connect
	(boost::bind(&AuthWidget::oAuthDone, this, process, _1));

      WObject::addChild(process);
    }

    bindWidget("icons", icons);
  }
}
Example #3
0
void WebGLDemo::main(){


    glContainer_ = new WContainerWidget(root());
    glContainer_->resize(500, 500);
    glContainer_->setInline(false);

    root()->addWidget(new WBreak());
    root()->addWidget(new WText("Rotate with mouse and zoom with scroll"));
    root()->addWidget(new WBreak());

    root()->addWidget(new WText(" "));
    root()->addWidget(new WBreak());
    root()->addWidget(new WText("LIGHT DIRECTION"));
    root()->addWidget(new WBreak());
    root()->addWidget(new WText("X : "));
    lightDirX = new WLineEdit("-1.0",root());
    root()->addWidget(new WText(" Y : "));
    lightDirY = new WLineEdit("-1.0",root());
    root()->addWidget(new WText(" Z : "));
    lightDirZ = new WLineEdit("-1.0",root());

    root()->addWidget(new WBreak());
    root()->addWidget(new WText(" "));
    root()->addWidget(new WBreak());
    root()->addWidget(new WText("LIGHT COLOR"));
    root()->addWidget(new WBreak());

    root()->addWidget(new WText("R : "));
    lightColR = new WLineEdit("0.8",root());
    root()->addWidget(new WText(" G : "));
    lightColG = new WLineEdit("0.8",root());
    root()->addWidget(new WText(" B : "));
    lightColB = new WLineEdit("0.8",root());

    root()->addWidget(new WBreak());
    root()->addWidget(new WText(" "));
    root()->addWidget(new WBreak());
    root()->addWidget(new WText("AMBIENT LIGHT COLOR"));
    root()->addWidget(new WBreak());
    root()->addWidget(new WText("R : "));
    ambLightColR = new WLineEdit("0.2",root());
    root()->addWidget(new WText(" G : "));
    ambLightColG = new WLineEdit("0.2",root());
    root()->addWidget(new WText(" B : "));
    ambLightColB = new WLineEdit("0.2",root());




    lightDirX->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
    lightDirY->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
    lightDirZ->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);

    lightColR->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
    lightColG->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
    lightColB->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);

    ambLightColR->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
    ambLightColG->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
    ambLightColB->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);

    updateShaders();

    this->globalKeyWentDown().connect(this,&WebGLDemo::eventKeyWentDown);

}