Game Development Community

dev|Pro Game Development Curriculum

GuiScrollCtrl enhancement - horizontal scroll

by Fyodor -bank- Osokin · 02/19/2008 (6:32 am) · 0 comments

What this resource gives you?
Quote:
1. If you press-n-hold SHIFT, than the GuiScrollCtrl will do horizontal scrolling instead of vertical (if horizontal scroll is enabled of course, else - no changes in behaviour)
2. If there is nothing to scroll vertically, it will try to scroll "horizontally" automatically
Changes:
open:
guiScrollCtrl.cc (.cpp)

locate:
bool GuiScrollCtrl::onMouseWheelUp(const GuiEvent &event)
change:
scrollByRegion((event.modifier & SI_CTRL) ? UpPage : UpArrow);
to this:
scrollByRegion(
      ( (event.modifier & SI_SHIFT && mHBarEnabled) || !mVBarEnabled ) ? 
      ( (event.modifier & SI_CTRL) ? LeftPage : LeftArrow ) :
      ( (event.modifier & SI_CTRL) ? UpPage : UpArrow )
      );

locate:
bool GuiScrollCtrl::onMouseWheelDown(const GuiEvent &event)
change:
scrollByRegion((event.modifier & SI_CTRL) ? DownPage : DownArrow);
to this:
scrollByRegion(
      ( (event.modifier & SI_SHIFT && mHBarEnabled) || !mVBarEnabled ) ? 
      ( (event.modifier & SI_CTRL) ? RightPage : RightArrow ) :
      ( (event.modifier & SI_CTRL) ? DownPage : DownArrow )
      );

Save. Rebuild. Enjoy!