]>
Commit | Line | Data |
---|---|---|
5526e819 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: htmlwin.h | |
3 | // Purpose: wxHtmlWindow class for parsing & displaying HTML | |
4 | // Author: Vaclav Slavik | |
69941f05 | 5 | // RCS-ID: $Id$ |
5526e819 | 6 | // Copyright: (c) 1999 Vaclav Slavik |
65571936 | 7 | // Licence: wxWindows licence |
5526e819 VS |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
69941f05 VS |
10 | #ifndef _WX_HTMLWIN_H_ |
11 | #define _WX_HTMLWIN_H_ | |
5526e819 | 12 | |
5526e819 VS |
13 | #include "wx/defs.h" |
14 | #if wxUSE_HTML | |
15 | ||
69941f05 VS |
16 | #include "wx/window.h" |
17 | #include "wx/scrolwin.h" | |
18 | #include "wx/config.h" | |
33f81fc7 | 19 | #include "wx/stopwatch.h" |
69941f05 VS |
20 | #include "wx/html/winpars.h" |
21 | #include "wx/html/htmlcell.h" | |
22 | #include "wx/filesys.h" | |
23 | #include "wx/html/htmlfilt.h" | |
903972f9 | 24 | #include "wx/filename.h" |
e05a12c9 | 25 | #include "wx/bitmap.h" |
5526e819 | 26 | |
bfb9ee96 | 27 | class wxHtmlProcessor; |
892aeafc VS |
28 | class wxHtmlWinModule; |
29 | class wxHtmlHistoryArray; | |
30 | class wxHtmlProcessorList; | |
6acba9a7 | 31 | class WXDLLIMPEXP_HTML wxHtmlWinAutoScrollTimer; |
5526e819 | 32 | |
6cc4e6b8 VS |
33 | |
34 | // wxHtmlWindow flags: | |
35 | #define wxHW_SCROLLBAR_NEVER 0x0002 | |
36 | #define wxHW_SCROLLBAR_AUTO 0x0004 | |
f65a786f VS |
37 | #define wxHW_NO_SELECTION 0x0008 |
38 | ||
39 | #define wxHW_DEFAULT_STYLE wxHW_SCROLLBAR_AUTO | |
40 | ||
bc55e31b | 41 | /// Enum for wxHtmlWindow::OnOpeningURL and wxHtmlWindowInterface::OnOpeningURL |
6cc4e6b8 VS |
42 | enum wxHtmlOpeningStatus |
43 | { | |
bc55e31b | 44 | /// Open the requested URL |
6cc4e6b8 | 45 | wxHTML_OPEN, |
bc55e31b | 46 | /// Do not open the URL |
6cc4e6b8 | 47 | wxHTML_BLOCK, |
bc55e31b | 48 | /// Redirect to another URL (returned from OnOpeningURL) |
6cc4e6b8 VS |
49 | wxHTML_REDIRECT |
50 | }; | |
51 | ||
bc55e31b VS |
52 | /** |
53 | Abstract interface to a HTML rendering window (such as wxHtmlWindow or | |
54 | wxHtmlListBox) that is passed to wxHtmlWinParser. It encapsulates all | |
55 | communication from the parser to the window. | |
56 | */ | |
57 | class WXDLLIMPEXP_HTML wxHtmlWindowInterface | |
58 | { | |
59 | public: | |
60 | /// Ctor | |
61 | wxHtmlWindowInterface() {} | |
62 | virtual ~wxHtmlWindowInterface() {} | |
63 | ||
64 | /** | |
65 | Called by the parser to set window's title to given text. | |
66 | */ | |
67 | virtual void SetHTMLWindowTitle(const wxString& title) = 0; | |
68 | ||
69 | /** | |
70 | Called when a link is clicked. | |
71 | ||
72 | @param link information about the clicked link | |
73 | */ | |
74 | virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) = 0; | |
75 | ||
76 | /** | |
77 | Called when the parser needs to open another URL (e.g. an image). | |
78 | ||
79 | @param type Type of the URL request (e.g. image) | |
80 | @param url URL the parser wants to open | |
81 | @param redirect If the return value is wxHTML_REDIRECT, then the | |
82 | URL to redirect to will be stored in this variable | |
83 | (the pointer must never be NULL) | |
84 | ||
85 | @return indicator of how to treat the request | |
86 | */ | |
87 | virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, | |
88 | const wxString& url, | |
89 | wxString *redirect) const = 0; | |
90 | ||
91 | /** | |
92 | Converts coordinates @a pos relative to given @a cell to | |
93 | physical coordinates in the window. | |
94 | */ | |
95 | virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, | |
96 | const wxPoint& pos) const = 0; | |
97 | ||
98 | /// Returns the window used for rendering (may be NULL). | |
99 | virtual wxWindow* GetHTMLWindow() = 0; | |
100 | ||
101 | /// Returns background colour to use by default. | |
102 | virtual wxColour GetHTMLBackgroundColour() const = 0; | |
103 | ||
104 | /// Sets window's background to colour @a clr. | |
105 | virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0; | |
106 | ||
107 | /// Sets window's background to given bitmap. | |
108 | virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) = 0; | |
109 | ||
110 | /// Sets status bar text. | |
111 | virtual void SetHTMLStatusText(const wxString& text) = 0; | |
88a1b648 VS |
112 | |
113 | /// Type of mouse cursor | |
114 | enum HTMLCursor | |
115 | { | |
116 | /// Standard mouse cursor (typically an arrow) | |
117 | HTMLCursor_Default, | |
118 | /// Cursor shown over links | |
119 | HTMLCursor_Link, | |
120 | /// Cursor shown over selectable text | |
121 | HTMLCursor_Text | |
122 | }; | |
123 | ||
124 | /** | |
125 | Returns mouse cursor of given @a type. | |
126 | */ | |
127 | virtual wxCursor GetHTMLCursor(HTMLCursor type) const = 0; | |
bc55e31b VS |
128 | }; |
129 | ||
130 | /** | |
131 | Helper class that implements part of mouse handling for wxHtmlWindow and | |
132 | wxHtmlListBox. Cursor changes and clicking on links are handled, text | |
133 | selection is not. | |
134 | */ | |
135 | class WXDLLIMPEXP_HTML wxHtmlWindowMouseHelper | |
136 | { | |
31297dbb | 137 | protected: |
bc55e31b VS |
138 | /** |
139 | Ctor. | |
140 | ||
141 | @param iface Interface to the owner window. | |
142 | */ | |
143 | wxHtmlWindowMouseHelper(wxHtmlWindowInterface *iface); | |
144 | ||
432ea998 VZ |
145 | /** |
146 | Virtual dtor. | |
147 | ||
148 | It is not really needed in this case but at leats it prevents gcc from | |
149 | complaining about its absence. | |
150 | */ | |
151 | virtual ~wxHtmlWindowMouseHelper() { } | |
152 | ||
bc55e31b VS |
153 | /// Returns true if the mouse moved since the last call to HandleIdle |
154 | bool DidMouseMove() const { return m_tmpMouseMoved; } | |
155 | ||
156 | /// Call this from EVT_MOTION event handler | |
157 | void HandleMouseMoved(); | |
158 | ||
159 | /** | |
160 | Call this from EVT_LEFT_UP handler (or, alternatively, EVT_LEFT_DOWN). | |
161 | ||
162 | @param rootCell HTML cell inside which the click occured. This doesn't | |
163 | have to be the leaf cell, it can be e.g. toplevel | |
164 | container, but the mouse must be inside the container's | |
165 | area, otherwise the event would be ignored. | |
166 | @param pos Mouse position in coordinates relative to @a cell | |
167 | @param event The event that triggered the call | |
168 | */ | |
169 | bool HandleMouseClick(wxHtmlCell *rootCell, | |
170 | const wxPoint& pos, const wxMouseEvent& event); | |
171 | ||
172 | /** | |
173 | Call this from OnInternalIdle of the HTML displaying window. Handles | |
174 | mouse movements and must be used together with HandleMouseMoved. | |
175 | ||
176 | @param rootCell HTML cell inside which the click occured. This doesn't | |
177 | have to be the leaf cell, it can be e.g. toplevel | |
178 | container, but the mouse must be inside the container's | |
179 | area, otherwise the event would be ignored. | |
180 | @param pos Current mouse position in coordinates relative to | |
181 | @a cell | |
182 | */ | |
183 | void HandleIdle(wxHtmlCell *rootCell, const wxPoint& pos); | |
184 | ||
185 | /** | |
186 | Called by HandleIdle when the mouse hovers over a cell. Default | |
187 | behaviour is to do nothing. | |
188 | ||
189 | @param cell the cell the mouse is over | |
190 | @param x, y coordinates of mouse relative to the cell | |
191 | */ | |
192 | virtual void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y); | |
193 | ||
194 | /** | |
195 | Called by HandleMouseClick when the user clicks on a cell. | |
196 | Default behavior is to call wxHtmlWindowInterface::OnLinkClicked() | |
197 | if this cell corresponds to a hypertext link. | |
198 | ||
199 | @param cell the cell the mouse is over | |
200 | @param x, y coordinates of mouse relative to the cell | |
201 | @param event The event that triggered the call | |
202 | ||
203 | ||
204 | @return true if a link was clicked, false otherwise. | |
205 | */ | |
206 | virtual bool OnCellClicked(wxHtmlCell *cell, | |
207 | wxCoord x, wxCoord y, | |
208 | const wxMouseEvent& event); | |
209 | ||
210 | protected: | |
211 | // this flag indicates if the mouse moved (used by HandleIdle) | |
212 | bool m_tmpMouseMoved; | |
213 | // contains last link name | |
214 | wxHtmlLinkInfo *m_tmpLastLink; | |
215 | // contains the last (terminal) cell which contained the mouse | |
216 | wxHtmlCell *m_tmpLastCell; | |
217 | ||
218 | private: | |
219 | wxHtmlWindowInterface *m_interface; | |
220 | }; | |
221 | ||
f65a786f | 222 | // ---------------------------------------------------------------------------- |
5526e819 | 223 | // wxHtmlWindow |
3ef01ce5 | 224 | // (This is probably the only class you will directly use.) |
5526e819 | 225 | // Purpose of this class is to display HTML page (either local |
f65a786f VS |
226 | // file or downloaded via HTTP protocol) in a window. Width of |
227 | // window is constant - given in constructor - virtual height | |
228 | // is changed dynamicly depending on page size. Once the | |
229 | // window is created you can set it's content by calling | |
3ef01ce5 | 230 | // SetPage(text) or LoadPage(filename). |
f65a786f | 231 | // ---------------------------------------------------------------------------- |
5526e819 | 232 | |
bc55e31b VS |
233 | class WXDLLIMPEXP_HTML wxHtmlWindow : public wxScrolledWindow, |
234 | public wxHtmlWindowInterface, | |
31297dbb | 235 | public wxHtmlWindowMouseHelper |
5526e819 VS |
236 | { |
237 | DECLARE_DYNAMIC_CLASS(wxHtmlWindow) | |
66806a0b | 238 | friend class wxHtmlWinModule; |
5526e819 | 239 | |
97494971 | 240 | public: |
bc55e31b | 241 | wxHtmlWindow() : wxHtmlWindowMouseHelper(this) { Init(); } |
6953da00 | 242 | wxHtmlWindow(wxWindow *parent, wxWindowID id = wxID_ANY, |
bfb9ee96 | 243 | const wxPoint& pos = wxDefaultPosition, |
97494971 | 244 | const wxSize& size = wxDefaultSize, |
f65a786f | 245 | long style = wxHW_DEFAULT_STYLE, |
4f417130 | 246 | const wxString& name = wxT("htmlWindow")) |
bc55e31b | 247 | : wxHtmlWindowMouseHelper(this) |
4f417130 VS |
248 | { |
249 | Init(); | |
250 | Create(parent, id, pos, size, style, name); | |
251 | } | |
97494971 VS |
252 | ~wxHtmlWindow(); |
253 | ||
6953da00 | 254 | bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, |
4f417130 VS |
255 | const wxPoint& pos = wxDefaultPosition, |
256 | const wxSize& size = wxDefaultSize, | |
257 | long style = wxHW_SCROLLBAR_AUTO, | |
258 | const wxString& name = wxT("htmlWindow")); | |
259 | ||
97494971 VS |
260 | // Set HTML page and display it. !! source is HTML document itself, |
261 | // it is NOT address/filename of HTML document. If you want to | |
262 | // specify document location, use LoadPage() istead | |
3103e8a9 | 263 | // Return value : false if an error occurred, true otherwise |
04f109ec | 264 | virtual bool SetPage(const wxString& source); |
574c939e | 265 | |
39029898 VS |
266 | // Append to current page |
267 | bool AppendToPage(const wxString& source); | |
97494971 VS |
268 | |
269 | // Load HTML page from given location. Location can be either | |
270 | // a) /usr/wxGTK2/docs/html/wx.htm | |
271 | // b) http://www.somewhere.uk/document.htm | |
272 | // c) ftp://ftp.somesite.cz/pub/something.htm | |
273 | // In case there is no prefix (http:,ftp:), the method | |
274 | // will try to find it itself (1. local file, then http or ftp) | |
275 | // After the page is loaded, the method calls SetPage() to display it. | |
276 | // Note : you can also use path relative to previously loaded page | |
277 | // Return value : same as SetPage | |
38caaa61 | 278 | virtual bool LoadPage(const wxString& location); |
97494971 | 279 | |
903972f9 VS |
280 | // Loads HTML page from file |
281 | bool LoadFile(const wxFileName& filename); | |
282 | ||
97494971 VS |
283 | // Returns full location of opened page |
284 | wxString GetOpenedPage() const {return m_OpenedPage;} | |
285 | // Returns anchor within opened page | |
286 | wxString GetOpenedAnchor() const {return m_OpenedAnchor;} | |
287 | // Returns <TITLE> of opened page or empty string otherwise | |
288 | wxString GetOpenedPageTitle() const {return m_OpenedPageTitle;} | |
289 | ||
290 | // Sets frame in which page title will be displayed. Format is format of | |
291 | // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s | |
292 | void SetRelatedFrame(wxFrame* frame, const wxString& format); | |
293 | wxFrame* GetRelatedFrame() const {return m_RelatedFrame;} | |
294 | ||
67a99992 | 295 | #if wxUSE_STATUSBAR |
97494971 VS |
296 | // After(!) calling SetRelatedFrame, this sets statusbar slot where messages |
297 | // will be displayed. Default is -1 = no messages. | |
298 | void SetRelatedStatusBar(int bar); | |
67a99992 | 299 | #endif // wxUSE_STATUSBAR |
97494971 VS |
300 | |
301 | // Sets fonts to be used when displaying HTML page. | |
fbfb8bcc | 302 | void SetFonts(const wxString& normal_face, const wxString& fixed_face, |
4eecf115 | 303 | const int *sizes = NULL); |
97494971 | 304 | |
10e5c7ea VS |
305 | // Sets font sizes to be relative to the given size or the system |
306 | // default size; use either specified or default font | |
307 | void SetStandardFonts(int size = -1, | |
308 | const wxString& normal_face = wxEmptyString, | |
309 | const wxString& fixed_face = wxEmptyString); | |
6953da00 | 310 | |
97494971 VS |
311 | // Sets space between text and window borders. |
312 | void SetBorders(int b) {m_Borders = b;} | |
313 | ||
97e490f8 VZ |
314 | // Sets the bitmap to use for background (currnetly it will be tiled, |
315 | // when/if we have CSS support we could add other possibilities...) | |
316 | void SetBackgroundImage(const wxBitmap& bmpBg) { m_bmpBg = bmpBg; } | |
317 | ||
97494971 VS |
318 | // Saves custom settings into cfg config. it will use the path 'path' |
319 | // if given, otherwise it will save info into currently selected path. | |
320 | // saved values : things set by SetFonts, SetBorders. | |
321 | virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); | |
322 | // ... | |
323 | virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); | |
324 | ||
325 | // Goes to previous/next page (in browsing history) | |
6953da00 | 326 | // Returns true if successful, false otherwise |
97494971 VS |
327 | bool HistoryBack(); |
328 | bool HistoryForward(); | |
329 | bool HistoryCanBack(); | |
330 | bool HistoryCanForward(); | |
331 | // Resets history | |
332 | void HistoryClear(); | |
333 | ||
334 | // Returns pointer to conteiners/cells structure. | |
335 | // It should be used ONLY when printing | |
336 | wxHtmlContainerCell* GetInternalRepresentation() const {return m_Cell;} | |
337 | ||
338 | // Adds input filter | |
339 | static void AddFilter(wxHtmlFilter *filter); | |
340 | ||
6cc4e6b8 VS |
341 | // Returns a pointer to the parser. |
342 | wxHtmlWinParser *GetParser() const { return m_Parser; } | |
343 | ||
344 | // Adds HTML processor to this instance of wxHtmlWindow: | |
345 | void AddProcessor(wxHtmlProcessor *processor); | |
346 | // Adds HTML processor to wxHtmlWindow class as whole: | |
347 | static void AddGlobalProcessor(wxHtmlProcessor *processor); | |
348 | ||
97e490f8 | 349 | |
6cc4e6b8 VS |
350 | // -- Callbacks -- |
351 | ||
352 | // Sets the title of the window | |
353 | // (depending on the information passed to SetRelatedFrame() method) | |
354 | virtual void OnSetTitle(const wxString& title); | |
355 | ||
f6010d8f | 356 | // Called when user clicked on hypertext link. Default behavior is to |
97494971 VS |
357 | // call LoadPage(loc) |
358 | virtual void OnLinkClicked(const wxHtmlLinkInfo& link); | |
574c939e KB |
359 | |
360 | // Called when wxHtmlWindow wants to fetch data from an URL (e.g. when | |
361 | // loading a page or loading an image). The data are downloaded if and only if | |
6953da00 | 362 | // OnOpeningURL returns true. If OnOpeningURL returns wxHTML_REDIRECT, |
6cc4e6b8 | 363 | // it must set *redirect to the new URL |
574c939e KB |
364 | virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType WXUNUSED(type), |
365 | const wxString& WXUNUSED(url), | |
366 | wxString *WXUNUSED(redirect)) const | |
6cc4e6b8 | 367 | { return wxHTML_OPEN; } |
6953da00 | 368 | |
15622068 VZ |
369 | #if wxUSE_CLIPBOARD |
370 | // Helper functions to select parts of page: | |
371 | void SelectWord(const wxPoint& pos); | |
372 | void SelectLine(const wxPoint& pos); | |
373 | void SelectAll(); | |
6953da00 | 374 | |
5d3f80be VS |
375 | // Convert selection to text: |
376 | wxString SelectionToText() { return DoSelectionToText(m_selection); } | |
377 | ||
378 | // Converts current page to text: | |
379 | wxString ToText(); | |
97e490f8 | 380 | #endif // wxUSE_CLIPBOARD |
6953da00 | 381 | |
6f02a879 VZ |
382 | virtual void OnInternalIdle(); |
383 | ||
88a1b648 VS |
384 | /// Returns standard HTML cursor as used by wxHtmlWindow |
385 | static wxCursor GetDefaultHTMLCursor(HTMLCursor type); | |
bc55e31b | 386 | |
97494971 | 387 | protected: |
4f417130 VS |
388 | void Init(); |
389 | ||
97494971 VS |
390 | // Scrolls to anchor of this name. (Anchor is #news |
391 | // or #features etc. it is part of address sometimes: | |
392 | // http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html#news) | |
6953da00 | 393 | // Return value : true if anchor exists, false otherwise |
97494971 VS |
394 | bool ScrollToAnchor(const wxString& anchor); |
395 | ||
bfb9ee96 | 396 | // Prepares layout (= fill m_PosX, m_PosY for fragments) based on |
97494971 VS |
397 | // actual size of window. This method also setup scrollbars |
398 | void CreateLayout(); | |
399 | ||
1338c59a VS |
400 | void OnEraseBackground(wxEraseEvent& event); |
401 | void OnPaint(wxPaintEvent& event); | |
97494971 | 402 | void OnSize(wxSizeEvent& event); |
31d8b4ad | 403 | void OnMouseMove(wxMouseEvent& event); |
adf2eb2d VS |
404 | void OnMouseDown(wxMouseEvent& event); |
405 | void OnMouseUp(wxMouseEvent& event); | |
61233023 VS |
406 | #if wxUSE_CLIPBOARD |
407 | void OnKeyUp(wxKeyEvent& event); | |
31eefb99 | 408 | void OnDoubleClick(wxMouseEvent& event); |
61233023 | 409 | void OnCopy(wxCommandEvent& event); |
1338c59a VS |
410 | void OnMouseEnter(wxMouseEvent& event); |
411 | void OnMouseLeave(wxMouseEvent& event); | |
63e819f2 | 412 | void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); |
d659d703 | 413 | #endif // wxUSE_CLIPBOARD |
97494971 VS |
414 | |
415 | // Returns new filter (will be stored into m_DefaultFilter variable) | |
416 | virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;} | |
417 | ||
892aeafc | 418 | // cleans static variables |
97494971 | 419 | static void CleanUpStatics(); |
97494971 | 420 | |
f65a786f VS |
421 | // Returns true if text selection is enabled (wxClipboard must be available |
422 | // and wxHW_NO_SELECTION not used) | |
423 | bool IsSelectionEnabled() const; | |
424 | ||
61233023 VS |
425 | enum ClipboardType |
426 | { | |
427 | Primary, | |
428 | Secondary | |
429 | }; | |
d659d703 VZ |
430 | |
431 | // Copies selection to clipboard if the clipboard support is available | |
4bdce112 VZ |
432 | // |
433 | // returns true if anything was copied to clipboard, false otherwise | |
5de65c69 | 434 | bool CopySelection(ClipboardType t = Secondary); |
0994d968 | 435 | |
d659d703 | 436 | #if wxUSE_CLIPBOARD |
0994d968 | 437 | // Automatic scrolling during selection: |
1338c59a | 438 | void StopAutoScrolling(); |
d659d703 | 439 | #endif // wxUSE_CLIPBOARD |
61233023 | 440 | |
977b867e | 441 | wxString DoSelectionToText(wxHtmlSelection *sel); |
6953da00 | 442 | |
73de5077 | 443 | private: |
bc55e31b VS |
444 | // wxHtmlWindowInterface methods: |
445 | virtual void SetHTMLWindowTitle(const wxString& title); | |
446 | virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link); | |
447 | virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, | |
448 | const wxString& url, | |
449 | wxString *redirect) const; | |
450 | virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, | |
451 | const wxPoint& pos) const; | |
452 | virtual wxWindow* GetHTMLWindow(); | |
453 | virtual wxColour GetHTMLBackgroundColour() const; | |
454 | virtual void SetHTMLBackgroundColour(const wxColour& clr); | |
455 | virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg); | |
456 | virtual void SetHTMLStatusText(const wxString& text); | |
88a1b648 | 457 | virtual wxCursor GetHTMLCursor(HTMLCursor type) const; |
bc55e31b | 458 | |
73de5077 VS |
459 | // implementation of SetPage() |
460 | bool DoSetPage(const wxString& source); | |
461 | ||
462 | protected: | |
1338c59a VS |
463 | // This is pointer to the first cell in parsed data. (Note: the first cell |
464 | // is usually top one = all other cells are sub-cells of this one) | |
97494971 | 465 | wxHtmlContainerCell *m_Cell; |
892aeafc VS |
466 | // parser which is used to parse HTML input. |
467 | // Each wxHtmlWindow has it's own parser because sharing one global | |
468 | // parser would be problematic (because of reentrancy) | |
97494971 | 469 | wxHtmlWinParser *m_Parser; |
892aeafc | 470 | // contains name of actualy opened page or empty string if no page opened |
97494971 | 471 | wxString m_OpenedPage; |
892aeafc | 472 | // contains name of current anchor within m_OpenedPage |
97494971 | 473 | wxString m_OpenedAnchor; |
892aeafc | 474 | // contains title of actualy opened page or empty string if no <TITLE> tag |
97494971 | 475 | wxString m_OpenedPageTitle; |
892aeafc | 476 | // class for opening files (file system) |
97494971 | 477 | wxFileSystem* m_FS; |
97494971 VS |
478 | |
479 | wxFrame *m_RelatedFrame; | |
480 | wxString m_TitleFormat; | |
67a99992 | 481 | #if wxUSE_STATUSBAR |
892aeafc VS |
482 | // frame in which page title should be displayed & number of it's statusbar |
483 | // reserved for usage with this html window | |
97494971 | 484 | int m_RelatedStatusBar; |
67a99992 | 485 | #endif // wxUSE_STATUSBAR |
97494971 | 486 | |
892aeafc VS |
487 | // borders (free space between text and window borders) |
488 | // defaults to 10 pixels. | |
97494971 | 489 | int m_Borders; |
97494971 | 490 | |
adf2eb2d VS |
491 | // current text selection or NULL |
492 | wxHtmlSelection *m_selection; | |
493 | ||
494 | // true if the user is dragging mouse to select text | |
495 | bool m_makingSelection; | |
496 | ||
1338c59a | 497 | #if wxUSE_CLIPBOARD |
0994d968 VS |
498 | // time of the last doubleclick event, used to detect tripleclicks |
499 | // (tripleclicks are used to select whole line): | |
33f81fc7 | 500 | wxMilliClock_t m_lastDoubleClick; |
0994d968 VS |
501 | |
502 | // helper class to automatically scroll the window if the user is selecting | |
503 | // text and the mouse leaves wxHtmlWindow: | |
1338c59a | 504 | wxHtmlWinAutoScrollTimer *m_timerAutoScroll; |
d659d703 | 505 | #endif // wxUSE_CLIPBOARD |
1338c59a | 506 | |
97494971 | 507 | private: |
1338c59a VS |
508 | // window content for double buffered rendering: |
509 | wxBitmap *m_backBuffer; | |
d659d703 | 510 | |
97e490f8 VZ |
511 | // background image, may be invalid |
512 | wxBitmap m_bmpBg; | |
513 | ||
adf2eb2d VS |
514 | // variables used when user is selecting text |
515 | wxPoint m_tmpSelFromPos; | |
516 | wxHtmlCell *m_tmpSelFromCell; | |
d659d703 | 517 | |
892aeafc VS |
518 | // if >0 contents of the window is not redrawn |
519 | // (in order to avoid ugly blinking) | |
97494971 | 520 | int m_tmpCanDrawLocks; |
97494971 | 521 | |
892aeafc | 522 | // list of HTML filters |
97494971 | 523 | static wxList m_Filters; |
892aeafc | 524 | // this filter is used when no filter is able to read some file |
97494971 | 525 | static wxHtmlFilter *m_DefaultFilter; |
97494971 | 526 | |
518ba663 VZ |
527 | // html processors array: |
528 | wxHtmlProcessorList *m_Processors; | |
529 | static wxHtmlProcessorList *m_GlobalProcessors; | |
530 | ||
892aeafc | 531 | // browser history |
518ba663 | 532 | wxHtmlHistoryArray *m_History; |
97494971 | 533 | int m_HistoryPos; |
892aeafc | 534 | // if this FLAG is false, items are not added to history |
97494971 | 535 | bool m_HistoryOn; |
bfb9ee96 | 536 | |
518ba663 VZ |
537 | // a flag set if we need to erase background in OnPaint() (otherwise this |
538 | // is supposed to have been done in OnEraseBackground()) | |
539 | bool m_eraseBgInOnPaint; | |
5526e819 | 540 | |
88a1b648 VS |
541 | // standard mouse cursors |
542 | static wxCursor *ms_cursorLink; | |
543 | static wxCursor *ms_cursorText; | |
544 | ||
69941f05 | 545 | DECLARE_EVENT_TABLE() |
22f3361e | 546 | DECLARE_NO_COPY_CLASS(wxHtmlWindow) |
69941f05 | 547 | }; |
5526e819 VS |
548 | |
549 | ||
d659d703 | 550 | #endif // wxUSE_HTML |
69941f05 VS |
551 | |
552 | #endif // _WX_HTMLWIN_H_ | |
19193a2c | 553 |