MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
webbrowser.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; version 2 of the
7  * License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19 
20 #ifndef _WebBROWSER_H_
21 #define _WebBROWSER_H_
22 
23 #include <mforms/view.h>
24 
25 namespace mforms {
26 
27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
28 #ifndef SWIG
29  class WebBrowser;
30 
31  struct MFORMS_EXPORT WebBrowserImplPtrs
32  {
33  bool (*create)(WebBrowser*);
34  void (*set_html)(WebBrowser*, const std::string&);
35  void (*navigate)(WebBrowser*, const std::string&);
36  std::string (*get_document_title)(WebBrowser*);
37  };
38 #endif
39 #endif
40 
45  class MFORMS_EXPORT WebBrowser : public View
46  {
47  public:
48  WebBrowser();
49 
51  void set_html(const std::string &path);
52 
54  void navigate(const std::string &url);
55 
57  std::string get_document_title();
58 
60  void set_link_click_handler(const boost::function<bool (const std::string &)> &slot);
61 
62 #ifndef SWIG
63 
67  boost::signals2::signal<void (const std::string&)>* signal_loaded() { return &_document_loaded; }
68 #ifndef DOXYGEN_SHOULD_SKIP_THIS
69  virtual void document_loaded(const std::string& actualUrl);
70 
71  // called when a URL is clicked. A return value of true means the link was
72  // handled and the URL should not be opened by the browser
73  bool on_link_clicked(const std::string& uri);
74 #endif
75 #endif
76  protected:
77  WebBrowserImplPtrs *_webbrowser_impl;
78  boost::signals2::signal<void (const std::string&)> _document_loaded;
79  boost::function<bool (const std::string&)> _handle_link_click;
80  };
81 };
82 
83 #endif // #fndef _WebBROWSER_H_
boost::function< bool(const std::string &)> _handle_link_click
Definition: webbrowser.h:79
#define MFORMS_EXPORT
Definition: base.h:33
boost::signals2::signal< void(const std::string &)> * signal_loaded()
Signal emitted when the document finishes loading.
Definition: webbrowser.h:67
HTML browser.
Definition: webbrowser.h:45
boost::signals2::signal< void(const std::string &)> _document_loaded
Definition: webbrowser.h:78
WebBrowserImplPtrs * _webbrowser_impl
Definition: webbrowser.h:77
MySQL Workbench 6.1 documentation