Пример #1
0
static int
choice_prop_clear(
    AB_PROP_TYPE type
)
{
    PropChoiceSettingsRec	*pcs = &(prop_choice_settings_rec[type]);

    if (pcs->current_obj == NULL)
        return OK;

    /* Clear Name */
    prop_field_set_value(&(pcs->name), "", False);

    /* Clear Label Type/Position */
    prop_options_set_value(&(pcs->label_type), (XtPointer)AB_LABEL_STRING, False);
    prop_options_set_value(&(pcs->label_pos), (XtPointer)AB_CP_WEST, False);

    /* Clear Label */
    ui_set_label_string(pcs->label.label, "Label:");
    prop_field_set_value(&(pcs->label), "", False);

    /* Clear Choice Type*/
    prop_options_set_value(&(pcs->choice_type), (XtPointer)AB_CHOICE_EXCLUSIVE, False);

    /* Clear Row/Columns */
    prop_radiobox_set_value(&(pcs->row_col), (XtPointer)AB_ORIENT_HORIZONTAL, False);
    prop_field_set_value(&(pcs->row_col_count), "", False);

    /* Clear Position */
    prop_geomfield_clear(&(pcs->pos), GEOM_X);
    prop_geomfield_clear(&(pcs->pos), GEOM_Y);

    /* Clear Initial State */
    prop_checkbox_set_value(&(pcs->init_state), AB_STATE_VISIBLE, True, False);
    prop_checkbox_set_value(&(pcs->init_state), AB_STATE_ACTIVE, True, False);

    /* Clear Color */
    prop_colorfield_set_value(&(pcs->bg_color), "", False);
    prop_colorfield_set_value(&(pcs->fg_color), "", False);

    /* Clear Items */
    prop_item_editor_clear(&(pcs->items));

    pcs->current_obj = NULL;

    turnoff_changebars(type);

    return OK;
}
Пример #2
0
/*
** Set the label string on an object
** (converts it to XmString internally, if needed)
*/
void
ui_obj_set_label_string(
    ABObj       obj,
    STRING	label
)
{
    ABObj labelObj   = NULL;
    
    if (obj == NULL)
	return;
	
    switch (obj_get_type(obj))
    {
	case AB_TYPE_BUTTON:
	case AB_TYPE_CHOICE:
	case AB_TYPE_COMBO_BOX:
	case AB_TYPE_LABEL:
	case AB_TYPE_LIST:
	case AB_TYPE_SPIN_BOX:
	case AB_TYPE_SCALE:
	case AB_TYPE_TEXT_FIELD:
	    labelObj = objxm_comp_get_subobj(obj, AB_CFG_LABEL_OBJ);
	    if (labelObj == NULL || objxm_get_widget(labelObj) == NULL)
		return;

	    ui_set_label_string(objxm_get_widget(labelObj), label);
	    break;

	case AB_TYPE_ITEM:
	    switch(obj_get_item_type(obj))
	    {
		case AB_ITEM_FOR_MENU:
		case AB_ITEM_FOR_MENUBAR:
		case AB_ITEM_FOR_CHOICE:
		    labelObj = objxm_comp_get_subobj(obj, AB_CFG_LABEL_OBJ);
		    if (labelObj == NULL || objxm_get_widget(labelObj) == NULL)
			return;

		    ui_set_label_string(objxm_get_widget(labelObj), label);
		    break;

		case AB_ITEM_FOR_COMBO_BOX:
		case AB_ITEM_FOR_LIST:
		case AB_ITEM_FOR_SPIN_BOX:
		    {
			ABObj        p_obj = obj_get_parent(obj);
			Widget       parent = objxm_get_widget(p_obj);
			AB_ITEM_TYPE itype = (AB_ITEM_TYPE)obj_get_subtype(obj);
			int          pos;
			int          num_items;
			XmString     xmitem;
	    
			if (parent != NULL)
			{
			    xmitem = XmStringCreateLocalized(label);
			    pos = obj_get_child_num(obj);
			    pos++; /* XmList starts at 1 */
		
			    if (obj_is_combo_box_item(obj))
				parent = ui_combobox_get_list_widget(parent);
		
			    if (obj_is_list_item(obj) ||
				obj_is_combo_box_item(obj))
				XtVaGetValues(parent,
				    XmNitemCount, &num_items,
				    NULL);
			    else if (obj_is_spin_box_item(obj))
				XtVaGetValues(parent,
				    DtNnumValues, &num_items,
				    NULL);

			    if (pos <= num_items)
			    {
				if (obj_is_list_item(obj) ||
				    obj_is_combo_box_item(obj))
				{
				    XmListReplacePositions(parent, &pos,
					&xmitem, 1);
				}
				else
				{
				    DtSpinBoxDeletePos(parent, pos);
				    DtSpinBoxAddItem(parent, xmitem, pos);
				}
			    }
			    XmStringFree(xmitem);
			}
		    }
		    break;

		default:
		    break;
	    }
	    break;
	    
	case AB_TYPE_BASE_WINDOW:
	case AB_TYPE_DIALOG:
	case AB_TYPE_FILE_CHOOSER:
	    labelObj = objxm_comp_get_subobj(obj, AB_CFG_LABEL_OBJ);
	    if (labelObj == NULL || objxm_get_widget(labelObj) == NULL)
		return;

	    XtVaSetValues(objxm_get_widget(labelObj), XmNtitle, label, NULL);
	    break;

	default:
	    break;
    }
}
Пример #3
0
static int
scale_prop_clear(
    AB_PROP_TYPE type
)
{
    PropScaleSettingsRec	*pss = &(prop_scale_settings_rec[type]);

    if (pss->current_obj == NULL)
	return OK;

    /* Clear Name */
    prop_field_set_value(&(pss->name), "", False);

    /* Clear Label Type/Position */
    prop_options_set_value(&(pss->label_type), (XtPointer)AB_LABEL_STRING, False);
    prop_options_set_value(&(pss->label_pos), (XtPointer)AB_CP_WEST, False);

    /* Clear Label */
    ui_set_label_string(pss->label.label, "Label:");
    prop_field_set_value(&(pss->label), "", False);

    /* Clear Scale Type*/ 
    prop_radiobox_set_value(&(pss->scale_type), (XtPointer)False, False); 

    /* Clear Orientation */
    prop_radiobox_set_value(&(pss->orient),
                            (XtPointer)AB_ORIENT_HORIZONTAL, False);

    /* Clear Direction */
    prop_options_set_value(&(pss->dir), (XtPointer)AB_DIR_LEFT_TO_RIGHT, False);
 
    /* Clear Value Range */
    prop_field_set_value(&(pss->min), "", False);
    prop_field_set_value(&(pss->max), "", False);
    prop_field_set_value(&(pss->incr), "", False);

    /* Clear Decimal Points */
    prop_field_set_value(&(pss->decimal), "", False);

    /* Clear Initial Value/Show Value */ 
    prop_field_set_value(&(pss->ivalue), "", False); 
    prop_checkbox_set_value(&(pss->show_value), True, False, False);

    /* Clear Geometry */
    prop_geomfield_clear(&(pss->geometry), GEOM_X);
    prop_geomfield_clear(&(pss->geometry), GEOM_Y);
    prop_geomfield_clear(&(pss->geometry), GEOM_WIDTH);
    prop_geomfield_clear(&(pss->geometry), GEOM_HEIGHT);
 
    /* Clear Initial State */
    prop_checkbox_set_value(&(pss->init_state), AB_STATE_VISIBLE, True, False);
    prop_checkbox_set_value(&(pss->init_state), AB_STATE_ACTIVE, True, False);

    /* Clear Color */
    prop_colorfield_set_value(&(pss->bg_color), "", False);
    prop_colorfield_set_value(&(pss->fg_color), "", False);

    pss->current_obj = NULL;

    turnoff_changebars(type);

    return OK;
}