mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Fix image buttons
This commit is contained in:
parent
301efb411e
commit
90b7df439f
7 changed files with 120 additions and 46 deletions
|
@ -38,6 +38,18 @@ namespace MWGui
|
|||
getWidget(mLeftPage, "LeftPage");
|
||||
getWidget(mRightPage, "RightPage");
|
||||
|
||||
adjustButton(mCloseButton);
|
||||
adjustButton(mTakeButton);
|
||||
adjustButton(mNextPageButton);
|
||||
adjustButton(mPrevPageButton);
|
||||
|
||||
if (mNextPageButton->getSize().width == 64)
|
||||
{
|
||||
// english button has a 7 pixel wide strip of garbage on its right edge
|
||||
mNextPageButton->setSize(64-7, mNextPageButton->getSize().height);
|
||||
mNextPageButton->setImageCoord(MyGUI::IntCoord(0,0,64-7,mNextPageButton->getSize().height));
|
||||
}
|
||||
|
||||
center();
|
||||
}
|
||||
|
||||
|
@ -174,4 +186,13 @@ namespace MWGui
|
|||
}
|
||||
}
|
||||
|
||||
void BookWindow::adjustButton (MWGui::ImageButton* button)
|
||||
{
|
||||
MyGUI::IntSize diff = button->getSize() - button->getRequestedSize();
|
||||
button->setSize(button->getRequestedSize());
|
||||
|
||||
if (button->getAlign().isRight())
|
||||
button->setPosition(button->getPosition() + MyGUI::IntPoint(diff.width,0));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace MWGui
|
|||
|
||||
void updatePages();
|
||||
void clearPages();
|
||||
void adjustButton(MWGui::ImageButton* button);
|
||||
|
||||
private:
|
||||
MWGui::ImageButton* mCloseButton;
|
||||
|
|
|
@ -137,10 +137,47 @@ namespace
|
|||
getPage (QuestsPage)->adviseLinkClicked (callback);
|
||||
}
|
||||
|
||||
adjustButton(OptionsBTN);
|
||||
adjustButton(PrevPageBTN);
|
||||
adjustButton(NextPageBTN);
|
||||
adjustButton(CloseBTN);
|
||||
adjustButton(CancelBTN);
|
||||
adjustButton(ShowAllBTN);
|
||||
adjustButton(ShowActiveBTN);
|
||||
adjustButton(JournalBTN);
|
||||
|
||||
MWGui::ImageButton* nextButton = getWidget<MWGui::ImageButton>(NextPageBTN);
|
||||
if (nextButton->getSize().width == 64)
|
||||
{
|
||||
// english button has a 7 pixel wide strip of garbage on its right edge
|
||||
nextButton->setSize(64-7, nextButton->getSize().height);
|
||||
nextButton->setImageCoord(MyGUI::IntCoord(0,0,64-7,nextButton->getSize().height));
|
||||
}
|
||||
|
||||
adjustButton(TopicsBTN);
|
||||
adjustButton(QuestsBTN);
|
||||
int width = getWidget<MyGUI::Widget>(TopicsBTN)->getSize().width + getWidget<MyGUI::Widget>(QuestsBTN)->getSize().width;
|
||||
int topicsWidth = getWidget<MyGUI::Widget>(TopicsBTN)->getSize().width;
|
||||
int pageWidth = getWidget<MyGUI::Widget>(RightBookPage)->getSize().width;
|
||||
|
||||
getWidget<MyGUI::Widget>(TopicsBTN)->setPosition((pageWidth - width)/2, getWidget<MyGUI::Widget>(TopicsBTN)->getPosition().top);
|
||||
getWidget<MyGUI::Widget>(QuestsBTN)->setPosition((pageWidth - width)/2 + topicsWidth, getWidget<MyGUI::Widget>(QuestsBTN)->getPosition().top);
|
||||
|
||||
mQuestMode = false;
|
||||
mAllQuests = false;
|
||||
}
|
||||
|
||||
void adjustButton (char const * name)
|
||||
{
|
||||
MWGui::ImageButton* button = getWidget<MWGui::ImageButton>(name);
|
||||
|
||||
MyGUI::IntSize diff = button->getSize() - button->getRequestedSize();
|
||||
button->setSize(button->getRequestedSize());
|
||||
|
||||
if (button->getAlign().isRight())
|
||||
button->setPosition(button->getPosition() + MyGUI::IntPoint(diff.width,0));
|
||||
}
|
||||
|
||||
void open()
|
||||
{
|
||||
mModel->load ();
|
||||
|
@ -391,6 +428,7 @@ namespace
|
|||
|
||||
void notifyClose(MyGUI::Widget* _sender)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
|
||||
|
||||
MWBase::Environment::get().getWindowManager ()->popGuiMode ();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,18 @@
|
|||
|
||||
#include "formatting.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
void adjustButton (MWGui::ImageButton* button)
|
||||
{
|
||||
MyGUI::IntSize diff = button->getSize() - button->getRequestedSize();
|
||||
button->setSize(button->getRequestedSize());
|
||||
|
||||
if (button->getAlign().isRight())
|
||||
button->setPosition(button->getPosition() + MyGUI::IntPoint(diff.width,0));
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
|
@ -26,6 +38,9 @@ namespace MWGui
|
|||
getWidget(mTakeButton, "TakeButton");
|
||||
mTakeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ScrollWindow::onTakeButtonClicked);
|
||||
|
||||
adjustButton(mCloseButton);
|
||||
adjustButton(mTakeButton);
|
||||
|
||||
center();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,25 +8,27 @@
|
|||
<Property key="ImageTexture" value="textures\tx_menubook.dds"/>
|
||||
<Property key="ImageCoord" value="50 0 412 256"/>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="300 350 48 32" name="NextPageBTN">
|
||||
<Property key="ImageCoord" value="0 0 48 32"/>
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_next_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_next_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_next_pressed.dds"/>
|
||||
</Widget>
|
||||
<Widget type="ImageButton" skin="ImageBox" position="220 350 48 32" name="PrevPageBTN">
|
||||
<Property key="ImageCoord" value="0 0 48 32"/>
|
||||
<Widget type="Widget" position="0 0 282 390">
|
||||
<Widget type="ImageButton" skin="ImageBox" position="205 350 48 32" name="PrevPageBTN">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_prev_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_prev_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_prev_pressed.dds"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
<Widget type="Widget" position="282 0 282 390">
|
||||
<Widget type="ImageButton" skin="ImageBox" position="18 350 48 32" name="NextPageBTN">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_next_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_next_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_next_pressed.dds"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="40 350 64 32" name="TakeButton">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_take_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_take_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_take_pressed.dds"/>
|
||||
</Widget>
|
||||
<Widget type="ImageButton" skin="ImageBox" position="475 350 48 32" name="CloseButton">
|
||||
<Property key="ImageCoord" value="0 0 48 32"/>
|
||||
<Widget type="ImageButton" skin="ImageBox" position="460 350 48 32" name="CloseButton">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_close_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_close_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_close_pressed.dds"/>
|
||||
|
|
|
@ -8,6 +8,21 @@
|
|||
<Property key="ImageTexture" value="textures\tx_menubook.dds"/>
|
||||
<Property key="ImageCoord" value="50 0 412 256"/>
|
||||
|
||||
<Widget type="Widget" position="0 0 282 390">
|
||||
<Widget type="ImageButton" skin="ImageBox" position="205 350 48 32" name="PrevPageBTN">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_prev_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_prev_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_prev_pressed.dds"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
<Widget type="Widget" position="282 0 282 390">
|
||||
<Widget type="ImageButton" skin="ImageBox" position="18 350 48 32" name="NextPageBTN">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_next_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_next_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_next_pressed.dds"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<!-- buttons -->
|
||||
<Widget type="ImageButton" skin="ImageBox" position="40 350 64 32" name="OptionsBTN">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_options_over.dds"/>
|
||||
|
@ -17,29 +32,16 @@
|
|||
<Widget type="TextBox" skin="NormalText" position="150 350 32 16" name="PageOneNum">
|
||||
<Property key="TextColour" value="0 0 0"/>
|
||||
</Widget>
|
||||
<Widget type="ImageButton" skin="ImageBox" position="220 350 48 32" name="PrevPageBTN">
|
||||
<Property key="ImageCoord" value="0 0 48 32"/>
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_prev_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_prev_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_prev_pressed.dds"/>
|
||||
</Widget>
|
||||
<Widget type="ImageButton" skin="ImageBox" position="300 350 48 32" name="NextPageBTN">
|
||||
<Property key="ImageCoord" value="0 0 48 32"/>
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_next_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_next_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_next_pressed.dds"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="TextBox" skin="NormalText" position="410 350 32 16" name="PageTwoNum">
|
||||
<Property key="TextColour" value="0 0 0"/>
|
||||
</Widget>
|
||||
<Widget type="ImageButton" skin="ImageBox" position="475 350 48 32" name="CloseBTN">
|
||||
<Property key="ImageCoord" value="0 0 48 32"/>
|
||||
<Widget type="ImageButton" skin="ImageBox" position="460 350 48 32" name="CloseBTN">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_close_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_close_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_close_pressed.dds"/>
|
||||
</Widget>
|
||||
<Widget type="ImageButton" skin="ImageBox" position="460 350 64 32" name="JournalBTN">
|
||||
<Property key="ImageCoord" value="0 0 64 32"/>
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_journal_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_journal_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_journal_pressed.dds"/>
|
||||
|
@ -62,6 +64,18 @@
|
|||
<Widget type="BookPage" skin="MW_BookPage" position="20 15 92 250" name="LeftTopicIndex"/>
|
||||
<Widget type="BookPage" skin="MW_BookPage" position="112 15 92 250" name="RightTopicIndex"/>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="62 15 100 20" Align="Top|Left" name="ShowActiveBTN">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_quests_active_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_quests_active_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_quests_active_pressed.dds"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="76 15 72 20" Align="Top|Left" name="ShowAllBTN">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_quests_all_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_quests_all_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_quests_all_pressed.dds"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="ScrollView" skin="MW_ScrollView" position="20 15 184 245" name="TopicsList" align="Right VStretch">
|
||||
<Property key="CanvasAlign" value="Left Top"/>
|
||||
<Widget type="BookPage" skin="MW_BookPage" position="0 0 30000 30000" name="TopicsPage"/>
|
||||
|
@ -72,36 +86,19 @@
|
|||
<Widget type="BookPage" skin="MW_BookPage" position="0 0 30000 30000" name="QuestsPage"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="62 15 100 20" Align="Top|Left" name="ShowActiveBTN">
|
||||
<Property key="ImageCoord" value="0 0 100 20"/>
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_quests_active_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_quests_active_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_quests_active_pressed.dds"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="76 15 72 20" Align="Top|Left" name="ShowAllBTN">
|
||||
<Property key="ImageCoord" value="0 0 72 20"/>
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_quests_all_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_quests_all_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_quests_all_pressed.dds"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="40 265 56 32" Align="Top|Left" name="TopicsBTN">
|
||||
<Property key="ImageCoord" value="0 0 56 32"/>
|
||||
<Widget type="ImageButton" skin="ImageBox" position="20 265 56 32" Align="Top|Left" name="TopicsBTN">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_topics_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_topics_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_topics_pressed.dds"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="130 265 56 32" Align="Top|Left" name="QuestsBTN">
|
||||
<Property key="ImageCoord" value="0 0 56 32"/>
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_quests_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_quests_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_quests_pressed.dds"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="85 290 56 32" Align="Top|Left" name="CancelBTN">
|
||||
<Property key="ImageCoord" value="0 0 56 32"/>
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_cancel_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_cancel_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_cancel_pressed.dds"/>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<Property key="ImagePushed" value="textures\tx_menubook_take_pressed.dds"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="ImageButton" skin="ImageBox" position="418 24 128 32" name="CloseButton">
|
||||
<Widget type="ImageButton" skin="ImageBox" position="415 24 128 32" name="CloseButton">
|
||||
<Property key="ImageHighlighted" value="textures\tx_menubook_close_over.dds"/>
|
||||
<Property key="ImageNormal" value="textures\tx_menubook_close_idle.dds"/>
|
||||
<Property key="ImagePushed" value="textures\tx_menubook_close_pressed.dds"/>
|
||||
|
|
Loading…
Reference in a new issue