OpenMW
apps/openmw/mwgui/waitdialog.hpp
Go to the documentation of this file.
00001 #ifndef MWGUI_WAIT_DIALOG_H
00002 #define MWGUI_WAIT_DIALOG_H
00003 
00004 #include "windowbase.hpp"
00005 #include "widgets.hpp"
00006 
00007 namespace MWGui
00008 {
00009 
00010     class WaitDialogProgressBar : public WindowBase
00011     {
00012     public:
00013         WaitDialogProgressBar();
00014 
00015         virtual void open();
00016 
00017         void setProgress(int cur, int total);
00018 
00019     protected:
00020         MyGUI::ProgressBar* mProgressBar;
00021         MyGUI::TextBox* mProgressText;
00022     };
00023 
00024     class WaitDialog : public WindowBase
00025     {
00026     public:
00027         WaitDialog();
00028 
00029         virtual void open();
00030 
00031         void onFrame(float dt);
00032 
00033         void bedActivated() { setCanRest(true); }
00034 
00035         bool getSleeping() { return mWaiting && mSleeping; }
00036         void wakeUp();
00037 
00038     protected:
00039         MyGUI::TextBox* mDateTimeText;
00040         MyGUI::TextBox* mRestText;
00041         MyGUI::TextBox* mHourText;
00042         MyGUI::Button* mUntilHealedButton;
00043         MyGUI::Button* mWaitButton;
00044         MyGUI::Button* mCancelButton;
00045         MWGui::Widgets::MWScrollBar* mHourSlider;
00046 
00047         bool mWaiting;
00048         bool mSleeping;
00049         int mCurHour;
00050         int mHours;
00051         int mManualHours; // stores the hours to rest selected via slider
00052         float mRemainingTime;
00053 
00054         WaitDialogProgressBar mProgressBar;
00055 
00056         void onUntilHealedButtonClicked(MyGUI::Widget* sender);
00057         void onWaitButtonClicked(MyGUI::Widget* sender);
00058         void onCancelButtonClicked(MyGUI::Widget* sender);
00059         void onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position);
00060 
00061         void setCanRest(bool canRest);
00062 
00063         void startWaiting(int hoursToWait);
00064         void stopWaiting();
00065     };
00066 
00067 }
00068 
00069 #endif