if you are referring to the mail program...
yes, you need to make sure your gmail account is set to IMAP. This method allows the mail to be stored on the server as opposed to being pulled down once into the mail program.
After you've done that both your gmail account and Mail program will function like you want. You need to setup a different type of mailbox in the program to correspond to this method. IMAP is the way, you currently have yours set to POP mail.