Code: Select all
METHOD Add( oMenuItem, lRoot ) CLASS TMenu
DEFAULT lRoot := .f.
AAdd( ::aItems, oMenuItem )
oMenuItem:oMenu = Self
if ValType( oMenuItem:bAction ) == "O" .and. ;
Upper( oMenuItem:bAction:ClassName() ) == "TMENU"
if oMenuItem:cPrompt != nil
AppendMenu( ::hMenu, nOr( MF_POPUP, MF_ENABLED,;
If( oMenuItem:hBitmap != 0 .or. ( .f. .and. IsWinNT() .and. ! lRoot .and. !::lSysmenu), MF_OWNERDRAW, 0 ),; //EMG
If( oMenuItem:lHelp, MF_HELP, 0 ),;
If( oMenuItem:lChecked, MF_CHECKED, 0 ),;
If( ! oMenuItem:lActive, MF_GRAYED, 0 ),;
If( oMenuItem:lBreak, MF_BREAK, 0 ) ),;
oMenuItem:bAction:hMenu,;
oMenuItem:cPrompt )
else
AppendMenu( ::hMenu, nOR( MF_POPUP, MF_BITMAP,;
If( oMenuItem:lChecked, MF_CHECKED, 0 ),;
If( ! oMenuItem:lActive, MF_GRAYED, 0 ),;
If( oMenuItem:lHelp, MF_HELP, 0 ),;
If( oMenuItem:lBreak, MF_BREAK, 0 ) ),;
oMenuItem:bAction:hMenu, oMenuItem:hBitmap )
endif
AAdd( aPopups, oMenuItem:bAction )
else
if oMenuItem:cPrompt != nil
AppendMenu( ::hMenu,;
nOR( If( oMenuItem:lActive,;
nOr( MF_ENABLED, If( oMenuItem:hBitmap != 0 .or. ;
( .f. .and. IsWinNT() .and. ! lRoot .and. ! ::lSysMenu ),; //EMG
MF_OWNERDRAW, 0 ) ),;
nOR( MF_DISABLED, MF_GRAYED ) ),;
If( oMenuItem:lChecked, MF_CHECKED, 0 ),;
If( oMenuItem:lHelp, MF_HELP, 0 ),;
If( oMenuItem:lBreak, MF_BREAK, 0 ) ),;
oMenuItem:nId, oMenuItem:cPrompt )
else
if oMenuItem:hBitmap != 0
#ifdef __XPP__
if oMenuItem:lBreak == nil
oMenuItem:lBreak = .f.
endif
#endif
AppendMenu( ::hMenu, nOr( MF_BITMAP,;
If( oMenuItem:lBreak, MF_BREAK, 0 ) ),;
oMenuItem:nId, oMenuItem:hBitmap )
else
AppendMenu( ::hMenu, MF_SEPARATOR, oMenuItem:nId, "" )
endif
endif
endif
return nil