CMS 3D CMS Logo

Public Member Functions

Navigator Class Reference

#include <Navigator.h>

Inheritance diagram for Navigator:
WebElement

List of all members.

Public Member Functions

 Navigator (std::string the_url, std::string top, std::string left)
 position
void printHTML (xgi::Output *out)
void printSelectHTML (xgi::Output *out, std::string name, std::string onchange)
 ~Navigator ()

Detailed Description

This is the class that should be instantiated in case the user wants to have a select menu, the elements of which, submit a request when clicked on.

Definition at line 14 of file Navigator.h.


Constructor & Destructor Documentation

Navigator::Navigator ( std::string  the_url,
std::string  top,
std::string  left 
) [inline]

position

Parameters:
topurl of the application

Definition at line 20 of file Navigator.h.

    : WebElement(the_url, top, left)
    {
    }
Navigator::~Navigator ( ) [inline]

Definition at line 25 of file Navigator.h.

    {
    }

Member Function Documentation

void Navigator::printHTML ( xgi::Output *  out) [virtual]

Implements WebElement.

Definition at line 4 of file Navigator.cc.

References WebElement::get_pix_left(), WebElement::get_pix_top(), position, printSelectHTML(), and asciidump::table.

{
  // std::string js_command = "makeNavigatorRequest('" + get_url() + "')"; 
  std::string js_command = "makeNavigatorRequest()"; 
  std::string position = "position:absolute; left:" + get_pix_left() + "; top:" + get_pix_top();

  *out << cgicc::div().set("style", position.c_str()) << std::endl;
  *out << cgicc::form().set("name", "NavigatorForm").set("id", "NavigatorForm") << std::endl;
  *out << cgicc::table() << std::endl;

  printSelectHTML(out, "Open",        js_command);
  printSelectHTML(out, "Subscribe",   js_command);
  printSelectHTML(out, "Unsubscribe", js_command);

  *out << cgicc::table() << std::endl; 
  *out << cgicc::form()  << std::endl;
  *out << cgicc::div()   << std::endl;
}
void Navigator::printSelectHTML ( xgi::Output *  out,
std::string  name,
std::string  onchange 
)

Definition at line 23 of file Navigator.cc.

References benchmark_cfg::select.

Referenced by printHTML().

{
  *out << cgicc::tr() << std::endl
       << cgicc::td() << std::endl
       << name << ":" << std::endl
       << cgicc::td() << std::endl;

  *out << cgicc::td() << std::endl;

  // if this is the "Open" menu, it should contain a "top" option
  if (name == "Open") 
    {
      *out << cgicc::select().set("name", name).set("id", name).set("onchange", onchange) << std::endl; 
      *out << cgicc::option().set("value", "").set("selected") << cgicc::option() << std::endl;
      *out << cgicc::option().set("value", "top") << "top" << cgicc::option() << std::endl;
      *out << cgicc::select() << std::endl;
    }
  else if (name != "Open")
    {
      *out << cgicc::select().set("name", name).set("id", name).set("onchange", onchange) << std::endl; 
      *out << cgicc::option().set("value", "").set("selected") << cgicc::option() << std::endl;
      *out << cgicc::select() << std::endl;
   }

  *out << cgicc::td() << std::endl;
  
  *out << cgicc::tr() << std::endl;
}