/*
** MUI Helper Functions of MadCat!
**
** 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-1307  USA
*/

#include "include/config.h"

#include <libraries/gadtools.h>

#include "include/mui.h"


ULONG __stdargs DoSuperNew(struct IClass *cl,Object *obj,ULONG tag1,...)
{
	return(DoSuperMethod(cl,obj,OM_NEW,&tag1,NULL));
}


Object *maketmenu(const UBYTE *msg)
{
	char *title = (char *)msg;

	if(title[1]==0)
		return(MenuitemObject,
		       MUIA_Menuitem_Title, title+2,
		       MUIA_Menuitem_Shortcut, title,
		       MUIA_Menuitem_Toggle, TRUE,
		       MUIA_Menuitem_Checkit, TRUE,
		       End);
	else
		return(MenuitemObject,
		       MUIA_Menuitem_Title, title,
		       MUIA_Menuitem_Toggle, TRUE,
		       MUIA_Menuitem_Checkit, TRUE,
		       End);
}


Object *makemenu(const UBYTE *msg)
{
	char *title = (char *)msg;

	if(msg==NULL) return(MenuitemObject,MUIA_Menuitem_Title,NM_BARLABEL,End);

	if(title[1]==0)
		return(MenuitemObject,
		       MUIA_Menuitem_Title, title+2,
		       MUIA_Menuitem_Shortcut, title,
		       End);
	else
		return(MenuitemObject,MUIA_Menuitem_Title,title,End);
}


Object *maketoggle(const UBYTE *msg, Object **tog)
{
	Object *obj,*obj2;

	obj = HGroup,
		Child, obj2 = ImageObject,
			ButtonFrame,
			MUIA_Background, MUII_ButtonBack,
			MUIA_InputMode, MUIV_InputMode_Toggle,
			MUIA_ShowSelState, FALSE,
			MUIA_CycleChain, 1,
			MUIA_Image_Spec, "6:15",
		End,
		Child, TextObject,
			MUIA_Text_Contents, (char *)msg,
		End,
	End;

	if(obj) {
		*tog = obj2;
		return(obj);
	} else
		return(NULL);
}
