| @@ -1199,6 +1199,15 @@ void LookAndFeel_V2::positionComboBoxText (ComboBox& box, Label& label) | |||||
| label.setFont (getComboBoxFont (box)); | label.setFont (getComboBoxFont (box)); | ||||
| } | } | ||||
| PopupMenu::Options LookAndFeel_V2::getOptionsForComboBoxPopupMenu (ComboBox& box, Label& label) | |||||
| { | |||||
| return PopupMenu::Options().withTargetComponent (&box) | |||||
| .withItemThatMustBeVisible (box.getSelectedId()) | |||||
| .withMinimumWidth (box.getWidth()) | |||||
| .withMaximumNumColumns (1) | |||||
| .withStandardItemHeight (label.getHeight()); | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| Font LookAndFeel_V2::getLabelFont (Label& label) | Font LookAndFeel_V2::getLabelFont (Label& label) | ||||
| { | { | ||||
| @@ -193,6 +193,7 @@ public: | |||||
| Font getComboBoxFont (ComboBox&) override; | Font getComboBoxFont (ComboBox&) override; | ||||
| Label* createComboBoxTextBox (ComboBox&) override; | Label* createComboBoxTextBox (ComboBox&) override; | ||||
| void positionComboBoxText (ComboBox&, Label&) override; | void positionComboBoxText (ComboBox&, Label&) override; | ||||
| PopupMenu::Options getOptionsForComboBoxPopupMenu (ComboBox&, Label&) override; | |||||
| //============================================================================== | //============================================================================== | ||||
| void drawLabel (Graphics&, Label&) override; | void drawLabel (Graphics&, Label&) override; | ||||
| @@ -545,12 +545,10 @@ void ComboBox::showPopup() | |||||
| menu.addItem (1, noChoicesMessage, false, false); | menu.addItem (1, noChoicesMessage, false, false); | ||||
| } | } | ||||
| menu.setLookAndFeel (&getLookAndFeel()); | |||||
| menu.showMenuAsync (PopupMenu::Options().withTargetComponent (this) | |||||
| .withItemThatMustBeVisible (getSelectedId()) | |||||
| .withMinimumWidth (getWidth()) | |||||
| .withMaximumNumColumns (1) | |||||
| .withStandardItemHeight (label->getHeight()), | |||||
| auto& lookAndFeel = getLookAndFeel(); | |||||
| menu.setLookAndFeel (&lookAndFeel); | |||||
| menu.showMenuAsync (lookAndFeel.getOptionsForComboBoxPopupMenu (*this, *label), | |||||
| ModalCallbackFunction::forComponent (comboBoxPopupMenuFinishedCallback, this)); | ModalCallbackFunction::forComponent (comboBoxPopupMenuFinishedCallback, this)); | ||||
| } | } | ||||
| @@ -376,6 +376,8 @@ public: | |||||
| virtual Label* createComboBoxTextBox (ComboBox&) = 0; | virtual Label* createComboBoxTextBox (ComboBox&) = 0; | ||||
| virtual void positionComboBoxText (ComboBox&, Label& labelToPosition) = 0; | virtual void positionComboBoxText (ComboBox&, Label& labelToPosition) = 0; | ||||
| virtual PopupMenu::Options getOptionsForComboBoxPopupMenu (ComboBox&, Label&) = 0; | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||