• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ mygui::ImageBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中mygui::ImageBox的典型用法代码示例。如果您正苦于以下问题:C++ ImageBox类的具体用法?C++ ImageBox怎么用?C++ ImageBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ImageBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: showBackground

    void MainMenu::showBackground(bool show)
    {
        if (mBackground)
        {
            MyGUI::Gui::getInstance().destroyWidget(mBackground);
            mBackground = NULL;
        }
        if (show)
        {
            if (!mBackground)
            {
                mBackground = MyGUI::Gui::getInstance().createWidgetReal<MyGUI::ImageBox>("ImageBox", 0,0,1,1,
                    MyGUI::Align::Stretch, "Menu");
                mBackground->setImageTexture("black.png");

                // Use black bars to correct aspect ratio. The video player also does it, so we need to do it
                // for mw_logo.bik to align correctly with menu_morrowind.dds.
                MyGUI::IntSize screenSize = MyGUI::RenderManager::getInstance().getViewSize();

                // No way to un-hardcode this right now, menu_morrowind.dds is 1024x512 but was designed for 4:3
                double imageaspect = 4.0/3.0;

                int leftPadding = std::max(0.0, (screenSize.width - screenSize.height * imageaspect) / 2);
                int topPadding = std::max(0.0, (screenSize.height - screenSize.width / imageaspect) / 2);

                MyGUI::ImageBox* image = mBackground->createWidget<MyGUI::ImageBox>("ImageBox",
                    leftPadding, topPadding, screenSize.width - leftPadding*2, screenSize.height - topPadding*2, MyGUI::Align::Default);
                image->setImageTexture("textures\\menu_morrowind.dds");
            }
        }
    }
开发者ID:ViteFalcon,项目名称:openmw,代码行数:31,代码来源:mainmenu.cpp


示例2: onSelectedItemImpl

    void AlchemyWindow::onSelectedItemImpl(MWWorld::Ptr item)
    {
        MyGUI::ImageBox* add = NULL;

        // don't allow to add an ingredient that is already added
        // (which could happen if two similiar ingredients don't stack because of script / owner)
        bool alreadyAdded = false;
        std::string name = MWWorld::Class::get(item).getName(item);
        if (mIngredient1->isUserString("ToolTipType"))
        {
            MWWorld::Ptr item2 = *mIngredient1->getUserData<MWWorld::Ptr>();
            std::string name2 = MWWorld::Class::get(item2).getName(item2);
            if (name == name2)
                alreadyAdded = true;
        }
        if (mIngredient2->isUserString("ToolTipType"))
        {
            MWWorld::Ptr item2 = *mIngredient2->getUserData<MWWorld::Ptr>();
            std::string name2 = MWWorld::Class::get(item2).getName(item2);
            if (name == name2)
                alreadyAdded = true;
        }
        if (mIngredient3->isUserString("ToolTipType"))
        {
            MWWorld::Ptr item2 = *mIngredient3->getUserData<MWWorld::Ptr>();
            std::string name2 = MWWorld::Class::get(item2).getName(item2);
            if (name == name2)
                alreadyAdded = true;
        }
        if (mIngredient4->isUserString("ToolTipType"))
        {
            MWWorld::Ptr item2 = *mIngredient4->getUserData<MWWorld::Ptr>();
            std::string name2 = MWWorld::Class::get(item2).getName(item2);
            if (name == name2)
                alreadyAdded = true;
        }
        if (alreadyAdded)
            return;

        if (!mIngredient1->isUserString("ToolTipType"))
            add = mIngredient1;
        if (add == NULL  && !mIngredient2->isUserString("ToolTipType"))
            add = mIngredient2;
        if (add == NULL  && !mIngredient3->isUserString("ToolTipType"))
            add = mIngredient3;
        if (add == NULL  && !mIngredient4->isUserString("ToolTipType"))
            add = mIngredient4;

        if (add != NULL)
        {
            add->setUserString("ToolTipType", "ItemPtr");
            add->setUserData(item);
            add->setImageTexture(getIconPath(item));
            drawItems();
            update();

            std::string sound = MWWorld::Class::get(item).getUpSoundId(item);
            MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
        }
    }
开发者ID:valistar,项目名称:openmw,代码行数:60,代码来源:alchemywindow.cpp


示例3: addGroup

    void SpellWindow::addGroup(const std::string &label, const std::string& label2)
    {
        if (mSpellView->getChildCount() > 0)
        {
            MyGUI::ImageBox* separator = mSpellView->createWidget<MyGUI::ImageBox>("MW_HLine",
                MyGUI::IntCoord(4, mHeight, mWidth-8, 18),
                MyGUI::Align::Left | MyGUI::Align::Top);
            separator->setNeedMouseFocus(false);
            mHeight += 18;
        }

        MyGUI::TextBox* groupWidget = mSpellView->createWidget<MyGUI::TextBox>("SandBrightText",
            MyGUI::IntCoord(0, mHeight, mWidth, 24),
            MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
        groupWidget->setCaptionWithReplacing(label);
        groupWidget->setTextAlign(MyGUI::Align::Left);
        groupWidget->setNeedMouseFocus(false);

        if (label2 != "")
        {
            MyGUI::TextBox* groupWidget2 = mSpellView->createWidget<MyGUI::TextBox>("SandBrightText",
                MyGUI::IntCoord(0, mHeight, mWidth-4, 24),
                MyGUI::Align::Left | MyGUI::Align::Top);
            groupWidget2->setCaptionWithReplacing(label2);
            groupWidget2->setTextAlign(MyGUI::Align::Right);
            groupWidget2->setNeedMouseFocus(false);

            groupWidget->setSize(mWidth-8-groupWidget2->getTextSize().width, groupWidget->getHeight());
        }

        mHeight += 24;
    }
开发者ID:rafis,项目名称:openmw,代码行数:32,代码来源:spellwindow.cpp


示例4: parseImage

void BookTextParser::parseImage(std::string tag, bool createWidget)
{
    int src_start = tag.find("SRC=")+5;
    std::string image = tag.substr(src_start, tag.find('"', src_start)-src_start);

    // fix texture extension to .dds
    if (image.size() > 4)
    {
        image[image.size()-3] = 'd';
        image[image.size()-2] = 'd';
        image[image.size()-1] = 's';
    }

    int width_start = tag.find("WIDTH=")+7;
    int width = boost::lexical_cast<int>(tag.substr(width_start, tag.find('"', width_start)-width_start));

    int height_start = tag.find("HEIGHT=")+8;
    int height = boost::lexical_cast<int>(tag.substr(height_start, tag.find('"', height_start)-height_start));

    if (createWidget)
    {
        MyGUI::ImageBox* box = mParent->createWidget<MyGUI::ImageBox> ("ImageBox",
            MyGUI::IntCoord(0, mHeight, width, height), MyGUI::Align::Left | MyGUI::Align::Top,
            mParent->getName() + boost::lexical_cast<std::string>(mParent->getChildCount()));
        box->setImageTexture("bookart\\" + image);
        box->setProperty("NeedMouse", "false");
    }

    mWidth = std::max(mWidth, width);
    mHeight += height;
}
开发者ID:JordanMilne,项目名称:openmw,代码行数:31,代码来源:formatting.cpp


示例5: startSelfEnchanting

    void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem)
    {
        MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();

        mEnchanting.setSelfEnchanting(true);
        mEnchanting.setEnchanter(player);

        mPtr = player;
        startEditing();
        mEnchanting.setSoulGem(soulgem);

        MyGUI::ImageBox* image = mSoulBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
        std::string path = std::string("icons\\");
        path += soulgem.getClass().getInventoryIcon(soulgem);
        int pos = path.rfind(".");
        path.erase(pos);
        path.append(".dds");
        image->setImageTexture (path);
        image->setUserString ("ToolTipType", "ItemPtr");
        image->setUserData(soulgem);
        image->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onRemoveSoul);

        mPrice->setVisible(false);
        mPriceText->setVisible(false);
        updateLabels();
    }
开发者ID:0xmono,项目名称:openmw,代码行数:26,代码来源:enchantingdialog.cpp


示例6: setSelectedWeapon

void HUD::setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent)
{
    std::string itemName = MWWorld::Class::get(item).getName(item);
    if (itemName != mWeaponName && mWeaponVisible)
    {
        mWeaponSpellTimer = 5.0f;
        mWeaponName = itemName;
        mWeaponSpellBox->setCaption(mWeaponName);
        mWeaponSpellBox->setVisible(true);
    }

    mWeapBox->setUserString("ToolTipType", "ItemPtr");
    mWeapBox->setUserData(item);

    mWeapStatus->setProgressRange(100);
    mWeapStatus->setProgressPosition(durabilityPercent);

    if (mWeapImage->getChildCount())
        MyGUI::Gui::getInstance().destroyWidget(mWeapImage->getChildAt(0));

    std::string path = std::string("icons\\");
    path+=MWWorld::Class::get(item).getInventoryIcon(item);
    Widgets::fixTexturePath(path);

    if (MWWorld::Class::get(item).getEnchantment(item) != "")
    {
        mWeapImage->setImageTexture("textures\\menu_icon_magic_mini.dds");
        MyGUI::ImageBox* itemBox = mWeapImage->createWidgetReal<MyGUI::ImageBox>("ImageBox", MyGUI::FloatCoord(0,0,1,1)
            , MyGUI::Align::Stretch);
        itemBox->setImageTexture(path);
        itemBox->setNeedMouseFocus(false);
    }
    else
        mWeapImage->setImageTexture(path);
}
开发者ID:zeidrich,项目名称:openmw,代码行数:35,代码来源:hud.cpp


示例7: addGroup

    void SpellView::addGroup(const std::string &label, const std::string& label2)
    {
        if (mScrollView->getChildCount() > 0)
        {
            MyGUI::ImageBox* separator = mScrollView->createWidget<MyGUI::ImageBox>("MW_HLine",
                MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 18),
                MyGUI::Align::Left | MyGUI::Align::Top);
            separator->setNeedMouseFocus(false);
            mLines.push_back(LineInfo(separator, (MyGUI::Widget*)NULL, NoSpellIndex));
        }

        MyGUI::TextBox* groupWidget = mScrollView->createWidget<MyGUI::TextBox>("SandBrightText",
            MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 24),
            MyGUI::Align::Left | MyGUI::Align::Top);
        groupWidget->setCaptionWithReplacing(label);
        groupWidget->setTextAlign(MyGUI::Align::Left);
        groupWidget->setNeedMouseFocus(false);

        if (label2 != "")
        {
            MyGUI::TextBox* groupWidget2 = mScrollView->createWidget<MyGUI::TextBox>("SandBrightText",
                MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 24),
                MyGUI::Align::Left | MyGUI::Align::Top);
            groupWidget2->setCaptionWithReplacing(label2);
            groupWidget2->setTextAlign(MyGUI::Align::Right);
            groupWidget2->setNeedMouseFocus(false);

            mLines.push_back(LineInfo(groupWidget, groupWidget2, NoSpellIndex));
        }
        else
            mLines.push_back(LineInfo(groupWidget, (MyGUI::Widget*)NULL, NoSpellIndex));
    }
开发者ID:Kleptoid,项目名称:openmw,代码行数:32,代码来源:spellview.cpp


示例8: init

void LocalMapBase::init(MyGUI::ScrollView* widget, MyGUI::ImageBox* compass, OEngine::GUI::Layout* layout, bool mapDragAndDrop)
{
    mLocalMap = widget;
    mLayout = layout;
    mMapDragAndDrop = mapDragAndDrop;
    mCompass = compass;

    // create 3x3 map widgets, 512x512 each, holding a 1024x1024 texture each
    const int widgetSize = 512;
    for (int mx=0; mx<3; ++mx)
    {
        for (int my=0; my<3; ++my)
        {
            MyGUI::ImageBox* map = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
                MyGUI::IntCoord(mx*widgetSize, my*widgetSize, widgetSize, widgetSize),
                MyGUI::Align::Top | MyGUI::Align::Left, "Map_" + boost::lexical_cast<std::string>(mx) + "_" + boost::lexical_cast<std::string>(my));

            MyGUI::ImageBox* fog = map->createWidget<MyGUI::ImageBox>("ImageBox",
                MyGUI::IntCoord(0, 0, widgetSize, widgetSize),
                MyGUI::Align::Top | MyGUI::Align::Left, "Map_" + boost::lexical_cast<std::string>(mx) + "_" + boost::lexical_cast<std::string>(my) + "_fog");

            if (!mMapDragAndDrop)
            {
                map->setNeedMouseFocus(false);
                fog->setNeedMouseFocus(false);
            }

            mMapWidgets.push_back(map);
            mFogWidgets.push_back(fog);
        }
    }
}
开发者ID:aurix,项目名称:openmw,代码行数:32,代码来源:map_window.cpp


示例9: onSoulSelected

    void EnchantingDialog::onSoulSelected(MWWorld::Ptr item)
    {
        mItemSelectionDialog->setVisible(false);
        mEnchanting.setSoulGem(item);

        if(mEnchanting.getGemCharge()==0)
        {
            MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage32}");
            return;
        }

        while (mSoulBox->getChildCount ())
            MyGUI::Gui::getInstance ().destroyWidget (mSoulBox->getChildAt(0));

        MyGUI::ImageBox* image = mSoulBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
        std::string path = std::string("icons\\");
        path += item.getClass().getInventoryIcon(item);
        int pos = path.rfind(".");
        path.erase(pos);
        path.append(".dds");
        image->setImageTexture (path);
        image->setUserString ("ToolTipType", "ItemPtr");
        image->setUserData(item);
        image->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onRemoveSoul);
        updateLabels();
    }
开发者ID:0xmono,项目名称:openmw,代码行数:26,代码来源:enchantingdialog.cpp


示例10: pickUpObject

    void InventoryWindow::pickUpObject (MWWorld::Ptr object)
    {
        /// \todo scripts

        // make sure the object is of a type that can be picked up
        std::string type = object.getTypeName();
        if ( (type != typeid(ESM::Apparatus).name())
            && (type != typeid(ESM::Armor).name())
            && (type != typeid(ESM::Book).name())
            && (type != typeid(ESM::Clothing).name())
            && (type != typeid(ESM::Ingredient).name())
            && (type != typeid(ESM::Light).name())
            && (type != typeid(ESM::Miscellaneous).name())
            && (type != typeid(ESM::Tool).name())
            && (type != typeid(ESM::Probe).name())
            && (type != typeid(ESM::Repair).name())
            && (type != typeid(ESM::Weapon).name())
            && (type != typeid(ESM::Potion).name()))
            return;

        // sound
        std::string sound = MWWorld::Class::get(object).getUpSoundId(object);
        MWBase::Environment::get().getSoundManager()->playSound(sound, 1, 1);

        int count = object.getRefData().getCount();

        // add to player inventory
        // can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
        MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
        MWWorld::Ptr newObject = *MWWorld::Class::get (player).getContainerStore (player).add (object);
        // remove from world
        MWBase::Environment::get().getWorld()->deleteObject (object);

        mDragAndDrop->mIsOnDragAndDrop = true;
        mDragAndDrop->mDraggedCount = count;

        std::string path = std::string("icons\\");
        path += MWWorld::Class::get(newObject).getInventoryIcon(newObject);
        MyGUI::ImageBox* baseWidget = mContainerWidget->createWidget<ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 42, 42), MyGUI::Align::Default);
        baseWidget->detachFromWidget();
        baseWidget->attachToWidget(mDragAndDrop->mDragAndDropWidget);
        baseWidget->setUserData(newObject);
        mDragAndDrop->mDraggedWidget = baseWidget;
        ImageBox* image = baseWidget->createWidget<ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
        int pos = path.rfind(".");
        path.erase(pos);
        path.append(".dds");
        image->setImageTexture(path);
        image->setNeedMouseFocus(false);

        // text widget that shows item count
        MyGUI::TextBox* text = image->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(0, 14, 32, 18), MyGUI::Align::Default, std::string("Label"));
        text->setTextAlign(MyGUI::Align::Right);
        text->setNeedMouseFocus(false);
        text->setTextShadow(true);
        text->setTextShadowColour(MyGUI::Colour(0,0,0));
        text->setCaption(getCountString(count));
        mDragAndDrop->mDraggedFrom = this;
    }
开发者ID:SlavaHill,项目名称:openmw,代码行数:59,代码来源:inventorywindow.cpp


示例11: resetCoins

 void LevelupDialog::resetCoins ()
 {
     int curX = mMainWidget->getWidth()/2 - (16 + 2) * 1.5;
     for (int i=0; i<3; ++i)
     {
         MyGUI::ImageBox* image = mCoins[i];
         image->setCoord(MyGUI::IntCoord(curX,250,16,16));
         curX += 24+2;
     }
 }
开发者ID:zeidrich,项目名称:openmw,代码行数:10,代码来源:levelupdialog.cpp


示例12: addSeparator

void ReviewDialog::addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{
    MyGUI::ImageBox* separator = mSkillView->createWidget<MyGUI::ImageBox>("MW_HLine", MyGUI::IntCoord(10, coord1.top, coord1.width + coord2.width - 4, 18), MyGUI::Align::Default);
    separator->eventMouseWheel += MyGUI::newDelegate(this, &ReviewDialog::onMouseWheel);

    mSkillWidgets.push_back(separator);

    coord1.top += separator->getHeight();
    coord2.top += separator->getHeight();
}
开发者ID:FranciscoPinto,项目名称:openmw,代码行数:10,代码来源:review.cpp


示例13: redraw

        void MWList::redraw(bool scrollbarShown)
        {
            const int _scrollBarWidth = 20; // fetch this from skin?
            const int scrollBarWidth = scrollbarShown ? _scrollBarWidth : 0;
            const int spacing = 3;
            size_t viewPosition = -mScrollView->getViewOffset().top;

            while (mScrollView->getChildCount())
            {
                MyGUI::Gui::getInstance().destroyWidget(mScrollView->getChildAt(0));
            }

            mItemHeight = 0;
            int i=0;
            for (std::vector<std::string>::const_iterator it=mItems.begin();
                it!=mItems.end(); ++it)
            {
                if (*it != "")
                {
                    MyGUI::Button* button = mScrollView->createWidget<MyGUI::Button>(
                        "MW_ListLine", MyGUI::IntCoord(0, mItemHeight, mScrollView->getSize().width - scrollBarWidth - 2, 24),
                        MyGUI::Align::Left | MyGUI::Align::Top, getName() + "_item_" + (*it));
                    button->setCaption((*it));
                    button->getSubWidgetText()->setWordWrap(true);
                    button->getSubWidgetText()->setTextAlign(MyGUI::Align::Left);
                    button->eventMouseWheel += MyGUI::newDelegate(this, &MWList::onMouseWheel);
                    button->eventMouseButtonClick += MyGUI::newDelegate(this, &MWList::onItemSelected);

                    int height = button->getTextSize().height;
                    button->setSize(MyGUI::IntSize(button->getSize().width, height));
                    button->setUserData(i);

                    mItemHeight += height + spacing;
                }
                else
                {
                    MyGUI::ImageBox* separator = mScrollView->createWidget<MyGUI::ImageBox>("MW_HLine",
                        MyGUI::IntCoord(2, mItemHeight, mScrollView->getWidth() - scrollBarWidth - 4, 18),
                        MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
                    separator->setNeedMouseFocus(false);

                    mItemHeight += 18 + spacing;
                }
                ++i;
            }
            mScrollView->setCanvasSize(mClient->getSize().width, std::max(mItemHeight, mClient->getSize().height));

            if (!scrollbarShown && mItemHeight > mClient->getSize().height)
                redraw(true);

            size_t viewRange = mScrollView->getCanvasSize().height;
            if(viewPosition > viewRange)
                viewPosition = viewRange;
            mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition));
        }
开发者ID:0xmono,项目名称:openmw,代码行数:55,代码来源:list.cpp


示例14: addSeparator

void StatsWindow::addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{
    MyGUI::ImageBox* separator = skillClientWidget->createWidget<MyGUI::ImageBox>("MW_HLine",
        MyGUI::IntCoord(10, coord1.top, coord1.width + coord2.width - 4, 18),
        MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
    separator->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
    skillWidgets.push_back(separator);

    coord1.top += separator->getHeight();
    coord2.top += separator->getHeight();
}
开发者ID:Thynix,项目名称:openmw,代码行数:11,代码来源:stats_window.cpp


示例15: resetCoins

 void LevelupDialog::resetCoins ()
 {
     int curX = 0;
     for (int i=0; i<3; ++i)
     {
         MyGUI::ImageBox* image = mCoins[i];
         image->detachFromWidget();
         image->attachToWidget(mCoinBox);
         image->setCoord(MyGUI::IntCoord(curX,0,16,16));
         curX += 24+2;
     }
 }
开发者ID:0xmono,项目名称:openmw,代码行数:12,代码来源:levelupdialog.cpp


示例16: resetCoins

 void LevelupDialog::resetCoins()
 {
     const int coinSpacing = 10;
     int curX = mCoinBox->getWidth()/2 - (coinSpacing*(mCoinCount - 1) + 16*mCoinCount)/2;
     for (unsigned int i=0; i<mCoinCount; ++i)
     {
         MyGUI::ImageBox* image = mCoins[i];
         image->detachFromWidget();
         image->attachToWidget(mCoinBox);
         image->setCoord(MyGUI::IntCoord(curX,0,16,16));
         curX += 16+coinSpacing;
     }
 }
开发者ID:Allxere,项目名称:openmw,代码行数:13,代码来源:levelupdialog.cpp


示例17: update

void AlchemyWindow::update()
{
    MWMechanics::Alchemy::TIngredientsIterator it = mAlchemy.beginIngredients ();
    for (int i=0; i<4; ++i)
    {
        MyGUI::ImageBox* ingredient = mIngredients[i];

        MWWorld::Ptr item;
        if (it != mAlchemy.endIngredients ())
        {
            item = *it;
            ++it;
        }

        if (ingredient->getChildCount())
            MyGUI::Gui::getInstance().destroyWidget(ingredient->getChildAt(0));

        ingredient->setImageTexture("");
        ingredient->clearUserStrings ();

        if (item.isEmpty ())
            continue;

        ingredient->setUserString("ToolTipType", "ItemPtr");
        ingredient->setUserData(item);
        ingredient->setImageTexture(getIconPath(item));

        MyGUI::TextBox* text = ingredient->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(0, 14, 32, 18), MyGUI::Align::Default, std::string("Label"));
        text->setTextAlign(MyGUI::Align::Right);
        text->setNeedMouseFocus(false);
        text->setTextShadow(true);
        text->setTextShadowColour(MyGUI::Colour(0,0,0));
        text->setCaption(getCountString(ingredient->getUserData<MWWorld::Ptr>()->getRefData().getCount()));
    }

    drawItems();

    std::vector<ESM::ENAMstruct> effects;
    ESM::EffectList list;
    list.mList = effects;
    for (MWMechanics::Alchemy::TEffectsIterator it = mAlchemy.beginEffects (); it != mAlchemy.endEffects (); ++it)
    {
        list.mList.push_back(*it);
    }

    while (mEffectsBox->getChildCount())
        MyGUI::Gui::getInstance().destroyWidget(mEffectsBox->getChildAt(0));

    MyGUI::IntCoord coord(0, 0, mEffectsBox->getWidth(), 24);
    Widgets::MWEffectListPtr effectsWidget = mEffectsBox->createWidget<Widgets::MWEffectList>
            ("MW_StatName", coord, MyGUI::Align::Left | MyGUI::Align::Top);
    effectsWidget->setWindowManager(&mWindowManager);

    Widgets::SpellEffectList _list = Widgets::MWEffectList::effectListFromESM(&list);
    effectsWidget->setEffectList(_list);

    std::vector<MyGUI::Widget*> effectItems;
    effectsWidget->createEffectWidgets(effectItems, mEffectsBox, coord, false, 0);
    effectsWidget->setCoord(coord);
}
开发者ID:lazydev2,项目名称:openmw,代码行数:60,代码来源:alchemywindow.cpp


示例18: assignCoins

    void LevelupDialog::assignCoins ()
    {
        resetCoins();
        for (unsigned int i=0; i<mSpentAttributes.size(); ++i)
        {
            MyGUI::ImageBox* image = mCoins[i];
            int attribute = mSpentAttributes[i];

            int xdiff = mAttributeMultipliers[attribute]->getCaption() == "" ? 0 : 30;

            MyGUI::IntPoint pos = mAttributes[attribute]->getAbsolutePosition() - mMainWidget->getAbsolutePosition() - MyGUI::IntPoint(24+xdiff,-4);
            image->setPosition(pos);
        }

        setAttributeValues();
    }
开发者ID:zeidrich,项目名称:openmw,代码行数:16,代码来源:levelupdialog.cpp


示例19: startDrag

    void DragAndDrop::startDrag (int index, SortFilterItemModel* sortModel, ItemModel* sourceModel, ItemView* sourceView, int count)
    {
        mItem = sourceModel->getItem(index);
        mDraggedCount = count;
        mSourceModel = sourceModel;
        mSourceView = sourceView;
        mSourceSortModel = sortModel;
        mIsOnDragAndDrop = true;
        mDragAndDropWidget->setVisible(true);

        std::string sound = MWWorld::Class::get(mItem.mBase).getUpSoundId(mItem.mBase);
        MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);

        if (mSourceSortModel)
        {
            mSourceSortModel->clearDragItems();
            mSourceSortModel->addDragItem(mItem.mBase, count);
        }

        std::string path = std::string("icons\\");
        path += MWWorld::Class::get(mItem.mBase).getInventoryIcon(mItem.mBase);
        MyGUI::ImageBox* baseWidget = mDragAndDropWidget->createWidget<MyGUI::ImageBox>
                ("ImageBox", MyGUI::IntCoord(0, 0, 42, 42), MyGUI::Align::Default);
        mDraggedWidget = baseWidget;
        MyGUI::ImageBox* image = baseWidget->createWidget<MyGUI::ImageBox>("ImageBox",
            MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
        size_t pos = path.rfind(".");
        if (pos != std::string::npos)
            path.erase(pos);
        path.append(".dds");
        image->setImageTexture(path);
        image->setNeedMouseFocus(false);

        // text widget that shows item count
        MyGUI::TextBox* text = image->createWidget<MyGUI::TextBox>("SandBrightText",
            MyGUI::IntCoord(0, 14, 32, 18), MyGUI::Align::Default, std::string("Label"));
        text->setTextAlign(MyGUI::Align::Right);
        text->setNeedMouseFocus(false);
        text->setTextShadow(true);
        text->setTextShadowColour(MyGUI::Colour(0,0,0));
        text->setCaption(ItemView::getCountString(count));

        sourceView->update();

        MWBase::Environment::get().getWindowManager()->setDragDrop(true);
    }
开发者ID:JohnathanGreen,项目名称:openmw,代码行数:46,代码来源:container.cpp


示例20: changeMission

void GUIMissionWindow::changeMission( int index,MissionState state,std::string caption)
{
	MyGUI::ImageBox* icon;
	MyGUI::TextBox* text;

	if(caption!="")
	{
		assignWidget(text,str(boost::format("Mission%1%Caption")%(index+1)));

		if(caption!="clear")
		{
			text->setCaption(caption);
		}
		else
		{
			text->setCaption("");
		}
	}

	assignWidget(icon,str(boost::format("Mission%1%Icon")%(index+1)));

	switch (state)
	{
	case MS_New:
		{
			icon->setItemName("New");
			break;
		}
	case MS_Complete:
		{
			icon->setItemName("Complete");
			break;
		}
	case MS_Fail:
		{
			icon->setItemName("Fail");
			break;
		}
	case MS_NULL:
		{
			icon->setItemName("");
			break;
		}
	}
}
开发者ID:parhelia512,项目名称:fdux-slg-game,代码行数:45,代码来源:GUIMissionWindow.cpp



注:本文中的mygui::ImageBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ mygui::IntCoord类代码示例发布时间:2022-05-31
下一篇:
C++ mygui::ButtonPtr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap