Permalink
Browse files

Allow left/right/up/down to be used to navigate submenus with the pop…

…up menu
  • Loading branch information...
1 parent 2014073 commit fa8b6ee382803071139033705ecb0b1185935dd1 @stuartm stuartm committed Sep 20, 2011
Showing with 14 additions and 2 deletions.
  1. +12 −1 mythtv/libs/libmythui/mythdialogbox.cpp
  2. +2 −1 mythtv/libs/libmythui/mythuibuttonlist.h
@@ -183,7 +183,11 @@ bool MythDialogBox::keyPressEvent(QKeyEvent *event)
QString action = actions[i];
handled = true;
- if (action == "ESCAPE" )
+ if (action == "ESCAPE" ||
+ (action == "LEFT" &&
+ m_buttonList->GetLayout() == MythUIButtonList::LayoutVertical) ||
+ (action == "UP" &&
+ m_buttonList->GetLayout() == MythUIButtonList::LayoutHorizontal))
{
SendEvent(-1, m_exittext, m_exitdata);
if (m_exitdata == 0 && m_exittext.isEmpty())
@@ -194,6 +198,13 @@ bool MythDialogBox::keyPressEvent(QKeyEvent *event)
SendEvent(-2);
Close();
}
+ else if ((action == "RIGHT" &&
+ m_buttonList->GetLayout() == MythUIButtonList::LayoutVertical) ||
+ (action == "DOWN" &&
+ m_buttonList->GetLayout() == MythUIButtonList::LayoutHorizontal))
+ {
+ Select(m_buttonList->GetItemCurrent());
+ }
else
handled = false;
}
@@ -128,6 +128,7 @@ class MUI_PUBLIC MythUIButtonList : public MythUIType
enum MovementUnit { MoveItem, MoveColumn, MoveRow, MovePage, MoveMax,
MoveMid, MoveByAmount };
+ enum LayoutType { LayoutVertical, LayoutHorizontal, LayoutGrid };
void SetDrawFromBottom(bool draw);
@@ -151,6 +152,7 @@ class MUI_PUBLIC MythUIButtonList : public MythUIType
uint ItemWidth(void);
uint ItemHeight(void);
+ const LayoutType GetLayout() const { return m_layout; }
bool MoveItemUpDown(MythUIButtonListItem *item, bool up);
@@ -188,7 +190,6 @@ class MUI_PUBLIC MythUIButtonList : public MythUIType
protected:
enum ScrollStyle { ScrollFree, ScrollCenter, ScrollGroupCenter };
- enum LayoutType { LayoutVertical, LayoutHorizontal, LayoutGrid };
enum ArrangeType { ArrangeFixed, ArrangeFill, ArrangeSpread, ArrangeStack };
enum WrapStyle { WrapCaptive = -1, WrapNone = 0, WrapSelect, WrapItems,
WrapFlowing };

0 comments on commit fa8b6ee

Please sign in to comment.