Esempio n. 1
0
HangmanWidget::HangmanWidget(std::wstring user, Dictionary dict,
			     WContainerWidget *parent):
   WContainerWidget(parent),
   MaxGuesses(9),
   User(user),
   Dict(dict)
{
   setContentAlignment(AlignCenter);

   Title = new WText(L"Guess the word!", this);
   Title->decorationStyle().font().setSize(WFont::XLarge);

   WordContainer = new WContainerWidget(this);
   WordContainer->setMargin(WLength(20), Top | Bottom);
   WordContainer->setContentAlignment(AlignCenter);
   WCssDecorationStyle& style = WordContainer->decorationStyle();
   style.setBorder(WBorder(WBorder::Solid));
   style.font().setFamily(WFont::Monospace, L"courier");
   style.font().setSize(WFont::XXLarge);

   StatusText = new WText(this);
   new WBreak(this);
   createHangmanImages(this);
   createAlphabet(this);
   new WBreak(this);
   NewGameButton = new WPushButton(L"New Game", this);
   NewGameButton->clicked.connect(SLOT(this, HangmanWidget::newGame));

   // prepare for first game
   newGame();
}
Esempio n. 2
0
void PrintResource::handleRequest(const Wt::Http::Request& request,
                                  Wt::Http::Response& response)
{
    //log("info")<<"PrintResource::handleRequest() "<<__LINE__;
    response.addHeader("Cache-Control", "max-age=315360000");
    response.setMimeType("text/html; charset=utf-8");
    std::ostringstream htmlStream;// = std::cout;
    htmlStream << "";

    //log("info")<<m_content->find("order_form");
    if(WContainerWidget *form = dynamic_cast<WContainerWidget*>(m_content->find("order_form")))
    {
        for(int i=0;i < form->count()-1;i++)
        {
            WWidget *item = form->widget(i);
            if(item->id() == "comments")
            {
                item->decorationStyle().setBorder(WBorder());
            }else
                item->setHidden(true);
        }
    }

    response.out() <<"<link href=\"http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css\" type=\"text/css\" rel=\"stylesheet\">"<<std::endl;
    response.out() <<"<link href=\"http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap-theme.min.css\" type=\"text/css\" rel=\"stylesheet\">"<<std::endl;
    response.out() << "<script src=\"/css/ie_console.js\"></script>";

    response.out() << ""
    "<script type=\"text/javascript\">\n"
    "        window.setTimeout(function () {\n"
    "            window.print();\n"
    "        }, 1000);\n"
    "</script>\n"<<std::endl;

    m_content->htmlText(response.out());
    //log("info")<<"PrintResource::handleRequest() "<<__LINE__;

/*
    response.out() << ""
    "<script type=\"text/javascript\">\n"
    "    (function() { \n"
    "        window.setTimeout(function () {\n"
    "            window.print();\n"
    "        }, 1500);\n"
    "    }); \n"
    "</script>\n"<<std::endl;

*/
    //m_content->htmlText(htmlStream);
    //std::string htmlStr= "";
    //htmlStr << htmlStream;
    //std::cout <<htmlStream<<std::endl;
    //renderer.render(WString().fromUTF8(htmlStream.str()));

    response.out() << WString().fromUTF8(htmlStream.str()) << std::endl;
}
Esempio n. 3
0
SoundManager::SoundManager()
  : WMediaPlayer(MediaType::Audio)
{
  resize(0, 0);
  setAttributeValue("style", "overflow: hidden");

  controlsWidget()->hide();
  decorationStyle().setBorder(WBorder());

  WStringStream ss;
  ss <<
    "function() { "
    """var s = " << jsRef() << ", l = s.getAttribute('loops');"
    """if (l && l != '0') {"
    ""   "s.setAttribute('loops', l - 1);"
    ""   << jsPlayerRef() << ".jPlayer('play');"
    """}"
    "}";

  ended().connect(ss.str());
  ended().setNotExposed();
}