home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / Triton / Source / classes / space.c < prev    next >
C/C++ Source or Header  |  1998-05-23  |  4KB  |  108 lines

  1. /*
  2.  *  OpenTriton -- A free release of the triton.library source code
  3.  *  Copyright (C) 1993-1998  Stefan Zeiger
  4.  *
  5.  *  This program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2 of the License, or
  8.  *  (at your option) any later version.
  9.  *
  10.  *  This program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *  GNU General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU General Public License
  16.  *  along with this program; if not, write to the Free Software
  17.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  */
  20.  
  21.  
  22. /****** triton.library/class_Space ******
  23. *
  24. *   NAME    
  25. *    class_Space -- A class of spaces with various sizes
  26. *
  27. *   SUPERCLASS
  28. *    class_DisplayObject
  29. *
  30. *   SYNOPSIS
  31. *    TROB_Space
  32. *
  33. *   ATTRIBUTES
  34. *    <Default>        : ULONG spacetype
  35. *                       - TRST_NONE         : No space
  36. *                       - TRST_SMALL        : Small space
  37. *                       - TRST_NORMAL       : Normal space (default)
  38. *                       - TRST_BIG          : Big space
  39. *                       [create]
  40. *
  41. ******/
  42.  
  43.  
  44. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  45. //////////////////////////////////////////////////////////////////////////////////////// Include our stuff //
  46. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  47.  
  48. #define TR_THIS_IS_TRITON
  49.  
  50. #include <libraries/triton.h>
  51. #include <clib/triton_protos.h>
  52. #include "/internal.h"
  53. #include "space.def"
  54.  
  55.  
  56. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  57. ////////////////////////////////////////////////////////////////////////////////////////////// Object data //
  58. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  59.  
  60. #define OBJECT (&(object->DO.O))
  61. #define DISPLAYOBJECT (&(object->DO))
  62. #define SPACE object
  63.  
  64.  
  65. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  66. ////////////////////////////////////////////////////////////////////////////////////////////////// Methods //
  67. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  68.  
  69. TR_METHOD(Space,NEW,NewData)
  70. {
  71.   if(!TRDP_DisplayObject_NEW(object,messageid,data,metaclass->trc_SuperClass)) return NULL;
  72.  
  73.   DISPLAYOBJECT->XResize=TRUE;
  74.   DISPLAYOBJECT->YResize=TRUE;
  75.   DISPLAYOBJECT->Flags|=TROB_DISPLAYOBJECT_SPACE;
  76.  
  77.   switch(data->itemdata)
  78.     {
  79.     case TRST_SMALL:
  80.       DISPLAYOBJECT->MinHeight=(data->project->trp_PropFont->tf_YSize)/4;
  81.       break;
  82.     case TRST_BIG:
  83.       DISPLAYOBJECT->MinHeight=data->project->trp_PropFont->tf_YSize;
  84.       break;
  85.     case TRST_NONE:
  86.       DISPLAYOBJECT->MinHeight=0;
  87.       break;
  88.     default: /* TRST_NORMAL */
  89.       DISPLAYOBJECT->MinHeight=(data->project->trp_PropFont->tf_YSize)/2;
  90.     }
  91.  
  92.   DISPLAYOBJECT->MinWidth=(DISPLAYOBJECT->MinHeight*data->project->trp_AspectFixing)/16;
  93.  
  94.   if((data->grouptype)==TRGR_Horiz)
  95.     {
  96.       DISPLAYOBJECT->XResize=FALSE;
  97.       DISPLAYOBJECT->MinHeight=0L;
  98.     }
  99.  
  100.   if((data->grouptype)==TRGR_Vert)
  101.     {
  102.       DISPLAYOBJECT->YResize=FALSE;
  103.       DISPLAYOBJECT->MinWidth=0L;
  104.     }
  105.  
  106.   return (ULONG)object;
  107. }
  108.