2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
25 * $XConsortium: obj_geometry.c /main/3 1995/11/06 18:34:59 rswiston $
27 * @(#)obj_geometry.c 1.10 08 Mar 1994 cde_app_builder/src/libABobj
29 * RESTRICTED CONFIDENTIAL INFORMATION:
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
39 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
45 * obj_geometry.c - geometry management
49 #include "obj_notifyP.h"
51 /*************************************************************************
53 ** Constants (#define and const) **
55 **************************************************************************/
57 /*************************************************************************
59 ** Private Functions (C declarations and macros) **
61 **************************************************************************/
63 /*************************************************************************
67 **************************************************************************/
69 /*************************************************************************
71 ** Function Definitions **
73 **************************************************************************/
75 /*************************************************************************
79 **************************************************************************/
82 obj_get_geometry(ABObj obj, int *x, int *y, int *width, int *height)
94 obj_get_position(ABObj obj, int *x, int *y)
103 obj_get_size(ABObj obj, int *width, int *height)
106 *height= obj->height;
111 /*************************************************************************
115 **************************************************************************/
119 obj_set_geometry(ABObj obj, int newX, int newY, int newWidth, int newHeight)
122 int iRC= 0; /* return code */
125 int oldWidth= obj->width;
126 int oldHeight= obj->height;
127 BOOL changed= ( (oldX != newX)
129 || (oldWidth != newWidth)
130 || (oldHeight != newHeight) );
137 iRC= objP_notify_send_allow_geometry_change(obj,
138 newX, newY, newWidth, newHeight);
146 oldWidth = obj->width;
147 oldHeight = obj->height;
150 obj->width= newWidth;
151 obj->height= newHeight;
153 iReturn= objP_notify_send_geometry_change(
154 obj, oldX, oldY, oldWidth, oldHeight);
162 obj_move(ABObj obj, int newX, int newY)
164 return obj_set_geometry(obj, newX, newY, obj->width, obj->height);
169 obj_resize(ABObj obj, int newWidth, int newHeight)
171 return obj_set_geometry(obj, obj->x, obj->y, newWidth, newHeight);
175 /*************************************************************************
179 **************************************************************************/
182 obj_test_set_geometry(ABObj obj,
183 int newX, int newY, int newHeight, int newWidth)
186 objP_notify_push_mode();
187 objP_notify_clear_mode(OBJEV_MODE_DISALLOW_ALL_EVS);
189 iReturn= objP_notify_send_allow_geometry_change(obj,
190 newX, newY, newHeight, newWidth);
192 objP_notify_pop_mode();
199 obj_test_move(ABObj obj, int newX, int newY)
201 return obj_test_set_geometry(obj, newX, newY, obj->width, obj->height);
206 obj_test_resize(ABObj obj, int newWidth, int newHeight)
208 return obj_test_set_geometry(obj, obj->x, obj->y, newWidth, newHeight);