1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-18 13:12:50 +00:00
OpenMW/apps/openmw/mwgui/bookwindow.hpp

66 lines
1.6 KiB
C++
Raw Normal View History

2012-05-03 03:33:33 +02:00
#ifndef MWGUI_BOOKWINDOW_H
#define MWGUI_BOOKWINDOW_H
#include "windowbase.hpp"
2012-05-03 03:33:33 +02:00
#include "../mwworld/ptr.hpp"
#include <components/widgets/imagebutton.hpp>
2012-05-03 03:33:33 +02:00
namespace MWGui
{
class BookWindow : public BookWindowBase
2012-05-03 03:33:33 +02:00
{
2022-09-22 21:26:05 +03:00
public:
BookWindow();
2022-09-22 21:26:05 +03:00
void setPtr(const MWWorld::Ptr& book) override;
void setInventoryAllowed(bool allowed);
2022-09-22 21:26:05 +03:00
void onResChange(int, int) override { center(); }
2017-09-23 22:07:30 +02:00
2023-07-09 08:42:09 +02:00
std::string_view getWindowIdForLua() const override { return "Book"; }
2022-09-22 21:26:05 +03:00
protected:
void onNextPageButtonClicked(MyGUI::Widget* sender);
void onPrevPageButtonClicked(MyGUI::Widget* sender);
void onCloseButtonClicked(MyGUI::Widget* sender);
void onTakeButtonClicked(MyGUI::Widget* sender);
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
void setTakeButtonShow(bool show);
2015-03-11 20:33:55 +01:00
2022-09-22 21:26:05 +03:00
void onKeyButtonPressed(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character);
2022-09-22 21:26:05 +03:00
void nextPage();
void prevPage();
2022-09-22 21:26:05 +03:00
void updatePages();
void clearPages();
2012-05-10 11:03:27 +02:00
2022-09-22 21:26:05 +03:00
private:
typedef std::pair<int, int> Page;
typedef std::vector<Page> Pages;
2014-09-20 00:11:04 +02:00
2022-09-22 21:26:05 +03:00
Gui::ImageButton* mCloseButton;
Gui::ImageButton* mTakeButton;
Gui::ImageButton* mNextPageButton;
Gui::ImageButton* mPrevPageButton;
2014-09-20 00:11:04 +02:00
2022-09-22 21:26:05 +03:00
MyGUI::TextBox* mLeftPageNumber;
MyGUI::TextBox* mRightPageNumber;
MyGUI::Widget* mLeftPage;
MyGUI::Widget* mRightPage;
2012-05-10 11:03:27 +02:00
2022-09-22 21:26:05 +03:00
unsigned int mCurrentPage; // 0 is first page
Pages mPages;
2022-09-22 21:26:05 +03:00
MWWorld::Ptr mBook;
2022-09-22 21:26:05 +03:00
bool mTakeButtonShow;
bool mTakeButtonAllowed;
2012-05-03 03:33:33 +02:00
};
}
#endif