Mercurial > emacs
annotate oldXMenu/AddSel.c @ 109173:33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
* lwlib-Xaw.c (xaw_generic_callback, command_reset)
(xaw_update_one_value): Reformat.
(xaw_update_one_widget): Reformat and remove dead code.
(xaw_scrollbar_scroll, xaw_scrollbar_jump, xaw_create_scrollbar)
(xaw_update_scrollbar): Remove (not used).
(make_dialog): Change from K&R to prototype. Remove dead code.
(xaw_creation_table): Remove scrollbar entry.
* lwlib-Xlw.c (x_print_complete_resource_name): Change from K&R to
prototype.
(xlw_update_one_value): Reformat.
* lwlib-Xm.c (x_print_complete_resource_name)
(make_destroyed_instance, free_destroyed_instance, first_child)
(lw_motif_widget_p, resource_motif_string, destroy_all_children)
(xm_arm_callback, xm_update_label, xm_update_list)
(xm_update_pushbutton, xm_update_cascadebutton)
(xm_update_toggle, xm_update_radiobox, make_menu_in_widget)
(update_one_menu_entry, xm_update_menu, xm_update_text)
(xm_update_text_field, xm_update_one_widget)
(xm_update_one_value, activate_button, dialog_key_cb)
(make_dialog, mark_dead_instance_destroyed)
(find_matching_instance, recenter_widget, recycle_instance)
(xm_create_dialog, make_menubar, remove_grabs, make_popup_menu)
(make_main, xm_destroy_instance, xm_popup_menu)
(set_min_dialog_size, xm_pop_instance, do_call)
(xm_internal_update_other_instances, xm_generic_callback)
(xm_nosel_callback, xm_pull_down_callback, xm_pop_down_callback)
(xm_set_keyboard_focus, xm_set_main_areas, xm_manage_resizing): Change
from K&R to prototype.
* lwlib-int.h (widget_creation_function): Fix prototype.
* lwlib.c (allocate_widget_info, lw_register_widget): Change from K&R
to prototype.
(lw_internal_update_other_instances, merge_widget_value): Reformat.
* xlwmenu.c (size_menu_item): Change from K&R to prototype.
Change label_width and height to int.
(draw_arrow, draw_shadow_rectangle, draw_shadow_rhombus)
(draw_separator, display_menu, fit_to_screen, motion_event_is_in_menu)
(map_event_to_widget_value): Reformat.
(display_menu_item): Change from K&R to prototype.
author | Jan D <jan.h.d@swipnet.se> |
---|---|
date | Thu, 08 Jul 2010 12:29:51 +0200 |
parents | 5cc91198ffb2 |
children | ef719132ddfa |
rev | line source |
---|---|
76174
fec5e03aaf59
Remove FSF copyright since file does not differ significantly from X11
Glenn Morris <rgm@gnu.org>
parents:
75348
diff
changeset
|
1 /* Copyright Massachusetts Institute of Technology 1985 */ |
fec5e03aaf59
Remove FSF copyright since file does not differ significantly from X11
Glenn Morris <rgm@gnu.org>
parents:
75348
diff
changeset
|
2 |
25858 | 3 #include "copyright.h" |
4 | |
5 | |
6 /* | |
7 * XMenu: MIT Project Athena, X Window system menu package | |
8 * | |
9 * XMenuAddSelection - Adds a selection to an XMenu object. | |
10 * | |
11 * Author: Tony Della Fera, DEC | |
12 * August, 1985 | |
13 * | |
14 */ | |
15 | |
16 #include <config.h> | |
17 #include "XMenuInt.h" | |
18 | |
19 int | |
109124
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76174
diff
changeset
|
20 XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help) |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76174
diff
changeset
|
21 |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76174
diff
changeset
|
22 /* Menu object to be modified. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76174
diff
changeset
|
23 /* Pane number to be modified. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76174
diff
changeset
|
24 /* Data value. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76174
diff
changeset
|
25 /* Selection label. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76174
diff
changeset
|
26 /* Make selection active? */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
76174
diff
changeset
|
27 /* Help string */ |
25858 | 28 { |
29 register XMPane *pane; /* Pane containing the new selection. */ | |
30 register XMSelect *select; /* Newly created selection. */ | |
31 | |
32 | |
33 int label_length; /* Label lenght in characters. */ | |
34 int label_width; /* Label width in pixels. */ | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
27455
diff
changeset
|
35 |
25858 | 36 /* |
37 * Check for NULL pointers! | |
38 */ | |
39 if (label == NULL) { | |
40 _XMErrorCode = XME_ARG_BOUNDS; | |
41 return(XM_FAILURE); | |
42 } | |
43 /* | |
44 * Find the right pane. | |
45 */ | |
46 pane = _XMGetPanePtr(menu, p_num); | |
47 if (pane == NULL) return(XM_FAILURE); | |
48 | |
49 /* | |
50 * Calloc the XMSelect structure. | |
51 */ | |
52 select = (XMSelect *)calloc(1, sizeof(XMSelect)); | |
53 if (select == NULL) { | |
54 _XMErrorCode = XME_CALLOC; | |
55 return(XM_FAILURE); | |
56 } | |
57 /* | |
58 * Determine label size. | |
59 */ | |
60 label_length = strlen(label); | |
61 label_width = XTextWidth(menu->s_fnt_info, label, label_length); | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
27455
diff
changeset
|
62 |
25858 | 63 /* |
64 * Fill the XMSelect structure. | |
65 */ | |
66 if (!strcmp (label, "--") || !strcmp (label, "---")) | |
67 { | |
68 select->type = SEPARATOR; | |
69 select->active = 0; | |
70 } | |
71 else | |
72 { | |
73 select->type = SELECTION; | |
74 select->active = active; | |
75 } | |
76 | |
77 select->serial = -1; | |
78 select->label = label; | |
79 select->label_width = label_width; | |
80 select->label_length = label_length; | |
81 select->data = data; | |
82 select->parent_p = pane; | |
27455
d93b1a9c3c96
(XMenuAddSelection): Add parameter HELP.
Gerd Moellmann <gerd@gnu.org>
parents:
25858
diff
changeset
|
83 select->help_string = help; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
27455
diff
changeset
|
84 |
25858 | 85 /* |
86 * Insert the selection at the end of the selection list. | |
87 */ | |
88 emacs_insque(select, pane->s_list->prev); | |
89 | |
90 /* | |
91 * Update the selection count. | |
92 */ | |
93 pane->s_count++; | |
94 | |
95 /* | |
96 * Schedule a recompute. | |
97 */ | |
98 menu->recompute = 1; | |
99 | |
100 /* | |
101 * Return the selection number just added. | |
102 */ | |
103 _XMErrorCode = XME_NO_ERROR; | |
104 return((pane->s_count - 1)); | |
105 } | |
52401 | 106 |
107 /* arch-tag: 0161f024-c739-440d-9498-050280c6c355 | |
108 (do not change this comment) */ |