//----------------------------------------------------------------------------// Rectf LayoutContainer::getClientChildContentArea_impl(bool skipAllPixelAlignment) const { if (!d_parent) { return skipAllPixelAlignment ? Window::getClientChildContentArea().getFresh(true) : Window::getClientChildContentArea().get(); } else { return skipAllPixelAlignment ? Rectf(getUnclippedOuterRect().getFresh(true).getPosition(), d_parent->getUnclippedInnerRect().getFresh(true).getSize()) : Rectf(getUnclippedOuterRect().get().getPosition(), d_parent->getUnclippedInnerRect().get().getSize()); } }
bool WebWindow::updateTexture() { if (d_webViewTexture == NULL) { CEGUI::Rect rect = getUnclippedOuterRect(); CEGUI::Direct3D9Renderer* d3d_renderer = static_cast<CEGUI::Direct3D9Renderer*>(CEGUI::System::getSingleton().getRenderer()); HRESULT hr = d3d_renderer->getDevice()->CreateTexture( UINT(rect.d_right - rect.d_left), UINT(rect.d_bottom - rect.d_top), 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &d_webViewTexture, NULL); if (FAILED(hr)) return false; d_webView->setDirty(true); } if (d_webView->isDirty()) { D3DLOCKED_RECT rect; d_webViewTexture->LockRect(0, &rect, NULL, D3DLOCK_DISCARD); d_webView->paint(rect.pBits, rect.Pitch); d_webViewTexture->UnlockRect(0); } return true; }
//----------------------------------------------------------------------------// Rect ScrolledContainer::getUnclippedInnerRect_impl(void) const { if (!d_parent) return Window::getUnclippedInnerRect_impl(); else return Rect(getUnclippedOuterRect().getPosition(), d_parent->getUnclippedInnerRect().getSize()); }
//----------------------------------------------------------------------------// Rect LayoutContainer::getClientChildWindowContentArea_impl() const { if (!d_parent) return Window::getClientChildWindowContentArea_impl(); else return Rect(getUnclippedOuterRect().getPosition(), d_parent->getUnclippedInnerRect().getSize()); }
void WebWindow::onSized(CEGUI::WindowEventArgs& e) { CEGUI::Window::onSized(e); SAFE_RELEASE(d_webViewTexture); CEGUI::Rect rect = getUnclippedOuterRect(); d_webView->resize(int(rect.d_right - rect.d_left), int(rect.d_bottom - rect.d_top)); }
void WebWindow::onMouseMove(CEGUI::MouseEventArgs& e) { CEGUI::Rect rect = getUnclippedOuterRect(); int x = int(e.position.d_x - rect.d_left); int y = int(e.position.d_y - rect.d_top); e.handled = d_webView->mouseEvent(WKE_MSG_MOUSEMOVE, x, y, getInputFlags()); CEGUI::Window::onMouseMove(e); }
void WebWindow::onMouseWheel(CEGUI::MouseEventArgs& e) { CEGUI::Rect rect = getUnclippedOuterRect(); int x = int(e.position.d_x - rect.d_left); int y = int(e.position.d_y - rect.d_top); e.handled = d_webView->mouseWheel(x, y, int(e.wheelChange * WHEEL_DELTA), getInputFlags()); CEGUI::Window::onMouseWheel(e); }
void WebWindow::onMouseButtonUp(CEGUI::MouseEventArgs& e) { CEGUI::Rect rect = getUnclippedOuterRect(); int x = int(e.position.d_x - rect.d_left); int y = int(e.position.d_y - rect.d_top); if (e.button == CEGUI::LeftButton) e.handled = d_webView->mouseEvent(WKE_MSG_LBUTTONUP, x, y, getInputFlags()); else if (e.button == CEGUI::RightButton) e.handled = d_webView->mouseEvent(WKE_MSG_RBUTTONUP, x, y, getInputFlags()); CEGUI::Window::onMouseButtonUp(e); }
//------------------------------------------------------------------------------// void InventoryItem::onMoved(ElementEventArgs& e) { invalidate(); DragContainer::onMoved(e); InventoryReceiver* receiver = dynamic_cast<InventoryReceiver*>(d_dropTarget); if (receiver) { const Sizef square_size(receiver->squarePixelSize()); Rectf area(getUnclippedOuterRect().get()); area.offset(0.5f * glm::vec2(square_size.d_width, square_size.d_height)); const int x = receiver->gridXLocationFromPixelPosition(area.left()); const int y = receiver->gridYLocationFromPixelPosition(area.top()); d_validDropTarget = receiver->itemWillFitAtLocation(*this, x, y); return; } d_validDropTarget = false; }
void Tooltip::positionSelf(void) { MouseCursor& cursor = MouseCursor::getSingleton(); Rect screen(Vector2(0, 0), System::getSingleton().getRenderer()->getDisplaySize()); Rect tipRect(getUnclippedOuterRect()); const Image* mouseImage = cursor.getImage(); Point mousePos(cursor.getPosition()); Size mouseSz(0,0); if (mouseImage) { mouseSz = mouseImage->getSize(); } Point tmpPos(mousePos.d_x + mouseSz.d_width, mousePos.d_y + mouseSz.d_height); tipRect.setPosition(tmpPos); // if tooltip would be off the right of the screen, // reposition to the other side of the mouse cursor. if (screen.d_right < tipRect.d_right) { tmpPos.d_x = mousePos.d_x - tipRect.getWidth() - 5; } // if tooltip would be off the bottom of the screen, // reposition to the other side of the mouse cursor. if (screen.d_bottom < tipRect.d_bottom) { tmpPos.d_y = mousePos.d_y - tipRect.getHeight() - 5; } // set final position of tooltip window. setPosition( UVector2(cegui_absdim(tmpPos.d_x), cegui_absdim(tmpPos.d_y))); }
//----------------------------------------------------------------------------// Rectf Element::getUnclippedInnerRect_impl(bool skipAllPixelAlignment) const { return skipAllPixelAlignment ? getUnclippedOuterRect().getFresh(true) : getUnclippedOuterRect().get(); }
//----------------------------------------------------------------------------// const Element::CachedRectf& Element::getNonClientChildContentArea() const { return getUnclippedOuterRect(); }
//------------------------------------------------------------------------------// Rectf InventoryItem::gridBasePixelRect() const { return getUnclippedOuterRect().get(); }