source: trunk/gui/class_c/nomdragwindow.c

Last change on this file was 241, checked in by cinc, 18 years ago

WC2007 patches for drag and drop implementation.

File size: 5.3 KB
Line 
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_NOMDragWindow_IMPLEMENTATION_FILE
39#define NOM_NOMDragWindow_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 <glib.h>
49
50#include <gtk/gtk.h>
51
52#include "nomguitk.h"
53
54#include "nomdragwindow.ih"
55
56
57NOM_Scope void NOMLINK impl_NOMDragWindow_displayDragImage(NOMDragWindow* nomSelf,
58 CORBA_Environment *ev)
59{
60 NOMDragWindowData* nomThis=NOMDragWindowGetData(nomSelf);
61 GtkWidget *wgtDrag;
62
63 wgtDrag=NOMDragWindow_queryWindowHandle(nomSelf, NULLHANDLE);
64 gdk_window_shape_combine_mask(wgtDrag->window, _ptrMaskBMPDrag, 0, 0);
65 gdk_window_set_back_pixmap(wgtDrag->window, _ptrPixMapDrag, FALSE);
66}
67
68
69NOM_Scope void NOMLINK impl_NOMDragWindow_displayStopImage(NOMDragWindow* nomSelf,
70 CORBA_Environment *ev)
71{
72 NOMDragWindowData* nomThis=NOMDragWindowGetData(nomSelf);
73 GtkWidget *wgtDrag;
74
75 wgtDrag=NOMDragWindow_queryWindowHandle(nomSelf, NULLHANDLE);
76 gdk_window_shape_combine_mask(wgtDrag->window, _ptrMaskBMPStop, 0, 0);
77 gdk_window_set_back_pixmap(wgtDrag->window, _ptrPixMapStop, FALSE);
78}
79
80
81NOM_Scope void NOMLINK impl_NOMDragWindow_displayCustomImage(NOMDragWindow* nomSelf,
82 const PGdkPixmap ptrPixMap,
83 const PGdkBitmap ptrMaskBMP,
84 CORBA_Environment *ev)
85{
86 /* NOMDragWindowData* nomThis=NOMDragWindowGetData(nomSelf); */
87 GtkWidget *wgtDrag;
88
89 wgtDrag=NOMDragWindow_queryWindowHandle(nomSelf, NULLHANDLE);
90 gdk_window_shape_combine_mask(wgtDrag->window, ptrMaskBMP, 0, 0);
91 gdk_window_set_back_pixmap(wgtDrag->window, ptrPixMap, FALSE);
92}
93
94
95/*
96 Callback which loads a pixmap into the drag widget as soon as it's realized.
97 */
98static void fldrWidgetRealize(GtkWidget * wgtDrag, gpointer ptrUserData)
99{
100 NOMDragWindow* ndw=(NOMDragWindow*)ptrUserData;
101
102 _displayDragImage( ndw, NULLHANDLE);
103
104 return;
105}
106
107/* orbit-idl-c-stubs.c, cs_output_stub line 347 */
108NOM_Scope void NOMLINK impl_NOMDragWindow_nomInit(NOMDragWindow* nomSelf, CORBA_Environment *ev)
109{
110 NOMDragWindowData* nomThis=NOMDragWindowGetData(nomSelf);
111 GtkWidget *wgtDrag;
112 GdkPixbuf *pixBufDrag;
113
114 NOMDragWindow_nomInit_parent(nomSelf, ev);
115
116 wgtDrag=gtk_window_new(GTK_WINDOW_POPUP);
117
118 /*
119 FIXME:
120 In GTK 2.8 use *_HINT_DND instead.
121 */
122 gtk_window_set_type_hint(GTK_WINDOW(wgtDrag), GDK_WINDOW_TYPE_HINT_MENU);
123 gtk_widget_set_app_paintable(GTK_WIDGET(wgtDrag), TRUE);
124
125 /* Get normal drag image */
126 pixBufDrag=gtk_widget_render_icon(wgtDrag, GTK_STOCK_DND, GTK_ICON_SIZE_DND, NULL);
127 gdk_pixbuf_render_pixmap_and_mask(pixBufDrag, &_ptrPixMapDrag, &_ptrMaskBMPDrag, 128);
128
129 gtk_widget_set_size_request(wgtDrag, gdk_pixbuf_get_width(pixBufDrag),
130 gdk_pixbuf_get_height(pixBufDrag));
131 g_object_unref(pixBufDrag);
132
133 /* Get "stop" drag image */
134 pixBufDrag=gtk_widget_render_icon(wgtDrag, GTK_STOCK_STOP, GTK_ICON_SIZE_DND, NULL);
135 gdk_pixbuf_render_pixmap_and_mask(pixBufDrag, &_ptrPixMapStop, &_ptrMaskBMPStop, 128);
136 g_object_unref(pixBufDrag);
137
138 /* Make sure we have a reference to the class so the garbage collector
139 doesn't unload us */
140 g_object_set_data(G_OBJECT(wgtDrag), NOMOBJECT_KEY_STRING, nomSelf);
141
142 g_signal_connect_after(GTK_WIDGET(wgtDrag), "realize", G_CALLBACK(fldrWidgetRealize),
143 (gpointer)nomSelf);
144
145 NOMDragWindow_setWindowHandle(nomSelf, wgtDrag, NULLHANDLE);
146}
147
148
149
150
151
Note: See TracBrowser for help on using the repository browser.