uploaded original spice-server-0.12.4 and celt-0.5.1.3
[sdk/emulator/libs/spice-server.git] / spice-common / spice-protocol / spice / foreign_menu_prot.h
1 /*
2    Copyright (C) 2009 Red Hat, Inc.
3
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8
9    This library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with this library; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef _H_FOREIGN_MENU_PROT
19 #define _H_FOREIGN_MENU_PROT
20
21 #include <spice/types.h>
22 #include <spice/start-packed.h>
23
24 #define FOREIGN_MENU_MAGIC      (*(uint32_t*)"FRGM")
25 #define FOREIGN_MENU_VERSION    1
26
27 typedef struct SPICE_ATTR_PACKED FrgMenuInitHeader {
28     uint32_t magic;
29     uint32_t version;
30     uint32_t size;
31 } FrgMenuInitHeader;
32
33 typedef struct SPICE_ATTR_PACKED FrgMenuInit {
34     FrgMenuInitHeader base;
35     uint64_t credentials;
36     uint8_t title[0]; //UTF8
37 } FrgMenuInit;
38
39 typedef struct SPICE_ATTR_PACKED FrgMenuMsg {
40     uint32_t id;
41     uint32_t size;
42 } FrgMenuMsg;
43
44 enum {
45     //extrenal app -> spice client
46     FOREIGN_MENU_SET_TITLE = 1,
47     FOREIGN_MENU_ADD_ITEM,
48     FOREIGN_MENU_MODIFY_ITEM,
49     FOREIGN_MENU_REMOVE_ITEM,
50     FOREIGN_MENU_CLEAR,
51
52     //spice client -> external app
53     FOREIGN_MENU_ITEM_EVENT = 1001,
54     FOREIGN_MENU_APP_ACTIVATED,
55     FOREIGN_MENU_APP_DEACTIVATED,
56 };
57
58 typedef struct SPICE_ATTR_PACKED FrgMenuSetTitle {
59     FrgMenuMsg base;
60     uint8_t string[0]; //UTF8
61 } FrgMenuSetTitle;
62
63 enum {
64     FOREIGN_MENU_ITEM_TYPE_CHECKED      = 1 << 0,
65     FOREIGN_MENU_ITEM_TYPE_DIM          = 1 << 1,
66     FOREIGN_MENU_ITEM_TYPE_SEPARATOR    = 1 << 2
67 };
68
69 #define FOREIGN_MENU_INVALID_ID 0
70
71 typedef struct SPICE_ATTR_PACKED FrgMenuAddItem {
72     FrgMenuMsg base;
73     uint32_t id;
74     uint32_t type;
75     uint32_t position;
76     uint8_t string[0]; //UTF8
77 } FrgMenuAddItem, FrgMenuModItem;
78
79 typedef struct SPICE_ATTR_PACKED FrgMenuRmItem {
80     FrgMenuMsg base;
81     uint32_t id;
82 } FrgMenuRmItem;
83
84 typedef struct FrgMenuMsg FrgMenuRmItems;
85 typedef struct FrgMenuMsg FrgMenuDelete;
86
87 enum {
88     FOREIGN_MENU_EVENT_CLICK,
89     FOREIGN_MENU_EVENT_CHECKED,
90     FOREIGN_MENU_EVENT_UNCHECKED
91 };
92
93 typedef struct SPICE_ATTR_PACKED FrgMenuEvent {
94     FrgMenuMsg base;
95     uint32_t id;
96     uint32_t action; //FOREIGN_MENU_EVENT_?
97 } FrgMenuEvent;
98
99 typedef struct FrgMenuMsg FrgMenuActivate;
100 typedef struct FrgMenuMsg FrgMenuDeactivate;
101
102 #include <spice/end-packed.h>
103
104 #endif