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

  1. #ifndef _IENTRYFD_
  2.   #define _IENTRYFD_
  3. /*******************************************************************************
  4. * FILE NAME: ientryfd.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IEntryField                                                              *
  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. #include <itextctl.hpp>
  19. #include <irect.hpp>
  20.  
  21. class IRange;
  22. class ISize;
  23. class IString;
  24. class IResourceId;
  25. class IColor;
  26. class IEntryFieldData;
  27.  
  28. #pragma pack(4)
  29.  
  30. class IEntryField : public ITextControl {
  31. typedef ITextControl
  32.   Inherited;
  33.  
  34. public:
  35. class Style;
  36. /*------------------------------- Constructors -------------------------------*/
  37.   IEntryField  ( unsigned long        id,
  38.                  IWindow*             parent,
  39.                  IWindow*             owner,
  40.                  const IRectangle&    initial = IRectangle(),
  41.                  const Style&         style = defaultStyle() );
  42.  
  43.   IEntryField  ( unsigned long        id,
  44.                  IWindow*             parent );
  45.  
  46.   IEntryField  ( const IWindowHandle& handle );
  47.  
  48. virtual
  49.  ~IEntryField  ( );
  50.  
  51. /*---------------------------------- Styles ----------------------------------*/
  52. INESTEDBITFLAGCLASSDEF2(Style, IEntryField, IWindow, IControl);
  53.  
  54. static const Style
  55.   IC_IMPORTU classDefaultStyle,
  56.   IC_IMPORTU autoScroll,
  57.   IC_IMPORTU margin,
  58.   IC_IMPORTU readOnly,
  59.   IC_IMPORTU unreadable,
  60.   IC_IMPORTU leftAlign,
  61.   IC_IMPORTU centerAlign,
  62.   IC_IMPORTU rightAlign,
  63. #ifndef IC_WIN_FLAGNOP
  64.   IC_IMPORTU autoTab,
  65.   IC_IMPORTU command,
  66.   IC_IMPORTU sbcsData,
  67.   IC_IMPORTU dbcsData,
  68.   IC_IMPORTU mixedData,
  69. #endif
  70. #ifndef IC_MOTIFPM_FLAGNOP
  71.   IC_IMPORTU border3D,
  72. #endif
  73.   IC_IMPORTU anyData;
  74. static const Style
  75.   IC_IMPORTU upperCase,
  76.   IC_IMPORTU lowerCase;
  77.  
  78. static Style
  79.   defaultStyle      ( );
  80.  
  81. static void
  82.   setDefaultStyle   ( const Style&    style );
  83.  
  84. virtual unsigned long
  85.   convertToGUIStyle ( const IBitFlag& style,
  86.                       Boolean         extendedOnly = false ) const;
  87.  
  88. /*---------------------------- Enumerations ----------------------------------*/
  89. enum Alignment {
  90.   left,
  91.   center,
  92.   right
  93. };
  94.  
  95. enum CharType {
  96.   any,
  97.   sbcs
  98. #ifndef IC_WIN_FLAGNOP
  99.   , dbcs,
  100.   mixed
  101. #endif
  102. };
  103.  
  104. /*-------------------------------- Attributes --------------------------------*/
  105. Alignment
  106.   alignment          ( ) const;
  107.  
  108. CharType
  109.   charType           ( ) const;
  110.  
  111. #ifndef IC_WIN_FLAGNOP
  112. virtual IEntryField
  113.  &enableCommand      ( Boolean   enable=true ),
  114.  &disableCommand     ( ),
  115.  &enableAutoTab      ( Boolean   enable=true ),
  116.  &disableAutoTab     ( ),
  117.  &enableMargin       ( Boolean   enable=true ),
  118.  &disableMargin      ( ),
  119.  &enableAutoScroll   ( Boolean   enable=true ),
  120.  &disableAutoScroll  ( ),
  121.  &setAlignment       ( Alignment alignment ),
  122.  &setCharType        ( CharType  type );
  123. #endif
  124.  
  125. Boolean
  126.   isCommand          ( ) const,
  127.   isAutoTab          ( ) const,
  128.   isAutoScroll       ( ) const,
  129.   isMargin           ( ) const;
  130.  
  131. /*-------------------------------- Clipboard Operations ----------------------*/
  132. virtual IEntryField
  133.  &cut        ( unsigned long timestamp=0 ),
  134.  ©       ( unsigned long timestamp=0 ),
  135.  &paste      ( ),
  136.  &clear      ( unsigned long timestamp=0 ),
  137.  &discard    ( ),
  138.  &removeAll  ( );
  139.  
  140. /*------------------------- Overloaded Disable/Enable Window -----------------*/
  141. virtual IEntryField
  142.  &disable  ( ),
  143.  &enable   ( Boolean enable=true );
  144.  
  145. /*-------------------------------- Insert Mode -------------------------------*/
  146. #ifndef IC_WIN_FLAGNOP
  147. virtual IEntryField
  148.  &enableInsertMode   ( Boolean insert=true ),
  149.  &disableInsertMode  ( );
  150. #endif
  151.  
  152. Boolean
  153.   isInsertMode       ( ) const;
  154.  
  155. /*---------------------------- Read-Only Operations --------------------------*/
  156. virtual IEntryField
  157.  &enableDataUpdate   ( Boolean update=true ),
  158.  &disableDataUpdate  ( );
  159.  
  160. Boolean
  161.   isWriteable        ( ) const;
  162.  
  163. /*-------------------------------- Text Limit --------------------------------*/
  164. virtual IEntryField
  165.  &setLimit  ( unsigned long      textLimit ),
  166.  &setLimit  ( const IResourceId& textLimit );
  167.  
  168. virtual unsigned long
  169.   limit     ( ) const;
  170.  
  171. /*-------------------------------- Selected Text -----------------------------*/
  172. static const long IC_IMPORTU end;
  173.  
  174. virtual IEntryField
  175.  &selectRange    ( const IRange& range = IRange(0,end),
  176.                    unsigned long timestamp = 0 );
  177.  
  178. IRange
  179.   selectedRange ( ) const;
  180.  
  181. IString
  182.   selectedText  ( ) const;
  183.  
  184. unsigned long
  185.   selectedTextLength ( ) const;
  186.  
  187. virtual IEntryField
  188.  &setCursorPosition( unsigned long newCursorPos );
  189.  
  190. unsigned long
  191.   cursorPosition ( ) const;
  192.  
  193. /*-------------------------------- Left Index --------------------------------*/
  194. virtual IEntryField
  195.   &setLeftIndex ( unsigned long index );
  196.  
  197. #ifndef IC_WIN_FLAGNOP
  198. unsigned long
  199.   leftIndex    ( ) const;
  200. #endif
  201.  
  202. /*-------------------------------- Test Operations ---------------------------*/
  203. Boolean
  204.   hasTextChanged  ( ) const,
  205.   isEmpty         ( ) const,
  206.   hasSelectedText ( ) const;
  207.  
  208. virtual IEntryField
  209.  &setTextChangedFlag    ( Boolean changed=true ),
  210.  &resetTextChangedFlag  ( );
  211.  
  212. /*---------------------------------- Colors ----------------------------------*/
  213. virtual IColor
  214.   foregroundColor ( ) const,
  215.   backgroundColor ( ) const;
  216.  
  217.  
  218. /*----------------------- Notification Event Descriptions --------------------*/
  219. static INotificationId const
  220. #ifndef IC_WIN_FLAGNOP
  221.   IC_IMPORTU insertModeId,
  222. #endif
  223.   IC_IMPORTU dataUpdateId,
  224.   IC_IMPORTU limitId,
  225.   IC_IMPORTU characterTypeId;
  226.  
  227. /*----------------------- Observer Notification ------------------------------*/
  228. virtual IEntryField
  229.  &enableNotification ( Boolean enable=true );
  230.  
  231. /*-------------------------------- Text Operations ---------------------------*/
  232. virtual IEntryField
  233.  &setText            ( const char* text ),
  234.  &setText            ( const IResourceId& text );
  235.  
  236.  
  237. protected:
  238. /*------------------------------ Layout Support ------------------------------*/
  239. virtual ISize
  240.   calcMinimumSize ( ) const;
  241.  
  242.  
  243.  
  244. /*---------------------------------- Styles ----------------------------------*/
  245. virtual IEntryField
  246.  &setStyle ( unsigned long style );
  247.  
  248. /*------------------------------- Constructors -------------------------------*/
  249.   IEntryField ( );
  250.  
  251. /*-------------------------- Drag and Drop Support ---------------------------*/
  252. virtual Boolean
  253.   isDragStarting( IEvent &event );
  254.  
  255.  
  256. private:
  257. /*------------------------------ Hidden Members ------------------------------*/
  258.   IEntryField  ( const IEntryField& entryField );
  259. IEntryField
  260.  &operator=    ( const IEntryField& entryField );
  261.  
  262. /*--------------------------------- Private ----------------------------------*/
  263. friend class IEntryFieldNotifyHandler;
  264. friend class IEntryHandler;
  265.  
  266. IRange
  267.   getCursorInfo ( ) const;
  268.  
  269. void
  270.   setCursorInfo ( const IRange &range );
  271.  
  272. static Style
  273.   currentDefaultStyle;
  274.  
  275. enum ReadStatus {
  276.   doesntMatter,
  277.   wasInput,
  278.   wasRead,
  279.   wasInputButReset,
  280.   wasReadButReset
  281. };
  282.  
  283. ReadStatus
  284.   eReadStatus;
  285.  
  286. Boolean
  287.   queryInsMode;
  288.  
  289. IEntryFieldData
  290.  *fEntryFieldData;
  291.  
  292. /*------------------------------ Obsolete Members ----------------------------*/
  293. #if ( IC_OBSOLETE <= IC_OBSOLETE_2 )
  294. public:
  295. Boolean
  296.   hasChanged      ( ) const;
  297.  
  298. virtual IEntryField
  299.   &setChangedFlag ( Boolean changeFlag = true );
  300. #endif
  301.  
  302. }; // IEntryField
  303.  
  304. INESTEDBITFLAGCLASSFUNCS(Style, IEntryField);
  305.  
  306. #pragma pack()
  307.  
  308. #endif  /* _IENTRYFD_ */
  309.