1 /*! 2 @file 3 @author Denis Koronchik 4 @date 09/2007 5 */ 6 7 #include "StrangeButton.h" 8 #include "MyGUI_ResourceSkin.h" 9 #include "MyGUI_ISubWidgetText.h" 10 11 namespace plugin 12 { 13 StrangeButton()14 StrangeButton::StrangeButton() 15 { 16 } 17 onMouseSetFocus(MyGUI::Widget * _old)18 void StrangeButton::onMouseSetFocus(MyGUI::Widget* _old) 19 { 20 Base::onMouseSetFocus(_old); 21 22 if (getSubWidgetText() == nullptr) 23 return; 24 25 std::string s, str = getSubWidgetText()->getCaption(); 26 for (int i = (int)str.length() - 1; i >= 0; i--) 27 s += str[i]; 28 29 getSubWidgetText()->setCaption(s); 30 } 31 onMouseLostFocus(MyGUI::Widget * _new)32 void StrangeButton::onMouseLostFocus(MyGUI::Widget* _new) 33 { 34 Base::onMouseLostFocus(_new); 35 36 if (getSubWidgetText() == nullptr) 37 return; 38 39 std::string s, str = getSubWidgetText()->getCaption(); 40 for (int i = (int)str.length() - 1; i >= 0; i--) 41 s += str[i]; 42 43 getSubWidgetText()->setCaption(s); 44 } 45 46 } // namespace plugin 47