void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder , bool preserveLineBreaks) const { if (!isSelectionValid()) return; writeToStream(decoder,selTopLeft,selBottomRight,preserveLineBreaks); }
void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder , bool preserveLineBreaks) { // do nothing if selection is invalid if ( !isSelectionValid() ) return; int top = sel_TL / columns; int left = sel_TL % columns; int bottom = sel_BR / columns; int right = sel_BR % columns; Q_ASSERT( top >= 0 && left >= 0 && bottom >= 0 && right >= 0 ); //kDebug() << "sel_TL = " << sel_TL; //kDebug() << "columns = " << columns; for (int y=top;y<=bottom;y++) { int start = 0; if ( y == top || columnmode ) start = left; int count = -1; if ( y == bottom || columnmode ) count = right - start + 1; const bool appendNewLine = ( y != bottom ); copyLineToStream( y, start, count, decoder, appendNewLine, preserveLineBreaks ); } }
void InteractiveButton::Render() { if (!isSelectionValid()) return; JRenderer *renderer = JRenderer::GetInstance(); WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); const string detailedInfoString = _(getText()); float stringWidth = mainFont->GetStringWidth(detailedInfoString.c_str()); float pspIconsSize = 0.5; float mainFontHeight = mainFont->GetHeight(); float boxStartX = getX() - 5; mXOffset = 0; mYOffset = 0; #ifndef TOUCH_ENABLED renderer->FillRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 9, 5, ARGB(0, 0, 0, 0)); #else renderer->FillRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 5, 5, ARGB(255, 192, 172, 119)); renderer->DrawRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 5, 5, ARGB(255, 255, 255, 255)); mYOffset += 2; #endif float buttonXOffset = getX() - mXOffset; float buttonYOffset = getY() + mYOffset; if (buttonImage != NULL) { renderer->RenderQuad(buttonImage.get(), buttonXOffset - buttonImage.get()->mWidth/2, buttonYOffset + mainFontHeight/2, 0, pspIconsSize, pspIconsSize); } mainFont->SetColor(ARGB(255, 0, 0, 0)); mainFont->DrawString(detailedInfoString, buttonXOffset, buttonYOffset); }
bool InteractiveButton::ButtonPressed() { checkUserClick(); if (isSelectionValid()) { mEngine->ReadButton(); mEngine->LeftClickedProcessed(); mEngine->HoldKey_NoRepeat( mActionKey ); setIsSelectionValid(false); return true; } return false; }
MenuItem* selected() { if (!isSelectionValid()) return 0; return &items[selection_]; }