[wesnoth-commits] [wesnoth/wesnoth] 609794: GUI2/Drop Down Menu: handle toggle callbacks using...

Charles Dang noreply at github.com
Fri Nov 27 03:07:34 UTC 2020


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 6097948e9b01fc62c063ebd4122e91d9e3dc1c06
      https://github.com/wesnoth/wesnoth/commit/6097948e9b01fc62c063ebd4122e91d9e3dc1c06
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2020-11-27 (Fri, 27 Nov 2020)

  Changed paths:
    M src/gui/dialogs/drop_down_menu.cpp
    M src/gui/dialogs/drop_down_menu.hpp
    M src/gui/widgets/menu_button.cpp
    M src/gui/widgets/multimenu_button.cpp
    M src/gui/widgets/multimenu_button.hpp

  Log Message:
  -----------
  GUI2/Drop Down Menu: handle toggle callbacks using the event system

This fires a NOTIFIED_MOFIDIED event in the parent widget when the toggle state changes instead of manually
passing a callback in as a ctor parameter. The only widget which handled this was the multimenu_button, and
that did some stuff, then fired off a NOTIFY_MODIFIED event of its own. This change basically just installs
a handler of its own for the NOTIFY_MODIFIED event, which should still allow any other dialogs to add their
own handlers if necessary.

This also adds a second constructor that takes the parent widget and pulls the rectangle and markup settings
from it rather than having them passed in manually. The ctor that takes them is retained for the cases where
the menu needs to be manually invoked without a parent widget.





More information about the Commits mailing list