📄 jsmenu.hpp
字号:
const string& action = kEmptyStr, ///< JS code const string& color = kEmptyStr, const string& mouseover = kEmptyStr, ///< JS code const string& mouseout = kEmptyStr); ///< JS code void AddItem(const char* title, ///< Text or HTML-code const string& action = kEmptyStr, ///< JS code const string& color = kEmptyStr, const string& mouseover = kEmptyStr, ///< JS code const string& mouseout = kEmptyStr); ///< JS code /// NOTE: The "node" will be convert to a string inside function, so /// the node's Print() method must not change a node structure. void AddItem(CNCBINode& node, const string& action = kEmptyStr, // JS code const string& color = kEmptyStr, const string& mouseover = kEmptyStr, // JS code const string& mouseout = kEmptyStr); // JS code /// Add item's separator. /// /// NOTE: parameter 'text' have effect only for eKurdinKC menu type. void AddSeparator(const string& text = kEmptyStr); /// Set menu attribute. void SetAttribute(EHTML_PM_Attribute attribute, const string& value); /// Get attribute name. string GetAttributeName(EHTML_PM_Attribute attribute) const; static string GetAttributeName(EHTML_PM_Attribute attribute, EType type); /// Get attribute value. string GetAttributeValue(EHTML_PM_Attribute attribute) const; /// Set global menu attribute. /// NOTE: Works only with eKurdinConf menu type. static void SetAttributeGlobal(EHTML_PM_Attribute attribute, const string& value); /// Get JavaScript code for menu call. string ShowMenu(void) const; /// Get JavaScript code for menu hide. string HideMenu(void) const; /// Use specified menu configuration (for eKurdinConf only). /// NOTE: All attributes stated by SetAttribute() will be ignored. void UseConfig(const string& name); void DisableLocalConfig(bool disable = true); /// Get HTML code for inserting into the end of the HEAD and BODY blocks. /// If "menu_lib_url" is not defined, then use default URL. /// NOTE: Parameters "use_dyn_menu" have effect only for eSmith menu static string GetCodeHead(EType type = eSmith, const string& menu_lib_url = kEmptyStr); static string GetCodeBody(EType type = eSmith, bool use_dyn_menu = false); /// Get string with JavaScript code for menu items string GetCodeItems(void) const;private: /// Print menu. virtual CNcbiOstream& PrintBegin(CNcbiOstream& out, TMode mode); /// Menu item type. struct SItem { /// Constructor for menu item. SItem(const string& title, const string& action, const string& color, const string& mouseover, const string& mouseout); /// Constructor for separator. SItem(void); string title; ///< Menu item title. string action; ///< JS action on press item. string color; ///< ? (not used in JSMenu script). string mouseover; ///< JS action on mouse over event for item. string mouseout; ///< JS action on mouse out event for item. }; typedef list<SItem> TItems; /// Get pointer to global attributes. static TAttributes* GetGlobalAttributesPtr(void);private: string m_Name; ///< Menu name EType m_Type; ///< Menu type TItems m_Items; ///< Menu items TAttributes m_Attrs; ///< Menu attributes // Name of local configuration for eKurdinConf menu type. string m_ConfigName; // Enable/disable local configuration for current menu. bool m_DisableLocalConfig; };//=============================================================================//// Inline////=============================================================================inline string CHTMLPopupMenu::GetName(void) const{ return m_Name;}inline CHTMLPopupMenu::EType CHTMLPopupMenu::GetType(void) const{ return m_Type;}inline void CHTMLPopupMenu::UseConfig(const string& name){ m_ConfigName = name;}inline string CHTMLPopupMenu::GetAttributeName(EHTML_PM_Attribute attribute) const{ return GetAttributeName(attribute, m_Type);}inline void CHTMLPopupMenu::DisableLocalConfig(bool disable){ m_DisableLocalConfig = disable;}END_NCBI_SCOPE/* @} *//* * =========================================================================== * $Log: jsmenu.hpp,v $ * Revision 1000.5 2004/06/01 19:15:17 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.19 * * Revision 1.19 2004/05/05 13:55:40 ivanov * + DisableLocalConfig() * * Revision 1.18 2004/04/05 16:19:46 ivanov * Added support for Sergey Kurdin's popup menu with configurations * * Revision 1.17 2004/01/16 15:12:32 ivanov * Minor cosmetic changes * * Revision 1.16 2003/12/18 20:14:21 golikov * Added HideMenu * * Revision 1.15 2003/12/02 14:21:35 ivanov * Remjved obsolete functions GetCodeBodyTag[Handler|Action]() * * Revision 1.14 2003/11/05 18:41:06 dicuccio * Added export specifiers * * Revision 1.13 2003/11/03 17:02:53 ivanov * Some formal code rearrangement. Move log to end. * * Revision 1.12 2003/10/02 18:16:46 ivanov * Get rid of compilation warnings; some formal code rearrangement * * Revision 1.11 2003/10/01 15:55:04 ivanov * Added support for Sergey Kurdin's side menu * * Revision 1.10 2003/04/25 13:45:32 siyan * Added doxygen groupings * * Revision 1.9 2002/12/12 17:20:21 ivanov * Renamed GetAttribute() -> GetMenuAttributeValue, * GetAttributeName() -> GetMenuAttributeName(). * * Revision 1.8 2002/12/09 22:12:45 ivanov * Added support for Sergey Kurdin's popup menu. * * Revision 1.7 2002/04/29 15:48:16 ucko * Make CHTMLPopupMenu::GetName const for consistency with CNcbiNode (and * because there's no reason for it not to be const). * * Revision 1.6 2002/02/13 20:15:39 ivanov * Added support of dynamic popup menues. Changed GetCodeBody(). * * Revision 1.5 2001/11/29 16:05:16 ivanov * Changed using menu script name "menu.js" -> "ncbi_menu.js" * * Revision 1.4 2001/10/15 23:16:19 vakatov * + AddItem(const char* title, ...) to avoid "string/CNCBINode" ambiguity * * Revision 1.3 2001/08/15 19:43:30 ivanov * Added AddMenuItem( node, ...) * * Revision 1.2 2001/08/14 16:52:47 ivanov * Changed parent class for CHTMLPopupMenu. * Changed means for init JavaScript popup menu & add it to HTML document. * * Revision 1.1 2001/07/16 13:45:33 ivanov * Initial revision * * =========================================================================== */#endif /* HTML___JSMENU__HPP */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -