// HTML_Input.cpp: implementation of the HTML_Input class. // ////////////////////////////////////////////////////////////////////// #include "HTML_all.h" #include "HTML_Input.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// HTML_Input::HTML_Input() { setChecked(false); setSelectOnFocus(false); } HTML_Input::~HTML_Input() { } HTML_Input* HTML_Input::setChecked(bool x) { checked = x; return(this); } HTML_Input* HTML_Input::setSize(char* x) { size = x; return(this); } HTML_Input* HTML_Input::setType(char* x) { type = x; return(this); } HTML_Input* HTML_Input::setValue(char* x) { value = x; return(this); } HTML_Input* HTML_Input::setValue(const char* x) { value = x; return(this); } HTML_Input* HTML_Input::setTabindex(char* x) { tabindex = x; return(this); } bool HTML_Input::getChecked() { return(checked); } const char* HTML_Input::getSize() { return(size.c_str()); } const char* HTML_Input::getType() { return(type.c_str()); } const char* HTML_Input::getValue() { return(value.c_str()); } const char* HTML_Input::getTabindex() { return(tabindex.c_str()); } string& HTML_Input::printString() { //print opening tag with options and new line buffer = "\n"); printStringNested(); return(buffer); } HTML_Element* HTML_Input::printOptions() { if(name.size() != 0) buffer.append(" name=\"" + name + "\""); if(type.size() != 0) buffer.append(" type=\"" + type + "\""); if(tabindex.size() != 0) buffer.append(" tabindex=\"" + tabindex + "\""); if(size.size() != 0) buffer.append(" size=\"" + size + "\""); if(value.size() != 0) buffer.append(" value=\"" + value + "\""); if(checked) buffer.append(" checked"); if(selectOnFocus && name.size() != 0) { buffer.append(" onfocus=\""); buffer.append(name); buffer.append(".select()\""); } return(this); } HTML_Input* HTML_Input::setName(char * x) { name = x; return(this); } HTML_Input* HTML_Input::setName(const char * x) { name = x; return(this); } HTML_Input* HTML_Input::setNameAndValue(char* n, char* v) { setName(n); setValue(v); return(this); } HTML_Input* HTML_Input::setNameAndValue(const char* n, const char* v) { setName(n); setValue(v); return(this); } HTML_Input* HTML_Input::setSelectOnFocus(bool x) { selectOnFocus = x; return(this); } bool HTML_Input::getSelectOnFocus() { return(selectOnFocus); }