]> Pileus Git - ~andy/gtk/blob - gtk/gtkwin32embed.h
743af3ccc9dfbcecac951ad965137b40eb5a3144
[~andy/gtk] / gtk / gtkwin32embed.h
1 /* GTK - The GIMP Toolkit
2  * gtkwin32embed.h: Utilities for Win32 embedding
3  * Copyright (C) 2005, Novell, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 /* By Tor Lillqvist <tml@novell.com> 2005 */
22
23 #ifndef __GTK_WIN32_EMBED_H__
24 #define __GTK_WIN32_EMBED_H__
25
26 G_BEGIN_DECLS
27
28 #define GTK_WIN32_EMBED_PROTOCOL_VERSION 1
29
30 /*
31  * When the plug and socket are in separate processes they use a
32  * simple protocol, more or less based on XEMBED. The protocol uses
33  * registered window messages. The name passed to
34  * RegisterWindowMessage() is gtk-win32-embed:%d, with %d being the
35  * numeric value of an GtkWin32EmbedMessageType enum. Each message
36  * carries the message type enum value and two integers, the "wparam"
37  * and "lparam", like all window messages.
38  *
39  * So far all the window messages are posted to the other
40  * process. Maybe some later enhancement will add also messages that
41  * are sent, i.e. where the sending process waits for the receiving
42  * process's window procedure to handle the message.
43  */
44
45 typedef enum {                                  /* send or post? */
46   /* First those sent from the socket
47    * to the plug
48    */
49   GTK_WIN32_EMBED_WINDOW_ACTIVATE,              /* post */
50   GTK_WIN32_EMBED_WINDOW_DEACTIVATE,            /* post */
51   GTK_WIN32_EMBED_FOCUS_IN,                     /* post */
52   GTK_WIN32_EMBED_FOCUS_OUT,                    /* post */
53   GTK_WIN32_EMBED_MODALITY_ON,                  /* post */
54   GTK_WIN32_EMBED_MODALITY_OFF,                 /* post */
55
56   /* Then the ones sent from the plug
57    * to the socket.
58    */
59   GTK_WIN32_EMBED_PARENT_NOTIFY,                /* post */
60   GTK_WIN32_EMBED_EVENT_PLUG_MAPPED,            /* post */
61   GTK_WIN32_EMBED_PLUG_RESIZED,                 /* post */
62   GTK_WIN32_EMBED_REQUEST_FOCUS,                /* post */
63   GTK_WIN32_EMBED_FOCUS_NEXT,                   /* post */
64   GTK_WIN32_EMBED_FOCUS_PREV,                   /* post */
65   GTK_WIN32_EMBED_GRAB_KEY,                     /* post */
66   GTK_WIN32_EMBED_UNGRAB_KEY,                   /* post */
67   GTK_WIN32_EMBED_LAST
68 } GtkWin32EmbedMessageType;
69
70 /* wParam values for GTK_WIN32_EMBED_FOCUS_IN: */
71 #define GTK_WIN32_EMBED_FOCUS_CURRENT 0
72 #define GTK_WIN32_EMBED_FOCUS_FIRST 1
73 #define GTK_WIN32_EMBED_FOCUS_LAST 2
74
75 /* Flags for lParam in GTK_WIN32_EMBED_FOCUS_IN, GTK_WIN32_EMBED_FOCUS_NEXT,
76  * GTK_WIN32_EMBED_FOCUS_PREV
77  */
78 #define GTK_WIN32_EMBED_FOCUS_WRAPAROUND         (1 << 0)
79
80 guint _gtk_win32_embed_message_type (GtkWin32EmbedMessageType type);
81 void _gtk_win32_embed_push_message (MSG *msg);
82 void _gtk_win32_embed_pop_message (void);
83 void _gtk_win32_embed_send (GdkWindow               *recipient,
84                             GtkWin32EmbedMessageType message,
85                             WPARAM                   wparam,
86                             LPARAM                   lparam);
87 void _gtk_win32_embed_send_focus_message (GdkWindow               *recipient,
88                                           GtkWin32EmbedMessageType message,
89                                           WPARAM                   wparam);
90 void     _gtk_win32_embed_set_focus_wrapped  (void);
91 gboolean _gtk_win32_embed_get_focus_wrapped  (void);
92
93 G_END_DECLS
94
95 #endif /*  __GTK_WIN32_EMBED_H__ */