Fixes for OpenBSD
[oweals/cde.git] / cde / programs / dtappbuilder / src / libABobj / obj_notifyP.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23
24 /*
25  *      $XConsortium: obj_notifyP.h /main/3 1995/11/06 18:38:04 rswiston $
26  *
27  *      @(#)obj_notifyP.h       1.24 02 Feb 1995        
28  *
29  *      RESTRICTED CONFIDENTIAL INFORMATION:
30  *      
31  *      The information in this document is subject to special
32  *      restrictions in a confidential disclosure agreement between
33  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
34  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
35  *      Sun's specific written approval.  This document and all copies
36  *      and derivative works thereof must be returned or destroyed at
37  *      Sun's request.
38  *
39  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
40  *
41  */
42
43 /*
44  * obj_notifyP.h - object change notification
45  *
46   * Internal files - defines internal data structures, et cetera
47  */
48 #ifndef _ABOBJ_NOTIFYP_H
49 #define _ABOBJ_NOTIFYP_H_
50
51 #include "objP.h"               /* include before obj.h! */
52 #include <ab_private/obj.h>
53 #include <ab_private/obj_notify.h>
54
55 /*
56  * return codes (supplement to util_err.h)
57  */
58 #define OBJ_NOTIFY_BATCHED (100)        /* not an error! */
59
60
61 typedef enum
62 {
63     OBJEV_UNDEF= 0,
64     OBJEV_ALLOW_GEOMETRY_CHANGE,
65     OBJEV_ATT_CHANGE,
66     OBJEV_ALLOW_REPARENT,
67     OBJEV_CREATE,
68     OBJEV_DESTROY,
69     OBJEV_REPARENT,
70     OBJEV_UPDATE,
71     OBJEV_UPDATE_WITH_DATA,
72     OBJ_EVENT_TYPE_NUM_VALUES
73 } OBJ_EVENT_TYPE;
74
75
76 typedef BYTE OBJ_EVENT_MODE;
77 #define OBJEV_MODE_SEND_NOTIFY_EVS      ((OBJ_EVENT_MODE)0x01)
78 #define OBJEV_MODE_SEND_ALLOW_EVS       ((OBJ_EVENT_MODE)0x02)
79 #define OBJEV_MODE_BATCH_NOTIFY_EVS     ((OBJ_EVENT_MODE)0x04)
80 #define OBJEV_MODE_DISALLOW_ALL_EVS     ((OBJ_EVENT_MODE)0x08)
81 #define OBJEV_MODE_NORMAL \
82                 (OBJEV_MODE_SEND_NOTIFY_EVS | OBJEV_MODE_SEND_ALLOW_EVS)
83
84 typedef union
85 {
86     OBJEV_ALLOW_GEOMETRY_CHANGE_INFO    allow_geometry_change;
87     OBJEV_ALLOW_REPARENT_INFO           allow_reparent;
88     OBJEV_ATT_CHANGE_INFO               att_change;
89     OBJEV_CREATE_INFO                   create;
90     OBJEV_DESTROY_INFO                  destroy_info;   /* destroy is C++ key*/
91     OBJEV_REPARENT_INFO                 reparent;
92     OBJEV_UPDATE_INFO                   update;
93     OBJEV_UPDATE_WITH_DATA_INFO         update_with_data;
94 } OBJ_EVENT_EXTRA_INFO;
95
96
97 typedef struct
98 {
99     OBJ_EVENT_TYPE              type;
100     OBJ_EVENT_EXTRA_INFO        info;
101 } OBJ_EVENT, *ObjEvent;
102
103
104 int             objP_notify_push_mode(void);    /* push current set of modes */
105 int             objP_notify_set_mode(OBJ_EVENT_MODE);   /* set a mode */
106 int             objP_notify_clear_mode(OBJ_EVENT_MODE); /* clear a mode */
107 BOOL            objP_notify_mode_is_set(OBJ_EVENT_MODE); /* query mode */
108 int             objP_notify_pop_mode(void);     /*pop to most-recently pushed*/
109 OBJ_EVENT_MODE  objP_notify_get_mode(void);
110 int             objP_notify_get_num_queued(void);
111 BOOL            objP_notify_event_will_queue(void);
112
113 /*
114  * These functions send or queue an event to be sent
115  */
116 int             objP_notify_send_create(ABObj);
117 int             objP_notify_send_destroy(ABObj);
118 int             objP_notify_send_allow_geometry_change(ABObj,
119                         int new_x, int new_y, int new_width, int new_height);
120 int             objP_notify_send_allow_reparent(ABObj, ABObj new_parent);
121 int             objP_notify_send_att_change(ABObj, OBJEV_ATT_FLAGS atts);
122 int             objP_notify_send_geometry_change(ABObj,
123                         int old_x, int old_y, int old_width, int old_height);
124 int             objP_notify_send_rc_geometry_change(ABObj);
125 int             objP_notify_send_name_change(ABObj, ISTRING old_name);
126 int             objP_notify_send_reparent(ABObj, ABObj old_parent);
127 int             objP_notify_send_selected_change(ABObj);
128 int             objP_notify_send_update(ABObj, BOOL update_subtree);
129
130 int             objP_notify_send_update_with_data(
131                         ABObj   obj,
132                         BOOL    update_subtree,
133                         int     update_code,
134                         void    *update_data,
135                         UpdateDataFreeFunc update_data_free_func
136                         );
137
138
139 /*************************************************************************
140 **                                                                      **
141 **      Inline implementation                                           **
142 **                                                                      **
143 *************************************************************************/
144
145 #define objP_notify_mode_is_set(mode) ((objP_notify_get_mode() & (mode)) != 0)
146
147 #endif /* _ABOBJ_NOTIFYP_H_ */
148