home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 6
/
AACD06.ISO
/
AACD
/
Utilities
/
amiCheck
/
Source
/
qamntPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-06-11
|
4KB
|
187 lines
/* qamntPanel.c
*
* defines the GUIFront characteristics of the qamnt 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 "qamntPanel.h"
#include "dataBase.h"
#include "enterPanel.h"
#include "regGadget.h"
/* prototypes */
BOOL QAmntHandleGadget(struct IntuiMessage *);
void QAmntInit(void);
ULONG qamntSel = ~0;
struct Window *qamntWin = NULL;
GUIFront *qamntGUI;
static BOOL done;
static BOOL useme;
/* quick configure of some gadgets */
/* define gadgetspec */
GadgetSpec QAgadgetspecs[] =
{
{LISTVIEW_KIND,AMNTSIZE,8, {0,0,0,0,NULL,NULL,GID_QAMNTLIST,
PLACETEXT_ABOVE},ListView,GS_DefaultTags},
};
/* set up array of pointers to our specs */
GadgetSpec *QA_AmntSpecs[] =
{
&QAgadgetspecs[0],
NULL,
};
/* define the layout of this panel */
ULONG QA_AmntPanel[] =
{
GUIL_Flags, GUILF_PropShare | GUILF_EqualWidth,
GUIL_GadgetSpecID, GID_QAMNTLIST,
TAG_DONE,
};
/****************************************************
* QAmntGUI
*
* create gui for this panel
*****************************************************/
BOOL QAmntGUI(GUIFront *parent)
{
UWORD ordinal;
BOOL noreply;
ULONG signal;
done = FALSE;
/* lock edit window */
GF_LockGUI(parent);
/* bring up this gui */
GF_SetGUIAttr(qamntGUI, GUI_OpenGUI, TRUE, TAG_DONE);
/* grab window */
GF_GetGUIAttr(qamntGUI,GUI_Window,&qamntWin,TAG_DONE);
QAmntInit();
/* 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(qamntGUI,QA_AmntSpecs[GID_QAMNTLIST],
imsg,&ordinal)) {
qamntSel = ordinal;
}
else AmiHelpKey(imsg,QUICKAMNT_PANEL);
break;
case IDCMP_GADGETUP:
noreply = FALSE;
done=QAmntHandleGadget(imsg);
break;
}
if (noreply) GF_ReplyIMsg(imsg);
}
}
/* detach list */
GF_SetGadgetAttrs(qamntGUI,QAgadgetspecs[GID_QAMNTLIST].gs_Gadget,
GTLV_Labels, ~0,
TAG_DONE);
/* close window */
GF_SetGUIAttr(qamntGUI, GUI_OpenGUI, FALSE, TAG_DONE);
qamntWin = NULL;
/* unlock edit window */
GF_UnlockGUI(parent);
return (useme);
}
/***************************************************
* QAmntHandleGadget....
*
* double clicks change ord val.
****************************************************/
BOOL QAmntHandleGadget(struct IntuiMessage *imsg)
{
BOOL done = FALSE;
struct Gadget *gad = (struct Gadget *)(imsg->IAddress);
UWORD code = imsg->Code;
switch (gad->GadgetID) {
case GID_QAMNTLIST:
qamntSel = code;
useme = TRUE;
done = TRUE;
break;
}
return (done);
}
/***********************************************************
* QAmntInit()
*
*
************************************************************/
void QAmntInit(void)
{
useme = FALSE;
GF_SetGadgetAttrs(qamntGUI,QAgadgetspecs[GID_QAMNTLIST].gs_Gadget,
GTLV_Labels, &amntlist,
GTLV_Selected, qamntSel,
TAG_DONE);
if (qamntSel != ~0)
GF_SetGadgetAttrs(qamntGUI,QAgadgetspecs[GID_QAMNTLIST].gs_Gadget,
GTLV_MakeVisible, qamntSel,
TAG_DONE);
}