MCPcopy Create free account
hub / github.com/buggins/coolreader / CRTOCDialog

Method CRTOCDialog

cr3gui/src/tocdlg.cpp:113–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113CRTOCDialog::CRTOCDialog( CRGUIWindowManager * wm, lString16 title, int resultCmd, int pageCount, LVDocView * docview )
114: CRNumberEditDialog( wm, title, lString16(), resultCmd, 1, pageCount )
115,_docview(docview)
116{
117 docview->getFlatToc( _items );
118 _skinName = L"#toc";
119 _skin = _wm->getSkin()->getMenuSkin(_skinName.c_str());
120 CRRectSkinRef clientSkin = _skin->getClientSkin();
121 CRRectSkinRef itemSkin = _skin->getItemSkin();
122 CRRectSkinRef valueSkin = _skin->getValueSkin();
123 CRRectSkinRef selItemSkin = _skin->getSelItemSkin();
124 if ( itemSkin.isNull() )
125 itemSkin = clientSkin;
126 if ( valueSkin.isNull() )
127 valueSkin = clientSkin;
128 if ( selItemSkin.isNull() )
129 selItemSkin = clientSkin;
130
131 lvRect borders = clientSkin->getBorderWidths();
132 CRScrollSkinRef sskin = _skin->getScrollSkin();
133 _font = itemSkin->getFont();
134 _fullscreen = true;
135 _rect = _wm->getScreen()->getRect();
136 _caption = title;
137 lvRect clientRect = _skin->getClientRect( _rect );
138 lvRect tocRect;
139 getClientRect( tocRect );
140 tocRect.shrinkBy(borders);
141 lvRect itemBorders = itemSkin->getBorderWidths();
142 _itemHeight = _font->getHeight() + itemBorders.top + itemBorders.bottom;
143 _pageItems = tocRect.height() / _itemHeight;
144 int curItem = getCurItemIndex();
145 _topItem = curItem>=0 ? curItem / _pageItems * _pageItems : 0;
146 _page = _topItem / _pageItems + 1;
147 _pages = (_items.length()+(_pageItems-1))/ _pageItems;
148 int curPage = _docview->getCurPage();
149 int docPages = _docview->getPageCount();
150 lString16 pageString(_("Current page: $1 of $2\n"));
151 pageString.replaceIntParam(1, curPage+1);
152 pageString.replaceIntParam(2, docPages);
153 _statusText = pageString + lString16(_("Enter page number:"));
154 _inputText = L"_";
155}
156
157bool CRTOCDialog::digitEntered( lChar16 c )
158{

Callers

nothing calls this directly

Calls 15

lString16Class · 0.85
getFlatTocMethod · 0.80
getMenuSkinMethod · 0.80
getClientSkinMethod · 0.80
getItemSkinMethod · 0.80
getValueSkinMethod · 0.80
getSelItemSkinMethod · 0.80
getBorderWidthsMethod · 0.80
getScreenMethod · 0.80
shrinkByMethod · 0.80
heightMethod · 0.80
replaceIntParamMethod · 0.80

Tested by

no test coverage detected