void CRBookmarkMenu::showContextMenu() { CRBookmarkMenuItem *item = static_cast<CRBookmarkMenuItem *>(_items[_selectedItem]); CRMenuSkinRef skin = getSkin(); CRRectSkinRef separatorSkin = skin->getSeparatorSkin(); int separatorHeight = 0; if ( !separatorSkin.isNull() ) separatorHeight = separatorSkin->getMinSize().y; lvRect clientRect; getClientRect(clientRect); lvPoint itemSize = getMaxItemSize(); _contextMenu[2].type = item->getBookmark() ? ITEM_ACTIVE : ITEM_INACTIVE; int y = clientRect.top + (itemSize.y + separatorHeight) * (_selectedItem - _topItem) + ((itemSize.y + separatorHeight)/4); if (_contextMenu[0].text == NULL) { _contextMenu[0].text = (char *)_("Set bookmark"); _contextMenu[1].text = (char *)_("Go to bookmark"); _contextMenu[2].text = (char *)_("Delete bookmark"); } OpenMenu(_contextMenu, _goToMode ? DCMD_BOOKMARK_GO_N : DCMD_BOOKMARK_SAVE_N, ScreenWidth()/4, y, handle_contextMenu); }
void CRCitesMenu::showContextMenu() { CRBookmarkMenuItem *item = static_cast<CRBookmarkMenuItem *>(_items[_selectedItem]); if (item->getBookmark() == NULL) return; CRMenuSkinRef skin = getSkin(); CRRectSkinRef separatorSkin = skin->getSeparatorSkin(); int separatorHeight = 0; if ( !separatorSkin.isNull() ) separatorHeight = separatorSkin->getMinSize().y; lvRect clientRect; getClientRect(clientRect); lvPoint itemSize = getMaxItemSize(); int y = clientRect.top + (itemSize.y + separatorHeight) * (_selectedItem - _topItem) + ((itemSize.y + separatorHeight)/4); if (_cites_contextMenu[0].text == NULL) { _cites_contextMenu[0].text = (char *)_("Go to citation"); _cites_contextMenu[1].text = (char *)_("Delete citation"); } OpenMenu(_cites_contextMenu, DCMD_BOOKMARK_GO_N, ScreenWidth()/4, y, handle_citesContextMenu); }
void CRRecentBooksMenu::showContextMenu() { CRRecentBookMenuItem *item = static_cast<CRRecentBookMenuItem *>(getItems()[_selectedItem]); CRMenuSkinRef skin = getSkin(); CRRectSkinRef separatorSkin = skin->getSeparatorSkin(); int separatorHeight = 0; if ( !separatorSkin.isNull() ) separatorHeight = separatorSkin->getMinSize().y; lvRect clientRect; getClientRect(clientRect); lvPoint itemSize = getMaxItemSize(); int y = clientRect.top + (itemSize.y + separatorHeight) * (_selectedItem - _topItem) + ((itemSize.y + separatorHeight)/4); if (_contextMenu[0].text == NULL) { _contextMenu[0].text = (char *)_("Open book"); _contextMenu[1].text = (char *)_("Delete record"); } OpenMenu(_contextMenu, MCMD_OPEN_RECENT_BOOK, ScreenWidth()/4, y, handle_contextMenu); }
void CRT9Keyboard::draw() { BackgroundFitWindow::draw(); CRMenuSkinRef skin = _wm->getSkin()->getMenuSkin( L"#t9input" ); CRRectSkinRef shortcutSkin = skin->getItemShortcutSkin(); CRRectSkinRef itemSkin = skin->getItemSkin(); CRRectSkinRef clientSkin = skin->getClientSkin(); LVDrawBuf * buf = _wm->getScreen()->getCanvas().get(); skin->draw( *buf, _rect ); lString16 prompt = Utf8ToUnicode(selector_.getPrefix()); prompt << L"_"; skin->draw( *buf, _rect ); //buf->FillRect( _rect, 0xAAAAAA ); lvRect rect = _rect; lvRect borders = skin->getBorderWidths(); rect.shrinkBy( borders ); lvRect keyRect = rect; // lvPoint minSizeN = shortcutSkin->getMinSize(); for ( int i=0; i<encoding_.length(); i++ ) { lString16 txtN = lString16::itoa(i); lString16 txt = encoding_[i]; if ( txt.empty() ) continue; // label 0..9 lvPoint sz = shortcutSkin->measureTextItem( txtN ); keyRect.right = keyRect.left + sz.x; //borders.left + borders.right; shortcutSkin->draw( *buf, keyRect ); shortcutSkin->drawText( *buf, keyRect, txtN ); keyRect.left = keyRect.right; // chars (abc) sz = itemSkin->measureTextItem( txt ); keyRect.right = keyRect.left + sz.x; //borders.left + borders.right; itemSkin->draw( *buf, keyRect ); itemSkin->drawText( *buf, keyRect, txt ); keyRect.left = keyRect.right; //borders.left; } keyRect.right = rect.right; if ( !clientSkin.isNull() && !keyRect.isEmpty() ) { clientSkin->draw( *buf, keyRect ); clientSkin->drawText( *buf, keyRect, prompt ); } }