File: DragDropHOWTO-1.html

package info (click to toggle)
libdnd 1.0-12
  • links: PTS
  • area: main
  • in suites: slink
  • size: 736 kB
  • ctags: 136
  • sloc: ansic: 765; makefile: 139; sh: 1
file content (113 lines) | stat: -rw-r--r-- 4,932 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<HTML>
<HEAD>
<TITLE>Introduction</TITLE>
</HEAD>
<BODY>
<H1>1. <A NAME="s1"></A>Introduction</H1>
<P>
<A HREF="DragDropHOWTO.html#toc1">Contents of this section</A></P>

<H2>1.1 <A NAME="ss1.1"></A> What is a drag and drop protocol ?</H2>

<P>I'm supposing you understand what ``drag and drop'' means. It's an intuitive
way to exchange data between programs. A drag and drop protocol is the mean
used by the programs to comunicate with each other in order to perform this
data exchange. If the programs want to exchange information, they must
be able to comunicate with each other in a common language. This language is
the ``protocol''. Therefore, if you create your own protocol, chances are other
programs will not understand you. So you must ``talk'' to other programs in a
common language. In this way, when you receive a drop, you will receive a ``I
dropped on you'' message, and you will understand the message no matter who
send it to you. This is the purpose of a drag and drop protocol: to provide a
common language for this kind of actions.</P>
<P></P>

<H2>1.2 <A NAME="ss1.2"></A> What is DND, and why should I use it ?</H2>

<P>DND is a drag and drop protocol developed by 
<A HREF="mailto:c.crusius@ieee.org">Csar Crusius</A>
. A <CODE>C</CODE> interface to
Xt-based programs is avaliable together with OffiX, a collection of useful
utilities using the DND protocol.</P>
<P>If you have a program that could benefit from having drag and drop
capabilities, DND might be a good choice for the following reasons:</P>
<P>
<UL>
<LI>It is public, unlike other ``standard'' protocols such as those used by
Open Look and Motif. These two are incompatible, and aren't, as far as I
know, published. Since Open Look and Motif applications are Xt based,
you can choose to use DND or the specific protocol. This could be a
compile-time option, for example.</LI>
<LI>You can use this protocol with <EM>any</EM> X program. Motif, Open Look
and Athena applications can exchange data using the DND protocol. Non-Xt
programs can incorporate DND protocol too (see section
<A HREF="DragDropHOWTO-3.html#DNDinternals">The DND internals</A>
).</LI>
<LI>A <CODE>C</CODE> Xt interface is provided, so you can add drag and drop
capabilities to an existing Xt program with a minimum effort.</LI>
</UL>
</P>
<P>Of course, there are also reasons to <EM>not</EM> use DND:</P>
<P>
<UL>
<LI>You <EM>must</EM> exchange data between your application and another
that uses another protocol.</LI>
<LI>You don't need drag and drop, and in this case I wonder why are you
still reading this.</LI>
</UL>
</P>
<P>I encourage you to use DND at least as a compile-time option for your program.
There is already a good reason to do that: the ``files'' program furnished with
OffiX. Won't it be good to be able to exchange data with a file manager?
Certainly will! And, as you will note, it's very easy to bring this new
capability to your program.</P>
<P></P>

<H2>1.3 <A NAME="ss1.3"></A> Getting and installing DND</H2>

<P>In the actual stage you can only get the Xt interface for DND. If you want to
use DND in non-Xt applications, you must write some code. It is not a difficult
task to do so (see section 
<A HREF="DragDropHOWTO-3.html#DNDinternals">The DND internals</A>
).</P>
<P>The best way to install the DND Xt interface library is the following:</P>
<P>
<UL>
<LI>Get the OffiX package. It can be found at 
<A HREF="http://gutenberg.lcmi.ufsc.br/OffiX">http://gutenberg.lcmi.ufsc.br/OffiX</A>
</LI>
<LI>Unpack the file somewhere. Edit the file <CODE>Imake.options</CODE> to suit your
needs. If you don't want any OffiX utility installed, don't compile the 
OffiX modules (remove all from <CODE>OFFIX_MODULES</CODE> option).</LI>
<LI>Type the command <CODE>xmkmf ; make Makefiles ; make</CODE></LI>
<LI>As root, type <CODE>make install</CODE></LI>
<LI>As root, type <CODE>make install.man</CODE></LI>
</UL>
</P>
<P>Now you should have the static DND library and the necessary header files
installed on your system. If you are not root and want to compile your program
with DND, just copy the files <CODE>DragAndDrop.c</CODE> and the DND header files from
the OffiX directory and compile and link them with your program.</P>
<P></P>

<H2>1.4 <A NAME="ss1.4"></A> DND and window managers</H2>

<P>There seems to be a strange behaviour when DND programs run under OpenWindows,
at least under the version I have in my work. With FVWM there are no problems
reported yet. If you run DND programs under another window manager, please send
me a 
<A HREF="mailto:c.crusius@ieee.org">note</A>
 telling about the
results.</P>
<P></P>

<HR>
<P>
<A HREF="DragDropHOWTO-2.html">Next</A> Chapter<P>
Table of contents of <A HREF="DragDropHOWTO.html#toc1">this chapter</A>,
 General <A HREF="DragDropHOWTO.html#toc">table of contents</A></P>
<P>
<A HREF="DragDropHOWTO.html">Top</A> of the document,
 <A HREF="#0"> Beginning of this Chapter</A></P>
</BODY>
</HTML>