Code: Select all
bool MinigameState::handleDragEnter(const CEGUI::EventArgs& args)
{
const CEGUI::DragDropEventArgs& ddea = static_cast<const CEGUI::DragDropEventArgs&>(args);
ddea.window->setProperty("FrameColours", "tl:FF00FF00 tr:FF00FF00 bl:FF00FF00 br:FF00FF00");
return true;
}
bool MinigameState::handleDragLeave(const CEGUI::EventArgs& args)
{
const CEGUI::DragDropEventArgs& ddea = static_cast<const CEGUI::DragDropEventArgs&>(args);
ddea.window->setProperty("FrameColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF");
return true;
}
bool MinigameState::handleDragDropped(const CEGUI::EventArgs& args)
{
const CEGUI::DragDropEventArgs& ddea = static_cast<const CEGUI::DragDropEventArgs&>(args);
ddea.window->setProperty("FrameColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF");
ddea.window->addChildWindow(ddea.dragDropItem);
return true;
}
void MinigameState::init_events( void )
{
// CEGUI
CEGUI::WindowManager& wMgr = CEGUI::WindowManager::getSingleton();
// Init frames
frameDNA = (CEGUI::FrameWindow*)wMgr.getWindow( "DNA" );
frameItem = (CEGUI::FrameWindow*)wMgr.getWindow( "blueBarSlot" );
frameItemIcon = (CEGUI::FrameWindow*)wMgr.getWindow( "blueBarSlot//" );
frameSlot = (CEGUI::FrameWindow*)wMgr.getWindow( "Slots" );
frameSlotHolder = (CEGUI::FrameWindow*)wMgr.getWindow( "AcceptBars" );
dragContainer = (CEGUI::DragContainer*)wMgr.getWindow( "blueBarSlot/" );
// Init buttons, items, etc
frameItem->subscribeEvent(CEGUI::Window::EventDragDropItemEnters,CEGUI::Event::Subscriber( &MinigameState::handleDragEnter, this ) );
frameItem->subscribeEvent(CEGUI::Window::EventDragDropItemLeaves, CEGUI::Event::Subscriber( &MinigameState::handleDragLeave, this ) );
frameItem->subscribeEvent(CEGUI::Window::EventDragDropItemDropped, CEGUI::Event::Subscriber( &MinigameState::handleDragDropped, this ) );
frameSlotHolder->subscribeEvent(CEGUI::Window::EventDragDropItemEnters,CEGUI::Event::Subscriber( &MinigameState::handleDragEnter, this ) );
frameSlotHolder->subscribeEvent(CEGUI::Window::EventDragDropItemLeaves, CEGUI::Event::Subscriber( &MinigameState::handleDragLeave, this ) );
frameSlotHolder->subscribeEvent(CEGUI::Window::EventDragDropItemDropped, CEGUI::Event::Subscriber( &MinigameState::handleDragDropped, this ) );
frameItemIcon->setProperty( "Image", "set:WindowsLook image:YellowBar" );
frameItemIcon->disable();
ChowNutz