summaryrefslogtreecommitdiff
path: root/lwlib
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>1999-07-21 21:43:52 +0000
committerGerd Moellmann <gerd@gnu.org>1999-07-21 21:43:52 +0000
commitda88f5921810efc44d46f972f8808920f6ed84e5 (patch)
tree5c4b61d8ed4d51e01e479f0f6fa1da457497ae39 /lwlib
parentcedccd2efa892887439e13957d451fc2d84be883 (diff)
(lw_separator_p): New.
(merge_widget_value): Handle button_type. (copy_widget_value_tree): Copy button_type.
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/lwlib.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index f6734038fe0..f17d231a677 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -238,6 +238,7 @@ copy_widget_value_tree (val, change)
copy->value = safe_strdup (val->value);
copy->key = safe_strdup (val->key);
copy->enabled = val->enabled;
+ copy->button_type = val->button_type;
copy->selected = val->selected;
copy->edited = False;
copy->change = change;
@@ -493,6 +494,13 @@ merge_widget_value (val1, val2, level)
change = max (change, VISIBLE_CHANGE);
val1->enabled = val2->enabled;
}
+ if (val1->button_type != val2->button_type)
+ {
+ EXPLAIN (val1->name, change, VISIBLE_CHANGE, "button type change",
+ val1->button_type, val2->button_type);
+ change = max (change, VISIBLE_CHANGE);
+ val1->button_type = val2->button_type;
+ }
if (val1->selected != val2->selected)
{
EXPLAIN (val1->name, change, VISIBLE_CHANGE, "selection change",
@@ -1387,3 +1395,73 @@ lw_allow_resizing (w, flag)
xm_manage_resizing (w, flag);
#endif
}
+
+
+/* Value is non-zero if LABEL is a menu separator. If it is, *TYPE is
+ set to an appropriate enumerator of type enum menu_separator.
+ MOTIF_P non-zero means map separator types not supported by Motif
+ to similar ones that are supported. */
+
+int
+lw_separator_p (label, type, motif_p)
+ char *label;
+ enum menu_separator *type;
+ int motif_p;
+{
+ int separator_p;
+
+ if (strlen (label) >= 3
+ && bcmp (label, "--:", 3) == 0)
+ {
+ static struct separator_table
+ {
+ char *name;
+ enum menu_separator type;
+ }
+ separator_names[] =
+ {
+ "noLine", SEPARATOR_NO_LINE,
+ "singleLine", SEPARATOR_SINGLE_LINE,
+ "doubleLine", SEPARATOR_DOUBLE_LINE,
+ "singleDashedLine", SEPARATOR_SINGLE_DASHED_LINE,
+ "doubleDashedLine", SEPARATOR_DOUBLE_DASHED_LINE,
+ "shadowEtchedIn", SEPARATOR_SHADOW_ETCHED_IN,
+ "shadowEtchedOut", SEPARATOR_SHADOW_ETCHED_OUT,
+ "shadowEtchedInDash", SEPARATOR_SHADOW_ETCHED_IN_DASH,
+ "shadowEtchedOutDash", SEPARATOR_SHADOW_ETCHED_OUT_DASH,
+ "shadowDoubleEtchedIn", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN,
+ "shadowDoubleEtchedOut", SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT,
+ "shadowDoubleEtchedInDash", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN_DASH,
+ "shadowDoubleEtchedOutDash", SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT_DASH,
+ 0
+ };
+
+ int i;
+
+ label += 3;
+ for (i = 0; separator_names[i].name; ++i)
+ if (strcmp (label, separator_names[i].name) == 0)
+ {
+ separator_p = 1;
+ *type = separator_names[i].type;
+
+ /* If separator type is not supported under Motif,
+ use a similar one. */
+ if (motif_p && *type >= SEPARATOR_SHADOW_DOUBLE_ETCHED_IN)
+ *type -= 4;
+ break;
+ }
+ }
+ else
+ {
+ /* Old-style separator, maybe. It's a separator if it contains
+ only dashes. */
+ while (*label == '-')
+ ++label;
+ separator_p = *label == 0;
+ *type = SEPARATOR_SHADOW_ETCHED_IN;
+ }
+
+ return separator_p;
+}
+