/* Copyright 2015, Stephen Fryatt (info@stevefryatt.org.uk)
 *
 * This file is part of Wimp Programming In C:
 *
 *   http://www.stevefryatt.org.uk/risc-os/wimp-prog
 *
 * Licensed under the EUPL, Version 1.2 only (the "Licence");
 * You may not use this work except in compliance with the
 * Licence.
 *
 * You may obtain a copy of the Licence at:
 *
 *   http://joinup.ec.europa.eu/software/page/eupl
 *
 * Unless required by applicable law or agreed to in
 * writing, software distributed under the Licence is
 * distributed on an "AS IS" basis, WITHOUT WARRANTIES
 * OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the Licence for the specific language governing
 * permissions and limitations under the Licence.
 */

/**
 * File: main.c
 */

#include "oslib/wimp.h"

int main(int argc, char *argv[])
{
	osbool		quit = FALSE;
	wimp_block	block;
	wimp_event_no	reason;

	wimp_initialise(wimp_VERSION_RO3, "Example App", NULL, NULL);

	while (!quit) {
		reason = wimp_poll(wimp_MASK_NULL | wimp_MASK_ENTERING |
				wimp_MASK_LEAVING | wimp_MASK_GAIN |
				wimp_MASK_LOSE | wimp_MASK_POLLWORD,
				&block, NULL);

		switch (reason) {
		case wimp_USER_MESSAGE:
		case wimp_USER_MESSAGE_RECORDED:
			if (block.message.action == message_QUIT)
				quit = TRUE;
			break;
		}
	}

	wimp_close_down(0);

	return 0;
}

