00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _MENUWEB_H
00021 #define _MENUWEB_H
00022
00023 #ifdef _WIN32
00024 #define STL_USING_VECTOR
00025 #include <stlhelper.h>
00026 #else
00027 #include <vector>
00028 #endif
00029
00030 namespace Cgi {
00031
00033
00034 enum
00035 {
00036 MENUITEM_TYPE_FORM = 1,
00037 MENUITEM_TYPE_SEPARATOR,
00038 MENUITEM_TYPE_URL,
00039 MENUITEM_TYPE_IMAGE
00040 };
00041
00042
00044
00045 enum
00046 {
00047 MENU_STYLE_FRAME_LEFT = 1,
00048 MENU_STYLE_TOP,
00049 MENU_STYLE_LEFT
00050 };
00051
00052
00054
00055 typedef struct
00056 {
00057 int num;
00058 int type;
00059 WebForm *form;
00060 std::string title;
00061 std::string url;
00062 std::string src;
00063 } MENUITEM;
00064 typedef std::vector<MENUITEM *> menuitem_v;
00065
00066
00068
00069 class MenuWeb : public Web
00070 {
00071 public:
00072 MenuWeb(int = MENU_STYLE_TOP);
00073 MenuWeb(const std::string &,const std::string &,int = MENU_STYLE_TOP);
00074 MenuWeb(int argc,char *argv[],const std::string &,const std::string &,int = MENU_STYLE_TOP);
00075 ~MenuWeb();
00076
00077 void SetMenuStyle(int);
00078
00079 const MENUITEM & AddMenuItem(WebForm *,const std::string &title);
00080 void AddMenuSeparator();
00081 void AddMenuLink(const std::string &url,const std::string &title);
00082 void AddMenuImage(const std::string &src);
00083
00084 virtual void ReadCookies();
00085 virtual void FormInput();
00086 virtual void CreateHeader();
00087 virtual void GenerateDocument();
00088
00089 std::string GetCookiename() { return m_cookiename; }
00090 void SetCookiename(const std::string &str) { m_cookiename = str; }
00091 void SetPage(int x) { m_page = x; m_bSetCookie = true; }
00092 int GetPage() { return m_page; }
00093 void SetMenuclass(const std::string &x) { m_strClass = x; }
00094
00095 void SetTheCookie();
00096
00097 private:
00098 MenuWeb(const MenuWeb& ) {}
00099 MenuWeb& operator=(const MenuWeb& ) { return *this; }
00100 int m_count;
00101 int m_style;
00102 int m_page;
00103 std::string m_cookiename;
00104 bool m_bSetCookie;
00105 menuitem_v m_items;
00106 std::string m_strClass;
00107 };
00108
00109 }
00110
00111 #endif // _MENUWEB_H