1 /*-----------------------------------------------------------------------------+
2 | The ncurses menu library is Copyright (C) 1995-1997 |
3 | by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> |
4 | All Rights Reserved. |
6 | Permission to use, copy, modify, and distribute this software and its |
7 | documentation for any purpose and without fee is hereby granted, provided |
8 | that the above copyright notice appear in all copies and that both that |
9 | copyright notice and this permission notice appear in supporting |
10 | documentation, and that the name of the above listed copyright holder(s) not |
11 | be used in advertising or publicity pertaining to distribution of the |
12 | software without specific, written prior permission. |
14 | THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO |
15 | THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- |
16 | NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR |
17 | ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- |
18 | SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
19 | NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH |
20 | THE USE OR PERFORMANCE OF THIS SOFTWARE. |
21 +-----------------------------------------------------------------------------*/
23 /***************************************************************************
24 * Module menu_spacing *
25 * Routines to handle spacing between entries *
26 ***************************************************************************/
28 #include "menu.priv.h"
30 MODULE_ID("$Id: m_spacing.c,v 1.7 1997/05/01 16:47:26 juergen Exp $")
32 #define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8)
33 #define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8)
34 #define MAX_SPC_ROWS (3)
36 /*---------------------------------------------------------------------------
38 | Function : int set_menu_spacing(MENU *menu,int desc, int r, int c);
40 | Description : Set the spacing between entried
42 | Return Values : E_OK - on success
43 +--------------------------------------------------------------------------*/
44 int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col )
46 MENU *m; /* split for ATAC workaround */
47 m = Normalize_Menu(menu);
50 if (m->status & _POSTED)
53 if (((s_desc < 0) || (s_desc > MAX_SPC_DESC)) ||
54 ((s_row < 0) || (s_row > MAX_SPC_ROWS)) ||
55 ((s_col < 0) || (s_col > MAX_SPC_COLS)))
56 RETURN(E_BAD_ARGUMENT);
58 m->spc_desc = s_desc ? s_desc : 1;
59 m->spc_rows = s_row ? s_row : 1;
60 m->spc_cols = s_col ? s_col : 1;
61 _nc_Calculate_Item_Length_and_Width(m);
67 /*---------------------------------------------------------------------------
69 | Function : int menu_spacing (const MENU *,int *,int *,int *);
71 | Description : Retrieve info about spacing between the entries
73 | Return Values : E_OK - on success
74 +--------------------------------------------------------------------------*/
75 int menu_spacing( const MENU *menu, int* s_desc, int* s_row, int* s_col)
77 const MENU *m; /* split for ATAC workaround */
78 m = Normalize_Menu(menu);
81 if (s_desc) *s_desc = m->spc_desc;
82 if (s_row) *s_row = m->spc_rows;
83 if (s_col) *s_col = m->spc_cols;
88 /* m_spacing.c ends here */