⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cursesm.h

📁 ncurses-5.4 需要的就来下把 一定会有用的哦
💻 H
📖 第 1 页 / 共 2 页
字号:
  }  // Get the number of items in this menu  inline int count() const {    return ::item_count(menu);   }  // Get the current item (i.e. the one the cursor is located)  inline NCursesMenuItem* current_item() const {    return my_items[::item_index(::current_item(menu))];  }    // Get the marker string  inline const char* mark() const {    return ::menu_mark(menu);  }  // Set the marker string  inline void set_mark(const char *mark) {    OnError (::set_menu_mark (menu, mark));  }  // Get the name of the request code c  inline static const char* request_name(int c) {    return ::menu_request_name(c);  }  // Get the current pattern  inline char* pattern() const {    return ::menu_pattern(menu);  }  // true if there is a pattern match, false otherwise.  bool set_pattern (const char *pat);  // set the default attributes for the menu  // i.e. set fore, back and grey attribute  virtual void setDefaultAttributes();  // Get the menus background attributes  inline chtype back() const {    return ::menu_back(menu);  }  // Get the menus foreground attributes  inline chtype fore() const {    return ::menu_fore(menu);  }  // Get the menus grey attributes (used for unselectable items)  inline chtype grey() const {    return ::menu_grey(menu);  }  // Set the menus background attributes  inline chtype set_background(chtype a) {    return ::set_menu_back(menu,a);  }  // Set the menus foreground attributes  inline chtype set_foreground(chtype a) {    return ::set_menu_fore(menu,a);  }  // Set the menus grey attributes (used for unselectable items)  inline chtype set_grey(chtype a) {    return ::set_menu_grey(menu,a);  }    inline void options_on (Menu_Options opts) {    OnError (::menu_opts_on (menu,opts));  }  inline void options_off(Menu_Options opts) {    OnError (::menu_opts_off(menu,opts));  }  inline Menu_Options options() const {    return ::menu_opts(menu);  }    inline void set_options (Menu_Options opts) {    OnError (::set_menu_opts (menu,opts));  }  inline int pad() const {    return ::menu_pad(menu);  }  inline void set_pad (int padch) {    OnError (::set_menu_pad (menu, padch));  }    // Position the cursor to the current item  inline void position_cursor () const {    OnError (::pos_menu_cursor (menu));  }  // Set the current item  inline void set_current(NCursesMenuItem& I) {    OnError (::set_current_item(menu, I.item));  }  // Get the current top row of the menu  inline int top_row (void) const {    return ::top_row (menu);  }  // Set the current top row of the menu  inline void set_top_row (int row) {    OnError (::set_top_row (menu, row));  }  // spacing control  // Set the spacing for the menu  inline void setSpacing(int spc_description,			 int spc_rows,			 int spc_columns) {    OnError(::set_menu_spacing(menu,			       spc_description,			       spc_rows,			       spc_columns));  }    // Get the spacing info for the menu  inline void Spacing(int& spc_description,		      int& spc_rows,		      int& spc_columns) const {    OnError(::menu_spacing(menu,			   &spc_description,			   &spc_rows,			   &spc_columns));  }  // Decorations  inline void frame(const char *title=NULL, const char* btitle=NULL) {    if (b_framed)      NCursesPanel::frame(title,btitle);    else      OnError(E_SYSTEM_ERROR);  }  inline void boldframe(const char *title=NULL, const char* btitle=NULL) {    if (b_framed)      NCursesPanel::boldframe(title,btitle);    else      OnError(E_SYSTEM_ERROR);  }    inline void label(const char *topLabel, const char *bottomLabel) {    if (b_framed)      NCursesPanel::label(topLabel,bottomLabel);    else      OnError(E_SYSTEM_ERROR);  }  // -----  // Hooks  // -----  // Called after the menu gets repositioned in its window.  // This is especially true if the menu is posted.  virtual void On_Menu_Init();  // Called before the menu gets repositioned in its window.  // This is especially true if the menu is unposted.  virtual void On_Menu_Termination();  // Called after the item became the current item  virtual void On_Item_Init(NCursesMenuItem& item);  // Called before this item is left as current item.  virtual void On_Item_Termination(NCursesMenuItem& item);    // Provide a default key virtualization. Translate the keyboard  // code c into a menu request code.  // The default implementation provides a hopefully straightforward  // mapping for the most common keystrokes and menu requests.  virtual int virtualize(int c);  // Operators  inline NCursesMenuItem* operator[](int i) const {    if ( (i < 0) || (i >= ::item_count (menu)) )      OnError (E_BAD_ARGUMENT);    return (my_items[i]);  }  // Perform the menu's operation  // Return the item where you left the selection mark for a single  // selection menu, or NULL for a multivalued menu.  virtual NCursesMenuItem* operator()(void);  // --------------------  // Exception handlers  // Called by operator()  // --------------------  // Called if the request is denied  virtual void On_Request_Denied(int c) const;    // Called if the item is not selectable  virtual void On_Not_Selectable(int c) const;  // Called if pattern doesn't match  virtual void On_No_Match(int c) const;  // Called if the command is unknown  virtual void On_Unknown_Command(int c) const;};//// -------------------------------------------------------------------------// This is the typical C++ typesafe way to allow to attach// user data to an item of a menu. Its assumed that the user// data belongs to some class T. Use T as template argument// to create a UserItem.// -------------------------------------------------------------------------//template<class T> class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem{public:  NCursesUserItem (const char* p_name,		   const char* p_descript = NULL,		   const T* p_UserData    = (T*)0)    : NCursesMenuItem (p_name, p_descript) {      if (item)	OnError (::set_item_userptr (item, (void *)p_UserData));  };  virtual ~NCursesUserItem() {};  inline const T* UserData (void) const {    return (const T*)::item_userptr (item);  };  inline virtual void setUserData(const T* p_UserData) {    if (item)      OnError (::set_item_userptr (item, (void *)p_UserData));  }};//// -------------------------------------------------------------------------// The same mechanism is used to attach user data to a menu// -------------------------------------------------------------------------//template<class T> class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu{protected:  NCursesUserMenu( int  lines, 		   int  cols, 		   int  begin_y = 0, 		   int  begin_x = 0,		   const T* p_UserData = (T*)0)     : NCursesMenu(lines,cols,begin_y,begin_x) {      if (menu)	set_user ((void *)p_UserData);  }public:  NCursesUserMenu (NCursesMenuItem Items[],		   const T* p_UserData = (T*)0,		   bool with_frame=FALSE,		   bool autoDelete_Items=FALSE)    : NCursesMenu (Items, with_frame, autoDelete_Items) {      if (menu)	set_user ((void *)p_UserData);  };    NCursesUserMenu (NCursesMenuItem Items[],		   int lines, 		   int cols, 		   int begin_y = 0, 		   int begin_x = 0,		   const T* p_UserData = (T*)0,		   bool with_frame=FALSE)    : NCursesMenu (Items, lines, cols, begin_y, begin_x, with_frame) {      if (menu)	set_user ((void *)p_UserData);  };      virtual ~NCursesUserMenu() {  };    inline T* UserData (void) const {    return (T*)get_user ();  };  inline virtual void setUserData (const T* p_UserData) {    if (menu)      set_user ((void *)p_UserData);  }};#endif // NCURSES_CURSESM_H_incl

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -