]>
git.saurik.com Git - wxWidgets.git/blob - src/html/helpdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/html/helpdlg.cpp
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
7 // Copyright: (c) Harm van der Heijden, Vaclav Slavik and Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h"
12 #include "wx/wxprec.h"
21 #include "wx/object.h"
27 #include "wx/bmpbuttn.h"
28 #include "wx/statbox.h"
29 #include "wx/radiobox.h"
31 #include "wx/msgdlg.h"
34 #include "wx/html/htmlwin.h"
35 #include "wx/html/helpdlg.h"
36 #include "wx/html/helpctrl.h"
37 #include "wx/artprov.h"
39 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpDialog
, wxDialog
)
41 BEGIN_EVENT_TABLE(wxHtmlHelpDialog
, wxDialog
)
42 EVT_CLOSE(wxHtmlHelpDialog::OnCloseWindow
)
45 wxHtmlHelpDialog::wxHtmlHelpDialog(wxWindow
* parent
, wxWindowID id
, const wxString
& title
,
46 int style
, wxHtmlHelpData
* data
)
49 Create(parent
, id
, title
, style
);
52 void wxHtmlHelpDialog::Init(wxHtmlHelpData
* data
)
54 // Simply pass the pointer on to the help window
57 m_helpController
= NULL
;
60 // Create: builds the GUI components.
61 bool wxHtmlHelpDialog::Create(wxWindow
* parent
, wxWindowID id
,
62 const wxString
& WXUNUSED(title
), int style
)
64 m_HtmlHelpWin
= new wxHtmlHelpWindow(m_Data
);
66 wxDialog::Create(parent
, id
, _("Help"),
67 wxPoint(m_HtmlHelpWin
->GetCfgData().x
, m_HtmlHelpWin
->GetCfgData().y
),
68 wxSize(m_HtmlHelpWin
->GetCfgData().w
, m_HtmlHelpWin
->GetCfgData().h
),
69 wxDEFAULT_FRAME_STYLE
|wxRESIZE_BORDER
, wxT("wxHtmlHelp"));
70 m_HtmlHelpWin
->Create(this, wxID_ANY
, wxDefaultPosition
, GetClientSize(),
71 wxTAB_TRAVERSAL
|wxNO_BORDER
, style
);
73 GetPosition(& (m_HtmlHelpWin
->GetCfgData().x
), & (m_HtmlHelpWin
->GetCfgData()).y
);
75 SetIcon(wxArtProvider::GetIcon(wxART_HELP
, wxART_HELP_BROWSER
));
77 wxWindow
* item1
= this;
78 wxBoxSizer
* item2
= new wxBoxSizer(wxVERTICAL
);
79 item1
->SetSizer(item2
);
80 item1
->SetAutoLayout(true);
82 wxWindow
* item3
= m_HtmlHelpWin
;
83 item2
->Add(item3
, 1, wxGROW
|wxALL
, 5);
85 wxBoxSizer
* item4
= new wxBoxSizer(wxHORIZONTAL
);
86 item2
->Add(item4
, 0, wxGROW
, 5);
88 item4
->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
90 wxButton
* item6
= new wxButton(item1
, wxID_OK
, _("Close"), wxDefaultPosition
, wxDefaultSize
, 0);
91 item4
->Add(item6
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 10);
93 // Add some space for the resize handle
94 item4
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 0);
103 wxHtmlHelpDialog::~wxHtmlHelpDialog()
107 void wxHtmlHelpDialog::SetTitleFormat(const wxString
& format
)
109 m_TitleFormat
= format
;
112 void wxHtmlHelpDialog::OnCloseWindow(wxCloseEvent
& evt
)
116 GetSize(& (m_HtmlHelpWin
->GetCfgData().w
), &(m_HtmlHelpWin
->GetCfgData().h
));
117 GetPosition(& (m_HtmlHelpWin
->GetCfgData().x
), & (m_HtmlHelpWin
->GetCfgData().y
));
120 if (m_HtmlHelpWin
->GetSplitterWindow() && m_HtmlHelpWin
->GetCfgData().navig_on
)
121 m_HtmlHelpWin
->GetCfgData().sashpos
= m_HtmlHelpWin
->GetSplitterWindow()->GetSashPosition();
123 if (m_helpController
)
125 m_helpController
->OnCloseFrame(evt
);
131 #endif // wxUSE_WXHTML_HELP