X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2bd5bbc948bd22c5a0edde9e35e4995c919f593b..7b9da2077d0975db6c965a85c91d5aca671ab5e3:/src/html/helpfrm.cpp?ds=sidebyside diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index 465670a126..68fbdd7f4c 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -13,7 +13,8 @@ #pragma implementation #endif -// For compilers that support precompilation, includes "wx.h". +// For compilers that support precompilation, includes "wx.h" + #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -23,9 +24,8 @@ #include "wx/defs.h" #if wxUSE_HTML - #ifndef WXPRECOMP -#include +#include "wx/wx.h" #endif #include "wx/html/helpfrm.h" @@ -48,6 +48,8 @@ #include "bitmaps/book.xpm" #include "bitmaps/folder.xpm" #include "bitmaps/page.xpm" +#include "bitmaps/help.xpm" +#include "bitmaps/helproot.xpm" #endif #include "wx/stream.h" @@ -96,10 +98,11 @@ void wxHtmlHelpFrame::Init(wxHtmlHelpData* data) m_DataCreated = TRUE; } - m_ContentsImageList = new wxImageList(12, 12); + m_ContentsImageList = new wxImageList(16, 16); m_ContentsImageList -> Add(wxICON(book)); m_ContentsImageList -> Add(wxICON(folder)); m_ContentsImageList -> Add(wxICON(page)); + m_ContentsImageList -> Add(wxICON(helproot)); m_ContentsBox = NULL; m_IndexBox = NULL; @@ -137,7 +140,19 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti if (m_Config) ReadCustomization(m_Config, m_ConfigRoot); - wxFrame::Create(parent, id, "", wxPoint(m_Cfg.x, m_Cfg.y), wxSize(m_Cfg.w, m_Cfg.h)); + wxFrame::Create(parent, id, _("Help"), wxPoint(m_Cfg.x, m_Cfg.y), wxSize(m_Cfg.w, m_Cfg.h)); + +#if defined(__WXMSW__) || (__WXPM__) + wxIcon frameIcon("wxhelp", wxBITMAP_TYPE_ICO_RESOURCE, 32, 32); +#else + wxIcon frameIcon(help_xpm); +#endif + if (frameIcon.Ok()) + SetIcon(frameIcon); + + GetPosition(&m_Cfg.x, &m_Cfg.y); + + SetIcon(wxICON(help)); int notebook_page = 0; @@ -150,13 +165,13 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti toolBar -> SetMargins(2, 2); wxBitmap* toolBarBitmaps[3]; -#ifdef __WXMSW__ +#if defined(__WXMSW__) || (__WXPM__) toolBarBitmaps[0] = new wxBitmap("panel"); toolBarBitmaps[1] = new wxBitmap("back"); toolBarBitmaps[2] = new wxBitmap("forward"); int width = 24; #else -toolBarBitmaps[0] = new wxBitmap(panel_xpm); + toolBarBitmaps[0] = new wxBitmap(panel_xpm); toolBarBitmaps[1] = new wxBitmap(back_xpm); toolBarBitmaps[2] = new wxBitmap(forward_xpm); int width = 16; @@ -248,14 +263,6 @@ toolBarBitmaps[0] = new wxBitmap(panel_xpm); b2 -> height.AsIs(); m_SearchButton -> SetConstraints(b2); - wxLayoutConstraints *b3 = new wxLayoutConstraints; - m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0); - b3 -> top.Below (m_SearchButton, 10); - b3 -> left.SameAs (dummy, wxLeft, 0); - b3 -> right.SameAs (dummy, wxRight, 0); - b3 -> bottom.SameAs (dummy, wxBottom, 0); - m_SearchList -> SetConstraints(b3); - wxLayoutConstraints *b4 = new wxLayoutConstraints; m_SearchChoice = new wxChoice(dummy, wxID_HTML_SEARCHCHOICE, wxDefaultPosition, wxDefaultSize); @@ -265,22 +272,35 @@ toolBarBitmaps[0] = new wxBitmap(panel_xpm); b4 -> height.AsIs(); m_SearchChoice -> SetConstraints(b4); + wxLayoutConstraints *b3 = new wxLayoutConstraints; + m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0); + b3 -> top.Below (m_SearchButton, 10); + b3 -> left.SameAs (dummy, wxLeft, 0); + b3 -> right.SameAs (dummy, wxRight, 0); + b3 -> bottom.SameAs (dummy, wxBottom, 0); + m_SearchList -> SetConstraints(b3); + dummy -> SetAutoLayout(TRUE); dummy -> Layout(); m_NavigPan -> AddPage(dummy, _("Search")); m_SearchPage = notebook_page++; } + m_HtmlWin -> Show(TRUE); //RefreshLists(); // showtime if (m_NavigPan && m_Splitter) { - m_NavigPan -> Show(TRUE); m_Splitter -> SetMinimumPaneSize(20); - if (m_Cfg.navig_on) + if (m_Cfg.navig_on) { + m_NavigPan -> Show(TRUE); m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + } + else { + m_NavigPan -> Show(FALSE); + m_Splitter -> Initialize(m_HtmlWin); + } } - m_HtmlWin -> Show(TRUE); return TRUE; } @@ -321,6 +341,7 @@ bool wxHtmlHelpFrame::DisplayContents() m_NavigPan -> Show(TRUE); m_HtmlWin -> Show(TRUE); m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + m_Cfg.navig_on = TRUE; } m_NavigPan -> SetSelection(0); return TRUE; @@ -418,6 +439,8 @@ void wxHtmlHelpFrame::CreateContents(bool show_progress) m_ContentsBox -> DeleteAllItems(); roots[0] = m_ContentsBox -> AddRoot(_("(Help)")); + m_ContentsBox -> SetItemImage(roots[0], IMG_RootFolder); + m_ContentsBox -> SetItemSelectedImage(roots[0], IMG_RootFolder); imaged[0] = TRUE; for (i = 0; i < cnt; i++, it++) { @@ -574,10 +597,12 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) if (m_Splitter -> IsSplit()) { m_Cfg.sashpos = m_Splitter -> GetSashPosition(); m_Splitter -> Unsplit(m_NavigPan); + m_Cfg.navig_on = FALSE; } else { m_NavigPan -> Show(TRUE); m_HtmlWin -> Show(TRUE); m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + m_Cfg.navig_on = TRUE; } break; } @@ -598,7 +623,7 @@ void wxHtmlHelpFrame::OnContentsSel(wxTreeEvent& event) void wxHtmlHelpFrame::OnIndexSel(wxCommandEvent& WXUNUSED(event)) { wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexBox -> GetClientData(m_IndexBox -> GetSelection()); - if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); + m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); } @@ -618,8 +643,14 @@ void wxHtmlHelpFrame::OnSearch(wxCommandEvent& WXUNUSED(event)) void wxHtmlHelpFrame::OnCloseWindow(wxCloseEvent& evt) { + GetSize(&m_Cfg.w, &m_Cfg.h); + GetPosition(&m_Cfg.x, &m_Cfg.y); + + if (m_Splitter && m_Cfg.navig_on) m_Cfg.sashpos = m_Splitter -> GetSashPosition(); + if (m_Config) WriteCustomization(m_Config, m_ConfigRoot); + evt.Skip(); }