home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / ispintxt.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  6.2 KB  |  187 lines

  1. #ifndef _ISPINTXT_
  2.   #define _ISPINTXT_
  3. /*******************************************************************************
  4. * FILE NAME: ispintxt.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     ITextSpinButton                                                          *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18.  
  19. #include <ispinbas.hpp>
  20.  
  21. class IString;
  22. class ITextSpinButtonData;
  23. class ITextSpinButtonCursorData;
  24. class IResourceId;
  25.  
  26. #pragma pack(4)
  27.  
  28. class ITextSpinButton : public IBaseSpinButton {
  29. typedef IBaseSpinButton
  30.   Inherited;
  31.  
  32. public :
  33. class Style;
  34. class Cursor;
  35. /*------------------------------- Constructors -------------------------------*/
  36.    ITextSpinButton ( unsigned long     id,
  37.                      IWindow*          parent,
  38.                      IWindow*          owner,
  39.                      const IRectangle& initial = IRectangle(),
  40.                      const Style&      style   = defaultStyle() );
  41.  
  42.    ITextSpinButton ( unsigned long id,
  43.                      IWindow*      parent );
  44.  
  45.    ITextSpinButton ( const IWindowHandle& handle );
  46.  
  47. virtual
  48.   ~ITextSpinButton ( );
  49.  
  50. /*---------------------------------- Styles ----------------------------------*/
  51. INESTEDBITFLAGCLASSDEF3(Style, ITextSpinButton, IBaseSpinButton,
  52.                         IWindow, IControl);
  53.  
  54. static const Style
  55.   IC_IMPORTU classDefaultStyle;
  56.  
  57. static Style
  58.   defaultStyle      ( );
  59.  
  60. static void
  61.   setDefaultStyle   ( const Style&    style );
  62.  
  63.   virtual unsigned long
  64.     convertToGUIStyle ( const IBitFlag& style,
  65.                         Boolean         extendedOnly = false ) const;
  66.  
  67. /*------------------------- Set Text and Validate ----------------------------*/
  68. virtual ITextSpinButton
  69.   &setText ( const char*        string ),
  70.   &setText ( const IResourceId& item );
  71.  
  72. virtual IString
  73.   text ( ) const;
  74.  
  75. virtual Boolean
  76.   isSpinFieldValid ( Boolean caseSensitive = false) const;
  77.  
  78. /*-------------------------- Text-List Operations ----------------------------*/
  79. virtual IString
  80.   elementAt ( unsigned long index ) const,
  81.   elementAt ( const Cursor& cursor ) const;
  82.  
  83. virtual ITextSpinButton
  84.   &replaceAt  ( const char*        newString,
  85.                 Cursor&            cursor ),
  86.   &replaceAt  ( const IResourceId& item,
  87.                 Cursor&            cursor ),
  88.   &removeAt   ( Cursor&            cursor ),
  89.   &removeAll  ( ),
  90.   &add        ( const char*         string,
  91.                 Cursor&             cursor ),
  92.   &add        ( const IResourceId&  item,
  93.                 Cursor&             cursor ),
  94.   &add        ( const char*         string,
  95.                 unsigned long       index  ),
  96.   &add        ( const IResourceId&  item,
  97.                 unsigned long       index  ),
  98.   &add        ( const char* const * stringArray,
  99.                 unsigned long       index,
  100.                 unsigned long       count ),
  101.   &addAsNext  ( const char*         string,
  102.                 Cursor&             cursor ),
  103.   &addAsNext  ( const IResourceId&  item,
  104.                 Cursor&             cursor ),
  105.   &addAsFirst ( const char*         string ),
  106.   &addAsFirst ( const IResourceId&  item   ),
  107.   &addAsLast  ( const char*         string ),
  108.   &addAsLast  ( const IResourceId&  item   ),
  109.   &spinTo     ( unsigned long       index  ),
  110.   &spinTo     ( const Cursor&       cursor ),
  111.   &spinTo     ( const char*         string,
  112.                 Boolean             caseSensitive = false );
  113.  
  114.  
  115. /*----------------------- Observer Notification ------------------------------*/
  116. virtual ITextSpinButton
  117.  &enableNotification ( Boolean enable=true );
  118.  
  119. /*------------------------------ Nested Classes ------------------------------*/
  120. class Cursor : public IVBase {
  121.  
  122. public:
  123. /*---------------------------- Constructors -----------------------------*/
  124.   Cursor  ( const ITextSpinButton& spinButton );
  125.  
  126. virtual
  127.   ~Cursor ( );
  128.  
  129. /*--------------------------- Cursor Movement ---------------------------*/
  130. virtual Boolean
  131.   setToFirst    ( ),
  132.   setToNext     ( ),
  133.   setToPrevious ( ),
  134.   setToLast     ( );
  135.  
  136. /*-------------------------- Cursor Validation --------------------------*/
  137. virtual Boolean
  138.   isValid    ( ) const;
  139. virtual void
  140.   invalidate ( );
  141.  
  142.  
  143. private:
  144. /*--------------------------- Hidden Members ----------------------------*/
  145.   Cursor    ( const Cursor& cursor );
  146. Cursor
  147.   &operator= ( const Cursor& cursor );
  148.  
  149. /*--------------------------------- Private ----------------------------------*/
  150. friend class ITextSpinButton;
  151.  
  152. ITextSpinButtonCursorData
  153.  *fCursorData;
  154. }; // ITextSpinButton::Cursor
  155.  
  156.  
  157. private:
  158. /*------------------------------ Hidden Members ------------------------------*/
  159. ITextSpinButton ( const ITextSpinButton& spinButton );
  160. ITextSpinButton
  161.  &operator=     ( const ITextSpinButton& spinButton );
  162.  
  163. /*--------------------------------- Private ----------------------------------*/
  164. friend class ITextSpinButton::Cursor;
  165. friend class ITextSpinButtonCursorData;
  166.  
  167. unsigned
  168.   findStringIndex(const Cursor& cursor) const,
  169.   findStringIndex( unsigned long index ) const;
  170. ITextSpinButton&
  171.   refreshText ( );
  172.  
  173. static Style
  174.   currentDefaultStyle;
  175.  
  176. ITextSpinButtonData
  177.  *fTextSpinButtonData;
  178. }; // ITextSpinButton
  179.  
  180. INESTEDBITFLAGCLASSFUNCS( Style, ITextSpinButton);
  181.  
  182.   #include <ispintxt.inl>
  183.  
  184. #pragma pack()
  185.  
  186. #endif // _ISPINTXT_
  187.