
/*
$Id: mt_demo.c,v 1.4 1999/10/14 07:43:39 carlos Exp $.
*/

#include <exec/types.h>
#include <exec/memory.h>

#include <proto/exec.h>
#include <proto/muimaster.h>

#include <proto/muitoolkit.h>
#include <libraries/muitoolkit.h>

#include "mt_demo_revision.h"

#include <stdio.h>
#include <stdlib.h>

char *ScreenTitle = "MuiToolkit demo " VERSIONREVISION " (" DATE ") · © 1999-2002 Marcin Orlowski <carlos@amiga.com.pl>";
char *Title       = "MuiToolkit demo " VERSIONREVISION ;

struct Library *MUIMasterBase  = NULL;
struct Library *MuiToolkitBase = NULL;

Object *app;

char *_Ok       = "*_Ok";
char *_Sorry    = "*_I'm sorry";

char *ShortHelp = "This is short help ;-)";

/// ShowRapidGUI


void ShowRapidGUI( void )
{
char *RadioLabel  = "_Radio";
char *StringLabel = "_Type something";

Object *win1, *c1,*c2, *c3,*c4, *bt1_src, *win1a;
Object *win2, *bt2_src, *win2a;


/// win1src
char *win1_src = "win1 = WindowObject,\n"
"    MUIA_Window_Title      , Title,\n"
"    MUIA_Window_ID         , 0x0000,\n"
"    MUIA_Window_ScreenTitle, ScreenTitle,\n"
"    WindowContents,\n"
"        VGroup,\n"
"            Child, TextObject,\n"
"                   TextFrame, TextBack,\n"
"                   MUIA_Text_Contents, \"Classic window\\nClose to proceed\",\n"
"                   MUIA_Text_PreParse, \"\\033c\",\n"
"                   End,\n"
"            Child, HGroup,\n"
"                   Child, Label( StringLabel ),\n"
"                   Child, StringObject, StringFrame,\n"
"                          MUIA_String_Contents, \"A bit of text\",\n"
"                          MUIA_String_MaxLen, 40,\n"
"                          MUIA_CycleChain, TRUE,\n"
"                          MUIA_String_AdvanceOnCR, TRUE,\n"
"                          MUIA_ShortHelp, \"Type something\",\n"
"                          End,\n"
"                   End,\n"
"            Child, ColGroup(3),\n"
"                   Child, TextObject,\n"
"                          ButtonFrame,\n"
"                          MUIA_Text_Contents, \"Button 1\",\n"
"                          MUIA_Text_PreParse, \"\\33c\",\n"
"                          MUIA_Text_HiChar  , '1',\n"
"                          MUIA_ControlChar  , '1',\n"
"                          MUIA_InputMode    , MUIV_InputMode_RelVerify,\n"
"                          MUIA_Background   , MUII_ButtonBack,\n"
"                          MUIA_CycleChain   , TRUE,\n"
"                          MUIA_ShortHelp    , \"Button numer 1\",\n"
"                          End,\n"
"                   Child, TextObject,\n"
"                          ButtonFrame,\n"
"                          MUIA_Text_Contents, \"Button 2\",\n"
"                          MUIA_Text_PreParse, \"\\33c\",\n"
"                          MUIA_Text_HiChar  , '2',\n"
"                          MUIA_ControlChar  , '2',\n"
"                          MUIA_InputMode    , MUIV_InputMode_RelVerify,\n"
"                          MUIA_Background   , MUII_ButtonBack,\n"
"                          MUIA_CycleChain   , TRUE,\n"
"                          MUIA_ShortHelp    , \"Button numer 2\",\n"
"                          End,\n"
"                   Child, TextObject,\n"
"                          ButtonFrame,\n"
"                          MUIA_Text_Contents, \"Button 3\",\n"
"                          MUIA_Text_PreParse, \"\\33c\",\n"
"                          MUIA_Text_HiChar  , '3',\n"
"                          MUIA_ControlChar  , '3',\n"
"                          MUIA_InputMode    , MUIV_InputMode_RelVerify,\n"
"                          MUIA_Background   , MUII_ButtonBack,\n"
"                          MUIA_CycleChain   , TRUE,\n"
"                          MUIA_ShortHelp    , \"Button numer 3\",\n"
"                          End,\n"
"                   Child, TextObject,\n"
"                          ButtonFrame,\n"
"                          MUIA_Text_Contents, \"Button 4\",\n"
"                          MUIA_Text_PreParse, \"\\33c\",\n"
"                          MUIA_Text_HiChar  , '4',\n"
"                          MUIA_ControlChar  , '4',\n"
"                          MUIA_InputMode    , MUIV_InputMode_RelVerify,\n"
"                          MUIA_Background   , MUII_ButtonBack,\n"
"                          MUIA_CycleChain   , TRUE,\n"
"                          MUIA_ShortHelp    , \"Button numer 4\",\n"
"                          End,\n"
"                   Child, TextObject,\n"
"                          ButtonFrame,\n"
"                          MUIA_Text_Contents, \"Button 5\",\n"
"                          MUIA_Text_PreParse, \"\\33c\",\n"
"                          MUIA_Text_HiChar  , '5',\n"
"                          MUIA_ControlChar  , '5',\n"
"                          MUIA_InputMode    , MUIV_InputMode_RelVerify,\n"
"                          MUIA_Background   , MUII_ButtonBack,\n"
"                          MUIA_CycleChain   , TRUE,\n"
"                          MUIA_ShortHelp    , \"Button numer 5\",\n"
"                          End,\n"
"                   Child, TextObject,\n"
"                          ButtonFrame,\n"
"                          MUIA_Text_Contents, \"Button 6\",\n"
"                          MUIA_Text_PreParse, \"\\33c\",\n"
"                          MUIA_Text_HiChar  , '6',\n"
"                          MUIA_ControlChar  , '6',\n"
"                          MUIA_InputMode    , MUIV_InputMode_RelVerify,\n"
"                          MUIA_Background   , MUII_ButtonBack,\n"
"                          MUIA_CycleChain   , TRUE,\n"
"                          MUIA_ShortHelp    , \"Button numer 6\",\n"
"                          End,\n"
"                   End,\n"
"            Child, HGroup,\n"
"                   Child, HGroup,\n"
"                          Child, Label( RadioLabel ),\n"
"                          Child, RadioObject,\n"
"                                 MUIA_Radio_Entries, radio,\n"
"                                 MUIA_CycleChain, TRUE,\n"
"                                 MUIA_ShortHelp, ShortHelp,\n"
"                                 End,\n"
"                          End,\n"
"                   Child, ColGroup(3),\n"
"                          Child, HVSpace,\n"
"                          Child, Label( \"_Check 1\" ),\n"
"                          Child, c1 = KeyCheckMark( FALSE, 'c' ),\n"
"                          Child, c2 = KeyCheckMark( TRUE , 'h' ),\n"
"                          Child, Label( \"C_heck 2\" ),\n"
"                          Child, HVSpace,\n"
"                          Child, c3 = KeyCheckMark( TRUE , 'e' ),\n"
"                          Child, Label( \"Ch_eck 3\" ),\n"
"                          Child, HVSpace,\n"
"                          Child, HVSpace,\n"
"                          Child, Label( \"Chec_k 4\" ),\n"
"                          Child, c4 = KeyCheckMark( FALSE, 'k' ),\n"
"                          End,\n"
"                    End,\n"
"             Child, bt1_src = TextObject,\n"
"                          ButtonFrame,\n"
"                          MUIA_Text_Contents, \"Show source\",\n"
"                          MUIA_Text_PreParse, \"\\33c\",\n"
"                          MUIA_Text_HiChar  , 's',\n"
"                          MUIA_ControlChar  , 's',\n"
"                          MUIA_InputMode    , MUIV_InputMode_RelVerify,\n"
"                          MUIA_Background   , MUII_ButtonBack,\n"
"                          MUIA_CycleChain   , TRUE,\n"
"                          MUIA_ShortHelp    , \"Yes, it should\",\n"
"                          End,\n"
"             End,\n"
"        End;\n"
"if( win1 )\n"
"    {\n"
"    set( c1, MUIA_ShortHelp, ShortHelp );\n"
"    set( c2, MUIA_ShortHelp, ShortHelp );\n"
"    set( c3, MUIA_ShortHelp, ShortHelp );\n"
"    set( c4, MUIA_ShortHelp, ShortHelp );\n"
"    }\n";

//|
/// win2src
char *win2_src = "win2 = WindowObject,\n"
"    MUIA_Window_Title      , Title,\n"
"    MUIA_Window_ID         , 0x0001,\n"
"    MUIA_Window_ScreenTitle, ScreenTitle,\n"
"    WindowContents,\n"
"       VGroup,\n"
"         Child, mt_Text(\"MuiToolkit window\\nClose to proceed\", \"\\033c\"),\n"
"         Child, HGroup,\n"
"                Child, mt_Label(StringLabel),\n"
"                Child, mt_String(\"A bit of text\", 40, StringLabel, \"Type something\"),\n"
"                End,\n"
"         Child, ColGroup(3),\n"
"                Child, mt_Button(\"Button _1\", \"This is button no.1\"),\n"
"                Child, mt_Button(\"Button _2\", \"This is button no.2\"),\n"
"                Child, mt_Button(\"Button _3\", \"This is button no.3\"),\n"
"                Child, mt_Button(\"Button _4\", \"This is button no.4\"),\n"
"                Child, mt_Button(\"Button _5\", \"This is button no.5\"),\n"
"                Child, mt_Button(\"Button _6\", \"This is button no.6\"),\n"
"                End,\n"
"         Child, HGroup,\n"
"                Child, HGroup,\n"
"                       Child, mt_Label( RadioLabel ),\n"
"                       Child, mt_Radio( radio, RadioLabel, ShortHelp ),\n"
"                       End,\n"
"                Child, VGroup,\n"
"                       Child, mt_Check( \"_Check 1\", mt_Check_AlignRight, FALSE, ShortHelp ),\n"
"                       Child, mt_Check( \"C_heck 2\", mt_Check_AlignLeft , TRUE , ShortHelp ),\n"
"                       Child, mt_Check( \"Ch_eck 3\", mt_Check_AlignLeft , TRUE , ShortHelp ),\n"
"                       Child, mt_Check( \"Chec_k 4\", mt_Check_AlignRight, FALSE, ShortHelp ),\n"
"                       End,\n"
"                End,\n"
"         Child, bt2_src = mt_Button(\"_Show source\", \"Yes, it does so ;)\"),\n"
"         End,\n"
"    End;";

//|

char *radio[] = { "Apples",
                  "Bananas",
                  "Plums",
                  NULL };



    win1 = win1a = win2 = win2a = NULL;


    // ...let's construct some dynamically added windows

    // this window is created using standard MUI
    // macros and calls

    win1 = WindowObject,
               MUIA_Window_Title      , Title,
               MUIA_Window_ID         , 0x0000,
               MUIA_Window_ScreenTitle, ScreenTitle,
               WindowContents,
                   VGroup,
                       Child, TextObject,
                              TextFrame, TextBack,
                              MUIA_Text_Contents, "Classic window\nClose to proceed",
                              MUIA_Text_PreParse, "\033c",
                              End,

                       Child, HGroup,

                       Child, Label( StringLabel ),
                       Child, StringObject, StringFrame,
                              MUIA_String_Contents, "A bit of text",
                              MUIA_String_MaxLen, 40,
                              MUIA_CycleChain, TRUE,
                              MUIA_String_AdvanceOnCR, TRUE,
                              MUIA_ShortHelp, "Type something",
                              End,
                       End,

                       Child, ColGroup(3),
                              Child, TextObject,
                                     ButtonFrame,
                                     MUIA_Text_Contents, "Button 1",
                                     MUIA_Text_PreParse, "\33c",
                                     MUIA_Text_HiChar  , '1',
                                     MUIA_ControlChar  , '1',
                                     MUIA_InputMode    , MUIV_InputMode_RelVerify,
                                     MUIA_Background   , MUII_ButtonBack,
                                     MUIA_CycleChain   , TRUE,
                                     MUIA_ShortHelp    , "Button numer 1",
                                     End,
                              Child, TextObject,
                                     ButtonFrame,
                                     MUIA_Text_Contents, "Button 2",
                                     MUIA_Text_PreParse, "\33c",
                                     MUIA_Text_HiChar  , '2',
                                     MUIA_ControlChar  , '2',
                                     MUIA_InputMode    , MUIV_InputMode_RelVerify,
                                     MUIA_Background   , MUII_ButtonBack,
                                     MUIA_CycleChain   , TRUE,
                                     MUIA_ShortHelp    , "Button numer 2",
                                     End,
                              Child, TextObject,
                                     ButtonFrame,
                                     MUIA_Text_Contents, "Button 3",
                                     MUIA_Text_PreParse, "\33c",
                                     MUIA_Text_HiChar  , '3',
                                     MUIA_ControlChar  , '3',
                                     MUIA_InputMode    , MUIV_InputMode_RelVerify,
                                     MUIA_Background   , MUII_ButtonBack,
                                     MUIA_CycleChain   , TRUE,
                                     MUIA_ShortHelp    , "Button numer 3",
                                     End,

                              Child, TextObject,
                                     ButtonFrame,
                                     MUIA_Text_Contents, "Button 4",
                                     MUIA_Text_PreParse, "\33c",
                                     MUIA_Text_HiChar  , '4',
                                     MUIA_ControlChar  , '4',
                                     MUIA_InputMode    , MUIV_InputMode_RelVerify,
                                     MUIA_Background   , MUII_ButtonBack,
                                     MUIA_CycleChain   , TRUE,
                                     MUIA_ShortHelp    , "Button numer 4",
                                     End,
                              Child, TextObject,
                                     ButtonFrame,
                                     MUIA_Text_Contents, "Button 5",
                                     MUIA_Text_PreParse, "\33c",
                                     MUIA_Text_HiChar  , '5',
                                     MUIA_ControlChar  , '5',
                                     MUIA_InputMode    , MUIV_InputMode_RelVerify,
                                     MUIA_Background   , MUII_ButtonBack,
                                     MUIA_CycleChain   , TRUE,
                                     MUIA_ShortHelp    , "Button numer 5",
                                     End,
                              Child, TextObject,
                                     ButtonFrame,
                                     MUIA_Text_Contents, "Button 6",
                                     MUIA_Text_PreParse, "\33c",
                                     MUIA_Text_HiChar  , '6',
                                     MUIA_ControlChar  , '6',
                                     MUIA_InputMode    , MUIV_InputMode_RelVerify,
                                     MUIA_Background   , MUII_ButtonBack,
                                     MUIA_CycleChain   , TRUE,
                                     MUIA_ShortHelp    , "Button numer 6",
                                     End,
                              End,

                       Child, HGroup,
                              Child, HGroup,
                                  Child, Label( RadioLabel ),
                                  Child, RadioObject,
                                         MUIA_Radio_Entries, radio,
                                         MUIA_CycleChain, TRUE,
                                         MUIA_ShortHelp, ShortHelp,
                                         End,
                                  End,
                              Child, ColGroup(3),
                                  Child, HVSpace,
                                  Child, Label( "_Check 1" ),
                                  Child, c1 = KeyCheckMark( FALSE, 'c' ),

                                  Child, c2 = KeyCheckMark( TRUE , 'h' ),
                                  Child, Label( "C_heck 2" ),
                                  Child, HVSpace,

                                  Child, c3 = KeyCheckMark( TRUE , 'e' ),
                                  Child, Label( "Ch_eck 3" ),
                                  Child, HVSpace,

                                  Child, HVSpace,
                                  Child, Label( "Chec_k 4" ),
                                  Child, c4 = KeyCheckMark( FALSE, 'k' ),
                                  End,
                              End,


                       Child, bt1_src = TextObject,
                              ButtonFrame,
                              MUIA_Text_Contents, "Show source",
                              MUIA_Text_PreParse, "\33c",
                              MUIA_Text_HiChar  , 's',
                              MUIA_ControlChar  , 's',
                              MUIA_InputMode    , MUIV_InputMode_RelVerify,
                              MUIA_Background   , MUII_ButtonBack,
                              MUIA_CycleChain   , TRUE,
                              MUIA_ShortHelp    , "Yes, it should",
                              End,
                    End,
                End;


       if( win1 )
           {
           set( c1, MUIA_ShortHelp, ShortHelp );
           set( c2, MUIA_ShortHelp, ShortHelp );
           set( c3, MUIA_ShortHelp, ShortHelp );
           set( c4, MUIA_ShortHelp, ShortHelp );
           }


    win1a = WindowObject,
               MUIA_Window_Title      , "133 lines (100 more!) · Source of classic window",
               MUIA_Window_ID         , 0x0002,
               MUIA_Window_ScreenTitle, ScreenTitle,
               WindowContents,
                   ScrollgroupObject,
                        MUIA_CycleChain, TRUE,
                        MUIA_Scrollgroup_Contents,
                           VirtgroupObject,
                                 Child, mt_Text( win1_src, NULL ),
                                 End,
                        End,
                   End;




    // this window is created with the help of MuiToolkit
    // Taste the difference:
    //  - all objects are automatically cyclechained
    //  - all objects are automatically hotkey driven
    //  - at least 50% of your typing is saved
    //  - adding bubble helps made easy ;-)

    win2 = WindowObject,
               MUIA_Window_Title      , Title,
               MUIA_Window_ID         , 0x0001,
               MUIA_Window_ScreenTitle, ScreenTitle,
               WindowContents,
                   VGroup,
                       Child, mt_Text("MuiToolkit window\nClose to proceed", "\033c"),

                       Child, HGroup,
                              Child, mt_Label( StringLabel ),
                              Child, mt_String("A bit of text", 40, StringLabel, "Type something"),
                              End,

                       Child, ColGroup(3),
                              Child, mt_Button("Button _1", "This is button no.1"),
                              Child, mt_Button("Button _2", "This is button no.2"),
                              Child, mt_Button("Button _3", "This is button no.3"),

                              Child, mt_Button("Button _4", "This is button no.4"),
                              Child, mt_Button("Button _5", "This is button no.5"),
                              Child, mt_Button("Button _6", "This is button no.6"),
                              End,

                       Child, HGroup,
                              Child, HGroup,
                                  Child, mt_Label( RadioLabel ),
                                  Child, mt_Radio( radio, RadioLabel, ShortHelp ),
                                  End,
                              Child, VGroup,
                                  Child, mt_Check( "_Check 1", mt_Check_AlignRight, FALSE, ShortHelp ),
                                  Child, mt_Check( "C_heck 2", mt_Check_AlignLeft , TRUE , ShortHelp ),
                                  Child, mt_Check( "Ch_eck 3", mt_Check_AlignLeft , TRUE , ShortHelp ),
                                  Child, mt_Check( "Chec_k 4", mt_Check_AlignRight, FALSE, ShortHelp ),
                                  End,
                              End,

                       Child, bt2_src = mt_Button("_Show source", "Yes, it does so ;)"),

                       End,
                End;


    win2a = WindowObject,
               MUIA_Window_Title      , "33 lines - Source of MT powered window",
               MUIA_Window_ID         , 0x0003,
               MUIA_Window_ScreenTitle, ScreenTitle,
               WindowContents,
                   ScrollgroupObject,
                        MUIA_CycleChain, TRUE,
                        MUIA_Scrollgroup_Contents,
                           VirtgroupObject,
                                 Child, mt_Text( win2_src, NULL ),
                                 End,
                           End,
                   End;


    if( win1 && win2 && win1a && win2a )
       {
       DoMethod( win1, MUIM_Notify, MUIA_Window_CloseRequest, TRUE ,MUIV_Notify_Application, 2 ,MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit );
       DoMethod( win2, MUIM_Notify, MUIA_Window_CloseRequest, TRUE ,MUIV_Notify_Application, 2 ,MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit );

       DoMethod( win1a, MUIM_Notify, MUIA_Window_CloseRequest, TRUE ,MUIV_Notify_Self, 3 , MUIM_Set, MUIA_Window_Open, FALSE );
       DoMethod( bt1_src, MUIM_Notify, MUIA_Pressed, FALSE, win1a, 3 ,MUIM_Set, MUIA_Window_Open, TRUE );

       DoMethod( win2a, MUIM_Notify, MUIA_Window_CloseRequest, TRUE ,MUIV_Notify_Self, 3 , MUIM_Set, MUIA_Window_Open, FALSE );
       DoMethod( bt2_src, MUIM_Notify, MUIA_Pressed, FALSE, win2a, 3 ,MUIM_Set, MUIA_Window_Open, TRUE );


       MUI_Request(app, NULL, 0, Title, "*Show me",
           "\033u\033bGoal #1:\033n\n\n"
           "Rapid GUI creation.\n\n"

           "I guess you probably realized, there\n"
           "is no GUI builder for making good\n"
           "object oriented GUI. The best results can\n"
           "as usual, be reached by creating it by hand.\n"
           "And MT is gonna help you at this field,\n"
           "offering basic object creation functions.\n"
           "Instead of writting lines of calls, tags etc\n"
           "to get useable and good GUI, just call one\n"
           "MT call...");

       MUI_Request(app, NULL, 0, Title, "*Wanna see this",
           "I now show you two, almost same windows.\n"
           "the \033b\"Classic\"\033n one is created using\n"
           "all the default MUI functions and macros.\n"
           "The next one \033b\"MT\"\033n is powered by MT.\n\n"
           "Click the \033b\"Show source\"\033n to taste the difference\n"
           "(and close any of these windows to proceed)");


       mt_WinAttach( app, win1  );
       mt_WinAttach( app, win1a );
       mt_WinAttach( app, win2  );
       mt_WinAttach( app, win2a );


       if( mt_WinOpen( win1 ) && mt_WinOpen( win2 ) )
           {
           ULONG sigs = 0;

           // the main loop
           while(DoMethod(app,MUIM_Application_NewInput,&sigs) != MUIV_Application_ReturnID_Quit)
               {
               if(sigs)
                   {
                   sigs = Wait(sigs | SIGBREAKF_CTRL_C);
                   if(sigs & SIGBREAKF_CTRL_C) break;
                   }
               }


           // not necessary, as disposing window object
           // will make it closed, but it's GoodThing{tm}
           // to always clean up
           mt_WinClose( win1 );
           mt_WinClose( win2 );
           }
       else
           {
           printf("Can't create windows!\n");
           }
       }

       // let's destroy our windows
       // it's safe to pass NULL as argument
       mt_WinDetach( app, win1  );
       mt_WinDetach( app, win1a );
       mt_WinDetach( app, win2  );
       mt_WinDetach( app, win2a );


}
//|
/// ShowGetString

#define STR_ANSWER  MUI_Request(app, NULL, 0, Title, _Ok, "You entered:\n\"%s\"", tmp); else MUI_Request(app, NULL, 0, Title, _Sorry, "Requester cancelled" );

void ShowGetString( void )
{
char tmp[50];


    MUI_Request(app, NULL, 0, Title, "*Pop it up",
           "\033u\033bmt_GetString()\033n\n\n"
           "Now, asking user for any string won't be\n"
           "a pain any longer..." );


    if( mt_GetString( app, tmp, sizeof( tmp ),
                           mt_StrReq_Contents, "Hello",
                           TAG_DONE )
      )
    STR_ANSWER


    MUI_Request(app, NULL, 0, Title, "*Really?",
           "The appearance of the requester is\n"
           "highly configurable...");


    if( mt_GetString( app, tmp, sizeof( tmp ),
                           mt_StrReq_WinTitle  , "Tricky day",
                           mt_StrReq_GroupTitle, "Clap your hands!",
                           mt_StrReq_Ok        , "_Cancel",
                           mt_StrReq_Cancel    , "_Ok",
                           mt_StrReq_Contents  , "Well, the 'Cancel' is 'Ok' ;)",
                           TAG_DONE )
      )
    STR_ANSWER


    if( mt_GetString( app, tmp, sizeof( tmp ),
                           mt_StrReq_Info    , "\033cAdditional info panel "
                                               "appears to be quite useful for "
                                               "many purposes, don't you think?\n\n"
                                               "By the way, this requester won't "
                                               "accept empty positive answers...",
                           mt_StrReq_StringHelp, "Ah, custom short help ;)",
                           mt_StrReq_NoEmpty , TRUE,
                           TAG_DONE )
      )
    STR_ANSWER


}
//|
/// ShowGetInteger

#define INT_ANSWER       MUI_Request(app, NULL, 0, Title, _Ok, "You entered:\n\"%ld\"", tmp); else MUI_Request(app, NULL, 0, Title, _Sorry, "Requester cancelled" );


void ShowGetInteger(void)
{

LONG tmp;


    MUI_Request(app, NULL, 0, Title, "*Pop it up",
           "\033u\033bmt_GetInteger()\033n\n\n"
           "Integer value? No problem..." );


    if( mt_GetInteger( app, &tmp,
                       mt_IntReq_Value, 0,
                       TAG_DONE )
      )
    INT_ANSWER


    if( mt_GetInteger( app, &tmp,
                       mt_IntReq_Info, "\033cThe requester accepts "
                                       "negative values as well!",
                       TAG_DONE )
      )
    INT_ANSWER


    MUI_Request(app, NULL, 0, Title, "*Marvelous",
                       "Bounds are also supported...\n"
                       "Both separately...");

    if( mt_GetInteger( app, &tmp,
                           mt_IntReq_Min, 30,
                           TAG_DONE )
      )
    INT_ANSWER


    if( mt_GetInteger( app, &tmp,
                           mt_IntReq_Max, -50,
                           TAG_DONE )
      )
    INT_ANSWER


    MUI_Request(app, NULL, 0, Title, "*Oh, my God!",
                       "...and together..." );

    if( mt_GetInteger( app, &tmp,
                           mt_IntReq_Min, 30,
                           mt_IntReq_Max, 50,
                           TAG_DONE )
      )
    INT_ANSWER


    MUI_Request(app, NULL, 0, Title, "*Really?",
           "As usual the appearance of the\n"
           "requester is highly configurable...");


    if( mt_GetInteger( app, &tmp,
                           mt_IntReq_Info      , "You have no Windows installed yet?\n\n"
                                                 "Good boy...",
                           mt_IntReq_WinTitle  , "Tricky day",
                           mt_IntReq_Ok        , "_Cancel",
                           mt_IntReq_Cancel    , "_Ok",
                           mt_IntReq_Value     , 666,
                           mt_IntReq_StringHelp, "Well, the 'Cancel' is 'Ok' ;)",
                           TAG_DONE )
      )
    INT_ANSWER


}

//|
/// main
void main( void )
{


    MUIMasterBase = (APTR) OpenLibrary( MUIMASTER_NAME, MUIMASTER_VMIN );
    MuiToolkitBase = (APTR) OpenLibrary( MUITOOLKIT_NAME, MUITOOLKIT_VMIN );


    if( MuiToolkitBase && MUIMasterBase )
       {

       // application object is a must ;)
       app = ApplicationObject,
                 MUIA_Application_Title      , "MT-Demo",
                 MUIA_Application_Version    , VERSTAG,
                 MUIA_Application_Copyright  , "© 1999 W.F.M.H.",
                 MUIA_Application_Author     , "Marcin Orlowski <carlos@amiga.com.pl>",
                 MUIA_Application_Description, Title,
                 MUIA_Application_Base       , "MTDEMO",
                 End;


       // let's go
       if( app )
           {
           MUI_Request(app, NULL, 0, Title, "*Let's go",
                   "\033u\033b%s (%s)\033n\n\n"
                   "This library is designed to help\n"
                   "you make better MUI applications.\n"
                   "It features many helpful functions\n"
                   "for both rapid gui programming as\n"
                   "well as support functions.\n\n"

                   "As it's programmer's toolbox, you won't\n"
                   "see all the adventages just by watching\n"
                   "this demo, you have to see the enclosed\n"
                   "source code of it. But we try to show you\n"
                   "as much as possible too.", VERS, DATE
                   );


           ShowRapidGUI();


           MUI_Request(app, NULL, 0, Title, "*Show me",
                   "\033u\033bGoal #2:\033n\n\n"
                   "\033iSupport functions\033n\n\n"
                   "Among object creation calls, MT features\n"
                   "other helpful functions, like for instance\n"
                   "requesters. No, not like this one...");

           ShowGetString();
           ShowGetInteger();


           MUI_Request(app, NULL, 0, Title, "*I like it",
                   "\033u\033bThat's it for now\033n\n\n"
                   "You recently reached the end of this\n"
                   "little demonstration. Hope you like it.\n\n"
                   "This is freeware software, so feel free to\n"
                   "use it in your own projects (I don't mind\n"
                   "a credit of course ;)" );

           MUI_Request(app, NULL, 0, Title, "*Great",
                   "\033u\033bNobody's perfect...\033n\n\n"
                   "So if this library lacks any function you\n"
                   "think is basic and would be nice to appear\n"
                   "among the available calls, please contact me.\n"
                   "I don't mind ready-to-use C sources and so on.\n\n"
                   "\033bAny contribution is warmly welcome!\033n\n\n"
                   "\033iPlease read the \"Contributions\" file for details\n"
                   "about how to contribute the project or how to get\n"
                   "the source snapshot!\033n");


           MUI_Request(app, NULL, 0, Title, "*Fine",
                   "\033u\033bQuestions, bug reports, anything?\033n\n\n"
                   "Marcin Orlowski\n"
                   "P.O. Box 91\n"
                   "71-507 Szczecin 5\n"
                   "Poland\n\n"
                   "e-mail: carlos@amiga.com.pl\n"
                   "Home site: http://wfmh.org.pl/~carlos/" );

           }
       else
           {
           printf("Can't create MUI application!\n");
           }
       }
    else
       {
       if( MUIMasterBase )
           {
           MUI_Request(app, NULL, 0, Title, "*I'll check",
                           "Can't open %s v%ld\n"
                           "Make sure it's in either \"MUI:Libs/\"\n"
                           "or \"LIBS:\" or in home directory of this\n"
                           "demonstration program!",
                           MUITOOLKIT_NAME, MUITOOLKIT_VMIN );
           }
       else
           {
           printf("** Can't open %s, v%ld\n", MUIMASTER_NAME, MUIMASTER_VMIN );

           if( !MuiToolkitBase )
               printf("** Can't open %s, v%ld\n", MUITOOLKIT_NAME, MUITOOLKIT_VMIN );
           }
       exit(20);
       }


    if( MuiToolkitBase)  CloseLibrary( MuiToolkitBase );
    if( MUIMasterBase )  CloseLibrary( MUIMasterBase  );


    exit(0);
}
//|
