210 lines
4.1 KiB
C
210 lines
4.1 KiB
C
/*
|
|||
|
|
HHWIF.C
|
||
|
|
|
||
|
|
Started by Huw 11/3/91
|
||
|
|
|
||
|
|
Routines for supplying menus and dialogs for non OOP users
|
||
|
|
such as OPL/W
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include <hwif.g>
|
||
|
|
#include <hwif.h>
|
||
|
|
#include <gate.g>
|
||
|
|
#include <p_gen.h>
|
||
|
|
#include <epoc.h>
|
||
|
|
|
||
|
|
GLREF_D PR_GATE *DatGate;
|
||
|
|
GLDEF_D UWORD _UseFullScreen;
|
||
|
|
GLDEF_D UWORD *_GreyLines;
|
||
|
|
GLDEF_D UWORD *_MenuPositions;
|
||
|
|
GLDEF_D UWORD _SmallFontDialog;
|
||
|
|
|
||
|
|
GLDEF_C INT hIFInit(VOID *console)
|
||
|
|
/*
|
||
|
|
Initialise HWIM interface
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
if (!(DatGate=p_new(CAT_HWIF_HWIM,C_GATE)))
|
||
|
|
return(E_GEN_NOMEMORY);
|
||
|
|
if (_UseFullScreen)
|
||
|
|
p_send2(DatGate,O_GT_XW_ENABLE);
|
||
|
|
return(p_send3(DatGate,O_GT_INIT,console));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hMenuOpen()
|
||
|
|
/*
|
||
|
|
Create a new menu bar
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
return(p_send2(DatGate,O_GT_MENU_OPEN));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hMenuAdd(TEXT *title,VOID *menu)
|
||
|
|
/*
|
||
|
|
Add another menu to the menu bar
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
return(p_send4(DatGate,O_GT_MENU_ADD,title,menu));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hMenuRun()
|
||
|
|
/*
|
||
|
|
Display and use the menu bar
|
||
|
|
|
||
|
|
Note that due to the addition of 'gate.g.dx' in os 356 and above, the
|
||
|
|
property 'gate.g.ulines' is in different places on different models.
|
||
|
|
|
||
|
|
Older models will be expecting the greyline data to be where later
|
||
|
|
models look for 'gate.g.dx', so a test is required to determine where
|
||
|
|
to copy the greyline data to.
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
if (_GreyLines)
|
||
|
|
{
|
||
|
|
p_bcpy((BYTE *)&DatGate->gate.g.ulines[0]-((p_version()>0x355f)?0:
|
||
|
|
sizeof(DLG_X_CONSTANTS)),_GreyLines,16*sizeof(UWORD));
|
||
|
|
}
|
||
|
|
return(p_send3(DatGate,O_GT_MENU_RUN,_MenuPositions));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C VOID hMenuClose()
|
||
|
|
/*
|
||
|
|
Close an incomplete menu bar down
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
p_send2(DatGate,O_GT_MENU_CLOSE);
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hDlgOpen(TEXT *title)
|
||
|
|
/*
|
||
|
|
Create a new dialog
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
INT method;
|
||
|
|
|
||
|
|
method=O_GT_DIAL_OPEN;
|
||
|
|
if (_SmallFontDialog)
|
||
|
|
{
|
||
|
|
method=O_GT_DIAL_SOPEN;
|
||
|
|
_SmallFontDialog=FALSE;
|
||
|
|
}
|
||
|
|
return(p_send3(DatGate,method,title));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hDlgAdd(UWORD type,TEXT *prompt,VOID *data)
|
||
|
|
/*
|
||
|
|
Add an item to the dialog
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
return(p_send5(DatGate,O_GT_DIAL_ADD,type,prompt,data));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hDlgRun()
|
||
|
|
/*
|
||
|
|
Display and use the dialog
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
return(p_send2(DatGate,O_GT_DIAL_RUN));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C VOID hDlgClose()
|
||
|
|
/*
|
||
|
|
Close an incomplete dialog down
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
p_send2(DatGate,O_GT_DIAL_CLOSE);
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C VOID *hCardOpen()
|
||
|
|
/*
|
||
|
|
Open a menu card for building
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
return((VOID *)p_send2(DatGate,O_GT_CARD_OPEN));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hCardAdd(VOID *hand,INT index,INT accel,TEXT *str)
|
||
|
|
/*
|
||
|
|
Add an item to a menu card
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
H_CARD card;
|
||
|
|
|
||
|
|
card.accel=accel;
|
||
|
|
card.str=str;
|
||
|
|
return(p_send5(DatGate,O_GT_CARD_ADD,hand,index,&card));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C VOID hCardClose(VOID *hand)
|
||
|
|
/*
|
||
|
|
Discard a menu card
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
p_send3(DatGate,O_GT_CARD_CLOSE,hand);
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C VOID *hChoiceOpen()
|
||
|
|
/*
|
||
|
|
Open a choice list for building
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
return((VOID *)p_send2(DatGate,O_GT_CHOICE_OPEN));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hChoiceAdd(VOID *hand,INT index,TEXT *str)
|
||
|
|
/*
|
||
|
|
Add an item to a choice list
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
H_CHOICE choice;
|
||
|
|
|
||
|
|
choice.str=str;
|
||
|
|
return(p_send5(DatGate,O_GT_CHOICE_ADD,hand,index,&choice));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C VOID hChoiceClose(VOID *hand)
|
||
|
|
/*
|
||
|
|
Discard a choice list
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
p_send3(DatGate,O_GT_CHOICE_CLOSE,hand);
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C VOID *hButtonOpen()
|
||
|
|
/*
|
||
|
|
Open a action list for building
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
return((VOID *)p_send2(DatGate,O_GT_BUTTON_OPEN));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hButtonAdd(VOID *hand,INT index,INT key,TEXT *str)
|
||
|
|
/*
|
||
|
|
Add a button to an action list
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
H_BUTTON but;
|
||
|
|
|
||
|
|
but.keycode=key;
|
||
|
|
but.str=str;
|
||
|
|
return(p_send5(DatGate,O_GT_BUTTON_ADD,hand,index,&but));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C VOID hButtonClose(VOID *hand)
|
||
|
|
/*
|
||
|
|
Discard an action list
|
||
|
|
*/
|
||
|
|
{
|
||
|
|
p_send3(DatGate,O_GT_BUTTON_CLOSE,hand);
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C INT hDlgPosition(INT x,INT y)
|
||
|
|
{
|
||
|
|
return(p_send4(DatGate,O_GT_DIAL_POSITION,x,y));
|
||
|
|
}
|
||
|
|
|
||
|
|
GLDEF_C UINT hLastSystemKey(UINT *pmodifiers)
|
||
|
|
{
|
||
|
|
return(p_send3(DatGate,O_GT_LAST_KEY,pmodifiers));
|
||
|
|
}
|