This version of the addItem() function is overloaded to accept a bool that determines if the menu expands normally or is reversed.
Normal:
Code: Select all
submenu->addItem(L"About", 500, true, true, false);
Reversed:
Code: Select all
submenu->addItem(L"About", 500, true, true, false, true);
Diff:
Code: Select all
CGUIContextMenu.cpp:
71a72
> s.ReverseCascade = false;
85a87,109
> u32 CGUIContextMenu::addItem(const wchar_t* text, s32 id, bool enabled, bool hasSubMenu, bool checked, bool cascadeLeft)
> {
> SItem s;
> s.Enabled = enabled;
> s.Checked = checked;
> s.Text = text;
> s.IsSeparator = (text == 0);
> s.SubMenu = 0;
> s.CommandId = id;
> s.ReverseCascade = cascadeLeft;
>
> if (hasSubMenu)
> {
> s.SubMenu = new CGUIContextMenu(Environment, this, id,
> core::rect<s32>(0,0,100,100), false, false);
> s.SubMenu->setVisible(false);
> }
>
> Items.push_back(s);
>
> recalculateSize();
> return Items.size() - 1;
> }
502a527,529
>
> if (!Items[i].ReverseCascade)
> {
511a539,550
> else
> {
> r.LowerRightCorner.X = r.UpperLeftCorner.X - 15;
>
> sprites->draw2DSprite(skin->getIcon(EGDI_CURSOR_LEFT),
> r.getCenter(), clip, skin->getColor(c),
> (i == HighLighted) ? ChangeTime : 0,
> (i == HighLighted) ? os::Timer::getTime() : 0,
> (i == HighLighted), true);
> }
> }
>
583a623,624
> if (!Items[i].ReverseCascade)
> {
586a628,635
> }
>
> else
> {
> Items[i].SubMenu->setRelativePosition(
> core::rect<s32>(0 - w, Items[i].PosY,
> 0, Items[i].PosY+h));
> }
CGUIContextMenu.h:
40a41,43
> virtual u32 addItem(const wchar_t* text, s32 commandid,
> bool enabled, bool hasSubMenu, bool checked, bool cascadeLeft);
>
109a113
> bool ReverseCascade;
IGUIContextMenu.h:
38,41c38,60
< virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
< bool hasSubMenu=false,
< bool checked=false
< ) = 0;
---
>
> virtual u32 addItem(const wchar_t* text, s32 commandid,
> bool enabled, bool hasSubMenu, bool checked)
> {
> commandid=-1;
> enabled=true;
> hasSubMenu=false;
> checked=false;
>
> return 0;
> };
>
> virtual u32 addItem(const wchar_t* text, s32 commandid,
> bool enabled, bool hasSubMenu, bool checked, bool cascadeLeft)
> {
> commandid=-1;
> enabled=true;
> hasSubMenu=false;
> checked=false;
> cascadeLeft=false;
>
> return 0;
> };