Public Member Functions | Private Member Functions | Private Attributes

HelloApplication Class Reference

Inherits Wt::WApplication.

List of all members.

Public Member Functions

 HelloApplication (const WEnvironment &env)

Private Member Functions

void greet ()

Private Attributes

WLineEditnameEdit_
WTextgreeting_

Detailed Description

Definition at line 20 of file hello.C.


Constructor & Destructor Documentation

HelloApplication::HelloApplication ( const WEnvironment env  ) 

Definition at line 38 of file hello.C.

  : WApplication(env)
{
  setTitle("Hello world");                               // application title

  root()->addWidget(new WText("Your name, please ? "));  // show some text
  nameEdit_ = new WLineEdit(root());                     // allow text input
  nameEdit_->setFocus();                                 // give focus

  WPushButton *b = new WPushButton("Greet me.", root()); // create a button
  b->setMargin(5, Left);                                 // add 5 pixels margin

  root()->addWidget(new WBreak());                       // insert a line break

  greeting_ = new WText(root());                         // empty text

  /*
   * Connect signals with slots
   *
   * - simple Wt-way
   */
  b->clicked().connect(this, &HelloApplication::greet);

  /*
   * - using an arbitrary function object (binding values with boost::bind())
   */
  nameEdit_->enterPressed().connect
    (boost::bind(&HelloApplication::greet, this));
}


Member Function Documentation

void HelloApplication::greet (  )  [private]

Definition at line 68 of file hello.C.

{
  /*
   * Update the text, using text input into the nameEdit_ field.
   */
  greeting_->setText("Hello there, " + nameEdit_->text());
}


Member Data Documentation

Definition at line 27 of file hello.C.

Definition at line 26 of file hello.C.


The documentation for this class was generated from the following file:

Generated on Mon Nov 29 2010 08:03:14 for Wt by doxygen 1.7.1