/*
** $Id: muitoolkit.h,v 1.8 2001/01/14 10:46:31 carlos Exp $.
**
** (C) Copyright 1999-2001 Marcin Orlowski <carlos@amiga.com.pl>
** All Rights Reserved.
*/

#ifndef LIBRARIES_MUITOOLKIT_H
#define LIBRARIES_MUITOOLKIT_H

#ifndef LIBRARIES_MUI_H
#include <libraries/mui.h>
#endif


#define MUITOOLKIT_NAME "muitoolkit.library"
#define MUITOOLKIT_VMIN 2


/* some useful macros */

#ifndef NO_MT_MACROS

#define getmutex(obj)       mt_Get( obj,MUIA_Radio_Active )
#define getcycle(obj)       mt_Get( obj,MUIA_Cycle_Active )
#define getstring(obj)      (char *)mt_Get( obj, MUIA_String_Contents )
#define getcheckmark(obj)   mt_Get( obj,MUIA_Selected )
#define getslider(obj)      mt_Get( obj,MUIA_Numeric_Value )
#define gettext(obj)        (char *)mt_Get((obj), MUIA_Text_Contents)
#define copystring(dst,obj) strcpy((dst), (char *)mt_Get((obj), MUIA_String_Contents))

#define settext(obj,val)    set(obj, MUIA_Text_Contents, val)
//#define gettext(obj)        (char *)mt_Get( obj, MUIA_Text_Contents )
#define getnumstring(obj)   mt_Get((obj), MUIA_String_Integer)

#define mt_Sleep(obj)       set(app, MUIA_Application_Sleep, (obj))

#define mt_Disable(obj)     set((obj), MUIA_Disabled, TRUE)
#define mt_Enable(obj)      set((obj), MUIA_Disabled, FALSE)

#endif


//


#ifndef MAKE_ID
#define MAKE_ID(a,b,c,d)        \
        ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
#endif



// macros defined to pair existsing MuiToolkit library calls

#define mt_WinClose(obj)           set( (obj), MUIA_Window_Open, FALSE )
#define mt_StringNumeric(a,b,c,d)  mt_StringAccept((a),(b),(c), "-0123456789", (d) )


/* Object backgrounds */

#define WindowBack     MUIA_Background, MUII_WindowBack
#define RequesterBack  MUIA_Background, MUII_RequesterBack
#define ButtonBack     MUIA_Background, MUII_ButtonBack
#define ListBack       MUIA_Background, MUII_ListBack
#define TextBack       MUIA_Background, MUII_TextBack
#define PropBack       MUIA_Background, MUII_PropBack
#define PopupBack      MUIA_Background, MUII_PopupBack
#define SelectedBack   MUIA_Background, MUII_SelectedBack
#define RegisterBack   MUIA_Background, MUII_RegisterBack
#define TapePlayBack   MUIA_Background, MUII_TapePlayBack
#define GroupBack      MUIA_Background, MUII_GroupBack
#define SliderBack     MUIA_Background, MUII_SliderBack
#define PageBack       MUIA_Background, MUII_PageBack
#define ReadListBack   MUIA_Background, MUII_ReadListBack



#define HBar           MUI_MakeObject( MUIO_HBar, 2)
#define VBar           MUI_MakeObject( MUIO_VBar, 2)


#define Bar            MUI_MakeObject(MUIO_BarTitle, NULL)
#define BarTitle(x)    MUI_MakeObject(MUIO_BarTitle, (x))


/* sets w/o triggering any notification */

#define nnsetmutex(obj,n)     nnset(obj,MUIA_Radio_Active,n)
#define nnsetcycle(obj,n)     nnset(obj,MUIA_Cycle_Active,n)
#define nnsetstring(obj,s)    nnset(obj,MUIA_String_Contents,s)
#define nnsetcheckmark(obj,b) nnset(obj,MUIA_Selected,b)
#define nnsetslider(obj,l)    nnset(obj,MUIA_Numeric_Value,l)



/* window IDs used by internal MT's windows */

#define ID_MT_STRREQ    MAKE_ID('M','T','0','0')
#define ID_MT_INTREQ    MAKE_ID('M','T','0','1')



/* Tags */

#ifndef CARLOS_MUI
#define CARLOS_MUI

#define MUISERIALNR_CARLOS 2447
#define TAGBASE_CARLOS (TAG_USER | ( MUISERIALNR_CARLOS << 16))
#define MT TAGBASE_CARLOS + 0x100
#define MTT(a) (MT + a)
#endif


#define mt_StrReq_WinTitle     MTT(0x000)    /* STRPTR */
#define mt_StrReq_Contents     MTT(0x001)    /* STRPTR */
#define mt_StrReq_Ok           MTT(0x002)    /* STRPTR */
#define mt_StrReq_Cancel       MTT(0x003)    /* STRPTR */
#define mt_StrReq_Secret       MTT(0x004)    /* BOOL   */
#define mt_StrReq_NoEmpty      MTT(0x005)    /* BOOL   */
#define mt_StrReq_GroupTitle   MTT(0x006)    /* STRPTR */
#define mt_StrReq_Info         MTT(0x007)    /* STRPTR */
#define mt_StrReq_StringHelp   MTT(0x008)    /* STRPTR */

#define mt_IntReq_WinTitle     MTT(0x010)    /* STRPTR */
#define mt_IntReq_Value        MTT(0x011)    /* LONG   */
#define mt_IntReq_Ok           MTT(0x012)    /* STRPTR */
#define mt_IntReq_Cancel       MTT(0x013)    /* STRPTR */
#define mt_IntReq_GroupTitle   MTT(0x014)    /* STRPTR */
#define mt_IntReq_Min          MTT(0x015)    /* LONG   */
#define mt_IntReq_Max          MTT(0x016)    /* LONG   */
#define mt_IntReq_Info         MTT(0x017)    /* STRPTR */
#define mt_IntReq_StringHelp   MTT(0x018)    /* STRPTR */


// mt_Check - aligment

#define mt_Check_NoLabel       0
#define mt_Check_AlignRight    1
#define mt_Check_AlignLeft     2


// the trickery

#pragma tagcall MuiToolkitBase mt_GetString 96 A09804
#pragma tagcall MuiToolkitBase mt_GetInteger 9c A9803

#endif /* LIBRARIES_MUITOOLKIT_H */
