Toolbars generally have two types of buttons:
Buttons that execute an action when user presses them. E.g., a file manager opens a separate command shell window.
Buttons that switch application mode. E.g., same file manager switches from displaying file names to displaying file thumbnails.
It's not a problem in dialogs - toggle buttons are simply replaced with checkboxes there - but how do I help the user distinguish between them on a toolbar? All the applications I can think of leave it for the user to learn by trial and error: You press a button and if it gets 'stuck' after that, it was a toggle button. There must be a better way.
ETA: After reading the most helpful links provided by Shreyas Tripathy I decided to stick with checkboxes here. Some additional googling with refined keywords demonstrated that at least one big name corporation universally uses checkboxes on their ribbons, which is close enough.