From b12e6c33985570a1688f38f1a603bbc914bbc0e7 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 24 Jun 2015 13:14:41 -0300 Subject: [PATCH] Add ui::MenuSeparator widget --- src/app/app_menus.cpp | 4 ++-- src/app/ui/brush_popup.cpp | 2 +- src/app/ui/color_bar.cpp | 4 ++-- src/app/ui/editor/editor.cpp | 2 +- src/ui/menu.h | 12 +++++++++--- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/app/app_menus.cpp b/src/app/app_menus.cpp index 92c03f27f..dae2758b0 100644 --- a/src/app/app_menus.cpp +++ b/src/app/app_menus.cpp @@ -209,7 +209,7 @@ Widget* AppMenus::convertXmlelemToMenuitem(TiXmlElement* elem) { // is it a ? if (strcmp(elem->Value(), "separator") == 0) - return new Separator("", HORIZONTAL); + return new MenuSeparator; const char* command_name = elem->Attribute("command"); Command* command = @@ -265,7 +265,7 @@ Widget* AppMenus::createInvalidVersionMenuitem() subMenu->addChild(new AppMenuItem(PACKAGE " is using a customized gui.xml (maybe from your HOME directory).")); subMenu->addChild(new AppMenuItem("You should update your customized gui.xml file to the new version to get")); subMenu->addChild(new AppMenuItem("the latest commands available.")); - subMenu->addChild(new Separator("", HORIZONTAL)); + subMenu->addChild(new MenuSeparator); subMenu->addChild(new AppMenuItem("You can bypass this validation adding the correct version")); subMenu->addChild(new AppMenuItem("number in element.")); menuitem->setSubmenu(subMenu); diff --git a/src/app/ui/brush_popup.cpp b/src/app/ui/brush_popup.cpp index 6a1ae18ad..0a5042a07 100644 --- a/src/app/ui/brush_popup.cpp +++ b/src/app/ui/brush_popup.cpp @@ -72,7 +72,7 @@ protected: deleteAllItem.Click.connect(&Item::onDeleteAllBrushes, this); menu.addChild(&lockItem); menu.addChild(&deleteItem); - menu.addChild(new Separator("", HORIZONTAL)); + menu.addChild(new MenuSeparator); menu.addChild(&deleteAllItem); // Here we make the popup window temporaly floating, so it's diff --git a/src/app/ui/color_bar.cpp b/src/app/ui/color_bar.cpp index e0217e2df..18ed2df87 100644 --- a/src/app/ui/color_bar.cpp +++ b/src/app/ui/color_bar.cpp @@ -299,12 +299,12 @@ void ColorBar::onPaletteButtonClick() des("Descending"); menu.addChild(&rev); menu.addChild(&grd); - menu.addChild(new ui::Separator("", HORIZONTAL)); + menu.addChild(new ui::MenuSeparator); menu.addChild(&hue); menu.addChild(&sat); menu.addChild(&bri); menu.addChild(&lum); - menu.addChild(new ui::Separator("", HORIZONTAL)); + menu.addChild(new ui::MenuSeparator); menu.addChild(&asc); menu.addChild(&des); diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index dc480e6ff..5ae25f69d 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -1612,7 +1612,7 @@ void Editor::showAnimationSpeedMultiplierPopup(bool withStopBehaviorOptions) } if (withStopBehaviorOptions) { - menu.addChild(new Separator("", HORIZONTAL)); + menu.addChild(new MenuSeparator); MenuItem* item = new MenuItem("Rewind on Stop"); item->Click.connect( []() { diff --git a/src/ui/menu.h b/src/ui/menu.h index e21efa789..377b2e5ba 100644 --- a/src/ui/menu.h +++ b/src/ui/menu.h @@ -1,5 +1,5 @@ // Aseprite UI Library -// Copyright (C) 2001-2013 David Capello +// Copyright (C) 2001-2013, 2015 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -11,6 +11,7 @@ #include "base/signal.h" #include "base/unique_ptr.h" #include "ui/register_message.h" +#include "ui/separator.h" #include "ui/widget.h" namespace ui { @@ -19,8 +20,7 @@ namespace ui { class Timer; struct MenuBaseData; - class Menu : public Widget - { + class Menu : public Widget { public: Menu(); ~Menu(); @@ -147,6 +147,12 @@ namespace ui { friend class MenuBox; }; + class MenuSeparator : public Separator { + public: + MenuSeparator() : Separator("", HORIZONTAL) { + } + }; + extern RegisterMessage kOpenMenuItemMessage; extern RegisterMessage kCloseMenuItemMessage; extern RegisterMessage kClosePopupMessage;