1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxWebView sample
4 // Author: Marianne Gagnon
6 // Copyright: (c) 2010 Marianne Gagnon, Steven Lamerton
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
14 // For compilers that support precompilation, includes "wx/wx.h".
15 #include "wx/wxprec.h"
25 #include <wx/artprov.h>
26 #include <wx/notifmsg.h>
27 #include <wx/settings.h>
28 #include <wx/webview.h>
29 #include <wx/infobar.h>
31 #if !defined(__WXMSW__) && !defined(__WXPM__)
32 #include "../sample.xpm"
36 #include <wx/stc/stc.h>
38 #error "wxStyledTextControl is needed by this sample"
42 #include "refresh.xpm"
45 class WebApp
: public wxApp
48 virtual bool OnInit();
51 class WebFrame
: public wxFrame
56 void OnAnimationTimer(wxTimerEvent
& evt
);
58 void OnUrl(wxCommandEvent
& evt
);
59 void OnBack(wxCommandEvent
& evt
);
60 void OnForward(wxCommandEvent
& evt
);
61 void OnStop(wxCommandEvent
& evt
);
62 void OnReload(wxCommandEvent
& evt
);
63 void OnClearHistory(wxCommandEvent
& evt
);
64 void OnEnableHistory(wxCommandEvent
& evt
);
65 void OnNavigationRequest(wxWebNavigationEvent
& evt
);
66 void OnNavigationComplete(wxWebNavigationEvent
& evt
);
67 void OnDocumentLoaded(wxWebNavigationEvent
& evt
);
68 void OnNewWindow(wxWebNavigationEvent
& evt
);
69 void OnViewSourceRequest(wxCommandEvent
& evt
);
70 void OnToolsClicked(wxCommandEvent
& evt
);
71 void OnSetZoom(wxCommandEvent
& evt
);
72 void OnError(wxWebNavigationEvent
& evt
);
73 void OnPrint(wxCommandEvent
& evt
);
74 void OnCut(wxCommandEvent
& evt
);
75 void OnCopy(wxCommandEvent
& evt
);
76 void OnPaste(wxCommandEvent
& evt
);
77 void OnUndo(wxCommandEvent
& evt
);
78 void OnRedo(wxCommandEvent
& evt
);
79 void OnMode(wxCommandEvent
& evt
);
86 wxToolBarToolBase
* m_toolbar_back
;
87 wxToolBarToolBase
* m_toolbar_forward
;
88 wxToolBarToolBase
* m_toolbar_stop
;
89 wxToolBarToolBase
* m_toolbar_reload
;
90 wxToolBarToolBase
* m_toolbar_tools
;
93 wxMenuItem
* m_tools_tiny
;
94 wxMenuItem
* m_tools_small
;
95 wxMenuItem
* m_tools_medium
;
96 wxMenuItem
* m_tools_large
;
97 wxMenuItem
* m_tools_largest
;
98 wxMenuItem
* m_tools_handle_navigation
;
99 wxMenuItem
* m_tools_handle_new_window
;
100 wxMenuItem
* m_tools_enable_history
;
101 wxMenuItem
* m_edit_cut
;
102 wxMenuItem
* m_edit_copy
;
103 wxMenuItem
* m_edit_paste
;
104 wxMenuItem
* m_edit_undo
;
105 wxMenuItem
* m_edit_redo
;
106 wxMenuItem
* m_edit_mode
;
109 int m_animation_angle
;
112 wxStaticText
* m_info_text
;
115 class SourceViewDialog
: public wxDialog
118 SourceViewDialog(wxWindow
* parent
, wxString source
);
121 IMPLEMENT_APP(WebApp
)
123 // ============================================================================
125 // ============================================================================
127 bool WebApp::OnInit()
129 if ( !wxApp::OnInit() )
132 WebFrame
*frame
= new WebFrame();
138 WebFrame::WebFrame() : wxFrame(NULL
, wxID_ANY
, "wxWebView Sample")
140 // set the frame icon
141 SetIcon(wxICON(sample
));
142 SetTitle("wxWebView Sample");
145 m_animation_angle
= 0;
148 wxBoxSizer
* topsizer
= new wxBoxSizer(wxVERTICAL
);
150 // Create the toolbar
151 m_toolbar
= CreateToolBar(wxTB_TEXT
);
152 m_toolbar
->SetToolBitmapSize(wxSize(32, 32));
154 wxBitmap back
= wxArtProvider::GetBitmap(wxART_GO_BACK
, wxART_TOOLBAR
);
155 wxBitmap forward
= wxArtProvider::GetBitmap(wxART_GO_FORWARD
, wxART_TOOLBAR
);
157 wxBitmap stop
= wxArtProvider::GetBitmap("gtk-stop", wxART_TOOLBAR
);
159 wxBitmap stop
= wxBitmap(stop_xpm
);
162 wxBitmap refresh
= wxArtProvider::GetBitmap("gtk-refresh", wxART_TOOLBAR
);
164 wxBitmap refresh
= wxBitmap(refresh_xpm
);
167 m_toolbar_back
= m_toolbar
->AddTool(wxID_ANY
, _("Back"), back
);
168 m_toolbar_forward
= m_toolbar
->AddTool(wxID_ANY
, _("Forward"), forward
);
169 m_toolbar_stop
= m_toolbar
->AddTool(wxID_ANY
, _("Stop"), stop
);
170 m_toolbar_reload
= m_toolbar
->AddTool(wxID_ANY
, _("Reload"), refresh
);
171 m_url
= new wxTextCtrl(m_toolbar
, wxID_ANY
, wxT(""), wxDefaultPosition
, wxSize(400, -1), wxTE_PROCESS_ENTER
);
172 m_toolbar
->AddControl(m_url
, _("URL"));
173 m_toolbar_tools
= m_toolbar
->AddTool(wxID_ANY
, _("Menu"), wxBitmap(wxlogo_xpm
));
175 m_toolbar
->Realize();
177 // Create the info panel
178 m_info
= new wxInfoBar(this);
179 topsizer
->Add(m_info
, wxSizerFlags().Expand());
181 // Create the webview
182 m_browser
= wxWebView::New(this, wxID_ANY
, "http://www.wxwidgets.org");
183 topsizer
->Add(m_browser
, wxSizerFlags().Expand().Proportion(1));
187 //Set a more sensible size for web browsing
188 SetSize(wxSize(800, 600));
190 // Create a log window
191 new wxLogWindow(this, _("Logging"));
193 // Create the Tools menu
194 m_tools_menu
= new wxMenu();
195 wxMenuItem
* print
= m_tools_menu
->Append(wxID_ANY
, _("Print"));
196 wxMenuItem
* viewSource
= m_tools_menu
->Append(wxID_ANY
, _("View Source"));
197 m_tools_menu
->AppendSeparator();
198 m_tools_tiny
= m_tools_menu
->AppendCheckItem(wxID_ANY
, _("Tiny"));
199 m_tools_small
= m_tools_menu
->AppendCheckItem(wxID_ANY
, _("Small"));
200 m_tools_medium
= m_tools_menu
->AppendCheckItem(wxID_ANY
, _("Medium"));
201 m_tools_large
= m_tools_menu
->AppendCheckItem(wxID_ANY
, _("Large"));
202 m_tools_largest
= m_tools_menu
->AppendCheckItem(wxID_ANY
, _("Largest"));
203 m_tools_menu
->AppendSeparator();
204 m_tools_handle_navigation
= m_tools_menu
->AppendCheckItem(wxID_ANY
, _("Handle Navigation"));
205 m_tools_handle_new_window
= m_tools_menu
->AppendCheckItem(wxID_ANY
, _("Handle New Windows"));
206 m_tools_menu
->AppendSeparator();
207 wxMenuItem
* clearhist
= m_tools_menu
->Append(wxID_ANY
, _("Clear History"));
208 m_tools_enable_history
= m_tools_menu
->AppendCheckItem(wxID_ANY
, _("Enable History"));
210 //Create an editing menu
211 wxMenu
* editmenu
= new wxMenu();
212 m_edit_cut
= editmenu
->Append(wxID_ANY
, _("Cut"));
213 m_edit_copy
= editmenu
->Append(wxID_ANY
, _("Copy"));
214 m_edit_paste
= editmenu
->Append(wxID_ANY
, _("Paste"));
215 editmenu
->AppendSeparator();
216 m_edit_undo
= editmenu
->Append(wxID_ANY
, _("Undo"));
217 m_edit_redo
= editmenu
->Append(wxID_ANY
, _("Redo"));
218 editmenu
->AppendSeparator();
219 m_edit_mode
= editmenu
->AppendCheckItem(wxID_ANY
, _("Edit Mode"));
221 m_tools_menu
->AppendSeparator();
222 m_tools_menu
->AppendSubMenu(editmenu
, "Edit");
224 //By default we want to handle navigation and new windows
225 m_tools_handle_navigation
->Check();
226 m_tools_handle_new_window
->Check();
227 m_tools_enable_history
->Check();
230 // Connect the toolbar events
231 Connect(m_toolbar_back
->GetId(), wxEVT_COMMAND_TOOL_CLICKED
,
232 wxCommandEventHandler(WebFrame::OnBack
), NULL
, this );
233 Connect(m_toolbar_forward
->GetId(), wxEVT_COMMAND_TOOL_CLICKED
,
234 wxCommandEventHandler(WebFrame::OnForward
), NULL
, this );
235 Connect(m_toolbar_stop
->GetId(), wxEVT_COMMAND_TOOL_CLICKED
,
236 wxCommandEventHandler(WebFrame::OnStop
), NULL
, this );
237 Connect(m_toolbar_reload
->GetId(), wxEVT_COMMAND_TOOL_CLICKED
,
238 wxCommandEventHandler(WebFrame::OnReload
),NULL
, this );
239 Connect(m_toolbar_tools
->GetId(), wxEVT_COMMAND_TOOL_CLICKED
,
240 wxCommandEventHandler(WebFrame::OnToolsClicked
), NULL
, this );
242 Connect(m_url
->GetId(), wxEVT_COMMAND_TEXT_ENTER
,
243 wxCommandEventHandler(WebFrame::OnUrl
), NULL
, this );
245 // Connect the webview events
246 Connect(m_browser
->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATING
,
247 wxWebNavigationEventHandler(WebFrame::OnNavigationRequest
), NULL
, this);
248 Connect(m_browser
->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATED
,
249 wxWebNavigationEventHandler(WebFrame::OnNavigationComplete
), NULL
, this);
250 Connect(m_browser
->GetId(), wxEVT_COMMAND_WEB_VIEW_LOADED
,
251 wxWebNavigationEventHandler(WebFrame::OnDocumentLoaded
), NULL
, this);
252 Connect(m_browser
->GetId(), wxEVT_COMMAND_WEB_VIEW_ERROR
,
253 wxWebNavigationEventHandler(WebFrame::OnError
), NULL
, this);
254 Connect(m_browser
->GetId(), wxEVT_COMMAND_WEB_VIEW_NEWWINDOW
,
255 wxWebNavigationEventHandler(WebFrame::OnNewWindow
), NULL
, this);
257 // Connect the menu events
258 Connect(viewSource
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
259 wxCommandEventHandler(WebFrame::OnViewSourceRequest
), NULL
, this );
260 Connect(print
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
261 wxCommandEventHandler(WebFrame::OnPrint
), NULL
, this );
262 Connect(m_tools_tiny
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
263 wxCommandEventHandler(WebFrame::OnSetZoom
), NULL
, this );
264 Connect(m_tools_small
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
265 wxCommandEventHandler(WebFrame::OnSetZoom
), NULL
, this );
266 Connect(m_tools_medium
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
267 wxCommandEventHandler(WebFrame::OnSetZoom
), NULL
, this );
268 Connect(m_tools_large
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
269 wxCommandEventHandler(WebFrame::OnSetZoom
), NULL
, this );
270 Connect(m_tools_largest
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
271 wxCommandEventHandler(WebFrame::OnSetZoom
), NULL
, this );
272 Connect(clearhist
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
273 wxCommandEventHandler(WebFrame::OnClearHistory
), NULL
, this );
274 Connect(m_tools_enable_history
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
275 wxCommandEventHandler(WebFrame::OnEnableHistory
), NULL
, this );
276 Connect(m_edit_cut
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
277 wxCommandEventHandler(WebFrame::OnCut
), NULL
, this );
278 Connect(m_edit_copy
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
279 wxCommandEventHandler(WebFrame::OnCopy
), NULL
, this );
280 Connect(m_edit_paste
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
281 wxCommandEventHandler(WebFrame::OnPaste
), NULL
, this );
282 Connect(m_edit_undo
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
283 wxCommandEventHandler(WebFrame::OnUndo
), NULL
, this );
284 Connect(m_edit_redo
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
285 wxCommandEventHandler(WebFrame::OnRedo
), NULL
, this );
286 Connect(m_edit_mode
->GetId(), wxEVT_COMMAND_MENU_SELECTED
,
287 wxCommandEventHandler(WebFrame::OnMode
), NULL
, this );
290 void WebFrame::OnAnimationTimer(wxTimerEvent
& evt
)
292 m_animation_angle
+= 15;
293 if (m_animation_angle
> 360) m_animation_angle
-= 360;
295 wxBitmap
image(24, 24);
298 dc
.SelectObject(image
);
299 dc
.SetBackground(wxBrush(wxColour(255,0,255)));
302 if (m_animation_angle
>= 0 && m_animation_angle
<= 180)
304 dc
.SetBrush(*wxYELLOW_BRUSH
);
305 dc
.SetPen(*wxYELLOW_PEN
);
306 dc
.DrawCircle(16 - int(sin(m_animation_angle
*0.01745f
/* convert to radians */)*14.0f
),
307 16 + int(cos(m_animation_angle
*0.01745f
/* convert to radians */)*14.0f
), 3 );
310 dc
.DrawBitmap(wxBitmap(wxlogo_xpm
), 0, 0, true);
312 if (m_animation_angle
> 180)
314 dc
.SetBrush(*wxYELLOW_BRUSH
);
315 dc
.SetPen(*wxYELLOW_PEN
);
316 dc
.DrawCircle(16 - int(sin(m_animation_angle
*0.01745f
/* convert to radians */)*14.0f
),
317 16 + int(cos(m_animation_angle
*0.01745f
/* convert to radians */)*14.0f
), 3 );
320 image
.SetMask(new wxMask(image
, wxColour(255,0,255)));
321 m_toolbar
->SetToolNormalBitmap(m_toolbar_tools
->GetId(), image
);
325 * Method that retrieves the current state from the web control and updates the GUI
326 * the reflect this current state.
328 void WebFrame::UpdateState()
330 m_toolbar
->EnableTool( m_toolbar_back
->GetId(), m_browser
->CanGoBack() );
331 m_toolbar
->EnableTool( m_toolbar_forward
->GetId(), m_browser
->CanGoForward() );
333 if (m_browser
->IsBusy())
337 m_timer
= new wxTimer(this);
338 this->Connect(wxEVT_TIMER
, wxTimerEventHandler(WebFrame::OnAnimationTimer
), NULL
, this);
340 m_timer
->Start(100); // start animation timer
342 m_toolbar
->EnableTool( m_toolbar_stop
->GetId(), true );
346 if (m_timer
!= NULL
) m_timer
->Stop(); // stop animation timer
347 m_toolbar
->SetToolNormalBitmap(m_toolbar_tools
->GetId(), wxBitmap(wxlogo_xpm
));
348 m_toolbar
->EnableTool( m_toolbar_stop
->GetId(), false );
351 SetTitle( m_browser
->GetCurrentTitle() );
352 m_url
->SetValue( m_browser
->GetCurrentURL() );
356 * Callback invoked when user entered an URL and pressed enter
358 void WebFrame::OnUrl(wxCommandEvent
& evt
)
360 m_browser
->LoadUrl( m_url
->GetValue() );
365 * Callback invoked when user pressed the "back" button
367 void WebFrame::OnBack(wxCommandEvent
& evt
)
374 * Callback invoked when user pressed the "forward" button
376 void WebFrame::OnForward(wxCommandEvent
& evt
)
378 m_browser
->GoForward();
383 * Callback invoked when user pressed the "stop" button
385 void WebFrame::OnStop(wxCommandEvent
& evt
)
392 * Callback invoked when user pressed the "reload" button
394 void WebFrame::OnReload(wxCommandEvent
& evt
)
400 void WebFrame::OnClearHistory(wxCommandEvent
& evt
)
402 m_browser
->ClearHistory();
406 void WebFrame::OnEnableHistory(wxCommandEvent
& evt
)
408 m_browser
->EnableHistory(m_tools_enable_history
->IsChecked());
412 void WebFrame::OnCut(wxCommandEvent
& evt
)
417 void WebFrame::OnCopy(wxCommandEvent
& evt
)
422 void WebFrame::OnPaste(wxCommandEvent
& evt
)
427 void WebFrame::OnUndo(wxCommandEvent
& evt
)
432 void WebFrame::OnRedo(wxCommandEvent
& evt
)
437 void WebFrame::OnMode(wxCommandEvent
& evt
)
439 m_browser
->SetEditable(m_edit_mode
->IsChecked());
444 * Callback invoked when there is a request to load a new page (for instance
445 * when the user clicks a link)
447 void WebFrame::OnNavigationRequest(wxWebNavigationEvent
& evt
)
449 wxLogMessage("%s", "Navigation request to '" + evt
.GetHref() + "' (target='" +
450 evt
.GetTarget() + "')");
452 wxASSERT(m_browser
->IsBusy());
454 //If we don't want to handle navigation then veto the event and navigation
455 //will not take place
456 if(!m_tools_handle_navigation
->IsChecked())
463 * Callback invoked when a navigation request was accepted
465 void WebFrame::OnNavigationComplete(wxWebNavigationEvent
& evt
)
467 wxLogMessage("%s", "Navigation complete; url='" + evt
.GetHref() + "'");
472 * Callback invoked when a page is finished loading
474 void WebFrame::OnDocumentLoaded(wxWebNavigationEvent
& evt
)
476 //Only notify if the document is the main frame, not a subframe
477 if(evt
.GetHref() == m_browser
->GetCurrentURL())
478 wxLogMessage("%s", "Document loaded; url='" + evt
.GetHref() + "'");
483 * On new window, we veto to stop extra windows appearing
485 void WebFrame::OnNewWindow(wxWebNavigationEvent
& evt
)
487 wxLogMessage("%s", "New window; url='" + evt
.GetHref() + "'");
489 //If we handle new window events then just load them in this window as we
490 //are a single window browser
491 if(m_tools_handle_new_window
->IsChecked())
492 m_browser
->LoadUrl(evt
.GetHref());
494 //We always veto because we handle the event, otherwise under windows a new
495 //internet explorer windowis created
502 * Invoked when user selects the "View Source" menu item
504 void WebFrame::OnViewSourceRequest(wxCommandEvent
& evt
)
506 SourceViewDialog
dlg(this, m_browser
->GetPageSource());
511 * Invoked when user selects the "Menu" item
513 void WebFrame::OnToolsClicked(wxCommandEvent
& evt
)
515 if(m_browser
->GetCurrentURL() == "")
518 m_tools_tiny
->Check(false);
519 m_tools_small
->Check(false);
520 m_tools_medium
->Check(false);
521 m_tools_large
->Check(false);
522 m_tools_largest
->Check(false);
524 wxWebViewZoom zoom
= m_browser
->GetZoom();
527 case wxWEB_VIEW_ZOOM_TINY
:
528 m_tools_tiny
->Check();
530 case wxWEB_VIEW_ZOOM_SMALL
:
531 m_tools_small
->Check();
533 case wxWEB_VIEW_ZOOM_MEDIUM
:
534 m_tools_medium
->Check();
536 case wxWEB_VIEW_ZOOM_LARGE
:
537 m_tools_large
->Check();
539 case wxWEB_VIEW_ZOOM_LARGEST
:
540 m_tools_largest
->Check();
544 m_edit_cut
->Enable(m_browser
->CanCut());
545 m_edit_copy
->Enable(m_browser
->CanCopy());
546 m_edit_paste
->Enable(m_browser
->CanPaste());
548 m_edit_undo
->Enable(m_browser
->CanUndo());
549 m_edit_redo
->Enable(m_browser
->CanRedo());
551 wxPoint position
= ScreenToClient( wxGetMousePosition() );
552 PopupMenu(m_tools_menu
, position
.x
, position
.y
);
556 * Invoked when user selects the zoom size in the menu
558 void WebFrame::OnSetZoom(wxCommandEvent
& evt
)
560 if (evt
.GetId() == m_tools_tiny
->GetId())
562 m_browser
->SetZoom(wxWEB_VIEW_ZOOM_TINY
);
564 else if (evt
.GetId() == m_tools_small
->GetId())
566 m_browser
->SetZoom(wxWEB_VIEW_ZOOM_SMALL
);
568 else if (evt
.GetId() == m_tools_medium
->GetId())
570 m_browser
->SetZoom(wxWEB_VIEW_ZOOM_MEDIUM
);
572 else if (evt
.GetId() == m_tools_large
->GetId())
574 m_browser
->SetZoom(wxWEB_VIEW_ZOOM_LARGE
);
576 else if (evt
.GetId() == m_tools_largest
->GetId())
578 m_browser
->SetZoom(wxWEB_VIEW_ZOOM_LARGEST
);
587 * Callback invoked when a loading error occurs
589 void WebFrame::OnError(wxWebNavigationEvent
& evt
)
591 wxString errorCategory
;
592 switch (evt
.GetInt())
594 case wxWEB_NAV_ERR_CONNECTION
:
595 errorCategory
= "wxWEB_NAV_ERR_CONNECTION";
598 case wxWEB_NAV_ERR_CERTIFICATE
:
599 errorCategory
= "wxWEB_NAV_ERR_CERTIFICATE";
602 case wxWEB_NAV_ERR_AUTH
:
603 errorCategory
= "wxWEB_NAV_ERR_AUTH";
606 case wxWEB_NAV_ERR_SECURITY
:
607 errorCategory
= "wxWEB_NAV_ERR_SECURITY";
610 case wxWEB_NAV_ERR_NOT_FOUND
:
611 errorCategory
= "wxWEB_NAV_ERR_NOT_FOUND";
614 case wxWEB_NAV_ERR_REQUEST
:
615 errorCategory
= "wxWEB_NAV_ERR_REQUEST";
618 case wxWEB_NAV_ERR_USER_CANCELLED
:
619 errorCategory
= "wxWEB_NAV_ERR_USER_CANCELLED";
622 case wxWEB_NAV_ERR_OTHER
:
623 errorCategory
= "wxWEB_NAV_ERR_OTHER";
627 wxLogMessage("Error; url='" + evt
.GetHref() + "', error='" + errorCategory
+ "' (" + evt
.GetString() + ")");
629 //Show the info bar with an error
630 m_info
->ShowMessage(_("An error occurred loading ") + evt
.GetHref() + "\n" +
631 "'" + errorCategory
+ "' (" + evt
.GetString() + ")", wxICON_ERROR
);
637 * Invoked when user selects "Print" from the menu
639 void WebFrame::OnPrint(wxCommandEvent
& evt
)
644 SourceViewDialog::SourceViewDialog(wxWindow
* parent
, wxString source
) :
645 wxDialog(parent
, wxID_ANY
, "Source Code",
646 wxDefaultPosition
, wxSize(700,500),
647 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
)
649 wxStyledTextCtrl
* text
= new wxStyledTextCtrl(this, wxID_ANY
);
650 text
->SetMarginWidth(1, 30);
651 text
->SetMarginType(1, wxSTC_MARGIN_NUMBER
);
652 text
->SetText(source
);
654 text
->StyleClearAll();
655 text
->SetLexer(wxSTC_LEX_HTML
);
656 text
->StyleSetForeground(wxSTC_H_DOUBLESTRING
, wxColour(255,0,0));
657 text
->StyleSetForeground(wxSTC_H_SINGLESTRING
, wxColour(255,0,0));
658 text
->StyleSetForeground(wxSTC_H_ENTITY
, wxColour(255,0,0));
659 text
->StyleSetForeground(wxSTC_H_TAG
, wxColour(0,150,0));
660 text
->StyleSetForeground(wxSTC_H_TAGUNKNOWN
, wxColour(0,150,0));
661 text
->StyleSetForeground(wxSTC_H_ATTRIBUTE
, wxColour(0,0,150));
662 text
->StyleSetForeground(wxSTC_H_ATTRIBUTEUNKNOWN
, wxColour(0,0,150));
663 text
->StyleSetForeground(wxSTC_H_COMMENT
, wxColour(150,150,150));
665 wxBoxSizer
* sizer
= new wxBoxSizer(wxVERTICAL
);
666 sizer
->Add(text
, 1, wxEXPAND
);