home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 6
/
AACD06.ISO
/
AACD
/
Utilities
/
amiCheck
/
Source
/
qmemoPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-06-11
|
4KB
|
187 lines
/* qmemoPanel.c
*
* defines the GUIFront characteristics of the qmemo panel
*/
#include <exec/types.h>
#include <exec/lists.h>
#include <exec/nodes.h>
#include <exec/memory.h>
#include <stdio.h>
#include <intuition/gadgetclass.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include "amiCheck.h"
#include "qmemoPanel.h"
#include "dataBase.h"
#include "enterPanel.h"
#include "regGadget.h"
/* prototypes */
BOOL QMemoHandleGadget(struct IntuiMessage *);
void QMemoInit(void);
ULONG qmemoSel = ~0;
struct Window *qmemoWin = NULL;
GUIFront *qmemoGUI;
static BOOL done;
static BOOL useme;
/* quick configure of some gadgets */
/* define gadgetspec */
GadgetSpec QMgadgetspecs[] =
{
{LISTVIEW_KIND,STRINGSIZE-10,8, {0,0,0,0,NULL,NULL,GID_QMEMOLIST,
PLACETEXT_ABOVE},ListView,GS_DefaultTags},
};
/* set up array of pointers to our specs */
GadgetSpec *QM_MemoSpecs[] =
{
&QMgadgetspecs[0],
NULL,
};
/* define the layout of this panel */
ULONG QM_MemoPanel[] =
{
GUIL_Flags, GUILF_PropShare | GUILF_EqualWidth,
GUIL_GadgetSpecID, GID_QMEMOLIST,
TAG_DONE,
};
/****************************************************
* QMemoGUI
*
* create gui for this panel
*****************************************************/
BOOL QMemoGUI(GUIFront *parent)
{
UWORD ordinal;
BOOL noreply;
ULONG signal;
done = FALSE;
/* lock edit window */
GF_LockGUI(parent);
/* bring up this gui */
GF_SetGUIAttr(qmemoGUI, GUI_OpenGUI, TRUE, TAG_DONE);
/* grab window */
GF_GetGUIAttr(qmemoGUI,GUI_Window,&qmemoWin,TAG_DONE);
QMemoInit();
/* Process input events */
while (!done)
{
struct IntuiMessage *imsg;
/* Wait for an event to occur */
signal = GF_Wait(guiapp,AmigaGuideSignal(agc));
if (signal & AmigaGuideSignal(agc)) {
AmiHelpMsg();
continue;
}
/* We only bother to listen for CLOSEWINDOW events.
* Of course, in a real application, you would be
* examining the Class field for IDCMP_GADGETUP
* messages and act accordingly.
*/
while (imsg = GF_GetIMsg(guiapp))
{
noreply = TRUE;
switch (imsg->Class) {
case IDCMP_REFRESHWINDOW:
RegRefresh(TRUE);
break;
case IDCMP_CLOSEWINDOW:
done = TRUE;
break;
case IDCMP_RAWKEY:
if (GF_ProcessListView(qmemoGUI,QM_MemoSpecs[GID_QMEMOLIST],
imsg,&ordinal)) {
qmemoSel = ordinal;
}
else AmiHelpKey(imsg,QUICKMEMO_PANEL);
break;
case IDCMP_GADGETUP:
noreply = FALSE;
done=QMemoHandleGadget(imsg);
break;
}
if (noreply) GF_ReplyIMsg(imsg);
}
}
/* detach list */
GF_SetGadgetAttrs(qmemoGUI,QMgadgetspecs[GID_QMEMOLIST].gs_Gadget,
GTLV_Labels, ~0,
TAG_DONE);
/* close window */
GF_SetGUIAttr(qmemoGUI, GUI_OpenGUI, FALSE, TAG_DONE);
qmemoWin = NULL;
/* unlock edit window */
GF_UnlockGUI(parent);
return (useme);
}
/***************************************************
* QMemoHandleGadget....
*
* double clicks change ord val.
****************************************************/
BOOL QMemoHandleGadget(struct IntuiMessage *imsg)
{
BOOL done = FALSE;
struct Gadget *gad = (struct Gadget *)(imsg->IAddress);
UWORD code = imsg->Code;
switch (gad->GadgetID) {
case GID_QMEMOLIST:
qmemoSel = code;
useme = TRUE;
done = TRUE;
break;
}
return (done);
}
/***********************************************************
* QMemoInit()
*
*
************************************************************/
void QMemoInit(void)
{
useme = FALSE;
GF_SetGadgetAttrs(qmemoGUI,QMgadgetspecs[GID_QMEMOLIST].gs_Gadget,
GTLV_Labels, &memolist,
GTLV_Selected, qmemoSel,
TAG_DONE);
if (qmemoSel != ~0)
GF_SetGadgetAttrs(qmemoGUI,QMgadgetspecs[GID_QMEMOLIST].gs_Gadget,
GTLV_MakeVisible, qmemoSel,
TAG_DONE);
}