on my main ui screen i have a image button that i would like users to be able to change sort of like an avatar kind of thing anyways when you press the button a list box appears and is filled in with image names available from a imageset like so
Code: Select all
bool myUI::PicSelect( const CEGUI::EventArgs& e)
{
using namespace CEGUI;
WindowManager& winMgr = WindowManager::getSingleton();
if (!winMgr.isWindowPresent("picselectwindow"))
Window* setup = winMgr.loadWindowLayout("picselect.layout");
ItemListbox* Pic_names = static_cast<ItemListbox*>(
winMgr.getWindow( "Pic_names"));
// get ptr to named imageset - don't forget this throws if imageset is not present
Imageset* imageset = ImagesetManager::getSingleton().getImageset( "pic" );
// get iterator to iterate over defined images.
Imageset::ImageIterator iter = imageset->getIterator();
while ( !iter.isAtEnd() )
{
// create new list item
ItemEntry* list_item = static_cast<ItemEntry*>(
WindowManager::getSingleton().createWindow( "TaharezLook/ListboxItem" ));
// set text on this item to whatever name the image has
list_item->setText( (*iter).getName() );
// add this item to the listbox
Pic_names->addChildWindow( list_item );
// advance iterator
++iter;
}
WindowManager::getSingleton().getWindow("Pic_cancel")->
subscribeEvent(PushButton::EventClicked, Event::Subscriber(&myUI::PicCancel, this));
WindowManager::getSingleton().getWindow("Pilot_OK")->
subscribeEvent(PushButton::EventClicked, Event::Subscriber(&myUI::PicOK, this));
WindowManager::getSingleton().getWindow("picselectwindow")->
subscribeEvent(FrameWindow::EventCloseClicked,
Event::Subscriber(&myUI::CloseWindowButton, this));
if (winMgr.isWindowPresent("background_wnd"))
{
Window* background = winMgr.getWindow("background_wnd");
background->addChildWindow("picselectwindow");
}
// event was handled
return true;
}
this works ok in the sense that it populates the listbox with the image names but i cant seem to find out how to change the image ie i can hightlight the image name i would like but the code that i need for the PicOK button i cant seem to work out
Code: Select all
bool myUI::PicOK(const CEGUI::EventArgs& e)
{
// code goes here from picOK button
return true;
}
could some kind soul point me in the right direction please
TIA