spell window layout & opening/closing/pinning logic

actorid
scrawl 13 years ago
parent 1b561ce91f
commit c7268233df

@ -28,7 +28,7 @@ add_openmw_dir (mwgui
dialogue_history window_base stats_window messagebox journalwindow charactercreation dialogue_history window_base stats_window messagebox journalwindow charactercreation
map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list
formatting inventorywindow container hud countdialog tradewindow settingswindow formatting inventorywindow container hud countdialog tradewindow settingswindow
confirmationdialog alchemywindow referenceinterface confirmationdialog alchemywindow referenceinterface spellwindow
) )
add_openmw_dir (mwdialogue add_openmw_dir (mwdialogue

@ -91,7 +91,7 @@ namespace MWGui
mFilterAll->setStateSelected(true); mFilterAll->setStateSelected(true);
setCoord(0, 342, 600, 258); setCoord(0, 342, 498, 258);
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
openContainer(player); openContainer(player);

@ -0,0 +1,20 @@
#include "spellwindow.hpp"
#include "window_manager.hpp"
namespace MWGui
{
SpellWindow::SpellWindow(WindowManager& parWindowManager)
: WindowPinnableBase("openmw_spell_window_layout.xml", parWindowManager)
{
getWidget(mSpellView, "SpellView");
getWidget(mEffectBox, "EffectsBox");
setCoord(498, 300, 302, 300);
}
void SpellWindow::onPinToggled()
{
mWindowManager.setSpellVisibility(!mPinned);
}
}

@ -0,0 +1,21 @@
#ifndef MWGUI_SPELLWINDOW_H
#define MWGUI_SPELLWINDOW_H
#include "window_pinnable_base.hpp"
namespace MWGui
{
class SpellWindow : public WindowPinnableBase
{
public:
SpellWindow(WindowManager& parWindowManager);
protected:
MyGUI::ScrollView* mSpellView;
MyGUI::Widget* mEffectBox;
virtual void onPinToggled();
};
}
#endif

@ -19,6 +19,7 @@
#include "settingswindow.hpp" #include "settingswindow.hpp"
#include "confirmationdialog.hpp" #include "confirmationdialog.hpp"
#include "alchemywindow.hpp" #include "alchemywindow.hpp"
#include "spellwindow.hpp"
#include "../mwmechanics/mechanicsmanager.hpp" #include "../mwmechanics/mechanicsmanager.hpp"
#include "../mwinput/inputmanager.hpp" #include "../mwinput/inputmanager.hpp"
@ -56,6 +57,7 @@ WindowManager::WindowManager(
, mSettingsWindow(NULL) , mSettingsWindow(NULL)
, mConfirmationDialog(NULL) , mConfirmationDialog(NULL)
, mAlchemyWindow(NULL) , mAlchemyWindow(NULL)
, mSpellWindow(NULL)
, mCharGen(NULL) , mCharGen(NULL)
, playerClass() , playerClass()
, playerName() , playerName()
@ -124,6 +126,7 @@ WindowManager::WindowManager(
mSettingsWindow = new SettingsWindow(*this); mSettingsWindow = new SettingsWindow(*this);
mConfirmationDialog = new ConfirmationDialog(*this); mConfirmationDialog = new ConfirmationDialog(*this);
mAlchemyWindow = new AlchemyWindow(*this); mAlchemyWindow = new AlchemyWindow(*this);
mSpellWindow = new SpellWindow(*this);
// The HUD is always on // The HUD is always on
hud->setVisible(true); hud->setVisible(true);
@ -167,6 +170,7 @@ WindowManager::~WindowManager()
delete mSettingsWindow; delete mSettingsWindow;
delete mConfirmationDialog; delete mConfirmationDialog;
delete mAlchemyWindow; delete mAlchemyWindow;
delete mSpellWindow;
cleanupGarbage(); cleanupGarbage();
} }
@ -211,6 +215,7 @@ void WindowManager::updateVisible()
mTradeWindow->setVisible(false); mTradeWindow->setVisible(false);
mSettingsWindow->setVisible(false); mSettingsWindow->setVisible(false);
mAlchemyWindow->setVisible(false); mAlchemyWindow->setVisible(false);
mSpellWindow->setVisible(false);
// Mouse is visible whenever we're not in game mode // Mouse is visible whenever we're not in game mode
MyGUI::PointerManager::getInstance().setVisible(isGuiMode()); MyGUI::PointerManager::getInstance().setVisible(isGuiMode());
@ -224,7 +229,7 @@ void WindowManager::updateVisible()
setMinimapVisibility((allowed & GW_Map) && !map->pinned()); setMinimapVisibility((allowed & GW_Map) && !map->pinned());
setWeaponVisibility((allowed & GW_Inventory) && !mInventoryWindow->pinned()); setWeaponVisibility((allowed & GW_Inventory) && !mInventoryWindow->pinned());
setSpellVisibility((allowed & GW_Magic)); /// \todo add pin state when spells window is implemented setSpellVisibility((allowed & GW_Magic) && !mSpellWindow->pinned());
setHMSVisibility((allowed & GW_Stats) && !mStatsWindow->pinned()); setHMSVisibility((allowed & GW_Stats) && !mStatsWindow->pinned());
// If in game mode, don't show anything. // If in game mode, don't show anything.
@ -271,9 +276,10 @@ void WindowManager::updateVisible()
int eff = shown & allowed; int eff = shown & allowed;
// Show the windows we want // Show the windows we want
map -> setVisible( (eff & GW_Map) ); map -> setVisible(eff & GW_Map);
mStatsWindow -> setVisible( (eff & GW_Stats) ); mStatsWindow -> setVisible(eff & GW_Stats);
mInventoryWindow->setVisible( (eff & GW_Inventory)); mInventoryWindow->setVisible(eff & GW_Inventory);
mSpellWindow->setVisible(eff & GW_Magic);
break; break;
} }
case GM_Container: case GM_Container:

@ -81,6 +81,7 @@ namespace MWGui
class SettingsWindow; class SettingsWindow;
class ConfirmationDialog; class ConfirmationDialog;
class AlchemyWindow; class AlchemyWindow;
class SpellWindow;
struct ClassPoint struct ClassPoint
{ {
@ -250,6 +251,7 @@ namespace MWGui
SettingsWindow* mSettingsWindow; SettingsWindow* mSettingsWindow;
ConfirmationDialog* mConfirmationDialog; ConfirmationDialog* mConfirmationDialog;
AlchemyWindow* mAlchemyWindow; AlchemyWindow* mAlchemyWindow;
SpellWindow* mSpellWindow;
CharacterCreation* mCharGen; CharacterCreation* mCharGen;

@ -60,6 +60,7 @@ configure_file("${SDIR}/openmw_trade_window_layout.xml" "${DDIR}/openmw_trade_wi
configure_file("${SDIR}/openmw_settings_window_layout.xml" "${DDIR}/openmw_settings_window_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_settings_window_layout.xml" "${DDIR}/openmw_settings_window_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_confirmation_dialog_layout.xml" "${DDIR}/openmw_confirmation_dialog_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_confirmation_dialog_layout.xml" "${DDIR}/openmw_confirmation_dialog_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_alchemy_window_layout.xml" "${DDIR}/openmw_alchemy_window_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_alchemy_window_layout.xml" "${DDIR}/openmw_alchemy_window_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_spell_window_layout.xml" "${DDIR}/openmw_spell_window_layout.xml" COPYONLY)
configure_file("${SDIR}/atlas1.cfg" "${DDIR}/atlas1.cfg" COPYONLY) configure_file("${SDIR}/atlas1.cfg" "${DDIR}/atlas1.cfg" COPYONLY)
configure_file("${SDIR}/smallbars.png" "${DDIR}/smallbars.png" COPYONLY) configure_file("${SDIR}/smallbars.png" "${DDIR}/smallbars.png" COPYONLY)
configure_file("${SDIR}/EBGaramond-Regular.ttf" "${DDIR}/EBGaramond-Regular.ttf" COPYONLY) configure_file("${SDIR}/EBGaramond-Regular.ttf" "${DDIR}/EBGaramond-Regular.ttf" COPYONLY)

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 600" name="_Main">
<!-- Effect box-->
<Widget type="Widget" skin="MW_Box" position="8 8 268 24" align="Left Top HStretch">
<Widget type="Widget" skin="" position="4 4 260 16" align="Left Top Stretch" name="EffectsBox">
</Widget>
</Widget>
<!-- Spell list -->
<Widget type="Widget" skin="MW_Box" position="8 38 268 518" align="Left Top Stretch">
<Widget type="ScrollView" skin="MW_ScrollView" position="4 4 260 510" align="Left Top Stretch" name="SpellView">
</Widget>
</Widget>
</Widget>
</MyGUI>
Loading…
Cancel
Save