/*
 * PicoTalk Communication Message Port
 */

// NOTE: PTALK_OBTAIN_CURRENT has to be released by PTALK_RELEASE_WINDOW
// for compatibility to PicoPainter: Initialize msg->res.alloc.bitmap and
// msg->res.alloc.winid to NULL and only release the window if you get
// a reply with this fields filled out (winid may be 0 only check bitmap
// field, bitmap may also be NULL if there is no current window in ArtEffect)
// you get also NULL if there is no current window.

// IMPORTANT: You have to initialize the alpha channel to 0xff to make
// your data visible

// use NOTIFY & LEAVE if you want to write sub applications, what open on
// PicoPainter Screen. If get a message on the ApplicationPort with command id
// PTALK_APPLICATION_QUIT close your application (do not forget to send
// a PTALK_LEAVE)! This is not functional in the current release, but is planned
// and should be supported for compatibility reasons to future versions, but
// NOTIFY & LEAVE itself also work in this version.

enum PTalkCmd { PTALK_OBTAIN_WINDOW=1, PTALK_RELEASE_WINDOW,
								PTALK_ALLOC_WINDOW, PTALK_CLOSE_WINDOW,
								PTALK_UPDATE_WINDOW,
								PTALK_ALLOC_BRUSH, PTALK_SET_BRUSH,
								PTALK_OBTAIN_CURRENT,
								PTALK_NOTIFY, PTALK_LEAVE,

								// commands PicoPaint sends to your application
								PTALK_APPLICATION_QUIT, PTALK_APPLICATION_CMD };

struct PicoMsg {
	struct Message msg;
	ULONG command;
	union {
		struct {
			ULONG winid;
			int width;
			int height;
			char *name;
		} alloc;
		struct {
			ULONG winid;
			int left,top;
			int width,height;
		} update;
		ULONG winid;
		struct {
			struct MsgPort *ApplicationPort;
			// max. 16 characters including terminating zero (used for arexx access),
			// please use only upper case characters (although lower case characters are possible)
			// IMPORTANT: it has to be the same name as the filename!
			char *ApplicationName;
		} notify;
		struct {
			ULONG ApplicationId;
		} leave;
		struct {
			char *CommandString;				// Commands passed by "PLUGIN CMD/A ARGUMENTS/A/F"
		} cmd;
	} arg;
	union {
		struct {
			ULONG winid;
			struct E_EBitMap *bitmap;
			struct E_EBitMap *source;		// pointer to copy of bitmap or NULL: do not modify!
			char *name;
		} alloc;
		struct {
			struct EI_Screen *screen;
			ULONG ApplicationId;
		} notify;
		struct {
			int error;									// error code to return
		} cmd;
	} res;
};
