[GUI] - add GUI_MSG_UNFOCUS_ALL for unfocusing all focus
authorMemphiz <memphis@machzwo.de>
Mon, 28 May 2012 00:17:06 +0000 (02:17 +0200)
committerMemphiz <memphis@machzwo.de>
Mon, 28 May 2012 00:34:56 +0000 (02:34 +0200)
xbmc/guilib/GUIMessage.h
xbmc/guilib/GUIWindow.cpp

index d493678..ed40a75 100644 (file)
  */
 #define GUI_MSG_REMOVE_CONTROL  40
 
+/*!
+ \brief A request to unfocus all currently focused controls
+ */
+#define GUI_MSG_UNFOCUS_ALL 41
+
 #define GUI_MSG_USER         1000
 
 /*!
index 55d8329..847e55e 100644 (file)
@@ -531,6 +531,21 @@ bool CGUIWindow::OnMessage(CGUIMessage& message)
       }
       break;
     }
+  
+  case GUI_MSG_UNFOCUS_ALL:
+    {
+      //unfocus the current focused control in this window
+      CGUIControl *control = GetFocusedControl();
+      if(control)
+      {
+        //tell focused control that it has lost the focus
+        CGUIMessage msgLostFocus(GUI_MSG_LOSTFOCUS, GetID(), control->GetID(), control->GetID());
+        control->OnMessage(msgLostFocus);
+        CLog::Log(LOGDEBUG, "Unfocus WindowID: %i, ControlID: %i",GetID(), control->GetID());
+      }
+      return true;
+    break;
+    }
 
   case GUI_MSG_SELCHANGED:
     {