1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-17 01:10:10 +00:00
OpenMW/apps/openmw/mwgui/waitdialog.hpp
florent.teppe 65cdd489fb create a specific esm reader function for RefID to avoid allocation for string and then again for RefId
Fixed some types

removed useless header

applied clang format

fixed compile tests

fixed clang tidy, and closer to logic before this MR

Removed hardcoded refids

unless there is a returned value we don't use static RefIds
can use == between RefId and hardcoded string

Fix clang format

Fixed a few instances where std::string was used, when only const std::string& was needed

removed unused variable
2022-12-27 19:15:57 +01:00

85 lines
2.1 KiB
C++

#ifndef MWGUI_WAIT_DIALOG_H
#define MWGUI_WAIT_DIALOG_H
#include "timeadvancer.hpp"
#include "windowbase.hpp"
#include <components/esm/refid.hpp>
namespace MWGui
{
class WaitDialogProgressBar : public WindowBase
{
public:
WaitDialogProgressBar();
void onOpen() override;
void setProgress(int cur, int total);
protected:
MyGUI::ProgressBar* mProgressBar;
MyGUI::TextBox* mProgressText;
};
class WaitDialog : public WindowBase
{
public:
WaitDialog();
void setPtr(const MWWorld::Ptr& ptr) override;
void onOpen() override;
bool exit() override;
void clear() override;
void onFrame(float dt) override;
bool getSleeping() { return mTimeAdvancer.isRunning() && mSleeping; }
void wakeUp();
void autosave();
WindowBase* getProgressBar() { return &mProgressBar; }
protected:
MyGUI::TextBox* mDateTimeText;
MyGUI::TextBox* mRestText;
MyGUI::TextBox* mHourText;
MyGUI::Button* mUntilHealedButton;
MyGUI::Button* mWaitButton;
MyGUI::Button* mCancelButton;
MyGUI::ScrollBar* mHourSlider;
TimeAdvancer mTimeAdvancer;
bool mSleeping;
int mHours;
int mManualHours; // stores the hours to rest selected via slider
float mFadeTimeRemaining;
int mInterruptAt;
ESM::RefId mInterruptCreatureList;
WaitDialogProgressBar mProgressBar;
void onUntilHealedButtonClicked(MyGUI::Widget* sender);
void onWaitButtonClicked(MyGUI::Widget* sender);
void onCancelButtonClicked(MyGUI::Widget* sender);
void onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position);
void onKeyButtonPressed(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character);
void onWaitingProgressChanged(int cur, int total);
void onWaitingInterrupted();
void onWaitingFinished();
void setCanRest(bool canRest);
void startWaiting(int hoursToWait);
void stopWaiting();
};
}
#endif