void MIViewBrowser::OnOpenSeriesClick( wxCommandEvent& event ) { wxTreeItemId id = wxTreeItemId(treeFileList->GetSelection()); /* this is a patient item */ if ( rootID == treeFileList->GetItemParent(id) ) { wxMessageBox("Select a file or series to open","MIView Information"); } /* this is a study item */ else if ( rootID == treeFileList->GetItemParent(treeFileList->GetItemParent(id)) ) { wxMessageBox("Select a file or series to open","MIView Information"); } /* this is a series item */ else if ( rootID == treeFileList->GetItemParent(treeFileList->GetItemParent(treeFileList->GetItemParent(id))) ) { //wxMessageBox("Select a file to open","MIView Information"); /* get list of children */ wxArrayString filelist = GetChildList(id); frame->OpenFiles(filelist); } /* otherwise it must be a file item */ else { /* open the file */ //wxMessageBox("You selected a file item","MIView Information"); wxArrayString filelist = GetChildList(treeFileList->GetItemParent(id)); frame->OpenFiles(filelist); } }
NS_IMETHODIMP nsSVGDisplayContainerFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame, nsFrameList& aFrameList) { // memorize first old frame after insertion point // XXXbz once again, this would work a lot better if the nsIFrame // methods returned framelist iterators.... nsIFrame* firstOldFrame = aPrevFrame ? aPrevFrame->GetNextSibling() : GetChildList(aListID).FirstChild(); nsIFrame* firstNewFrame = aFrameList.FirstChild(); // Insert the new frames nsSVGContainerFrame::InsertFrames(aListID, aPrevFrame, aFrameList); // Call InitialUpdate on the new frames ONLY if our nsSVGOuterSVGFrame has had // its initial reflow (our NS_FRAME_FIRST_REFLOW bit is clear) - bug 399863. if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) { for (nsIFrame* kid = firstNewFrame; kid != firstOldFrame; kid = kid->GetNextSibling()) { nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); if (SVGFrame) { SVGFrame->InitialUpdate(); } } } return NS_OK; }
int CWindowManager::CoreRequestWidth() { const TChildList &childs = GetChildList(); int ret = GetMinWidth(); for (TChildList::const_iterator it=childs.begin(); it!=childs.end(); it++) { if ((*it)->Enabled()) ret = std::max(ret, (*it)->RequestWidth()); } return ret; }
// -------------------------------------------------------- // ---------- DisplaySeriesHTML --------------------------- // -------------------------------------------------------- void MIViewBrowser::DisplaySeriesHTML(wxTreeItemId id) { wxString str; int i; int childCount = (int)treeFileList->GetChildrenCount(id); wxArrayString kids = GetChildList(id); htmlInfo->SetPage(""); str = "Series <b>" + treeFileList->GetItemText(id) + "</b> has the following files:<br>"; for (i=0;i<kids.Count();i++) str += kids[i] + "<br>"; htmlInfo->AppendToPage(str); }
int CBox::GetTotalWidgetW(CWidget *w) { const SBoxEntry &entry = m_BoxEntries[w]; int ret = 0; if (m_eDirection == HORIZONTAL) { ret += GetWidgetW(w) + (2 * entry.hpadding); if (w != GetChildList().back()) ret += m_iSpacing; } else ret = w->RequestWidth() + (2 * entry.hpadding); return ret; }
int CBox::GetTotalWidgetH(CWidget *w) { const SBoxEntry &entry = m_BoxEntries[w]; int ret = 0; if (m_eDirection == VERTICAL) { ret = (GetWidgetH(w) + (2 * entry.vpadding)); if (w != GetChildList().back()) ret += m_iSpacing; } else ret = w->RequestHeight() + (2 * entry.vpadding); return ret; }
CBox::TChildList::size_type CBox::ExpandedWidgets() { const TChildList &childs = GetChildList(); TChildList::size_type ret = 0; for (TChildList::const_iterator it=childs.begin(); it!=childs.end(); it++) { if (!IsValidWidget(*it)) continue; if (!m_bEqual && !m_BoxEntries[*it].expand) continue; ret++; } return ret; }
int CBox::RequestedWidgetsH() { const TChildList &childs = GetChildList(); int ret = 0; for (TChildList::const_iterator it=childs.begin(); it!=childs.end(); it++) { if (!IsValidWidget(*it)) continue; if (m_eDirection == VERTICAL) ret += GetTotalWidgetH(*it); else ret = std::max(ret, GetTotalWidgetH(*it)); } return ret; }
PG_Widget* PG_WidgetList::GetWidgetFromPos(Sint32 y) { Uint32 dy = 0; Uint32 min_dy = 100000000; PG_Widget* result = NULL; PG_Widget* list = GetChildList()->first(); for( ; list != NULL; list = list->next()) { dy = abs(0- (list->my_ypos - my_ypos)); if(dy < min_dy) { min_dy = dy; result = list; } } return result; }
int CBox::GetWidgetH(CWidget *w) { int ret = 0; if (m_bEqual) { // UNDONE: Cache? const TChildList &childs = GetChildList(); for (TChildList::const_iterator it=childs.begin(); it!=childs.end(); it++) { if (!IsValidWidget(*it)) continue; ret = std::max(ret, (*it)->RequestHeight()); } } else ret = w->RequestHeight(); return ret; }
void CWindowManager::CoreDrawChilds() { const TChildList &childs = GetChildList(); for (TChildList::const_iterator it=childs.begin(); it!=childs.end(); it++) { if (!(*it)->Enabled()) continue; if (std::find(m_ActiveWidgets.begin(), m_ActiveWidgets.end(), *it) != m_ActiveWidgets.end()) continue; // We draw these as last, so it looks like they are on top DrawChild(*it); } for (TChildList::const_iterator it=m_ActiveWidgets.begin(); it!=m_ActiveWidgets.end(); it++) { if (!(*it)->Enabled()) continue; DrawChild(*it); } }
void CBox::CoreDrawLayout() { if (Empty()) return; const TChildList &childs = GetChildList(); const TChildList::size_type size = ExpandedWidgets(); const int diffw = FieldWidth() - RequestedWidgetsW(); const int diffh = FieldHeight() - RequestedWidgetsH(); const int extraw = (size) ? diffw / size : 0; const int extrah = (size) ? diffh / size : 0; int remainingw = (size) ? diffw % size : 0; int remainingh = (size) ? diffh % size : 0; int begx = FieldX(), begy = FieldY(); // Coords for widgets that were packed at start int endx = (FieldX()+FieldWidth())-1, endy = (FieldY()+FieldHeight())-1; // Coords for widgets that were packed at end for (TChildList::const_iterator it=childs.begin(); it!=childs.end(); it++) { if (!IsValidWidget(*it)) continue; const SBoxEntry &entry = m_BoxEntries[*it]; int basex = entry.hpadding, basey = entry.vpadding; int widgetw = 0, widgeth = 0; int basew = extraw, baseh = extrah; int spacing = 0; if (*it != childs.back()) spacing += m_iSpacing; if (remainingw) { basew++; remainingw--; } if (remainingh) { baseh++; remainingh--; } if (m_eDirection == HORIZONTAL) { spacing += entry.hpadding; widgetw += GetWidgetW(*it); widgeth += (FieldHeight() - (basey*entry.vpadding)); if (entry.expand) { if (entry.fill) widgetw += basew; else { spacing += (basew/2); basex += (basew/2); } } } else { spacing += entry.vpadding; widgetw += (FieldWidth() - (basex+entry.hpadding)); widgeth += GetWidgetH(*it); if (entry.expand) { if (entry.fill) widgeth += baseh; else { spacing += (baseh/2); basey += (baseh/2); } } } assert(begx+basex >= FieldX()); assert(begy+basey >= FieldY()); assert(widgetw>0 && widgeth>0); assert(widgetw >= (*it)->RequestWidth()); assert(widgeth >= (*it)->RequestHeight()); if (entry.start) { SetChildSize(*it, begx+basex, begy+basey, widgetw, widgeth); if (m_eDirection == HORIZONTAL) begx += (basex + spacing + widgetw); else begy += (basey + spacing + widgeth); } else { SetChildSize(*it, endx-basex-(widgetw-1), endy-basey-(widgeth-1), widgetw, widgeth); if (m_eDirection == HORIZONTAL) endx -= (basex + spacing + widgetw); else endy -= (basey + spacing + widgeth); } } }