X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lwlib%2Flwlib-Xaw.c;h=4cf14dea677e4ef4a946d79b057047615215a2e3;hb=a1655b870904de973c366d85ebdc8adde4ef5e1e;hp=77aeb48b5b9856aa4029bb5b5f6dfe85c902077a;hpb=46f51e794ddb493a8a76ec2f3be00b41e3b0be22;p=chise%2Fxemacs-chise.git diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c index 77aeb48..4cf14de 100644 --- a/lwlib/lwlib-Xaw.c +++ b/lwlib/lwlib-Xaw.c @@ -69,8 +69,8 @@ lw_xaw_widget_p (Widget widget) || XtIsSubclass (widget, labelWidgetClass) || XtIsSubclass (widget, toggleWidgetClass) || XtIsSubclass (widget, gaugeWidgetClass) -#if 0 - || XtIsSubclass (widget, textWidgetClass) +#ifndef NEED_MOTIF + || XtIsSubclass (widget, asciiTextWidgetClass) #endif #endif ); @@ -126,9 +126,6 @@ void xaw_update_one_widget (widget_instance *instance, Widget widget, widget_value *val, Boolean deep_p) { - if (val->args && val->args->nargs) - XtSetValues (widget, val->args->args, val->args->nargs); - if (0) ; #ifdef LWLIB_SCROLLBARS_ATHENA @@ -137,6 +134,13 @@ xaw_update_one_widget (widget_instance *instance, Widget widget, xaw_update_scrollbar (instance, widget, val); } #endif +#ifdef LWLIB_WIDGETS_ATHENA +#ifndef NEED_MOTIF + else if (XtIsSubclass (widget, asciiTextWidgetClass)) + { + } +#endif +#endif #ifdef LWLIB_DIALOGS_ATHENA else if (XtIsSubclass (widget, dialogWidgetClass)) { @@ -146,7 +150,7 @@ xaw_update_one_widget (widget_instance *instance, Widget widget, } #endif /* LWLIB_DIALOGS_ATHENA */ #ifdef LWLIB_WIDGETS_ATHENA - else if (XtIsSubclass (widget, labelWidgetClass)) + else if (XtClass (widget) == labelWidgetClass) { Arg al [1]; XtSetArg (al [0], XtNlabel, val->value); @@ -193,6 +197,9 @@ xaw_update_one_widget (widget_instance *instance, Widget widget, #endif /* LWLIB_WIDGETS_ATHENA */ } #endif /* LWLIB_DIALOGS_ATHENA */ + /* Lastly update our global arg values. */ + if (val->args && val->args->nargs) + XtSetValues (widget, val->args->args, val->args->nargs); } void @@ -220,11 +227,19 @@ xaw_update_one_value (widget_instance *instance, Widget widget, #ifndef NEED_MOTIF else if (XtIsSubclass (widget, asciiTextWidgetClass)) { - Arg al [1]; + Arg al [2]; + String buf = 0; + XtSetArg (al [0], XtNstring, &buf); + XtGetValues (widget, al, 2); + if (val->value) - free (val->value); - XtSetArg (al [0], XtNstring, &val->value); - XtGetValues (widget, al, 1); + { + free (val->value); + val->value = 0; + } + /* I don't think this causes a leak. */ + if (buf) + val->value = strdup (buf); val->edited = True; } #endif @@ -329,8 +344,8 @@ static XtActionsRec xaw_actions [] = { static Boolean actions_initted = False; static Widget -make_dialog (CONST char* name, Widget parent, Boolean pop_up_p, - CONST char* shell_title, CONST char* icon_name, +make_dialog (const char* name, Widget parent, Boolean pop_up_p, + const char* shell_title, const char* icon_name, Boolean text_input_slot, Boolean radio_box, Boolean list, int left_buttons, int right_buttons) @@ -438,8 +453,8 @@ xaw_create_dialog (widget_instance* instance) Widget parent = instance->parent; Widget widget; Boolean pop_up_p = instance->pop_up_p; - CONST char *shell_name = 0; - CONST char *icon_name = 0; + const char *shell_name = 0; + const char *icon_name = 0; Boolean text_input_slot = False; Boolean radio_box = False; Boolean list = False; @@ -788,7 +803,7 @@ xaw_create_progress (widget_instance *instance) int ac = 0; Widget scale = 0; widget_value* val = instance->info->val; - +#if 0 /* This looks too awful, although more correct. */ if (!val->call_data) { XtSetArg (al [ac], XtNsensitive, False); ac++; @@ -797,6 +812,10 @@ xaw_create_progress (widget_instance *instance) { XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; } +#else + XtSetArg (al [ac], XtNsensitive, True); ac++; +#endif + XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++; XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++; XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0);ac++; @@ -817,6 +836,7 @@ xaw_create_progress (widget_instance *instance) } #ifndef NEED_MOTIF +#define TEXT_BUFFER_SIZE 128 static Widget xaw_create_text_field (widget_instance *instance) { @@ -825,22 +845,36 @@ xaw_create_text_field (widget_instance *instance) Widget text = 0; widget_value* val = instance->info->val; - XtSetArg (al [ac], XtNsensitive, val->enabled && val->call_data); ac++; + XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++; XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0); ac++; XtSetArg (al [ac], XtNtype, XawAsciiString); ac++; XtSetArg (al [ac], XtNeditType, XawtextEdit); ac++; + XtSetArg (al [ac], XtNuseStringInPlace, False); ac++; +#if 0 + XtSetArg (al [ac], XtNlength, TEXT_BUFFER_SIZE); ac++; +#endif + if (val->value) + { + XtSetArg (al [ac], XtNstring, val->value); ac++; + } /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); text = XtCreateManagedWidget (val->name, asciiTextWidgetClass, instance->parent, al, ac); + + /* add the callback */ + if (val->call_data) + XtAddCallback (text, XtNgetValue, xaw_generic_callback, (XtPointer)instance); + XtManageChild (text); return text; } #endif + #endif /* LWLIB_WIDGETS_ATHENA */ widget_creation_entry