14 Class.
CastTo(m_content, layoutRoot.FindAnyWidget(
"HtmlWidget"));
15 Class.
CastTo(m_author, layoutRoot.FindAnyWidget(
"Author"));
16 Class.
CastTo(m_title, layoutRoot.FindAnyWidget(
"Title"));
17 Class.
CastTo(m_page, layoutRoot.FindAnyWidget(
"Page"));
20 m_content.GetScreenSize(width, m_page_height);
26 m_content.LoadFile( book.ConfigGetString(
"file") );
27 m_author.SetText( book.ConfigGetString(
"author") );
28 m_title.SetText( book.ConfigGetString(
"title") );
29 m_content_total_height = m_content.GetContentHeight();
36 super.OnClick(w,
x,
y, button);
38 switch (w.GetUserID())
66 if (m_content_total_height > m_page_height)
71 if (m_content_pos < 0)
76 if (m_content_pos > maxOffset)
78 m_content_pos = maxOffset;
81 m_content.SetContentOffset(m_content_pos,
true);
83 float pagesTotal =
Math.
Ceil(m_content_total_height / m_page_height);
84 float currPage =
Math.
Round(m_content_pos / m_page_height) + 1;
proto native WorkspaceWidget GetWorkspace()
Super root of all classes in Enforce script.
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Round(float f)
Returns mathematical round of value.
static proto float Ceil(float f)
Returns ceil of value.
const int IDC_BOOK_VIEWER_PREV
const int IDC_BOOK_VIEWER_NEXT