With a hint of sarcasm, and a wink, it's all you have to say to 'a male' wearing 'a cowboy hat' to make him feel completely gay, become completely embarrassed and leave whatever establishment he is patronizing. The only exception would be if he were a participant in an actual rodeo. In such an instance I suppose it would be appropriate to wear a cowboy hat, but still gay.
I was at this bar the other night and this dude wearing a cowboy hat walked up to me and I said, "nice cowboy hat" and I winked at him. He looked at me like I was gay or something, and then amazingly everyone started saying, "nice cowboy hat" until he finally turned red and left.