/*
File: LCDCOMM.C

Methods for Class:  lcdcomm  (Superclass: comman).
*/

#include <lcdtest.g>
#include <hwim.h>
#include <olib.h>
#include <lcdview.g>
#include <lcdcomm.g>
#include <lcddlgs.g>
#include <lcdtest.rsg>
#include <p_file.h>
#include <epoc.h>

GLREF_D PR_LCDCOMM   *DatApp2;   /* Command Manager      */
GLREF_D PR_LCDVIEW   *DatApp3;   /* Main Client Window   */

LOCAL_C INT lLaunchDlg(P_CATID cat,UINT class,UINT id,VOID *prbuf)
    {
    DL_DATA dl_data;

    dl_data.id = id;
    dl_data.rbuf = prbuf;
    dl_data.pdlg = NULL;
    return(hLaunchDial(cat,class,&dl_data));
    }

LOCAL_C INT lLaunchDlgLcdtest(UINT class,UINT id,VOID *prbuf)
    {   /* Launches an LCDTEST category dialog.  */
    return(lLaunchDlg(CAT_LCDTEST_LCDTEST,class,id,prbuf));
    }

LOCAL_C INT lLaunchDlgLcdtestNull(UINT class,UINT id)
    {   /* Launches a LCDTEST category dialog with rbuf set to NULL.    */
    return(lLaunchDlgLcdtest(class,id,NULL));
    }

#pragma METHOD_CALL

METHOD VOID lcdcomm_com_init(PR_LCDCOMM *self)
    {
    DatApp2 = self;
    self->lcdcomm.sound.duration = 5;
    self->lcdcomm.sound.pitch = 320;
    }

METHOD VOID lcdcomm_com_exit(PR_LCDCOMM *self)
    {           /* Exit application. */
    p_supersend2(self,O_COM_EXIT);
    }

METHOD VOID lcdcomm_cm_backlight(PR_LCDCOMM *self)
    {           /* Switch backlight on/off. */
    lLaunchDlgLcdtestNull(C_LCD_BACKLIGHT,D_BACKLIGHT);
    }

METHOD VOID lcdcomm_cm_sound(PR_LCDCOMM *self)
    {           /* Make a beep by calling p_sound()     */
    lLaunchDlgLcdtest(C_LCD_SOUND,D_SOUND,&self->lcdcomm.sound);
    }
