home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / System / ReqToolsLib / Source / reqtools / rtgetlonga.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-02  |  5.5 KB  |  190 lines

  1.  
  2. /*
  3.     (C) 1999 - 2000 AROS - The Amiga Research OS
  4.     $Id: rtgetlonga.c,v 1.3 2000/11/26 16:53:48 stegerg Exp $
  5.  
  6.     Desc:
  7.     Lang: English
  8. */
  9.  
  10. #include <exec/types.h>
  11. #include <proto/exec.h>
  12. #include <proto/reqtools.h>
  13. #include <proto/intuition.h>
  14. #include <exec/libraries.h>
  15. #include <exec/memory.h>
  16. #include <libraries/reqtools.h>
  17. #include <aros/libcall.h>
  18.  
  19. #include "reqtools_intern.h"
  20. #include "general.h"
  21.  
  22. /*****************************************************************************
  23.  
  24.     NAME */
  25.  
  26.     AROS_LH4(ULONG, rtGetLongA,
  27.  
  28. /*  SYNOPSIS */
  29.  
  30.     AROS_LHA(ULONG *, longptr, A1),
  31.     AROS_LHA(char *, title, A2),
  32.     AROS_LHA(struct rtReqInfo *, reqinfo, A3),
  33.     AROS_LHA(struct TagItem *, taglist, A0),
  34.  
  35. /*  LOCATION */
  36.  
  37.     struct ReqToolsBase *, ReqToolsBase, 13, ReqTools)
  38.  
  39. /*  FUNCTION
  40.     Puts up a requester to get a signed long (32-bit) number from the
  41.     user.
  42.  
  43.     'reqinfo' can be used to customize the requester. For greater
  44.     control use the tags listed below. The advantage of the rtReqInfo
  45.     structure is that it is global, where tags have to be specified
  46.     each function call. See libraries/reqtools.[hi] for a description
  47.     of the rtReqInfo structure.
  48.    
  49.     INPUTS
  50.     &longvar - address of long (32 bit!) variable to hold result.
  51.     title - pointer to null terminated title of requester window.
  52.     reqinfo - pointer to a rtReqInfo structure allocated with
  53.         rtAllocRequest() or NULL.
  54.     taglist  - pointer to a TagItem array.
  55.  
  56.     TAGS
  57.     RT_Window - see rtEZRequestA()
  58.  
  59.     RT_IDCMPFlags - see rtEZRequestA()
  60.  
  61.     RT_ReqPos - see rtEZRequestA()
  62.  
  63.     RT_LeftOffset - see rtEZRequestA()
  64.  
  65.     RT_TopOffset - see rtEZRequestA()
  66.  
  67.     RT_PubScrName - see rtEZRequestA()
  68.  
  69.     RT_Screen - see rtEZRequestA()
  70.  
  71.     RT_ReqHandler - see rtEZRequestA()
  72.  
  73.     RT_WaitPointer - see rtEZRequestA()
  74.  
  75.     RT_Underscore - [V38] see rtEZRequestA() Only when you also use the
  76.         RTGL_GadFmt tag.
  77.  
  78.     RT_LockWindow - [V38] see rtEZRequestA()
  79.  
  80.     RT_ScreenToFront - [V38] see rtEZRequestA()
  81.  
  82.     RT_ShareIDCMP - [V38] see rtEZRequestA()
  83.  
  84.     RT_Locale - [V38] see rtEZRequestA()
  85.  
  86.     RT_IntuiMsgFunc - [V38] see rtEZRequestA()
  87.  
  88.     RT_TextAttr - [V38] see rtEZRequestA(). Note that under 1.2/1.3 the
  89.         string gadget's font will remain the screen font.
  90.  
  91.     RTGL_Min - (ULONG) Minimum allowed value. If the user tries to
  92.         enter a smaller value the requester will refuse to accept it.
  93.  
  94.     RTGL_Max - (ULONG) Maximum allowed value, higher values are refused.
  95.  
  96.     RTGL_Width - (ULONG) Width of requester window in pixels. This is
  97.         only a suggestion. rtGetLongA() will not go below a certain
  98.         width.
  99.  
  100.     RTGL_ShowDefault - (BOOL) If this is TRUE (default) the value
  101.         already in 'longvar' will be displayed in the requester when it
  102.         comes up. If set to FALSE the requester will be empty.
  103.  
  104.     RTGL_GadFmt - (char *) [V38] Using this tag you can offer the user
  105.         several responses. See rtEZRequestA() for more information.
  106.         Note that selecting this gadget is considered a positive
  107.         response so the integer in the gadget is copied to '&longvar'.
  108.  
  109.     RTGL_GadFmtArgs - (APTR) [V38] If you used formatting codes with
  110.         RTGL_GadFmt use this tag to pass the arguments.
  111.  
  112.     RTGL_Invisible - (BOOL) [V38] Using this tag you can switch on
  113.         invisible typing. Very useful if you need to get something like
  114.         a code number from the user. It is strongly advised to use
  115.         { RTGL_ShowDefault, FALSE } or the user may get very confused! 
  116.         Default is FALSE.
  117.  
  118.     RTGL_BackFill - (BOOL) [V38] Backfill requester window with
  119.         pattern. Default TRUE.
  120.  
  121.     RTGL_TextFmt - (char *) [V38] Print these lines of text above the
  122.         gadget in the requester. Very useful to inform the user of what
  123.         he should enter. Most of the time you will also want to set the
  124.         GLREQF_CENTERTEXT flag. If you set the RTGL_BackFill tag to
  125.         FALSE _no_ recessed border will be placed around the text.
  126.         Formatting codes may be used in the string (see
  127.         RTGL_TextFmtArgs tag).
  128.  
  129.     RTGL_TextFmtArgs - (APTR) [V38] If you used formatting codes with
  130.         RTGL_TextFmt use this tag to pass the arguments.
  131.  
  132.     RTGL_Flags - (ULONG) [V38]
  133.  
  134.         GLREQF_CENTERTEXT - centers each line of text above the gadget
  135.             in the requester window. Should be generally set.
  136.  
  137.         GLREQF_HIGHLIGHTTEXT - Highlight text above the gadget. You
  138.             will normally only want to use this if you also turned off
  139.             the window backfilling.
  140.  
  141.     RESULT
  142.     ret - TRUE if user entered a number, FALSE if not. If one of your
  143.         idcmp flags caused the requester to end 'ret' will hold this
  144.         flag. If you used the RTGL_GadFmt tag the return code will hold
  145.         the value of the response as with rtEZRequestA().
  146.  
  147.     NOTES
  148.     'longvar' will NOT change if the requester is aborted.
  149.  
  150.     Automatically adjusts the requester to the screen font.
  151.  
  152.     rtGetLongA() checks the pr_WindowPtr of your process to find the
  153.     screen to put the requester on.
  154.  
  155.     If you use the RTGL_GadFmt tag the return value is not always the
  156.     gadget the user selected. If the integer gadget is empty and the
  157.     user presses the leftmost gadget (normally 'Ok') rtGetLong() will
  158.     return 0 (FALSE)! If the integer gadget is empty and the user
  159.     presses one of the other gadgets rtGetLong() _will_ return its
  160.     value!
  161.     Important: &longvar will not be changed in either of these cases.
  162.  
  163.     EXAMPLE
  164.  
  165.     BUGS
  166.     none known
  167.  
  168.     SEE ALSO
  169.  
  170.     INTERNALS
  171.  
  172.     HISTORY
  173.  
  174. ******************************************************************************/
  175. {
  176.     AROS_LIBFUNC_INIT
  177.    
  178.     return GetString(NULL,
  179.                  0,
  180.              title,
  181.              0,
  182.              longptr,
  183.              ENTER_NUMBER,
  184.              reqinfo,
  185.              taglist);
  186.              
  187.     AROS_LIBFUNC_EXIT
  188.   
  189. } /* rtGetLongA */
  190.