2 #include "mof/KeyFrameAnimation.h"
4 #include "TargetMenu.h"
8 mof::Window* et::ItemMenu::addSelectableTextItem(mof::Window* pOwner, std::vector<mof::Window*>& selectables , TCHAR* text , int size){
9 mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager);
10 pOwner->add(pSelectable);
11 selectables.push_back(pSelectable);
15 et::ItemMenu::ItemMenu( mof::TextureManager* pTextureManager , std::list<et::ItemData>& itemDataList , et::ItemOperatorFactory* pNextMenuFactory )
16 : et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) , m_itemDataList(itemDataList)
21 /*for(std::list<et::ItemData&>::iterator itr = itemDataList.begin() ; itr != itemDataList.end() ; ++itr){
22 m_itemDataList.push_back(*itr);
24 m_pNextMenuFactory = pNextMenuFactory;
27 m_pTextureManager = pTextureManager;
28 std::vector<mof::Window*> selectables;
30 mof::Window* pSelectable = NULL;
31 //
\83A
\83C
\83e
\83\80\82Ì
\83\8a\83X
\83g
\8dì
\90¬
32 for(std::list<et::ItemData>::iterator itr = itemDataList.begin() ; itr != itemDataList.end() ; ++itr){
33 pSelectable = addSelectableTextItem(this , selectables , (TCHAR*)(*itr).name.c_str() , 16);
36 if(selectables.size() == 0){
37 pSelectable = addSelectableTextItem(this , selectables , _T("
\81@
\81@
\81@
\81@
\81@
\81@
\81@
\81@") , 16);
38 pSelectable->setAvailable(false);
40 if(selectables.size() % 2 != 0){//
\97v
\8fC
\90³
41 pSelectable = addSelectableTextItem(this , selectables , _T("
\81@
\81@
\81@
\81@
\81@
\81@
\81@
\81@") , 16);
42 pSelectable->setAvailable(false);
44 m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource() , 2);
48 et::ItemMenu::~ItemMenu(void)
51 delete m_pNextMenuFactory;
58 void et::ItemMenu::setVisible(bool visible){
59 et::MyFrame::setVisible(visible);
61 mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();
62 pAnimation->setPosition(0 , mof::Vector2D(160 ,500));
63 pAnimation->setPosition(10 , mof::Vector2D(160 , 370));
64 mof::AnimationResource resource(pAnimation);
65 m_pSelector->setMenuAnimation(resource);
66 setAnimation(0 , resource);
69 mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();
70 pAnimation->setPosition(0 , mof::Vector2D(160 , 370));
71 pAnimation->setPosition(10 , mof::Vector2D(160 , 500));
72 mof::AnimationResource resource(pAnimation);
73 m_pSelector->setMenuAnimation(resource);
74 setAnimation(0 , resource);
78 et::MyFrame* et::ItemMenu::performAction(){
79 if(m_itemDataList.empty())return this;
80 int index = getSelectionModel()->getSelectingIndex();
82 et::ItemOperationMenu* pOperationMenu = m_pNextMenuFactory->create();
84 for(std::list<et::ItemData>::iterator itr = m_itemDataList.begin() ; itr != m_itemDataList.end() ; ++itr , ++i){
85 if(i == index)pOperationMenu->setTargetItem(&(*itr));
88 return pOperationMenu;