// Returns the rectangle for this object (id = 0) or a child element (id > 0). wxAccStatus CProjectListCtrlAccessible::GetLocation(wxRect& rect, int elementId) { CProjectListCtrl* pCtrl = wxDynamicCast(GetWindow(), CProjectListCtrl); if (pCtrl && (0 == elementId)) { // List control rect.SetPosition(pCtrl->GetScreenPosition()); rect.SetWidth(pCtrl->GetSize().GetWidth()); rect.SetHeight(pCtrl->GetSize().GetHeight()); return wxACC_OK; } else if (pCtrl && (0 != elementId)) { // List item wxSize cCtrlSize = pCtrl->GetClientSize(); // Set the initial control postition to the absolute coords of the upper // left hand position of the control rect.SetPosition(pCtrl->GetScreenPosition()); rect.width = cCtrlSize.GetWidth() - 1; rect.height = pCtrl->GetItemHeight(elementId - 1) - 1; // Items can have different heights int firstVisibleItem = (int)pCtrl->GetFirstVisibleLine(); int yOffset = 0; for (int i=firstVisibleItem; i<(elementId - 1); ++i) { yOffset += pCtrl->GetItemHeight((size_t)i); } rect.SetTop(rect.GetTop() + yOffset); rect.height -= 1; return wxACC_OK; } // Let the framework handle the other cases. return wxACC_FALSE; }
void wxGD::Draw::GlossyGradient( wxDC &dc, wxRect &rect, wxColour &topStart, wxColour &bottomStart, wxColour &bottomEnd, wxColour &colour, bool hover ) { wxColour topEnd = colour; int r = colour.Red() + 45; if( r > 255 ) r = 225; int g = colour.Green() + 45; if( g > 255 ) g = 225; int b = colour.Blue() + 45; if( b > 255) b = 225; topStart = wxColour( (unsigned char)r, (unsigned char)g, (unsigned char)b ); r = colour.Red() - 75; if( r < 0 ) r = 15; g = colour.Green() - 75; if( g < 0 ) g = 15; b = colour.Blue() - 75; if( b < 0 ) b = 15; bottomStart = wxColour( (unsigned char)r, (unsigned char)g, (unsigned char)b ); r = colour.Red() - 15; if( r < 0 ) r = 30; g = colour.Green() - 15; if( g < 0 ) g = 30; b = colour.Blue() - 15; if( b < 0 ) b = 30; bottomEnd = wxColour( (unsigned char)r, (unsigned char)g, (unsigned char)b ); rect.SetHeight( rect.GetHeight() / 2 ); dc.GradientFillLinear( rect, topStart, topEnd, wxSOUTH ); rect.Offset( 0, rect.GetHeight() ); if( hover ) dc.GradientFillLinear( rect, bottomStart, topStart, wxSOUTH ); else dc.GradientFillLinear( rect, bottomStart, topEnd, wxSOUTH ); }
void CView::Arrange(wxWindow* child, wxRect& clientRect, bool top) { if (child && child->IsShown()) { int const childHeight = child->GetSize().GetHeight(); wxRect childRect = clientRect; childRect.SetHeight(childHeight); if (!top) { childRect.SetTop(clientRect.GetBottom() - childHeight + 1); } else { clientRect.SetTop(childHeight); } clientRect.SetHeight(std::max(0, (clientRect.GetHeight() - childHeight))); child->SetSize(childRect); #ifdef __WXMSW__ child->Refresh(); #endif } }
void wxSFShapeBase::_GetCompleteBoundingBox(wxRect &rct, int mask) { //wxASSERT(m_pParentManager); if(!m_pParentManager)return; if( m_lstProcessed.IndexOf(this) != wxNOT_FOUND )return; else m_lstProcessed.Append(this); ShapeList lstChildren; //SerializableList lstConnections; // firts, get bounding box of the current shape if(mask & bbSELF) { if(rct.IsEmpty())rct = this->GetBoundingBox().Inflate( abs(m_nHBorder), abs(m_nVBorder) ); else rct.Union(this->GetBoundingBox().Inflate( abs(m_nHBorder), abs(m_nVBorder)) ); // add also shadow offset if neccessary if( (mask & bbSHADOW) && (m_nStyle & sfsSHOW_SHADOW) && GetParentCanvas() ) { wxRealPoint nOffset = GetParentCanvas()->GetShadowOffset(); if( nOffset.x < 0 ) { rct.SetX(rct.GetX() + (int)nOffset.x); rct.SetWidth(rct.GetWidth() - (int)nOffset.x); } else rct.SetWidth(rct.GetWidth() + (int)nOffset.x); if( nOffset.y < 0 ) { rct.SetY(rct.GetY() + (int)nOffset.y); rct.SetHeight(rct.GetHeight() - (int)nOffset.y); } else rct.SetHeight(rct.GetHeight() + (int)nOffset.y);; } } else mask |= bbSELF; // get list of all connection lines assigned to the shape and find their child shapes if(mask & bbCONNECTIONS) { wxSFShapeBase *pLine; ShapeList lstLines; GetAssignedConnections( CLASSINFO(wxSFLineShape), lineBOTH, lstLines ); ShapeList::compatibility_iterator node = lstLines.GetFirst(); while(node) { pLine = node->GetData(); //rct.Union(pLine->GetBoundingBox()); lstChildren.Append(pLine); // get children of the connections pLine->GetChildShapes(sfANY, lstChildren); node = node->GetNext(); } } // get children of this shape if(mask & bbCHILDREN) { this->GetChildShapes(sfANY, lstChildren, sfNORECURSIVE); // now, call this function for all children recursively... ShapeList::compatibility_iterator node = lstChildren.GetFirst(); while(node) { node->GetData()->_GetCompleteBoundingBox(rct, mask); node = node->GetNext(); } } }