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