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: pal_list.c /main/5 1996/08/08 18:02:00 mustafa $
27 * @(#)pal_list.c 1.41 15 Feb 1994 cde_app_builder/src/ab
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 * pal_list.c - Implements Palette List object functionality
49 #include <ab_private/obj_notify.h>
50 #include <ab_private/objxm.h>
51 #include <ab_private/ab.h>
52 #include <ab_private/pal.h>
53 #include <ab_private/prop.h>
54 #include <ab_private/abobj.h>
55 #include <ab_private/abobj_set.h>
56 #include <ab_private/abobj_edit.h>
57 #include <ab_private/ui_util.h>
60 const int list_init_width = 130;
62 typedef struct PROP_LIST_SETTINGS
65 PropFieldSettingRec name;
66 PropOptionsSettingRec sel_mode;
67 PropGeometrySettingRec pos;
68 PropRadioSettingRec wth_policy;
69 PropGeometrySettingRec wth;
70 PropOptionsSettingRec hgt_metric;
71 PropGeometrySettingRec hgt;
72 PropOptionsSettingRec label_type;
73 PropFieldSettingRec label;
74 PropOptionsSettingRec label_pos;
75 PropCheckboxSettingRec init_state;
76 PropColorSettingRec bg_color;
77 PropColorSettingRec fg_color;
78 PropMenunameSettingRec menuname;
79 PropFieldSettingRec menu_title;
80 PropFieldSettingRec item_label;
81 PropCheckboxSettingRec item_state;
82 PropItemsSettingRec items;
84 } PropListSettingsRec, *PropListSettings;
86 /*************************************************************************
88 ** Private Function Declarations **
90 **************************************************************************/
94 static int list_initialize(
97 static Widget list_prop_init(
101 static int list_prop_activate(
105 static int list_prop_clear(
108 static int list_prop_load(
111 unsigned long loadkey
113 static int list_prop_apply(
116 static BOOL list_prop_pending(
119 static BOOL verify_props(
122 static void turnoff_changebars(
129 static int prop_list_install_obj_destroy_CB(void);
131 static int prop_list_obj_destroy_CB(
132 ObjEvDestroyInfo destroyInfo
138 static void wth_policyCB(
140 XtPointer clientdata,
141 XmToggleButtonCallbackStruct *state
145 /*************************************************************************
149 **************************************************************************/
150 PalItemInfo list_palitem_rec = {
152 /* type */ AB_TYPE_LIST,
154 /* animation pixmaps*/ NULL,
155 /* number of pixmaps*/ 0,
156 /* rev_prop_frame */ NULL,
157 /* fix_prop_dialog */ NULL,
158 /* initialize */ list_initialize,
159 /* is_a_test */ obj_is_list,
160 /* prop_initialize */ list_prop_init,
161 /* prop_activate */ list_prop_activate,
162 /* prop_clear */ list_prop_clear,
163 /* prop_load */ list_prop_load,
164 /* prop_apply */ list_prop_apply,
165 /* prop_pending */ list_prop_pending
169 PalItemInfo *ab_list_palitem = &list_palitem_rec;
170 PropListSettingsRec prop_list_settings_rec[AB_PROP_TYPE_NUM_VALUES];
173 /*************************************************************************
175 ** Function Definitions **
177 **************************************************************************/
183 AB_LIST_INFO *info = &(obj->info.list);
184 ABObj module = obj_get_module(obj);
189 obj_set_unique_name(obj, "list");
191 obj_set_num_rows(obj, 4);
192 obj_set_height(obj, -1);
193 obj_set_width(obj, list_init_width);
194 obj_set_selection_mode(obj, AB_SELECT_BROWSE);
195 obj_set_is_initially_visible(obj, True);
196 obj_set_is_initially_active(obj, True);
198 /* Add initial items to list */
199 items[0] = catgets(Dtb_project_catd, 6, 70, "itemA");
200 items[1] = catgets(Dtb_project_catd, 6, 71, "itemB");
201 for (i=0; i < XtNumber(items); i++)
203 iobj = obj_create(AB_TYPE_ITEM, NULL);
204 obj_set_subtype(iobj, AB_ITEM_FOR_LIST);
205 obj_append_child(obj, iobj);
206 abobj_set_item_name(iobj, obj_get_module(obj), obj_get_name(obj), items[i]);
207 obj_set_label(iobj, items[i]);
208 obj_set_is_initially_selected(iobj, False);
210 obj_set_attachment(obj, AB_CP_NORTH, AB_ATTACH_POINT, NULL, obj->y);
211 obj_set_attachment(obj, AB_CP_WEST, AB_ATTACH_POINT, NULL, obj->x);
224 DtbListPropDialogInfoRec rev_list_prop_dialog; /* Revolving Props */
225 DtbListPropDialogInfo cgen = &dtb_list_prop_dialog; /* Codegen structure */
226 DtbRevolvPropDialogInfo rpd = &(dtb_revolv_prop_dialog);
227 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
235 if (type == AB_PROP_REVOLVING)
238 * Only the Attributes ControlPanel needs to be created within
239 * the existing Revolving Prop dialog, so fill out all other
240 * fields with the Revolving Prop dialog equivelents, so the
241 * dtb initialize proc will skip those non-NULL fields...
243 dtbListPropDialogInfo_clear(&rev_list_prop_dialog);
245 cgen = &(rev_list_prop_dialog);
246 cgen->prop_dialog = rpd->prop_dialog;
247 cgen->prop_dialog_shellform = rpd->prop_dialog_shellform;
248 cgen->prop_dialog_panedwin = rpd->prop_dialog_panedwin;
249 cgen->prop_dialog_form = rpd->prop_dialog_form;
250 cgen->objlist_panel = rpd->objlist_panel;
251 cgen->objlist_label = rpd->objlist_label2;
252 cgen->objlist_scrolledwin = rpd->objlist_scrolledwin;
253 cgen->objlist = rpd->objlist;
254 cgen->attrs_ctrlpanel_frame = rpd->attrs_ctrlpanel_frame;
255 cgen->activate_panel = rpd->activate_panel;
256 cgen->apply_button = rpd->apply_button;
257 cgen->ok_button = rpd->ok_button;
258 cgen->cancel_button = rpd->cancel_button;
259 cgen->reset_button = rpd->reset_button;
260 cgen->help_button = rpd->help_button;
263 * Get notification of object destruction!
265 prop_list_install_obj_destroy_CB();
268 else /* AB_PROP_FIXED - create entire dialog*/
269 cgen = &dtb_list_prop_dialog;
271 if (dtb_list_prop_dialog_initialize(cgen, parent) == 0)
273 pls->prop_sheet = cgen->attrs_ctrlpanel;
274 pls->current_obj = NULL;
276 if (type == AB_PROP_REVOLVING)
277 XtVaSetValues(parent,
278 XmNuserData, pls->current_obj,
281 /* Dialog/Object List */
282 if (type == AB_PROP_FIXED)
284 prop_fixed_dialog_init(ab_list_palitem,
285 cgen->prop_dialog_shellform, cgen->objlist);
286 prop_activate_panel_init(type, ab_list_palitem,
287 cgen->ok_button, cgen->apply_button,
288 cgen->reset_button, cgen->cancel_button,
292 /* Alternate Editor Buttons */
293 prop_editors_panel_init(type, ab_list_palitem,
294 cgen->attach_button, cgen->conn_button, cgen->helptxt_button);
297 * Prop Sheet Settings....
301 prop_field_init(&(pls->name), cgen->name_field_label,
302 cgen->name_field, cgen->name_cb);
304 /* Label, Type, Position */
306 item[n] = cgen->labeltype_rbox_items.String_item;
307 item_val[n] = AB_LABEL_STRING; n++;
308 item[n] = cgen->labeltype_rbox_items.Graphic_item;
309 item_val[n] = AB_LABEL_GLYPH; n++;
310 prop_options_init(&(pls->label_type), cgen->labeltype_rbox_label,
311 cgen->labeltype_rbox, cgen->labeltype_rbox_menu,
312 n, item, (XtPointer*)item_val,
315 prop_field_init(&(pls->label), cgen->label_field_label,
316 cgen->label_field, cgen->label_cb);
318 prop_label_field_init(&(pls->label), cgen->graphic_hint, item, n);
321 item[n] = cgen->labelpos_rbox_items.Above_item;
322 item_val[n] = AB_CP_NORTH; n++;
323 item[n] = cgen->labelpos_rbox_items.Left_item;
324 item_val[n] = AB_CP_WEST; n++;
325 prop_options_init(&(pls->label_pos), cgen->labelpos_rbox_label,
326 cgen->labelpos_rbox, cgen->labelpos_rbox_menu,
327 n, item, (XtPointer*)item_val,
332 item[n] = cgen->selmode_rbox_items.Single_Select_item;
333 item_val[n] = AB_SELECT_SINGLE; n++;
334 item[n] = cgen->selmode_rbox_items.Browse_Select_item;
335 item_val[n] = AB_SELECT_BROWSE; n++;
336 item[n] = cgen->selmode_rbox_items.Multiple_Select_item;
337 item_val[n] = AB_SELECT_MULTIPLE; n++;
338 item[n] = cgen->selmode_rbox_items.Browse_Multiple_Select_item;
339 item_val[n] = AB_SELECT_BROWSE_MULTIPLE; n++;
340 prop_options_init(&(pls->sel_mode), cgen->selmode_rbox_label,
341 cgen->selmode_rbox, cgen->selmode_rbox_menu,
342 n, item, (XtPointer*)item_val,
346 prop_geomfield_init(&(pls->pos), cgen->pos_label,
347 cgen->x_field_label, cgen->x_field,
348 cgen->y_field_label, cgen->y_field,
349 NULL, NULL, NULL, NULL,
354 item[n] = cgen->wpolicy_rbox_items.Longest_Item_item;
355 item_val[n] = SIZE_OF_CONTENTS_KEY; n++;
356 item[n] = cgen->wpolicy_rbox_items.Fixed_item;
357 item_val[n] = SIZE_FIXED_KEY; n++;
358 prop_radiobox_init(&(pls->wth_policy), cgen->wpolicy_rbox_label,
359 cgen->wpolicy_rbox, n, item, (XtPointer*)item_val,
363 XtAddCallback(item[i], XmNvalueChangedCallback,
364 (XtCallbackProc)prop_size_policyCB, (XtPointer)&(pls->wth));
366 prop_geomfield_init(&(pls->wth), cgen->wpolicy_rbox_label,
367 NULL, NULL, NULL, NULL,
368 cgen->width_field_label, cgen->width_field,
373 prop_geomfield_init(&(pls->hgt), cgen->hgt_opmenu_label,
374 NULL, NULL, NULL, NULL,
376 cgen->height_field_label, cgen->height_field,
380 item[n] = cgen->hgt_opmenu_items.Lines_item;
381 item_val[n] = SIZE_IN_CHARS_KEY; n++;
382 item[n] = cgen->hgt_opmenu_items.Pixels_item;
383 item_val[n] = SIZE_IN_PIXELS_KEY; n++;
384 prop_options_init(&(pls->hgt_metric), cgen->hgt_opmenu_label,
386 cgen->hgt_opmenu_menu,
387 n, item, (XtPointer*)item_val,
392 item[n] = cgen->istate_ckbox_items.Visible_item;
393 item_val[n] = AB_STATE_VISIBLE; n++;
394 item[n] = cgen->istate_ckbox_items.Active_item;
395 item_val[n] = AB_STATE_ACTIVE; n++;
396 prop_checkbox_init(&(pls->init_state), cgen->istate_ckbox_label,
397 cgen->istate_ckbox, n, item, item_val,
401 prop_colorfield_init(&(pls->bg_color), cgen->bg_mbutton,
402 cgen->bg_mbutton_bg_mbutton_menu_items.None_item,
403 cgen->bg_mbutton_bg_mbutton_menu_items.Color_Chooser_item,
404 cgen->bg_swatch, cgen->bg_field, cgen->bg_cb);
406 prop_colorfield_init(&(pls->fg_color), cgen->fg_mbutton,
407 cgen->fg_mbutton_fg_mbutton_menu_items.None_item,
408 cgen->fg_mbutton_fg_mbutton_menu_items.Color_Chooser_item,
409 cgen->fg_swatch, cgen->fg_field, cgen->fg_cb);
412 prop_field_init(&(pls->menu_title), cgen->menutitle_field_label,
413 cgen->menutitle_field, cgen->menutitle_cb);
415 /* Menu Name Setting */
416 prop_menuname_init(&(pls->menuname), type, cgen->menu_label,
417 cgen->menu_mbutton, cgen->menu_field,
418 cgen->name_field, cgen->menu_cb,
420 &(pls->current_obj), True);
425 prop_field_init(&(pls->item_label), cgen->itemlabel_label,
426 cgen->itemlabel_field, cgen->itemlist_cb);
430 item[n] = cgen->itemstate_ckbox_items.Selected_item;
431 item_val[n] = AB_STATE_SELECTED; n++;
432 prop_checkbox_init(&(pls->item_state), NULL,
433 cgen->itemstate_ckbox, n, item, item_val,
436 /* Store Items->Insert menu items in array */
438 item[n] = cgen->item_edit_mbutton_editmenu_items.Add_Before_item;
439 item_val[n] = INSERT_BEFORE; n++;
440 item[n] = cgen->item_edit_mbutton_editmenu_items.Add_After_item;
441 item_val[n] = INSERT_AFTER; n++;
443 /* Store Items->Edit menu_items.items in array */
445 item2[j] = cgen->item_edit_mbutton_editmenu_items.Cut_item;
446 item2_val[j] = AB_EDIT_CUT; j++;
447 item2[j] = cgen->item_edit_mbutton_editmenu_items.Copy_item;
448 item2_val[j] = AB_EDIT_COPY; j++;
449 item2[j] = cgen->item_edit_mbutton_editmenu_items.Paste_item;
450 item2_val[j] = AB_EDIT_PASTE; j++;
451 item2[j] = cgen->item_edit_mbutton_editmenu_items.Delete_item;
452 item2_val[j] = AB_EDIT_DELETE; j++;
453 item2[j] = cgen->item_edit_mbutton_editmenu_items.Change_item;
454 item2_val[j] = EDIT_CHANGE; j++;
456 /* Hook up Item Editing mechanism to Item List */
457 prop_item_editor_init(&(pls->items), AB_ITEM_FOR_LIST,
458 cgen->itemlist, cgen->itemlist_cb,
459 cgen->item_add_button,
460 n, item, item_val, /* Insert */
461 j, item2, item2_val,/* Edit */
462 &(pls->item_label), NULL/*label_type*/, NULL/*graphic_hint*/,
463 NULL/*mnemonic*/, NULL/*accel*/, NULL/*line_style*/,
464 &(pls->item_state), NULL/*submenu*/,
465 &(pls->current_obj));
467 prop_changebars_cleared(pls->prop_sheet);
469 return (cgen->prop_dialog_shellform);
482 ui_set_active(prop_list_settings_rec[type].prop_sheet, active);
493 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
495 if (pls->current_obj == NULL)
499 prop_field_set_value(&(pls->name), "", False);
501 /* Clear Label Type/Position */
502 prop_options_set_value(&(pls->label_type), (XtPointer)AB_LABEL_STRING, False);
503 prop_options_set_value(&(pls->label_pos), (XtPointer)AB_CP_WEST, False);
506 ui_set_label_string(pls->label.label, "Label:");
507 prop_field_set_value(&(pls->label), "", False);
509 /* Clear Selection Mode */
510 prop_options_set_value(&(pls->sel_mode), (XtPointer)AB_SELECT_SINGLE, False);
513 prop_geomfield_clear(&(pls->pos), GEOM_X);
514 prop_geomfield_clear(&(pls->pos), GEOM_Y);
517 prop_radiobox_set_value(&(pls->wth_policy),
518 (XtPointer)SIZE_FIXED_KEY, False);
519 prop_geomfield_clear(&(pls->wth), GEOM_WIDTH);
522 prop_geomfield_clear(&(pls->hgt), GEOM_HEIGHT);
524 /* Clear Initial State */
525 prop_checkbox_set_value(&(pls->init_state), AB_STATE_VISIBLE, True, False);
526 prop_checkbox_set_value(&(pls->init_state), AB_STATE_ACTIVE, True, False);
529 prop_colorfield_set_value(&(pls->bg_color), "", False);
530 prop_colorfield_set_value(&(pls->fg_color), "", False);
532 /* Clear Menu Name/Title */
533 prop_menuname_set_value(&(pls->menuname), "", False);
534 prop_field_set_value(&(pls->menu_title), "", False);
537 prop_item_editor_clear(&(pls->items));
539 pls->current_obj = NULL;
541 turnoff_changebars(type);
551 unsigned long loadkey
554 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
556 BOOL load_all = (loadkey & LoadAll);
561 if (pls->current_obj != NULL)
562 obj = pls->current_obj;
566 else if (!obj_is_list(obj))
569 pls->current_obj = obj;
572 if (load_all || loadkey & LoadName)
573 prop_field_set_value(&(pls->name), obj_get_name(obj), False);
577 /* Load Label Type/Position */
578 prop_options_set_value(&(pls->label_type), (XtPointer)obj->label_type, False);
579 prop_options_set_value(&(pls->label_pos), (XtPointer)obj_get_label_position(obj), False);
582 prop_setup_label_field(&(pls->label), NULL,
583 obj->label_type, obj_get_label(obj), AB_LINE_UNDEF);
585 /* Load Selection Mode */
586 prop_options_set_value(&(pls->sel_mode),
587 (XtPointer)((AB_SELECT_TYPE)obj_get_selection_mode(obj)), False);
589 /* Load Initial State */
590 prop_checkbox_set_value(&(pls->init_state), AB_STATE_VISIBLE,
591 obj_is_initially_visible(obj), False);
592 prop_checkbox_set_value(&(pls->init_state), AB_STATE_ACTIVE,
593 obj_is_initially_active(obj), False);
596 prop_colorfield_set_value(&(pls->bg_color), obj_get_bg_color(obj), False);
597 prop_colorfield_set_value(&(pls->fg_color), obj_get_fg_color(obj), False);
599 /* Load Menu Name/Title */
600 prop_menuname_set_value(&(pls->menuname), obj_get_menu_name(obj), False);
601 prop_field_set_value(&(pls->menu_title), obj_get_menu_title(obj), False);
604 prop_item_editor_load(&(pls->items), obj);
606 turnoff_changebars(type);
610 if (load_all || loadkey & LoadPosition)
611 prop_load_obj_position(obj, &(pls->pos));
614 if (load_all || loadkey & LoadSize)
617 editable = abobj_width_resizable(obj);
618 prop_radiobox_set_value(&(pls->wth_policy), editable?
619 (XtPointer)SIZE_FIXED_KEY :
620 (XtPointer)SIZE_OF_CONTENTS_KEY, False);
622 ui_set_active(pls->wth.w_field, editable);
623 ui_set_active(pls->wth.w_label, editable);
625 prop_geomfield_set_value(&(pls->wth), GEOM_WIDTH,
626 abobj_get_comp_width(obj), False);
629 if (obj_get_num_rows(obj) == -1) /* Size in Pixels */
631 prop_options_set_value(&(pls->hgt_metric), (XtPointer)SIZE_IN_PIXELS_KEY, False);
632 height = abobj_get_comp_height(obj);
634 else /* Size in Chars */
636 prop_options_set_value(&(pls->hgt_metric), (XtPointer)SIZE_IN_CHARS_KEY, False);
637 height = obj_get_num_rows(obj);
639 prop_geomfield_set_value(&(pls->hgt), GEOM_HEIGHT, height, False);
651 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
654 int width_policy, metric, new_w, new_h;
655 BOOL size_chg = False;
656 BOOL reset_bg = False;
657 BOOL reset_fg = False;
659 if (!verify_props(type))
662 if (prop_changed(pls->name.changebar))
664 value = prop_field_get_value(&(pls->name));
665 abobj_set_name(pls->current_obj, value);
668 if (prop_changed(pls->label.changebar) ||
669 prop_changed(pls->label_type.changebar))
671 value = prop_field_get_value(&(pls->label));
673 abobj_set_label(pls->current_obj,
674 (AB_LABEL_TYPE)prop_options_get_value(&(pls->label_type)),
678 abobj_set_label_position(pls->current_obj,
679 (AB_COMPASS_POINT)prop_options_get_value(&(pls->label_pos)));
683 if (prop_changed(pls->sel_mode.changebar))
685 abobj_set_selection_mode(pls->current_obj,
686 (AB_SELECT_TYPE)prop_options_get_value(&(pls->sel_mode)));
688 if (prop_changed(pls->pos.changebar))
690 if (abobj_is_movable(pls->current_obj))
691 abobj_set_xy(pls->current_obj,
692 prop_geomfield_get_value(&(pls->pos), GEOM_X),
693 prop_geomfield_get_value(&(pls->pos), GEOM_Y));
695 if (prop_changed(pls->wth_policy.changebar))
697 width_policy = prop_radiobox_get_value(&(pls->wth_policy));
698 abobj_set_size_policy(pls->current_obj, width_policy == SIZE_FIXED_KEY);
700 if (width_policy == SIZE_FIXED_KEY)
702 new_w = prop_geomfield_get_value(&(pls->wth), GEOM_WIDTH);
703 abobj_set_pixel_width(pls->current_obj, new_w, 0);
707 if (prop_changed(pls->hgt.changebar))
709 metric = (int)prop_options_get_value(&(pls->hgt_metric));
710 new_h = prop_geomfield_get_value(&(pls->hgt), GEOM_HEIGHT);
712 abobj_set_num_rows(pls->current_obj,
713 metric == SIZE_IN_CHARS_KEY? new_h : -1);
715 abobj_set_pixel_height(pls->current_obj,
716 metric == SIZE_IN_PIXELS_KEY? new_h : -1, 0);
720 if (prop_changed(pls->init_state.changebar))
722 abobj_set_visible(pls->current_obj,
723 prop_checkbox_get_value(&(pls->init_state), AB_STATE_VISIBLE));
724 abobj_set_active(pls->current_obj,
725 prop_checkbox_get_value(&(pls->init_state), AB_STATE_ACTIVE));
727 if (prop_changed(pls->fg_color.changebar))
729 value = prop_colorfield_get_value(&(pls->fg_color));
730 abobj_set_foreground_color(pls->current_obj, value);
731 if (util_strempty(value))
734 prop_colorfield_set_value(&(pls->fg_color),
735 obj_get_fg_color(pls->current_obj), False);
737 if (prop_changed(pls->bg_color.changebar))
739 value = prop_colorfield_get_value(&(pls->bg_color));
740 abobj_set_background_color(pls->current_obj, value);
741 if (util_strempty(value))
744 prop_colorfield_set_value(&(pls->bg_color),
745 obj_get_bg_color(pls->current_obj), False);
747 if (prop_changed(pls->menuname.changebar))
749 value = prop_menuname_get_value(&(pls->menuname));
750 abobj_set_menu_name(pls->current_obj, value);
752 prop_menuname_set_value(&(pls->menuname),
753 obj_get_menu_name(pls->current_obj), False);
755 if (prop_changed(pls->menu_title.changebar))
757 value = prop_field_get_value(&(pls->menu_title));
758 abobj_set_menu_title(pls->current_obj, value);
761 if (prop_changed(pls->items.changebar))
763 /* Ensure edits to current item are saved before apply */
764 prop_item_change(&(pls->items), False);
765 prop_item_editor_apply(&(pls->items));
769 abobj_tree_instantiate_changes(pls->current_obj);
771 if (reset_bg || reset_fg) /* Set back to No Color */
772 abobj_reset_colors(pls->current_obj, reset_bg, reset_fg);
776 /* Need to force XmList to be fixed width, since often it's
777 * finicky and snaps back to the width of the longest item...
779 if (obj_get_width(pls->current_obj) != -1)
781 szObj = objxm_comp_get_subobj(pls->current_obj, AB_CFG_SIZE_OBJ);
782 XtVaSetValues(objxm_get_widget(szObj),
783 XmNwidth, obj_get_width(pls->current_obj),
786 abobj_force_dang_form_resize(pls->current_obj);
788 turnoff_changebars(type);
798 return(prop_changebars_pending(prop_list_settings_rec[type].prop_sheet));
806 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
808 if (prop_changed(pls->name.changebar) &&
809 !prop_name_ok(pls->current_obj, pls->name.field))
812 if ((prop_changed(pls->label_type.changebar) || prop_changed(pls->label.changebar)) &&
813 prop_options_get_value(&(pls->label_type)) == (XtPointer)AB_LABEL_GLYPH &&
814 !prop_graphic_filename_ok(pls->label.field, False))
817 if (prop_changed(pls->pos.changebar) &&
818 (!prop_number_ok(pls->pos.x_field, (STRING)XFieldStr, -SHRT_MAX, SHRT_MAX) ||
819 !prop_number_ok(pls->pos.y_field, (STRING)YFieldStr, -SHRT_MAX, SHRT_MAX)))
822 if (prop_changed(pls->wth.changebar) &&
823 !prop_number_ok(pls->wth.w_field, (STRING)WFieldStr, 1, SHRT_MAX))
826 if (prop_changed(pls->hgt.changebar) &&
827 !prop_number_ok(pls->hgt.h_field, (STRING)HFieldStr, 1, SHRT_MAX))
830 if (prop_changed(pls->fg_color.changebar) && !prop_color_ok(pls->fg_color.field))
833 if (prop_changed(pls->bg_color.changebar) && !prop_color_ok(pls->bg_color.field))
836 if (prop_changed(pls->menuname.changebar) && !prop_obj_name_ok(pls->menuname.field,
837 obj_get_module(pls->current_obj), AB_TYPE_MENU, "Menu"))
848 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
850 prop_set_changebar(pls->name.changebar, PROP_CB_OFF);
851 prop_set_changebar(pls->sel_mode.changebar, PROP_CB_OFF);
852 prop_set_changebar(pls->wth_policy.changebar,PROP_CB_OFF);
853 prop_set_changebar(pls->hgt.changebar, PROP_CB_OFF);
854 prop_set_changebar(pls->pos.changebar, PROP_CB_OFF);
855 prop_set_changebar(pls->label_type.changebar,PROP_CB_OFF);
856 prop_set_changebar(pls->label.changebar, PROP_CB_OFF);
857 prop_set_changebar(pls->init_state.changebar,PROP_CB_OFF);
858 prop_set_changebar(pls->bg_color.changebar, PROP_CB_OFF);
859 prop_set_changebar(pls->fg_color.changebar, PROP_CB_OFF);
860 prop_set_changebar(pls->menuname.changebar, PROP_CB_OFF);
861 prop_set_changebar(pls->menu_title.changebar, PROP_CB_OFF);
862 prop_set_changebar(pls->items.changebar, PROP_CB_OFF);
864 prop_changebars_cleared(pls->prop_sheet);
869 * Object destroy callback
872 prop_list_install_obj_destroy_CB()
874 static BOOL callback_installed = False;
876 if (callback_installed)
880 obj_add_destroy_callback(prop_list_obj_destroy_CB, "List Props");
886 prop_list_obj_destroy_CB(ObjEvDestroyInfo destroyInfo)
889 ABObj doomedObj = destroyInfo->obj;
890 PropListSettingsRec *pls;
892 if (!obj_is_list_item(doomedObj))
897 for (i = 0; i < AB_PROP_TYPE_NUM_VALUES; ++i)
899 pls = &(prop_list_settings_rec[i]);
901 if (pls->current_obj == doomedObj)
902 pls->current_obj = NULL;
903 if (pls->items.current_item == doomedObj)
904 pls->items.current_item = NULL;
905 if (pls->items.clipboard_item == doomedObj)
906 pls->items.clipboard_item = NULL;
914 XtPointer clientdata,
915 XmToggleButtonCallbackStruct *state
918 AB_PROP_TYPE type = (AB_PROP_TYPE)clientdata;
919 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
922 /* Width field should ONLY be editable if Size Policy
927 XtVaGetValues(w, XmNuserData, &value, NULL);
928 ui_field_set_editable(pls->wth.w_field, value == SIZE_FIXED_KEY);