CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
Button Class Reference

#include <Button.h>

Inheritance diagram for Button:
WebElement

Public Member Functions

 Button (std::string the_url, std::string top, std::string left, std::string the_requestID, std::string the_name)
 
void printHTML (xgi::Output *out)
 
 ~Button ()
 
- Public Member Functions inherited from WebElement
std::string get_pix_left ()
 
std::string get_pix_top ()
 
std::string get_url ()
 
 WebElement (std::string the_url, std::string top, std::string left)
 
virtual ~WebElement ()
 

Private Attributes

std::string name
 the name that will appear on the button More...
 
std::string requestID
 the string connected to the callback, eg "Default" More...
 

Detailed Description

This is the class that should be instantiated in case the user wants to have a button on the web page, which is connected to a function defined in your web client. Pressing this button will result in the javascript function makeRequest being called and the request "/Request?RequestID=[Your request name]" being submitted to the server.

Definition at line 18 of file Button.h.

Constructor & Destructor Documentation

Button::Button ( std::string  the_url,
std::string  top,
std::string  left,
std::string  the_requestID,
std::string  the_name 
)
inline

Definition at line 28 of file Button.h.

References name, and requestID.

29  : WebElement(the_url, top, left)
30  {
31  name = the_name;
32  requestID = the_requestID;
33  }
WebElement(std::string the_url, std::string top, std::string left)
Definition: WebElement.h:21
std::string name
the name that will appear on the button
Definition: Button.h:22
std::string requestID
the string connected to the callback, eg &quot;Default&quot;
Definition: Button.h:24
Button::~Button ( )
inline

Definition at line 35 of file Button.h.

36  {
37  }

Member Function Documentation

void Button::printHTML ( xgi::Output out)
virtual

Implements WebElement.

Definition at line 4 of file Button.cc.

References WebElement::get_pix_left(), WebElement::get_pix_top(), WebElement::get_url(), LaserDQM_cfg::input, name, position, requestID, and runtimedef::set().

5 {
6  std::string position = "position:absolute; left:" + get_pix_left() + "; top:" + get_pix_top();
7  *out << cgicc::div().set("style", position.c_str()) << std::endl;
8 
9  std::string js_command = "makeRequest('" + get_url() + "/" + "Request?RequestID=" + requestID + "', dummy)";
10  *out << cgicc::input().set("type", "button")
11  .set("value", name.c_str())
12  .set("onclick", js_command.c_str()) << std::endl;
13 
14  *out << cgicc::div() << std::endl;
15 }
std::string get_pix_left()
Definition: WebElement.h:38
std::string get_url()
Definition: WebElement.h:32
std::string name
the name that will appear on the button
Definition: Button.h:22
std::string requestID
the string connected to the callback, eg &quot;Default&quot;
Definition: Button.h:24
tuple out
Definition: dbtoconf.py:99
std::string get_pix_top()
Definition: WebElement.h:37
static int position[264][3]
Definition: ReadPGInfo.cc:509
void set(const std::string &name, int value)
set the flag, with a run-time name

Member Data Documentation

std::string Button::name
private
std::string Button::requestID
private

the string connected to the callback, eg "Default"

Definition at line 24 of file Button.h.

Referenced by Button(), and printHTML().