static void lw_pop_all_widgets (LWLIB_ID id, Boolean up) { widget_info* info = get_widget_info (id, False); widget_instance* instance; if (info) for (instance = info->instances; instance; instance = instance->next) if (instance->pop_up_p && instance->widget) { #if defined (USE_LUCID) if (lw_lucid_widget_p (instance->widget)) { XtRealizeWidget (instance->widget); xlw_pop_instance (instance, up); } #endif #if defined (USE_MOTIF) if (lw_motif_widget_p (instance->widget)) { XtRealizeWidget (instance->widget); xm_pop_instance (instance, up); } #endif #if defined (USE_XAW) if (lw_xaw_widget_p (instance->widget)) { XtRealizeWidget (XtParent (instance->widget)); XtRealizeWidget (instance->widget); xaw_pop_instance (instance, up); } #endif } }
widget_value* lw_get_all_values (LWLIB_ID id) { widget_info* info = get_widget_info (id, False); widget_value* val = info->val; if (lw_get_some_values (id, val)) return val; else return NULL; }
static widget_instance* find_instance (LWLIB_ID id, Widget parent, Boolean pop_up_p) { widget_info* info = get_widget_info (id, False); widget_instance* instance; if (info) for (instance = info->instances; instance; instance = instance->next) if (instance->parent == parent && instance->pop_up_p == pop_up_p) return instance; return NULL; }
int lw_modify_all_widgets (LWLIB_ID id, widget_value* val, Boolean deep_p) { widget_info* info = get_widget_info (id, False); widget_value* new_val; widget_value* next_new_val; widget_value* cur; widget_value* prev; widget_value* next; int found; int change_p = 0; if (!info) return 0; for (new_val = val; new_val; new_val = new_val->next) { next_new_val = new_val->next; new_val->next = NULL; found = False; for (prev = NULL, cur = info->val; cur; prev = cur, cur = cur->next) if (!strcmp (cur->name, new_val->name)) { found = True; next = cur->next; cur->next = NULL; cur = merge_widget_value (cur, new_val, deep_p ? 1000 : 1, &change_p); if (prev) prev->next = cur ? cur : next; else info->val = cur ? cur : next; if (cur) cur->next = next; break; } if (!found) { /* Could not find it, add it */ if (prev) prev->next = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE); else info->val = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE); change_p = 1; } new_val->next = next_new_val; } update_all_widget_values (info, deep_p); return change_p; }
void lw_register_widget (const char* type, const char* name, LWLIB_ID id, widget_value* val, lw_callback pre_activate_cb, lw_callback selection_cb, lw_callback post_activate_cb, lw_callback highlight_cb) { if (!get_widget_info (id, False)) allocate_widget_info (type, name, id, val, pre_activate_cb, selection_cb, post_activate_cb, highlight_cb); }
void lw_destroy_all_widgets (LWLIB_ID id) { widget_info* info = get_widget_info (id, True); widget_instance* instance; widget_instance* next; if (info) { for (instance = info->instances; instance; ) { next = instance->next; destroy_one_instance (instance); instance = next; } free_widget_info (info); } }
Widget lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p) { widget_instance* instance; widget_info* info; instance = find_instance (id, parent, pop_up_p); if (!instance) { info = get_widget_info (id, False); if (!info) return NULL; instance = allocate_widget_instance (info, parent, pop_up_p); initialize_widget_instance (instance); } if (!instance->widget) abort (); return instance->widget; }
Boolean lw_get_some_values (LWLIB_ID id, widget_value *val_out) { widget_info* info = get_widget_info (id, False); widget_instance* instance; widget_value* val; Boolean result = False; if (!info) return False; instance = info->instances; if (!instance) return False; for (val = val_out; val; val = val->next) if (get_one_value (instance, val)) result = True; return result; }
/* Internal function used by the library dependent implementation to get the widget_value for a given widget in an instance */ widget_info * lw_get_widget_info (LWLIB_ID id) { return get_widget_info (id, 0); }