intermediate Thumb cycle count commit (part 2)

This commit is contained in:
Thomas Jentzsch 2021-07-08 15:47:11 +02:00
parent c73261b716
commit c8463ae54b
4 changed files with 18 additions and 1 deletions

View File

@ -168,6 +168,13 @@ const string& ContextMenu::getSelectedName() const
return (_selectedItem >= 0) ? _entries[_selectedItem].first : EmptyString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ContextMenu::setSelectedName(const string& name)
{
if(_selectedItem >= 0)
_entries[_selectedItem].first = name;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const Variant& ContextMenu::getSelectedTag() const
{

View File

@ -71,6 +71,7 @@ class ContextMenu : public Dialog, public CommandSender
/** Accessor methods for the currently selected item. */
int getSelected() const;
const string& getSelectedName() const;
void setSelectedName(const string& name);
const Variant& getSelectedTag() const;
/** This dialog uses its own positioning, so we override Dialog::setPosition() */

View File

@ -40,7 +40,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
_textcolorhi = kTextColor; // do not highlight the label
setTextFilter([](char c) {
return (isprint(c) && c != '\"') || c == '\x1c' || c == '\x1d'; // DEGREE || ELLIPSIS
return isprint(c) && c != '\"' || c == '\x1c' || c == '\x1d'; // DEGREE || ELLIPSIS
});
setEditable(false);
@ -122,6 +122,12 @@ const string& PopUpWidget::getSelectedName() const
return myMenu->getSelectedName();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpWidget::setSelectedName(const string& name)
{
myMenu->setSelectedName(name);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const Variant& PopUpWidget::getSelectedTag() const
{

View File

@ -48,6 +48,8 @@ class PopUpWidget : public EditableWidget
/** Add the given items to the widget. */
void addItems(const VariantList& items);
///** Get the items of the widget. */
//const VariantList& getItems(const VariantList& items) const;
/** Various selection methods passed directly to the underlying menu
See ContextMenu.hxx for more information. */
@ -59,6 +61,7 @@ class PopUpWidget : public EditableWidget
int getSelected() const;
const string& getSelectedName() const;
void setSelectedName(const string& name);
const Variant& getSelectedTag() const;
bool wantsFocus() const override { return true; }