#pragma +
// Name:						Window-Klassen
// Programmtyp:			Hilfsroutine für
//								Fakturierprogramm
//	Programmiersprache:	C++ (AT&T Standard 3.0)
// Computersystem:		Commodore AMIGA
// Betriebssystem:		AMIGA OS3.0 oder höher
// Autor:					Manfred Tremmel
// © Copyright:			1997-2000 by MT Graphic & Design
// Version:					V1.08
//
//    Copyright (C) 1997-2000 Manfred Tremmel
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA

// Includes:
#include <new.h>
#include <intuition/intuition.h>
#include <iostream.h>
#include <stdlib.h>

#include "MT-Rechnung.h"
#include "MTLocale.h"
#include "MTScreen.h"
#include "MTWindow.h"
#include "MTAuswert.h"
#include "MTWinInfo.h"
#include "MTVersion.h"

extern MTARexx				MyARexx;
extern OpenLocaleClass	*MyLocalePTR;

MTInfo_Gadget::MTInfo_Gadget(MTWindow *Win) : MTAuswert( Win )
{
	MyDatestamp = MyLocalePTR->ParseDateC( (STRPTR)_Datum_, "%d.%m.%Y" );
	Buffer[0] = '\0';
};

// Gadget-Auswertung:
WORD MTInfo_Gadget::MTAuswertung( struct IntuiMessage* imsg, WORD DONE )
{
	ULONG IconNummer;
	switch( imsg->Class )
	{
		// ein Button wurde betätigt (genaugenommen losgelassen)
		case IDCMP_IDCMPUPDATE:
			if( imsg->Code	== 0xffff )
				IconNummer = imsg->Qualifier;
			else
				IconNummer = GetTagData(GA_ID,0,(struct TagItem *)imsg->IAddress);
			switch( IconNummer )
			{
				case INFO_OK:
					DONE	= 1;
					break;
			}
			break;
		// Window Aktiviert
		case IDCMP_ACTIVEWINDOW:
			if( Buffer[0] == '\0' )
			{
				MyLocalePTR->FormatDateC( Buffer, &MyDatestamp, MyLocalePTR->Thislocale->loc_DateFormat );
				SetGadgetAttrs( ThisWindow->gads[INFO_VERSION], ThisWindow->Win, NULL, WARGSA_Format, _Version_, TAG_DONE );
				SetGadgetAttrs( ThisWindow->gads[INFO_STATUS], ThisWindow->Win, NULL, WARGSA_Format, _VerStatus_, TAG_DONE );
				SetGadgetAttrs( ThisWindow->gads[INFO_DATUM], ThisWindow->Win, NULL, WARGSA_Format, Buffer, TAG_DONE );
				SetGadgetAttrs( ThisWindow->gads[INFO_PUBSCREEN], ThisWindow->Win, NULL, WARGSA_Format, ThisWindow->ThisScreen->PubScreenMerker, TAG_DONE );
				SetGadgetAttrs( ThisWindow->gads[INFO_REXXPORT], ThisWindow->Win, NULL, WARGSA_Format, MyARexx.RexxPortName, TAG_DONE );
			}
			break;
	}
	return DONE;
};

