]> git.saurik.com Git - wxWidgets.git/blob - src/html/helpdlg.cpp
Increase the number of visible OS X combo items.
[wxWidgets.git] / 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 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h"
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_WXHTML_HELP
19
20 #ifndef WX_PRECOMP
21 #include "wx/object.h"
22 #include "wx/intl.h"
23 #include "wx/log.h"
24
25 #include "wx/sizer.h"
26
27 #include "wx/bmpbuttn.h"
28 #include "wx/statbox.h"
29 #include "wx/radiobox.h"
30 #include "wx/menu.h"
31 #include "wx/msgdlg.h"
32 #endif // WX_PRECOMP
33
34 #include "wx/html/htmlwin.h"
35 #include "wx/html/helpdlg.h"
36 #include "wx/html/helpctrl.h"
37 #include "wx/artprov.h"
38
39 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpDialog, wxDialog)
40
41 BEGIN_EVENT_TABLE(wxHtmlHelpDialog, wxDialog)
42 EVT_CLOSE(wxHtmlHelpDialog::OnCloseWindow)
43 END_EVENT_TABLE()
44
45 wxHtmlHelpDialog::wxHtmlHelpDialog(wxWindow* parent, wxWindowID id, const wxString& title,
46 int style, wxHtmlHelpData* data)
47 {
48 Init(data);
49 Create(parent, id, title, style);
50 }
51
52 void wxHtmlHelpDialog::Init(wxHtmlHelpData* data)
53 {
54 // Simply pass the pointer on to the help window
55 m_Data = data;
56 m_HtmlHelpWin = NULL;
57 m_helpController = NULL;
58 }
59
60 // Create: builds the GUI components.
61 bool wxHtmlHelpDialog::Create(wxWindow* parent, wxWindowID id,
62 const wxString& WXUNUSED(title), int style)
63 {
64 m_HtmlHelpWin = new wxHtmlHelpWindow(m_Data);
65
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);
72
73 GetPosition(& (m_HtmlHelpWin->GetCfgData().x), & (m_HtmlHelpWin->GetCfgData()).y);
74
75 SetIcon(wxArtProvider::GetIcon(wxART_HELP, wxART_HELP_BROWSER));
76
77 wxWindow* item1 = this;
78 wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL);
79 item1->SetSizer(item2);
80 item1->SetAutoLayout(true);
81
82 wxWindow* item3 = m_HtmlHelpWin;
83 item2->Add(item3, 1, wxGROW|wxALL, 5);
84
85 wxBoxSizer* item4 = new wxBoxSizer(wxHORIZONTAL);
86 item2->Add(item4, 0, wxGROW, 5);
87
88 item4->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
89
90 wxButton* item6 = new wxButton(item1, wxID_OK, _("Close"), wxDefaultPosition, wxDefaultSize, 0);
91 item4->Add(item6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10);
92 #ifdef __WXMAC__
93 // Add some space for the resize handle
94 item4->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 0);
95 #endif
96
97 Layout();
98 Centre();
99
100 return true;
101 }
102
103 wxHtmlHelpDialog::~wxHtmlHelpDialog()
104 {
105 }
106
107 void wxHtmlHelpDialog::SetTitleFormat(const wxString& format)
108 {
109 m_TitleFormat = format;
110 }
111
112 void wxHtmlHelpDialog::OnCloseWindow(wxCloseEvent& evt)
113 {
114 if (!IsIconized())
115 {
116 GetSize(& (m_HtmlHelpWin->GetCfgData().w), &(m_HtmlHelpWin->GetCfgData().h));
117 GetPosition(& (m_HtmlHelpWin->GetCfgData().x), & (m_HtmlHelpWin->GetCfgData().y));
118 }
119
120 if (m_HtmlHelpWin->GetSplitterWindow() && m_HtmlHelpWin->GetCfgData().navig_on)
121 m_HtmlHelpWin->GetCfgData().sashpos = m_HtmlHelpWin->GetSplitterWindow()->GetSashPosition();
122
123 if (m_helpController)
124 {
125 m_helpController->OnCloseFrame(evt);
126 }
127
128 evt.Skip();
129 }
130
131 #endif // wxUSE_WXHTML_HELP