There is no standard button preview text box control, but there is a standard NSFontPanel class that you can use to let users select a font after pressing the "T" button.
The best idea is probably to override NSTextFieldCell. I was able to get the desired look by overriding -drawInteriorWithFrame: inView :, and skipping a slightly wider frame when called in super, and then drawing the button myself. You will also need to do your own mouse button search, but you could just create your own instance of NSButtonCell and access it for several methods with sub-correction for the button.
For convenience, you can also create a subclass of NSTextField that uses this cell instead of the direct NSTextFieldCell, but if you are loading material from XIB, you can simply change the cell class in XIB and leave it as a plain text field.
source share