-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebcontrol.h
773 lines (574 loc) · 26.3 KB
/
webcontrol.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
///////////////////////////////////////////////////////////////////////////////
// Name: webcontrol.h
// Purpose: wxwebconnect: embedded web browser control library
// Author: Benjamin I. Williams
// Modified by:
// Created: 2006-09-22
// RCS-ID:
// Copyright: (C) Copyright 2006-2010, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
#ifndef __WXWEBCONNECT_WEBCONTROL_H
#define __WXWEBCONNECT_WEBCONTROL_H
#include "dom.h"
#include "wx/xrc/xmlres.h"
#undef SWIG
#undef WXDLLIMPEXP_AUI
#define WXDLLIMPEXP_AUI
///////////////////////////////////////////////////////////////////////////////
// web states, used by the EVT_WEB_STATECHANGE event
///////////////////////////////////////////////////////////////////////////////
enum wxWebState
{
wxWEB_STATE_NONE = 0,
wxWEB_STATE_START = 1 << 0,
wxWEB_STATE_REDIRECTING = 1 << 1,
wxWEB_STATE_TRANSFERRING = 1 << 2,
wxWEB_STATE_NEGOTIATING = 1 << 3,
wxWEB_STATE_STOP = 1 << 4,
wxWEB_STATE_IS_REQUEST = 1 << 5,
wxWEB_STATE_IS_DOCUMENT = 1 << 6,
wxWEB_STATE_IS_NETWORK = 1 << 7,
wxWEB_STATE_IS_WINDOW = 1 << 8,
};
enum wxWebResult
{
wxWEB_RESULT_NONE = 0,
wxWEB_RESULT_SUCCESS = 1 << 0,
wxWEB_RESULT_UNKNOWN_PROTOCOL = 1 << 1,
wxWEB_RESULT_FILE_NOT_FOUND = 1 << 2,
wxWEB_RESULT_UNKNOWN_HOST = 1 << 3,
wxWEB_RESULT_CONNECTION_REFUSED = 1 << 4,
wxWEB_RESULT_NET_INTERRUPT = 1 << 5,
wxWEB_RESULT_NET_TIMEOUT = 1 << 6,
wxWEB_RESULT_MALFORMED_URI = 1 << 7,
wxWEB_RESULT_REDIRECT_LOOP = 1 << 8,
wxWEB_RESULT_UNKNOWN_SOCKET_TYPE = 1 << 9,
wxWEB_RESULT_NET_RESET = 1 << 10,
wxWEB_RESULT_DOCUMENT_NOT_CACHED = 1 << 11,
wxWEB_RESULT_DOCUMENT_IS_PRINTMODE = 1 << 12,
wxWEB_RESULT_PORT_ACCESS_NOT_ALLOWED = 1 << 13,
wxWEB_RESULT_UNKNOWN_PROXY_HOST = 1 << 14,
wxWEB_RESULT_PROXY_CONNECTION_REFUSED = 1 << 15
};
enum wxWebLoadFlag
{
wxWEB_LOAD_NORMAL = 0,
wxWEB_LOAD_LINKCLICK = 1 << 1
};
enum wxWebFindFlag
{
wxWEB_FIND_BACKWARDS = 1 << 1,
wxWEB_FIND_WRAP = 1 << 2,
wxWEB_FIND_ENTIRE_WORD = 1 << 3,
wxWEB_FIND_MATCH_CASE = 1 << 4,
wxWEB_FIND_SEARCH_FRAMES = 1 << 5
};
enum wxWebDownloadAction
{
wxWEB_DOWNLOAD_OPEN = 1,
wxWEB_DOWNLOAD_SAVE = 2,
wxWEB_DOWNLOAD_SAVEAS = 3,
wxWEB_DOWNLOAD_CANCEL = 4
};
enum wxWebChromeFlags
{
wxWEB_CHROME_MODAL = 1 << 1,
wxWEB_CHROME_RESIZABLE = 1 << 2,
wxWEB_CHROME_CENTER = 1 << 3,
wxWEB_CHROME_CENTRE = 1 << 3,
};
enum wxWebDOMNodeType
{
// see DOM Level 2 spec for more info
wxWEB_NODETYPE_ELEMENT_NODE = 1,
wxWEB_NODETYPE_ATTRIBUTE_NODE = 2,
wxWEB_NODETYPE_TEXT_NODE = 3,
wxWEB_NODETYPE_CDATA_SECTION_NODE = 4,
wxWEB_NODETYPE_ENTITY_REFERENCE_NODE = 5,
wxWEB_NODETYPE_ENTITY_NODE = 6,
wxWEB_NODETYPE_PROCESSING_INSTRUCTION_NODE = 7,
wxWEB_NODETYPE_COMMENT_NODE = 8,
wxWEB_NODETYPE_DOCUMENT_NODE = 9,
wxWEB_NODETYPE_DOCUMENT_TYPE_NODE = 10,
wxWEB_NODETYPE_DOCUMENT_FRAGMENT_NODE = 11,
wxWEB_NODETYPE_NOTATION_NODE = 12,
};
class BrowserChrome;
struct EmbeddingPtrs;
///////////////////////////////////////////////////////////////////////////////
// wxWebContentHandler class
///////////////////////////////////////////////////////////////////////////////
// (CLASS) wxWebContentHandler
// Category: Content
// Description: Used for intercepting and handling specific types of content
// in order to override the default manner in which the web control
// handles certain types of content.
// Remarks: The wxWebContentHandler class is used for intercepting and handling
// specific types of content in order to override the default manner in
// which the web control handles certain types of content.
// (METHOD) wxWebContentHandler::CanHandleContent
// Syntax: bool wxWebContentHandler::CanHandleContent(const wxString& url,
// const wxString& mime_type)
// (METHOD) wxWebContentHandler::OnStartRequest
// Syntax: void wxWebContentHandler::OnStartRequest(const wxString& url)
// (METHOD) wxWebContentHandler::OnStopRequest
// Syntax: void wxWebContentHandler::OnStartRequest(const wxString& url)
// (METHOD) wxWebContentHandler::OnData
// Syntax: void wxWebContentHandler::OnData(const unsigned char* buf,
// size_t size)
class wxWebContentHandler
{
public:
virtual ~wxWebContentHandler() { }
virtual bool CanHandleContent(const wxString& url,
const wxString& mime_type) = 0;
virtual void OnStartRequest(const wxString& url) { }
virtual void OnStopRequest() { }
virtual void OnData(const unsigned char* buf, size_t size) { }
};
WX_DEFINE_ARRAY_PTR(wxWebContentHandler*, wxWebContentHandlerPtrArray);
///////////////////////////////////////////////////////////////////////////////
// wxWebProgressBase class
///////////////////////////////////////////////////////////////////////////////
// (CLASS) wxWebProgressBase
// Category: Content
// Description: Used to get information about the progress of a download.
// Progress information receivers should derive from this class and
// override the desired methods.
// Remarks: The wxWebProgressBase class is used to get information about
// the progress of a download. Progress information receivers should
// derive from this class and override the desired methods.
// (METHOD) wxWebProgressBase::OnStartRequest
// Syntax: void wxWebProgressBase::Init(const wxString& url,
// const wxString& suggested_filename)
// (METHOD) wxWebProgressBase::Cancel
// Syntax: void wxWebProgressBase::Cancel()
// (METHOD) wxWebProgressBase::IsCancelled
// Syntax: bool wxWebProgressBase::IsCancelled()
// (METHOD) wxWebProgressBase::OnStart
// Syntax: void wxWebProgressBase::OnStart()
// (METHOD) wxWebProgressBase::OnFinish
// Syntax: void wxWebProgressBase::OnFinish()
// (METHOD) wxWebProgressBase::OnError
// Syntax: void wxWebProgressBase::OnError()
// (METHOD) wxWebProgressBase::OnProgressChange
// Syntax: void wxWebProgressBase::OnProgressChange(wxLongLong cur_progress,
// wxLongLong max_progress)
class wxWebProgressBase
{
public:
wxWebProgressBase()
{
m_cancelled = false;
}
virtual ~wxWebProgressBase() { }
virtual void Init(const wxString& url,
const wxString& suggested_filename) { }
virtual void Cancel() { m_cancelled = true; }
virtual bool IsCancelled() const { return m_cancelled; }
virtual void OnStart() { }
virtual void OnFinish() { }
virtual void OnError(const wxString& message) { }
virtual void OnProgressChange(wxLongLong cur_progress,
wxLongLong max_progress) { }
protected:
bool m_cancelled;
};
///////////////////////////////////////////////////////////////////////////////
// wxWebPostData class
///////////////////////////////////////////////////////////////////////////////
// (CLASS) wxWebPostData
// Category: Content
// Description: Used for building up a POST request, which can be issued
// through wxWebControl::openURI().
// Remarks: The wxWebPostData class is used for building up a POST request,
// which can be issued through wxWebControl::openURI().
// (METHOD) wxWebPostData::Add
// Syntax: void wxWebPostData::Add(const wxString& variable,
// const wxString& value)
// (METHOD) wxWebPostData::GetPostString
// Syntax: wxString wxWebPostData::GetPostString()
class wxWebPostData
{
public:
void Add(const wxString& variable, const wxString& value);
wxString GetPostString();
private:
wxArrayString m_vars;
wxArrayString m_values;
};
///////////////////////////////////////////////////////////////////////////////
// wxWebPreferences class
///////////////////////////////////////////////////////////////////////////////
// (CLASS) wxWebPreferences
// Category: Content
// Description: Used for configuring a the preferences of a web control.
// Remarks: The wxWebPreferences class is used for configuring the
// preferences of a web control.
// (METHOD) wxWebPreferences::GetBoolPref
// Syntax: bool wxWebPreferences::GetBoolPref(const wxString& branch_name, const wxString& name)
// (METHOD) wxWebPreferences::GetStringPref
// Syntax: wxString wxWebPreferences::GetStringPref(const wxString& branch_name, const wxString& name)
// (METHOD) wxWebPreferences::GetIntPref
// Syntax: int wxWebPreferences::GetIntPref(const wxString& branch_name, const wxString& name)
// (METHOD) wxWebPreferences::SetIntPref
// Syntax: void wxWebPreferences::SetIntPref(const wxString& branch_name, const wxString& name,
// int value)
// (METHOD) wxWebPreferences::SetStringPref
// Syntax: void wxWebPreferences::SetStringPref(const wxString& branch_name, const wxString& name,
// const wxString& value)
// (METHOD) wxWebPreferences::SetBoolPref
// Syntax: void wxWebPreferences::SetBoolPref(const wxString& branch_name, const wxString& name,
// bool value)
class wxWebPreferences
{
friend class wxWebControl;
private:
// private constructor - please use wxWebControl::GetWebPreferences()
wxWebPreferences();
public:
bool GetBoolPref(const wxString& branch_name, const wxString& name);
wxString GetStringPref(const wxString& branch_name, const wxString& name);
int GetIntPref(const wxString& branch_name, const wxString& name);
void SetIntPref(const wxString& branch_name, const wxString& name, int value);
void SetStringPref(const wxString& branch_name, const wxString& name, const wxString& value);
void SetBoolPref(const wxString& branch_name, const wxString& name, bool value);
};
///////////////////////////////////////////////////////////////////////////////
// wxWebControl class
///////////////////////////////////////////////////////////////////////////////
// (CLASS) wxWebControl
// Category: Control
// Derives: wxControl
// Description: Primary web browser control. Used for displaying and
// interacting with web content.
// Remarks: The wxWebControl class is the primary web browser control
// class; it is used for displaying and interacting with web content.
class wxWebFavIconProgress;
class MainURIListener;
class wxWebControl : public wxControl
{
friend class BrowserChrome;
friend class PromptService;
friend class WindowCreator;
friend class wxWebFavIconProgress;
public:
static bool InitEngine(const wxString& path);
static void InstallXRCHandler(wxXmlResource *res = NULL);
static bool AddContentHandler(wxWebContentHandler* handler, bool take_ownership = false);
static void AddPluginPath(const wxString& path);
static void SetProfilePath(const wxString& path);
static wxWebPreferences GetPreferences();
static void SetIgnoreCertErrors(bool ignore);
static bool GetIgnoreCertErrors();
static bool SaveRequest(
const wxString& uri,
const wxString& destination_path,
wxWebPostData* post_data = NULL,
wxWebProgressBase* listener = NULL);
static bool SaveRequestToString(
const wxString& uri,
wxString* result = NULL,
wxWebPostData* post_data = NULL,
wxWebProgressBase* listener = NULL);
static bool ClearCache();
public:
wxWebControl() : wxControl(), m_ok(false), m_disable_favicon_fetching(false) {};
wxWebControl(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize) {
Create(parent, id, pos, size);
}
bool Create(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);
~wxWebControl();
bool IsOk() const;
// navigation
void OpenURI(const wxString& uri,
unsigned int flags = wxWEB_LOAD_NORMAL,
wxWebPostData* post_data = NULL,
bool grab_focus = true);
bool SetContent(const wxString& strBaseURI, const wxString& strContent, const wxString& strContentType = wxT("text/html"));
wxString GetCurrentURI() const;
void GoForward();
void GoBack();
void Reload();
void Stop();
bool IsContentLoaded() const;
void SetHistoryMaxLength(int max_length);
void PurgeHistory();
// javascript
bool Execute(const wxString& js_code);
wxString ExecuteScriptWithResult(const wxString& js_code);
// printing
void Print(bool silent = false);
void SetPageSettings(double page_width, double page_height,
double left_margin, double right_margin, double top_margin, double bottom_margin);
void GetPageSettings(double* page_width, double* page_height,
double* left_margin, double* right_margin, double* top_margin, double* bottom_margin);
// view source
void ViewSource();
void ViewSource(wxWebControl* source_web_browser);
void ViewSource(const wxString& uri);
// save
bool SaveCurrent(const wxString& destination_path);
// zoom
void GetTextZoom(float* zoom);
void SetTextZoom(float zoom);
// find
bool Find(const wxString& text, unsigned int flags = 0);
// clipboard
bool CanCutSelection();
bool CanCopySelection();
bool CanCopyLinkLocation();
bool CanCopyImageLocation();
bool CanCopyImageContents();
bool CanPaste();
void CutSelection();
void CopySelection();
void CopyLinkLocation();
void CopyImageLocation();
void CopyImageContents();
void Paste();
void SelectAll();
void SelectNone();
// Needed to fix bugs where this steals focus and refuses to get it back.
void ForceKillFocus();
// other
wxImage GetFavIcon() const;
void DisableFavIconFetching();
wxDOMDocument GetDOMDocument();
private:
void OnSize(wxSizeEvent& evt);
void OnSetFocus(wxFocusEvent& evt);
void OnKillFocus(wxFocusEvent& evt);
void InitPrintSettings();
wxString GetCurrentLoadURI();
void ResetFavicon();
void FetchFavIcon(void* uri);
void OnFavIconFetched(const wxString& filename);
void OnDOMContentLoaded();
bool ExecuteJSCode(const wxString& js_code, wxString& result);
private:
EmbeddingPtrs* m_ptrs;
BrowserChrome* m_chrome;
bool m_ok;
wxWebContentHandlerPtrArray m_content_handlers;
wxWebContentHandlerPtrArray m_to_delete;
wxWebFavIconProgress* m_favicon_progress;
MainURIListener* m_main_uri_listener;
wxImage m_favicon;
bool m_favicon_fetched;
bool m_disable_favicon_fetching;
bool m_content_loaded;
DECLARE_EVENT_TABLE()
};
///////////////////////////////////////////////////////////////////////////////
// wxWebEvent class
///////////////////////////////////////////////////////////////////////////////
// (CLASS) wxWebEvent
// Category: Control
// Derives: wxNotifyEvent
// Description: Primary web browser event. Encapsulates information about
// web control state changes, status changes, and other web-related events.
// Remarks: The wxWebEvent class represents a web browser event. It
// encapsulates information about web control state changes, status changes,
// and other web-related events.
// (CONSTRUCTOR) wxWebEvent::wxWebEvent
// Description: Creates a new wxWebEvent object.
//
// Syntax: wxWebEvent::wxWebEvent(wxEventType command_type = wxEVT_NULL,
// int win_id = 0)
// Remarks: Creates a new wxWebEvent object.
// (METHOD) wxWebEvent::Clone
// Syntax: wxEvent *wxWebEvent::Clone() const
// (METHOD) wxWebEvent::GetState
// Syntax: int wxWebEvent::GetState()
// (METHOD) wxWebEvent::SetState
// Syntax: void wxWebEvent::SetState(int value)
// (METHOD) wxWebEvent::GetResult
// Syntax: int wxWebEvent::GetResult() const
// (METHOD) wxWebEvent::SetResult
// Syntax: void wxWebEvent::SetResult(int value)
// (METHOD) wxWebEvent::SetHref
// Syntax: void wxWebEvent::SetHref(const wxString& value)
// (METHOD) wxWebEvent::GetHref
// Syntax: wxString wxWebEvent::GetHref() const
// (METHOD) wxWebEvent::SetFilename
// Syntax: void wxWebEvent::SetFilename(const wxString& value)
// (METHOD) wxWebEvent::GetFilename
// Syntax: wxString wxWebEvent::GetFilename() const
// (METHOD) wxWebEvent::SetContentType
// Syntax: void wxWebEvent::SetContentType(const wxString& value)
// (METHOD) wxWebEvent::GetContentType
// Syntax: wxString wxWebEvent::GetContentType() const
// (METHOD) wxWebEvent::GetTargetNode
// Syntax: wxDOMNode wxWebEvent::GetTargetNode()
// (METHOD) wxWebEvent::GetDOMEvent
// Syntax: wxDOMEvent wxWebEvent::GetDOMEvent()
// (METHOD) wxWebEvent::GetCreateChromeFlags
// Syntax: int wxWebEvent::GetCreateChromeFlags() const
// (METHOD) wxWebEvent::SetCreateChromeFlags
// Syntax: void wxWebEvent::SetCreateChromeFlags(int value)
// (METHOD) wxWebEvent::SetCreateBrowser
// Syntax: void wxWebEvent::SetCreateBrowser(wxWebControl* ctrl)
// (METHOD) wxWebEvent::SetDownloadAction
// Syntax: void wxWebEvent::SetDownloadAction(int action)
// (METHOD) wxWebEvent::SetDownloadTarget
// Syntax: void wxWebEvent::SetDownloadTarget(const wxString& path)
// (METHOD) wxWebEvent::SetDownloadListener
// Syntax: void wxWebEvent::SetDownloadListener(wxWebProgressBase* listener)
// (METHOD) wxWebEvent::SetShouldHandle
// Syntax: void wxWebEvent::SetShouldHandle(bool value)
// (METHOD) wxWebEvent::SetOutputContentType
// Syntax: void wxWebEvent::SetOutputContentType(const wxString& value)
class WXDLLIMPEXP_AUI wxWebEvent : public wxNotifyEvent
{
public:
wxWebEvent(wxEventType command_type = wxEVT_NULL,
int win_id = 0)
: wxNotifyEvent(command_type, win_id)
{
m_state = wxWEB_STATE_NONE;
m_res = wxWEB_RESULT_NONE;
m_create_browser = NULL;
m_create_chrome_flags = 0;
m_download_action = 0;
m_download_listener = NULL;
m_should_handle = true;
}
#ifndef SWIG
wxWebEvent(const wxWebEvent& c) : wxNotifyEvent(c)
{
m_state = c.m_state;
m_res = c.m_res;
m_target_node = c.m_target_node;
m_dom_event = c.m_dom_event;
m_href = c.m_href;
m_create_browser = c.m_create_browser;
m_create_chrome_flags = c.m_create_chrome_flags;
m_filename = c.m_filename;
m_content_type = c.m_content_type;
m_output_content_type = c.m_output_content_type;
m_should_handle = c.m_should_handle;
m_download_action = c.m_download_action;
m_download_action_path = c.m_download_action_path;
m_download_listener = c.m_download_listener;
}
#endif
wxEvent *Clone() const { return new wxWebEvent(*this); }
int GetState() const { return m_state; }
void SetState(int value) { m_state = value; }
int GetResult() const { return m_res; }
void SetResult(int value) { m_res = value; }
void SetHref(const wxString& value) { m_href = value; }
wxString GetHref() const { return m_href; }
void SetFilename(const wxString& value) { m_filename = value; }
wxString GetFilename() const { return m_filename; }
void SetContentType(const wxString& value) { m_content_type = value; }
wxString GetContentType() const { return m_content_type; }
wxDOMNode GetTargetNode() { return m_target_node; }
wxDOMEvent GetDOMEvent() { return m_dom_event; }
int GetCreateChromeFlags() const { return m_create_chrome_flags; }
void SetCreateChromeFlags(int value) { m_create_chrome_flags = value; }
void SetCreateBrowser(wxWebControl* ctrl) { m_create_browser = ctrl; }
void SetDownloadAction(int action) { m_download_action = action; }
void SetDownloadTarget(const wxString& path) { m_download_action_path = path; }
void SetDownloadListener(wxWebProgressBase* listener) { m_download_listener = listener; }
void SetShouldHandle(bool value) { m_should_handle = value; }
void SetOutputContentType(const wxString& value) { m_output_content_type = value; }
int m_state;
int m_res;
wxDOMNode m_target_node;
wxDOMEvent m_dom_event;
wxString m_href;
wxString m_filename;
bool m_should_handle;
wxString m_content_type;
wxString m_output_content_type;
int m_create_chrome_flags;
wxWebControl* m_create_browser;
int m_download_action;
wxString m_download_action_path;
wxWebProgressBase* m_download_listener;
#ifndef SWIG
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWebEvent)
#endif
};
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_TITLECHANGE, 0)
//DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_CONTENTTYPE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_OPENURI, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_LOCATIONCHANGE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_DOMCONTENTLOADED, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_STATECHANGE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_STATUSCHANGE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_STATUSTEXT, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_SHOWCONTEXTMENU, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_LEFTDOWN, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_MIDDLEDOWN, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_RIGHTDOWN, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_LEFTUP, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_MIDDLEUP, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_RIGHTUP, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_LEFTDCLICK, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_MOUSEOVER, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_MOUSEOUT, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_DRAGDROP, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_CREATEBROWSER, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_INITDOWNLOAD, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_SHOULDHANDLECONTENT, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_FAVICONAVAILABLE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_WEB_DOMEVENT, 0)
END_DECLARE_EVENT_TYPES()
typedef void (wxEvtHandler::*wxWebEventFunction)(wxWebEvent&);
#define wxWebEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebEventFunction, &func)
#define EVT_WEB_OPENURI(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_OPENURI, winid, wxWebEventHandler(func))
#define EVT_WEB_TITLECHANGE(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_TITLECHANGE, winid, wxWebEventHandler(func))
#define EVT_WEB_LOCATIONCHANGE(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_LOCATIONCHANGE, winid, wxWebEventHandler(func))
#define EVT_WEB_DOMCONTENTLOADED(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_DOMCONTENTLOADED, winid, wxWebEventHandler(func))
#define EVT_WEB_STATECHANGE(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_STATECHANGE, winid, wxWebEventHandler(func))
#define EVT_WEB_STATUSCHANGE(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_STATUSCHANGE, winid, wxWebEventHandler(func))
#define EVT_WEB_STATUSTEXT(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_STATUSTEXT, winid, wxWebEventHandler(func))
#define EVT_WEB_SHOWCONTEXTMENU(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_SHOWCONTEXTMENU, winid, wxWebEventHandler(func))
#define EVT_WEB_LEFTDOWN(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_LEFTDOWN, winid, wxWebEventHandler(func))
#define EVT_WEB_MIDDLEDOWN(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_MIDDLEDOWN, winid, wxWebEventHandler(func))
#define EVT_WEB_RIGHTDOWN(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_RIGHTDOWN, winid, wxWebEventHandler(func))
#define EVT_WEB_LEFTUP(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_LEFTUP, winid, wxWebEventHandler(func))
#define EVT_WEB_MIDDLEUP(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_MIDDLEUP, winid, wxWebEventHandler(func))
#define EVT_WEB_RIGHTUP(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_RIGHTUP, winid, wxWebEventHandler(func))
#define EVT_WEB_LEFTDCLICK(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_LEFTDCLICK, winid, wxWebEventHandler(func))
#define EVT_WEB_DRAGDROP(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_DRAGDROP, winid, wxWebEventHandler(func))
#define EVT_WEB_CREATEBROWSER(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_CREATEBROWSER, winid, wxWebEventHandler(func))
#define EVT_WEB_INITDOWNLOAD(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_INITDOWNLOAD, winid, wxWebEventHandler(func))
#define EVT_WEB_SHOULDHANDLECONTENT(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_SHOULDHANDLECONTENT, winid, wxWebEventHandler(func))
#define EVT_WEB_FAVICONAVAILABLE(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_FAVICONAVAILABLE, winid, wxWebEventHandler(func))
#define EVT_WEB_DOMEVENT(winid, func) \
wx__DECLARE_EVT1(wxEVT_WEB_DOMEVENT, winid, wxWebEventHandler(func))
#endif