Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

frm_post.c File Reference

#include "form.priv.h"

Go to the source code of this file.

Functions

 post_form (FORM *form)
 unpost_form (FORM *form)


Function Documentation

post_form FORM form  ) 
 

Definition at line 51 of file frm_post.c.

References _nc_Refresh_Current_Field(), _nc_Set_Form_Page(), _POSTED, Call_Hook, E_BAD_ARGUMENT, E_NO_ROOM, E_NOT_CONNECTED, E_OK, E_POSTED, err(), Get_Form_Window, getmaxx, getmaxy, RETURN, T, and T_CALLED.

Referenced by NCursesForm::post().

00052 {
00053   WINDOW *formwin;
00054   int err;
00055   int page;
00056 
00057   T((T_CALLED("post_form(%p)"), form));
00058 
00059   if (!form)
00060     RETURN(E_BAD_ARGUMENT);
00061 
00062   if (form->status & _POSTED)
00063     RETURN(E_POSTED);
00064 
00065   if (!(form->field))
00066     RETURN(E_NOT_CONNECTED);
00067 
00068   formwin = Get_Form_Window(form);
00069   if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin)))
00070     RETURN(E_NO_ROOM);
00071 
00072   /* reset form->curpage to an invald value. This forces Set_Form_Page
00073      to do the page initialization which is required by post_form.
00074    */
00075   page = form->curpage;
00076   form->curpage = -1;
00077   if ((err = _nc_Set_Form_Page(form, page, form->current)) != E_OK)
00078     RETURN(err);
00079 
00080   form->status |= _POSTED;
00081 
00082   Call_Hook(form, forminit);
00083   Call_Hook(form, fieldinit);
00084 
00085   _nc_Refresh_Current_Field(form);
00086   RETURN(E_OK);
00087 }

unpost_form FORM form  ) 
 

Definition at line 101 of file frm_post.c.

References _IN_DRIVER, _POSTED, Call_Hook, delwin(), E_BAD_ARGUMENT, E_BAD_STATE, E_NOT_POSTED, E_OK, Get_Form_Window, RETURN, T, T_CALLED, and werase().

Referenced by NCursesForm::post(), and NCursesForm::unpost().

00102 {
00103   T((T_CALLED("unpost_form(%p)"), form));
00104 
00105   if (!form)
00106     RETURN(E_BAD_ARGUMENT);
00107 
00108   if (!(form->status & _POSTED))
00109     RETURN(E_NOT_POSTED);
00110 
00111   if (form->status & _IN_DRIVER)
00112     RETURN(E_BAD_STATE);
00113 
00114   Call_Hook(form, fieldterm);
00115   Call_Hook(form, formterm);
00116 
00117   werase(Get_Form_Window(form));
00118   delwin(form->w);
00119   form->w = (WINDOW *)0;
00120   form->status &= ~_POSTED;
00121   RETURN(E_OK);
00122 }


© sourcejam.com 2005-2008