]>
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
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"
22 #include "wx/object.h"
28 #include "wx/bmpbuttn.h"
29 #include "wx/statbox.h"
30 #include "wx/radiobox.h"
32 #include "wx/msgdlg.h"
35 #include "wx/html/htmlwin.h"
36 #include "wx/html/helpdlg.h"
37 #include "wx/html/helpctrl.h"
38 #include "wx/artprov.h"
40 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpDialog
, wxDialog
)
42 BEGIN_EVENT_TABLE(wxHtmlHelpDialog
, wxDialog
)
43 EVT_CLOSE(wxHtmlHelpDialog::OnCloseWindow
)
46 wxHtmlHelpDialog::wxHtmlHelpDialog(wxWindow
* parent
, wxWindowID id
, const wxString
& title
,
47 int style
, wxHtmlHelpData
* data
)
50 Create(parent
, id
, title
, style
);
53 void wxHtmlHelpDialog::Init(wxHtmlHelpData
* data
)
55 // Simply pass the pointer on to the help window
58 m_helpController
= NULL
;
61 // Create: builds the GUI components.
62 bool wxHtmlHelpDialog::Create(wxWindow
* parent
, wxWindowID id
,
63 const wxString
& WXUNUSED(title
), int style
)
65 m_HtmlHelpWin
= new wxHtmlHelpWindow(m_Data
);
67 wxDialog::Create(parent
, id
, _("Help"),
68 wxPoint(m_HtmlHelpWin
->GetCfgData().x
, m_HtmlHelpWin
->GetCfgData().y
),
69 wxSize(m_HtmlHelpWin
->GetCfgData().w
, m_HtmlHelpWin
->GetCfgData().h
),
70 wxDEFAULT_FRAME_STYLE
|wxRESIZE_BORDER
, wxT("wxHtmlHelp"));
71 m_HtmlHelpWin
->Create(this, wxID_ANY
, wxDefaultPosition
, GetClientSize(),
72 wxTAB_TRAVERSAL
|wxNO_BORDER
, style
);
74 GetPosition(& (m_HtmlHelpWin
->GetCfgData().x
), & (m_HtmlHelpWin
->GetCfgData()).y
);
76 SetIcon(wxArtProvider::GetIcon(wxART_HELP
, wxART_HELP_BROWSER
));
78 wxWindow
* item1
= this;
79 wxBoxSizer
* item2
= new wxBoxSizer(wxVERTICAL
);
80 item1
->SetSizer(item2
);
81 item1
->SetAutoLayout(true);
83 wxWindow
* item3
= m_HtmlHelpWin
;
84 item2
->Add(item3
, 1, wxGROW
|wxALL
, 5);
86 wxBoxSizer
* item4
= new wxBoxSizer(wxHORIZONTAL
);
87 item2
->Add(item4
, 0, wxGROW
, 5);
89 item4
->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
91 wxButton
* item6
= new wxButton(item1
, wxID_OK
, _("&Close"), wxDefaultPosition
, wxDefaultSize
, 0);
92 item4
->Add(item6
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 10);
94 // Add some space for the resize handle
95 item4
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 0);
104 wxHtmlHelpDialog::~wxHtmlHelpDialog()
108 void wxHtmlHelpDialog::SetTitleFormat(const wxString
& format
)
110 m_TitleFormat
= format
;
113 void wxHtmlHelpDialog::OnCloseWindow(wxCloseEvent
& evt
)
117 GetSize(& (m_HtmlHelpWin
->GetCfgData().w
), &(m_HtmlHelpWin
->GetCfgData().h
));
118 GetPosition(& (m_HtmlHelpWin
->GetCfgData().x
), & (m_HtmlHelpWin
->GetCfgData().y
));
121 if (m_HtmlHelpWin
->GetSplitterWindow() && m_HtmlHelpWin
->GetCfgData().navig_on
)
122 m_HtmlHelpWin
->GetCfgData().sashpos
= m_HtmlHelpWin
->GetSplitterWindow()->GetSashPosition();
124 if (m_helpController
)
126 m_helpController
->OnCloseFrame(evt
);
132 #endif // wxUSE_WXHTML_HELP