home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 5 / amigaformatcd05.iso / mui / developer / autodocs / mui_group.doc < prev    next >
Text File  |  1996-08-13  |  16KB  |  550 lines

  1. TABLE OF CONTENTS
  2.  
  3. Group.mui/Group.mui
  4. Group.mui/MUIA_Group_ActivePage
  5. Group.mui/MUIA_Group_Child
  6. Group.mui/MUIA_Group_ChildList
  7. Group.mui/MUIA_Group_Columns
  8. Group.mui/MUIA_Group_Horiz
  9. Group.mui/MUIA_Group_HorizSpacing
  10. Group.mui/MUIA_Group_LayoutHook
  11. Group.mui/MUIA_Group_PageMode
  12. Group.mui/MUIA_Group_Rows
  13. Group.mui/MUIA_Group_SameHeight
  14. Group.mui/MUIA_Group_SameSize
  15. Group.mui/MUIA_Group_SameWidth
  16. Group.mui/MUIA_Group_Spacing
  17. Group.mui/MUIA_Group_VertSpacing
  18. Group.mui/MUIM_Group_ExitChange
  19. Group.mui/MUIM_Group_InitChange
  20. Group.mui/Group.mui
  21.  
  22.     Group class is responsible for the complete layout
  23.     of a MUI window. A group may contain any number of
  24.     child objects, maybe buttons, cycle gadgets or
  25.     even other groups.
  26.  
  27.     Some attributes of group class define how the children
  28.     of a group are layouted. You can e.g. tell your group
  29.     to place its children horizontally (in a row) or
  30.     vertically (in a column). Since every MUI object knows
  31.     about its minimum and maximum dimensions, group class
  32.     has everything it needs to do that job.
  33.  
  34.     More sophisticated layout is possible by assigning
  35.     different weights to objects in a group or by
  36.     making a group two-dimensional.
  37.  
  38.     Beneath the layout issues, a group object passes
  39.     attributes and methods through to all of its
  40.     children. Thus, you can talk and listen to any
  41.     child of a group by talking and listening to the
  42.     group itself.
  43. Group.mui/MUIA_Group_ActivePage
  44.  
  45.     NAME
  46.     MUIA_Group_ActivePage -- (V5 ) [ISG], LONG
  47.  
  48.     SPECIAL INPUTS
  49.     MUIV_Group_ActivePage_First
  50.     MUIV_Group_ActivePage_Last
  51.     MUIV_Group_ActivePage_Prev
  52.     MUIV_Group_ActivePage_Next
  53.     MUIV_Group_ActivePage_Advance
  54.  
  55.     FUNCTION
  56.     Set (or get) the active page of a page group.
  57.     Only this active page is displayed, all others
  58.     are hidden.
  59.  
  60.     The value may range from 0 (for the first child)
  61.     to numchildren-1 (for the last child). Children are
  62.     adressed in the order of creation:
  63.  
  64.     PageGroup,
  65.        Child, Page_0_Object,
  66.        Child, Page_1_Object,
  67.        Child, Page_2_Object,
  68.        Child, Page_3_Object,
  69.        End;
  70.  
  71.     Note: You may *never* supply an incorrect page value!
  72.  
  73.     SEE ALSO
  74.     MUIA_Group_PageMode
  75. Group.mui/MUIA_Group_Child
  76.  
  77.     NAME
  78.     MUIA_Group_Child -- (V4 ) [I..], Object *
  79.  
  80.     FUNCTION
  81.     You supply a pointer to a previously created MUI object
  82.     here. This object will be treated as child of the group,
  83.     the group is responsible for positioning the object.
  84.  
  85.     Of course you can specify any number of child objects,
  86.     limited only by available memory.
  87.  
  88.     Normally, the value for a MUIA_Group_Child tag is
  89.     a direct call to another MUI_NewObject(), children
  90.     are generated "on the fly".
  91.  
  92.     When a group is disposed, all of its children will also
  93.     get deleted. If you supply a NULL pointer as child,
  94.     the group object will fail and previously dispose all
  95.     valid children found in the taglist.
  96.  
  97.     This behaviour makes it possible to generate a complete
  98.     application within one single (but long) MUI_NewObject()
  99.     call. Error checking is not necessary since every error,
  100.     even if it occurs in a very deep nesting level, will
  101.     cause the complete call to fail without leaving back
  102.     any previously created object.
  103.  
  104.    EXAMPLES
  105.     Please have a look at some of the supplied example
  106.     programs.
  107.  
  108.    SEE ALSO
  109.     MUIA_Group_Horiz
  110. Group.mui/MUIA_Group_ChildList
  111.  
  112.     NAME
  113.     MUIA_Group_ChildList -- (V4 ) [..G], struct List *
  114.  
  115.     FUNCTION
  116.     This attribute returns a pointer to a struct List in which
  117.     a group manages its children.
  118.  
  119.     The only thing you are allowed to do with this list is
  120.     to traverse through the children. You *must* use
  121.     intuition.library/NextObject() for this purpose!
  122.  
  123.     Never add or remove member directly, use the 
  124.     OM_ADDMEMBER/OM_REMMEMBER methods instead!
  125.  
  126.     SEE ALSO
  127.     MUIA_Group_Child
  128. Group.mui/MUIA_Group_Columns
  129.  
  130.     NAME
  131.     MUIA_Group_Columns -- (V4 ) [IS.], LONG
  132.  
  133.     FUNCTION
  134.     Indicate number of columns in a two dimensional group.
  135.     If you use this tag, the total number of children must
  136.     be dividable by the number of columns.
  137.  
  138.     The children will be positioned in a two dimensional
  139.     array, e.g. allowing easy creation of button fields
  140.     (maybe for calculator).
  141.  
  142.     The children in your taglist are always read line 
  143.     by line.
  144.  
  145.     When MUI layouts two-dimensional groups, it does
  146.     actually two layout calculations, one for the rows
  147.     and one the columns. Parameters like weights and
  148.     dimensions are handled this way:
  149.  
  150.     - the minimum width of a column/row is the maximum
  151.       minimum width of all objects in this column/row.
  152.  
  153.     - the maximum width of a column/row is the minimum
  154.       maximum width of all objects in this column/row.
  155.  
  156.     - the weight of a column/row is the sum of all
  157.       objects in this column/row.
  158.  
  159.     Actually, there is no difference if you use
  160.     MUIA_Group_Columns or MUIA_Group_Rows.
  161.  
  162.     EXAMPLE
  163.  
  164.     /* group of labeled string gadgets */
  165.  
  166.     GroupObject,
  167.        MUIA_Group_Columns, 2,
  168.        MUIA_Group_Child  , label1,
  169.        MUIA_Group_Child  , string1,
  170.        MUIA_Group_Child  , label2,
  171.        MUIA_Group_Child  , string2,
  172.        MUIA_Group_Child  , label3,
  173.        MUIA_Group_Child  , string3,
  174.            ...
  175.        End;
  176.  
  177.     SEE ALSO
  178.     MUIA_Group_Rows, MUIA_Group_Horiz
  179. Group.mui/MUIA_Group_Horiz
  180.  
  181.     NAME
  182.     MUIA_Group_Horiz -- (V4 ) [I..], BOOL
  183.  
  184.     FUNCTION
  185.     Boolean value to indicate whether the objects in
  186.     this group shall be layouted horizontally or
  187.     vertically. Defaults to FALSE.
  188.  
  189.     This is the easy way of telling your group how
  190.     it has to look like. If you want two-dimensional
  191.     groups, you have to use MUIA_Group_Columns
  192.     or MUIA_Group_Rows.
  193.  
  194.     EXAMPLE
  195.     GroupObject,
  196.        MUIA_Group_Horiz, TRUE,
  197.        MUIA_Group_Child, obj1,
  198.        MUIA_Group_Child, obj2,
  199.        MUIA_Group_Child, obj3,
  200.        End;
  201.  
  202.     SEE ALSO
  203.     MUIA_Group_Columns, MUIA_Group_Rows, MUIA_Group_Child
  204. Group.mui/MUIA_Group_HorizSpacing
  205.  
  206.     NAME
  207.     MUIA_Group_HorizSpacing -- (V4 ) [ISG], LONG
  208.  
  209.     FUNCTION
  210.     Number of pixels to be inserted between horizontal
  211.     elements of a group.
  212.  
  213.     Please use this tag wisely, you will override the
  214.     user's prefered default setting!
  215.  
  216.     SEE ALSO
  217.     MUIA_Group_Spacing, MUIA_Group_VertSpacing
  218. Group.mui/MUIA_Group_LayoutHook
  219.  
  220.     NAME
  221.     MUIA_Group_LayoutHook -- (V11) [I..], struct Hook *
  222.  
  223.     FUNCTION
  224.     Since version 11 of muimaster.library, you have the
  225.     ability to customize the way objects are placed in a
  226.     group. Altough MUI features a very powerful builtin
  227.     layout algorithm which serves well for almost all
  228.     GUI related purposes, it might sometimes become
  229.     handy to override this with custom code.
  230.  
  231.     Imagine you want to build a multimedia document
  232.     viewer which contains text objects, bitmap objects
  233.     and buttons. An easy way for doing this is to simply
  234.     create a sub class of group class which contains all
  235.     the documents elements as MUI objects and which
  236.     specifies a custom layout hook for the parent group.
  237.     This hook is then responsible for placing the
  238.     objects within the bounds of the parent group.
  239.  
  240.     As soon as you specify a MUIA_Group_LayoutHook, the
  241.     builtin layout calculation is skipped and your hook
  242.     is called whenever MUI needs some information.
  243.     Register A2 will contain a pointer to the parent
  244.     group object and register A1 will contain a pointer
  245.     to a struct MUI_LayoutMsg. The lm_Type field of
  246.     this structure determines which kind of action MUI
  247.     wants you to perform (see below), the lm_Children
  248.     field is a pointer to a list of your groups
  249.     children. By traversing through list list with the
  250.     intuition function NextObject(), you can retrieve
  251.     the children of the group.
  252.  
  253.     If lm_Type == MUILM_ASKMINMAX, MUI wants you to
  254.     calculate your groups minimum, maximum and default
  255.     sizes. At this time, the children of your group have
  256.     already been asked for their dimensions. This allows
  257.     you to traverse through the list of children and do
  258.     some calculations depending on their min/max sizes.
  259.     Use the macros _minwidth(child), _maxwidth(child),
  260.     _minheight(child), _maxheight(child) for this
  261.     purpose. Place the result of your calculations in
  262.     the structure lm_MinMax of the MUI_LayoutMsg and
  263.     exit your hook with a return value of 0.
  264.  
  265.     If lm_Type == MUILM_LAYOUT, MUI has already placed
  266.     the group object somewhere in a window and now wants
  267.     you to place the children of this group. You have to
  268.     traverse through the child list and calculate
  269.     positions and sizes for each child. Use the function
  270.     MUI_Layout() to tell the child where it should
  271.     appear. You have to make sure that you don't place
  272.     child objects outside of the parent group and you
  273.     should generally avoid overlapping objects. Return
  274.     TRUE if all children are placed, return FALSE if you
  275.     were for some reasons unable to place your children.
  276.  
  277.     If your previous min/max calculations were correct,
  278.     your algorithms should not have problems to place
  279.     all the children in the rectangle defined by the
  280.     parent group. Its size will never be smaller as your
  281.     specified minimum dimensions and never be larger as
  282.     your specified maximum dimensions.
  283.  
  284.     If your group is a virtual group, the width
  285.     and height your layout hook receives are as big as
  286.     the *visible* part of the virtual group. In this
  287.     case, you are allowed to position your objects
  288.     outside of the visible part, i.e. you are not
  289.     limited to keep your objects inside the given width
  290.     and height. Place them where you wish and set
  291.     lm_Layout.Width and lm_Layout.Height to the width
  292.     and height you really need for your objects before
  293.     exiting. The virtual width and height of your group
  294.     will be adjusted accordingly.
  295.  
  296.     EXAMPLE
  297.     see MUI demo program Layout.c
  298.  
  299.     SEE ALSO
  300.     muimaster.library/MUI_Layout()
  301. Group.mui/MUIA_Group_PageMode
  302.  
  303.     NAME
  304.     MUIA_Group_PageMode -- (V5 ) [I..], BOOL
  305.  
  306.     FUNCTION
  307.     Settings this attribute to TRUE makes the current group a page
  308.     group. Page groups always display only one of their children, 
  309.     which one can be adjusted with the MUIA_Group_ActivePage 
  310.     attribute.
  311.  
  312.     Imagine you have a preferences window with several different
  313.     pages, e.g. the MUI preferences with object, frame, image,
  314.     font, screen, keyboard and system prefs. Instead of one
  315.     separate window for each group, you could put all pages into
  316.     one page group and have a cycle gadget for page switching.
  317.     This will make your program easier to use since the user
  318.     won't have to handle a lot of windows. However, he will not
  319.     be able to work with more than one page at the same time.
  320.  
  321.     Sizes are calculated as follows:
  322.  
  323.     The minimum width/height of a page group is the maximum
  324.     minimum width/height of all its children.
  325.  
  326.     The maximum width/height of a page group is the minimum
  327.     maximum width/height of all its children.
  328.  
  329.     When the maximum width/height of a child in a page group is
  330.     smaller than the minimum width/height of the page group
  331.     (since it contains another child with big minimum width/height),
  332.     the child be centered.
  333.  
  334.     Page groups are not limited in depth, children of a page
  335.     group may of course be other page groups.
  336.  
  337.     If you want to have a gadget only visible under certain
  338.     conditions, you could make a page group containing this
  339.     gadget and an empty rectangle object.
  340.  
  341.     If you want TAB cycling for the objects in a page group,
  342.     simply include all objects in the cycle chain (as if
  343.     they all were visible at the same time).
  344.  
  345.     EXAMPLE
  346.     demo program "Pages.c"
  347.  
  348.     SEE ALSO
  349.     MUIA_Group_ActivePage
  350. Group.mui/MUIA_Group_Rows
  351.  
  352.     NAME
  353.     MUIA_Group_Rows -- (V4 ) [IS.], LONG
  354.  
  355.     FUNCTION
  356.     Indicate number of rows in a two dimensional group.
  357.     If you use this tag, the total number of children must
  358.     be dividable by the number of rows.
  359.  
  360.     The children will be positioned in a two dimensional
  361.     array, e.g. allowing easy creation of button fields
  362.     (maybe for calculator).
  363.  
  364.     The children in your taglist are always read line
  365.     by line.
  366.  
  367.     When MUI layouts two-dimensional groups, it does
  368.     actually two layout calculations, one for the rows
  369.     and one the columns. Parameters like weights and
  370.     dimensions are handled this way:
  371.  
  372.     - the minimum width of a column/row is the maximum
  373.       minimum width of all objects in this column/row.
  374.  
  375.     - the maximum width of a column/row is the minimum
  376.       maximum width of all objects in this column/row.
  377.  
  378.     - the weight of a column/row is the sum of all
  379.       objects in this column/row.
  380.  
  381.     Actually, there is no difference if you use
  382.     MUIA_Group_Columns or MUIA_Group_Rows.
  383.  
  384.     SEE ALSO
  385.     MUIA_Group_Columns, MUIA_Group_Horiz
  386. Group.mui/MUIA_Group_SameHeight
  387.  
  388.     NAME
  389.     MUIA_Group_SameHeight -- (V4 ) [I..], BOOL
  390.  
  391.     FUNCTION
  392.     Boolean value to indicate that all children of this
  393.     group shall have the same height.
  394.  
  395.     BUGS
  396.     Up to version 5 of groupclass, using MUIA_Group_SameHeight
  397.     could make objects larger than their maximum height. This
  398.     has been fixed for version 6.
  399.  
  400.     SEE ALSO
  401.     MUIA_Group_SameSize, MUIA_Group_SameWidth
  402. Group.mui/MUIA_Group_SameSize
  403.  
  404.     NAME
  405.     MUIA_Group_SameSize -- (V4 ) [I..], BOOL
  406.  
  407.     FUNCTION
  408.     This is a shorthand for MUIA_Group_SameWidth and
  409.     MUIA_Group_SameHeight, it sets both of these
  410.     attributes at once.
  411.  
  412.     Using MUIA_Group_SameSize, you won't need to think
  413.     if your group is horizontal or vertical, both
  414.     cases are handled automatically.
  415.  
  416.     Forcing all objects of a group to be the same size
  417.     is e.g. useful for a row of buttons. It's visually
  418.     more attractive when these buttons have equal sizes
  419.     instead of being just as big as the text within.
  420.  
  421.     BUGS
  422.     Up to version 5 of groupclass, using MUIA_Group_SameSize
  423.     could make objects larger than their maximum size. This
  424.     has been fixed for version 6.
  425.  
  426.     EXAMPLE
  427.  
  428.     /* three buttons, same size */
  429.  
  430.     GroupObject,
  431.        MUIA_Group_Horiz   , TRUE,
  432.        MUIA_Group_SameSize, TRUE,
  433.        MUIA_Group_Child   , but1,
  434.        MUIA_Group_Child   , but2,
  435.        MUIA_Group_Child   , but3,
  436.        End;
  437.  
  438.     SEE ALSO
  439.     MUIA_Group_SameWidth, MUIA_Group_SameHeight
  440. Group.mui/MUIA_Group_SameWidth
  441.  
  442.     NAME
  443.     MUIA_Group_SameWidth -- (V4 ) [I..], BOOL
  444.  
  445.     FUNCTION
  446.     Boolean value to indicate that all children of this
  447.     group shall have the same width.
  448.  
  449.     BUGS
  450.     Up to version 5 of groupclass, using MUIA_Group_SameWidth
  451.     could make objects larger than their maximum width. This
  452.     has been fixed for version 6.
  453.  
  454.     SEE ALSO
  455.     MUIA_Group_SameSize, MUIA_Group_SameHeight
  456. Group.mui/MUIA_Group_Spacing
  457.  
  458.     NAME
  459.     MUIA_Group_Spacing -- (V4 ) [IS.], LONG
  460.  
  461.     FUNCTION
  462.     This is a shorthand for MUIA_Group_HorizSpacing and
  463.     MUIA_Group_VertSpacing, it sets both of these
  464.     attributes at once.
  465.  
  466.     Using MUIA_Group_Spacing, you won't need to think
  467.     if your group is horizontal or vertical, both
  468.     cases are handled automatically.
  469.  
  470.     Note that setting a spacing value for a group
  471.     overrides the user's default settings. Please
  472.     use it only if you have a good reason.
  473.  
  474.     EXAMPLE
  475.  
  476.     /* no space between obj1 and obj2: */
  477.  
  478.     GroupObject,
  479.        MUIA_Group_Horiz  , TRUE,
  480.        MUIA_Group_Spacing, 0,
  481.        MUIA_Group_Child  , obj1,
  482.        MUIA_Group_Child  , obj2,
  483.        End;
  484.  
  485.     SEE ALSO
  486.     MUIA_Group_HorizSpacing, MUIA_Group_VertSpacing
  487. Group.mui/MUIA_Group_VertSpacing
  488.  
  489.     NAME
  490.     MUIA_Group_VertSpacing -- (V4 ) [ISG], LONG
  491.  
  492.     FUNCTION
  493.     Number of pixels to be inserted between vertical
  494.     elements of a group.
  495.  
  496.     Please use this tag wisely, you will override the
  497.     user's prefered default setting!
  498.  
  499.     SEE ALSO
  500.     MUIA_Group_Spacing, MUIA_Group_HorizSpacing
  501. Group.mui/MUIM_Group_ExitChange
  502.  
  503.     NAME
  504.     MUIM_Group_ExitChange (V11)
  505.  
  506.     SYNOPSIS
  507.     DoMethod(obj,MUIM_Group_ExitChange,);
  508.  
  509.     FUNCTION
  510.     Terminates MUIM_Group_InitChange state.
  511.  
  512.     SEE ALSO
  513.     MUIM_Group_InitChange
  514. Group.mui/MUIM_Group_InitChange
  515.  
  516.     NAME
  517.     MUIM_Group_InitChange (V11)
  518.  
  519.     SYNOPSIS
  520.     DoMethod(obj,MUIM_Group_InitChange,);
  521.  
  522.     FUNCTION
  523.     Prepares a group for dynamic adding/removing of objects.
  524.     MUI 3 offers the possibility to dynamically add/remove
  525.     children from groups, even when the window that contains
  526.     these objects is currently open. To be able to do this,
  527.     you must first put the group into a special "exchange"
  528.     state by using this method. Then, you can add/remove
  529.     children at will. If you're done, use MUIM_Group_ExitChange
  530.     to make MUI recalculate the display.
  531.  
  532.     RESULT
  533.     returns NULL on failure.
  534.  
  535.     EXAMPLE
  536.     /* remove two children, add another one */
  537.  
  538.     if (DoMethod(group,MUIM_Group_InitChange))
  539.     {
  540.        DoMethod(group,OM_REMMEMBER,somechild);
  541.        DoMethod(group,OM_REMMEMBER,somechild2);
  542.  
  543.        DoMethod(group,OM_ADDMEMBER,somenewchild);
  544.  
  545.        DoMethod(group,MUIM_Group_ExitChange);
  546.     }
  547.  
  548.     SEE ALSO
  549.     MUIM_Group_InitChange
  550.