! $XConsortium: xmanimate.uil /main/4 1996/07/15 15:13:12 drk $
! Motif
!
! Copyright (c) 1987-2012, The Open Group. All rights reserved.
!
! These libraries and programs are free software; you can
! redistribute them and/or modify them under the terms of the GNU
! Lesser General Public License as published by the Free Software
! Foundation; either version 2 of the License, or (at your option)
! any later version.
!
! These libraries and programs are distributed in the hope that
! they will be useful, but WITHOUT ANY WARRANTY; without even the
! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
! PURPOSE. See the GNU Lesser General Public License for more
! details.
!
! You should have received a copy of the GNU Lesser General Public
! License along with these librararies and programs; if not, write
! to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
! Floor, Boston, MA 02110-1301 USA
! 
! 
! HISTORY

!***************************************************************
!*                                                            **
!*   Motifanim general interface.                             **
!*   Author : Daniel Dardailler, March 90, June 90, August 91 **
!*                                                            **
!**************************************************************/
module motifanim
    version = 'v1.0'
    names = case_sensitive

procedure
    p_motifanim_start();    
    p_motifanim_stop();    
    p_motifanim_step();
    p_motifanim_speed(integer);
    p_motifanim_exit();
    p_motifanim_help();
    p_motifanim_draw(integer);	


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The main is a big Form that try to manage its children 
! as well as possible...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

object
    motifanim_main : XmMainWindow {
       controls {
            XmMenuBar     motifanim_bar ;
            XmForm        motifanim_form ;
       };
    };

object
    motifanim_form : XmForm {
	arguments { 
	    XmNdefaultButton = motifanim_start ;
	};
	controls {
	    XmScrolledWindow    motifanim_view;
	    XmSeparator		motifanim_sep;
	    XmPushButton	motifanim_start;
	    XmPushButton	motifanim_stop;
	    XmPushButton	motifanim_step;
	    XmScale		motifanim_speed;
	};
    };

!-------------------------------------------------------
! As a geometry starting point, we fix the bottom line of 
! PushButtons (start, stop..) to the Form bottom and sides
! and the menubar to the top
!-------------------------------------------------------

object
    motifanim_bar : XmMenuBar {
	arguments {
	    XmNmenuHelpWidget = XmCascadeButton help_entry;
         };
         controls {                              
            XmCascadeButton file_menu_entry;
            XmCascadeButton help_entry;
         };
    };

object
        file_menu_entry : XmCascadeButton {
            arguments {
                XmNlabelString = compound_string('File') ;
		XmNmnemonic = keysym("F");
            };                                            
            controls {
                XmPulldownMenu file_menu;
            };
        };
object
        help_entry : XmCascadeButton {
            arguments {
                XmNlabelString = compound_string('Help') ;
		XmNmnemonic = keysym("H");
            };                                            
            controls {
                XmPulldownMenu help_menu;
            };
        };

object
        file_menu : XmPulldownMenu {
            controls {
                XmPushButton motifanim_quit;
            };
        };
object
        help_menu : XmPulldownMenu {
            controls {
                XmPushButton motifanim_help;
            };
        };

object
    motifanim_quit : XmPushButton {
	arguments { 
	    XmNlabelString = compound_string('Quit');
 	    XmNmnemonic = keysym("Q");
	};
	callbacks { 
	    XmNactivateCallback = procedure p_motifanim_exit();
	};
    };
object
    motifanim_help : XmPushButton {
	arguments { 
	    XmNlabelString = compound_string('Overview');
 	    XmNmnemonic = keysym("O");
	};
	callbacks { 
	    XmNactivateCallback = procedure p_motifanim_help();
	};
    };

object
    motifanim_start : XmPushButton {
	arguments { 
	    XmNlabelString = compound_string('Start');
	    XmNbottomAttachment = XmATTACH_FORM ;
	    XmNleftAttachment = XmATTACH_FORM ;
	};
	callbacks { 
	    XmNactivateCallback = procedure p_motifanim_start();
	};
    };

object
    motifanim_stop : XmPushButton {
	arguments { 
	    XmNlabelString = compound_string('Stop');
	    XmNbottomAttachment = XmATTACH_FORM ;
	    XmNleftAttachment = XmATTACH_WIDGET ;
	    XmNleftWidget = XmPushButton motifanim_start ;
	};
	callbacks { 
	    XmNactivateCallback = procedure p_motifanim_stop();
	};
    };

object
    motifanim_step : XmPushButton {
	arguments { 
	    XmNlabelString = compound_string('One step');
	    XmNbottomAttachment = XmATTACH_FORM ;
	    XmNleftAttachment = XmATTACH_WIDGET ;
	    XmNleftWidget = XmPushButton motifanim_stop ;
	};
	callbacks { 
	    XmNactivateCallback = procedure p_motifanim_step();
	};
    };

object
    motifanim_speed : XmScale {
	arguments { 
	    XmNtitleString = compound_string('Speed');
	    XmNorientation = XmHORIZONTAL ;
	    XmNbottomAttachment = XmATTACH_FORM ;
	    XmNleftAttachment = XmATTACH_WIDGET ;
	    XmNleftWidget = XmPushButton motifanim_step ;
	};
	callbacks { 
	    MrmNcreateCallback = procedure p_motifanim_speed(0);
	    XmNdragCallback = procedure p_motifanim_speed(1);
	    XmNvalueChangedCallback = procedure p_motifanim_speed(2);
        };
    };



!-------------------------------------------------------
! Now that the bottom pushbuttons are fixed,
! we attach the Separator to the first one in the line
!-------------------------------------------------------


object
    motifanim_sep : XmSeparator {
	arguments {
	    XmNrightAttachment = XmATTACH_FORM ;
	    XmNleftAttachment = XmATTACH_FORM ;
	    XmNbottomAttachment = XmATTACH_WIDGET ;
	    XmNbottomWidget = motifanim_speed ;
	};
    };



!-------------------------------------------------------
! This one is full rubber
!-------------------------------------------------------

object
    motifanim_view : XmScrolledWindow {
	arguments {
	    XmNrightAttachment = XmATTACH_FORM ;
	    XmNtopAttachment = XmATTACH_FORM ;
	    XmNbottomAttachment = XmATTACH_WIDGET ;
	    XmNbottomWidget = XmSeparator motifanim_sep ;
	    XmNleftAttachment = XmATTACH_FORM ;
	    XmNscrollingPolicy = XmAUTOMATIC ;
	};
	controls {
	    XmDrawingArea	view_anim ;
	};
    };

value
	anim_width     : imported integer ;
	anim_height    : imported integer ;
	anim_backcolor : imported color ;

object
    view_anim : XmDrawingArea {
	arguments { 
	    XmNwidth = anim_width ;
	    XmNheight = anim_height ;
	    XmNbackground = anim_backcolor ;
	};
	callbacks {
	    MrmNcreateCallback = procedure p_motifanim_draw(0);
	    XmNexposeCallback = procedure p_motifanim_draw(1);
	};
    };

end module;


