home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IMNITEM.INL
< prev
next >
Wrap
Text File
|
1993-10-22
|
8KB
|
253 lines
#ifndef _IMNITEM_INL_
#define _IMNITEM_INL_ 0
/*******************************************************************************
* FILE NAME: imnitem.inl *
* *
* DESCRIPTION: *
* This file contains the definition of the inline functions for the *
* class(es) declared in imnitem.hpp. *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or *
* disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IMNITEM_
#undef _IMNITEM_INL_
#define _IMNITEM_INL_ 1
#include <imnitem.hpp>
#endif
#ifndef _IRESLIB_
#include <ireslib.hpp>
#endif
#ifndef _ISTRING_
#include <istring.hpp>
#endif
#if _IMNITEM_INL_
#define inline
#endif
inline void IMenuItem :: setDefaultStyle( const IMenuItem::Style& newDefault)
/***************************************************************/
/* Replace the default style for new objects. */
/***************************************************************/
{
currentDefaultStyle = newDefault;
}
inline void IMenuItem :: setDefaultAttribute
( const IMenuItem::Attribute& newDefault)
/***************************************************************/
/* Replace the default Attribute for new objects. */
/***************************************************************/
{
currentDefaultAttribute = newDefault;
}
/*------------------------------------------------------------------------------
Sets command style.
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem :: setSelectable(Boolean state)
{
if (!state)
afStyle |= unavailable.asUnsignedLong();
else
afStyle &= ~unavailable.asUnsignedLong();
return *this;
}
/*------------------------------------------------------------------------------
Sets noDismiss on/off
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem :: setNoDismiss(Boolean state)
{
if (state)
afAttribute |= noDismiss.asUnsignedLong();
else
afAttribute &= ~noDismiss.asUnsignedLong();
return *this;
}
/*------------------------------------------------------------------------------
Sets frame on/off
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem :: setFramed(Boolean state)
{
if (state)
afAttribute |= framed.asUnsignedLong();
else
afAttribute &= ~framed.asUnsignedLong();
return *this;
}
/*------------------------------------------------------------------------------
Sets frame on/off
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem :: setChecked(Boolean state)
{
if (state)
afAttribute |= checked.asUnsignedLong();
else
afAttribute &= ~checked.asUnsignedLong();
return *this;
}
/*------------------------------------------------------------------------------
Sets enable/disable
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem :: setDisabled(Boolean state)
{
if (state)
afAttribute |= disabled.asUnsignedLong();
else
afAttribute &= ~disabled.asUnsignedLong();
return *this;
}
/*------------------------------------------------------------------------------
Sets highlight on/off.
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem :: setHighlighted(Boolean state)
{
if (state)
afAttribute |= highlighted.asUnsignedLong();
else
afAttribute &= ~highlighted.asUnsignedLong();
return *this;
}
/*------------------------------------------------------------------------------
Test style and attribute.
------------------------------------------------------------------------------*/
inline IBase::Boolean IMenuItem :: isSelectable() const
{
return !(afStyle & unavailable.asUnsignedLong());
}
inline IBase::Boolean IMenuItem :: isDrawItem() const
{
return (afStyle & drawItem.asUnsignedLong());
}
inline IBase::Boolean IMenuItem :: isSeparator() const
{
return (afStyle & separator.asUnsignedLong());
}
inline IBase::Boolean IMenuItem :: isNoDismiss() const
{
return (afAttribute & noDismiss.asUnsignedLong());
}
inline IBase::Boolean IMenuItem :: isFramed() const
{
return (afAttribute & framed.asUnsignedLong());
}
inline IBase::Boolean IMenuItem :: isChecked() const
{
return (afAttribute & checked.asUnsignedLong());
}
inline IBase::Boolean IMenuItem :: isDisabled() const
{
return (afAttribute & disabled.asUnsignedLong());
}
inline IBase::Boolean IMenuItem :: isHighlighted() const
{
return (afAttribute & highlighted.asUnsignedLong());
}
/*------------------------------------------------------------------------------
Sets the menu-item text from .rc
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem :: setText(const IResourceId& textResId)
{
return(setText((char*)textResId.resourceLibrary().loadString(textResId)));
}
/*------------------------------------------------------------------------------
Sets the menu-item bitmap from .rc
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem :: setBitmap(const IResourceId& bitmapResId)
{
return(setBitmap(bitmapResId.resourceLibrary().loadBitmap(bitmapResId)) );
}
inline IMenuItem& IMenuItem :: setBitmap(unsigned long bitmapResId)
{
return(setBitmap(IResourceId(bitmapResId)));
}
/*------------------------------------------------------------------------------
Set menu item position
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem::setIndex ( long index)
{
iPosition = index;
return *this;
}
/*------------------------------------------------------------------------------
Query menu item information
------------------------------------------------------------------------------*/
inline unsigned long IMenuItem::id() const
{
return itemId;
}
inline long IMenuItem::index ( ) const
{
return iPosition;
}
inline IWindowHandle IMenuItem::submenuHandle( ) const
{
return hwndSubmenu;
}
inline unsigned long IMenuItem:: style( ) const
{
return afStyle;
}
inline unsigned long IMenuItem::attribute ( ) const
{
return afAttribute;
}
inline IString IMenuItem::text( ) const
{
return strClItemText;
}
inline IBitmapHandle IMenuItem::bitmap ( ) const
{
return hBitmapHandle;
}
/*------------------------------------------------------------------------------
Set style and attribute given unsigned long.
------------------------------------------------------------------------------*/
inline IMenuItem& IMenuItem::setStyle( unsigned long newStyle )
{
afStyle = newStyle;
return *this;
}
inline IMenuItem& IMenuItem::setAttribute( unsigned long newAttribute )
{
afAttribute = newAttribute;
return *this;
}
#endif // _IMNITEM_INL_