/****************************************************************************1* Copyright (c) 1998 Free Software Foundation, Inc. *2* *3* Permission is hereby granted, free of charge, to any person obtaining a *4* copy of this software and associated documentation files (the *5* "Software"), to deal in the Software without restriction, including *6* without limitation the rights to use, copy, modify, merge, publish, *7* distribute, distribute with modifications, sublicense, and/or sell *8* copies of the Software, and to permit persons to whom the Software is *9* furnished to do so, subject to the following conditions: *10* *11* The above copyright notice and this permission notice shall be included *12* in all copies or substantial portions of the Software. *13* *14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *15* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *17* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *20* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *21* *22* Except as contained in this notice, the name(s) of the above copyright *23* holders shall not be used in advertising or otherwise to promote the *24* sale, use or other dealings in this Software without prior written *25* authorization. *26****************************************************************************/2728/****************************************************************************29* Author: Juergen Pfeifer <[email protected]> 1995,1997 *30****************************************************************************/31#include "form.priv.h"3233MODULE_ID("$Id$")3435/*---------------------------------------------------------------------------36| Facility : libnform37| Function : int post_form(FORM * form)38|39| Description : Writes the form into its associated subwindow.40|41| Return Values : E_OK - success42| E_BAD_ARGUMENT - invalid form pointer43| E_POSTED - form already posted44| E_NOT_CONNECTED - no fields connected to form45| E_NO_ROOM - form doesn't fit into subwindow46| E_SYSTEM_ERROR - system error47+--------------------------------------------------------------------------*/48int post_form(FORM * form)49{50WINDOW *formwin;51int err;52int page;53int height, width;5455if (!form)56RETURN(E_BAD_ARGUMENT);5758if (form->status & _POSTED)59RETURN(E_POSTED);6061if (!(form->field))62RETURN(E_NOT_CONNECTED);6364formwin = Get_Form_Window(form);65getmaxyx(formwin, height, width);66if ((form->cols > width) || (form->rows > height))67RETURN(E_NO_ROOM);6869/* reset form->curpage to an invalid value. This forces Set_Form_Page70to do the page initialization which is required by post_form.71*/72page = form->curpage;73form->curpage = -1;74if ((err = _nc_Set_Form_Page(form,page,form->current))!=E_OK)75RETURN(err);7677form->status |= _POSTED;7879Call_Hook(form,forminit);80Call_Hook(form,fieldinit);8182_nc_Refresh_Current_Field(form);83RETURN(E_OK);84}8586/*---------------------------------------------------------------------------87| Facility : libnform88| Function : int unpost_form(FORM * form)89|90| Description : Erase form from its associated subwindow.91|92| Return Values : E_OK - success93| E_BAD_ARGUMENT - invalid form pointer94| E_NOT_POSTED - form isn't posted95| E_BAD_STATE - called from a hook routine96+--------------------------------------------------------------------------*/97int unpost_form(FORM * form)98{99if (!form)100RETURN(E_BAD_ARGUMENT);101102if (!(form->status & _POSTED))103RETURN(E_NOT_POSTED);104105if (form->status & _IN_DRIVER)106RETURN(E_BAD_STATE);107108Call_Hook(form,fieldterm);109Call_Hook(form,formterm);110111werase(Get_Form_Window(form));112delwin(form->w);113form->w = (WINDOW *)0;114form->status &= ~_POSTED;115RETURN(E_OK);116}117118/* frm_post.c ends here */119120121