|
|
@ -1252,72 +1252,65 @@ class BookPageImpl : public BookPage
|
|
|
|
MYGUI_RTTI_DERIVED(BookPage)
|
|
|
|
MYGUI_RTTI_DERIVED(BookPage)
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BookPageImpl()
|
|
|
|
|
|
|
|
: mPageDisplay(NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void showPage (TypesetBook::Ptr book, size_t page)
|
|
|
|
void showPage (TypesetBook::Ptr book, size_t page)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
|
|
|
mPageDisplay->showPage (book, page);
|
|
|
|
pd->showPage (book, page);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
throw std::runtime_error ("The main sub-widget for a BookPage must be a PageDisplay.");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void adviseLinkClicked (boost::function <void (InteractiveId)> linkClicked)
|
|
|
|
void adviseLinkClicked (boost::function <void (InteractiveId)> linkClicked)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
|
|
|
mPageDisplay->mLinkClicked = linkClicked;
|
|
|
|
{
|
|
|
|
|
|
|
|
pd->mLinkClicked = linkClicked;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void unadviseLinkClicked ()
|
|
|
|
void unadviseLinkClicked ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
|
|
|
mPageDisplay->mLinkClicked = boost::function <void (InteractiveId)> ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual void initialiseOverride()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Base::initialiseOverride();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (getSubWidgetText())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mPageDisplay = getSubWidgetText()->castType<PageDisplay>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pd->mLinkClicked = boost::function <void (InteractiveId)> ();
|
|
|
|
throw std::runtime_error("BookPage unable to find page display sub widget");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void onMouseLostFocus(Widget* _new)
|
|
|
|
void onMouseLostFocus(Widget* _new)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// NOTE: MyGUI also fires eventMouseLostFocus for widgets that are about to be destroyed (if they had focus).
|
|
|
|
// NOTE: MyGUI also fires eventMouseLostFocus for widgets that are about to be destroyed (if they had focus).
|
|
|
|
// Child widgets may already be destroyed! So be careful.
|
|
|
|
// Child widgets may already be destroyed! So be careful.
|
|
|
|
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
|
|
|
mPageDisplay->onMouseLostFocus ();
|
|
|
|
{
|
|
|
|
|
|
|
|
pd->onMouseLostFocus ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
Widget::onMouseLostFocus (_new);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void onMouseMove(int left, int top)
|
|
|
|
void onMouseMove(int left, int top)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
|
|
|
mPageDisplay->onMouseMove (left, top);
|
|
|
|
{
|
|
|
|
|
|
|
|
pd->onMouseMove (left, top);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
Widget::onMouseMove (left, top);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void onMouseButtonPressed (int left, int top, MyGUI::MouseButton id)
|
|
|
|
void onMouseButtonPressed (int left, int top, MyGUI::MouseButton id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
|
|
|
mPageDisplay->onMouseButtonPressed (left, top, id);
|
|
|
|
{
|
|
|
|
|
|
|
|
pd->onMouseButtonPressed (left, top, id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
Widget::onMouseButtonPressed (left, top, id);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void onMouseButtonReleased(int left, int top, MyGUI::MouseButton id)
|
|
|
|
void onMouseButtonReleased(int left, int top, MyGUI::MouseButton id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
|
|
|
mPageDisplay->onMouseButtonReleased (left, top, id);
|
|
|
|
{
|
|
|
|
|
|
|
|
pd->onMouseButtonReleased (left, top, id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
Widget::onMouseButtonReleased (left, top, id);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PageDisplay* mPageDisplay;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void BookPage::registerMyGUIComponents ()
|
|
|
|
void BookPage::registerMyGUIComponents ()
|
|
|
|