]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/helpfrm.cpp
use wxHashMap, not wxHashTable in wxXPMDecoder
[wxWidgets.git] / src / html / helpfrm.cpp
index 78ca55abb0251f3c9aeb855391e015032e8d9836..a71bab25219924b39820dea9aba4c0d08e33979d 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "wx/html/helpfrm.h"
 #include "wx/html/helpctrl.h"
+#include "wx/textctrl.h"
 #include "wx/notebook.h"
 #include "wx/imaglist.h"
 #include "wx/treectrl.h"
 // Bitmaps:
 
 #ifndef __WXMSW__
-#include "bitmaps/wpanel.xpm"
-#include "bitmaps/wback.xpm"
-#include "bitmaps/wforward.xpm"
-#include "bitmaps/wbook.xpm"
-#include "bitmaps/woptions.xpm"
-#include "bitmaps/wfolder.xpm"
-#include "bitmaps/wpage.xpm"
-#include "bitmaps/whelp.xpm"
-#include "bitmaps/whlproot.xpm"
-#include "bitmaps/wbkadd.xpm"
-#include "bitmaps/wbkdel.xpm"
-#include "bitmaps/wup.xpm"
-#include "bitmaps/wupnode.xpm"
-#include "bitmaps/wdown.xpm"
-#include "bitmaps/wopen.xpm"
-#include "bitmaps/wprint.xpm"
-#endif
-
+    // XPM hack: make the arrays const
+    #define static static const
+
+    #include "bitmaps/wpanel.xpm"
+    #include "bitmaps/wback.xpm"
+    #include "bitmaps/wforward.xpm"
+    #include "bitmaps/wbook.xpm"
+    #include "bitmaps/woptions.xpm"
+    #include "bitmaps/wfolder.xpm"
+    #include "bitmaps/wpage.xpm"
+    #include "bitmaps/whelp.xpm"
+    #include "bitmaps/whlproot.xpm"
+    #include "bitmaps/wbkadd.xpm"
+    #include "bitmaps/wbkdel.xpm"
+    #include "bitmaps/wup.xpm"
+    #include "bitmaps/wupnode.xpm"
+    #include "bitmaps/wdown.xpm"
+    #include "bitmaps/wopen.xpm"
+    #include "bitmaps/wprint.xpm"
+
+    #undef static
+#endif // __WXMSW__
 
 // what is considered "small index"?
 #define INDEX_IS_SMALL 100
@@ -303,6 +308,11 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
     if (style & wxHF_CONTENTS)
     {
         wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
+        
+        long treeStyle = wxSUNKEN_BORDER | wxTR_HAS_BUTTONS;
+        #ifndef __WXMSW__ // FIXME - temporary, till MSW supports wxTR_HIDE_ROOT
+        treeStyle |= wxTR_HIDE_ROOT;
+        #endif
 
         if (style & wxHF_BOOKMARKS)
         {
@@ -347,11 +357,7 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
             wxLayoutConstraints *b4 = new wxLayoutConstraints;
             m_ContentsBox = new wxTreeCtrl(dummy, wxID_HTML_TREECTRL,
                                            wxDefaultPosition, wxDefaultSize,
-#ifdef __WXMAC__
-       wxSUNKEN_BORDER|wxTR_MAC_BUTTONS|wxTR_NO_LINES|wxTR_ROW_LINES );
-#else
-       wxSUNKEN_BORDER|wxTR_HAS_BUTTONS );
-#endif
+                                           treeStyle);
             m_ContentsBox->AssignImageList(ContentsImageList);
 
             b4->top.Below (m_Bookmarks, 10);
@@ -370,7 +376,7 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
         {
             m_ContentsBox = new wxTreeCtrl(m_NavigPan, wxID_HTML_TREECTRL,
                                            wxDefaultPosition, wxDefaultSize,
-                                           wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
+                                           treeStyle);
             m_ContentsBox->AssignImageList(ContentsImageList);
             m_NavigPan->AddPage(m_ContentsBox, _("Contents"));
         }
@@ -770,9 +776,13 @@ void wxHtmlHelpFrame::CreateContents()
     //     set its icon accordingly
     bool imaged[MAX_ROOTS];
     m_ContentsBox->DeleteAllItems();
+    
+    // FIXME - will go away when wxMSW's wxTreeCtrl supports wxTR_HIDE_ROOT!
+    bool hasSuperRoot = (booksCnt > 1) || 
+                        (m_ContentsBox->GetWindowStyle() & wxTR_HIDE_ROOT);
 
     // Don't show (Help) root if there's only one boook
-    if (booksCnt > 1)
+    if (hasSuperRoot)
     {
         roots[0] = m_ContentsBox->AddRoot(_("(Help)"));
         m_ContentsBox->SetItemImage(roots[0], IMG_RootFolder);
@@ -786,7 +796,7 @@ void wxHtmlHelpFrame::CreateContents()
         if (it->m_Level == 0)
         {
             // special case, only one book, make it tree's root:
-            if (booksCnt == 1)
+            if (!hasSuperRoot)
             {
                 roots[0] = roots[1] = m_ContentsBox->AddRoot(
                                          it->m_Name, IMG_Book, -1,
@@ -1049,7 +1059,8 @@ class wxHtmlHelpFrameOptionsDialog : public wxDialog
 
                 topsizer->Add(new wxStaticText(this, -1, _("Preview:")),
                                 0, wxLEFT | wxTOP, 10);
-                topsizer->Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)),
+                topsizer->Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150),
+                                                         wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER),
                                 1, wxEXPAND | wxLEFT|wxTOP|wxRIGHT, 10);
 
                 sizer = new wxBoxSizer(wxHORIZONTAL);