00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "Select.h"
00024
00025
00026 namespace Cgi {
00027
00028
00029 Select::Select(const std::string& name) : Styled(), m_name(name)
00030 {
00031 }
00032
00033
00034 Select::~Select()
00035 {
00036 }
00037
00038
00039 void Select::Add(const std::string& value)
00040 {
00041 m_values.push_back(new Value(*this, value));
00042 }
00043
00044
00045 void Select::Add(long value,const std::string& description)
00046 {
00047 m_values.push_back(new Multi(*this, value, description));
00048 }
00049
00050
00051 void Select::Print()
00052 {
00053 if (GetStyle().size())
00054 {
00055 printf("<select style='%s' name='%s'>", GetStyle().c_str(), m_name.c_str());
00056 }
00057 else
00058 {
00059 printf("<select name='%s'>", m_name.c_str());
00060 }
00061 for (std::list<Value *>::iterator it = m_values.begin(); it != m_values.end(); it++)
00062 {
00063 Value *p = *it;
00064 p -> Print();
00065 }
00066 printf("</select>");
00067 }
00068
00069
00070 }