How can I force a CCLayer to take all touch events?

I have a CCLayer, and I want it to be the only CCNode that receives touch events. I tried using

void setPriority( int nPriority, CCTouchDelegate * pDelegate )

but I don’t think that worked.

Is there a better way to do it?

  1. Disable touch on every other layer and only enable touch on that layer. ( setTouchEnabled( bool ) )
  2. Do not add any touch handlers in the other events. ( ccTouchBegan, ccTouchMoved, ccTouchEnded )

I want to not only disable layers, but also buttons and other widgets like sliders.

Put all touch functions in one layer.