home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
ISPINBT.INL
< prev
next >
Wrap
Text File
|
1993-10-22
|
8KB
|
196 lines
#ifndef _ISPINBT_INL_
#define _ISPINBT_INL_ 0
/*******************************************************************************
* FILE NAME: ispinbt.inl *
* *
* DESCRIPTION: *
* This file contains the definition of the inline functions for the *
* class(es) declared in ispinbt.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 _ISPINBT_
#undef _ISPINBT_INL_
#define _ISPINBT_INL_ 1
#include <ispinbt.hpp>
#endif
#ifndef _IEXCEPT_
#include <iexcept.hpp>
#endif
#ifndef _IRESLIB_
#include <ireslib.hpp>
#endif
#if _ISPINBT_INL_
#define inline
#endif
inline void ISpinButton :: setDefaultStyle(const ISpinButton::Style& stsStyle)
/***************************************************************/
/* Replace the default style for new static text objects. */
/***************************************************************/
{
currentDefaultStyle = stsStyle;
}
inline ISpinButton& ISpinButton :: setReadOnly ( Boolean bReadOnly )
{
/*------------------------------------------------------------------------------
Make this spin field read only
------------------------------------------------------------------------------*/
if (bReadOnly)
setStyle(style() | readOnly.asUnsignedLong());
else
setStyle(style() & ~readOnly.asUnsignedLong());
refresh(); // force refresh
return *this;
}
inline ISpinButton& ISpinButton :: setFastSpin ( Boolean fast)
/*------------------------------------------------------------------------------
Make the spin button speed faster
------------------------------------------------------------------------------*/
{
if (fast)
setStyle(style() | fastSpin.asUnsignedLong());
else
setStyle(style() & ~fastSpin.asUnsignedLong());
return *this;
}
inline ISpinButton& ISpinButton :: enableBorder ( Boolean enable)
/*------------------------------------------------------------------------------
Draw a border around the spin field
------------------------------------------------------------------------------*/
{
if (enable)
setStyle(style() & ~noBorder.asUnsignedLong());
else
setStyle(style() | noBorder.asUnsignedLong());
refresh(); // force refresh
return *this;
}
inline ISpinButton& ISpinButton :: disableBorder ( )
/*------------------------------------------------------------------------------
Suppress drawing the spin field border.
------------------------------------------------------------------------------*/
{
return enableBorder(false);
}
inline IBase::Boolean ISpinButton :: isMaster ( ) const
/*------------------------------------------------------------------------------
Is the spin button a master?
------------------------------------------------------------------------------*/
{
return (style() & master.asUnsignedLong()) ? true : false;
}
inline IBase::Boolean ISpinButton :: isServant ( ) const
/*------------------------------------------------------------------------------
Is the spin button a servant?
------------------------------------------------------------------------------*/
{
return (!isMaster());
}
inline IBase::Boolean ISpinButton :: isReadOnly ( ) const
/*------------------------------------------------------------------------------
Is the spin field read only?
------------------------------------------------------------------------------*/
{
return (style() & readOnly.asUnsignedLong()) ? true : false;
}
inline IBase::Boolean ISpinButton :: isFastSpin ( ) const
/*------------------------------------------------------------------------------
Is fast spin activated?
------------------------------------------------------------------------------*/
{
return (style() & fastSpin.asUnsignedLong()) ? true : false;
}
inline IBase::Boolean ISpinButton :: isBorder ( ) const
/*------------------------------------------------------------------------------
Does the spin field has a border?
------------------------------------------------------------------------------*/
{
return (style() & noBorder.asUnsignedLong()) ? false : true;
}
inline ISpinButton::Type ISpinButton :: inputTypeAllowed ( ) const
/*------------------------------------------------------------------------------
Returns the input type allowed.
------------------------------------------------------------------------------*/
{
return (style() & numericOnly.asUnsignedLong()) ? numeric : alphanumeric;
}
inline unsigned long ISpinButton::limit ( ) const
/*------------------------------------------------------------------------------
Returns the number of characters allowed.
------------------------------------------------------------------------------*/
{
return this->textLimit;
}
inline ISpinButton& ISpinButton :: spinTo ( long aValue )
/*------------------------------------------------------------------------------
Set the current number with the range in the spin field.
------------------------------------------------------------------------------*/
{
return setCurrent(aValue);
}
inline void ISpinButton::Cursor :: invalidate ()
/*------------------------------------------------------------------------------
Invalidate the cursor
------------------------------------------------------------------------------*/
{
this->lCurrent = 0;
}
inline IBase::Boolean ISpinButton::Cursor :: isValid () const
/*------------------------------------------------------------------------------
Is the cursor valid?
------------------------------------------------------------------------------*/
{
return (this->lCurrent > 0 && this->ulCurCount == rSpBut.lCount) ? true : false;
}
inline ISpinButton& ISpinButton :: spinTo ( const Cursor& cursor )
/*------------------------------------------------------------------------------
Set the current text to the text at the cursor position.
------------------------------------------------------------------------------*/
{
return setCurrent(cursor);
}
/*------------------------------------------------------------------------------
Add a text next to the current cursor position.
------------------------------------------------------------------------------*/
inline ISpinButton& ISpinButton :: addAsNext ( const char* string,
Cursor& cursor, Boolean immediateUpdate )
{
add(string, cursor, immediateUpdate);
return *this;
}
inline ISpinButton& ISpinButton :: addAsNext ( const IResourceId& resid,
Cursor& cursor, Boolean immediateUpdate )
{
IString newText=resid.resourceLibrary().loadString(resid);
return addAsNext(newText,cursor,immediateUpdate);
}
#endif // _ISPINBT_INL_