]>
git.saurik.com Git - wxWidgets.git/blob - src/html/helpdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxHtmlHelpDialog
4 // Notes: Based on htmlhelp.cpp, implementing a monolithic
5 // HTML Help controller class, by Vaclav Slavik
6 // Author: Harm van der Heijden, Vaclav Slavik and Julian Smart
8 // Copyright: (c) Harm van der Heijden, Vaclav Slavik and Julian Smart
9 // Licence: wxWidgets licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h"
13 #include "wx/wxprec.h"
25 #include "wx/object.h"
28 #include "wx/bmpbuttn.h"
29 #include "wx/statbox.h"
30 #include "wx/radiobox.h"
35 #include "wx/msgdlg.h"
38 #include "wx/html/htmlwin.h"
39 #include "wx/html/helpdlg.h"
40 #include "wx/html/helpctrl.h"
41 #include "wx/artprov.h"
43 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpDialog
, wxDialog
)
45 BEGIN_EVENT_TABLE(wxHtmlHelpDialog
, wxDialog
)
46 EVT_CLOSE(wxHtmlHelpDialog::OnCloseWindow
)
49 wxHtmlHelpDialog::wxHtmlHelpDialog(wxWindow
* parent
, wxWindowID id
, const wxString
& title
,
50 int style
, wxHtmlHelpData
* data
)
53 Create(parent
, id
, title
, style
);
56 void wxHtmlHelpDialog::Init(wxHtmlHelpData
* data
)
58 // Simply pass the pointer on to the help window
61 m_helpController
= NULL
;
64 // Create: builds the GUI components.
65 bool wxHtmlHelpDialog::Create(wxWindow
* parent
, wxWindowID id
,
66 const wxString
& WXUNUSED(title
), int style
)
68 m_HtmlHelpWin
= new wxHtmlHelpWindow(m_Data
);
70 wxDialog::Create(parent
, id
, _("Help"),
71 wxPoint(m_HtmlHelpWin
->GetCfgData().x
, m_HtmlHelpWin
->GetCfgData().y
),
72 wxSize(m_HtmlHelpWin
->GetCfgData().w
, m_HtmlHelpWin
->GetCfgData().h
),
73 wxDEFAULT_FRAME_STYLE
|wxRESIZE_BORDER
, wxT("wxHtmlHelp"));
74 m_HtmlHelpWin
->Create(this, -1, wxDefaultPosition
, GetClientSize(),
75 wxTAB_TRAVERSAL
|wxNO_BORDER
, style
);
77 GetPosition(& (m_HtmlHelpWin
->GetCfgData().x
), & (m_HtmlHelpWin
->GetCfgData()).y
);
79 SetIcon(wxArtProvider::GetIcon(wxART_HELP
, wxART_HELP_BROWSER
));
81 wxWindow
* item1
= this;
82 wxBoxSizer
* item2
= new wxBoxSizer(wxVERTICAL
);
83 item1
->SetSizer(item2
);
84 item1
->SetAutoLayout(true);
86 wxWindow
* item3
= m_HtmlHelpWin
;
87 item2
->Add(item3
, 1, wxGROW
|wxALL
, 5);
89 wxBoxSizer
* item4
= new wxBoxSizer(wxHORIZONTAL
);
90 item2
->Add(item4
, 0, wxGROW
, 5);
92 item4
->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
94 wxButton
* item6
= new wxButton(item1
, wxID_OK
, _("&Close"), wxDefaultPosition
, wxDefaultSize
, 0);
95 item4
->Add(item6
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 10);
97 // Add some space for the resize handle
98 item4
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 0);
107 wxHtmlHelpDialog::~wxHtmlHelpDialog()
111 void wxHtmlHelpDialog::SetTitleFormat(const wxString
& format
)
113 m_TitleFormat
= format
;
116 void wxHtmlHelpDialog::OnCloseWindow(wxCloseEvent
& evt
)
120 GetSize(& (m_HtmlHelpWin
->GetCfgData().w
), &(m_HtmlHelpWin
->GetCfgData().h
));
121 GetPosition(& (m_HtmlHelpWin
->GetCfgData().x
), & (m_HtmlHelpWin
->GetCfgData().y
));
124 if (m_HtmlHelpWin
->GetSplitterWindow() && m_HtmlHelpWin
->GetCfgData().navig_on
)
125 m_HtmlHelpWin
->GetCfgData().sashpos
= m_HtmlHelpWin
->GetSplitterWindow()->GetSashPosition();
127 if (m_helpController
)
129 m_helpController
->OnCloseFrame(evt
);
135 #endif // wxUSE_WXHTML_HELP