#include <Button.h>
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 () | |
Private Attributes | |
std::string | name |
the name that will appear on the button | |
std::string | requestID |
the string connected to the callback, eg "Default" |
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.
Button::Button | ( | std::string | the_url, |
std::string | top, | ||
std::string | left, | ||
std::string | the_requestID, | ||
std::string | the_name | ||
) | [inline] |
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, and requestID.
{ std::string position = "position:absolute; left:" + get_pix_left() + "; top:" + get_pix_top(); *out << cgicc::div().set("style", position.c_str()) << std::endl; std::string js_command = "makeRequest('" + get_url() + "/" + "Request?RequestID=" + requestID + "', dummy)"; *out << cgicc::input().set("type", "button") .set("value", name.c_str()) .set("onclick", js_command.c_str()) << std::endl; *out << cgicc::div() << std::endl; }
std::string Button::name [private] |
the name that will appear on the button
Definition at line 22 of file Button.h.
Referenced by Button(), and printHTML().
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().