home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IENTRYFD_
- #define _IENTRYFD_
- /*******************************************************************************
- * FILE NAME: Ientryfd.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * Ientryfd - This class creates and manages the entry field control window. *
- * *
- * 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. *
- * *
- * $Log: R:/IBMCLASS/IBASECTL/VCS/IENTRYFD.HPV $
- //
- // Rev 1.9 25 Oct 1992 17:05:18 nunn
- //changed library name to ICLUI
- //
- // Rev 1.8 25 Oct 1992 10:53:48 boezeman
- //Add documentation and converted file to skeleton.hpp format.
- //
- // Rev 1.7 22 Oct 1992 09:48:06 boezeman
- //Made changes to set and return all styles, also changed all methods that
- //return void to now return IEntryField&, also changed the format of the
- //hpp to that of the skeleton.hpp.
-
- Rev 1.7 20 Oct 1992 21:22:02 Boezeman
- Add methods for setting and return all allowable styles for entryfields.
- Changed file to be structed like skeleton.hpp
-
- Rev 1.6 13 Oct 1992 21:22:02 tsuji
- Correct comments around log directive.
-
- Rev 1.5 13 Oct 1992 20:56:44 tsuji
- Correct log directive, remove IBM Confidential classification.
-
- Rev 1.4 13 Oct 1992 19:05:40 tsuji
- Remove no-op virtual destructor, add Inherited typedef.
- *******************************************************************************/
- #ifndef _ITEXTCTL_
- #include <itextctl.hpp>
- #endif
-
- // Forward declarations for other classes:
- class IEntryField; /* ef */
- class IRange;
- class IRectangle;
- class ISize;
- class IString;
- class IResourceId;
- class IWindowHandle;
- #ifndef _IBITFLAG_
- #include <ibitflag.hpp>
- #endif
-
- class IEntryField : public ITextControl {
- /*******************************************************************************
- * This class creates and manages the entry field control window. *
- * *
- * To use this class, create an instance of this class as follows: *
- * IEntryField efEntry(ID_ENTRY, this, IRectangle(10,10,30,12)); *
- * *
- * To change the style of the entry field after it has been created, use *
- * functions such as: * *
- * setAlignment(IEntryField::center). *
- * *
- * Valid styles for an entry field are: *
- * IEntryField::autoscroll, *
- * IEntryField::margin, *
- * IEntryField::autotab, *
- * IEntryField::readonly, *
- * IEntryField::command, *
- * IEntryField::unreadable, *
- * IEntryField::autosize, *
- * IEntryField::leftAlign, *
- * IEntryField::centerAlign, *
- * IEntryField::rightAlign, *
- * IEntryField::anyData, *
- * IEntryField::sbcsData, *
- * IEntryField::dbcsData, *
- * IEntryField::mixedData, *
- * IEntryField::defStyle, *
- * any of the IControl styles, and *
- * any of the IWindow styles. *
- * *
- * Specific keystroke processing (e.g. numeric *
- * only fields) can be implemented through the *
- * use of a specialized handler for the entry *
- * field control. *
- * *
- * EXAMPLE: *
- * <sample code> *
- *******************************************************************************/
- /* Next release, ICLUI will provide support *
- * to automatically change the height and *
- * width of an entry field on a canvas to *
- * match the size of the font used by the *
- * entry field. */
- typedef ITextControl
- Inherited;
-
- public:
-
- INESTEDBITFLAGCLASSDEF2(Style, IEntryField, IWindow, IControl);
- // style class definition
- static const Style
- autoscroll,
- margin,
- autotab,
- readonly,
- command,
- unreadable,
- autosize,
- leftAlign,
- centerAlign,
- rightAlign,
- anyData,
- sbcsData,
- dbcsData,
- mixedData;
- static const Style&
- defStyle;
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There are 3 ways to construct instances of this class: |
- | 1. default |
- | 2. From a Dialog Template |
- | 3. From a Window |
- ------------------------------------------------------------------------------*/
- IEntryField(unsigned long Id,
- const IWindow* parent,
- const IWindow* owner,
- const IRectangle& initial,
- Style style = defStyle);
-
- IEntryField(unsigned long Id,
- const IWindow* parentDialog);
-
- IEntryField(IWindowHandle handle);
-
- /*-------------------------------- STYLES --------------------------------------
- | These function provide means of getting and setting the default style |
- | attributes of instances of this class: |
- | defaultStyle - returns the entry field control default style setting |
- | setDefaultStyle - sets the entry field control default style |
- ------------------------------------------------------------------------------*/
- static Style
- defaultStyle();
- static void
- setDefaultStyle(Style style);
- /*-------------------------------- STYLES --------------------------------------
- | These operations replace the value of, append a style value(s) to and remove |
- | a style value(s) from the window style of the entry field control. |
- | setAlignment - sets the alignment of the entry field |
- | alignment - returns the currently set alignment, left is the default|
- | setCharType - sets the character type of the entry field control |
- | charType - returns the currently set char type, any is the default |
- | enableAutoScroll - Enables or diables the autoscroll style on an entry field|
- | disableAutoScroll- Diables the autoscroll style on an entry field. |
- | isAutoScroll - Queries if the autoscroll style is set on an entry field|
- | enableMargin - Enables or diables the margin style on an entry field |
- | disableMargin - Diables the margin style on an entry field. |
- | isMargin - Queries if the margin style is set on an entry field |
- | enableCommand - Enables or diables the command style on an entry field |
- | disableCommand - Diables the command style on an entry field. |
- | isCommand - Queries if the command style is set on an entry field |
- | enableAutoTab - Enables or diables the autotab style on an entry field |
- | disableAutoTab - Diables the autotab style on an entry field. |
- | isAutoTab - Queries if the autotab style is set on an entry field |
- | enableAutoSize - Enables or diables the autosize style on an entry field |
- | disableAutoSize - Diables the autosize style on an entry field. |
- | isAutoSize - Queries if the autosize style is set on an entry field |
- ------------------------------------------------------------------------------*/
- enum Alignment { left, center, right };
- IEntryField&
- setAlignment(Alignment alignment); //JJB
- Alignment
- alignment(); //JJB
- enum CharType { sbcs, dbcs, any, mixed };
- IEntryField&
- setCharType(CharType type); //JJB
- CharType
- charType(); //JJB
- IEntryField&
- enableAutoScroll(Boolean bTurnOn=true); //JJB
- IEntryField&
- disableAutoScroll(); //JJB
- IEntryField&
- enableMargin(Boolean bTurnOn=true); //JJB
- IEntryField&
- disableMargin(); //JJB
- IEntryField&
- enableCommand(Boolean bTurnOn=true); //JJB
- IEntryField&
- disableCommand(); //JJB
- IEntryField&
- enableAutoTab(Boolean bTurnOn=true); //JJB
- IEntryField&
- disableAutoTab(); //JJB
- IEntryField&
- enableAutoSize(Boolean bTurnOn=true); //JJB
- IEntryField&
- disableAutoSize(); //JJB
- Boolean
- isAutoScroll(), //JJB
- isMargin(), //JJB
- isCommand(), //JJB
- isAutoTab(), //JJB
- isAutoSize(); //JJB
-
- /*-------------------------------- CLIPBOARD OPERATIONS ------------------------
- | These operations allows data to be transferred between the clipboard and the |
- | entry field. Each of these operations deal with the selected text in the |
- | entry field. |
- | isClipboardOpen - Queries if the clipboard contains text data. |
- | cut - Removes the selected text from the entry field and puts |
- | it in the clipboard. |
- | copy - Copies the selected text to the clipboard. |
- | paste - Replaces the selected text with the text in the clipboard|
- | clear - Replaces the selected text in the entry field with spaces|
- | discard - Deletes the marked text. |
- ------------------------------------------------------------------------------*/
- Boolean
- isClipboardOpen() const;
- IEntryField&
- cut(); //JJB
- IEntryField&
- copy(); //JJB
- IEntryField&
- paste(); //JJB
- IEntryField&
- clear(); //JJB
- IEntryField&
- discard(); //JJB
-
-
- /*-------------------------------- OVERLOADED DISABLE/ENABLE WINDOW ------------
- | These operations are overloaded to ensure a diabled entry field is set to |
- | read-only state to prevent user input. |
- | disable - Disables an entry field. |
- | enable - Enables or disables an entry field. |
- ------------------------------------------------------------------------------*/
- void
- disable(),
- enable(Boolean bTurnOn=true);
-
- /*-------------------------------- INSERTMODE ----------------------------------
- | enableInsertMode - Enables or disables the insert mode on a entry field. |
- | disableInsertMode- Disables the insert mode on a entry field. |
- | isInsertMode - Queries is the entry field is in insert mode. |
- ------------------------------------------------------------------------------*/
- IEntryField&
- enableInsertMode(Boolean bTurnOn=true); //JJB
- IEntryField&
- disableInsertMode(); //JJB
- Boolean
- isInsertMode() const;
-
- /*-------------------------------- READONLYMODE --------------------------------
- | enableReadOnly - Enables or disables the read-only mode on a entry field |
- | disableReadOnly - Disables the read-only mode on a entry field. |
- | isReadOnly - Queries is the entry field is in read-only mode. |
- ------------------------------------------------------------------------------*/
- IEntryField&
- enableReadOnly(Boolean bTurnOn=true); //JJB
- IEntryField&
- disableReadOnly(); //JJB
- Boolean
- isReadOnly() const;
-
- /*-------------------------------- TEXTLIMIT -----------------------------------
- | setTextLimit - Sets the length of the longest text that the entry field is |
- | is allowed to hold. |
- | textLimit - Returns the longest text that the entry field can hold. |
- ------------------------------------------------------------------------------*/
- IEntryField&
- setTextLimit(unsigned long textLimit); //JJB
- IEntryField&
- setTextLimit(const IResourceId& textLimit); //JJB
- unsigned long
- textLimit() const;
-
- /*-------------------------------- MARKED TEXT ---------------------------------
- | These operations mark (select) a range of text, return the range of the |
- | marked text, and return the marked text string. The marked range is the |
- | 0-based index of the first character marked (or to be marked) and the 0-based|
- | index of the last character marked (or to be marked). A range of (-1,-1) is |
- | returned by markedTextRange is no text is marked |
- | markText - Marks(select) a range of text. |
- | markedTextRange - Returns the range of the marked text. |
- | markedText - Returns the marked text string. |
- ------------------------------------------------------------------------------*/
- IEntryField&
- markText(const IRange& range); //JJB
- IRange
- markedTextRange() const;
- IString
- markedText() const;
-
- /*-------------------------------- FIRST CHARACTER------------------------------
- | setFirstCharIndex- Set the first character displayed at the left edge of |
- | the entry field. The index is 0-based. |
- | firstCharIndex - Returns the first character displayed at the left edge |
- | of the entry field. The index is 0-based. |
- ------------------------------------------------------------------------------*/
- IEntryField&
- setFirstCharIndex(unsigned long index); //JJB
- unsigned long
- firstCharIndex() const;
-
- /*-------------------------------- TEST OPERATIONS -----------------------------
- | isChanged - Queries if the entry field text has changed. |
- | isEmpty - Queries if the entry field is empty. |
- | isMarked - Queries if any of the entry field text is selected. |
- ------------------------------------------------------------------------------*/
- Boolean
- isChanged() const,
- isEmpty() const,
- isMarked() const;
-
- protected:
- /*----------------------------- LAYOUT SIZE ------------------------------------
- | calcMinSize - Returns the minimum size that this entry field control should be|
- ------------------------------------------------------------------------------*/
- virtual ISize
- calcMinSize();
-
- virtual void
- setStyle(unsigned long style);
-
- IEntryField();
-
- static Style
- classDefaultStyle;
-
- private:
- /*--------------------------------- PRIVATE ----------------------------------*/
- IEntryField(const IEntryField&);
- //IEntryField& operator=(const IEntryField&);
-
- IRange
- getCursorInfo() const;
- void
- setCursorInfo(const IRange& range);
-
- enum ReadStatus { doesntMatter, wasInput, wasRead,
- wasInputButReset, wasReadButReset };
- ReadStatus
- eReadStatus;
- }; // class IEntryField
-
- INESTEDBITFLAGCLASSFUNCS(Style, IEntryField);
- // global style functions
- #endif /* _IENTRYFD_ */