intedit.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:9k
- /*
- * intedit.h
- *
- * Integer edit control.
- *
- * Portable Windows Library
- *
- * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Portable Windows Library.
- *
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
- * All Rights Reserved.
- *
- * Contributor(s): ______________________________________.
- *
- * $Log: intedit.h,v $
- * Revision 1.16 1999/03/10 03:49:51 robertj
- * More documentation adjustments.
- *
- * Revision 1.15 1999/03/09 08:01:48 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.14 1999/02/16 08:08:45 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.13 1998/09/23 06:23:56 robertj
- * Added open source copyright license.
- *
- * Revision 1.12 1995/06/17 11:12:41 robertj
- * Documentation update.
- *
- * Revision 1.11 1995/03/14 12:41:35 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.10 1994/12/21 11:53:09 robertj
- * Documentation and variable normalisation.
- *
- * Revision 1.9 1994/10/30 11:46:42 robertj
- * Changed mechanism for doing notification callback functions.
- *
- * Revision 1.8 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.7 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.6 1994/06/25 11:55:15 robertj
- * Unix version synchronisation.
- *
- * Revision 1.5 1994/03/07 07:38:19 robertj
- * Major enhancementsacross the board.
- *
- * Revision 1.4 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.3 1993/09/27 16:35:25 robertj
- * Removed special constructor for dialog resource loading.
- *
- * Revision 1.2 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PINTEGEREDITBOX
- #ifdef __GNUC__
- #pragma interface
- #endif
- #include <limits.h>
- /**A text editing box that only allows numbers to be entered.
- */
- class PIntegerEditBox : public PNumberEditBox
- {
- PCLASSINFO(PIntegerEditBox, PNumberEditBox);
- public:
- /**Create a number edit box for integer values with the parameters
- specified, validation to assure the user does not enter values outside
- the range specified.
- */
- PIntegerEditBox(
- PInteractor * parent, /// Interactor into which the control is placed.
- long min = LONG_MIN, /// Minimum value allowed for entry.
- long max = LONG_MAX, /// Maximum value allowed for entry.
- long val = 0, /// Initial value for editing.
- long ndg = 1, /// Amount to change via the nudge buttons.
- BYTE numBase = 10
- /// Radix base for number conversion, this may only be from 2 to 36.
- );
- /** Create control from interactor layout with the specified control ID. */
- PIntegerEditBox(
- PInteractorLayout * parent, /// Interactor into which the box is placed.
- PRESOURCE_ID ctlID, /// Identifier for the control in the layout.
- const PNotifier & notify, /// Function to call when changes state.
- long * valuePtr /// Variable to change to the editor value.
- );
- /** Destroy the number edit box. */
- virtual ~PIntegerEditBox();
- /**@name New functions for class */
- /**Set the value of the number edit box control. This will be updated on
- the screen immediately (within OS constraints).
- */
- void SetValue(
- long val /// New value for edit box.
- );
- /**Get the current contents of the number edit box control as entered by
- the user, or set via the Ref{SetValue()} function.
- @return
- integer for the current contents of the edit box.
- */
- long GetValue() const;
- /**Get the current value pointer associated with the control. The variable
- pointed to by this is autamatically updated with the current value of
- the edit box.
- @return
- value pointer associated with the control.
- */
- long * GetValuePointer() const;
- /**Set the current value pointer associated with the control. The variable
- pointed to by this is autamatically updated with the current value of
- the edit box.
- */
- void SetValuePointer(
- long * ptr /// New value pointer to associate with the control.
- );
- /**Set the maximum value that may be entered in the number edit box.
- */
- void SetMaximum(
- long val /// New maximum value for edit box.
- );
- /**Get the maximum value that may be entered in the number edit box.
-
- @return
- integer maximum value.
- */
- long GetMaximum();
- /**Set the minimum value that may be entered in the number edit box.
- */
- void SetMinimum(
- long val /// New minimum value for the edit box.
- );
- /**Get the minimum value that may be entered in the number edit box.
-
- @return
- integer minimum value.
- */
- long GetMinimum();
- /**Set the nudge value that will be used by the nudge buttons in the
- number edit box.
- */
- void SetNudge(
- long val /// New nudge amount for the edit box nudge buttons.
- );
- /**Get the nudge value that will be used by the nudge buttons in the
- number edit box.
-
- @return
- integer minimum value.
- */
- long GetNudge();
- /**Set the number radix that will be used in the number edit box.
-
- The number base may be from 2 to 36. Typical values are 2 for binary
- notation, 8 for octal notation, 10 for the traditional decimal notation
- and 16 for hexadecimal.
- */
- void SetBase(
- BYTE numBase /// New number base for integer conversion.
- );
- /**Get the number radix that will be used in the number edit box.
-
- The number base may be from 2 to 36. Typical values are 2 for binary
- notation, 8 for octal notation, 10 for the traditional decimal notation
- and 16 for hexadecimal.
- @return
- number base for conversion.
- */
- BYTE GetBase();
- protected:
- /**@name Overrides from class PInteractor */
- /**The system calls this whenever the system wishes to change focus to
- another interactor in the same layout or titled window.
-
- @return
- TRUE to allow the change and FALSE to cause the change not to occur and
- the focus restored to the control.
- */
- virtual BOOL OnEndInput();
- /**The system calls this whenever a keyboard key was pressed and this
- interactor had the focus. The string is the translated ANSI/UNICODE
- representation of the key combination.
- */
- virtual void OnKeyInput(
- const PString & str /// String representation of the key pressed.
- );
- /**@name Overrides from class PControl */
- /**This function transfers the value of the control to or from the variable
- pointed to by the value pointer member variable.
- */
- virtual void TransferValue(
- int option
- /**Transfer value option. When this is -1 when the function transfers
- the value from the value pointer into the control. This is called in
- Ref{PDialog::OnInit()} function. When option is zero then the
- function transfers the value from the control to the value pointer
- variable. This is called just before the callback function every time
- the edit box value changes.
- */
- );
- /**@name Overrides from class PNumberEditBox */
- /** Add the nudge value to the edit box value. */
- virtual void AddNudge();
- /** Subtract the nudge value to the edit box value. */
- virtual void SubtractNudge();
-
- // Member variables
- /** Minimum value possible for edit box. */
- long minimum;
- /** Minimum value possible for edit box. */
- long maximum;
- /** Amount to change the value with the nudge buttons. */
- long nudge;
- /** Number base radix for integer conversion. */
- BYTE base;
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////