Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5127: Add a separate ui::MenuItem for separator elements
- Loading branch information
1 parent
e27bf33
commit 8f66a35
Showing
4 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#pragma once | ||
|
||
#include "imenu.h" | ||
|
||
#include <wx/menuitem.h> | ||
|
||
namespace wxutil | ||
{ | ||
|
||
// Represents a separator item | ||
class SeparatorItem final : | ||
public ui::IMenuItem | ||
{ | ||
protected: | ||
wxMenuItem* _menuItem; | ||
ui::IMenu::VisibilityTest _visibilityTest; | ||
|
||
public: | ||
SeparatorItem(wxMenuItem* menuItem, const ui::IMenu::VisibilityTest& visTest = AlwaysVisible) : | ||
_menuItem(menuItem), | ||
_visibilityTest(visTest) | ||
{} | ||
|
||
wxMenuItem* getMenuItem() override | ||
{ | ||
return _menuItem; | ||
} | ||
|
||
void execute() override | ||
{} | ||
|
||
bool isVisible() override | ||
{ | ||
return _visibilityTest(); | ||
} | ||
|
||
static bool AlwaysVisible() { return true; } | ||
}; | ||
|
||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters