#include <dat.g>
#include <dat.rg>
#include <date.h>

GLREF_D PR_DATWSERV * const w_ws;

#pragma METHOD_CALL

METHOD VOID *datedlg_dl_item_new(PR_DATEDLG *self,AD_DLGBOX *par)
    {
    return(f_new(CAT_DAT_DAT,par->class));
    }

METHOD VOID datedlg_dl_dyn_init(PR_DATEDLG *self)
    {
    P_DAYSEC ds;

    p_send4(((PR_DATWIN *)w_ws->wserv.cli)->datwin.time,O_TO_SENSE,SENSE_TIME_DAYSEC,&ds);
    p_send4(self,O_WN_SET,1,&ds.day);
    }

METHOD INT datedlg_dl_key(PR_DATEDLG *self,INT index,INT keycode)
    {
    P_DAYSEC ds;
    
    p_send4(self,O_WN_SENSE,1,&ds.day);
    ds.sec=0;
    f_leave(p_send4(((PR_DATWIN *)w_ws->wserv.cli)->datwin.time,O_TO_SET,SET_TIME_DAYSEC,&ds));
    return(WN_KEY_CHANGED);
    }

