- {
- m_ContentsBox->SetItemBold(roots[1], TRUE);
- m_ContentsBox->SetItemImage(roots[1], IMG_Book);
- m_ContentsBox->SetItemSelectedImage(roots[1], IMG_Book);
- imaged[1] = TRUE;
+ {
+ // special case, only one book, make it tree's root:
+ if (booksCnt == 1)
+ {
+ roots[0] = roots[1] = m_ContentsBox->AddRoot(
+ it->m_Name, IMG_Book, -1,
+ new wxHtmlHelpTreeItemData(i));
+ imaged[0] = imaged[1] = TRUE;
+ m_ContentsBox->SetItemBold(roots[1], TRUE);
+ }
+ // multiple books:
+ else
+ {
+ if (m_hfStyle & wxHF_MERGE_BOOKS)
+ // VS: we don't want book nodes, books' content should
+ // appear under tree's root. This line will create "fake"
+ // record about book node so that the rest of this look
+ // will believe there really _is_ book node and will
+ // behave correctly.
+ roots[1] = roots[0];
+ else
+ {
+ roots[1] = m_ContentsBox->AppendItem(roots[0],
+ it->m_Name, IMG_Book, -1,
+ new wxHtmlHelpTreeItemData(i));
+ m_ContentsBox->SetItemBold(roots[1], TRUE);
+ }
+ imaged[1] = TRUE;
+ }
+ }
+ // ...and their contents:
+ else
+ {
+ roots[it->m_Level + 1] = m_ContentsBox->AppendItem(
+ roots[it->m_Level], it->m_Name, IMG_Page,
+ -1, new wxHtmlHelpTreeItemData(i));
+ imaged[it->m_Level + 1] = FALSE;