150276Speter/**************************************************************************** 2262685Sdelphij * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * 350276Speter * * 450276Speter * Permission is hereby granted, free of charge, to any person obtaining a * 550276Speter * copy of this software and associated documentation files (the * 650276Speter * "Software"), to deal in the Software without restriction, including * 750276Speter * without limitation the rights to use, copy, modify, merge, publish, * 850276Speter * distribute, distribute with modifications, sublicense, and/or sell * 950276Speter * copies of the Software, and to permit persons to whom the Software is * 1050276Speter * furnished to do so, subject to the following conditions: * 1150276Speter * * 1250276Speter * The above copyright notice and this permission notice shall be included * 1350276Speter * in all copies or substantial portions of the Software. * 1450276Speter * * 1550276Speter * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 1650276Speter * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 1750276Speter * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 1850276Speter * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 1950276Speter * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 2050276Speter * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 2150276Speter * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 2250276Speter * * 2350276Speter * Except as contained in this notice, the name(s) of the above copyright * 2450276Speter * holders shall not be used in advertising or otherwise to promote the * 2550276Speter * sale, use or other dealings in this Software without prior written * 2650276Speter * authorization. * 2750276Speter ****************************************************************************/ 2850276Speter 2950276Speter/**************************************************************************** 30166124Srafan * Author: Juergen Pfeifer, 1995,1997 * 3150276Speter ****************************************************************************/ 3250276Speter 3350276Speter/*************************************************************************** 3450276Speter* Module m_spacing * 3550276Speter* Routines to handle spacing between entries * 3650276Speter***************************************************************************/ 3750276Speter 3850276Speter#include "menu.priv.h" 3950276Speter 40262685SdelphijMODULE_ID("$Id: m_spacing.c,v 1.19 2012/03/10 23:43:41 tom Exp $") 4150276Speter 4250276Speter#define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8) 4350276Speter#define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8) 4450276Speter#define MAX_SPC_ROWS (3) 4550276Speter 4650276Speter/*--------------------------------------------------------------------------- 4750276Speter| Facility : libnmenu 4850276Speter| Function : int set_menu_spacing(MENU *menu,int desc, int r, int c); 4950276Speter| 50166124Srafan| Description : Set the spacing between entries 5150276Speter| 5250276Speter| Return Values : E_OK - on success 5350276Speter+--------------------------------------------------------------------------*/ 5476726SpeterNCURSES_EXPORT(int) 55166124Srafanset_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col) 5650276Speter{ 57166124Srafan MENU *m; /* split for ATAC workaround */ 58166124Srafan 59262629Sdelphij T((T_CALLED("set_menu_spacing(%p,%d,%d,%d)"), 60262629Sdelphij (void *)menu, s_desc, s_row, s_col)); 61166124Srafan 6250276Speter m = Normalize_Menu(menu); 6350276Speter 6450276Speter assert(m); 6550276Speter if (m->status & _POSTED) 6650276Speter RETURN(E_POSTED); 6750276Speter 6850276Speter if (((s_desc < 0) || (s_desc > MAX_SPC_DESC)) || 69166124Srafan ((s_row < 0) || (s_row > MAX_SPC_ROWS)) || 70166124Srafan ((s_col < 0) || (s_col > MAX_SPC_COLS))) 7150276Speter RETURN(E_BAD_ARGUMENT); 7250276Speter 73262685Sdelphij m->spc_desc = (short)(s_desc ? s_desc : 1); 74262685Sdelphij m->spc_rows = (short)(s_row ? s_row : 1); 75262685Sdelphij m->spc_cols = (short)(s_col ? s_col : 1); 7650276Speter _nc_Calculate_Item_Length_and_Width(m); 7750276Speter 7850276Speter RETURN(E_OK); 7950276Speter} 8050276Speter 8150276Speter/*--------------------------------------------------------------------------- 8250276Speter| Facility : libnmenu 8350276Speter| Function : int menu_spacing (const MENU *,int *,int *,int *); 8450276Speter| 8550276Speter| Description : Retrieve info about spacing between the entries 8650276Speter| 8750276Speter| Return Values : E_OK - on success 8850276Speter+--------------------------------------------------------------------------*/ 8976726SpeterNCURSES_EXPORT(int) 90166124Srafanmenu_spacing(const MENU * menu, int *s_desc, int *s_row, int *s_col) 9150276Speter{ 92166124Srafan const MENU *m; /* split for ATAC workaround */ 93166124Srafan 94262629Sdelphij T((T_CALLED("menu_spacing(%p,%p,%p,%p)"), 95262629Sdelphij (const void *)menu, 96262629Sdelphij (void *)s_desc, 97262629Sdelphij (void *)s_row, 98262629Sdelphij (void *)s_col)); 99166124Srafan 10050276Speter m = Normalize_Menu(menu); 10150276Speter 10250276Speter assert(m); 103166124Srafan if (s_desc) 104166124Srafan *s_desc = m->spc_desc; 105166124Srafan if (s_row) 106166124Srafan *s_row = m->spc_rows; 107166124Srafan if (s_col) 108166124Srafan *s_col = m->spc_cols; 10950276Speter 11050276Speter RETURN(E_OK); 11150276Speter} 11250276Speter 11350276Speter/* m_spacing.c ends here */ 114