Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / datatypes / startdragselect.c
blob7298a748134d62065964e4cd92ade61e95a27834
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include <proto/dos.h>
9 #include <proto/utility.h>
10 #include <proto/datatypes.h>
11 #include "datatypes_intern.h"
13 /*****************************************************************************
15 NAME */
17 AROS_LH1(ULONG, StartDragSelect,
19 /* SYNOPSIS */
20 AROS_LHA(Object *, o, A0),
22 /* LOCATION */
23 struct Library *, DataTypesBase, 50, DataTypes)
25 /* FUNCTION
27 Start drag-selection by the user; the drag selection will only start
28 if the object in question supports DTM_SELECT, is in a window or
29 requester and no layout-process is working on the object.
31 INPUTS
33 o -- data type object in question; may be NULL
35 RESULT
37 TRUE if all went OK, FALSE otherwise. If FALSE, IoErr() gives further
38 information:
40 ERROR_ACTION_NOT_KNOWN -- the object doesn't support DTM_SELECT
41 ERROR_OBJECT_IN_USE -- the object is currently occupied
43 NOTES
45 EXAMPLE
47 BUGS
49 SEE ALSO
51 INTERNALS
53 HISTORY
55 6.8.99 SDuvan implemented
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 struct DTSpecialInfo *dtsi;
62 BOOL retval = TRUE;
64 if(o == NULL)
65 return FALSE;
67 dtsi = ((struct Gadget *)o)->SpecialInfo;
69 /* Doesn't support drag selection? */
70 if(FindMethod(GetDTMethods(o), DTM_SELECT) == NULL)
72 SetIoErr(ERROR_ACTION_NOT_KNOWN);
73 return FALSE;
76 ObtainSemaphore(&dtsi->si_Lock);
78 if(dtsi->si_Flags & DTSIF_LAYOUTPROC)
80 retval = FALSE;
81 SetIoErr(ERROR_OBJECT_IN_USE);
83 else
84 dtsi->si_Flags |= DTSIF_DRAGSELECT;
86 ReleaseSemaphore(&dtsi->si_Lock);
88 return retval;
90 AROS_LIBFUNC_EXIT
91 } /* StartDragSelect */