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_GetCommandWidth(RootMenu *Root,ItemNode *Item):
- *
- * Calculate the width of a command sequence.
- */
-
- WORD __regargs
- LTP_GetCommandWidth(RootMenu *Root,ItemNode *Item)
- {
- WORD Width = 0;
-
- // Skip separator bars
-
- if(!(Item -> Flags & ITEMF_IsBar))
- {
- // Add in the Amiga glyph
-
- if(Item -> Item . Flags & COMMSEQ)
- Width = TextLength(&Root -> RPort,&Item -> Item . Command,1) + 2 + Root -> AmigaWidth + 2;
- else
- {
- // Add in command or submenu indicator
-
- if(Item -> Flags & (ITEMF_Command | ITEMF_HasSub))
- Width = IntuiTextLength(((struct IntuiText *)Item -> Item . ItemFill) -> NextText) + 2;
- }
- }
-
- return(Width);
- }
-
- #endif /* DO_MENUS */
-