Hat Etiquette
  
 
I've not yet found what would seem to be the definitive list of hat rules. I'll use excerpts from various listings of hat etiquette until a definitive list is found.
 
First I'll list what I consider to be Rule #1 (which in a more civilized world would not need to be mentioned): Except under special conditions, a cap should not be worn backwards on the head. Those who insist on following the jackass trend of wearing a cap turned backwards display a lack of civility. Put another way; wearing a cap backwards on the head looks stupid.
 
From the The Last Best West
Cowboy Hat Etiquette - By Longfellow
Any hat should be removed when eating anywhere, that includes baseball caps!

Any hat should be removed when the national anthem of any country is played. Hold your hat in your right hand, over your heart. This applies to women, unless their hat is held on with hat pins.

Cowboys tip their hats to ladies when out doors, remove them when being introduced, and remove them when entering a ladies home.

Men never tipped their hats to other men in the Old West. It was akin to calling them a woman. A nod was a common greeting when not shaking hands.

     The Code of the West

In commercial or public buildings it's not necessary to remove your hat - but should be when entering a private office. Generally considered polite to remove it in a private home, unless other people are wearing their hat.

Wearing a cowboy hat to a theatre or movie is fine but should be removed if it blocks anyone's view of the entertainment.
 
From Country Calendar's FAQ's about Cowboy Hats
A man tips his hat:

1. When walking with a friend who passes a woman only the friend knows.

2. Any time a lady who is a stranger thanks you for some service.

3. Any time you excuse yourself to a woman stranger, as in a crowded bus when you jostle her, or when you have to ask to crowd past.

4. Any time a stranger shows courtesy to a woman you are with, as when a man or woman picks up something she has dropped, or a man gives her his seat.

5. When you ask a woman (or elderly man) for directions.
 
Your cigarette, pipe or cigar should always be taken out of your mouth before removing or tipping your hat.
 
A man takes off his hat outdoors:

1. When being introduced, or saying good-by.

2. As a greeting when passing someone he knows on the street.

3. When talking, particularly with a woman, an older man, or a clergyman.

4. When the National Anthem is being played, or the flag is passing.

5. At a burial, or (except in large cities) in the presence of a funeral procession.
 
Indoors, a man always takes off his hat, except:

1. In public buildings, such as railroad stations or post offices.

2. In entrance halls and corridors of office buildings or hotels.

3. In elevators of public or office buildings. You have to use your judgment about this, though. In a department store elevator full of women you might take it off. Also, if a woman you know gets into an office building elevator, you would probably take it off, and you certainly would do so if you started talking to her.