File: html.h

package info (click to toggle)
mysql-gui-tools 5.0r14%2BopenSUSE-2.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 116,956 kB
  • ctags: 48,715
  • sloc: sql: 341,918; pascal: 276,698; ansic: 91,020; cpp: 90,451; objc: 33,236; sh: 29,481; yacc: 10,756; xml: 10,589; java: 10,079; php: 2,806; python: 2,092; makefile: 1,783; perl: 4
file content (133 lines) | stat: -rw-r--r-- 3,578 bytes parent folder | download | duplicates (3)
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
/* Copyright (C) 2004 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#ifndef _HTML_H_
#define _HTML_H_

// quick&dirty wrapper for gtkhtml

extern "C" {
#include "config.h"
#ifndef WITH_GTKHTML2
#include <gtkhtml/gtkhtml.h>
#else
#include <libgtkhtml/util/htmlstream.h>
#endif
};
#include <gtkmm/layout.h>

#ifdef WITH_GTKHTML2
typedef struct _HtmlView GtkHTML;
typedef struct _HtmlViewClass GtkHTMLClass;
#else
typedef struct _GtkHTML GtkHTML;
typedef struct _GtkHTMLClass GtkHTMLClass;
#endif

namespace Gtk {

class HTML_Class;
  
class HTML : public Gtk::Layout {
  public:
    typedef HTML CppObjectType;
    typedef HTML_Class CppClassType;
//    typedef GtkHTML BaseObjectType;
//    typedef GtkHTMLClass BaseClassType;
    virtual ~HTML();
    
#ifdef WITH_GTKHTML2
    typedef HtmlStream* Stream;
#else
    typedef struct _GtkHTMLStream* Stream;
#endif
    

    typedef sigc::signal3<void,HTML*,const std::string&,Stream> URLRequestedSignal;
    
  private:
    friend class HTML_Class;
    static CppClassType html_class_;

    std::list<std::string> _search_path;
    
    URLRequestedSignal _signal_url_requested;
    
    // noncopyable
    HTML(const HTML&);
    HTML& operator=(const HTML&);

    void setup();
    
#ifdef WITH_GTKHTML2
    static void url_requested(GtkHTML *html, const char *url, Stream stream,
                              gpointer data);
#else
    static void url_requested(GtkHTML *html, const char *url, 
                              Stream handle, gpointer data);
#endif
  protected:
    explicit HTML(const Glib::ConstructParams& construct_params);
    explicit HTML(GtkHTML* castitem);
    
    std::string find_file(const std::string &file);

    HTML();
  public:
    static GType get_type()      G_GNUC_CONST;
    static GType get_base_type() G_GNUC_CONST;

    GtkHTML*       gobj()       { return reinterpret_cast<GtkHTML*>(gobject_); }
                                                                              
    const GtkHTML* gobj() const { return reinterpret_cast<GtkHTML*>(gobject_); }

  public:

    static HTML *create();
    
    void add_search_path(const std::string &path);
    
    void load_empty();
    void load_from_string(const Glib::ustring &str);
    
    bool jump_to_anchor(const Glib::ustring &str);
    
    Stream begin();
    void write(Stream stream, const Glib::ustring &str);
    void write(Stream stream, const char *data, unsigned int size);
    void end(Stream stream);

    URLRequestedSignal signal_url_requested() { return _signal_url_requested; };
};

}


/*
namespace Glib
{
#ifdef WITH_GTKHTML2
  Gtk::HTML* wrap(GtkHTML* object, bool take_copy = false);
#else
  Gtk::HTML* wrap(GtkHTML* object, bool take_copy = false);
#endif
}
*/

void html_init();


#endif /* _HTML_H_ */