bool RFile::overlaps(const vec2& pos) const { vec2 abs_pos = getAbsolutePos(); float halfsize_x = size * 0.5f; vec2 halfsize ( halfsize_x, halfsize_x * graphic_ratio ); Bounds2D file_bounds(abs_pos - halfsize, abs_pos + halfsize); return file_bounds.contains(pos); }
void RFile::calcScreenPos(GLint* viewport, GLdouble* modelview, GLdouble* projection) { static GLdouble screen_x, screen_y, screen_z; vec2 text_pos = getAbsolutePos(); text_pos.x += 5.5f; if(selected) text_pos.y -= 2.0f; else text_pos.y -= 1.0f; gluProject( text_pos.x, text_pos.y, 0.0f, modelview, projection, viewport, &screen_x, &screen_y, &screen_z); screen_y = (float)viewport[3] - screen_y; screenpos.x = screen_x; screenpos.y = screen_y; }
void vmsUiLinkWindow::Draw(CDC *pdc) { CFont *pfntOld = pdc->SelectObject (m_pfntLnk ? m_pfntLnk : vmsUiFonts::Tahoma_11underline ()); CRect rc; getAbsolutePos (&rc); if (m_tstrUrl.empty () && m_uDrawTextFormat == 0) { DrawState (pdc->GetSafeHdc (), NULL, NULL, (LPARAM)m_tstrText.c_str (), 0, rc.left, rc.top, rc.Width (), rc.Height (), DST_TEXT | DSS_DISABLED); } else { pdc->SetTextColor (_SkinMgr.getLinkTextColor ()); pdc->DrawText (m_tstrText.c_str (), &rc, m_uDrawTextFormat); if (m_uDrawTextFormat) { pdc->DrawText (m_tstrText.c_str (), &rc, m_uDrawTextFormat); } } pdc->SelectObject (pfntOld); pdc->SetTextColor (RGB (0,0,0)); }