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 libraries 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
50 #include <ab_private/obj_notify.h>
51 #include <ab_private/objxm.h>
52 #include <ab_private/ab.h>
53 #include <ab_private/pal.h>
54 #include <ab_private/prop.h>
55 #include <ab_private/abobj.h>
56 #include <ab_private/abobj_set.h>
57 #include <ab_private/abobj_edit.h>
58 #include <ab_private/ui_util.h>
61 const int list_init_width = 130;
63 typedef struct PROP_LIST_SETTINGS
66 PropFieldSettingRec name;
67 PropOptionsSettingRec sel_mode;
68 PropGeometrySettingRec pos;
69 PropRadioSettingRec wth_policy;
70 PropGeometrySettingRec wth;
71 PropOptionsSettingRec hgt_metric;
72 PropGeometrySettingRec hgt;
73 PropOptionsSettingRec label_type;
74 PropFieldSettingRec label;
75 PropOptionsSettingRec label_pos;
76 PropCheckboxSettingRec init_state;
77 PropColorSettingRec bg_color;
78 PropColorSettingRec fg_color;
79 PropMenunameSettingRec menuname;
80 PropFieldSettingRec menu_title;
81 PropFieldSettingRec item_label;
82 PropCheckboxSettingRec item_state;
83 PropItemsSettingRec items;
85 } PropListSettingsRec, *PropListSettings;
87 /*************************************************************************
89 ** Private Function Declarations **
91 **************************************************************************/
95 static int list_initialize(
98 static Widget list_prop_init(
102 static int list_prop_activate(
106 static int list_prop_clear(
109 static int list_prop_load(
112 unsigned long loadkey
114 static int list_prop_apply(
117 static BOOL list_prop_pending(
120 static BOOL verify_props(
123 static void turnoff_changebars(
130 static int prop_list_install_obj_destroy_CB(void);
132 static int prop_list_obj_destroy_CB(
133 ObjEvDestroyInfo destroyInfo
139 static void wth_policyCB(
141 XtPointer clientdata,
142 XmToggleButtonCallbackStruct *state
146 /*************************************************************************
150 **************************************************************************/
151 PalItemInfo list_palitem_rec = {
153 /* type */ AB_TYPE_LIST,
155 /* animation pixmaps*/ NULL,
156 /* number of pixmaps*/ 0,
157 /* rev_prop_frame */ NULL,
158 /* fix_prop_dialog */ NULL,
159 /* initialize */ list_initialize,
160 /* is_a_test */ obj_is_list,
161 /* prop_initialize */ list_prop_init,
162 /* prop_activate */ list_prop_activate,
163 /* prop_clear */ list_prop_clear,
164 /* prop_load */ list_prop_load,
165 /* prop_apply */ list_prop_apply,
166 /* prop_pending */ list_prop_pending
170 PalItemInfo *ab_list_palitem = &list_palitem_rec;
171 PropListSettingsRec prop_list_settings_rec[AB_PROP_TYPE_NUM_VALUES];
174 /*************************************************************************
176 ** Function Definitions **
178 **************************************************************************/
184 AB_LIST_INFO *info = &(obj->info.list);
185 ABObj module = obj_get_module(obj);
190 obj_set_unique_name(obj, "list");
192 obj_set_num_rows(obj, 4);
193 obj_set_height(obj, -1);
194 obj_set_width(obj, list_init_width);
195 obj_set_selection_mode(obj, AB_SELECT_BROWSE);
196 obj_set_is_initially_visible(obj, True);
197 obj_set_is_initially_active(obj, True);
199 /* Add initial items to list */
200 items[0] = catgets(Dtb_project_catd, 6, 70, "itemA");
201 items[1] = catgets(Dtb_project_catd, 6, 71, "itemB");
202 for (i=0; i < XtNumber(items); i++)
204 iobj = obj_create(AB_TYPE_ITEM, NULL);
205 obj_set_subtype(iobj, AB_ITEM_FOR_LIST);
206 obj_append_child(obj, iobj);
207 abobj_set_item_name(iobj, obj_get_module(obj), obj_get_name(obj), items[i]);
208 obj_set_label(iobj, items[i]);
209 obj_set_is_initially_selected(iobj, False);
211 obj_set_attachment(obj, AB_CP_NORTH, AB_ATTACH_POINT, NULL, obj->y);
212 obj_set_attachment(obj, AB_CP_WEST, AB_ATTACH_POINT, NULL, obj->x);
225 DtbListPropDialogInfoRec rev_list_prop_dialog; /* Revolving Props */
226 DtbListPropDialogInfo cgen = &dtb_list_prop_dialog; /* Codegen structure */
227 DtbRevolvPropDialogInfo rpd = &(dtb_revolv_prop_dialog);
228 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
236 if (type == AB_PROP_REVOLVING)
239 * Only the Attributes ControlPanel needs to be created within
240 * the existing Revolving Prop dialog, so fill out all other
241 * fields with the Revolving Prop dialog equivelents, so the
242 * dtb initialize proc will skip those non-NULL fields...
244 dtbListPropDialogInfo_clear(&rev_list_prop_dialog);
246 cgen = &(rev_list_prop_dialog);
247 cgen->prop_dialog = rpd->prop_dialog;
248 cgen->prop_dialog_shellform = rpd->prop_dialog_shellform;
249 cgen->prop_dialog_panedwin = rpd->prop_dialog_panedwin;
250 cgen->prop_dialog_form = rpd->prop_dialog_form;
251 cgen->objlist_panel = rpd->objlist_panel;
252 cgen->objlist_label = rpd->objlist_label2;
253 cgen->objlist_scrolledwin = rpd->objlist_scrolledwin;
254 cgen->objlist = rpd->objlist;
255 cgen->attrs_ctrlpanel_frame = rpd->attrs_ctrlpanel_frame;
256 cgen->activate_panel = rpd->activate_panel;
257 cgen->apply_button = rpd->apply_button;
258 cgen->ok_button = rpd->ok_button;
259 cgen->cancel_button = rpd->cancel_button;
260 cgen->reset_button = rpd->reset_button;
261 cgen->help_button = rpd->help_button;
264 * Get notification of object destruction!
266 prop_list_install_obj_destroy_CB();
269 else /* AB_PROP_FIXED - create entire dialog*/
270 cgen = &dtb_list_prop_dialog;
272 if (dtb_list_prop_dialog_initialize(cgen, parent) == 0)
274 pls->prop_sheet = cgen->attrs_ctrlpanel;
275 pls->current_obj = NULL;
277 if (type == AB_PROP_REVOLVING)
278 XtVaSetValues(parent,
279 XmNuserData, pls->current_obj,
282 /* Dialog/Object List */
283 if (type == AB_PROP_FIXED)
285 prop_fixed_dialog_init(ab_list_palitem,
286 cgen->prop_dialog_shellform, cgen->objlist);
287 prop_activate_panel_init(type, ab_list_palitem,
288 cgen->ok_button, cgen->apply_button,
289 cgen->reset_button, cgen->cancel_button,
293 /* Alternate Editor Buttons */
294 prop_editors_panel_init(type, ab_list_palitem,
295 cgen->attach_button, cgen->conn_button, cgen->helptxt_button);
298 * Prop Sheet Settings....
302 prop_field_init(&(pls->name), cgen->name_field_label,
303 cgen->name_field, cgen->name_cb);
305 /* Label, Type, Position */
307 item[n] = cgen->labeltype_rbox_items.String_item;
308 item_val[n] = AB_LABEL_STRING; n++;
309 item[n] = cgen->labeltype_rbox_items.Graphic_item;
310 item_val[n] = AB_LABEL_GLYPH; n++;
311 prop_options_init(&(pls->label_type), cgen->labeltype_rbox_label,
312 cgen->labeltype_rbox, cgen->labeltype_rbox_menu,
313 n, item, (XtPointer*)item_val,
316 prop_field_init(&(pls->label), cgen->label_field_label,
317 cgen->label_field, cgen->label_cb);
319 prop_label_field_init(&(pls->label), cgen->graphic_hint, item, n);
322 item[n] = cgen->labelpos_rbox_items.Above_item;
323 item_val[n] = AB_CP_NORTH; n++;
324 item[n] = cgen->labelpos_rbox_items.Left_item;
325 item_val[n] = AB_CP_WEST; n++;
326 prop_options_init(&(pls->label_pos), cgen->labelpos_rbox_label,
327 cgen->labelpos_rbox, cgen->labelpos_rbox_menu,
328 n, item, (XtPointer*)item_val,
333 item[n] = cgen->selmode_rbox_items.Single_Select_item;
334 item_val[n] = AB_SELECT_SINGLE; n++;
335 item[n] = cgen->selmode_rbox_items.Browse_Select_item;
336 item_val[n] = AB_SELECT_BROWSE; n++;
337 item[n] = cgen->selmode_rbox_items.Multiple_Select_item;
338 item_val[n] = AB_SELECT_MULTIPLE; n++;
339 item[n] = cgen->selmode_rbox_items.Browse_Multiple_Select_item;
340 item_val[n] = AB_SELECT_BROWSE_MULTIPLE; n++;
341 prop_options_init(&(pls->sel_mode), cgen->selmode_rbox_label,
342 cgen->selmode_rbox, cgen->selmode_rbox_menu,
343 n, item, (XtPointer*)item_val,
347 prop_geomfield_init(&(pls->pos), cgen->pos_label,
348 cgen->x_field_label, cgen->x_field,
349 cgen->y_field_label, cgen->y_field,
350 NULL, NULL, NULL, NULL,
355 item[n] = cgen->wpolicy_rbox_items.Longest_Item_item;
356 item_val[n] = SIZE_OF_CONTENTS_KEY; n++;
357 item[n] = cgen->wpolicy_rbox_items.Fixed_item;
358 item_val[n] = SIZE_FIXED_KEY; n++;
359 prop_radiobox_init(&(pls->wth_policy), cgen->wpolicy_rbox_label,
360 cgen->wpolicy_rbox, n, item, (XtPointer*)item_val,
364 XtAddCallback(item[i], XmNvalueChangedCallback,
365 (XtCallbackProc)prop_size_policyCB, (XtPointer)&(pls->wth));
367 prop_geomfield_init(&(pls->wth), cgen->wpolicy_rbox_label,
368 NULL, NULL, NULL, NULL,
369 cgen->width_field_label, cgen->width_field,
374 prop_geomfield_init(&(pls->hgt), cgen->hgt_opmenu_label,
375 NULL, NULL, NULL, NULL,
377 cgen->height_field_label, cgen->height_field,
381 item[n] = cgen->hgt_opmenu_items.Lines_item;
382 item_val[n] = SIZE_IN_CHARS_KEY; n++;
383 item[n] = cgen->hgt_opmenu_items.Pixels_item;
384 item_val[n] = SIZE_IN_PIXELS_KEY; n++;
385 prop_options_init(&(pls->hgt_metric), cgen->hgt_opmenu_label,
387 cgen->hgt_opmenu_menu,
388 n, item, (XtPointer*)item_val,
393 item[n] = cgen->istate_ckbox_items.Visible_item;
394 item_val[n] = AB_STATE_VISIBLE; n++;
395 item[n] = cgen->istate_ckbox_items.Active_item;
396 item_val[n] = AB_STATE_ACTIVE; n++;
397 prop_checkbox_init(&(pls->init_state), cgen->istate_ckbox_label,
398 cgen->istate_ckbox, n, item, item_val,
402 prop_colorfield_init(&(pls->bg_color), cgen->bg_mbutton,
403 cgen->bg_mbutton_bg_mbutton_menu_items.None_item,
404 cgen->bg_mbutton_bg_mbutton_menu_items.Color_Chooser_item,
405 cgen->bg_swatch, cgen->bg_field, cgen->bg_cb);
407 prop_colorfield_init(&(pls->fg_color), cgen->fg_mbutton,
408 cgen->fg_mbutton_fg_mbutton_menu_items.None_item,
409 cgen->fg_mbutton_fg_mbutton_menu_items.Color_Chooser_item,
410 cgen->fg_swatch, cgen->fg_field, cgen->fg_cb);
413 prop_field_init(&(pls->menu_title), cgen->menutitle_field_label,
414 cgen->menutitle_field, cgen->menutitle_cb);
416 /* Menu Name Setting */
417 prop_menuname_init(&(pls->menuname), type, cgen->menu_label,
418 cgen->menu_mbutton, cgen->menu_field,
419 cgen->name_field, cgen->menu_cb,
421 &(pls->current_obj), True);
426 prop_field_init(&(pls->item_label), cgen->itemlabel_label,
427 cgen->itemlabel_field, cgen->itemlist_cb);
431 item[n] = cgen->itemstate_ckbox_items.Selected_item;
432 item_val[n] = AB_STATE_SELECTED; n++;
433 prop_checkbox_init(&(pls->item_state), NULL,
434 cgen->itemstate_ckbox, n, item, item_val,
437 /* Store Items->Insert menu items in array */
439 item[n] = cgen->item_edit_mbutton_editmenu_items.Add_Before_item;
440 item_val[n] = INSERT_BEFORE; n++;
441 item[n] = cgen->item_edit_mbutton_editmenu_items.Add_After_item;
442 item_val[n] = INSERT_AFTER; n++;
444 /* Store Items->Edit menu_items.items in array */
446 item2[j] = cgen->item_edit_mbutton_editmenu_items.Cut_item;
447 item2_val[j] = AB_EDIT_CUT; j++;
448 item2[j] = cgen->item_edit_mbutton_editmenu_items.Copy_item;
449 item2_val[j] = AB_EDIT_COPY; j++;
450 item2[j] = cgen->item_edit_mbutton_editmenu_items.Paste_item;
451 item2_val[j] = AB_EDIT_PASTE; j++;
452 item2[j] = cgen->item_edit_mbutton_editmenu_items.Delete_item;
453 item2_val[j] = AB_EDIT_DELETE; j++;
454 item2[j] = cgen->item_edit_mbutton_editmenu_items.Change_item;
455 item2_val[j] = EDIT_CHANGE; j++;
457 /* Hook up Item Editing mechanism to Item List */
458 prop_item_editor_init(&(pls->items), AB_ITEM_FOR_LIST,
459 cgen->itemlist, cgen->itemlist_cb,
460 cgen->item_add_button,
461 n, item, item_val, /* Insert */
462 j, item2, item2_val,/* Edit */
463 &(pls->item_label), NULL/*label_type*/, NULL/*graphic_hint*/,
464 NULL/*mnemonic*/, NULL/*accel*/, NULL/*line_style*/,
465 &(pls->item_state), NULL/*submenu*/,
466 &(pls->current_obj));
468 prop_changebars_cleared(pls->prop_sheet);
470 return (cgen->prop_dialog_shellform);
483 ui_set_active(prop_list_settings_rec[type].prop_sheet, active);
494 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
496 if (pls->current_obj == NULL)
500 prop_field_set_value(&(pls->name), "", False);
502 /* Clear Label Type/Position */
503 prop_options_set_value(&(pls->label_type), (XtPointer)AB_LABEL_STRING, False);
504 prop_options_set_value(&(pls->label_pos), (XtPointer)AB_CP_WEST, False);
507 ui_set_label_string(pls->label.label, "Label:");
508 prop_field_set_value(&(pls->label), "", False);
510 /* Clear Selection Mode */
511 prop_options_set_value(&(pls->sel_mode), (XtPointer)AB_SELECT_SINGLE, False);
514 prop_geomfield_clear(&(pls->pos), GEOM_X);
515 prop_geomfield_clear(&(pls->pos), GEOM_Y);
518 prop_radiobox_set_value(&(pls->wth_policy),
519 (XtPointer)SIZE_FIXED_KEY, False);
520 prop_geomfield_clear(&(pls->wth), GEOM_WIDTH);
523 prop_geomfield_clear(&(pls->hgt), GEOM_HEIGHT);
525 /* Clear Initial State */
526 prop_checkbox_set_value(&(pls->init_state), AB_STATE_VISIBLE, True, False);
527 prop_checkbox_set_value(&(pls->init_state), AB_STATE_ACTIVE, True, False);
530 prop_colorfield_set_value(&(pls->bg_color), "", False);
531 prop_colorfield_set_value(&(pls->fg_color), "", False);
533 /* Clear Menu Name/Title */
534 prop_menuname_set_value(&(pls->menuname), "", False);
535 prop_field_set_value(&(pls->menu_title), "", False);
538 prop_item_editor_clear(&(pls->items));
540 pls->current_obj = NULL;
542 turnoff_changebars(type);
552 unsigned long loadkey
555 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
557 BOOL load_all = (loadkey & LoadAll);
562 if (pls->current_obj != NULL)
563 obj = pls->current_obj;
567 else if (!obj_is_list(obj))
570 pls->current_obj = obj;
573 if (load_all || loadkey & LoadName)
574 prop_field_set_value(&(pls->name), obj_get_name(obj), False);
578 /* Load Label Type/Position */
579 prop_options_set_value(&(pls->label_type), (XtPointer)obj->label_type, False);
580 prop_options_set_value(&(pls->label_pos), (XtPointer)obj_get_label_position(obj), False);
583 prop_setup_label_field(&(pls->label), NULL,
584 obj->label_type, obj_get_label(obj), AB_LINE_UNDEF);
586 /* Load Selection Mode */
587 prop_options_set_value(&(pls->sel_mode),
588 (XtPointer)((AB_SELECT_TYPE)obj_get_selection_mode(obj)), False);
590 /* Load Initial State */
591 prop_checkbox_set_value(&(pls->init_state), AB_STATE_VISIBLE,
592 obj_is_initially_visible(obj), False);
593 prop_checkbox_set_value(&(pls->init_state), AB_STATE_ACTIVE,
594 obj_is_initially_active(obj), False);
597 prop_colorfield_set_value(&(pls->bg_color), obj_get_bg_color(obj), False);
598 prop_colorfield_set_value(&(pls->fg_color), obj_get_fg_color(obj), False);
600 /* Load Menu Name/Title */
601 prop_menuname_set_value(&(pls->menuname), obj_get_menu_name(obj), False);
602 prop_field_set_value(&(pls->menu_title), obj_get_menu_title(obj), False);
605 prop_item_editor_load(&(pls->items), obj);
607 turnoff_changebars(type);
611 if (load_all || loadkey & LoadPosition)
612 prop_load_obj_position(obj, &(pls->pos));
615 if (load_all || loadkey & LoadSize)
618 editable = abobj_width_resizable(obj);
619 prop_radiobox_set_value(&(pls->wth_policy), editable?
620 (XtPointer)SIZE_FIXED_KEY :
621 (XtPointer)SIZE_OF_CONTENTS_KEY, False);
623 ui_set_active(pls->wth.w_field, editable);
624 ui_set_active(pls->wth.w_label, editable);
626 prop_geomfield_set_value(&(pls->wth), GEOM_WIDTH,
627 abobj_get_comp_width(obj), False);
630 if (obj_get_num_rows(obj) == -1) /* Size in Pixels */
632 prop_options_set_value(&(pls->hgt_metric), (XtPointer)SIZE_IN_PIXELS_KEY, False);
633 height = abobj_get_comp_height(obj);
635 else /* Size in Chars */
637 prop_options_set_value(&(pls->hgt_metric), (XtPointer)SIZE_IN_CHARS_KEY, False);
638 height = obj_get_num_rows(obj);
640 prop_geomfield_set_value(&(pls->hgt), GEOM_HEIGHT, height, False);
652 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
655 int width_policy, metric, new_w, new_h;
656 BOOL size_chg = False;
657 BOOL reset_bg = False;
658 BOOL reset_fg = False;
660 if (!verify_props(type))
663 if (prop_changed(pls->name.changebar))
665 value = prop_field_get_value(&(pls->name));
666 abobj_set_name(pls->current_obj, value);
669 if (prop_changed(pls->label.changebar) ||
670 prop_changed(pls->label_type.changebar))
672 value = prop_field_get_value(&(pls->label));
674 abobj_set_label(pls->current_obj,
675 (AB_LABEL_TYPE)prop_options_get_value(&(pls->label_type)),
679 abobj_set_label_position(pls->current_obj,
680 (AB_COMPASS_POINT)prop_options_get_value(&(pls->label_pos)));
684 if (prop_changed(pls->sel_mode.changebar))
686 abobj_set_selection_mode(pls->current_obj,
687 (AB_SELECT_TYPE)prop_options_get_value(&(pls->sel_mode)));
689 if (prop_changed(pls->pos.changebar))
691 if (abobj_is_movable(pls->current_obj))
692 abobj_set_xy(pls->current_obj,
693 prop_geomfield_get_value(&(pls->pos), GEOM_X),
694 prop_geomfield_get_value(&(pls->pos), GEOM_Y));
696 if (prop_changed(pls->wth_policy.changebar))
698 width_policy = prop_radiobox_get_value(&(pls->wth_policy));
699 abobj_set_size_policy(pls->current_obj, width_policy == SIZE_FIXED_KEY);
701 if (width_policy == SIZE_FIXED_KEY)
703 new_w = prop_geomfield_get_value(&(pls->wth), GEOM_WIDTH);
704 abobj_set_pixel_width(pls->current_obj, new_w, 0);
708 if (prop_changed(pls->hgt.changebar))
710 metric = (int)(intptr_t) prop_options_get_value(&(pls->hgt_metric));
711 new_h = prop_geomfield_get_value(&(pls->hgt), GEOM_HEIGHT);
713 abobj_set_num_rows(pls->current_obj,
714 metric == SIZE_IN_CHARS_KEY? new_h : -1);
716 abobj_set_pixel_height(pls->current_obj,
717 metric == SIZE_IN_PIXELS_KEY? new_h : -1, 0);
721 if (prop_changed(pls->init_state.changebar))
723 abobj_set_visible(pls->current_obj,
724 prop_checkbox_get_value(&(pls->init_state), AB_STATE_VISIBLE));
725 abobj_set_active(pls->current_obj,
726 prop_checkbox_get_value(&(pls->init_state), AB_STATE_ACTIVE));
728 if (prop_changed(pls->fg_color.changebar))
730 value = prop_colorfield_get_value(&(pls->fg_color));
731 abobj_set_foreground_color(pls->current_obj, value);
732 if (util_strempty(value))
735 prop_colorfield_set_value(&(pls->fg_color),
736 obj_get_fg_color(pls->current_obj), False);
738 if (prop_changed(pls->bg_color.changebar))
740 value = prop_colorfield_get_value(&(pls->bg_color));
741 abobj_set_background_color(pls->current_obj, value);
742 if (util_strempty(value))
745 prop_colorfield_set_value(&(pls->bg_color),
746 obj_get_bg_color(pls->current_obj), False);
748 if (prop_changed(pls->menuname.changebar))
750 value = prop_menuname_get_value(&(pls->menuname));
751 abobj_set_menu_name(pls->current_obj, value);
753 prop_menuname_set_value(&(pls->menuname),
754 obj_get_menu_name(pls->current_obj), False);
756 if (prop_changed(pls->menu_title.changebar))
758 value = prop_field_get_value(&(pls->menu_title));
759 abobj_set_menu_title(pls->current_obj, value);
762 if (prop_changed(pls->items.changebar))
764 /* Ensure edits to current item are saved before apply */
765 prop_item_change(&(pls->items), False);
766 prop_item_editor_apply(&(pls->items));
770 abobj_tree_instantiate_changes(pls->current_obj);
772 if (reset_bg || reset_fg) /* Set back to No Color */
773 abobj_reset_colors(pls->current_obj, reset_bg, reset_fg);
777 /* Need to force XmList to be fixed width, since often it's
778 * finicky and snaps back to the width of the longest item...
780 if (obj_get_width(pls->current_obj) != -1)
782 szObj = objxm_comp_get_subobj(pls->current_obj, AB_CFG_SIZE_OBJ);
783 XtVaSetValues(objxm_get_widget(szObj),
784 XmNwidth, obj_get_width(pls->current_obj),
787 abobj_force_dang_form_resize(pls->current_obj);
789 turnoff_changebars(type);
799 return(prop_changebars_pending(prop_list_settings_rec[type].prop_sheet));
807 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
809 if (prop_changed(pls->name.changebar) &&
810 !prop_name_ok(pls->current_obj, pls->name.field))
813 if ((prop_changed(pls->label_type.changebar) || prop_changed(pls->label.changebar)) &&
814 prop_options_get_value(&(pls->label_type)) == (XtPointer)AB_LABEL_GLYPH &&
815 !prop_graphic_filename_ok(pls->label.field, False))
818 if (prop_changed(pls->pos.changebar) &&
819 (!prop_number_ok(pls->pos.x_field, (STRING)XFieldStr, -SHRT_MAX, SHRT_MAX) ||
820 !prop_number_ok(pls->pos.y_field, (STRING)YFieldStr, -SHRT_MAX, SHRT_MAX)))
823 if (prop_changed(pls->wth.changebar) &&
824 !prop_number_ok(pls->wth.w_field, (STRING)WFieldStr, 1, SHRT_MAX))
827 if (prop_changed(pls->hgt.changebar) &&
828 !prop_number_ok(pls->hgt.h_field, (STRING)HFieldStr, 1, SHRT_MAX))
831 if (prop_changed(pls->fg_color.changebar) && !prop_color_ok(pls->fg_color.field))
834 if (prop_changed(pls->bg_color.changebar) && !prop_color_ok(pls->bg_color.field))
837 if (prop_changed(pls->menuname.changebar) && !prop_obj_name_ok(pls->menuname.field,
838 obj_get_module(pls->current_obj), AB_TYPE_MENU, "Menu"))
849 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
851 prop_set_changebar(pls->name.changebar, PROP_CB_OFF);
852 prop_set_changebar(pls->sel_mode.changebar, PROP_CB_OFF);
853 prop_set_changebar(pls->wth_policy.changebar,PROP_CB_OFF);
854 prop_set_changebar(pls->hgt.changebar, PROP_CB_OFF);
855 prop_set_changebar(pls->pos.changebar, PROP_CB_OFF);
856 prop_set_changebar(pls->label_type.changebar,PROP_CB_OFF);
857 prop_set_changebar(pls->label.changebar, PROP_CB_OFF);
858 prop_set_changebar(pls->init_state.changebar,PROP_CB_OFF);
859 prop_set_changebar(pls->bg_color.changebar, PROP_CB_OFF);
860 prop_set_changebar(pls->fg_color.changebar, PROP_CB_OFF);
861 prop_set_changebar(pls->menuname.changebar, PROP_CB_OFF);
862 prop_set_changebar(pls->menu_title.changebar, PROP_CB_OFF);
863 prop_set_changebar(pls->items.changebar, PROP_CB_OFF);
865 prop_changebars_cleared(pls->prop_sheet);
870 * Object destroy callback
873 prop_list_install_obj_destroy_CB(void)
875 static BOOL callback_installed = False;
877 if (callback_installed)
881 obj_add_destroy_callback(prop_list_obj_destroy_CB, "List Props");
887 prop_list_obj_destroy_CB(ObjEvDestroyInfo destroyInfo)
890 ABObj doomedObj = destroyInfo->obj;
891 PropListSettingsRec *pls;
893 if (!obj_is_list_item(doomedObj))
898 for (i = 0; i < AB_PROP_TYPE_NUM_VALUES; ++i)
900 pls = &(prop_list_settings_rec[i]);
902 if (pls->current_obj == doomedObj)
903 pls->current_obj = NULL;
904 if (pls->items.current_item == doomedObj)
905 pls->items.current_item = NULL;
906 if (pls->items.clipboard_item == doomedObj)
907 pls->items.clipboard_item = NULL;
915 XtPointer clientdata,
916 XmToggleButtonCallbackStruct *state
919 AB_PROP_TYPE type = (AB_PROP_TYPE)clientdata;
920 PropListSettingsRec *pls = &(prop_list_settings_rec[type]);
923 /* Width field should ONLY be editable if Size Policy
928 XtVaGetValues(w, XmNuserData, &value, NULL);
929 ui_field_set_editable(pls->wth.w_field, value == SIZE_FIXED_KEY);