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_custdlg.c /main/5 1996/08/08 17:59:53 mustafa $
27 * @(#)pal_custdlg.c 1.40 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_custdlg.c - Implements Palette CustomDialog object functionality
49 #include <ab_private/util.h>
50 #include <ab_private/ab.h>
51 #include <ab_private/pal.h>
52 #include <ab_private/proj.h>
53 #include <ab_private/prop.h>
54 #include <ab_private/abobj.h>
55 #include <ab_private/abobj_set.h>
56 #include <ab_private/ui_util.h>
57 #include "custdlg_ui.h"
60 const int custdlg_init_height = 175;
61 const int custdlg_init_width = 380;
63 typedef struct PROP_CUSTDLG_SETTINGS
66 PropObjOptionsSettingRec win_parent;
67 PropFieldSettingRec name;
68 PropFieldSettingRec title;
69 PropRadioSettingRec size_policy;
70 PropGeometrySettingRec geometry;
71 PropRadioSettingRec resize_mode;
72 PropCheckboxSettingRec areas;
73 PropObjOptionsSettingRec default_but;
74 PropObjOptionsSettingRec help_but;
75 PropCheckboxSettingRec init_state;
76 PropColorSettingRec bg_color;
77 PropColorSettingRec fg_color;
79 } PropCustdlgSettingsRec, *PropCustdlgSettings;
81 /*************************************************************************
83 ** Private Function Declarations **
85 **************************************************************************/
89 static int custdlg_initialize(
92 static Widget custdlg_prop_init(
96 static int custdlg_prop_activate(
100 static int custdlg_prop_clear(
103 static int custdlg_prop_load(
106 unsigned long loadkey
108 static int custdlg_prop_apply(
111 static BOOL custdlg_prop_pending(
115 static BOOL verify_props(
118 static void turnoff_changebars(
122 static void custdlg_create_area(
124 AB_CONTAINER_TYPE area_type
126 static void custdlg_create_buttons(
130 static void custdlg_remove_area(
134 static BOOL button_test_func(
137 static BOOL winparent_test_func(
143 /*************************************************************************
147 **************************************************************************/
149 PalItemInfo custdlg_palitem_rec = {
151 /* type */ AB_TYPE_DIALOG,
152 /* name */ "Custom Dialog",
153 /* animation pixmaps*/ NULL,
154 /* number of pixmaps*/ 0,
155 /* rev_prop_frame */ NULL,
156 /* fix_prop_dialog */ NULL,
157 /* initialize */ custdlg_initialize,
158 /* is_a_test */ obj_is_popup_win,
159 /* prop_initialize */ custdlg_prop_init,
160 /* prop_activate */ custdlg_prop_activate,
161 /* prop_clear */ custdlg_prop_clear,
162 /* prop_load */ custdlg_prop_load,
163 /* prop_apply */ custdlg_prop_apply,
164 /* prop_pending */ custdlg_prop_pending
168 PalItemInfo *ab_custdlg_palitem = &custdlg_palitem_rec;
169 PropCustdlgSettingsRec prop_custdlg_settings_rec[AB_PROP_TYPE_NUM_VALUES];
172 /*************************************************************************
174 ** Function Definitions **
176 **************************************************************************/
182 ABObj module = obj_get_module(obj);
188 /* Find MainWindow to be Custom Dialog's Motif parent.
189 * If none exist, window-parent will remain NULL
191 num_wins = obj_get_num_children(module);
192 for (i = 0; i < num_wins; i++)
194 win = obj_get_child(module, i);
195 if (obj_is_base_win(win))
197 obj_set_win_parent(obj, win);
201 obj_set_unique_name(obj, "dialog");
203 obj_set_label(obj, catgets(Dtb_project_catd, 100, 256, "Custom Dialog"));
204 obj_set_bg_color(obj, "white");
205 obj_set_is_initially_visible(obj, False);
206 obj_set_is_initially_active(obj, True);
207 obj_set_width(obj, custdlg_init_width);
208 obj_set_height(obj, custdlg_init_height);
210 /* Create Default Button Panel */
211 apobj = obj_create(AB_TYPE_CONTAINER, obj);
212 obj_set_subtype(apobj, AB_CONT_BUTTON_PANEL);
213 pal_initialize_obj(apobj);
215 /* Create Default Buttons for Button Panel */
216 custdlg_create_buttons(obj, apobj);
228 DtbCustdlgPropDialogInfoRec rev_custdlg_prop_dialog; /* Revolving Props */
229 DtbCustdlgPropDialogInfo cgen = &dtb_custdlg_prop_dialog; /* Codegen structure */
230 DtbRevolvPropDialogInfo rpd = &(dtb_revolv_prop_dialog);
231 PropCustdlgSettingsRec *pcs = &(prop_custdlg_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 dtbCustdlgPropDialogInfo_clear(&rev_custdlg_prop_dialog);
246 cgen = &(rev_custdlg_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 else /* AB_PROP_FIXED */
265 cgen = &dtb_custdlg_prop_dialog;
267 if (dtb_custdlg_prop_dialog_initialize(cgen, parent) == 0)
269 pcs->prop_sheet = cgen->attrs_ctrlpanel;
270 pcs->current_obj = NULL;
272 if (type == AB_PROP_REVOLVING)
273 XtVaSetValues(parent,
274 XmNuserData, pcs->current_obj,
277 /* Dialog/Object List */
278 if (type == AB_PROP_FIXED)
280 prop_fixed_dialog_init(ab_custdlg_palitem,
281 cgen->prop_dialog_shellform, cgen->objlist);
282 prop_activate_panel_init(type, ab_custdlg_palitem,
283 cgen->ok_button, cgen->apply_button,
284 cgen->reset_button, cgen->cancel_button,
288 /* Alternate Editor Buttons */
289 prop_editors_panel_init(type, ab_custdlg_palitem,
290 NULL, cgen->conn_button, cgen->helptxt_button);
293 * Prop Sheet Settings....
297 prop_field_init(&(pcs->name), cgen->name_field_label,
298 cgen->name_field, cgen->name_cb);
302 item[n] = cgen->winparent_opmenu_items.None_item;
303 item_val[n] = NULL; n++;
304 prop_obj_options_init(&(pcs->win_parent), cgen->winparent_opmenu_label,
305 cgen->winparent_opmenu, cgen->winparent_opmenu_menu,
306 n, item, (XtPointer*)item_val,
307 cgen->winparent_cb, True, /* Display module */
308 &(pcs->current_obj), winparent_test_func);
311 prop_field_init(&(pcs->title), cgen->title_field_label, cgen->title_field,
316 item[n] = cgen->resizemode_rbox_items.Adjustable_item;
317 item_val[n] = True; n++;
318 item[n] = cgen->resizemode_rbox_items.Fixed_item;
319 item_val[n] = False; n++;
320 prop_radiobox_init(&(pcs->resize_mode), cgen->resizemode_rbox_label,
321 cgen->resizemode_rbox, n, item, (XtPointer*)item_val,
322 cgen->resizemode_cb);
327 item[n] = cgen->areas_ckbox_items.Button_Panel_item;
328 item_val[n] = AB_CONT_BUTTON_PANEL; n++;
329 item[n] = cgen->areas_ckbox_items.Footer_item;
330 item_val[n] = AB_CONT_FOOTER; n++;
331 prop_checkbox_init(&(pcs->areas), cgen->areas_ckbox_label,
332 cgen->areas_ckbox, n, item, item_val,
337 item[n] = cgen->defaultb_opmenu_items.None_item;
338 item_val[n] = NULL; n++;
339 prop_obj_options_init(&(pcs->default_but), cgen->defaultb_opmenu_label,
340 cgen->defaultb_opmenu, cgen->defaultb_opmenu_menu,
341 n, item, (XtPointer*)item_val,
342 cgen->default_button_cb, False, /* don't display module */
343 &(pcs->current_obj), button_test_func);
347 item[n] = cgen->helpb_opmenu_items.None_item;
348 item_val[n] = NULL; n++;
349 prop_obj_options_init(&(pcs->help_but), cgen->helpb_opmenu_label,
350 cgen->helpb_opmenu, cgen->helpb_opmenu_menu,
351 n, item, (XtPointer*)item_val,
352 cgen->help_button_cb, False, /* don't display module */
353 &(pcs->current_obj), button_test_func);
357 item[n] = cgen->size_policy_rbox_items.Fit_Contents_item;
358 item_val[n] = SIZE_OF_CONTENTS_KEY; n++;
359 item[n] = cgen->size_policy_rbox_items.Fixed_item;
360 item_val[n] = SIZE_FIXED_KEY; n++;
361 prop_radiobox_init(&(pcs->size_policy), cgen->size_policy_rbox_label,
362 cgen->size_policy_rbox, n, item, (XtPointer*)item_val,
363 cgen->size_policy_cb);
366 XtAddCallback(item[i], XmNvalueChangedCallback,
367 (XtCallbackProc)prop_size_policyCB, (XtPointer)&(pcs->geometry));
370 prop_geomfield_init(&(pcs->geometry), cgen->geom_label,
371 NULL, NULL, NULL, NULL,
372 cgen->width_field_label, cgen->width_field,
373 cgen->height_field_label, cgen->height_field,
378 item[n] = cgen->istate_ckbox_items.Visible_item;
379 item_val[n] = AB_STATE_VISIBLE; n++;
380 prop_checkbox_init(&(pcs->init_state), cgen->istate_ckbox_label,
381 cgen->istate_ckbox, n, item, item_val,
385 prop_colorfield_init(&(pcs->bg_color), cgen->bg_mbutton,
386 cgen->bg_mbutton_bg_mbutton_menu_items.None_item,
387 cgen->bg_mbutton_bg_mbutton_menu_items.Color_Chooser_item,
388 cgen->bg_swatch, cgen->bg_field, cgen->bg_cb);
390 prop_colorfield_init(&(pcs->fg_color), cgen->fg_mbutton,
391 cgen->fg_mbutton_fg_mbutton_menu_items.None_item,
392 cgen->fg_mbutton_fg_mbutton_menu_items.Color_Chooser_item,
393 cgen->fg_swatch, cgen->fg_field, cgen->fg_cb);
395 prop_changebars_cleared(pcs->prop_sheet);
397 return (cgen->prop_dialog_shellform);
405 custdlg_prop_activate(
410 ui_set_active(prop_custdlg_settings_rec[type].prop_sheet, active);
421 PropCustdlgSettingsRec *pcs = &(prop_custdlg_settings_rec[type]);
423 if (pcs->current_obj == NULL)
427 prop_field_set_value(&(pcs->name), "", False);
429 /* Clear Window Parent */
430 prop_obj_options_load(&(pcs->win_parent), NULL);
433 prop_field_set_value(&(pcs->title), "", False);
435 /* Clear Resize Mode */
436 prop_radiobox_set_value(&(pcs->resize_mode), (XtPointer)True, False);
438 /* Clear Window Areas */
439 prop_checkbox_set_value(&(pcs->areas), AB_CONT_BUTTON_PANEL, False, False);
440 prop_checkbox_set_value(&(pcs->areas), AB_CONT_FOOTER, False, False);
442 /* Clear Default Button */
443 prop_obj_options_load(&(pcs->default_but), NULL);
445 /* Clear Help Button */
446 prop_obj_options_load(&(pcs->help_but), NULL);
448 /* Clear Size Policy */
449 prop_radiobox_set_value(&(pcs->size_policy), (XtPointer)SIZE_FIXED_KEY, False);
452 prop_geomfield_clear(&(pcs->geometry), GEOM_WIDTH);
453 prop_geomfield_clear(&(pcs->geometry), GEOM_HEIGHT);
455 /* Clear Initial State */
456 prop_checkbox_set_value(&(pcs->init_state), AB_STATE_VISIBLE, True, False);
459 prop_colorfield_set_value(&(pcs->bg_color), "", False);
460 prop_colorfield_set_value(&(pcs->fg_color), "", False);
462 pcs->current_obj = NULL;
464 turnoff_changebars(type);
474 unsigned long loadkey
478 PropCustdlgSettingsRec *pcs = &(prop_custdlg_settings_rec[type]);
479 BOOL load_all = (loadkey & LoadAll);
483 if (pcs->current_obj != NULL)
484 obj = pcs->current_obj;
488 else if (!obj_is_popup_win(obj))
491 pcs->current_obj = obj;
494 if (load_all || loadkey & LoadName)
495 prop_field_set_value(&(pcs->name), obj_get_name(obj), False);
499 /* Load Window Parent */
500 prop_obj_options_load(&(pcs->win_parent), proj_get_project());
501 prop_obj_options_set_value(&(pcs->win_parent),
502 obj_get_win_parent(obj), False);
505 prop_field_set_value(&(pcs->title), obj_get_label(obj), False);
507 /* Load Resize Mode */
508 prop_radiobox_set_value(&(pcs->resize_mode),
509 (XtPointer)obj_get_resizable(obj), False);
511 /* Load Window Areas */
512 area = objxm_comp_custdlg_get_area(obj, AB_CONT_BUTTON_PANEL);
513 prop_checkbox_set_value(&(pcs->areas), AB_CONT_BUTTON_PANEL,
514 area != NULL, False);
516 area = objxm_comp_custdlg_get_area(obj, AB_CONT_FOOTER);
517 prop_checkbox_set_value(&(pcs->areas), AB_CONT_FOOTER,
518 area != NULL, False);
520 /* Load Default Button */
521 prop_obj_options_load(&(pcs->default_but),
522 objxm_comp_custdlg_get_area(obj, AB_CONT_BUTTON_PANEL));
523 prop_obj_options_set_value(&(pcs->default_but),
524 obj_get_default_act_button(obj), False);
526 /* Load Help Button */
527 prop_obj_options_load(&(pcs->help_but),
528 objxm_comp_custdlg_get_area(obj, AB_CONT_BUTTON_PANEL));
529 prop_obj_options_set_value(&(pcs->help_but),
530 obj_get_help_act_button(obj), False);
532 /* Load Size Policy */
533 prop_radiobox_set_value(&(pcs->size_policy),
534 abobj_width_resizable(obj)?
535 (XtPointer)SIZE_FIXED_KEY :
536 (XtPointer)SIZE_OF_CONTENTS_KEY, False);
538 /* Load Initial State */
539 prop_checkbox_set_value(&(pcs->init_state), AB_STATE_VISIBLE,
540 obj_is_initially_visible(obj), False);
543 prop_colorfield_set_value(&(pcs->bg_color), obj_get_bg_color(obj), False);
544 prop_colorfield_set_value(&(pcs->fg_color), obj_get_fg_color(obj), False);
546 turnoff_changebars(type);
550 if (load_all || loadkey & LoadSize)
551 prop_load_obj_size(obj, &(pcs->geometry));
561 PropCustdlgSettingsRec *pcs = &(prop_custdlg_settings_rec[type]);
566 BOOL reset_bg = False;
567 BOOL reset_fg = False;
568 BOOL size_chg = False;
571 if (!verify_props(type))
574 if (prop_changed(pcs->name.changebar))
576 value = prop_field_get_value(&(pcs->name));
577 abobj_set_name(pcs->current_obj, value);
580 if (prop_changed(pcs->win_parent.options.changebar))
582 ABObj win_parent = (ABObj) NULL;
584 win_parent = prop_obj_options_get_value(&(pcs->win_parent));
585 abobj_set_win_parent(pcs->current_obj, win_parent);
587 if (prop_changed(pcs->title.changebar))
589 value = prop_field_get_value(&(pcs->title));
590 abobj_set_label(pcs->current_obj, pcs->current_obj->label_type, value);
593 if (prop_changed(pcs->resize_mode.changebar))
595 abobj_set_resize_mode(pcs->current_obj,
596 (BOOL)prop_radiobox_get_value(&(pcs->resize_mode)));
598 if (prop_changed(pcs->areas.changebar))
600 module = obj_get_module(pcs->current_obj);
603 area = objxm_comp_custdlg_get_area(pcs->current_obj, AB_CONT_BUTTON_PANEL);
604 area_set = prop_checkbox_get_value(&(pcs->areas), AB_CONT_BUTTON_PANEL);
606 if (area != NULL && !area_set) /* Remove Button Panel */
607 custdlg_remove_area(pcs->current_obj, area);
609 else if (area == NULL && area_set) /* Add Button Panel */
610 custdlg_create_area(pcs->current_obj, AB_CONT_BUTTON_PANEL);
613 area = objxm_comp_custdlg_get_area(pcs->current_obj, AB_CONT_FOOTER);
614 area_set = prop_checkbox_get_value(&(pcs->areas), AB_CONT_FOOTER);
616 if (area != NULL && !area_set) /* Remove Footer */
617 custdlg_remove_area(pcs->current_obj, area);
619 else if (area == NULL && area_set) /* Add Footer */
620 custdlg_create_area(pcs->current_obj, AB_CONT_FOOTER);
622 if (prop_changed(pcs->default_but.options.changebar))
624 abobj_set_default_act_button(pcs->current_obj,
625 prop_obj_options_get_value(&(pcs->default_but)));
628 if (prop_changed(pcs->help_but.options.changebar))
630 abobj_set_help_act_button(pcs->current_obj,
631 prop_obj_options_get_value(&(pcs->help_but)));
634 if (prop_changed(pcs->size_policy.changebar))
636 abobj_set_size_policy(pcs->current_obj,
637 prop_radiobox_get_value(&(pcs->size_policy)) == SIZE_FIXED_KEY);
641 if (prop_changed(pcs->geometry.changebar))
643 if (abobj_width_resizable(pcs->current_obj))
645 new_w = prop_geomfield_get_value(&(pcs->geometry), GEOM_WIDTH);
646 abobj_set_pixel_width(pcs->current_obj, new_w, 0);
648 if (abobj_height_resizable(pcs->current_obj))
650 new_h = prop_geomfield_get_value(&(pcs->geometry), GEOM_HEIGHT);
651 abobj_set_pixel_height(pcs->current_obj, new_h, 0);
654 if (prop_changed(pcs->init_state.changebar))
656 abobj_set_visible(pcs->current_obj,
657 prop_checkbox_get_value(&(pcs->init_state), AB_STATE_VISIBLE));
659 if (prop_changed(pcs->fg_color.changebar))
661 value = prop_colorfield_get_value(&(pcs->fg_color));
662 abobj_set_foreground_color(pcs->current_obj, value);
663 if (util_strempty(value))
666 prop_colorfield_set_value(&(pcs->fg_color), obj_get_fg_color(pcs->current_obj), False);
668 if (prop_changed(pcs->bg_color.changebar))
670 value = prop_colorfield_get_value(&(pcs->bg_color));
671 abobj_set_background_color(pcs->current_obj, value);
672 if (util_strempty(value))
675 prop_colorfield_set_value(&(pcs->bg_color), obj_get_bg_color(pcs->current_obj), False);
677 abobj_tree_instantiate_changes(pcs->current_obj);
679 if (reset_bg || reset_fg) /* Set back to No Color */
680 abobj_reset_colors(pcs->current_obj, reset_bg, reset_fg);
682 turnoff_changebars(type);
689 custdlg_prop_pending(
693 return(prop_changebars_pending(prop_custdlg_settings_rec[type].prop_sheet));
701 PropCustdlgSettingsRec *pcs = &(prop_custdlg_settings_rec[type]);
705 if (prop_changed(pcs->name.changebar) && !prop_name_ok(pcs->current_obj, pcs->name.field))
708 if (prop_changed(pcs->areas.changebar))
710 DTB_MODAL_ANSWER answer = DTB_ANSWER_NONE;
713 /* Check Button Panel */
714 area = objxm_comp_custdlg_get_area(pcs->current_obj, AB_CONT_BUTTON_PANEL);
715 area_set = prop_checkbox_get_value(&(pcs->areas), AB_CONT_BUTTON_PANEL);
716 if (area != NULL && !area_set) /* Remove Menubar */
718 pobj = objxm_comp_get_subobj(area, AB_CFG_PARENT_OBJ);
720 if (obj_get_num_children(pobj) > 0)
722 /* Popup Modal Message and wait for answer */
723 dtb_custdlg_remove_bpanel_msg_initialize(
724 &dtb_custdlg_remove_bpanel_msg);
725 answer = dtb_show_modal_message(pcs->areas.checkbox,
726 &dtb_custdlg_remove_bpanel_msg,
728 if (answer == DTB_ANSWER_CANCEL)
733 area = objxm_comp_custdlg_get_area(pcs->current_obj, AB_CONT_FOOTER);
734 area_set = prop_checkbox_get_value(&(pcs->areas), AB_CONT_FOOTER);
735 if (area != NULL && !area_set) /* Remove Footer */
737 pobj = objxm_comp_get_subobj(area, AB_CFG_PARENT_OBJ);
739 if (obj_get_num_children(pobj) > 0)
741 /* Popup Modal Message and wait for answer */
742 dtb_custdlg_remove_footer_msg_initialize(
743 &dtb_custdlg_remove_footer_msg);
744 answer = dtb_show_modal_message(pcs->areas.checkbox,
745 &dtb_custdlg_remove_footer_msg,
747 if (answer == DTB_ANSWER_CANCEL)
753 if (prop_changed(pcs->geometry.changebar) &&
754 (!prop_number_ok(pcs->geometry.w_field, (STRING)WFieldStr, 1, SHRT_MAX) ||
755 !prop_number_ok(pcs->geometry.h_field, (STRING)HFieldStr, 1, SHRT_MAX)))
758 if (prop_changed(pcs->fg_color.changebar) && !prop_color_ok(pcs->fg_color.field))
761 if (prop_changed(pcs->bg_color.changebar) && !prop_color_ok(pcs->bg_color.field))
772 PropCustdlgSettingsRec *pcs = &(prop_custdlg_settings_rec[type]);
774 prop_set_changebar(pcs->name.changebar, PROP_CB_OFF);
775 prop_set_changebar(pcs->win_parent.options.changebar,PROP_CB_OFF);
776 prop_set_changebar(pcs->title.changebar, PROP_CB_OFF);
777 prop_set_changebar(pcs->resize_mode.changebar, PROP_CB_OFF);
778 prop_set_changebar(pcs->areas.changebar, PROP_CB_OFF);
779 prop_set_changebar(pcs->default_but.options.changebar,PROP_CB_OFF);
780 prop_set_changebar(pcs->help_but.options.changebar, PROP_CB_OFF);
781 prop_set_changebar(pcs->size_policy.changebar, PROP_CB_OFF);
782 prop_set_changebar(pcs->geometry.changebar, PROP_CB_OFF);
783 prop_set_changebar(pcs->init_state.changebar, PROP_CB_OFF);
784 prop_set_changebar(pcs->bg_color.changebar, PROP_CB_OFF);
785 prop_set_changebar(pcs->fg_color.changebar, PROP_CB_OFF);
787 prop_changebars_cleared(pcs->prop_sheet);
794 AB_CONTAINER_TYPE area_type
802 pwobj = objxm_comp_get_subobj(obj, AB_CFG_WINDOW_PW_OBJ);
803 workobj = objxm_comp_get_subobj(obj, AB_CFG_PARENT_OBJ);
805 area = obj_create(AB_TYPE_CONTAINER, pwobj);
806 obj_set_subtype(area, area_type);
807 pal_initialize_obj(area);
809 if (area_type == AB_CONT_FOOTER)
811 label = obj_create(AB_TYPE_LABEL, area);
814 pal_initialize_obj(label);
815 obj_set_label(label, catgets(Dtb_project_catd, 100, 264, "footer message"));
816 obj_set_label_alignment(label, AB_ALIGN_LEFT);
817 obj_set_unique_name(label,
818 ab_ident_from_name_and_label(obj_get_name(obj), "label"));
821 * Workaround part1: MainWindow bug that causes MainWindow to shrink
822 * when a MessageWindow area is added
824 XtVaGetValues(objxm_get_widget(workobj),
828 else if (area_type == AB_CONT_BUTTON_PANEL)
829 custdlg_create_buttons(obj, area);
831 abobj_show_tree(area, True);
833 /* Workaround part2 */
834 if (area_type == AB_CONT_FOOTER)
835 XtVaSetValues(objxm_get_widget(workobj),
839 abobj_set_save_needed(obj_get_module(obj), True);
844 custdlg_create_buttons(
850 char *button_names[] = {"button1","button2","button3"};
851 char *button_labels[3];
852 int startpos, endpos;
855 button_labels[0] = catgets(Dtb_project_catd, 100, 265, "Button1");
856 button_labels[1] = catgets(Dtb_project_catd, 100, 266, "Button2");
857 button_labels[2] = catgets(Dtb_project_catd, 100, 267, "Button3");
860 for(i=0; i < XtNumber(button_names); i++)
862 bobj = obj_create(AB_TYPE_BUTTON, area);
863 obj_set_subtype(bobj, AB_BUT_PUSH);
864 obj_set_unique_name(bobj,
865 ab_ident_from_name_and_label(obj_get_name(obj),button_names[i]));
866 obj_set_label(bobj, button_labels[i]);
867 obj_set_is_initially_visible(bobj, True);
868 obj_set_is_initially_active(bobj, True);
869 startpos = endpos + 10;
870 obj_set_attachment(bobj, AB_CP_WEST, AB_ATTACH_GRIDLINE, (void*)startpos, 0);
871 endpos = startpos + 20;
872 obj_set_attachment(bobj, AB_CP_EAST, AB_ATTACH_GRIDLINE, (void*)endpos, 0);
873 obj_set_attachment(bobj, AB_CP_NORTH, AB_ATTACH_POINT, (void*)0, 5);
884 objxm_tree_destroy(area);
885 abobj_set_save_needed(obj_get_module(obj), True);
889 * Test whether a Button should be a candidate to be the dialog's
890 * "Default" button or not
897 ABObj parent = obj_get_root(obj_get_parent(obj));
899 if (obj_is_button(obj))
901 while (obj_is_group(parent))
902 parent = obj_get_root(obj_get_parent(parent));
904 if (obj_get_container_type(parent) == AB_CONT_BUTTON_PANEL)
911 * Test whether an object can be the "Window Parent" of the dialog
918 return(obj_is_base_win(obj));