зеркало из https://github.com/electron/electron.git
refactor: use Get/SetID from views:View in Button (#35022)
This commit is contained in:
Родитель
08dd38d9be
Коммит
57c265198e
|
@ -193,7 +193,7 @@ void MenuBar::ButtonPressed(int id, const ui::Event& event) {
|
|||
SubmenuButton* source = nullptr;
|
||||
for (auto* child : children()) {
|
||||
auto* button = static_cast<SubmenuButton*>(child);
|
||||
if (button->tag() == id) {
|
||||
if (button->GetID() == id) {
|
||||
source = button;
|
||||
break;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ void MenuBar::RebuildChildren() {
|
|||
auto* button = new SubmenuButton(
|
||||
base::BindRepeating(&MenuBar::ButtonPressed, base::Unretained(this), i),
|
||||
menu_model_->GetLabelAt(i), background_color_);
|
||||
button->set_tag(i);
|
||||
button->SetID(i);
|
||||
AddChildView(button);
|
||||
}
|
||||
UpdateViewColors();
|
||||
|
|
|
@ -34,7 +34,7 @@ void MenuDelegate::RunMenu(ElectronMenuModel* model,
|
|||
hold_first_switch_ = true;
|
||||
}
|
||||
|
||||
id_ = button->tag();
|
||||
id_ = button->GetID();
|
||||
adapter_ = std::make_unique<MenuModelAdapter>(model);
|
||||
|
||||
auto* item = new views::MenuItemView(this);
|
||||
|
@ -127,7 +127,7 @@ views::MenuItemView* MenuDelegate::GetSiblingMenu(
|
|||
views::MenuButton* button;
|
||||
ElectronMenuModel* model;
|
||||
if (menu_bar_->GetMenuButtonFromScreenPoint(screen_point, &model, &button) &&
|
||||
button->tag() != id_) {
|
||||
button->GetID() != id_) {
|
||||
bool switch_in_progress = !!button_to_open_;
|
||||
// Always update target to open.
|
||||
button_to_open_ = button;
|
||||
|
|
Загрузка…
Ссылка в новой задаче