home *** CD-ROM | disk | FTP | other *** search
- /* GadTools layout toolkit
- **
- ** Copyright © 1993-1995 by Olaf `Olsen' Barthel
- ** Freely distributable.
- **
- ** :ts=4
- */
-
- #include "gtlayout_global.h"
-
- #ifdef DO_MENUS
-
- /* LTP_AdjustItemPosition(struct MenuItem *Item,WORD Left,WORD Top):
- *
- * Calculate the effective positions of the menu items.
- */
-
- WORD __regargs
- LTP_AdjustItemPosition(struct MenuItem *Item,WORD Left,WORD Top)
- {
- ItemNode *Node;
- WORD Width = 0;
-
- // Hit the road, Jack...
-
- while(Item)
- {
- // Get back
-
- Node = (ItemNode *)((ULONG)Item - sizeof(struct MinNode));
-
- // Add up the left edge
-
- Node -> Left = Left + Node -> Item . LeftEdge;
- Node -> Top = Top + Node -> Item . TopEdge;
-
- // Fix up the sub menu
-
- if(Node -> Item . SubItem)
- Node -> Width = LTP_AdjustItemPosition(Node -> Item . SubItem,Node -> Left,Node -> Top);
-
- // Update the local width
-
- if(Node -> Item . LeftEdge + Node -> Item . Width > Width)
- Width = Node -> Item . LeftEdge + Node -> Item . Width;
-
- Item = Item -> NextItem;
- }
-
- return(Width);
- }
-
- #endif /* DO_MENUS */
-