home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / ISUBMENU.INL < prev    next >
Text File  |  1993-10-22  |  5KB  |  127 lines

  1. #ifndef _ISUBMENU_INL_
  2. #define _ISUBMENU_INL_ 0
  3. /*******************************************************************************
  4. * FILE NAME: isubmenu.inl                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the definition of the inline functions for the          *
  8. *   class(es) declared in isubmenu.hpp.                                        *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or               *
  15. *   disclosure                                                                 *
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  17. *                                                                              *
  18. *******************************************************************************/
  19. #ifndef _ISUBMENU_
  20.   #undef  _ISUBMENU_INL_
  21.   #define _ISUBMENU_INL_ 1
  22.   #include <isubmenu.hpp>
  23. #endif
  24. #ifndef _IEXCEPT_
  25.  #include <iexcept.hpp>
  26. #endif
  27.  
  28. #ifndef _IMNITEM_
  29.  #include <imnitem.hpp>
  30. #endif
  31.  
  32.  
  33. #ifndef _IRESLIB_
  34.  #include <ireslib.hpp>
  35. #endif
  36.  
  37. #if _ISUBMENU_INL_
  38.   #define inline
  39. #endif
  40.  
  41.  
  42. /*------------------------------------------------------------------------------
  43.   Constructor.
  44. ------------------------------------------------------------------------------*/
  45. inline ISubmenu :: ISubmenu(const IWindowHandle& submenuHandle)
  46.       : hwndHandle(submenuHandle), pItemList(0)
  47. {}
  48.  
  49. /*------------------------------------------------------------------------------
  50.   Add bitmap menu-item from .rc
  51. ------------------------------------------------------------------------------*/
  52. inline ISubmenu& ISubmenu :: addBitmap    ( unsigned long itemId,
  53.                                             unsigned long newItemBitmapResId )
  54. {
  55.   return addBitmap(itemId, IResourceId(newItemBitmapResId));
  56. }
  57.  
  58.  
  59. /*------------------------------------------------------------------------------
  60.   Have the cursor point to the first element
  61. ------------------------------------------------------------------------------*/
  62. inline IBase::Boolean ISubmenu::Cursor :: setToFirst ()
  63. {
  64.   lCurrent = 0;
  65.   return true;
  66. }
  67.  
  68. /*------------------------------------------------------------------------------
  69.   Have the cursor point to the previous element
  70. ------------------------------------------------------------------------------*/
  71. inline IBase::Boolean ISubmenu::Cursor :: setToPrevious ()
  72. {
  73.   --lCurrent;
  74.   return (lCurrent < 0) ? false : true;
  75. }
  76.  
  77. /*------------------------------------------------------------------------------
  78.   Have the cursor point to the last element
  79. ------------------------------------------------------------------------------*/
  80. inline IBase::Boolean ISubmenu::Cursor :: setToLast ()
  81. {
  82.   lCurrent = pSubmenu->numberOfItems() - 1;
  83.   return (lCurrent < 0) ? false : true;
  84. }
  85.  
  86. /*------------------------------------------------------------------------------
  87.   Invalidate the cursor
  88. ------------------------------------------------------------------------------*/
  89. inline IBase::Boolean ISubmenu::Cursor :: isValid () const
  90. {
  91.   return (lCurrent < 0) ? false : true;
  92. }
  93.  
  94. /*------------------------------------------------------------------------------
  95.   Invalidate the cursor
  96. ------------------------------------------------------------------------------*/
  97. inline void ISubmenu::Cursor :: invalidate ()
  98. {
  99.   lCurrent = -1L;
  100. }
  101.  
  102. /*------------------------------------------------------------------------------
  103.   Get menu item at cursor position.
  104. ------------------------------------------------------------------------------*/
  105. inline IMenuItem ISubmenu::elementAt ( const Cursor& cursor ) const
  106. {
  107.    return cursor.pSubmenu->menuItem(cursor.pSubmenu->menuItemId(cursor));
  108. }
  109.  
  110. /*------------------------------------------------------------------------------
  111.   Delete menu item at cursor position.
  112. ------------------------------------------------------------------------------*/
  113. inline ISubmenu& ISubmenu::deleteAt      ( Cursor&           cursor   )
  114. {
  115.    return cursor.pSubmenu->deleteItem(cursor.pSubmenu->menuItemId(cursor));
  116. }
  117.  
  118. /*------------------------------------------------------------------------------
  119.   Remove submenu at cursor position.
  120. ------------------------------------------------------------------------------*/
  121. inline ISubmenu& ISubmenu::removeSubmenuAt ( Cursor&           cursor   )
  122. {
  123.    return cursor.pSubmenu->removeSubmenu(menuItemId(cursor));
  124. }
  125.  
  126. #endif // _ISUBMENU_INL_
  127.