1 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
2 | * Version: CDDL 1.0/LGPL 2.1
|
---|
3 | *
|
---|
4 | * The contents of this file are subject to the COMMON DEVELOPMENT AND
|
---|
5 | * DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
|
---|
6 | * this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at http://www.sun.com/cddl/
|
---|
8 | *
|
---|
9 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
11 | * for the specific language governing rights and limitations under the
|
---|
12 | * License.
|
---|
13 | *
|
---|
14 | * The Original Code is "NOM" Netlabs Object Model
|
---|
15 | *
|
---|
16 | * The Initial Developer of the Original Code is
|
---|
17 | * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
|
---|
18 | * Portions created by the Initial Developer are Copyright (C) 2007
|
---|
19 | * the Initial Developer. All Rights Reserved.
|
---|
20 | *
|
---|
21 | * Contributor(s):
|
---|
22 | *
|
---|
23 | * Alternatively, the contents of this file may be used under the terms of
|
---|
24 | * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
|
---|
25 | * case the provisions of the LGPL are applicable instead of those above. If
|
---|
26 | * you wish to allow use of your version of this file only under the terms of
|
---|
27 | * the LGPL, and not to allow others to use your version of this file under
|
---|
28 | * the terms of the CDDL, indicate your decision by deleting the provisions
|
---|
29 | * above and replace them with the notice and other provisions required by the
|
---|
30 | * LGPL. If you do not delete the provisions above, a recipient may use your
|
---|
31 | * version of this file under the terms of any one of the CDDL or the LGPL.
|
---|
32 | *
|
---|
33 | * ***** END LICENSE BLOCK ***** */
|
---|
34 | /*
|
---|
35 | * And remember, phase 3 is near...
|
---|
36 | */
|
---|
37 |
|
---|
38 | #ifndef NOM_NOMDragInfo_IMPLEMENTATION_FILE
|
---|
39 | #define NOM_NOMDragInfo_IMPLEMENTATION_FILE
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #define INCL_DOS
|
---|
43 | #include <os2.h>
|
---|
44 |
|
---|
45 | #include "nom.h"
|
---|
46 | #include <nomtk.h>
|
---|
47 |
|
---|
48 | #include <gtk/gtk.h>
|
---|
49 |
|
---|
50 | #include "nomguitk.h"
|
---|
51 | #include "nomwindow.h"
|
---|
52 | #include "desktoptypes.h"
|
---|
53 | #include "wpnotebook.h"
|
---|
54 | #include "wpfolderwindow.h"
|
---|
55 | #include "wpfolder.h"
|
---|
56 | #include "wpobject.h"
|
---|
57 |
|
---|
58 | #include "nomdraginfo.ih"
|
---|
59 |
|
---|
60 |
|
---|
61 | NOM_Scope gulong NOMLINK impl_NOMDragInfo_queryNumDragItems(NOMDragInfo* nomSelf,
|
---|
62 | CORBA_Environment *ev)
|
---|
63 | {
|
---|
64 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
65 |
|
---|
66 | if(!_arrayDragItems)
|
---|
67 | return 0;
|
---|
68 |
|
---|
69 | return _arrayDragItems->len;
|
---|
70 | }
|
---|
71 |
|
---|
72 | NOM_Scope gulong NOMLINK impl_NOMDragInfo_addWPObjectToItemList(NOMDragInfo* nomSelf,
|
---|
73 | const PWPObject wpObject,
|
---|
74 | const PWPFolder wpFolder,
|
---|
75 | const PGtkWidget wgtSource,
|
---|
76 | CORBA_Environment *ev)
|
---|
77 | {
|
---|
78 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
79 | DRAGITEM diTemp;
|
---|
80 |
|
---|
81 | diTemp.wgtSource=wgtSource;
|
---|
82 | diTemp.wpObjectSource=wpFolder;
|
---|
83 | diTemp.chrSourceName="";
|
---|
84 | diTemp.wpObject=wpObject;
|
---|
85 | diTemp.chrObjectName="";
|
---|
86 |
|
---|
87 | _arrayDragItems=g_array_append_val(_arrayDragItems, diTemp);
|
---|
88 | return _arrayDragItems->len-1;
|
---|
89 | }
|
---|
90 |
|
---|
91 | NOM_Scope void NOMLINK impl_NOMDragInfo_deleteAllDragItems(NOMDragInfo* nomSelf,
|
---|
92 | CORBA_Environment *ev)
|
---|
93 | {
|
---|
94 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
95 |
|
---|
96 | g_array_set_size(_arrayDragItems, 0);
|
---|
97 | }
|
---|
98 |
|
---|
99 |
|
---|
100 | NOM_Scope CORBA_boolean NOMLINK impl_NOMDragInfo_queryIsItemWPObject(NOMDragInfo* nomSelf,
|
---|
101 | const gulong ulIdx,
|
---|
102 | CORBA_Environment *ev)
|
---|
103 | {
|
---|
104 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
105 | DRAGITEM *pdi;
|
---|
106 |
|
---|
107 | /* Index out of range? */
|
---|
108 | if(ulIdx>=_arrayDragItems->len)
|
---|
109 | return FALSE;
|
---|
110 |
|
---|
111 | pdi=&g_array_index(_arrayDragItems, DRAGITEM, ulIdx);
|
---|
112 |
|
---|
113 | if(!nomIsObj(pdi->wpObject))
|
---|
114 | return FALSE;
|
---|
115 |
|
---|
116 | return TRUE;
|
---|
117 | }
|
---|
118 |
|
---|
119 |
|
---|
120 | NOM_Scope PWPObject NOMLINK impl_NOMDragInfo_queryWPObjectFromItemList(NOMDragInfo* nomSelf,
|
---|
121 | const gulong ulIdx,
|
---|
122 | CORBA_Environment *ev)
|
---|
123 | {
|
---|
124 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
125 | DRAGITEM *pdi;
|
---|
126 |
|
---|
127 | /* Index out of range? */
|
---|
128 | if(ulIdx>=_arrayDragItems->len)
|
---|
129 | return NULL;
|
---|
130 |
|
---|
131 | pdi=&g_array_index(_arrayDragItems, DRAGITEM, ulIdx);
|
---|
132 |
|
---|
133 | if(!nomIsObj(pdi->wpObject))
|
---|
134 | return NULL;
|
---|
135 |
|
---|
136 | return pdi->wpObject;
|
---|
137 | }
|
---|
138 |
|
---|
139 | NOM_Scope void NOMLINK impl_NOMDragInfo_setGdkDragContextPointer(NOMDragInfo* nomSelf,
|
---|
140 | const PGdkDragContext gdkDragContext,
|
---|
141 | CORBA_Environment *ev)
|
---|
142 | {
|
---|
143 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
144 |
|
---|
145 | _dragContext=gdkDragContext;
|
---|
146 | }
|
---|
147 |
|
---|
148 |
|
---|
149 | NOM_Scope PGtkWidget NOMLINK impl_NOMDragInfo_querySourceWidgetHandle(NOMDragInfo* nomSelf,
|
---|
150 | const gulong ulIdx,
|
---|
151 | CORBA_Environment *ev)
|
---|
152 | {
|
---|
153 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
154 | DRAGITEM *pdi;
|
---|
155 |
|
---|
156 | /* Check index */
|
---|
157 | if(ulIdx>=_arrayDragItems->len)
|
---|
158 | return NULLHANDLE;
|
---|
159 |
|
---|
160 | pdi=&g_array_index(_arrayDragItems, DRAGITEM, ulIdx);
|
---|
161 |
|
---|
162 | return pdi->wgtSource;
|
---|
163 | }
|
---|
164 |
|
---|
165 |
|
---|
166 | NOM_Scope PWPObject NOMLINK impl_NOMDragInfo_querySourceWPObject(NOMDragInfo* nomSelf,
|
---|
167 | const gulong ulIdx,
|
---|
168 | CORBA_Environment *ev)
|
---|
169 | {
|
---|
170 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
171 | DRAGITEM *pdi;
|
---|
172 |
|
---|
173 | /* Check index */
|
---|
174 | if(ulIdx>=_arrayDragItems->len)
|
---|
175 | return NULLHANDLE;
|
---|
176 |
|
---|
177 | pdi=&g_array_index(_arrayDragItems, DRAGITEM, ulIdx);
|
---|
178 |
|
---|
179 | return pdi->wpObjectSource;
|
---|
180 | }
|
---|
181 |
|
---|
182 | NOM_Scope GdkDragAction NOMLINK impl_NOMDragInfo_queryChosenDropAction(NOMDragInfo* nomSelf,
|
---|
183 | CORBA_Environment *ev)
|
---|
184 | {
|
---|
185 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
186 |
|
---|
187 | return _dragContext->action;
|
---|
188 | }
|
---|
189 |
|
---|
190 | NOM_Scope void NOMLINK impl_NOMDragInfo_nomInit(NOMDragInfo* nomSelf, CORBA_Environment *ev)
|
---|
191 | {
|
---|
192 | NOMDragInfoData* nomThis=NOMDragInfoGetData(nomSelf);
|
---|
193 |
|
---|
194 | /* Let parent do initializations. */
|
---|
195 | NOMDragInfo_nomInit_parent(nomSelf, ev);
|
---|
196 |
|
---|
197 | /* Create an array holding items being dragged. */
|
---|
198 | _arrayDragItems=g_array_new (FALSE, TRUE, sizeof(DRAGITEM));
|
---|
199 | }
|
---|
200 |
|
---|
201 |
|
---|
202 |
|
---|