Custom drawing in ComboBox


#1

I was looking at both ComboBox and ListBox/ListBoxModel. I like how with ListBox, I can draw whatever I want in a cell using ListBoxModel::paintListBoxItem().

I’d like to do something similar with a class that inherits from ComboBox, where I can draw parts of the drop-down portion myself. My goal is to display both text and images in the drop-down component. Can this be done, maybe by implementing the inherited methods paint() or paintOverChildren()? Or would I be re-implementing a whole new component from scratch?


#2

Well, a menu can contain custom components, and I think that the combo box uses a PopupMenu for its popup, so it should be possible. Can’t remember whether I put anything in place to allow that, or whether it’d require hackery.