*/
#define wxUSE_MINIFRAME 0
+/*
+ * wxHTML
+ */
+#define wxUSE_HTML 0
+
/*
* Disable this if your compiler can't cope
* with omission of prototype parameters.
DEFAULT_wxUSE_STARTUP_TIPS=no
DEFAULT_wxUSE_PROGRESSDLG=no
DEFAULT_wxUSE_MINIFRAME=no
+ DEFAULT_wxUSE_HTML=no
DEFAULT_wxUSE_VALIDATORS=yes
DEFAULT_wxUSE_ACCEL=no
DEFAULT_wxUSE_STARTUP_TIPS=yes
DEFAULT_wxUSE_PROGRESSDLG=yes
DEFAULT_wxUSE_MINIFRAME=yes
+ DEFAULT_wxUSE_HTML=no
DEFAULT_wxUSE_VALIDATORS=yes
DEFAULT_wxUSE_ACCEL=yes
WX_ARG_ENABLE(tipdlg, [ --enable-tipdlg use startup tips], wxUSE_STARTUP_TIPS)
WX_ARG_ENABLE(progressdlg, [ --enable-progressdlg use wxProgressDialog], wxUSE_PROGRESSDLG)
WX_ARG_ENABLE(miniframe, [ --enable-miniframe use wxMiniFrame class], wxUSE_MINIFRAME)
+WX_ARG_ENABLE(html, [ --enable-html use wxHTML sub-library], wxUSE_HTML)
WX_ARG_ENABLE(tooltips, [ --enable-tooltips use wxToolTip class], wxUSE_TOOLTIPS)
WX_ARG_ENABLE(splines, [ --enable-splines use spline drawing code], wxUSE_SPLINES)
WX_ARG_ENABLE(validators, [ --enable-validators use wxValidator and derived classes], wxUSE_VALIDATORS)
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS minifram"
fi
+if test "$wxUSE_HTML" = "yes"; then
+ AC_DEFINE(wxUSE_HTML)
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html"
+fi
+
if test "$wxUSE_VALIDATORS" = "yes"; then
AC_DEFINE(wxUSE_VALIDATORS)
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS validate"
samples/validate/Makefile
samples/wxpoem/Makefile
samples/wxsocket/Makefile
+ samples/html/Makefile
+ samples/html/about/Makefile
+ samples/html/help/Makefile
+ samples/html/test/Makefile
+ samples/html/printing/Makefile
+ samples/html/widget/Makefile
+ samples/html/virtual/Makefile
+ samples/html/zip/Makefile
],
[
chmod +x wx-config
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: busyinfo.h
+// Purpose: Information window (when app is busy)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __INFOWIN_H__
+#define __INFOWIN_H__
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+
+#include <wx/dialog.h>
+
+
+
+
+class wxInfoFrame : public wxFrame
+{
+ public:
+ wxInfoFrame(wxWindow *parent, const wxString& message);
+};
+
+
+//--------------------------------------------------------------------------------
+// wxBusyInfo
+// Displays progress information
+// Can be used in exactly same way as wxBusyCursor
+//--------------------------------------------------------------------------------
+
+class wxBusyInfo : public wxObject
+{
+ public:
+ wxBusyInfo(const wxString& message);
+ ~wxBusyInfo();
+
+ private:
+ wxInfoFrame *m_InfoFrame;
+};
+
+
+#endif
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: filesys.h
+// Purpose: class for opening files - virtual file system
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __FILESYS_H__
+#define __FILESYS_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <wx/stream.h>
+#include <wx/mimetype.h>
+#include <wx/url.h>
+
+
+class wxFSFile;
+class wxFileSystemHandler;
+class wxFileSystem;
+
+//--------------------------------------------------------------------------------
+// wxFSFile
+// This class is a file opened using wxFileSystem. It consists of
+// input stream, location, mime type & optional anchor
+// (in 'index.htm#chapter2', 'chapter2' is anchor)
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxFSFile : public wxObject
+{
+ private:
+ wxInputStream *m_Stream;
+ wxString m_Location;
+ wxString m_MimeType;
+ wxString m_Anchor;
+
+ public:
+ wxFSFile(wxInputStream *stream, const wxString& loc, const wxString& mimetype, const wxString& anchor)
+ {
+ m_Stream = stream;
+ m_Location = loc;
+ m_MimeType = mimetype; m_MimeType.MakeLower();
+ m_Anchor = anchor;
+ }
+ virtual ~wxFSFile()
+ {
+ if (m_Stream) delete m_Stream;
+ }
+
+ wxInputStream *GetStream() const {return m_Stream;}
+ // returns stream. This doesn't _create_ stream, it only returns
+ // pointer to it!!
+
+ const wxString& GetMimeType() const {return m_MimeType;}
+ // returns file's mime type
+
+ const wxString& GetLocation() const {return m_Location;}
+ // returns the original location (aka filename) of the file
+
+ const wxString& GetAnchor() const {return m_Anchor;}
+};
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxFileSystemHandler
+// This class is FS handler for wxFileSystem. It provides
+// interface to access certain
+// kinds of files (HTPP, FTP, local, tar.gz etc..)
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxFileSystemHandler : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxFileSystemHandler)
+
+ public:
+ wxFileSystemHandler() : wxObject() {}
+
+ virtual bool CanOpen(const wxString& location) = 0;
+ // returns TRUE if this handler is able to open given location
+
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0;
+ // opens given file and returns pointer to input stream.
+ // Returns NULL if opening failed.
+ // The location is always absolute path.
+
+ protected:
+ wxString GetProtocol(const wxString& location) const;
+ // returns protocol ("file", "http", "tar" etc.) The last (most right)
+ // protocol is used:
+ // {it returns "tar" for "file:subdir/archive.tar.gz#tar:/README.txt"}
+
+ wxString GetLeftLocation(const wxString& location) const;
+ // returns left part of address:
+ // {it returns "file:subdir/archive.tar.gz" for "file:subdir/archive.tar.gz#tar:/README.txt"}
+
+ wxString GetAnchor(const wxString& location) const;
+ // returns anchor part of address:
+ // {it returns "anchor" for "file:subdir/archive.tar.gz#tar:/README.txt#anchor"}
+ // NOTE: anchor is NOT a part of GetLeftLocation()'s return value
+
+ wxString GetRightLocation(const wxString& location) const;
+ // returns right part of address:
+ // {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"}
+
+ wxString GetMimeTypeFromExt(const wxString& location);
+ // Returns MIME type of the file - w/o need to open it
+ // (default behaviour is that it returns type based on extension)
+
+ private:
+ static wxMimeTypesManager m_MimeMng;
+ // MIME manager
+ // (it's static and thus shared by all instances and derived classes)
+};
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxFileSystem
+// This class provides simple interface for opening various
+// kinds of files (HTPP, FTP, local, tar.gz etc..)
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxFileSystem : public wxObject
+{
+ DECLARE_DYNAMIC_CLASS(wxFileSystem)
+
+ private:
+ wxString m_Path;
+ // the path (location) we are currently in
+ // this is path, not file!
+ // (so if you opened test/demo.htm, it is
+ // "test/", not "test/demo.htm")
+ wxString m_LastName;
+ // name of last opened file (full path)
+ static wxList m_Handlers;
+ // list of FS handlers
+
+ public:
+ wxFileSystem() : wxObject() {m_Path = m_LastName = wxEmptyString; m_Handlers.DeleteContents(TRUE);}
+
+ void ChangePathTo(const wxString& location, bool is_dir = FALSE);
+ // sets the current location. Every call to OpenFile is
+ // relative to this location.
+ // NOTE !!
+ // unless is_dir = TRUE 'location' is *not* the directory but
+ // file contained in this directory
+ // (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/")
+
+ wxString GetPath() const {return m_Path;}
+
+ wxFSFile* OpenFile(const wxString& location);
+ // opens given file and returns pointer to input stream.
+ // Returns NULL if opening failed.
+ // It first tries to open the file in relative scope
+ // (based on ChangePathTo()'s value) and then as an absolute
+ // path.
+
+ static void AddHandler(wxFileSystemHandler *handler);
+ // Adds FS handler.
+ // In fact, this class is only front-end to the FS hanlers :-)
+};
+
+
+/*
+
+'location' syntax:
+
+To determine FS type, we're using standard KDE notation:
+file:/absolute/path/file.htm
+file:relative_path/xxxxx.html
+/some/path/x.file ('file:' is default)
+http://www.gnome.org
+file:subdir/archive.tar.gz#tar:/README.txt
+
+special characters :
+ ':' - FS identificator is before this char
+ '#' - separator. It can be either HTML anchor ("index.html#news")
+ (in case there is no ':' in the string to the right from it)
+ or FS separator
+ (example : http://www.wxhtml.org/wxhtml-0.1.tar.gz#tar:/include/wxhtml/filesys.h"
+ this would access tgz archive stored on web)
+ '/' - directory (path) separator. It is used to determine upper-level path.
+ HEY! Don't use \ even if you're on Windows!
+
+*/
+
+#endif // __FILESYS_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: fs_inet.h
+// Purpose: HTTP and FTP file system
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+
+REMARKS :
+
+This FS creates local cache (in /tmp directory). The cache is freed
+on program exit.
+
+Size of cache is limited to cca 1000 items (due to GetTempFileName
+limitation)
+
+
+*/
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/filesys.h>
+
+
+
+//--------------------------------------------------------------------------------
+// wxInternetFSHandler
+//--------------------------------------------------------------------------------
+
+class wxInternetFSHandler : public wxFileSystemHandler
+{
+ private:
+ wxHashTable m_Cache;
+
+ public:
+ virtual bool CanOpen(const wxString& location);
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
+ ~wxInternetFSHandler();
+};
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: fs_zip.h
+// Purpose: ZIP file system
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/filesys.h>
+
+
+
+//--------------------------------------------------------------------------------
+// wxZipFSHandler
+//--------------------------------------------------------------------------------
+
+class wxZipFSHandler : public wxFileSystemHandler
+{
+ public:
+ virtual bool CanOpen(const wxString& location);
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
+ ~wxZipFSHandler();
+};
+
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: forcelink.h
+// Purpose: see bellow
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+
+DESCRPITON:
+
+mod_*.cpp files contain handlers for tags. These files are modules - they contain
+one wxTagModule class and it's OnInit() method is called from wxApp's init method.
+The module is called even if you only link it into the executable, so everything
+seems wonderful.
+
+The problem is that we have these modules in LIBRARY and mod_*.cpp files contain
+no method nor class which is known out of the module. So the linker won't
+link these .o/.obj files into executable because it detected that it is not used
+by the program.
+
+To workaround this I introduced set of macros FORCE_LINK_ME and FORCE_LINK. These
+macros are generic and are not limited to mod_*.cpp files. You may find them quite
+useful somewhere else...
+
+How to use them:
+let's suppose you want to always link file foo.cpp and that you have module
+always.cpp that is certainly always linked (e.g. the one with main() function
+or htmlwin.cpp in wxHtml library).
+
+Place FORCE_LINK_ME(foo) somewhere in foo.cpp and FORCE_LINK(foo) somewhere
+in always.cpp
+See mod_*.cpp and htmlwin.cpp for example :-)
+
+*/
+
+
+#ifndef __FORCELINK_H__
+#define __FORCELINK_H__
+
+
+
+// This must be part of the module you want to force:
+#define FORCE_LINK_ME(module_name) \
+ int _link_dummy_func_##module_name () \
+ { \
+ return 1; \
+ }
+
+
+// And this must be somewhere where it certainly will be linked:
+#define FORCE_LINK(module_name) \
+ extern int _link_dummy_func_##module_name (); \
+ static int _link_dummy_var_##module_name = \
+ _link_dummy_func_##module_name ();
+
+
+#endif // __FORCELINK_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlcell.h
+// Purpose: wxHtmlCell class is used by wxHtmlWindow/wxHtmlWinParser
+// as a basic visual element of HTML page
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __HTMLCELL_H__
+#define __HTMLCELL_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+
+#include <wx/html/htmltag.h>
+#include <wx/html/htmldefs.h>
+#include <wx/window.h>
+
+class wxHtmlCell;
+class wxHtmlContainerCell;
+
+//--------------------------------------------------------------------------------
+// wxHtmlCell
+// Internal data structure. It represents fragments of parsed HTML
+// page - a word, picture, table, horizontal line and so on.
+// It is used by wxHtmlWindow to represent HTML page in memory.
+//--------------------------------------------------------------------------------
+
+
+class WXDLLEXPORT wxHtmlCell : public wxObject
+{
+ protected:
+ wxHtmlCell *m_Next;
+ // pointer to the next cell
+ wxHtmlContainerCell *m_Parent;
+ // pointer to parent cell
+ long m_Width, m_Height, m_Descent;
+ // dimensions of fragment
+ // m_Descent is used to position text&images..
+ long m_PosX, m_PosY;
+ // position where the fragment is drawn
+ wxString m_Link;
+ // destination address if this fragment is hypertext link, "" otherwise
+
+ public:
+ wxHtmlCell() : wxObject() {m_Next = NULL; m_Parent = NULL; m_Width = m_Height = m_Descent = 0;};
+ virtual ~wxHtmlCell() {if (m_Next) delete m_Next;};
+
+ void SetParent(wxHtmlContainerCell *p) {m_Parent = p;}
+ wxHtmlContainerCell *GetParent() const {return m_Parent;}
+
+ int GetPosX() const {return m_PosX;}
+ int GetPosY() const {return m_PosY;}
+ int GetWidth() const {return m_Width;}
+ int GetHeight() const {return m_Height;}
+ int GetDescent() const {return m_Descent;}
+ virtual wxString GetLink(int x = 0, int y = 0) const {return m_Link;}
+ // returns the link associated with this cell. The position is position within
+ // the cell so it varies from 0 to m_Width, from 0 to m_Height
+ wxHtmlCell *GetNext() const {return m_Next;}
+ // members access methods
+
+ virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;}
+ void SetLink(const wxString& link) {m_Link = link;}
+ void SetNext(wxHtmlCell *cell) {m_Next = cell;}
+ // members writin methods
+
+ virtual void Layout(int w) {SetPos(0, 0); if (m_Next) m_Next -> Layout(w);};
+ // 1. adjust cell's width according to the fact that maximal possible width is w.
+ // (this has sense when working with horizontal lines, tables etc.)
+ // 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height) members)
+ // = place items to fit window, according to the width w
+
+ virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) {if (m_Next) m_Next -> Draw(dc, x, y, view_y1, view_y2);}
+ // renders the cell
+
+ virtual void DrawInvisible(wxDC& dc, int x, int y) {if (m_Next) m_Next -> DrawInvisible(dc, x, y);};
+ // proceed drawing actions in case the cell is not visible (scrolled out of screen).
+ // This is needed to change fonts, colors and so on
+
+ virtual const wxHtmlCell* Find(int condition, const void* param) const {if (m_Next) return m_Next -> Find(condition, param); else return NULL;}
+ // This method returns pointer to the FIRST cell for that
+ // the condition
+ // is true. It first checks if the condition is true for this
+ // cell and then calls m_Next -> Find(). (Note: it checks
+ // all subcells if the cell is container)
+ // Condition is unique condition identifier (see htmldefs.h)
+ // (user-defined condition IDs should start from 10000)
+ // and param is optional parameter
+ // Example : m_Cell -> Find(HTML_COND_ISANCHOR, "news");
+ // returns pointer to anchor news
+
+ virtual void OnMouseClick(wxWindow *parent, int x, int y, bool left, bool middle, bool right);
+ // This function is called when mouse button is clicked over the cell.
+ // left, middle, right are flags indicating whether the button was or wasn't
+ // pressed.
+ // Parent is pointer to wxHtmlWindow that generated the event
+ // HINT: if this handling is not enough for you you should use
+ // wxHtmlBinderCell
+};
+
+
+
+
+//--------------------------------------------------------------------------------
+// Inherited cells:
+//--------------------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlWordCell
+// Single word in input stream.
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlWordCell : public wxHtmlCell
+{
+ protected:
+ wxString m_Word;
+
+ public:
+ wxHtmlWordCell(const wxString& word, wxDC& dc);
+ void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+};
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlContainerCell
+// Container - it contains other cells. Basic of layout algorithm.
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlContainerCell : public wxHtmlCell
+{
+ protected:
+ int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom;
+ // indentation of subcells. There is always m_Indent pixels
+ // big space between given border of the container and the subcells
+ // it m_Indent < 0 it is in PERCENTS, otherwise it is in pixels
+ int m_MinHeight, m_MinHeightAlign;
+ // minimal height.
+ int m_MaxLineWidth;
+ // maximal widht of line. Filled during Layout()
+ wxHtmlCell *m_Cells, *m_LastCell;
+ // internal cells, m_Cells points to the first of them, m_LastCell to the last one.
+ // (LastCell is needed only to speed-up InsertCell)
+ int m_AlignHor, m_AlignVer;
+ // alignment horizontal and vertical (left, center, right)
+ int m_WidthFloat, m_WidthFloatUnits;
+ // width float is used in adjustWidth
+ bool m_UseBkColour;
+ wxColour m_BkColour;
+ // background color of this container
+ bool m_UseBorder;
+ wxColour m_BorderColour1, m_BorderColour2;
+ // borders color of this container
+
+ public:
+ wxHtmlContainerCell(wxHtmlContainerCell *parent);
+ ~wxHtmlContainerCell() {if (m_Cells) delete m_Cells;}
+
+ virtual void Layout(int w);
+ virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+ virtual void DrawInvisible(wxDC& dc, int x, int y);
+
+ void InsertCell(wxHtmlCell *cell);
+ // insert cell at the end of m_Cells list
+ void SetAlignHor(int al) {m_AlignHor = al;}
+ int GetAlignHor() const {return m_AlignHor;}
+ void SetAlignVer(int al) {m_AlignVer = al;}
+ // sets horizontal/vertical alignment
+ int GetAlignVer() const {return m_AlignVer;}
+ void SetIndent(int i, int what, int units = HTML_UNITS_PIXELS);
+ // sets left-border indentation. units is one of HTML_UNITS_* constants
+ // what is combination of HTML_INDENT_*
+ int GetIndent(int ind) const;
+ // returns the indentation. ind is one of HTML_INDENT_* constants
+ int GetIndentUnits(int ind) const;
+ // returns type of value returned by GetIndent(ind)
+ void SetAlign(const wxHtmlTag& tag);
+ // sets alignment info based on given tag's params
+ void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units;}
+ void SetWidthFloat(const wxHtmlTag& tag);
+ // sets floating width adjustment
+ // (examples : 32 percent of parent container,
+ // -15 pixels percent (this means 100 % - 15 pixels)
+ void SetMinHeight(int h, int align = HTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align;}
+ // sets minimal height of this container.
+ int GetMaxLineWidth() const {return m_MaxLineWidth;}
+ // returns maximal line width in this container.
+ // Call to this method is valid only after calling
+ // Layout()
+ void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = TRUE; m_BkColour = clr;}
+ void SetBorder(const wxColour& clr1, const wxColour& clr2) {m_UseBorder = TRUE; m_BorderColour1 = clr1, m_BorderColour2 = clr2;}
+ virtual wxString GetLink(int x = 0, int y = 0) const;
+ virtual const wxHtmlCell* Find(int condition, const void* param) const;
+ virtual void OnMouseClick(wxWindow *parent, int x, int y, bool left, bool middle, bool right);
+
+ wxHtmlCell* GetFirstCell() {return m_Cells;}
+ // returns pointer to the first cell in container or NULL
+};
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlColourCell
+// Color changer.
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlColourCell : public wxHtmlCell
+{
+ public:
+ wxColour m_Colour;
+ unsigned m_Flags;
+
+ wxHtmlColourCell(wxColour clr, int flags = HTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;}
+ virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+ virtual void DrawInvisible(wxDC& dc, int x, int y);
+};
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlFontCell
+// Sets actual font used for text rendering
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlFontCell : public wxHtmlCell
+{
+ public:
+ wxFont *m_Font;
+
+ wxHtmlFontCell(wxFont *font) : wxHtmlCell() {m_Font = font;};
+ virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+ virtual void DrawInvisible(wxDC& dc, int x, int y);
+};
+
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlwidgetCell
+// This cell is connected with wxWindow object
+// You can use it to insert windows into HTML page
+// (buttons, input boxes etc.)
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlWidgetCell : public wxHtmlCell
+{
+ protected:
+ wxWindow* m_Wnd;
+ int m_WidthFloat;
+ // width float is used in adjustWidth (it is in percents)
+
+ public:
+ wxHtmlWidgetCell(wxWindow *wnd, int w = 0);
+ // !!! wnd must have correct parent!
+ // if w != 0 then the m_Wnd has 'floating' width - it adjust
+ // it's width according to parent container's width
+ // (w is percent of parent's width)
+ virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+ virtual void DrawInvisible(wxDC& dc, int x, int y);
+ virtual void Layout(int w);
+};
+
+
+
+
+#endif // __HTMLCELL_H__
+
+#endif
+
+
+
+
+
+
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmldefs.h
+// Purpose: constants for wxhtml library
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __HTMLDEFS_H__
+#define __HTMLDEFS_H__
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+
+//--------------------------------------------------------------------------------
+// ALIGNMENTS
+// Describes alignment of text etc. in containers
+//--------------------------------------------------------------------------------
+
+#define HTML_ALIGN_LEFT 0x0000
+#define HTML_ALIGN_RIGHT 0x0002
+
+#define HTML_ALIGN_TOP 0x0004
+#define HTML_ALIGN_BOTTOM 0x0008
+
+#define HTML_ALIGN_CENTER 0x0001
+
+
+
+//--------------------------------------------------------------------------------
+// COLOR MODES
+// Used by wxHtmlColourCell to determine clr of what is changing
+//--------------------------------------------------------------------------------
+
+#define HTML_CLR_FOREGROUND 0x0001
+#define HTML_CLR_BACKGROUND 0x0002
+
+
+
+//--------------------------------------------------------------------------------
+// UNITS
+// Used to specify units
+//--------------------------------------------------------------------------------
+
+#define HTML_UNITS_PIXELS 0x0001
+#define HTML_UNITS_PERCENT 0x0002
+
+
+
+//--------------------------------------------------------------------------------
+// INDENTS
+// Used to specify indetation relatives
+//--------------------------------------------------------------------------------
+
+#define HTML_INDENT_LEFT 0x0010
+#define HTML_INDENT_RIGHT 0x0020
+#define HTML_INDENT_TOP 0x0040
+#define HTML_INDENT_BOTTOM 0x0080
+
+#define HTML_INDENT_HORIZONTAL HTML_INDENT_LEFT | HTML_INDENT_RIGHT
+#define HTML_INDENT_VERTICAL HTML_INDENT_TOP | HTML_INDENT_BOTTOM
+#define HTML_INDENT_ALL HTML_INDENT_VERTICAL | HTML_INDENT_HORIZONTAL
+
+
+
+
+//--------------------------------------------------------------------------------
+// FIND CONDITIONS
+// Identifiers of wxHtmlCell's Find() conditions
+//--------------------------------------------------------------------------------
+
+#define HTML_COND_ISANCHOR 1
+ // Finds the anchor of 'param' name (pointer to wxString).
+
+#define HTML_COND_USER 10000
+ // User-defined conditions should start from this number
+
+
+//--------------------------------------------------------------------------------
+// INTERNALS
+// wxHTML internal constants
+//--------------------------------------------------------------------------------
+
+#define HTML_SCROLL_STEP 16
+ /* size of one scroll step of wxHtmlWindow in pixels */
+#define HTML_BUFLEN 1024
+ /* size of temporary buffer used during parsing */
+#define HTML_REALLOC_STEP 32
+ /* steps of array reallocation */
+
+#endif
+#endif
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlfilter.h
+// Purpose: filters
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __HTMLFILTER_H__
+#define __HTMLFILTER_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/filesys.h>
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlFilter
+// This class is input filter. It can "translate" files
+// in non-HTML format to HTML format
+// interface to access certain
+// kinds of files (HTPP, FTP, local, tar.gz etc..)
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlFilter : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlFilter)
+
+ public:
+ wxHtmlFilter() : wxObject() {}
+
+ virtual bool CanRead(const wxFSFile& file) = 0;
+ // returns TRUE if this filter is able to open&read given file
+
+ virtual wxString ReadFile(const wxFSFile& file) = 0;
+ // reads given file and returns HTML document.
+ // Returns empty string if opening failed
+};
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlFilterPlainText
+// This filter is used as default filter if no other can
+// be used (= uknown type of file). It is used by
+// wxHtmlWindow itself.
+//--------------------------------------------------------------------------------
+
+
+class WXDLLEXPORT wxHtmlFilterPlainText : public wxHtmlFilter
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlFilterPlainText)
+
+ public:
+ virtual bool CanRead(const wxFSFile& file);
+ virtual wxString ReadFile(const wxFSFile& file);
+};
+
+
+
+
+#endif // __HTMLFILTER_H__
+
+#endif
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlhelp.h
+// Purpose: Help controller
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __HTMLHELP_H__
+#define __HTMLHELP_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/window.h>
+#include <wx/config.h>
+#include <wx/splitter.h>
+#include <wx/notebook.h>
+#include <wx/listctrl.h>
+#include <wx/html/htmlwin.h>
+
+
+
+//--------------------------------------------------------------------------------
+// helper classes & structs - please ignore 'em
+//--------------------------------------------------------------------------------
+
+
+
+class WXDLLEXPORT HtmlBookRecord : public wxObject
+{
+ public:
+ wxString m_BasePath;
+ wxString m_Title;
+ wxString m_Start;
+
+ HtmlBookRecord(const wxString& basepath, const wxString& title, const wxString& start) {m_BasePath = basepath; m_Title = title; m_Start = start;}
+ wxString GetTitle() const {return m_Title;}
+ wxString GetStart() const {return m_Start;}
+ wxString GetBasePath() const {return m_BasePath;}
+};
+
+
+#undef WXDLLEXPORTLOCAL
+#define WXDLLEXPORTLOCAL WXDLLEXPORT
+ // ?? Don't know why - but Allen Van Sickel reported it to fix problems with DLL
+WX_DECLARE_OBJARRAY(HtmlBookRecord, HtmlBookRecArray);
+
+#undef WXDLLEXPORTLOCAL
+#define WXDLLEXPORTLOCAL
+
+
+typedef struct
+ {
+ short int m_Level;
+ int m_ID;
+ char* m_Name;
+ char* m_Page;
+ HtmlBookRecord *m_Book;
+ } HtmlContentsItem;
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlHelpController
+// This class ensures dislaying help.
+// See documentation for details on its philosophy.
+//
+// WARNING!!
+// This class is not derived from wxHelpController and is not
+// compatible with it!
+//--------------------------------------------------------------------------------
+
+
+class WXDLLEXPORT wxHtmlHelpController : public wxEvtHandler
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
+
+ protected:
+ wxConfigBase *m_Config;
+ wxString m_ConfigRoot;
+ // configuration file/registry used to store custom settings
+ wxString m_TitleFormat;
+ // title of the help frame
+ wxString m_TempPath;
+
+ wxFrame *m_Frame;
+ wxHtmlWindow *m_HtmlWin;
+ wxSplitterWindow *m_Splitter;
+ wxNotebook *m_NavigPan;
+ wxTreeCtrl *m_ContentsBox;
+ wxImageList *m_ContentsImageList;
+ wxListBox *m_IndexBox;
+ wxTextCtrl *m_SearchText;
+ wxButton *m_SearchButton;
+ wxListBox *m_SearchList;
+ // ...pointers to parts of help window
+
+ struct {
+ long x, y, w, h;
+ long sashpos;
+ bool navig_on;
+ } m_Cfg;
+ // settings (window size, position, sash pos etc..)
+
+ HtmlBookRecArray m_BookRecords;
+ // each book has one record in this array
+ HtmlContentsItem* m_Contents;
+ int m_ContentsCnt;
+ // list of all available books and pages.
+ HtmlContentsItem* m_Index;
+ int m_IndexCnt;
+ // list of index items
+
+ public:
+ wxHtmlHelpController();
+ ~wxHtmlHelpController();
+
+ void SetTitleFormat(const wxString& format) {m_TitleFormat = format;}
+ // Sets format of title of the frame. Must contain exactly one "%s"
+ // (for title of displayed HTML page)
+
+ void SetTempDir(const wxString& path);
+ // Sets directory where temporary files are stored.
+ // These temp files are index & contents file in binary (much faster to read)
+ // form. These files are NOT deleted on program's exit.
+
+ bool AddBook(const wxString& book, bool show_wait_msg = FALSE);
+ // Adds new book. 'book' is location of .htb file (stands for "html book").
+ // See documentation for details on its format.
+ // Returns success.
+ // If show_wait_msg == true then message window with "loading book..." is displayed
+
+ void Display(const wxString& x);
+ // Displays page x. If not found it will offect the user a choice of searching
+ // books.
+ // Looking for the page runs in these steps:
+ // 1. try to locate file named x (if x is for example "doc/howto.htm")
+ // 2. try to open starting page of book x
+ // 3. try to find x in contents (if x is for example "How To ...")
+ // 4. try to find x in index (if x is for example "How To ...")
+ // 5. offer searching and if the user agree, run KeywordSearch
+ void Display(const int id);
+ // Alternative version that works with numeric ID.
+ // (uses extension to MS format, <param name="ID" value=id>, see docs)
+
+ void DisplayContents();
+ // Displays help window and focuses contents.
+
+ void DisplayIndex();
+ // Displays help window and focuses index.
+
+ bool KeywordSearch(const wxString& keyword);
+ // Searches for keyword. Returns TRUE and display page if found, return
+ // FALSE otherwise
+ // Syntax of keyword is Altavista-like:
+ // * words are separated by spaces
+ // (but "\"hello world\"" is only one world "hello world")
+ // * word may be pretended by + or -
+ // (+ : page must contain the word ; - : page can't contain the word)
+ // * if there is no + or - before the word, + is default
+
+ void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString) {m_Config = config; m_ConfigRoot = rootpath;}
+ // Assigns config object to the controller. This config is then
+ // used in subsequent calls to Read/WriteCustomization of both help
+ // controller and it's wxHtmlWindow
+
+ void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
+ // saves custom settings into cfg config. it will use the path 'path'
+ // if given, otherwise it will save info into currently selected path.
+ // saved values : things set by SetFonts, SetBorders.
+ void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
+ // ...
+
+ protected:
+ virtual void CreateHelpWindow();
+ // Creates frame & html window and sets m_Frame and other variables;
+ // Do nothing if the window already exists
+ void RefreshLists();
+ // Refreshes Contents and Index tabs
+ void CreateContents();
+ // Adds items to m_Contents tree control
+ void CreateIndex();
+ // Adds items to m_IndexList
+
+ void LoadMSProject(HtmlBookRecord *book, wxFileSystem& fsys, const wxString& indexfile, const wxString& contentsfile, bool show_wait_msg);
+ // Imports .hhp files (MS HTML Help Workshop)
+ void LoadCachedBook(HtmlBookRecord *book, wxInputStream *f);
+ // Reads binary book
+ void SaveCachedBook(HtmlBookRecord *book, wxOutputStream *f);
+ // Writes binary book
+
+ void OnToolbar(wxCommandEvent& event);
+ void OnContentsSel(wxTreeEvent& event);
+ void OnIndexSel(wxCommandEvent& event);
+ void OnSearchSel(wxCommandEvent& event);
+ void OnSearch(wxCommandEvent& event);
+ void OnCloseWindow(wxCloseEvent& event);
+
+ DECLARE_EVENT_TABLE()
+};
+
+
+
+#endif // __HTMLHELP_H__
+
+#endif
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlparser.h
+// Purpose: wxHtmlParser class (generic parser)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __HTMLPARSER_H__
+#define __HTMLPARSER_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/html/htmltag.h>
+#include <wx/filesys.h>
+
+class wxHtmlParser;
+class wxHtmlTagHandler;
+
+//--------------------------------------------------------------------------------
+// wxHtmlParser
+// This class handles generic parsing of HTML document : it scans
+// the document and divide it into blocks of tags (where one block
+// consists of starting and ending tag and of text between these
+// 2 tags.
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlParser : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlParser)
+
+ protected:
+ wxString m_Source;
+ // source being parsed
+ wxHtmlTagsCache *m_Cache;
+ // tags cache, used during parsing.
+ wxHashTable m_HandlersHash;
+ wxList m_HandlersList;
+ // handlers that handle particular tags. The table is accessed by
+ // key = tag's name.
+ // This attribute MUST be filled by derived class otherwise it would
+ // be empty and no tags would be recognized
+ // (see wxHtmlWinParser for details about filling it)
+ // m_HandlersHash is for random access based on knowledge of tag name (BR, P, etc.)
+ // it may (and often does) contain more references to one object
+ // m_HandlersList is list of all handlers and it is guaranteed to contain
+ // only one reference to each handler instance.
+ wxFileSystem *m_FS;
+ // class for opening files (file system)
+
+ public:
+ wxHtmlParser() : wxObject(), m_HandlersHash(wxKEY_STRING) {m_FS = NULL; m_Cache = NULL;}
+ virtual ~wxHtmlParser();
+
+ void SetFS(wxFileSystem *fs) {m_FS = fs;}
+ // Sets the class which will be used for opening files
+ wxFileSystem* GetFS() const {return m_FS;}
+
+ wxObject* Parse(const wxString& source);
+ // You can simply call this method when you need parsed output.
+ // This method does these things:
+ // 1. call InitParser(source);
+ // 2. call DoParsing();
+ // 3. call GetProduct(); (it's return value is then returned)
+ // 4. call DoneParser();
+
+ virtual void InitParser(const wxString& source);
+ // Sets the source. This must be called before running Parse() method.
+ virtual void DoneParser();
+ // This must be called after Parse().
+
+ void DoParsing(int begin_pos, int end_pos);
+ inline void DoParsing() {DoParsing(0, m_Source.Length());};
+ // Parses the m_Source from begin_pos to end_pos-1.
+ // (in noparams version it parses whole m_Source)
+
+ virtual wxObject* GetProduct() = 0;
+ // Returns product of parsing
+ // Returned value is result of parsing of the part. The type of this result
+ // depends on internal representation in derived parser
+ // (see wxHtmlWinParser for details).
+
+ virtual void AddTagHandler(wxHtmlTagHandler *handler);
+ // adds handler to the list & hash table of handlers.
+
+ wxString* GetSource() {return &m_Source;}
+
+ virtual wxList* GetTempData() {return NULL;}
+ // this method returns list of wxObjects that represents
+ // all data allocated by the parser. These can't be freeded
+ // by destructor because they must be valid as long as
+ // GetProduct's return value is valid - the caller must
+ // explicitly call delete MyParser -> GetTempData() to free
+ // the memory
+ // (this method always sets the list to delete its contents)
+
+ protected:
+
+ virtual void AddText(const char* txt) = 0;
+ // Adds text to the output.
+ // This is called from Parse() and must be overriden in derived classes.
+ // txt is not guaranteed to be only one word. It is largest continuous part of text
+ // (= not broken by tags)
+ // NOTE : using char* because of speed improvements
+
+ virtual void AddTag(const wxHtmlTag& tag);
+ // Adds tag and proceeds it. Parse() may (and usually is) called from this method.
+ // This is called from Parse() and may be overriden.
+ // Default behavior is that it looks for proper handler in m_Handlers. The tag is
+ // ignored if no hander is found.
+ // Derived class is *responsible* for filling in m_Handlers table.
+};
+
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlTagHandler
+// This class (and derived classes) cooperates with wxHtmlParser.
+// Each recognized tag is passed to handler which is capable
+// of handling it. Each tag is handled in 3 steps:
+// 1. Handler will modifies state of parser
+// (using it's public methods)
+// 2. Parser parses source between starting and ending tag
+// 3. Handler restores original state of the parser
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlTagHandler : public wxObject
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlTagHandler)
+
+ protected:
+ wxHtmlParser *m_Parser;
+
+ public:
+ wxHtmlTagHandler() : wxObject () {m_Parser = NULL;};
+
+ virtual void SetParser(wxHtmlParser *parser) {m_Parser = parser;}
+ // Sets the parser.
+ // NOTE : each _instance_ of handler is guaranteed to be called
+ // only by one parser. This means you don't have to care about
+ // reentrancy.
+
+ virtual wxString GetSupportedTags() = 0;
+ // Returns list of supported tags. The list is in uppercase and
+ // tags are delimited by ','.
+ // Example : "I,B,FONT,P"
+ // is capable of handling italic, bold, font and paragraph tags
+
+ virtual bool HandleTag(const wxHtmlTag& tag) = 0;
+ // This is hadling core method. It does all the Steps 1-3.
+ // To process step 2, you can call ParseInner()
+ // returned value : TRUE if it called ParseInner(),
+ // FALSE etherwise
+
+ protected:
+ void ParseInner(const wxHtmlTag& tag) {m_Parser -> DoParsing(tag.GetBeginPos(), tag.GetEndPos1());}
+ // parses input between beginning and ending tag.
+ // m_Parser must be set.
+};
+
+
+
+
+
+#endif // __HTMLPARSER_H__
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmltag.h
+// Purpose: wxHtmlTag class (represents single tag)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __HTMLTAG_H__
+#define __HTMLTAG_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlTagsCache
+// !! INTERNAL STRUCTURE !! Do not use in your program!
+// This structure contains information on positions of tags
+// in the string being parsed
+//--------------------------------------------------------------------------------
+
+typedef struct {
+ int Key;
+ // this is "pos" value passed to wxHtmlTag's constructor.
+ // it is position of '<' character of the tag
+ int End1, End2;
+ // end positions for the tag:
+ // end1 is '<' of ending tag,
+ // end2 is '>' or both are
+ // -1 if there is no ending tag for this one...
+ // or -2 if this is ending tag </...>
+ char *Name;
+ // name of this tag
+ } sCacheItem;
+
+
+
+class wxHtmlTagsCache : public wxObject
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlTagsCache)
+
+ private:
+ sCacheItem *m_Cache;
+ int m_CacheSize;
+ int m_CachePos;
+
+ public:
+ wxHtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;}
+ wxHtmlTagsCache(const wxString& source);
+ ~wxHtmlTagsCache() {free(m_Cache);}
+
+ void QueryTag(int at, int* end1, int* end2);
+ // Finds parameters for tag starting at at and fills the variables
+};
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlTag
+// This represents single tag. It is used as internal structure
+// by wxHtmlParser.
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlTag : public wxObject
+{
+ DECLARE_CLASS(wxHtmlTag)
+
+ private:
+ wxString m_Name, m_Params;
+ int m_Begin, m_End1, m_End2;
+ bool m_Ending;
+
+ public:
+ wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache);
+ // constructs wxHtmlTag object based on HTML tag.
+ // The tag begins (with '<' character) at position pos in source
+ // end_pos is position where parsing ends (usually end of document)
+
+ inline wxString GetName() const {return m_Name;};
+ // Returns tag's name in uppercase.
+
+ bool HasParam(const wxString& par) const;
+ // Returns TRUE if the tag has given parameter. Parameter
+ // should always be in uppercase.
+ // Example : <IMG SRC="test.jpg"> HasParam("SRC") returns TRUE
+
+ wxString GetParam(const wxString& par, bool with_commas = FALSE) const;
+ // Returns value of the param. Value is in uppercase unless it is
+ // enclosed with "
+ // Example : <P align=right> GetParam("ALIGN") returns (RIGHT)
+ // <P IMG SRC="WhaT.jpg"> GetParam("SRC") returns (WhaT.jpg)
+ // (or ("WhaT.jpg") if with_commas == TRUE)
+
+ void ScanParam(const wxString& par, char *format, ...) const;
+ // Scans param like scanf() functions family do.
+ // Example : ScanParam("COLOR", "\"#%X\"", &clr);
+ // This is always with with_commas=FALSE
+
+ inline const wxString& GetAllParams() const {return m_Params;};
+ // Returns string containing all params.
+
+ inline bool IsEnding() const {return m_Ending;};
+ // return TRUE if this is ending tag (</something>) or FALSE
+ // if it isn't (<something>)
+
+ inline bool HasEnding() const {return m_End1 >= 0;};
+ // return TRUE if this is ending tag (</something>) or FALSE
+ // if it isn't (<something>)
+
+ inline int GetBeginPos() const {return m_Begin;};
+ // returns beginning position of _internal_ block of text
+ // See explanation (returned value is marked with *):
+ // bla bla bla <MYTAG>* bla bla intenal text</MYTAG> bla bla
+ inline int GetEndPos1() const {return m_End1;};
+ // returns ending position of _internal_ block of text.
+ // bla bla bla <MYTAG> bla bla intenal text*</MYTAG> bla bla
+ inline int GetEndPos2() const {return m_End2;};
+ // returns end position 2 :
+ // bla bla bla <MYTAG> bla bla internal text</MYTAG>* bla bla
+};
+
+
+
+
+
+
+#endif // __HTMLTAG_H__
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlwin.h
+// Purpose: wxHtmlWindow class for parsing & displaying HTML
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __HTMLWIN_H__
+#define __HTMLWIN_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/window.h>
+#include <wx/config.h>
+#include <wx/treectrl.h>
+#include <wx/html/htmlwinparser.h>
+#include <wx/html/htmlcell.h>
+#include <wx/filesys.h>
+#include <wx/html/htmlfilter.h>
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlWindow
+// (This is probably the only class you will directly use.)
+// Purpose of this class is to display HTML page (either local
+// file or downloaded via HTTP protocol) in a window. Width
+// of window is constant - given in constructor - virtual height
+// is changed dynamicly depending on page size.
+// Once the window is created you can set it's content by calling
+// SetPage(text) or LoadPage(filename).
+//--------------------------------------------------------------------------------
+
+
+// item of history list
+class WXDLLEXPORT HtmlHistoryItem : public wxObject
+{
+ private:
+ wxString m_Page;
+ wxString m_Anchor;
+ int m_Pos;
+
+ public:
+ HtmlHistoryItem(const wxString& p, const wxString& a) {m_Page = p, m_Anchor = a, m_Pos = 0;}
+ int GetPos() const {return m_Pos;}
+ void SetPos(int p) {m_Pos = p;}
+ const wxString& GetPage() const {return m_Page;}
+ const wxString& GetAnchor() const {return m_Anchor;}
+};
+
+#undef WXDLLEXPORTLOCAL
+#define WXDLLEXPORTLOCAL WXDLLEXPORT
+ // ?? Don't know why - but Allen Van Sickel reported it to fix problems with DLL
+
+WX_DECLARE_OBJARRAY(HtmlHistoryItem, HtmlHistoryArray);
+
+#undef WXDLLEXPORTLOCAL
+#define WXDLLEXPORTLOCAL
+
+
+class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlWindow)
+
+ protected:
+ wxHtmlContainerCell *m_Cell;
+ // This is pointer to the first cell in parsed data.
+ // (Note: the first cell is usually top one = all other cells are sub-cells of this one)
+ wxHtmlWinParser *m_Parser;
+ // parser which is used to parse HTML input.
+ // Each wxHtmlWindow has it's own parser because sharing one global
+ // parser would be problematic (because of reentrancy)
+ wxString m_OpenedPage;
+ // contains name of actualy opened page or empty string if no page opened
+ wxString m_OpenedAnchor;
+ // contains name of current anchor within m_OpenedPage
+ wxFileSystem* m_FS;
+ // class for opening files (file system)
+
+ wxFrame *m_RelatedFrame;
+ wxString m_TitleFormat;
+ int m_RelatedStatusBar;
+ // frame in which page title should be displayed & number of it's statusbar
+ // reserved for usage with this html window
+
+ int m_Borders;
+ // borders (free space between text and window borders)
+ // defaults to 10 pixels.
+
+ bool m_Scrollable;
+ // TRUE if you can scroll the window.
+ // If it is FALSE you can't scroll the window even if it's contents is larger
+ // than window.
+
+
+ private:
+ bool m_tmpMouseMoved;
+ // a flag indicated if mouse moved
+ // (if TRUE we will try to change cursor in last call to OnIdle)
+ bool m_tmpCanDraw;
+ // if FALSE contents of the window is not redrawn
+ // (in order to avoid ugly bliking)
+
+ static wxList m_Filters;
+ // list of HTML filters
+ static wxHtmlFilterPlainText m_DefaultFilter;
+ // this filter is used when no filter is able to read some file
+
+ HtmlHistoryArray m_History;
+ int m_HistoryPos;
+ // browser history
+ bool m_HistoryOn;
+ // if this FLAG is false, items are not added to history
+
+ public:
+ wxHtmlWindow() : wxScrolledWindow() {};
+ wxHtmlWindow(wxWindow *parent, wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ const wxString& name = "htmlWindow", bool scrollable = TRUE);
+ ~wxHtmlWindow();
+
+ bool SetPage(const wxString& source);
+ // Set HTML page and display it. !! source is HTML document itself,
+ // it is NOT address/filename of HTML document. If you want to
+ // specify document location, use LoadPage() istead
+ // Return value : FALSE if an error occured, TRUE otherwise
+
+ bool LoadPage(const wxString& location);
+ // Load HTML page from given location. Location can be either
+ // a) /usr/wxGTK2/docs/html/wx.htm
+ // b) http://www.somewhere.uk/document.htm
+ // c) ftp://ftp.somesite.cz/pub/something.htm
+ // In case there is no prefix (http:,ftp:), the method
+ // will try to find it itself (1. local file, then http or ftp)
+ // After the page is loaded, the method calls SetPage() to display it.
+ // Note : you can also use path relative to previously loaded page
+ // Return value : same as SetPage
+
+ wxString GetOpenedPage() const {return m_OpenedPage;}
+ // Returns full location of opened page
+
+ void SetRelatedFrame(wxFrame* frame, const wxString& format);
+ // sets frame in which page title will be displayed. Format is format of
+ // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
+ wxFrame* GetRelatedFrame() const {return m_RelatedFrame;}
+
+ void SetRelatedStatusBar(int bar);
+ // after(!) calling SetRelatedFrame, this sets statusbar slot where messages
+ // will be displayed. Default is -1 = no messages.
+
+ void SetFonts(wxString normal_face, int normal_italic_mode, wxString fixed_face, int fixed_italic_mode, int *sizes);
+ // sets fonts to be used when displaying HTML page.
+ // *_italic_mode can be either wxSLANT or wxITALIC
+
+ void SetTitle(const wxString& title);
+ // Sets the title of the window
+ // (depending on the information passed to SetRelatedFrame() method)
+
+ void SetBorders(int b) {m_Borders = b;}
+ // Sets space between text and window borders.
+
+ virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
+ // saves custom settings into cfg config. it will use the path 'path'
+ // if given, otherwise it will save info into currently selected path.
+ // saved values : things set by SetFonts, SetBorders.
+ virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
+ // ...
+
+ bool HistoryBack();
+ bool HistoryForward();
+ // Goes to previous/next page (in browsing history)
+ // Returns TRUE if successful, FALSE otherwise
+ void HistoryClear();
+ // Resets history
+
+ wxHtmlContainerCell* GetInternalRepresentation() const {return m_Cell;}
+ // Returns pointer to conteiners/cells structure.
+ // It should be used ONLY when printing
+
+ static void AddFilter(wxHtmlFilter *filter);
+ // Adds input filter
+
+ virtual void OnLinkClicked(const wxString& link);
+ // called when users clicked on hypertext link. Default behavior is to
+ // call LoadPage(loc)
+
+ protected:
+ bool ScrollToAnchor(const wxString& anchor);
+ // Scrolls to anchor of this name. (Anchor is #news
+ // or #features etc. it is part of address sometimes:
+ // http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html#news)
+ // Return value : TRUE if anchor exists, FALSE otherwise
+
+ void CreateLayout();
+ // prepare layout (= fill m_PosX, m_PosY for fragments) based on actual size of
+ // window. This method also setup scrollbars
+
+ void OnDraw(wxDC& dc);
+ void OnSize(wxSizeEvent& event);
+ void OnMouseEvent(wxMouseEvent& event);
+ void OnIdle(wxIdleEvent& event);
+ void OnKeyDown(wxKeyEvent& event);
+
+ DECLARE_EVENT_TABLE()
+};
+
+
+
+#endif // __HTMLWIN_H__
+
+#endif
+
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlwinparser.h
+// Purpose: wxHtmlWinParser class (parser to be used with wxHtmlWindow)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __HTMLWINPARSER_H__
+#define __HTMLWINPARSER_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/module.h>
+#include <wx/html/htmlparser.h>
+#include <wx/html/htmlcell.h>
+
+class wxHtmlWinParser;
+class wxHtmlWinTagHandler;
+class wxHtmlTagsModule;
+
+//--------------------------------------------------------------------------------
+// wxHtmlWinParser
+// This class is derived from wxHtmlParser and its mail goal
+// is to parse HTML input so that it can be displayed in
+// wxHtmlWindow. It uses special wxHtmlWinTagHandler.
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlWinParser)
+
+ friend class wxHtmlWindow;
+
+ private:
+ wxWindow *m_Window;
+ // window we're parsing for
+ wxDC *m_DC;
+ // Device Context we're parsing for
+ static wxList m_Modules;
+ // list of tags modules (see wxHtmlTagsModule for details)
+ // This list is used to initialize m_Handlers member.
+
+ wxHtmlContainerCell *m_Container;
+ // actual container. See Open/CloseContainer for details.
+
+ int m_FontBold, m_FontItalic, m_FontUnderlined, m_FontFixed; // this is not TRUE,FALSE but 1,0, we need it for indexing
+ int m_FontSize; /* -2 to +4, 0 is default */
+ wxColour m_LinkColor;
+ wxColour m_ActualColor;
+ // basic font parameters.
+ wxString m_Link;
+ // actual hypertext link or empty string
+ bool m_UseLink;
+ // TRUE if m_Link is not empty
+ long m_CharHeight, m_CharWidth;
+ // average height of normal-sized text
+ int m_Align;
+ // actual alignment
+
+ wxFont *m_FontsTable[2][2][2][2][7];
+ // table of loaded fonts. 1st four indexes are 0 or 1, depending on on/off
+ // state of these flags (from left to right):
+ // [bold][italic][underlined][fixed_size]
+ // last index is font size : from 0 to 7 (remapped from html sizes -2 to +4)
+ // Note : this table covers all possible combinations of fonts, but not
+ // all of them are used, so many items in table are usually NULL.
+ int m_FontsSizes[7];
+ wxString m_FontFaceFixed, m_FontFaceNormal;
+ int m_ItalicModeFixed, m_ItalicModeNormal;
+ // html font sizes and faces of fixed and proportional fonts
+
+ public:
+ wxHtmlWinParser() : wxHtmlParser() {wxHtmlWinParser(NULL);}
+ wxHtmlWinParser(wxWindow *wnd);
+
+ virtual void InitParser(const wxString& source);
+ virtual void DoneParser();
+ virtual wxObject* GetProduct();
+
+ virtual void SetDC(wxDC *dc) {m_DC = dc;}
+ // Set's the DC used for parsing. If SetDC() is not called,
+ // parsing won't proceed
+ wxDC *GetDC() {return m_DC;}
+ int GetCharHeight() const {return m_CharHeight;}
+ int GetCharWidth() const {return m_CharWidth;}
+ // NOTE : these functions do _not_ return _actual_
+ // height/width. They return h/w of default font
+ // for this DC. If you want actual values, call
+ // GetDC() -> GetChar...()
+ wxWindow *GetWindow() {return m_Window;}
+ // returns associated wxWindow
+
+ void SetFonts(wxString normal_face, int normal_italic_mode, wxString fixed_face, int fixed_italic_mode, int *sizes);
+ // sets fonts to be used when displaying HTML page.
+ // *_italic_mode can be either wxSLANT or wxITALIC
+
+ virtual wxList* GetTempData();
+
+ static void AddModule(wxHtmlTagsModule *module);
+ // Adds tags module. see wxHtmlTagsModule for details.
+
+ // parsing-related methods. These methods are called by tag handlers:
+ wxHtmlContainerCell *GetContainer() const {return m_Container;}
+ // Returns pointer to actual container. Common use in tag handler is :
+ // m_WParser -> GetContainer() -> InsertCell(new ...);
+ wxHtmlContainerCell *OpenContainer();
+ // opens new container. This container is sub-container of opened
+ // container. Sets GetContainer to newly created container
+ // and returns it.
+ wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
+ // works like OpenContainer except that new container is not created
+ // but c is used. You can use this to directly set actual container
+ wxHtmlContainerCell *CloseContainer();
+ // closes the container and sets actual Container to upper-level
+ // container
+
+ int GetFontSize() const {return m_FontSize;}
+ void SetFontSize(int s) {m_FontSize = s;}
+ int GetFontBold() const {return m_FontBold;}
+ void SetFontBold(int x) {m_FontBold = x;}
+ int GetFontItalic() const {return m_FontItalic;}
+ void SetFontItalic(int x) {m_FontItalic = x;}
+ int GetFontUnderlined() const {return m_FontUnderlined;}
+ void SetFontUnderlined(int x) {m_FontUnderlined = x;}
+ int GetFontFixed() const {return m_FontFixed;}
+ void SetFontFixed(int x) {m_FontFixed = x;}
+
+ int GetAlign() const {return m_Align;}
+ void SetAlign(int a) {m_Align = a;}
+ const wxColour& GetLinkColor() const {return m_LinkColor;}
+ void SetLinkColor(const wxColour& clr) {m_LinkColor = clr;}
+ const wxColour& GetActualColor() const {return m_ActualColor;}
+ void SetActualColor(const wxColour& clr) {m_ActualColor = clr;}
+ const wxString& GetLink() const {return m_Link;}
+ void SetLink(const wxString& link) {m_Link = link; m_UseLink = link.Length() > 0;}
+
+ virtual wxFont* CreateCurrentFont();
+ // creates font depending on m_Font* members.
+ // (note : it calls wxHtmlWindow's CreateCurrentFont...)
+
+ protected:
+ virtual void AddText(const char *txt);
+
+ private:
+ bool m_tmpLastWasSpace;
+ // temporary variable used by AddText
+};
+
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlWinTagHandler
+// This is basicly wxHtmlTagHandler except
+// it is extended with protected member m_Parser pointing to
+// the wxHtmlWinParser object
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlWinTagHandler : public wxHtmlTagHandler
+{
+ DECLARE_ABSTRACT_CLASS(wxHtmlWinTagHandler)
+
+ protected:
+ wxHtmlWinParser *m_WParser;
+ // same as m_Parser, but overcasted
+
+ public:
+ wxHtmlWinTagHandler() : wxHtmlTagHandler() {};
+
+ virtual void SetParser(wxHtmlParser *parser) {wxHtmlTagHandler::SetParser(parser); m_WParser = (wxHtmlWinParser*) parser;};
+};
+
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlTagsModule
+// This is basic of dynamic tag handlers binding.
+// The class provides methods for filling parser's handlers
+// hash table.
+// (See documentation for details)
+//--------------------------------------------------------------------------------
+
+class WXDLLEXPORT wxHtmlTagsModule : public wxModule
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlTagsModule)
+
+ public:
+ wxHtmlTagsModule() : wxModule() {};
+
+ virtual bool OnInit();
+ virtual void OnExit();
+
+ virtual void FillHandlersTable(wxHtmlWinParser *parser) {}
+ // This is called by wxHtmlWinParser.
+ // The method must simply call parser->AddTagHandler(new <handler_class_name>);
+ // for each handler
+
+};
+
+
+
+#endif // __HTMLWINPARSER_H__
+
+#endif
+
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: mod_templ.h
+// Purpose: wxHtml tags module generic "template"
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+
+DESCRIPTION:
+This is set of macros for easier writing of tag handlers. How to use it?
+See mod_fonts.cpp for example...
+
+Attention! This is quite strange C++ bastard. Before using it,
+I STRONGLY recommend reading and understanding these macros!!
+
+*/
+
+
+#ifndef __MOD_TEMPL_H__
+#define __MOD_TEMPL_H__
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+
+#ifdef __GNUG__
+#pragma interface
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+
+
+
+#include <wx/html/htmlwinparser.h>
+
+
+#define TAG_HANDLER_BEGIN(name,tags) \
+ class HTML_Handler_##name : public wxHtmlWinTagHandler \
+ { \
+ public: \
+ wxString GetSupportedTags() {return tags;}
+
+
+
+#define TAG_HANDLER_VARS \
+ private:
+
+#define TAG_HANDLER_CONSTR(name) \
+ public: \
+ HTML_Handler_##name () : wxHtmlWinTagHandler()
+
+
+#define TAG_HANDLER_PROC(varib) \
+ public: \
+ bool HandleTag(const wxHtmlTag& varib)
+
+
+
+#define TAG_HANDLER_END(name) \
+ };
+
+
+
+
+#define TAGS_MODULE_BEGIN(name) \
+ class HTML_Module##name : public wxHtmlTagsModule \
+ { \
+ DECLARE_DYNAMIC_CLASS(HTML_Module##name ) \
+ public: \
+ void FillHandlersTable(wxHtmlWinParser *parser) \
+ {
+
+
+
+
+#define TAGS_MODULE_ADD(handler) \
+ parser -> AddTagHandler(new HTML_Handler_##handler);
+
+
+
+
+#define TAGS_MODULE_END(name) \
+ } \
+ }; \
+ IMPLEMENT_DYNAMIC_CLASS(HTML_Module##name , wxHtmlTagsModule)
+
+
+
+#endif
+#endif
\ No newline at end of file
--- /dev/null
+
+//
+// This file contains bitmaps used
+// by wxHtmlHelpController
+// Include it in your .rc file if you're using wxHTML help system
+// (#include "wx/html/msw/wxhtml.rc")
+//
+
+back BITMAP "wx/html/msw/back.bmp"
+forward BITMAP "wx/html/msw/forward.bmp"
+panel BITMAP "wx/html/msw/panel.bmp"
+
+book ICON "wx/html/msw/book.ico"
+folder ICON "wx/html/msw/folder.ico"
+page ICON "wx/html/msw/page.ico"
+
--- /dev/null
+
+#define wxHTML_VERSION_MAJOR 0
+#define wxHTML_VERSION_MINOR 2
+#define wxHTML_VERSION_REL 3
+
+#define wxHTML_VERSION (wxHTML_VERSION_MAJOR * 1000 + wxHTML_VERSION_MINOR * 100 + wxHTML_VERSION_REL)
+
// wxWindow::SetToolTip() method
#define wxUSE_SOCKETS 0
// Set to 1 to use socket classes
+#define wxUSE_HTML 0
+ // Set to 1 to use wxHTML sub-library
/*
* Finer detail
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wxhtml.h
+// Purpose: wxHTML library for wxWindows
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WXHTML_H__
+#define __WXHTML_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+
+#include <wx/html/version.h>
+#include <wx/html/htmldefs.h>
+#include <wx/html/htmltag.h>
+#include <wx/html/htmlcell.h>
+#include <wx/html/htmlparser.h>
+#include <wx/html/htmlwin.h>
+#include <wx/html/htmlwinparser.h>
+#include <wx/filesys.h>
+#include <wx/html/htmlhelp.h>
+
+#endif // __WXHTML_H__
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: zipstream.h
+// Purpose: wxZipInputStream for reading files from ZIP archive
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __ZIPSTREAM_H__
+#define __ZIPSTREAM_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#if wxUSE_ZLIB && wxUSE_STREAMS
+
+#include <wx/stream.h>
+
+//--------------------------------------------------------------------------------
+// wxZipInputStream
+// This class is input stream from ZIP archive. The archive
+// must be local file (accessible via FILE*)
+//--------------------------------------------------------------------------------
+
+
+class WXDLLEXPORT wxZipInputStream : public wxInputStream
+{
+ private:
+ size_t m_Size;
+ off_t m_Pos;
+ void *m_Archive;
+ // this void* is handle of archive .
+ // I'm sorry it is void and not proper type but I don't want
+ // to make unzip.h header public.
+
+ public:
+ wxZipInputStream(const wxString& archive, const wxString& file);
+ // archive is name of .zip archive, file is name of file to be extracted.
+ // Remember that archive must be local file accesible via fopen, fread functions!
+ ~wxZipInputStream();
+
+ protected:
+ virtual size_t StreamSize() const {return m_Size;}
+ virtual size_t OnSysRead(void *buffer, size_t bufsize);
+ virtual off_t OnSysSeek(off_t seek, wxSeekMode mode);
+ virtual off_t OnSysTell() const {return m_Pos;}
+};
+
+
+#endif // if use_zlib && use_streams
+
+#endif // __ZIPSTREAM_H__
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+## Purpose: The automake makefile for wxHTML samples
+## Author: VS
+## Version: $Id$
+##
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS = about help printing test virtual widget zip
+
--- /dev/null
+AUTOMAKE_OPTIONS = 1.3 no-dependencies
+
+SUFFIXES = .cpp
+
+DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
+
+noinst_PROGRAMS = about
+
+about_SOURCES = about.cpp
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: test.cpp
+// Purpose: wxHtml testing example
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma implementation "test.cpp"
+ #pragma interface "test.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include <wx/wxprec.h>
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+ #include <wx/wx.h>
+#endif
+
+#include <wx/image.h>
+#include <wx/wxhtml.h>
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+
+// Define a new application type, each program should derive a class from wxApp
+ class MyApp : public wxApp
+ {
+ public:
+ // override base class virtuals
+ // ----------------------------
+
+ // this one is called on application startup and is a good place for the app
+ // initialization (doing it here and not in the ctor allows to have an error
+ // return: if OnInit() returns false, the application terminates)
+ virtual bool OnInit();
+ };
+
+// Define a new frame type: this is going to be our main frame
+ class MyFrame : public wxFrame
+ {
+ public:
+ // ctor(s)
+ MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
+
+ // event handlers (these functions should _not_ be virtual)
+ void OnQuit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+
+ private:
+ // any class wishing to process wxWindows events must use this macro
+ DECLARE_EVENT_TABLE()
+ };
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+ enum
+ {
+ // menu items
+ Minimal_Quit = 1,
+ Minimal_About,
+ Minimal_Back,
+ Minimal_Forward,
+
+ // controls start here (the numbers are, of course, arbitrary)
+ Minimal_Text = 1000,
+ };
+
+// ----------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// ----------------------------------------------------------------------------
+
+// the event tables connect the wxWindows events with the functions (event
+// handlers) which process them. It can be also done at run-time, but for the
+// simple menu events like this the static method is much simpler.
+ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
+ EVT_MENU(Minimal_About, MyFrame::OnAbout)
+ END_EVENT_TABLE()
+
+ // Create a new application object: this macro will allow wxWindows to create
+ // the application object during program execution (it's better than using a
+ // static object for many reasons) and also declares the accessor function
+ // wxGetApp() which will return the reference of the right type (i.e. MyApp and
+ // not wxApp)
+ IMPLEMENT_APP(MyApp)
+
+ // ============================================================================
+ // implementation
+ // ============================================================================
+
+ // ----------------------------------------------------------------------------
+ // the application class
+ // ----------------------------------------------------------------------------
+ // `Main program' equivalent: the program execution "starts" here
+ bool MyApp::OnInit()
+ {
+ wxImage::AddHandler(new wxPNGHandler);
+ // Create the main application window
+ MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
+ wxPoint(50, 50), wxSize(150, 50));
+
+ // Show it and tell the application that it's our main window
+ // @@@ what does it do exactly, in fact? is it necessary here?
+ frame->Show(TRUE);
+ SetTopWindow(frame);
+
+
+ // success: wxApp::OnRun() will be called which will enter the main message
+ // loop and the application will run. If we returned FALSE here, the
+ // application would exit immediately.
+ return TRUE;
+ }
+
+// ----------------------------------------------------------------------------
+// main frame
+// ----------------------------------------------------------------------------
+
+
+// frame constructor
+ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : wxFrame((wxFrame *)NULL, -1, title, pos, size)
+ {
+ // create a menu bar
+ wxMenu *menuFile = new wxMenu;
+
+ menuFile->Append(Minimal_About, "&About");
+ menuFile->Append(Minimal_Quit, "E&xit");
+
+ // now append the freshly created menu to the menu bar...
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(menuFile, "&File");
+
+ // ... and attach this menu bar to the frame
+ SetMenuBar(menuBar);
+ }
+
+
+// event handlers
+
+ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+ {
+ // TRUE is to force the frame to close
+ Close(TRUE);
+ }
+
+ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+ {
+ wxHtmlWindow *html;
+ wxDialog dlg(this, -1, "About", wxDefaultPosition, wxSize(400, 230), wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE);
+
+ html = new wxHtmlWindow(&dlg, -1, wxPoint(10, 10), wxSize(380, 160), "htmlWindow", FALSE);
+ html -> SetBorders(0);
+ html -> LoadPage("data/about.htm");
+ wxButton *bu1 = new wxButton(&dlg, wxID_OK, "OK", wxPoint(250, 185), wxSize(100, 30));
+ bu1 -> SetDefault();
+ dlg.ShowModal();
+ }
+
+
+
+
+
+
+
--- /dev/null
+#include "wx/msw/wx.rc"
+
--- /dev/null
+<html><body bgcolor="#FFFFFF"><table cellspacing=3 cellpadding=4 width="100%">
+<tr><td bgcolor="#101010">
+<center><font size=+2 color="#FFFFFF"><b>
+<br>wxHTML Library Sample 0.2.0<br>
+</b></font></center>
+<tr><td bgcolor="#73A183">
+<b><font size=+1>Copyright (C) 1999 Vaclav Slavik</font></b><p>
+<font size=-1>
+<table cellpadding=0 cellspacing=0 width="100%">
+<tr><td width="65%">
+Vaclav Slavik (slavik2@czn.cz)<br>Someone Else (selse@hell.org)<p>
+<td valign=top><img src="logo.png">
+</table>
+<font size=-2>
+The wxHTML library is available at <font color="#0000FF">http://www.ms.mff.cuni.cz/~vsla8348/wxhtml</font><br>
+The library is licenced under wxWindows Library Licence, Version 3.
+</font></font></table></body></html>
--- /dev/null
+AUTOMAKE_OPTIONS = 1.3 no-dependencies
+
+SUFFIXES = .cpp
+
+DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
+
+noinst_PROGRAMS = help
+
+help_SOURCES = help.cpp
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: test.cpp
+// Purpose: wxHtml testing example
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma implementation
+ #pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include <wx/wxprec.h>
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+ #include <wx/wx.h>
+#endif
+
+#include <wx/image.h>
+#include <wx/wxhtml.h>
+#if (( wxVERSION_NUMBER < 2100 ) || (( wxVERSION_NUMBER == 2100 ) && (wxBETA_NUMBER <= 4)))
+#include <wx/imaggif.h>
+#endif
+#include <wx/config.h>
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+// Define a new application type, each program should derive a class from wxApp
+ class MyApp : public wxApp
+ {
+ private:
+ wxHtmlHelpController help;
+ wxConfig* config;
+
+ public:
+ // override base class virtuals
+ // ----------------------------
+
+ // this one is called on application startup and is a good place for the app
+ // initialization (doing it here and not in the ctor allows to have an error
+ // return: if OnInit() returns false, the application terminates)
+ bool OnInit();
+ int OnExit();
+ };
+
+ IMPLEMENT_APP(MyApp)
+
+
+ bool MyApp::OnInit()
+ {
+ config = new wxConfig("wxHTMLhelp");
+ #if wxUSE_LIBPNG
+ wxImage::AddHandler(new wxPNGHandler);
+ #endif
+ #if wxUSE_LIBJPEG
+ wxImage::AddHandler(new wxJPEGHandler);
+ #endif
+
+ help.UseConfig(config);
+ help.SetTempDir("tmp");
+ help.AddBook("helpfiles/testing.hhp");
+ help.Display("Main page");
+ return TRUE;
+ }
+
+ int MyApp::OnExit()
+ {
+ delete config;
+ return 0;
+ }
+
+
+
+
+
+
+
+
--- /dev/null
+#include "wx/msw/wx.rc"
+#include "wx/html/msw/wxhtml.rc"
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<HTML>
+<HEAD>
+<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
+<!-- Sitemap 1.0 -->
+</HEAD><BODY>
+<UL>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="1">
+ <param name="Name" value="Book 1">
+ <param name="Local" value="book1.htm">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="main">
+ <param name="Name" value="Untitled: d:\HELPS\testing\main.htm">
+ <param name="Local" value="main.htm">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="2">
+ <param name="Name" value="Book 1">
+ <param name="Local" value="book2.htm">
+ </OBJECT>
+</UL>
+</BODY></HTML>
--- /dev/null
+<html><title>Book 1</title><body>
+<h2>Book 1.</h2>
+How do you enjoy <i> book one</i>??
+</body></html>
--- /dev/null
+<html><title>Book 1</title><body>
+<h2>Book 2.</h2>
+How do you enjoy <i> book two</i>??
+<p>Please click <a href="page2-b.htm">HERE</a>
+</body></html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<HTML>
+<HEAD>
+<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
+<!-- Sitemap 1.0 -->
+</HEAD><BODY>
+<OBJECT type="text/site properties">
+ <param name="ImageType" value="Folder">
+</OBJECT>
+<UL>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Main page">
+ <param name="Local" value="main.htm">
+ </OBJECT>
+ <UL>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Book 1">
+ <param name="Local" value="book1.htm">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Book 2">
+ <param name="ID" value=34>
+ <param name="Local" value="book2.htm">
+ </OBJECT>
+ <UL>
+ <LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="sub book">
+ <param name="Local" value="page2-b.htm">
+ </OBJECT>
+ </UL>
+ </UL>
+</UL>
+</BODY></HTML>
--- /dev/null
+<html><body>
+<h2>This is main page.</h2>
+<a href="book1.htm">Book 1</a><br>
+<a href="book2.htm">Book 2</a><br>
+</body></html>
--- /dev/null
+<html><body>
+<font color="#FF0000" size=+4 face="Tahoma">
+Hello, you're on sub page of page 2 !!!
+</font>
+</body></html>
--- /dev/null
+[OPTIONS]
+Compatibility=1.1
+Compiled file=testing.chm
+Contents file=contents.hhc
+Display compile progress=No
+Index file=Index.hhk
+Language=0x405 Èesky
+Title=Testing HELPFILE :-)
+Default topic=main.htm
+
+[FILES]
+main.htm
+book1.htm
+book2.htm
+page2-b.htm
--- /dev/null
+AUTOMAKE_OPTIONS = 1.3 no-dependencies
+
+SUFFIXES = .cpp
+
+DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
+
+noinst_PROGRAMS = printing
+
+printing_SOURCES = printing.cpp
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
--- /dev/null
+/*
+ * File: printing.cc
+ * Purpose: Printing demo for wxWindows class library
+ * Author: Julian Smart
+ * modified by Vaclav Slavik (wxHTML stuffs)
+ * Created: 1995
+ * Updated:
+ * Copyright: (c) 1995, AIAI, University of Edinburgh
+ */
+
+/* static const char sccsid[] = "%W% %G%"; */
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#if !wxUSE_PRINTING_ARCHITECTURE
+#error You must set wxUSE_PRINTING_ARCHITECTURE to 1 in setup.h to compile this demo.
+#endif
+
+// Set this to 1 if you want to test PostScript printing under MSW.
+// However, you'll also need to edit src/msw/makefile.nt.
+
+//!!! DON'T DO THAT! This is wxHTML sample now
+#define wxTEST_POSTSCRIPT_IN_MSW 0
+
+#include <ctype.h>
+#include "wx/metafile.h"
+#include "wx/print.h"
+#include "wx/printdlg.h"
+
+#include "wx/accel.h"
+
+#if wxTEST_POSTSCRIPT_IN_MSW
+#include "wx/generic/printps.h"
+#include "wx/generic/prntdlgg.h"
+#endif
+
+#include <wx/wxhtml.h>
+#include <wx/wfstream.h>
+#include "printing.h"
+
+#ifndef __WXMSW__
+#include "mondrian.xpm"
+#endif
+
+// Global print data, to remember settings during the session
+wxPrintData *g_printData = (wxPrintData*) NULL ;
+
+// Global page setup data
+wxPageSetupData* g_pageSetupData = (wxPageSetupData*) NULL;
+
+
+// Declare a frame
+MyFrame *frame = (MyFrame *) NULL;
+wxHtmlWindow *html = NULL;
+int orientation = wxPORTRAIT;
+
+// Main proc
+IMPLEMENT_APP(MyApp)
+
+
+MyApp::MyApp()
+{
+}
+
+// The `main program' equivalent, creating the windows and returning the
+// main frame
+bool MyApp::OnInit(void)
+{
+ g_printData = new wxPrintData;
+ g_pageSetupData = new wxPageSetupDialogData;
+
+ // Create the main frame window
+ frame = new MyFrame((wxFrame *) NULL, (char *) "wxWindows Printing Demo", wxPoint(0, 0), wxSize(600, 400));
+
+ // Give it a status line
+ frame->CreateStatusBar(2);
+
+ // Load icon and bitmap
+ frame->SetIcon( wxICON( mondrian) );
+
+ // Make a menubar
+ wxMenu *file_menu = new wxMenu;
+
+ file_menu->Append(WXPRINT_PRINT, "&Print...", "Print");
+ file_menu->Append(WXPRINT_PRINT_SETUP, "Print &Setup...", "Setup printer properties");
+ file_menu->Append(WXPRINT_PAGE_SETUP, "Page Set&up...", "Page setup");
+ file_menu->Append(WXPRINT_PREVIEW, "Print Pre&view", "Preview");
+
+ // Accelerators
+ wxAcceleratorEntry entries[1];
+ entries[0].Set(wxACCEL_CTRL, (int) 'V', WXPRINT_PREVIEW);
+ wxAcceleratorTable accel(1, entries);
+ frame->SetAcceleratorTable(accel);
+
+ file_menu->AppendSeparator();
+ file_menu->Append(WXPRINT_QUIT, "E&xit", "Exit program");
+
+ wxMenu *help_menu = new wxMenu;
+ help_menu->Append(WXPRINT_ABOUT, "&About", "About this demo");
+
+ wxMenuBar *menu_bar = new wxMenuBar;
+
+ menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(help_menu, "&Help");
+
+ // Associate the menu bar with the frame
+ frame->SetMenuBar(menu_bar);
+
+ frame->Centre(wxBOTH);
+ frame->Show(TRUE);
+
+ frame->SetStatusText("Printing demo");
+
+ SetTopWindow(frame);
+
+ return TRUE;
+}
+
+int MyApp::OnExit()
+{
+ delete g_printData;
+ delete g_pageSetupData;
+ return 1;
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_MENU(WXPRINT_QUIT, MyFrame::OnExit)
+ EVT_MENU(WXPRINT_PRINT, MyFrame::OnPrint)
+ EVT_MENU(WXPRINT_PREVIEW, MyFrame::OnPrintPreview)
+ EVT_MENU(WXPRINT_PRINT_SETUP, MyFrame::OnPrintSetup)
+ EVT_MENU(WXPRINT_PAGE_SETUP, MyFrame::OnPageSetup)
+ EVT_MENU(WXPRINT_ABOUT, MyFrame::OnPrintAbout)
+END_EVENT_TABLE()
+
+// Define my frame constructor
+MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
+ wxFrame(frame, -1, title, pos, size)
+{
+ html = new wxHtmlWindow(this);
+ html -> LoadPage("test.htm");
+}
+
+void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
+{
+ Close(TRUE);
+}
+
+void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
+{
+ wxPrinter printer;
+ MyPrintout printout("My printout");
+ if (!printer.Print(this, &printout, TRUE))
+ wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK);
+}
+
+void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
+{
+ wxPrintData printData;
+ printData.SetOrientation(orientation);
+
+ // Pass two printout objects: for preview, and possible printing.
+ wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printData);
+ if (!preview->Ok())
+ {
+ delete preview;
+ wxMessageBox("There was a problem previewing.\nPerhaps your current printer is not set correctly?", "Previewing", wxOK);
+ return;
+ }
+
+ wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
+ frame->Centre(wxBOTH);
+ frame->Initialize();
+ frame->Show(TRUE);
+}
+
+void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event))
+{
+ wxPrintDialogData printDialogData(* g_printData);
+ wxPrintDialog printerDialog(this, & printDialogData);
+
+ printerDialog.GetPrintDialogData().SetSetupDialog(TRUE);
+ printerDialog.ShowModal();
+
+ (*g_printData) = printerDialog.GetPrintDialogData().GetPrintData();
+}
+
+void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
+{
+ (*g_pageSetupData) = * g_printData;
+
+ wxPageSetupDialog pageSetupDialog(this, g_pageSetupData);
+ pageSetupDialog.ShowModal();
+
+ (*g_printData) = pageSetupDialog.GetPageSetupData().GetPrintData();
+ (*g_pageSetupData) = pageSetupDialog.GetPageSetupData();
+}
+
+
+
+void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event))
+{
+ (void)wxMessageBox("wxWindows printing demo\nAuthor: Julian Smart julian.smart@ukonline.co.uk\n\nModified by Vaclav Slavik to show wxHtml features",
+ "About wxWindows printing demo", wxOK|wxCENTRE);
+}
+
+
+bool MyPrintout::OnPrintPage(int page)
+{
+ wxDC *dc = GetDC();
+ if (dc)
+ {
+ if (page == 1)
+ DrawPageOne(dc);
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+bool MyPrintout::OnBeginDocument(int startPage, int endPage)
+{
+ if (!wxPrintout::OnBeginDocument(startPage, endPage))
+ return FALSE;
+
+ return TRUE;
+}
+
+void MyPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
+{
+ *minPage = 1;
+ *maxPage = 1;
+ *selPageFrom = 1;
+ *selPageTo = 1;
+}
+
+bool MyPrintout::HasPage(int pageNum)
+{
+ return (pageNum == 1);
+}
+
+
+void MyPrintout::DrawPageOne(wxDC *dc)
+{
+ int leftMargin = 20;
+ int topMargin = 40;
+
+/* You might use THIS code to set the printer DC to ROUGHLY reflect
+ * the screen text size. This page also draws lines of actual length 5cm
+ * on the page.
+ */
+ // Get the logical pixels per inch of screen and printer
+ int ppiScreenX, ppiScreenY;
+ GetPPIScreen(&ppiScreenX, &ppiScreenY);
+ int ppiPrinterX, ppiPrinterY;
+ GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
+
+ // Here we obtain internal cell representation of HTML document:
+ wxHtmlContainerCell *cell = html -> GetInternalRepresentation();
+
+ // Now we have to check in case our real page size is reduced
+ // (e.g. because we're drawing to a print preview memory DC)
+ int pageWidth, pageHeight;
+ int w, h;
+ dc->GetSize(&w, &h);
+ GetPageSizePixels(&pageWidth, &pageHeight);
+
+ // Now we must scale it somehow. The best would be to suppose that html window
+ // width is equal to page width:
+
+ float scale = (float)((float)(pageWidth - 0 * leftMargin)/((float)cell -> GetMaxLineWidth() + 2 * leftMargin));
+
+ // If printer pageWidth == current DC width, then this doesn't
+ // change. But w might be the preview bitmap width, so scale down.
+ float overallScale = scale * (float)(w/(float)pageWidth);
+ dc->SetUserScale(overallScale, overallScale);
+
+ // Calculate conversion factor for converting millimetres into
+ // logical units.
+ // There are approx. 25.1 mm to the inch. There are ppi
+ // device units to the inch. Therefore 1 mm corresponds to
+ // ppi/25.1 device units. We also divide by the
+ // screen-to-printer scaling factor, because we need to
+ // unscale to pass logical units to DrawLine.
+
+ dc->SetBackgroundMode(wxTRANSPARENT);
+
+ // TESTING
+
+ int pageWidthMM, pageHeightMM;
+ GetPageSizeMM(&pageWidthMM, &pageHeightMM);
+
+
+ // This is all the printing :
+ cell -> Draw(*dc, leftMargin, topMargin, 0, cell -> GetHeight());
+}
+
+
+
--- /dev/null
+/*
+ * File: printing.h
+ * Purpose: Printing demo for wxWindows class library
+ * Author: Julian Smart
+ * Created: 1995
+ * Updated:
+ * Copyright: (c) 1995, AIAI, University of Edinburgh
+ */
+
+/* sccsid[] = "%W% %G%" */
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+// Define a new application
+class MyApp: public wxApp
+{
+ public:
+ MyApp() ;
+ bool OnInit();
+ int OnExit();
+};
+
+DECLARE_APP(MyApp)
+
+class MyCanvas;
+
+// Define a new canvas and frame
+class MyFrame: public wxFrame
+{
+ public:
+ MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
+
+ void OnPrint(wxCommandEvent& event);
+ void OnPrintPreview(wxCommandEvent& event);
+ void OnPrintSetup(wxCommandEvent& event);
+ void OnPageSetup(wxCommandEvent& event);
+#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
+ void OnPrintPS(wxCommandEvent& event);
+ void OnPrintPreviewPS(wxCommandEvent& event);
+ void OnPrintSetupPS(wxCommandEvent& event);
+ void OnPageSetupPS(wxCommandEvent& event);
+#endif
+
+ void OnExit(wxCommandEvent& event);
+ void OnPrintAbout(wxCommandEvent& event);
+DECLARE_EVENT_TABLE()
+};
+
+
+class MyPrintout: public wxPrintout
+{
+ public:
+ MyPrintout(char *title = "My printout"):wxPrintout(title) {}
+ bool OnPrintPage(int page);
+ bool HasPage(int page);
+ bool OnBeginDocument(int startPage, int endPage);
+ void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
+
+ void DrawPageOne(wxDC *dc);
+};
+
+#define WXPRINT_QUIT 100
+#define WXPRINT_PRINT 101
+#define WXPRINT_PRINT_SETUP 102
+#define WXPRINT_PAGE_SETUP 103
+#define WXPRINT_PREVIEW 104
+
+#define WXPRINT_PRINT_PS 105
+#define WXPRINT_PRINT_SETUP_PS 106
+#define WXPRINT_PAGE_SETUP_PS 107
+#define WXPRINT_PREVIEW_PS 108
+
+#define WXPRINT_ABOUT 109
+
--- /dev/null
+mondrian ICON "mondrian.ico"
+#include "wx/msw/wx.rc"
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="GENERATOR" CONTENT="Mozilla/4.06 [en] (X11; I; Linux 2.0.35 i686) [Netscape]">
+</HEAD>
+<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#000088">
+This is - - default text, now switching to
+<CENTER>
+<P>center, now still ctr, now exiting</CENTER>
+
+<P>exited!.<A HREF="#downtown">[link to down]</A>
+<P>Hello, this *is* default charset (helvetica, probably) and it is displayed
+with one <FONT COLOR="#FF0000">COLOR CHANGE</FONT>. Of course we
+can have as many color changes as we can, what about this <FONT COLOR="#FF0000">M</FONT><FONT COLOR="#FFFF00">A</FONT><FONT COLOR="#33FF33">D</FONT><B><FONT COLOR="#FFFFFF"><FONT SIZE=+1>N</FONT></FONT></B>E<FONT COLOR="#999999">S</FONT><FONT COLOR="#CC33CC">S?</FONT>
+<P><FONT COLOR="#000000">There was a space above.</FONT>
+<BR>
+<HR WIDTH="100%">This was a line. <TT>(BTW we are in <B>fixed</B> font
+/ <I><U>typewriter</U> font</I> right now :-)</TT>
+<BR>This is in <B>BOLD</B> face. This is <I>ITALIC.</I> This is <B><I><U>E
+V E R Y T H I N G</U></I></B>.
+<BR>
+<BR>
+<BR>
+<BR>
+<BR>
+<CENTER>
+<P>Right now, <FONT COLOR="#0000FF"><FONT SIZE=+4>centered REALLY Big Text</FONT></FONT>,
+how do you like (space) it?</CENTER>
+
+<DIV ALIGN=right>RIGHT: <FONT SIZE=-2>text-2, </FONT><FONT SIZE=-1>text-1,
+</FONT>text+0,
+<FONT SIZE=+1>text+1,
+</FONT><FONT COLOR="#FF0000"><FONT SIZE=+2>text+2,
+</FONT></FONT><FONT SIZE=+3>text+3,
+</FONT><FONT SIZE=+4>text+4</FONT>
+<BR><U><FONT SIZE=+1>we are right now</FONT></U></DIV>
+
+<CENTER><U><FONT SIZE=+1>we are center now</FONT></U></CENTER>
+<U><FONT SIZE=+1>we are left now.</FONT></U>
+<P><I><FONT COLOR="#3366FF">Blue italic text is displayed there....</FONT></I>
+<H1>
+
+<HR ALIGN=LEFT SIZE=10 WIDTH="50%">This is heading one.</H1>
+this is normal
+<CENTER>
+<H1>
+This is <FONT COLOR="#33FF33">CENTERED</FONT> heading one</H1></CENTER>
+<IMG SRC="pic.png" ALT="Testing image image" >and this is text......
+<BR>
+<UL>
+<LI>
+item 1</LI>
+
+<LI>
+item 2</LI>
+
+<UL>
+<LI>
+nested item</LI>
+
+<LI>
+nested item 2</LI>
+</UL>
+
+<LI>
+item 3</LI>
+</UL>
+
+<OL>
+<LI>
+item one</LI>
+
+<LI>
+item two</LI>
+
+<OL>
+<LI>
+nsted item</LI>
+</OL>
+
+<LI>
+last numbered item</LI>
+</OL>
+
+<H1>
+Heading 1</H1>
+<I>Italic text now...</I>
+<H2>
+<I>Heading 2</I></H2>
+<I>and now?</I>
+<H3>
+Heading 3</H3>
+
+<H4>
+Heading 4</H4>
+
+<H5>
+Heading 5</H5>
+
+<H6>
+Heading 6</H6>
+And this is normal text, once again :-)
+<P>And yes, we're in <FONT SIZE=+4>HTML DOCUMENT, </FONT><FONT SIZE=+1>so
+what about some nice <A HREF="fft.html">hypertext link</A>??</FONT>
+<P>hello?
+<CENTER>
+<P>This is <A NAME="downtown"></A>centered paragraph</CENTER>
+
+<P>Now, you will see some PRE text:
+<PRE>// This is sample C++ code:
+
+void main(int argc, char *argv[])
+{
+ printf("Go away, man!\n");
+ i = 666;
+ printf("\n\n\nCRASH\n DOWN NOW. . . \n");
+}</PRE>
+
+<H3>
+WWW</H3>
+<A HREF="http://www.kde.org">This is WWW link to KDE site!</A>
+<BR><A HREF="http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html">(one
+folder up)</A>
+</BODY>
+</HTML>
--- /dev/null
+AUTOMAKE_OPTIONS = 1.3 no-dependencies
+
+SUFFIXES = .cpp
+
+DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
+
+noinst_PROGRAMS = test
+
+test_SOURCES = test.cpp
--- /dev/null
+<HTML>
+<head><title>wxWindow</title></head>
+<BODY BGCOLOR="#FFFFFF">
+<A NAME="wxwindow"></A><CENTER>
+<A HREF="http://www.wx.org/wx.zip#zip:wx.htm#anchor">Contents</A> <A HREF="wx22.htm#classref">Up</A> <A HREF="wx259.htm#wxwave"><<</A> <A HREF="wx261.htm#wxwindowdc">>></A> </CENTER><HR>
+
+<H2>wxWindow</H2>
+<P>
+wxWindow is the base class for all windows. Any
+children of the window will be deleted automatically by the destructor
+before the window itself is deleted.<P>
+<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
+<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>
+
+<A HREF="wx158.htm#wxobject">wxObject</A><P>
+<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
+<wx/window.h><P>
+<B><FONT COLOR="#FF0000">Window styles</FONT></B><P>
+The following styles can apply to all windows, although they will not always make sense for a particular
+window class.<P>
+
+<TABLE BORDER>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxSIMPLE_BORDER</B>
+</TD>
+
+<TD VALIGN=TOP>
+Displays a thin border around the window. wxBORDER is the old name
+for this style.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxDOUBLE_BORDER</B>
+</TD>
+
+<TD VALIGN=TOP>
+Displays a double border. Windows only.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxSUNKEN_BORDER</B>
+</TD>
+
+<TD VALIGN=TOP>
+Displays a sunken border.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxRAISED_BORDER</B>
+</TD>
+
+<TD VALIGN=TOP>
+Displays a raised border.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxSTATIC_BORDER</B>
+</TD>
+
+<TD VALIGN=TOP>
+Displays a border suitable for a static control.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxTRANSPARENT_WINDOW</B>
+</TD>
+
+<TD VALIGN=TOP>
+The window is transparent, that is, it will not receive paint
+events. Windows only.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxNO_3D</B>
+</TD>
+
+<TD VALIGN=TOP>
+Prevents the children of this window taking on 3D styles, even though
+the application-wide policy is for 3D controls. Windows only.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxTAB_TRAVERSAL</B>
+</TD>
+
+<TD VALIGN=TOP>
+Use this to enable tab traversal for non-dialog windows.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxVSCROLL</B>
+</TD>
+
+<TD VALIGN=TOP>
+Use this style to enable a vertical scrollbar.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxHSCROLL</B>
+</TD>
+
+<TD VALIGN=TOP>
+Use this style to enable a horizontal scrollbar.
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxCLIP_CHILDREN</B>
+</TD>
+
+<TD VALIGN=TOP>
+Use this style to eliminate flicker caused by the background being
+repainted, then children being painted over them. Windows-only.
+</TD></TR>
+
+
+</TABLE>
+<P>
+See also <A HREF="wx305.htm#windowstyles">window styles overview</A>.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+<B><FONT COLOR="#FF0000">Members</FONT></B><P>
+<A HREF="#topic1026">wxWindow::wxWindow</A><BR>
+<A HREF="#topic1027">wxWindow::~wxWindow</A><BR>
+<A HREF="#topic1028">wxWindow::AddChild</A><BR>
+<A HREF="#wxwindowcapturemouse">wxWindow::CaptureMouse</A><BR>
+<A HREF="#wxwindowcenter">wxWindow::Center</A><BR>
+<A HREF="#wxwindowcentre">wxWindow::Centre</A><BR>
+<A HREF="#wxwindowclear">wxWindow::Clear</A><BR>
+<A HREF="#topic1029">wxWindow::ClientToScreen</A><BR>
+<A HREF="#wxwindowclose">wxWindow::Close</A><BR>
+<A HREF="#wxwindowconvertdialogtopixels">wxWindow::ConvertDialogToPixels</A><BR>
+<A HREF="#wxwindowconvertpixelstodialog">wxWindow::ConvertPixelsToDialog</A><BR>
+<A HREF="#wxwindowdestroy">wxWindow::Destroy</A><BR>
+<A HREF="#topic1030">wxWindow::DestroyChildren</A><BR>
+<A HREF="#wxwindowdragacceptfiles">wxWindow::DragAcceptFiles</A><BR>
+<A HREF="#wxwindowenable">wxWindow::Enable</A><BR>
+<A HREF="#wxwindowfindfocus">wxWindow::FindFocus</A><BR>
+<A HREF="#wxwindowfindwindow">wxWindow::FindWindow</A><BR>
+<A HREF="#wxwindowfit">wxWindow::Fit</A><BR>
+<A HREF="#wxwindowgetbackgroundcolour">wxWindow::GetBackgroundColour</A><BR>
+<A HREF="#topic1031">wxWindow::GetCharHeight</A><BR>
+<A HREF="#topic1032">wxWindow::GetCharWidth</A><BR>
+<A HREF="#topic1033">wxWindow::GetChildren</A><BR>
+<A HREF="#wxwindowgetclientsize">wxWindow::GetClientSize</A><BR>
+<A HREF="#wxwindowgetconstraints">wxWindow::GetConstraints</A><BR>
+<A HREF="#wxwindowgetdefaultitem">wxWindow::GetDefaultItem</A><BR>
+<A HREF="#wxwindowgetdroptarget">wxWindow::GetDropTarget</A><BR>
+<A HREF="#wxwindowgeteventhandler">wxWindow::GetEventHandler</A><BR>
+<A HREF="#wxwindowgetfont">wxWindow::GetFont</A><BR>
+<A HREF="#wxwindowgetforegroundcolour">wxWindow::GetForegroundColour</A><BR>
+<A HREF="#topic1034">wxWindow::GetGrandParent</A><BR>
+<A HREF="#topic1035">wxWindow::GetHandle</A><BR>
+<A HREF="#wxwindowgetid">wxWindow::GetId</A><BR>
+<A HREF="#topic1036">wxWindow::GetPosition</A><BR>
+<A HREF="#topic1037">wxWindow::GetLabel</A><BR>
+<A HREF="#wxwindowgetname">wxWindow::GetName</A><BR>
+<A HREF="#topic1038">wxWindow::GetParent</A><BR>
+<A HREF="#wxwindowgetrect">wxWindow::GetRect</A><BR>
+<A HREF="#wxwindowgetreturncode">wxWindow::GetReturnCode</A><BR>
+<A HREF="#wxwindowgetscrollthumb">wxWindow::GetScrollThumb</A><BR>
+<A HREF="#wxwindowgetscrollpos">wxWindow::GetScrollPos</A><BR>
+<A HREF="#wxwindowgetscrollrange">wxWindow::GetScrollRange</A><BR>
+<A HREF="#wxwindowgetsize">wxWindow::GetSize</A><BR>
+<A HREF="#topic1039">wxWindow::GetTextExtent</A><BR>
+<A HREF="#wxwindowgettitle">wxWindow::GetTitle</A><BR>
+<A HREF="#wxwindowgetupdateregion">wxWindow::GetUpdateRegion</A><BR>
+<A HREF="#topic1040">wxWindow::GetWindowStyleFlag</A><BR>
+<A HREF="#wxwindowinitdialog">wxWindow::InitDialog</A><BR>
+<A HREF="#wxwindowisenabled">wxWindow::IsEnabled</A><BR>
+<A HREF="#wxwindowisretained">wxWindow::IsRetained</A><BR>
+<A HREF="#wxwindowisshown">wxWindow::IsShown</A><BR>
+<A HREF="#wxwindowlayout">wxWindow::Layout</A><BR>
+<A HREF="#wxwindowloadfromresource">wxWindow::LoadFromResource</A><BR>
+<A HREF="#wxwindowlower">wxWindow::Lower</A><BR>
+<A HREF="#wxwindowmakemodal">wxWindow::MakeModal</A><BR>
+<A HREF="#wxwindowmove">wxWindow::Move</A><BR>
+<A HREF="#wxwindowonactivate">wxWindow::OnActivate</A><BR>
+<A HREF="#wxwindowonchar">wxWindow::OnChar</A><BR>
+<A HREF="#wxwindowoncharhook">wxWindow::OnCharHook</A><BR>
+<A HREF="#wxwindowoncommand">wxWindow::OnCommand</A><BR>
+<A HREF="#wxwindowonclose">wxWindow::OnClose</A><BR>
+<A HREF="#wxwindowonclosewindow">wxWindow::OnCloseWindow</A><BR>
+<A HREF="#wxwindowondropfiles">wxWindow::OnDropFiles</A><BR>
+<A HREF="#wxwindowonerasebackground">wxWindow::OnEraseBackground</A><BR>
+<A HREF="#wxwindowonkeydown">wxWindow::OnKeyDown</A><BR>
+<A HREF="#wxwindowonkeyup">wxWindow::OnKeyUp</A><BR>
+<A HREF="#wxwindowonkillfocus">wxWindow::OnKillFocus</A><BR>
+<A HREF="#wxwindowonidle">wxWindow::OnIdle</A><BR>
+<A HREF="#wxwindowoninitdialog">wxWindow::OnInitDialog</A><BR>
+<A HREF="#wxwindowonmenucommand">wxWindow::OnMenuCommand</A><BR>
+<A HREF="#wxwindowonmenuhighlight">wxWindow::OnMenuHighlight</A><BR>
+<A HREF="#wxwindowonmouseevent">wxWindow::OnMouseEvent</A><BR>
+<A HREF="#wxwindowonmove">wxWindow::OnMove</A><BR>
+<A HREF="#wxwindowonpaint">wxWindow::OnPaint</A><BR>
+<A HREF="#wxwindowonscroll">wxWindow::OnScroll</A><BR>
+<A HREF="#wxwindowonsetfocus">wxWindow::OnSetFocus</A><BR>
+<A HREF="#wxwindowonsize">wxWindow::OnSize</A><BR>
+<A HREF="#wxwindowonsyscolourchanged">wxWindow::OnSysColourChanged</A><BR>
+<A HREF="#wxwindowpopeventhandler">wxWindow::PopEventHandler</A><BR>
+<A HREF="#wxwindowpopupmenu">wxWindow::PopupMenu</A><BR>
+<A HREF="#wxwindowpusheventhandler">wxWindow::PushEventHandler</A><BR>
+<A HREF="#wxwindowraise">wxWindow::Raise</A><BR>
+<A HREF="#wxwindowrefresh">wxWindow::Refresh</A><BR>
+<A HREF="#wxwindowreleasemouse">wxWindow::ReleaseMouse</A><BR>
+<A HREF="#wxwindowremovechild">wxWindow::RemoveChild</A><BR>
+<A HREF="#wxwindowscreentoclient">wxWindow::ScreenToClient</A><BR>
+<A HREF="#wxwindowscrollwindow">wxWindow::ScrollWindow</A><BR>
+<A HREF="#wxwindowsetacceleratortable">wxWindow::SetAcceleratorTable</A><BR>
+<A HREF="#wxwindowsetautolayout">wxWindow::SetAutoLayout</A><BR>
+<A HREF="#wxwindowsetbackgroundcolour">wxWindow::SetBackgroundColour</A><BR>
+<A HREF="#wxwindowsetclientsize">wxWindow::SetClientSize</A><BR>
+<A HREF="#wxwindowsetcursor">wxWindow::SetCursor</A><BR>
+<A HREF="#wxwindowseteventhandler">wxWindow::SetEventHandler</A><BR>
+<A HREF="#wxwindowsetconstraints">wxWindow::SetConstraints</A><BR>
+<A HREF="#wxwindowsetdroptarget">wxWindow::SetDropTarget</A><BR>
+<A HREF="#wxwindowsetfocus">wxWindow::SetFocus</A><BR>
+<A HREF="#wxwindowsetfont">wxWindow::SetFont</A><BR>
+<A HREF="#wxwindowsetforegroundcolour">wxWindow::SetForegroundColour</A><BR>
+<A HREF="#wxwindowsetid">wxWindow::SetId</A><BR>
+<A HREF="#wxwindowsetname">wxWindow::SetName</A><BR>
+<A HREF="#wxwindowsetpalette">wxWindow::SetPalette</A><BR>
+<A HREF="#wxwindowsetreturncode">wxWindow::SetReturnCode</A><BR>
+<A HREF="#wxwindowsetscrollbar">wxWindow::SetScrollbar</A><BR>
+<A HREF="#wxwindowsetscrollpos">wxWindow::SetScrollPos</A><BR>
+<A HREF="#wxwindowsetsize">wxWindow::SetSize</A><BR>
+<A HREF="#wxwindowsetsizehints">wxWindow::SetSizeHints</A><BR>
+<A HREF="#wxwindowsettitle">wxWindow::SetTitle</A><BR>
+<A HREF="#topic1041">wxWindow::Show</A><BR>
+<A HREF="#wxwindowtransferdatafromwindow">wxWindow::TransferDataFromWindow</A><BR>
+<A HREF="#wxwindowtransferdatatowindow">wxWindow::TransferDataToWindow</A><BR>
+<A HREF="#wxwindowvalidate">wxWindow::Validate</A><BR>
+<A HREF="#wxwindowwarppointer">wxWindow::WarpPointer</A><BR>
+<P>
+
+<HR>
+<A NAME="topic1026"></A>
+<H3>wxWindow::wxWindow</H3>
+<P>
+<B></B> <B>wxWindow</B>()<P>
+Default constructor.<P>
+<B></B> <B>wxWindow</B>(<B>wxWindow*</B><I> parent</I>, <B>wxWindowID </B><I>id</I>,
+ <B>const wxPoint& </B><I>pos = wxDefaultPosition</I>,
+ <B>const wxSize& </B><I>size = wxDefaultSize</I>,
+ <B>long </B><I>style = 0</I>,
+ <B>const wxString& </B><I>name = wxPanelNameStr</I>)<P>
+Constructs a window, which can be a child of a frame, dialog or any other non-control window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>parent</I><UL><UL>
+Pointer to a parent window.</UL></UL>
+<P>
+<I>id</I><UL><UL>
+Window identifier. If -1, will automatically create an identifier.</UL></UL>
+<P>
+<I>pos</I><UL><UL>
+Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows
+should generate a default position for the window. If using the wxWindow class directly, supply
+an actual position.</UL></UL>
+<P>
+<I>size</I><UL><UL>
+Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows
+should generate a default size for the window.</UL></UL>
+<P>
+<I>style</I><UL><UL>
+Window style. For generic window styles, please see <A HREF="wx260.htm#wxwindow">wxWindow</A>.</UL></UL>
+<P>
+<I>name</I><UL><UL>
+Window name.</UL></UL>
+<P>
+
+<HR>
+<A NAME="topic1027"></A>
+<H3>wxWindow::~wxWindow</H3>
+<P>
+<B></B> <B>~wxWindow</B>()<P>
+Destructor. Deletes all subwindows, then deletes itself. Instead of using
+the <B>delete</B> operator explicitly, you should normally
+use <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A> so that wxWindows
+can delete a window only when it is safe to do so, in idle time.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx296.htm#windowdeletionoverview">Window deletion overview</A>,
+<A HREF="wx260.htm#wxwindowonclosewindow">wxWindow::OnCloseWindow</A>,
+<A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>,
+<A HREF="wx45.htm#wxcloseevent">wxCloseEvent</A><P>
+
+<HR>
+<A NAME="topic1028"></A>
+<H3>wxWindow::AddChild</H3>
+<P>
+<B>virtual void</B> <B>AddChild</B>(<B>wxWindow* </B><I>child</I>)<P>
+Adds a child window. This is called automatically by window creation
+functions so should not be required by the application programmer.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>child</I><UL><UL>
+Child window to add.</UL></UL>
+<P>
+
+<HR>
+<A NAME="wxwindowcapturemouse"></A>
+<H3>wxWindow::CaptureMouse</H3>
+<P>
+<B>virtual void</B> <B>CaptureMouse</B>()<P>
+Directs all mouse input to this window. Call <A HREF="wx260.htm#wxwindowreleasemouse">wxWindow::ReleaseMouse</A> to
+release the capture.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowreleasemouse">wxWindow::ReleaseMouse</A><P>
+
+<HR>
+<A NAME="wxwindowcenter"></A>
+<H3>wxWindow::Center</H3>
+<P>
+<B>void</B> <B>Center</B>(<B>int</B><I> direction</I>)<P>
+A synonym for <A HREF="wx260.htm#wxwindowcentre">Centre</A>.<P>
+
+<HR>
+<A NAME="wxwindowcentre"></A>
+<H3>wxWindow::Centre</H3>
+<P>
+<B>virtual void</B> <B>Centre</B>(<B>int</B><I> direction = wxHORIZONTAL</I>)<P>
+Centres the window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>direction</I><UL><UL>
+Specifies the direction for the centering. May be <TT>wxHORIZONTAL</TT>, <TT>wxVERTICAL</TT>
+or <TT>wxBOTH</TT>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+The actual behaviour depends on the derived window. For a frame or dialog box,
+centring is relative to the whole display. For a panel item, centring is
+relative to the panel.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowcenter">wxWindow::Center</A><P>
+
+<HR>
+<A NAME="wxwindowclear"></A>
+<H3>wxWindow::Clear</H3>
+<P>
+<B>void</B> <B>Clear</B>()<P>
+Clears the window by filling it with the current background colour. Does not
+cause an erase background event to be generated.<P>
+
+<HR>
+<A NAME="topic1029"></A>
+<H3>wxWindow::ClientToScreen</H3>
+<P>
+<B>virtual void</B> <B>ClientToScreen</B>(<B>int* </B><I>x</I>, <B>int* </B><I>y</I>) <B>const</B><P>
+<B>virtual wxPoint</B> <B>ClientToScreen</B>(<B>const wxPoint&</B><I> pt</I>) <B>const</B><P>
+Converts to screen coordinates from coordinates relative to this window.<P>
+<I>x</I><UL><UL>
+A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
+a screen coordinate will be passed out.</UL></UL>
+<P>
+<I>y</I><UL><UL>
+A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
+a screen coordinate will be passed out.</UL></UL>
+<P>
+<I>pt</I><UL><UL>
+The client position for the second form of the function.</UL></UL>
+<P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>ClientToScreen(point)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts and returns a wxPoint
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>ClientToScreenXY(x, y)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a 2-tuple, (x, y)
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+
+<HR>
+<A NAME="wxwindowclose"></A>
+<H3>wxWindow::Close</H3>
+<P>
+<B>virtual bool</B> <B>Close</B>(<B>const bool</B><I> force = FALSE</I>)<P>
+The purpose of this call is to provide a safer way of destroying a window than using
+the <I>delete</I> operator.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>force</I><UL><UL>
+FALSE if the window's close handler should be able to veto the destruction
+of this window, TRUE if it cannot.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Close calls the <A HREF="wx45.htm#wxcloseevent">close handler</A> for the window, providing an opportunity for the window to
+choose whether to destroy the window.<P>
+The close handler should check whether the window is being deleted forcibly,
+using <A HREF="wx45.htm#wxcloseeventgetforce">wxCloseEvent::GetForce</A>, in which case it should
+destroy the window using <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>.<P>
+Applies to managed windows (wxFrame and wxDialog classes) only.<P>
+<I>Note</I> that calling Close does not guarantee that the window will be destroyed; but it
+provides a way to simulate a manual close of a window, which may or may not be implemented by
+destroying the window. The default implementation of wxDialog::OnCloseWindow does not
+necessarily delete the dialog, since it will simply simulate an wxID_CANCEL event which
+itself only hides the dialog.<P>
+To guarantee that the window will be destroyed, call <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A> instead.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx296.htm#windowdeletionoverview">Window deletion overview</A>,
+<A HREF="wx260.htm#wxwindowonclosewindow">wxWindow::OnCloseWindow</A>,
+<A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>,
+<A HREF="wx45.htm#wxcloseevent">wxCloseEvent</A><P>
+
+<HR>
+<A NAME="wxwindowconvertdialogtopixels"></A>
+<H3>wxWindow::ConvertDialogToPixels</H3>
+<P>
+<B>wxPoint</B> <B>ConvertDialogToPixels</B>(<B>const wxPoint&</B><I> pt</I>)<P>
+<B>wxSize</B> <B>ConvertDialogToPixels</B>(<B>const wxSize&</B><I> sz</I>)<P>
+Converts a point or size from dialog units to pixels.<P>
+For the x dimension, the dialog units are multiplied by the average character width
+and then divided by 4.<P>
+For the y dimension, the dialog units are multiplied by the average character height
+and then divided by 8.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Dialog units are used for maintaining a dialog's proportions even if the font changes.
+Dialogs created using Dialog Editor optionally use dialog units.<P>
+You can also use these functions programmatically. A convenience macro is defined:<P>
+<FONT SIZE=2>
+<PRE>
+#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
+</PRE>
+</FONT><P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowconvertpixelstodialog">wxWindow::ConvertPixelsToDialog</A><P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>ConvertDialogPointToPixels(point)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts and returns a wxPoint
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>ConvertDialogSizeToPixels(size)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts and returns a wxSize
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+<P>
+Additionally, the following helper functions are defined:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxDLG_PNT(win, point)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Converts a wxPoint from dialog
+units to pixels
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxDLG_SZE(win, size)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Converts a wxSize from dialog
+units to pixels
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+
+<HR>
+<A NAME="wxwindowconvertpixelstodialog"></A>
+<H3>wxWindow::ConvertPixelsToDialog</H3>
+<P>
+<B>wxPoint</B> <B>ConvertPixelsToDialog</B>(<B>const wxPoint&</B><I> pt</I>)<P>
+<B>wxSize</B> <B>ConvertPixelsToDialog</B>(<B>const wxSize&</B><I> sz</I>)<P>
+Converts a point or size from pixels to dialog units.<P>
+For the x dimension, the pixels are multiplied by 4 and then divided by the average
+character width.<P>
+For the y dimension, the pixels are multipled by 8 and then divided by the average
+character height.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Dialog units are used for maintaining a dialog's proportions even if the font changes.
+Dialogs created using Dialog Editor optionally use dialog units.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowconvertdialogtopixels">wxWindow::ConvertDialogToPixels</A><P>
+
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>ConvertDialogPointToPixels(point)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts and returns a wxPoint
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>ConvertDialogSizeToPixels(size)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts and returns a wxSize
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+<HR>
+<A NAME="wxwindowdestroy"></A>
+<H3>wxWindow::Destroy</H3>
+<P>
+<B>virtual bool</B> <B>Destroy</B>()<P>
+Destroys the window safely. Use this function instead of the delete operator, since
+different window classes can be destroyed differently. Frames and dialogs
+are not destroyed immediately when this function is called - they are added
+to a list of windows to be deleted on idle time, when all the window's events
+have been processed. This prevents problems with events being sent to non-existant
+windows.<P>
+<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
+TRUE if the window has either been successfully deleted, or it has been added
+to the list of windows pending real deletion.<P>
+
+<HR>
+<A NAME="topic1030"></A>
+<H3>wxWindow::DestroyChildren</H3>
+<P>
+<B>virtual void</B> <B>DestroyChildren</B>()<P>
+Destroys all children of a window. Called automatically by the destructor.<P>
+
+<HR>
+<A NAME="wxwindowdragacceptfiles"></A>
+<H3>wxWindow::DragAcceptFiles</H3>
+<P>
+<B>virtual void</B> <B>DragAcceptFiles</B>(<B>const bool</B><I> accept</I>)<P>
+Enables or disables elibility for drop file events (OnDropFiles).<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>accept</I><UL><UL>
+If TRUE, the window is eligible for drop file events. If FALSE, the window
+will not accept drop file events.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Windows only.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowondropfiles">wxWindow::OnDropFiles</A><P>
+
+<HR>
+<A NAME="wxwindowenable"></A>
+<H3>wxWindow::Enable</H3>
+<P>
+<B>virtual void</B> <B>Enable</B>(<B>const bool</B><I> enable</I>)<P>
+Enable or disable the window for user input.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>enable</I><UL><UL>
+If TRUE, enables the window for input. If FALSE, disables the window.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowisenabled">wxWindow::IsEnabled</A><P>
+
+<HR>
+<A NAME="wxwindowfindfocus"></A>
+<H3>wxWindow::FindFocus</H3>
+<P>
+<B>static wxWindow*</B> <B>FindFocus</B>()<P>
+Finds the window or control which currently has the keyboard focus.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Note that this is a static function, so it can be called without needing a wxWindow pointer.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetfocus">wxWindow::SetFocus</A><P>
+
+<HR>
+<A NAME="wxwindowfindwindow"></A>
+<H3>wxWindow::FindWindow</H3>
+<P>
+<B>wxWindow*</B> <B>FindWindow</B>(<B>long</B><I> id</I>)<P>
+Find a child of this window, by identifier.<P>
+<B>wxWindow*</B> <B>FindWindow</B>(<B>const wxString&</B><I> name</I>)<P>
+Find a child of this window, by name.<P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>FindWindowById(id)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts an integer
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>FindWindowByName(name)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts a string
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+<HR>
+<A NAME="wxwindowfit"></A>
+<H3>wxWindow::Fit</H3>
+<P>
+<B>virtual void</B> <B>Fit</B>()<P>
+Sizes the window so that it fits around its subwindows.<P>
+
+<HR>
+<A NAME="wxwindowgetbackgroundcolour"></A>
+<H3>wxWindow::GetBackgroundColour</H3>
+<P>
+<B>virtual wxColour</B> <B>GetBackgroundColour</B>() <B>const</B><P>
+Returns the background colour of the window.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetbackgroundcolour">wxWindow::SetBackgroundColour</A>,
+<A HREF="wx260.htm#wxwindowsetforegroundcolour">wxWindow::SetForegroundColour</A>,
+<A HREF="wx260.htm#wxwindowgetforegroundcolour">wxWindow::GetForegroundColour</A>,
+<A HREF="wx260.htm#wxwindowonerasebackground">wxWindow::OnEraseBackground</A><P>
+
+<HR>
+<A NAME="topic1031"></A>
+<H3>wxWindow::GetCharHeight</H3>
+<P>
+<B>virtual int</B> <B>GetCharHeight</B>() <B>const</B><P>
+Returns the character height for this window.<P>
+
+<HR>
+<A NAME="topic1032"></A>
+<H3>wxWindow::GetCharWidth</H3>
+<P>
+<B>virtual int</B> <B>GetCharWidth</B>() <B>const</B><P>
+Returns the average character width for this window.<P>
+
+<HR>
+<A NAME="topic1033"></A>
+<H3>wxWindow::GetChildren</H3>
+<P>
+<B>wxList&</B> <B>GetChildren</B>()<P>
+Returns a reference to the list of the window's children.<P>
+
+<HR>
+<A NAME="wxwindowgetclientsize"></A>
+<H3>wxWindow::GetClientSize</H3>
+<P>
+<B>virtual void</B> <B>GetClientSize</B>(<B>int* </B><I>width</I>, <B>int* </B><I>height</I>) <B>const</B><P>
+<B>virtual wxSize</B> <B>GetClientSize</B>() <B>const</B><P>
+This gets the size of the window 'client area' in pixels. The client area is the
+area which may be drawn on by the programmer, excluding title bar, border etc.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>width</I><UL><UL>
+Receives the client width in pixels.</UL></UL>
+<P>
+<I>height</I><UL><UL>
+Receives the client height in pixels.</UL></UL>
+<P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxGetClientSizeTuple()</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a 2-tuple of (width, height)
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>wxGetClientSize()</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a wxSize object
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+<HR>
+<A NAME="wxwindowgetconstraints"></A>
+<H3>wxWindow::GetConstraints</H3>
+<P>
+<B>wxLayoutConstraints*</B> <B>GetConstraints</B>() <B>const</B><P>
+Returns a pointer to the window's layout constraints, or NULL if there are none.<P>
+
+<HR>
+<A NAME="wxwindowgetdefaultitem"></A>
+<H3>wxWindow::GetDefaultItem</H3>
+<P>
+<B>wxButton*</B> <B>GetDefaultItem</B>() <B>const</B><P>
+Returns a pointer to the button which is the default for this window, or NULL.<P>
+
+<HR>
+<A NAME="wxwindowgetdroptarget"></A>
+<H3>wxWindow::GetDropTarget</H3>
+<P>
+<B>wxDropTarget*</B> <B>GetDropTarget</B>() <B>const</B><P>
+Returns the associated drop target, which may be NULL.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetdroptarget">wxWindow::SetDropTarget</A>,
+<A HREF="wx312.htm#wxdndoverview">Drag and drop overview</A><P>
+
+<HR>
+<A NAME="wxwindowgeteventhandler"></A>
+<H3>wxWindow::GetEventHandler</H3>
+<P>
+<B>wxEvtHandler*</B> <B>GetEventHandler</B>() <B>const</B><P>
+Returns the event handler for this window. By default, the window is its
+own event handler.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowseteventhandler">wxWindow::SetEventHandler</A>,
+<A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A>,
+<A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PopEventHandler</A>,
+<A HREF="wx85.htm#wxevthandlerprocessevent">wxEvtHandler::ProcessEvent</A>,
+<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><P>
+
+<HR>
+<A NAME="wxwindowgetfont"></A>
+<H3>wxWindow::GetFont</H3>
+<P>
+<B>wxFont&</B> <B>GetFont</B>() <B>const</B><P>
+Returns a reference to the font for this window.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetfont">wxWindow::SetFont</A><P>
+
+<HR>
+<A NAME="wxwindowgetforegroundcolour"></A>
+<H3>wxWindow::GetForegroundColour</H3>
+<P>
+<B>virtual wxColour</B> <B>GetForegroundColour</B>()<P>
+Returns the foreground colour of the window.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+The interpretation of foreground colour is open to interpretation according
+to the window class; it may be the text colour or other colour, or it may not
+be used at all.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetforegroundcolour">wxWindow::SetForegroundColour</A>,
+<A HREF="wx260.htm#wxwindowsetbackgroundcolour">wxWindow::SetBackgroundColour</A>,
+<A HREF="wx260.htm#wxwindowgetbackgroundcolour">wxWindow::GetBackgroundColour</A><P>
+
+<HR>
+<A NAME="topic1034"></A>
+<H3>wxWindow::GetGrandParent</H3>
+<P>
+<B>wxWindow*</B> <B>GetGrandParent</B>() <B>const</B><P>
+Returns the grandparent of a window, or NULL if there isn't one.<P>
+
+<HR>
+<A NAME="topic1035"></A>
+<H3>wxWindow::GetHandle</H3>
+<P>
+<B>void*</B> <B>GetHandle</B>() <B>const</B><P>
+Returns the platform-specific handle of the physical window. Cast it to an appropriate
+handle, such as <B>HWND</B> for Windows or <B>Widget</B> for Motif.<P>
+
+<HR>
+<A NAME="wxwindowgetid"></A>
+<H3>wxWindow::GetId</H3>
+<P>
+<B>int</B> <B>GetId</B>() <B>const</B><P>
+Returns the identifier of the window.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Each window has an integer identifier. If the application has not provided one,
+an identifier will be generated.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetid">wxWindow::SetId</A>
+<A HREF="wx299.htm#windowids">Window identifiers</A><P>
+
+<HR>
+<A NAME="topic1036"></A>
+<H3>wxWindow::GetPosition</H3>
+<P>
+<B>virtual void</B> <B>GetPosition</B>(<B>int* </B><I>x</I>, <B>int* </B><I>y</I>) <B>const</B><P>
+This gets the position of the window in pixels, relative to the parent window or
+if no parent, relative to the whole display.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>x</I><UL><UL>
+Receives the x position of the window.</UL></UL>
+<P>
+<I>y</I><UL><UL>
+Receives the y position of the window.</UL></UL>
+<P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>GetPosition()</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a wxPoint
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>GetPositionTuple()</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a tuple (x, y)
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+<HR>
+<A NAME="topic1037"></A>
+<H3>wxWindow::GetLabel</H3>
+<P>
+<B>virtual wxString& </B> <B>GetLabel</B>() <B>const</B><P>
+Generic way of getting a label from any window, for
+identification purposes.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+The interpretation of this function differs from class to class.
+For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
+the button text. This function can be useful for meta-programs (such as testing
+tools or special-needs access programs) which need to identify windows
+by name.<P>
+
+<HR>
+<A NAME="wxwindowgetname"></A>
+<H3>wxWindow::GetName</H3>
+<P>
+<B>virtual wxString& </B> <B>GetName</B>() <B>const</B><P>
+Returns the window's name.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
+name in the window constructor or via <A HREF="wx260.htm#wxwindowsetname">wxWindow::SetName</A>.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetname">wxWindow::SetName</A><P>
+
+<HR>
+<A NAME="topic1038"></A>
+<H3>wxWindow::GetParent</H3>
+<P>
+<B>virtual wxWindow*</B> <B>GetParent</B>() <B>const</B><P>
+Returns the parent of the window, or NULL if there is no parent.<P>
+
+<HR>
+<A NAME="wxwindowgetrect"></A>
+<H3>wxWindow::GetRect</H3>
+<P>
+<B>virtual wxRect</B> <B>GetRect</B>() <B>const</B><P>
+Returns the size and position of the window as a <A HREF="wx193.htm#wxrect">wxRect</A> object.<P>
+
+<HR>
+<A NAME="wxwindowgetreturncode"></A>
+<H3>wxWindow::GetReturnCode</H3>
+<P>
+<B>int</B> <B>GetReturnCode</B>()<P>
+Gets the return code for this window.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+A return code is normally associated with a modal dialog, where <A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A> returns
+a code to the application.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetreturncode">wxWindow::SetReturnCode</A>, <A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A>,
+<A HREF="wx71.htm#wxdialogendmodal">wxDialog::EndModal</A><P>
+
+<HR>
+<A NAME="wxwindowgetscrollthumb"></A>
+<H3>wxWindow::GetScrollThumb</H3>
+<P>
+<B>virtual int</B> <B>GetScrollThumb</B>(<B>int </B><I>orientation</I>)<P>
+Returns the built-in scrollbar thumb size.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetscrollbar">wxWindow::SetScrollbar</A><P>
+
+<HR>
+<A NAME="wxwindowgetscrollpos"></A>
+<H3>wxWindow::GetScrollPos</H3>
+<P>
+<B>virtual int</B> <B>GetScrollPos</B>(<B>int </B><I>orientation</I>)<P>
+Returns the built-in scrollbar position.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+See <A HREF="wx260.htm#wxwindowsetscrollbar">wxWindow::SetScrollbar</A><P>
+
+<HR>
+<A NAME="wxwindowgetscrollrange"></A>
+<H3>wxWindow::GetScrollRange</H3>
+<P>
+<B>virtual int</B> <B>GetScrollRange</B>(<B>int </B><I>orientation</I>)<P>
+Returns the built-in scrollbar range.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetscrollbar">wxWindow::SetScrollbar</A><P>
+
+<HR>
+<A NAME="wxwindowgetsize"></A>
+<H3>wxWindow::GetSize</H3>
+<P>
+<B>virtual void</B> <B>GetSize</B>(<B>int* </B><I>width</I>, <B>int* </B><I>height</I>) <B>const</B><P>
+<B>virtual wxSize</B> <B>GetSize</B>() <B>const</B><P>
+This gets the size of the entire window in pixels.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>width</I><UL><UL>
+Receives the window width.</UL></UL>
+<P>
+<I>height</I><UL><UL>
+Receives the window height.</UL></UL>
+<P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>GetSize()</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a wxSize
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>GetSizeTuple()</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a 2-tuple (width, height)
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+<HR>
+<A NAME="topic1039"></A>
+<H3>wxWindow::GetTextExtent</H3>
+<P>
+<B>virtual void</B> <B>GetTextExtent</B>(<B>const wxString& </B><I>string</I>, <B>int* </B><I>x</I>, <B>int* </B><I>y</I>,
+ <B>int* </B><I>descent = NULL</I>, <B>int* </B><I>externalLeading = NULL</I>,
+ <B>const wxFont* </B><I>font = NULL</I>, <B>const bool</B><I> use16 = FALSE</I>) <B>const</B><P>
+Gets the dimensions of the string as it would be drawn on the
+window with the currently selected font.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>string</I><UL><UL>
+String whose extent is to be measured.</UL></UL>
+<P>
+<I>x</I><UL><UL>
+Return value for width.</UL></UL>
+<P>
+<I>y</I><UL><UL>
+Return value for height.</UL></UL>
+<P>
+<I>descent</I><UL><UL>
+Return value for descent (optional).</UL></UL>
+<P>
+<I>externalLeading</I><UL><UL>
+Return value for external leading (optional).</UL></UL>
+<P>
+<I>font</I><UL><UL>
+Font to use instead of the current window font (optional).</UL></UL>
+<P>
+<I>use16</I><UL><UL>
+If TRUE, <I>string</I> contains 16-bit characters. The default is FALSE.</UL></UL>
+<P>
+
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>GetTextExtent(string)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a 2-tuple, (width, height)
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>GetFullTextExtent(string, font=NULL)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a
+4-tuple, (width, height, descent, externalLeading)
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+
+<HR>
+<A NAME="wxwindowgettitle"></A>
+<H3>wxWindow::GetTitle</H3>
+<P>
+<B>virtual wxString</B> <B>GetTitle</B>()<P>
+Gets the window's title. Applicable only to frames and dialogs.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsettitle">wxWindow::SetTitle</A><P>
+
+<HR>
+<A NAME="wxwindowgetupdateregion"></A>
+<H3>wxWindow::GetUpdateRegion</H3>
+<P>
+<B>virtual wxRegion</B> <B>GetUpdateRegion</B>() <B>const</B><P>
+Returns the region specifying which parts of the window have been damaged. Should
+only be called within an <A HREF="wx260.htm#wxwindowonpaint">OnPaint</A> event handler.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx195.htm#wxregion">wxRegion</A>, <A HREF="wx196.htm#wxregioniterator">wxRegionIterator</A>, <A HREF="wx260.htm#wxwindowonpaint">wxWindow::OnPaint</A><P>
+
+<HR>
+<A NAME="topic1040"></A>
+<H3>wxWindow::GetWindowStyleFlag</H3>
+<P>
+<B>long</B> <B>GetWindowStyleFlag</B>() <B>const</B><P>
+Gets the window style that was passed to the consructor or <B>Create</B> member.<P>
+
+<HR>
+<A NAME="wxwindowinitdialog"></A>
+<H3>wxWindow::InitDialog</H3>
+<P>
+<B>void</B> <B>InitDialog</B>()<P>
+Sends an <A HREF="wx260.htm#wxwindowoninitdialog">wxWindow::OnInitDialog</A> event, which
+in turn transfers data to the dialog via validators.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowoninitdialog">wxWindow::OnInitDialog</A><P>
+
+<HR>
+<A NAME="wxwindowisenabled"></A>
+<H3>wxWindow::IsEnabled</H3>
+<P>
+<B>virtual bool</B> <B>IsEnabled</B>() <B>const</B><P>
+Returns TRUE if the window is enabled for input, FALSE otherwise.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowenable">wxWindow::Enable</A><P>
+
+<HR>
+<A NAME="wxwindowisretained"></A>
+<H3>wxWindow::IsRetained</H3>
+<P>
+<B>virtual bool</B> <B>IsRetained</B>() <B>const</B><P>
+Returns TRUE if the window is retained, FALSE otherwise.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Retained windows are only available on X platforms.<P>
+
+<HR>
+<A NAME="wxwindowisshown"></A>
+<H3>wxWindow::IsShown</H3>
+<P>
+<B>virtual bool</B> <B>IsShown</B>() <B>const</B><P>
+Returns TRUE if the window is shown, FALSE if it has been hidden.<P>
+
+<HR>
+<A NAME="wxwindowlayout"></A>
+<H3>wxWindow::Layout</H3>
+<P>
+<B>void</B> <B>Layout</B>()<P>
+Invokes the constraint-based layout algorithm for this window. It is called
+automatically by the default <B>wxWindow::OnSize</B> member.<P>
+
+<HR>
+<A NAME="wxwindowloadfromresource"></A>
+<H3>wxWindow::LoadFromResource</H3>
+<P>
+<B>virtual bool</B> <B>LoadFromResource</B>(<B>wxWindow* </B><I>parent</I>,
+<B>const wxString& </B><I>resourceName</I>, <B>const wxResourceTable* </B><I>resourceTable = NULL</I>)<P>
+Loads a panel or dialog from a resource file.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>parent</I><UL><UL>
+Parent window.</UL></UL>
+<P>
+<I>resourceName</I><UL><UL>
+The name of the resource to load.</UL></UL>
+<P>
+<I>resourceTable</I><UL><UL>
+The resource table to load it from. If this is NULL, the
+default resource table will be used.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
+TRUE if the operation succeeded, otherwise FALSE.<P>
+
+<HR>
+<A NAME="wxwindowlower"></A>
+<H3>wxWindow::Lower</H3>
+<P>
+<B>void</B> <B>Lower</B>()<P>
+Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
+or frame).<P>
+
+<HR>
+<A NAME="wxwindowmakemodal"></A>
+<H3>wxWindow::MakeModal</H3>
+<P>
+<B>virtual void</B> <B>MakeModal</B>(<B>const bool </B><I>flag</I>)<P>
+Disables all other windows in the application so that
+the user can only interact with this window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>flag</I><UL><UL>
+If TRUE, this call disables all other windows in the application so that
+the user can only interact with this window. If FALSE, the effect is reversed.</UL></UL>
+<P>
+
+<HR>
+<A NAME="wxwindowmove"></A>
+<H3>wxWindow::Move</H3>
+<P>
+<B>void</B> <B>Move</B>(<B>int</B><I> x</I>, <B>int</B><I> y</I>)<P>
+<B>void</B> <B>Move</B>(<B>const wxPoint&</B><I> pt</I>)<P>
+Moves the window to the given position.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>x</I><UL><UL>
+Required x position.</UL></UL>
+<P>
+<I>y</I><UL><UL>
+Required y position.</UL></UL>
+<P>
+<I>pt</I><UL><UL>
+<A HREF="wx171.htm#wxpoint">wxPoint</A> object representing the position.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Implementations of SetSize can also implicitly implement the
+wxWindow::Move function, which is defined in the base wxWindow class
+as the call:<P>
+<PRE>
+ SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING);
+</PRE>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetsize">wxWindow::SetSize</A><P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>Move(point)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts a wxPoint
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>MoveXY(x, y)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts a pair of integers
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+<HR>
+<A NAME="wxwindowonactivate"></A>
+<H3>wxWindow::OnActivate</H3>
+<P>
+<B>void</B> <B>OnActivate</B>(<B>wxActivateEvent&</B><I> event</I>)<P>
+Called when a window is activated or deactivated.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Object containing activation information.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+If the window is being activated, <A HREF="wx25.htm#wxactivateeventgetactive">wxActivateEvent::GetActive</A> returns TRUE,
+otherwise it returns FALSE (it is being deactivated).<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx25.htm#wxactivateevent">wxActivateEvent</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonchar"></A>
+<H3>wxWindow::OnChar</H3>
+<P>
+<B>void</B> <B>OnChar</B>(<B>wxKeyEvent&</B><I> event</I>)<P>
+Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Object containing keypress information. See <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A> for
+details about this class.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+This member function is called in response to a keypress. To intercept this event,
+use the EVT_CHAR macro in an event table definition. Your <B>OnChar</B> handler may call this
+default function to achieve default keypress functionality.<P>
+Note that the ASCII values do not have explicit key codes: they are passed as ASCII
+values.<P>
+Note that not all keypresses can be intercepted this way. If you wish to intercept modifier
+keypresses, then you will need to use <A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A> or
+<A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>.<P>
+Most, but not all, windows allow keypresses to be intercepted.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A>, <A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>,
+<A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A>, <A HREF="wx260.htm#wxwindowoncharhook">wxWindow::OnCharHook</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowoncharhook"></A>
+<H3>wxWindow::OnCharHook</H3>
+<P>
+<B>void</B> <B>OnCharHook</B>(<B>wxKeyEvent&</B><I> event</I>)<P>
+This member is called to allow the window to intercept keyboard events
+before they are processed by child windows.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Object containing keypress information. See <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A> for
+details about this class.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+This member function is called in response to a keypress, if the window is active. To intercept this event,
+use the EVT_CHAR_HOOK macro in an event table definition. If you do not process a particular
+keypress, call <A HREF="wx84.htm#wxeventskip">wxEvent::Skip</A> to allow default processing.<P>
+An example of using this function is in the implementation of escape-character processing for wxDialog,
+where pressing ESC dismisses the dialog by <B>OnCharHook</B> 'forging' a cancel button press event.<P>
+Note that the ASCII values do not have explicit key codes: they are passed as ASCII
+values.<P>
+This function is only relevant to top-level windows (frames and dialogs), and under
+Windows only.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A>, <A HREF="wx260.htm#wxwindowoncharhook">wxWindow::OnCharHook</A>,
+<A HREF="wx26.htm#wxapponcharhook">wxApp::OnCharHook</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowoncommand"></A>
+<H3>wxWindow::OnCommand</H3>
+<P>
+<B>virtual void</B> <B>OnCommand</B>(<B>wxEvtHandler& </B><I>object</I>, <B>wxCommandEvent& </B><I>event</I>)<P>
+This virtual member function is called if the control does not handle the command event.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>object</I><UL><UL>
+Object receiving the command event.</UL></UL>
+<P>
+<I>event</I><UL><UL>
+Command event</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+This virtual function is provided mainly for backward compatibility. You can also intercept commands
+from child controls by using an event table, with identifiers or identifier ranges to identify
+the control(s) in question.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx52.htm#wxcommandevent">wxCommandEvent</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonclose"></A>
+<H3>wxWindow::OnClose</H3>
+<P>
+<B>virtual bool</B> <B>OnClose</B>()<P>
+Called when the user has tried to close a a frame
+or dialog box using the window manager (X) or system menu (Windows).<P>
+<B>Note:</B> This is an obsolete function.
+It is superceded by the <A HREF="wx260.htm#wxwindowonclosewindow">wxWindow::OnCloseWindow</A> event
+handler.<P>
+<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
+If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
+attempt will be ignored. Do not delete the window from within this handler, although
+you may delete other windows.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx296.htm#windowdeletionoverview">Window deletion overview</A>,
+<A HREF="wx260.htm#wxwindowclose">wxWindow::Close</A>,
+<A HREF="wx260.htm#wxwindowonclosewindow">wxWindow::OnCloseWindow</A>,
+<A HREF="wx45.htm#wxcloseevent">wxCloseEvent</A><P>
+
+<HR>
+<A NAME="wxwindowonclosewindow"></A>
+<H3>wxWindow::OnCloseWindow</H3>
+<P>
+<B>void</B> <B>OnCloseWindow</B>(<B>wxCloseEvent& </B><I>event</I>)<P>
+This is an event handler function called when the user has tried to close a a frame
+or dialog box using the window manager (X) or system menu (Windows). It is
+called via the <A HREF="wx260.htm#wxwindowclose">wxWindow::Close</A> function, so
+that the application can also invoke the handler programmatically.<P>
+Use the EVT_CLOSE event table macro to handle close events.<P>
+You should check whether the application is forcing the deletion of the window
+using <A HREF="wx45.htm#wxcloseeventgetforce">wxCloseEvent::GetForce</A>. If this is TRUE,
+destroy the window using <A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>.
+If not, it is up to you whether you respond by destroying the window.<P>
+(Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of
+the window is required, test for the negative of CanVeto. If CanVeto returns FALSE,
+it is not possible to skip window deletion.)<P>
+If you don't destroy the window, you should call <A HREF="wx45.htm#wxcloseeventveto">wxCloseEvent::Veto</A> to
+let the calling code know that you did not destroy the window. This allows the <A HREF="wx260.htm#wxwindowclose">wxWindow::Close</A> function
+to return TRUE or FALSE depending on whether the close instruction was honoured or not.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+The <A HREF="wx260.htm#wxwindowonclose">wxWindow::OnClose</A> virtual function remains
+for backward compatibility with earlier versions of wxWindows. The
+default <B>OnCloseWindow</B> handler for wxFrame and wxDialog will call <B>OnClose</B>,
+destroying the window if it returns TRUE or if the close is being forced.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx296.htm#windowdeletionoverview">Window deletion overview</A>,
+<A HREF="wx260.htm#wxwindowclose">wxWindow::Close</A>,
+<A HREF="wx260.htm#wxwindowonclose">wxWindow::OnClose</A>,
+<A HREF="wx260.htm#wxwindowdestroy">wxWindow::Destroy</A>,
+<A HREF="wx45.htm#wxcloseevent">wxCloseEvent</A>,
+<A HREF="wx26.htm#wxapponqueryendsession">wxApp::OnQueryEndSession</A>,
+<A HREF="wx26.htm#wxapponendsession">wxApp::OnEndSession</A><P>
+
+<HR>
+<A NAME="wxwindowondropfiles"></A>
+<H3>wxWindow::OnDropFiles</H3>
+<P>
+<B>void</B> <B>OnDropFiles</B>(<B>wxDropFilesEvent&</B><I> event</I>)<P>
+Called when files have been dragged from the file manager to the window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Drop files event. For more information, see <A HREF="wx80.htm#wxdropfilesevent">wxDropFilesEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+The window must have previously been enabled for dropping by calling
+<A HREF="wx260.htm#wxwindowdragacceptfiles">wxWindow::DragAcceptFiles</A>.<P>
+This event is only generated under Windows.<P>
+To intercept this event, use the EVT_DROP_FILES macro in an event table definition.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx80.htm#wxdropfilesevent">wxDropFilesEvent</A>, <A HREF="wx260.htm#wxwindowdragacceptfiles">wxWindow::DragAcceptFiles</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonerasebackground"></A>
+<H3>wxWindow::OnEraseBackground</H3>
+<P>
+<B>void</B> <B>OnEraseBackground</B>(<B>wxEraseEvent&</B><I> event</I>)<P>
+Called when the background of the window needs to be erased.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Erase background event. For more information, see <A HREF="wx83.htm#wxeraseevent">wxEraseEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+This event is only generated under Windows.<P>
+To intercept this event, use the EVT_ERASE_BACKGROUND macro in an event table definition.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx83.htm#wxeraseevent">wxEraseEvent</A>, <A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonkeydown"></A>
+<H3>wxWindow::OnKeyDown</H3>
+<P>
+<B>void</B> <B>OnKeyDown</B>(<B>wxKeyEvent&</B><I> event</I>)<P>
+Called when the user has pressed a key, before it is translated into an ASCII value using other
+modifier keys that might be pressed at the same time.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Object containing keypress information. See <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A> for
+details about this class.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+This member function is called in response to a key down event. To intercept this event,
+use the EVT_KEY_DOWN macro in an event table definition. Your <B>OnKeyDown</B> handler may call this
+default function to achieve default keypress functionality.<P>
+Note that not all keypresses can be intercepted this way. If you wish to intercept special
+keys, such as shift, control, and function keys, then you will need to use <A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A> or
+<A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>.<P>
+Most, but not all, windows allow keypresses to be intercepted.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowonchar">wxWindow::OnChar</A>, <A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>,
+<A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A>, <A HREF="wx260.htm#wxwindowoncharhook">wxWindow::OnCharHook</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonkeyup"></A>
+<H3>wxWindow::OnKeyUp</H3>
+<P>
+<B>void</B> <B>OnKeyUp</B>(<B>wxKeyEvent&</B><I> event</I>)<P>
+Called when the user has released a key.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Object containing keypress information. See <A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A> for
+details about this class.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+This member function is called in response to a key up event. To intercept this event,
+use the EVT_KEY_UP macro in an event table definition. Your <B>OnKeyUp</B> handler may call this
+default function to achieve default keypress functionality.<P>
+Note that not all keypresses can be intercepted this way. If you wish to intercept special
+keys, such as shift, control, and function keys, then you will need to use <A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A> or
+<A HREF="wx260.htm#wxwindowonkeyup">wxWindow::OnKeyUp</A>.<P>
+Most, but not all, windows allow key up events to be intercepted.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowonchar">wxWindow::OnChar</A>, <A HREF="wx260.htm#wxwindowonkeydown">wxWindow::OnKeyDown</A>,
+<A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A>, <A HREF="wx260.htm#wxwindowoncharhook">wxWindow::OnCharHook</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonkillfocus"></A>
+<H3>wxWindow::OnKillFocus</H3>
+<P>
+<B>void</B> <B>OnKillFocus</B>(<B>wxFocusEvent& </B><I>event</I>)<P>
+Called when a window's focus is being killed.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+The focus event. For more information, see <A HREF="wx99.htm#wxfocusevent">wxFocusEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+To intercept this event, use the macro EVT_KILL_FOCUS in an event table definition.<P>
+Most, but not all, windows respond to this event.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx99.htm#wxfocusevent">wxFocusEvent</A>, <A HREF="wx260.htm#wxwindowonsetfocus">wxWindow::OnSetFocus</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonidle"></A>
+<H3>wxWindow::OnIdle</H3>
+<P>
+<B>void</B> <B>OnIdle</B>(<B>wxIdleEvent& </B><I>event</I>)<P>
+Provide this member function for any processing which needs to be done
+when the application is idle.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx26.htm#wxapponidle">wxApp::OnIdle</A>, <A HREF="wx113.htm#wxidleevent">wxIdleEvent</A><P>
+
+<HR>
+<A NAME="wxwindowoninitdialog"></A>
+<H3>wxWindow::OnInitDialog</H3>
+<P>
+<B>void</B> <B>OnInitDialog</B>(<B>wxInitDialogEvent&</B><I> event</I>)<P>
+Default handler for the wxEVT_INIT_DIALOG event. Calls <A HREF="wx260.htm#wxwindowtransferdatatowindow">wxWindow::TransferDataToWindow</A>.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Dialog initialisation event.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Gives the window the default behaviour of transferring data to child controls via
+the validator that each control has.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx255.htm#wxvalidator">wxValidator</A>, <A HREF="wx260.htm#wxwindowtransferdatatowindow">wxWindow::TransferDataToWindow</A><P>
+
+<HR>
+<A NAME="wxwindowonmenucommand"></A>
+<H3>wxWindow::OnMenuCommand</H3>
+<P>
+<B>void</B> <B>OnMenuCommand</B>(<B>wxCommandEvent& </B><I>event</I>)<P>
+Called when a menu command is received from a menu bar.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+The menu command event. For more information, see <A HREF="wx52.htm#wxcommandevent">wxCommandEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+A function with this name doesn't actually exist; you can choose any member function to receive
+menu command events, using the EVT_COMMAND macro for individual commands or EVT_COMMAND_RANGE for
+a range of commands.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx52.htm#wxcommandevent">wxCommandEvent</A>,
+<A HREF="wx260.htm#wxwindowonmenuhighlight">wxWindow::OnMenuHighlight</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonmenuhighlight"></A>
+<H3>wxWindow::OnMenuHighlight</H3>
+<P>
+<B>void</B> <B>OnMenuHighlight</B>(<B>wxMenuEvent& </B><I>event</I>)<P>
+Called when a menu select is received from a menu bar: that is, the
+mouse cursor is over a menu item, but the left mouse button has not been
+pressed.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+The menu highlight event. For more information, see <A HREF="wx143.htm#wxmenuevent">wxMenuEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+You can choose any member function to receive
+menu select events, using the EVT_MENU_HIGHLIGHT macro for individual menu items or EVT_MENU_HIGHLIGHT_ALL macro
+for all menu items.<P>
+The default implementation for <A HREF="wx104.htm#wxframeonmenuhighlight">wxFrame::OnMenuHighlight</A> displays help
+text in the first field of the status bar.<P>
+This function was known as <B>OnMenuSelect</B> in earlier versions of wxWindows, but this was confusing
+since a selection is normally a left-click action.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx143.htm#wxmenuevent">wxMenuEvent</A>,
+<A HREF="wx260.htm#wxwindowonmenucommand">wxWindow::OnMenuCommand</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+
+<HR>
+<A NAME="wxwindowonmouseevent"></A>
+<H3>wxWindow::OnMouseEvent</H3>
+<P>
+<B>void</B> <B>OnMouseEvent</B>(<B>wxMouseEvent&</B><I> event</I>)<P>
+Called when the user has initiated an event with the
+mouse.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+The mouse event. See <A HREF="wx150.htm#wxmouseevent">wxMouseEvent</A> for
+more details.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Most, but not all, windows respond to this event.<P>
+To intercept this event, use the EVT_MOUSE_EVENTS macro in an event table definition, or individual
+mouse event macros such as EVT_LEFT_DOWN.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx150.htm#wxmouseevent">wxMouseEvent</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonmove"></A>
+<H3>wxWindow::OnMove</H3>
+<P>
+<B>void</B> <B>OnMove</B>(<B>wxMoveEvent& </B><I>event</I>)<P>
+Called when a window is moved.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+The move event. For more information, see <A HREF="wx151.htm#wxmoveevent">wxMoveEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Use the EVT_MOVE macro to intercept move events.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Not currently implemented.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx151.htm#wxmoveevent">wxMoveEvent</A>,
+<A HREF="wx104.htm#wxframeonsize">wxFrame::OnSize</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonpaint"></A>
+<H3>wxWindow::OnPaint</H3>
+<P>
+<B>void</B> <B>OnPaint</B>(<B>wxPaintEvent& </B><I>event</I>)<P>
+Sent to the event handler when the window must be refreshed.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Paint event. For more information, see <A HREF="wx164.htm#wxpaintevent">wxPaintEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Use the EVT_PAINT macro in an event table definition to intercept paint events.<P>
+In a paint event handler, the application should always create a <A HREF="wx163.htm#wxpaintdc">wxPaintDC</A> object.<P>
+For example:<P>
+<FONT SIZE=2><PRE>
+ void MyWindow::OnPaint(wxPaintEvent& event)
+ {
+ wxPaintDC dc(this);
+
+ DrawMyDocument(dc);
+ }
+</PRE>
+</FONT>You can optimize painting by retrieving the rectangles
+that have been damaged and only repainting these. The rectangles are in
+terms of the client area, and are unscrolled, so you will need to do
+some calculations using the current view position to obtain logical,
+scrolled units.<P>
+Here is an example of using the <A HREF="wx196.htm#wxregioniterator">wxRegionIterator</A> class:<P>
+<FONT SIZE=2><PRE>
+// Called when window needs to be repainted.
+void MyWindow::OnPaint(wxPaintEvent& event)
+{
+ wxPaintDC dc(this);
+
+ // Find Out where the window is scrolled to
+ int vbX,vbY; // Top left corner of client
+ ViewStart(&vbX,&vbY);
+
+ int vX,vY,vW,vH; // Dimensions of client area in pixels
+ wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
+
+ while (upd)
+ {
+ vX = upd.GetX();
+ vY = upd.GetY();
+ vW = upd.GetW();
+ vH = upd.GetH();
+
+ // Alternatively we can do this:
+ // wxRect rect;
+ // upd.GetRect(&rect);
+
+ // Repaint this rectangle
+ ...some code...
+
+ upd ++ ;
+ }
+}
+</PRE>
+</FONT><B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx164.htm#wxpaintevent">wxPaintEvent</A>,
+<A HREF="wx163.htm#wxpaintdc">wxPaintDC</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonscroll"></A>
+<H3>wxWindow::OnScroll</H3>
+<P>
+<B>void</B> <B>OnScroll</B>(<B>wxScrollEvent& </B><I>event</I>)<P>
+Called when a scroll event is received from one of the window's built-in scrollbars.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Command event. Retrieve the new scroll position by
+calling <A HREF="wx202.htm#wxscrolleventgetposition">wxScrollEvent::GetPosition</A>, and the
+scrollbar orientation by calling <A HREF="wx202.htm#wxscrolleventgetorientation">wxScrollEvent::GetOrientation</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Note that it is not possible to distinguish between horizontal and vertical scrollbars
+until the function is executing (you can't have one function for vertical, another
+for horizontal events).<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx202.htm#wxscrollevent">wxScrollEvent</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonsetfocus"></A>
+<H3>wxWindow::OnSetFocus</H3>
+<P>
+<B>void</B> <B>OnSetFocus</B>(<B>wxFocusEvent& </B><I>event</I>)<P>
+Called when a window's focus is being set.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+The focus event. For more information, see <A HREF="wx99.htm#wxfocusevent">wxFocusEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+To intercept this event, use the macro EVT_SET_FOCUS in an event table definition.<P>
+Most, but not all, windows respond to this event.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx99.htm#wxfocusevent">wxFocusEvent</A>, <A HREF="wx260.htm#wxwindowonkillfocus">wxWindow::OnKillFocus</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonsize"></A>
+<H3>wxWindow::OnSize</H3>
+<P>
+<B>void</B> <B>OnSize</B>(<B>wxSizeEvent& </B><I>event</I>)<P>
+Called when the window has been resized.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+Size event. For more information, see <A HREF="wx206.htm#wxsizeevent">wxSizeEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+You may wish to use this for frames to resize their child windows as appropriate.<P>
+Note that the size passed is of
+the whole window: call <A HREF="wx260.htm#wxwindowgetclientsize">wxWindow::GetClientSize</A> for the area which may be
+used by the application.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx206.htm#wxsizeevent">wxSizeEvent</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowonsyscolourchanged"></A>
+<H3>wxWindow::OnSysColourChanged</H3>
+<P>
+<B>void</B> <B>OnSysColourChanged</B>(<B>wxOnSysColourChangedEvent& </B><I>event</I>)<P>
+Called when the user has changed the system colours.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>event</I><UL><UL>
+System colour change event. For more information, see <A HREF="wx227.htm#wxsyscolourchangedevent">wxSysColourChangedEvent</A>.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx227.htm#wxsyscolourchangedevent">wxSysColourChangedEvent</A>,
+<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A><P>
+
+<HR>
+<A NAME="wxwindowpopeventhandler"></A>
+<H3>wxWindow::PopEventHandler</H3>
+<P>
+<B>wxEvtHandler*</B> <B>PopEventHandler</B>(<B>bool </B><I>deleteHandler = FALSE</I>) <B>const</B><P>
+Removes and returns the top-most event handler on the event handler stack.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>deleteHandler</I><UL><UL>
+If this is TRUE, the handler will be deleted after it is removed. The
+default value is FALSE.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowseteventhandler">wxWindow::SetEventHandler</A>,
+<A HREF="wx260.htm#wxwindowgeteventhandler">wxWindow::GetEventHandler</A>,
+<A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A>,
+<A HREF="wx85.htm#wxevthandlerprocessevent">wxEvtHandler::ProcessEvent</A>,
+<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><P>
+
+<HR>
+<A NAME="wxwindowpopupmenu"></A>
+<H3>wxWindow::PopupMenu</H3>
+<P>
+<B>virtual bool</B> <B>PopupMenu</B>(<B>wxMenu* </B><I>menu</I>, <B>int </B><I>x</I>, <B>int </B><I>y</I>)<P>
+Pops up the given menu at the specified coordinates, relative to this
+window, and returns control when the user has dismissed the menu. If a
+menu item is selected, the callback defined for the menu is called with
+wxMenu and wxCommandEvent reference arguments. The callback should access
+the commandInt member of the event to check the selected menu identifier.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>menu</I><UL><UL>
+Menu to pop up.</UL></UL>
+<P>
+<I>x</I><UL><UL>
+Required x position for the menu to appear.</UL></UL>
+<P>
+<I>y</I><UL><UL>
+Required y position for the menu to appear.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx140.htm#wxmenu">wxMenu</A><P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Just before the menu is popped up, <A HREF="wx140.htm#wxmenuupdateui">wxMenu::UpdateUI</A> is called
+to ensure that the menu items are in the correct state.<P>
+
+<HR>
+<A NAME="wxwindowpusheventhandler"></A>
+<H3>wxWindow::PushEventHandler</H3>
+<P>
+<B>void</B> <B>PushEventHandler</B>(<B>wxEvtHandler* </B><I>handler</I>)<P>
+Pushes this event handler onto the event stack for the window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>handler</I><UL><UL>
+Specifies the handler to be pushed.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+An event handler is an object that is capable of processing the events
+sent to a window. By default, the window is its own event handler, but
+an application may wish to substitute another, for example to allow
+central implementation of event-handling for a variety of different
+window classes.<P>
+<A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A> allows
+an application to set up a chain of event handlers, where an event not handled by one event handler is
+handed to the next one in the chain. Use <A HREF="wx260.htm#wxwindowpopeventhandler">wxWindow::PopEventHandler</A> to
+remove the event handler.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowseteventhandler">wxWindow::SetEventHandler</A>,
+<A HREF="wx260.htm#wxwindowgeteventhandler">wxWindow::GetEventHandler</A>,
+<A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PopEventHandler</A>,
+<A HREF="wx85.htm#wxevthandlerprocessevent">wxEvtHandler::ProcessEvent</A>,
+<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><P>
+
+<HR>
+<A NAME="wxwindowraise"></A>
+<H3>wxWindow::Raise</H3>
+<P>
+<B>void</B> <B>Raise</B>()<P>
+Raises the window to the top of the window hierarchy if it is a managed window (dialog
+or frame).<P>
+
+<HR>
+<A NAME="wxwindowrefresh"></A>
+<H3>wxWindow::Refresh</H3>
+<P>
+<B>virtual void</B> <B>Refresh</B>(<B>const bool</B><I> eraseBackground = TRUE</I>, <B>const wxRect* </B><I>rect
+= NULL</I>)<P>
+Causes a message or event to be generated to repaint the
+window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>eraseBackground</I><UL><UL>
+If TRUE, the background will be
+erased.</UL></UL>
+<P>
+<I>rect</I><UL><UL>
+If non-NULL, only the given rectangle will
+be treated as damaged.</UL></UL>
+<P>
+
+<HR>
+<A NAME="wxwindowreleasemouse"></A>
+<H3>wxWindow::ReleaseMouse</H3>
+<P>
+<B>virtual void</B> <B>ReleaseMouse</B>()<P>
+Releases mouse input captured with <A HREF="wx260.htm#wxwindowcapturemouse">wxWindow::CaptureMouse</A>.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowcapturemouse">wxWindow::CaptureMouse</A><P>
+
+<HR>
+<A NAME="wxwindowremovechild"></A>
+<H3>wxWindow::RemoveChild</H3>
+<P>
+<B>virtual void</B> <B>RemoveChild</B>(<B>wxWindow* </B><I>child</I>)<P>
+Removes a child window. This is called automatically by window deletion
+functions so should not be required by the application programmer.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>child</I><UL><UL>
+Child window to remove.</UL></UL>
+<P>
+
+<HR>
+<A NAME="wxwindowscreentoclient"></A>
+<H3>wxWindow::ScreenToClient</H3>
+<P>
+<B>virtual void</B> <B>ScreenToClient</B>(<B>int* </B><I>x</I>, <B>int* </B><I>y</I>) <B>const</B><P>
+<B>virtual wxPoint</B> <B>ScreenToClient</B>(<B>const wxPoint& </B><I>pt</I>) <B>const</B><P>
+Converts from screen to client window coordinates.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>x</I><UL><UL>
+Stores the screen x coordinate and receives the client x coordinate.</UL></UL>
+<P>
+<I>y</I><UL><UL>
+Stores the screen x coordinate and receives the client x coordinate.</UL></UL>
+<P>
+<I>pt</I><UL><UL>
+The screen position for the second form of the function.</UL></UL>
+<P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>ScreenToClient(point)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts and returns a wxPoint
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>ScreenToClientXY(x, y)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Returns a 2-tuple, (x, y)
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+
+<HR>
+<A NAME="wxwindowscrollwindow"></A>
+<H3>wxWindow::ScrollWindow</H3>
+<P>
+<B>virtual void</B> <B>ScrollWindow</B>(<B>int </B><I>dx</I>, <B>int </B><I>dy</I>, <B>const wxRect*</B><I> rect = NULL</I>)<P>
+Physically scrolls the pixels in the window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>dx</I><UL><UL>
+Amount to scroll horizontally.</UL></UL>
+<P>
+<I>dy</I><UL><UL>
+Amount to scroll vertically.</UL></UL>
+<P>
+<I>rect</I><UL><UL>
+Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
+pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
+can optimise painting by checking for the invalidated region.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Available only under Windows.<P>
+Use this function to optimise your scrolling implementations, to minimise the area that must be
+redrawn.<P>
+
+<HR>
+<A NAME="wxwindowsetacceleratortable"></A>
+<H3>wxWindow::SetAcceleratorTable</H3>
+<P>
+<B>virtual void</B> <B>SetAcceleratorTable</B>(<B>const wxAcceleratorTable&</B><I> accel</I>)<P>
+Sets the accelerator table for this window. See <A HREF="wx24.htm#wxacceleratortable">wxAcceleratorTable</A>.<P>
+
+<HR>
+<A NAME="wxwindowsetautolayout"></A>
+<H3>wxWindow::SetAutoLayout</H3>
+<P>
+<B>void</B> <B>SetAutoLayout</B>(<B>const bool</B><I> autoLayout</I>)<P>
+Determines whether the <A HREF="wx260.htm#wxwindowlayout">wxWindow::Layout</A> function will
+be called automatically when the window is resized.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>autoLayout</I><UL><UL>
+Set this to TRUE if you wish the Layout function to be called
+from within wxWindow::OnSize functions.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetconstraints">wxWindow::SetConstraints</A><P>
+
+<HR>
+<A NAME="wxwindowsetbackgroundcolour"></A>
+<H3>wxWindow::SetBackgroundColour</H3>
+<P>
+<B>virtual void</B> <B>SetBackgroundColour</B>(<B>const wxColour& </B><I>colour</I>)<P>
+Sets the background colour of the window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>colour</I><UL><UL>
+The colour to be used as the background colour.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+The background colour is usually painted by the default
+<A HREF="wx260.htm#wxwindowonerasebackground">wxWindow::OnEraseBackground</A> event handler function.<P>
+Note that setting the background colour does not cause an immediate refresh, so you
+may wish to call <A HREF="wx260.htm#wxwindowclear">wxWindow::Clear</A> or <A HREF="wx260.htm#wxwindowrefresh">wxWindow::Refresh</A> after
+calling this function.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowgetbackgroundcolour">wxWindow::GetBackgroundColour</A>,
+<A HREF="wx260.htm#wxwindowsetforegroundcolour">wxWindow::SetForegroundColour</A>,
+<A HREF="wx260.htm#wxwindowgetforegroundcolour">wxWindow::GetForegroundColour</A>,
+<A HREF="wx260.htm#wxwindowclear">wxWindow::Clear</A>,
+<A HREF="wx260.htm#wxwindowrefresh">wxWindow::Refresh</A>,
+<A HREF="wx260.htm#wxwindowonerasebackground">wxWindow::OnEraseBackground</A><P>
+
+<HR>
+<A NAME="wxwindowsetclientsize"></A>
+<H3>wxWindow::SetClientSize</H3>
+<P>
+<B>virtual void</B> <B>SetClientSize</B>(<B>int</B><I> width</I>, <B>int</B><I> height</I>)<P>
+<B>virtual void</B> <B>SetClientSize</B>(<B>const wxSize&</B><I> size</I>)<P>
+This sets the size of the window client area in pixels. Using this function to size a window
+tends to be more device-independent than <A HREF="wx260.htm#wxwindowsetsize">wxWindow::SetSize</A>, since the application need not
+worry about what dimensions the border or title bar have when trying to fit the window
+around panel items, for example.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>width</I><UL><UL>
+The required client area width.</UL></UL>
+<P>
+<I>height</I><UL><UL>
+The required client area height.</UL></UL>
+<P>
+<I>size</I><UL><UL>
+The required client size.</UL></UL>
+<P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>SetClientSize(size)</B>
+</TD>
+
+<TD VALIGN=TOP>
+Accepts a wxSize
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>SetClientSizeWH(width, height)</B>
+</TD>
+
+<TD VALIGN=TOP>
+
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+<HR>
+<A NAME="wxwindowsetcursor"></A>
+<H3>wxWindow::SetCursor</H3>
+<P>
+<B>virtual void</B> <B>SetCursor</B>(<B>const wxCursor&</B><I>cursor</I>)<P>
+Sets the window's cursor. Notice that setting the cursor for this window does
+not set it for its children so you'll need to explicitly call SetCursor() for
+them too if you need it.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>cursor</I><UL><UL>
+Specifies the cursor that the window should normally display.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx268.htm#wxsetcursor">::wxSetCursor</A>, <A HREF="wx59.htm#wxcursor">wxCursor</A><P>
+
+<HR>
+<A NAME="wxwindowseteventhandler"></A>
+<H3>wxWindow::SetEventHandler</H3>
+<P>
+<B>void</B> <B>SetEventHandler</B>(<B>wxEvtHandler* </B><I>handler</I>)<P>
+Sets the event handler for this window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>handler</I><UL><UL>
+Specifies the handler to be set.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+An event handler is an object that is capable of processing the events
+sent to a window. By default, the window is its own event handler, but
+an application may wish to substitute another, for example to allow
+central implementation of event-handling for a variety of different
+window classes.<P>
+It is usually better to use <A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A> since
+this sets up a chain of event handlers, where an event not handled by one event handler is
+handed to the next one in the chain.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowgeteventhandler">wxWindow::GetEventHandler</A>,
+<A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PushEventHandler</A>,
+<A HREF="wx260.htm#wxwindowpusheventhandler">wxWindow::PopEventHandler</A>,
+<A HREF="wx85.htm#wxevthandlerprocessevent">wxEvtHandler::ProcessEvent</A>,
+<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><P>
+
+<HR>
+<A NAME="wxwindowsetconstraints"></A>
+<H3>wxWindow::SetConstraints</H3>
+<P>
+<B>void</B> <B>SetConstraints</B>(<B>wxLayoutConstraints* </B><I>constraints</I>)<P>
+Sets the window to have the given layout constraints. The window
+will then own the object, and will take care of its deletion.
+If an existing layout constraints object is already owned by the
+window, it will be deleted.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>constraints</I><UL><UL>
+The constraints to set. Pass NULL to disassociate and delete the window's
+constraints.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+You must call <A HREF="wx260.htm#wxwindowsetautolayout">wxWindow::SetAutoLayout</A> to tell a window to use
+the constraints automatically in OnSize; otherwise, you must
+override OnSize and call Layout explicitly.<P>
+
+<HR>
+<A NAME="wxwindowsetdroptarget"></A>
+<H3>wxWindow::SetDropTarget</H3>
+<P>
+<B>void</B> <B>SetDropTarget</B>(<B>wxDropTarget*</B><I> target</I>)<P>
+Associates a drop target with this window.<P>
+If the window already has a drop target, it is deleted.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowgetdroptarget">wxWindow::GetDropTarget</A>,
+<A HREF="wx312.htm#wxdndoverview">Drag and drop overview</A><P>
+
+<HR>
+<A NAME="wxwindowsetfocus"></A>
+<H3>wxWindow::SetFocus</H3>
+<P>
+<B>virtual void</B> <B>SetFocus</B>()<P>
+This sets the window to receive keyboard input.<P>
+
+<HR>
+<A NAME="wxwindowsetfont"></A>
+<H3>wxWindow::SetFont</H3>
+<P>
+<B>void</B> <B>SetFont</B>(<B>const wxFont& </B><I>font</I>)<P>
+Sets the font for this window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>font</I><UL><UL>
+Font to associate with this window.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowgetfont">wxWindow::GetFont</A><P>
+
+<HR>
+<A NAME="wxwindowsetforegroundcolour"></A>
+<H3>wxWindow::SetForegroundColour</H3>
+<P>
+<B>virtual void</B> <B>SetForegroundColour</B>(<B>const wxColour& </B><I>colour</I>)<P>
+Sets the foreground colour of the window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>colour</I><UL><UL>
+The colour to be used as the foreground colour.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+The interpretation of foreground colour is open to interpretation according
+to the window class; it may be the text colour or other colour, or it may not
+be used at all.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowgetforegroundcolour">wxWindow::GetForegroundColour</A>,
+<A HREF="wx260.htm#wxwindowsetbackgroundcolour">wxWindow::SetBackgroundColour</A>,
+<A HREF="wx260.htm#wxwindowgetbackgroundcolour">wxWindow::GetBackgroundColour</A><P>
+
+<HR>
+<A NAME="wxwindowsetid"></A>
+<H3>wxWindow::SetId</H3>
+<P>
+<B>void</B> <B>SetId</B>(<B>int</B><I> id</I>)<P>
+Sets the identifier of the window.<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Each window has an integer identifier. If the application has not provided one,
+an identifier will be generated. Normally, the identifier should be provided
+on creation and should not be modified subsequently.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowgetid">wxWindow::GetId</A>,
+<A HREF="wx299.htm#windowids">Window identifiers</A><P>
+
+<HR>
+<A NAME="wxwindowsetname"></A>
+<H3>wxWindow::SetName</H3>
+<P>
+<B>virtual void</B> <B>SetName</B>(<B>const wxString& </B><I>name</I>)<P>
+Sets the window's name.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>name</I><UL><UL>
+A name to set for the window.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowgetname">wxWindow::GetName</A><P>
+
+<HR>
+<A NAME="wxwindowsetpalette"></A>
+<H3>wxWindow::SetPalette</H3>
+<P>
+<B>virtual void</B> <B>SetPalette</B>(<B>wxPalette* </B><I>palette</I>)<P>
+Obsolete - use <A HREF="wx65.htm#wxdcsetpalette">wxDC::SetPalette</A> instead.<P>
+
+<HR>
+<A NAME="wxwindowsetreturncode"></A>
+<H3>wxWindow::SetReturnCode</H3>
+<P>
+<B>void</B> <B>SetReturnCode</B>(<B>int </B><I>retCode</I>)<P>
+Sets the return code for this window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>retCode</I><UL><UL>
+The integer return code, usually a control identifier.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+A return code is normally associated with a modal dialog, where <A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A> returns
+a code to the application. The function <A HREF="wx71.htm#wxdialogendmodal">wxDialog::EndModal</A> calls <B>SetReturnCode</B>.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowgetreturncode">wxWindow::GetReturnCode</A>, <A HREF="wx71.htm#wxdialogshowmodal">wxDialog::ShowModal</A>,
+<A HREF="wx71.htm#wxdialogendmodal">wxDialog::EndModal</A><P>
+
+<HR>
+<A NAME="wxwindowsetscrollbar"></A>
+<H3>wxWindow::SetScrollbar</H3>
+<P>
+<B>virtual void</B> <B>SetScrollbar</B>(<B>int </B><I>orientation</I>, <B>int </B><I>position</I>,
+<B>int </B><I>thumbSize</I>, <B>int </B><I>range</I>,
+<B>const bool </B><I>refresh = TRUE</I>)<P>
+Sets the scrollbar properties of a built-in scrollbar.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>orientation</I><UL><UL>
+Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.</UL></UL>
+<P>
+<I>position</I><UL><UL>
+The position of the scrollbar in scroll units.</UL></UL>
+<P>
+<I>thumbSize</I><UL><UL>
+The size of the thumb, or visible portion of the scrollbar, in scroll units.</UL></UL>
+<P>
+<I>range</I><UL><UL>
+The maximum position of the scrollbar.</UL></UL>
+<P>
+<I>refresh</I><UL><UL>
+TRUE to redraw the scrollbar, FALSE otherwise.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+Let's say you wish to display 50 lines of text, using the same font.
+The window is sized so that you can only see 16 lines at a time.<P>
+You would use:<P>
+<FONT SIZE=2><PRE>
+ SetScrollbar(wxVERTICAL, 0, 16, 50);
+</PRE>
+</FONT><P>
+Note that with the window at this size, the thumb position can never go
+above 50 minus 16, or 34.<P>
+You can determine how many lines are currently visible by dividing the current view
+size by the character height in pixels.<P>
+When defining your own scrollbar behaviour, you will always need to recalculate
+the scrollbar settings when the window size changes. You could therefore put your
+scrollbar calculations and SetScrollbar
+call into a function named AdjustScrollbars, which can be called initially and also
+from your <A HREF="wx260.htm#wxwindowonsize">wxWindow::OnSize</A> event handler function.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx297.htm#scrollingoverview">Scrolling overview</A>,
+<A HREF="wx201.htm#wxscrollbar">wxScrollBar</A>, <A HREF="wx203.htm#wxscrolledwindow">wxScrolledWindow</A><P>
+
+<HR>
+<A NAME="wxwindowsetscrollpos"></A>
+<H3>wxWindow::SetScrollPos</H3>
+<P>
+<B>virtual void</B> <B>SetScrollPos</B>(<B>int </B><I>orientation</I>, <B>int </B><I>pos</I>, <B>const bool </B><I>refresh = TRUE</I>)<P>
+Sets the position of one of the built-in scrollbars.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>orientation</I><UL><UL>
+Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.</UL></UL>
+<P>
+<I>pos</I><UL><UL>
+Position in scroll units.</UL></UL>
+<P>
+<I>refresh</I><UL><UL>
+TRUE to redraw the scrollbar, FALSE otherwise.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+This function does not directly affect the contents of the window: it is up to the
+application to take note of scrollbar attributes and redraw contents accordingly.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowsetscrollbar">wxWindow::SetScrollbar</A>,
+<A HREF="wx260.htm#wxwindowsetscrollpos">wxWindow::GetScrollPos</A>,
+<A HREF="wx260.htm#wxwindowgetscrollthumb">wxWindow::GetScrollThumb</A>,
+<A HREF="wx201.htm#wxscrollbar">wxScrollBar</A>, <A HREF="wx203.htm#wxscrolledwindow">wxScrolledWindow</A><P>
+
+<HR>
+<A NAME="wxwindowsetsize"></A>
+<H3>wxWindow::SetSize</H3>
+<P>
+<B>virtual void</B> <B>SetSize</B>(<B>int</B><I> x</I>, <B>int</B><I> y</I>, <B>int</B><I> width</I>, <B>int</B><I> height</I>,
+ <B>int</B><I> sizeFlags = wxSIZE_AUTO</I>)<P>
+<B>virtual void</B> <B>SetSize</B>(<B>const wxRect&</B><I> rect</I>)<P>
+Sets the size and position of the window in pixels.<P>
+<B>virtual void</B> <B>SetSize</B>(<B>int</B><I> width</I>, <B>int</B><I> height</I>)<P>
+<B>virtual void</B> <B>SetSize</B>(<B>const wxSize&</B><I> size</I>)<P>
+Sets the size of the window in pixels.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>x</I><UL><UL>
+Required x position in pixels, or -1 to indicate that the existing
+value should be used.</UL></UL>
+<P>
+<I>y</I><UL><UL>
+Required y position in pixels, or -1 to indicate that the existing
+value should be used.</UL></UL>
+<P>
+<I>width</I><UL><UL>
+Required width in pixels, or -1 to indicate that the existing
+value should be used.</UL></UL>
+<P>
+<I>height</I><UL><UL>
+Required height position in pixels, or -1 to indicate that the existing
+value should be used.</UL></UL>
+<P>
+<I>size</I><UL><UL>
+<A HREF="wx205.htm#wxsize">wxSize</A> object for setting the size.</UL></UL>
+<P>
+<I>rect</I><UL><UL>
+<A HREF="wx193.htm#wxrect">wxRect</A> object for setting the position and size.</UL></UL>
+<P>
+<I>sizeFlags</I><UL><UL>
+Indicates the interpretation of other parameters. It is a bit list of the following:<P>
+<B>wxSIZE_AUTO_WIDTH</B>: a -1 width value is taken to indicate
+a wxWindows-supplied default width.<BR>
+
+<B>wxSIZE_AUTO_HEIGHT</B>: a -1 height value is taken to indicate
+a wxWindows-supplied default width.<BR>
+
+<B>wxSIZE_AUTO</B>: -1 size values are taken to indicate
+a wxWindows-supplied default size.<BR>
+
+<B>wxSIZE_USE_EXISTING</B>: existing dimensions should be used
+if -1 values are supplied.<BR>
+
+<B>wxSIZE_ALLOW_MINUS_ONE</B>: allow dimensions of -1 and less to be interpreted
+as real dimensions, not default values.
+</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+The second form is a convenience for calling the first form with default
+x and y parameters, and must be used with non-default width and height values.<P>
+The first form sets the position and optionally size, of the window.
+Parameters may be -1 to indicate either that a default should be supplied
+by wxWindows, or that the current value of the dimension should be used.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowmove">wxWindow::Move</A><P>
+<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
+ In place of a single overloaded method name, wxPython
+implements the following methods:<P>
+
+<UL><UL>
+
+<TABLE>
+
+
+<TR><TD VALIGN=TOP>
+<B>SetDimensions(x, y, width, height, sizeFlags=wxSIZE_AUTO)</B>
+</TD>
+
+<TD VALIGN=TOP>
+
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>SetSize(size)</B>
+</TD>
+
+<TD VALIGN=TOP>
+
+</TD></TR>
+
+
+<TR><TD VALIGN=TOP>
+<B>SetPosition(point)</B>
+</TD>
+
+<TD VALIGN=TOP>
+
+</TD></TR>
+
+
+</TABLE>
+</UL></UL>
+
+<P>
+
+<HR>
+<A NAME="wxwindowsetsizehints"></A>
+<H3>wxWindow::SetSizeHints</H3>
+<P>
+<B>virtual void</B> <B>SetSizeHints</B>(<B>int</B><I> minW=-1</I>, <B>int</B><I> minH=-1</I>, <B>int</B><I> maxW=-1</I>, <B>int</B><I> maxH=-1</I>,
+ <B>int</B><I> incW=-1</I>, <B>int</B><I> incH=-1</I>)<P>
+Allows specification of minimum and maximum window sizes, and window size increments.
+If a pair of values is not set (or set to -1), the default values will be used.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>minW</I><UL><UL>
+Specifies the minimum width allowable.</UL></UL>
+<P>
+<I>minH</I><UL><UL>
+Specifies the minimum height allowable.</UL></UL>
+<P>
+<I>maxW</I><UL><UL>
+Specifies the maximum width allowable.</UL></UL>
+<P>
+<I>maxH</I><UL><UL>
+Specifies the maximum height allowable.</UL></UL>
+<P>
+<I>incW</I><UL><UL>
+Specifies the increment for sizing the width (Motif/Xt only).</UL></UL>
+<P>
+<I>incH</I><UL><UL>
+Specifies the increment for sizing the height (Motif/Xt only).</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
+If this function is called, the user will not be able to size the window outside the
+given bounds.<P>
+The resizing increments are only significant under Motif or Xt.<P>
+
+<HR>
+<A NAME="wxwindowsettitle"></A>
+<H3>wxWindow::SetTitle</H3>
+<P>
+<B>virtual void</B> <B>SetTitle</B>(<B>const wxString& </B><I>title</I>)<P>
+Sets the window's title. Applicable only to frames and dialogs.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>title</I><UL><UL>
+The window's title.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowgettitle">wxWindow::GetTitle</A><P>
+
+<HR>
+<A NAME="topic1041"></A>
+<H3>wxWindow::Show</H3>
+<P>
+<B>virtual bool</B> <B>Show</B>(<B>const bool</B><I> show</I>)<P>
+Shows or hides the window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>show</I><UL><UL>
+If TRUE, displays the window and brings it to the front. Otherwise,
+hides the window.</UL></UL>
+<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowisshown">wxWindow::IsShown</A><P>
+
+<HR>
+<A NAME="wxwindowtransferdatafromwindow"></A>
+<H3>wxWindow::TransferDataFromWindow</H3>
+<P>
+<B>virtual bool</B> <B>TransferDataFromWindow</B>()<P>
+Transfers values from child controls to data areas specified by their validators. Returns
+FALSE if a transfer failed.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowtransferdatatowindow">wxWindow::TransferDataToWindow</A>,
+<A HREF="wx255.htm#wxvalidator">wxValidator</A>, <A HREF="wx260.htm#wxwindowvalidate">wxWindow::Validate</A><P>
+
+<HR>
+<A NAME="wxwindowtransferdatatowindow"></A>
+<H3>wxWindow::TransferDataToWindow</H3>
+<P>
+<B>virtual bool</B> <B>TransferDataToWindow</B>()<P>
+Transfers values to child controls from data areas specified by their validators.<P>
+<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
+Returns FALSE if a transfer failed.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowtransferdatafromwindow">wxWindow::TransferDataFromWindow</A>,
+<A HREF="wx255.htm#wxvalidator">wxValidator</A>, <A HREF="wx260.htm#wxwindowvalidate">wxWindow::Validate</A><P>
+
+<HR>
+<A NAME="wxwindowvalidate"></A>
+<H3>wxWindow::Validate</H3>
+<P>
+<B>virtual bool</B> <B>Validate</B>()<P>
+Validates the current values of the child controls using their validators.<P>
+<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
+Returns FALSE if any of the validations failed.<P>
+<B><FONT COLOR="#FF0000">See also</FONT></B><P>
+<A HREF="wx260.htm#wxwindowtransferdatafromwindow">wxWindow::TransferDataFromWindow</A>,
+<A HREF="wx260.htm#wxwindowtransferdatafromwindow">wxWindow::TransferDataFromWindow</A>,
+<A HREF="wx255.htm#wxvalidator">wxValidator</A><P>
+
+<HR>
+<A NAME="wxwindowwarppointer"></A>
+<H3>wxWindow::WarpPointer</H3>
+<P>
+<B>void</B> <B>WarpPointer</B>(<B>int</B><I> x</I>, <B>int</B><I> y</I>)<P>
+Moves the pointer to the given position on the window.<P>
+<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
+<I>x</I><UL><UL>
+The new x position for the cursor.</UL></UL>
+<P>
+<I>y</I><UL><UL>
+The new y position for the cursor.</UL></UL>
+<P>
+
+</BODY></HTML>
--- /dev/null
+<head>
+ <META >
+ <META NAME="Author" CONTENT="Vaclav Slavik">
+ <META NAME="Keywords" CONTENT="wxWindows,HTML widget,HTML,free,Unix,Linux,Windows,cross-platform,wxHTML,LGPL">
+ <TITLE>wxHTML : wxWindows HTML library</TITLE>
+</head>
+
+<body TEXT="#000000" BGCOLOR="#8D99BC" LINK="#51188E" VLINK="#51188E" ALINK="#FF0000">
+
+<!-- TITLE BAR -->
+
+<center>
+<img src="pic/logo.png">
+<p>
+[ Intro & News ]
+<a href="features.html.iso-8859-1">[ Features ]</a>
+<a href="downloads.html.iso-8859-1">[ Download ]</a>
+<a href="licence.html.iso-8859-1">[ Licence ]</a>
+<a href="screenshots.html.iso-8859-1">[ Screenshots ]</a>
+<a href="links.html.iso-8859-1">[ Links & Apps ]</a>
+</center>
+
+
+<!-- PAGE -->
+
+
+<!-- HEADLINE -->
+
+<p align=center><b><font color="#9B3030">
+
+<center><table bgcolor="#00000" width="60%" cellpadding=1>
+<tr><td>
+<table width="100%" cellspacing=1 cellpadding=0><tr><td bgcolor="#7783A2" valign=center><font color="#FFFFFF" size=+2><center>
+
+Latest release 0.2.3
+
+</center></font>
+</table>
+</table></center>
+
+</font></b></p>
+
+<center></center>
+<div align=right><font size=-1>
+<!-- begin include -->
+2811<!-- end --> visitors since January 99
+
+
+<br>Last updated on : June 13, 1999
+
+
+</font></div>
+<p>
+
+<table width="100%" cellspacing=0 cellpadding=6 border><tr><td width="30%" bgcolor="#7783A2" valign=top>
+
+
+<!-- NEWS -->
+
+<h2><u>News</u></h2>
+
+<ul>
+<li><b><font color="#9B3030">13/06/1999</font> - CVS available! </b><br>
+Thanks to Russell Smith, development version of wxHTML is available through CVS.
+See Download page for details!
+</ul>
+
+<ul>
+<li><b><font color="#9B3030">13/06/1999</font> - 0.2.3 release </b><br>
+Only minor changes and bugfixes.
+</ul>
+
+<ul>
+<li><b><font color="#9B3030">16/05/1999</font> - New release </b><br>
+Well, 0.2.1 is out. It contains some bug fixes (mainly related to Visual C++)
+and new help controller that works with MS HTML Help Workshop projects as
+it's native format. Patch from previous version is only 30kB so don't hesitate
+to download it!
+</ul>
+
+<ul>
+<li><b><font color="#9B3030">02/05/1999</font> - Beta release 0.2 is out!</b><br>
+Ok, it's here, download it! Help controller is included (and broken under
+MSW/Mingw32 - I'll fix it asap. If anyone can help with it, please do so...)
+</ul>
+
+
+
+
+
+<!-- INTRO -->
+
+<td valign=top>
+<h2><u>Intro</u></h2>
+
+I started work on this library in January, 1999.
+<br>The main goal was to provide light-weight HTML viewer for
+<a href="http://web.ukonline.co.uk/julian.smart/wxwin">wxWindows 2</a> toolkit.
+This viewer was expected to be used as help/documentation browser rather than full-featured web browser.
+
+<p>This library is released under <b><font color="#330000"><a href="licence.html.iso-8859-1">
+wxWindows Library Licence, Version 3</a></font>.</b> It is basically
+GNU Library General Public Licence except that it makes using
+wxHTML in commercial products much easier.
+
+<p>The library should work on all platforms supported by wxWindows - it
+is written as poor wxWindows-only code, without line of platform-specific
+code (as I hope :-). It is known to compile under these enviromnets:
+
+<ul>
+<li>EGCS under Linux
+<li>Cygwin b20 or Mingw32 under Windows 95
+</ul>
+
+
+
+
+
+
+<!-- AUTHOR -->
+
+<h2><u>Author(s)</u></h2>
+<i>wxHTML (and this page) is copyrighted by Vaclav Slavik. Parts of wxHTML are copyrighted by other
+autors - all of them are listed in <a href="#contrib">contributors</a> section.
+</i>
+<p>
+Feel free to send your suggestions, comments, bug reports to me. My
+e-mail address is
+
+<br><A HREF="mailto:slavik2@czn.cz">slavik2@czn.cz</A>
+<br>or
+<br><A HREF="mailto:vsla8348@ss1000.ms.mff.cuni.cz">vsla8348@ss1000.ms.mff.cuni.cz</A>
+<p align=right>Vaclav Slavik
+
+
+<a name="contrib"><h2><u>Contributors</u></h2></a>
+<ul>
+<li><b><u>Guillermo Rodriguez Garcia</u></b> (<a href="mailto:guille@iies.es">guille@iies.es</a>)
+<br>contributed GIF reading routines
+</ul>
+
+</table>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="GENERATOR" CONTENT="Mozilla/4.06 [en] (X11; I; Linux 2.0.35 i686) [Netscape]">
+</HEAD>
+<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EF" VLINK="#51188E" ALINK="#FF0000">
+
+<H3>
+This is TABLES
+tests page...</H3>
+
+
+(yes, really, see bellow:)
+<BR>Click <a href="test.htm">here</a> to go to original testing page...
+<BR>Click <a href="../../docs/html/man.htm">here</a> to go to manuals...
+<BR>
+<CENTER><TABLE CELLSPACING=5 BORDER COLS=2 WIDTH="40%" NOSAVE >
+<TR ALIGN=CENTER NOSAVE>
+<TD WIDTH="40%" NOSAVE>Top left
+<BR>(two lines expression)
+<P>paragraph done</TD>
+
+<TD NOSAVE>Top right</TD>
+</TR>
+
+<TR>
+<TD>Bottom left</TD>
+
+<TD>Bottom right</TD>
+</TR>
+</TABLE></CENTER>
+
+<P>Subsampling is shown there:
+<BR>
+<TABLE BORDER COLS=2 WIDTH="100%" NOSAVE >
+<TR NOSAVE>
+<TD VALIGN=BOTTOM NOSAVE>
+<TABLE BORDER COLS=2 WIDTH="50%" NOSAVE >
+<TR ALIGN=CENTER BGCOLOR="#3366FF" NOSAVE>
+<TD>a</TD>
+
+<TD WIDTH="10%" NOSAVE>b</TD>
+</TR>
+
+<TR NOSAVE>
+<TD>c</TD>
+
+<TD NOSAVE>d</TD>
+</TR>
+
+</TABLE>
+</TD>
+
+<TD VALIGN=BOTTOM NOSAVE>2</TD>
+</TR>
+
+<TR NOSAVE>
+<TD>3 dflkj lkjfl dkjldkfjl flk jflkf lkjflkj ljlf ajlfj alff h khg hgj
+gjg jg gjhfg fg gjh gjf jgf jgj f gjfgj kfajg </TD>
+
+<TD ALIGN=CENTER VALIGN=BOTTOM BGCOLOR="#FFFF99" NOSAVE>4
+<BR>gh
+<BR>gfh
+<BR>gh
+<BR>hg
+<BR>5</TD>
+</TR>
+</TABLE>
+
+<P>This is "default" table - with no sizes givev:
+<BR>
+<TABLE BORDER COLS=4 WIDTH="100%" NOSAVE >
+<TR NOSAVE>
+<TD>Hello</TD>
+
+<TD NOSAVE>lkfdsjlk fj dlfj lkfj lkjflk jlfk lk fjlk elwkf lkejflek f jlekjflkj
+ljlk lk jlkf lefjl j flkj ljl lf lfj lfjl lj lwe lekf;eh kfejh lkh kjh
+kjhkj hkj hkj lkh kjh kjlh kj</TD>
+
+<TD>shortebn formo lr lk</TD>
+
+<TD>djsf lkjlf poer oi pjr po kpk </TD>
+</TR>
+
+<TR>
+<TD>a</TD>
+
+<TD>b</TD>
+
+<TD>c</TD>
+
+<TD>d</TD>
+</TR>
+
+<TR NOSAVE>
+<TD>1</TD>
+
+<TD>2</TD>
+
+<TD COLSPAN="2" ROWSPAN="2" NOSAVE>3</TD>
+</TR>
+
+<TR>
+<TD>A</TD>
+
+<TD>B</Td>
+</TR>
+</TABLE>
+
+
+
+
+
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: test.cpp
+// Purpose: wxHtml testing example
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma implementation "test.cpp"
+ #pragma interface "test.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include <wx/wxprec.h>
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+ #include <wx/wx.h>
+#endif
+
+#include <wx/image.h>
+#include <wx/html/htmlwin.h>
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+// Define a new application type, each program should derive a class from wxApp
+ class MyApp : public wxApp
+ {
+ public:
+ // override base class virtuals
+ // ----------------------------
+
+ // this one is called on application startup and is a good place for the app
+ // initialization (doing it here and not in the ctor allows to have an error
+ // return: if OnInit() returns false, the application terminates)
+ virtual bool OnInit();
+ };
+
+// Define a new frame type: this is going to be our main frame
+ class MyFrame : public wxFrame
+ {
+ public:
+ // ctor(s)
+ MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
+
+ // event handlers (these functions should _not_ be virtual)
+ void OnQuit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+ void OnBack(wxCommandEvent& event);
+ void OnForward(wxCommandEvent& event);
+
+ private:
+ // any class wishing to process wxWindows events must use this macro
+ DECLARE_EVENT_TABLE()
+ };
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+ enum
+ {
+ // menu items
+ Minimal_Quit = 1,
+ Minimal_About,
+ Minimal_Back,
+ Minimal_Forward,
+
+ // controls start here (the numbers are, of course, arbitrary)
+ Minimal_Text = 1000,
+ };
+
+// ----------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// ----------------------------------------------------------------------------
+
+// the event tables connect the wxWindows events with the functions (event
+// handlers) which process them. It can be also done at run-time, but for the
+// simple menu events like this the static method is much simpler.
+ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
+ EVT_MENU(Minimal_About, MyFrame::OnAbout)
+ EVT_MENU(Minimal_Back, MyFrame::OnBack)
+ EVT_MENU(Minimal_Forward, MyFrame::OnForward)
+ END_EVENT_TABLE()
+
+ // Create a new application object: this macro will allow wxWindows to create
+ // the application object during program execution (it's better than using a
+ // static object for many reasons) and also declares the accessor function
+ // wxGetApp() which will return the reference of the right type (i.e. MyApp and
+ // not wxApp)
+ IMPLEMENT_APP(MyApp)
+
+ // ============================================================================
+ // implementation
+ // ============================================================================
+
+ // ----------------------------------------------------------------------------
+ // the application class
+ // ----------------------------------------------------------------------------
+ // `Main program' equivalent: the program execution "starts" here
+ bool MyApp::OnInit()
+ {
+ wxLogDebug("[starting testing app]");
+ #if wxUSE_LIBPNG
+ wxImage::AddHandler(new wxPNGHandler);
+ #endif
+ #if wxUSE_LIBJPEG
+ wxImage::AddHandler(new wxJPEGHandler);
+ #endif
+ // Create the main application window
+ MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
+ wxPoint(50, 50), wxSize(640, 480));
+
+ // Show it and tell the application that it's our main window
+ // @@@ what does it do exactly, in fact? is it necessary here?
+ frame->Show(TRUE);
+ SetTopWindow(frame);
+
+
+ // success: wxApp::OnRun() will be called which will enter the main message
+ // loop and the application will run. If we returned FALSE here, the
+ // application would exit immediately.
+ return TRUE;
+ }
+
+// ----------------------------------------------------------------------------
+// main frame
+// ----------------------------------------------------------------------------
+
+wxHtmlWindow *html;
+
+// frame constructor
+ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : wxFrame((wxFrame *)NULL, -1, title, pos, size)
+ {
+ // create a menu bar
+ wxMenu *menuFile = new wxMenu;
+ wxMenu *menuNav = new wxMenu;
+
+ menuFile->Append(Minimal_About, "&Load wxWindows manual page");
+ menuFile->AppendSeparator();
+ menuFile->Append(Minimal_Quit, "E&xit");
+ menuNav->Append(Minimal_Back, "Go &BACK");
+ menuNav->Append(Minimal_Forward, "Go &FORWARD");
+
+ // now append the freshly created menu to the menu bar...
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(menuFile, "&File");
+ menuBar->Append(menuNav, "&Navigate");
+
+ // ... and attach this menu bar to the frame
+ SetMenuBar(menuBar);
+
+ CreateStatusBar(1);
+
+ {
+ wxConfig *cfg = new wxConfig("wxHtmlTest");
+ html = new wxHtmlWindow(this);
+ html -> SetRelatedFrame(this, "HTML : %s");
+ html -> SetRelatedStatusBar(0);
+ html -> ReadCustomization(cfg);
+ delete cfg;
+ html -> LoadPage("test.htm");
+ }
+ }
+
+
+// event handlers
+
+ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+ {
+ // TRUE is to force the frame to close
+ wxLogDebug("about to save config...");
+ wxConfig *cfg = new wxConfig("wxHtmlTest");
+ html -> WriteCustomization(cfg);
+ delete cfg;
+ Close(TRUE);
+ }
+
+ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+ {
+ html -> LoadPage("fft.html");
+ }
+
+
+
+ void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
+ {
+ if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
+ }
+
+
+ void MyFrame::OnForward(wxCommandEvent& WXUNUSED(event))
+ {
+ if (!html -> HistoryForward()) wxMessageBox("No more items in history!");
+ }
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="GENERATOR" CONTENT="Mozilla/4.06 [en] (X11; I; Linux 2.0.35 i686) [Netscape]">
+</HEAD>
+<BODY TEXT="#000000" BGCOLOR="#006600" LINK="#0000FF" VLINK="#FF0000" ALINK="#000088">
+
+<b><a href="tables.htm">click here to go to tables test page!</a></b>
+
+<p>
+This is - - default text, now switching to
+<CENTER>
+<P>center, now still ctr, now exiting</CENTER>
+exited!.<A HREF="#downtown">[link to down]</A>
+<P>Hello, this *is* default charset (helvetica, probably) and it is displayed
+with one <FONT COLOR="#FF0000">COLOR CHANGE</FONT>. Of course we
+can have as many color changes as we can, what about this <FONT COLOR="#FF0000">M</FONT><FONT COLOR="#FFFF00">A</FONT><FONT COLOR="#33FF33">D</FONT><B><FONT COLOR="#FFFFFF"><FONT SIZE=+1>N</FONT></FONT></B>E<FONT COLOR="#999999">S</FONT><FONT COLOR="#CC33CC">S?</FONT>
+<P><FONT COLOR="#000000">There was a space above.</FONT>
+<BR>
+<HR WIDTH="100%">This was a line. <TT>(BTW we are in <B>fixed</B> font
+/ <I><U>typewriter</U> font</I> right now :-)</TT>
+<BR>This is in <B>BOLD</B> face. This is <I>ITALIC.</I> This is <B><I><U>E
+V E R Y T H I N G</U></I></B>.
+<BR>
+<P><BR>
+<CENTER>
+<P>Right now, <FONT COLOR="#0000FF"><FONT SIZE=+4>centered REALLY Big Text</FONT></FONT>,
+how do you like (space) it?</CENTER>
+
+<DIV ALIGN=right>RIGHT: <FONT SIZE=-2>text-2, </FONT><FONT SIZE=-1>text-1,
+</FONT>text+0,
+<FONT SIZE=+1>text+1,
+</FONT><FONT COLOR="#FF0000"><FONT SIZE=+2>text+2,
+</FONT></FONT><FONT SIZE=+3>text+3,
+</FONT><FONT SIZE=+4>text+4</FONT>
+<BR><U><FONT SIZE=+1>we are right now</FONT></U></DIV>
+
+<CENTER><U><FONT SIZE=+1>we are center now</FONT></U></CENTER>
+<U><FONT SIZE=+1>we are left now.</FONT></U>
+<P><I><FONT COLOR="#3366FF">Blue italic text is displayed there....</FONT></I>
+<H1>
+
+<HR ALIGN=LEFT SIZE=10 WIDTH="50%">This is heading one.</H1>
+this is normal
+<CENTER>
+<H1>
+This is <FONT COLOR="#33FF33">CENTERED</FONT> heading one</H1></CENTER>
+<FONT COLOR="#FFFF00">Yes, hmmmmmmmmm........, right now, <TT>we should
+display some tiny nice image</TT>, he?</FONT>
+<BR><IMG SRC="pic.png" ALT="Testing image image" ><IMG SRC="pic2.bmp">and this is text......
+<P><IMG SRC="pic.png" ALT="Testing image image" HEIGHT=200 WIDTH=327 ALIGN=CENTER>and
+this is text......
+<BR><A HREF="pic.png"><IMG SRC="pic.png" ALT="Testing image image" HEIGHT=160 WIDTH=100 ALIGN=TEXTTOP></A> (try clicking on the image :-) and
+this is text......
+<BR>
+<BR>
+<UL>
+<LI>
+item 1</LI>
+
+<LI>
+item 2</LI>
+
+<UL>
+<LI>
+nested item</LI>
+
+<LI>
+nested item 2</LI>
+</UL>
+
+<LI>
+item 3</LI>
+</UL>
+
+<OL>
+<LI>
+item one</LI>
+
+<LI>
+item two</LI>
+
+<OL>
+<LI>
+nsted item</LI>
+</OL>
+
+<LI>
+last numbered item</LI>
+</OL>
+
+<H1>
+Heading 1</H1>
+<I>Italic text now...</I>
+<H2>
+<I>Heading 2</I></H2>
+<I>and now?</I>
+<H3>
+Heading 3</H3>
+
+<H4>
+Heading 4</H4>
+
+<H5>
+Heading 5</H5>
+
+<H6>
+Heading 6</H6>
+And this is normal text, once again :-)
+<BR>
+<BR>
+<BR>
+<BR>
+<BR>
+<BR>
+<P>And yes, we're in <FONT SIZE=+4>HTML DOCUMENT, </FONT><FONT SIZE=+1>so
+what about some nice <A HREF="fft.html">hypertext link</A>??</FONT>
+<P>hello?
+<BR>
+<P><BR>
+<CENTER>
+<P>This is <A NAME="downtown"></a>centered paragraph</CENTER>
+
+<P>This is new par?
+<P><B>We switched to BOLD</B>
+<P><B>This is new paragraph</B> Bold is off now.
+<P>new par
+<P> -----------
+<P><FONT SIZE=-2>Hello</FONT>
+<OL><FONT SIZE=-2>this is standalone :-)</FONT>
+<LI>
+<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
+jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
+fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
+kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
+twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
+TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
+two two two two two two twotwo TWO</FONT></LI>
+
+<BLOCKQUOTE><FONT SIZE=+0><B>(blockquote)</B>two two two two two two twotwo
+TWO two two two two two two twotwo TWO two two two two two two twotwo TWO</FONT>
+<BLOCKQUOTE><FONT SIZE=+0>two two two two two two twotwo TWO two two two</FONT></BLOCKQUOTE>
+<FONT SIZE=+0>two two two twotwo TWO two two two two two two twotwo TWO
+two two two two two two twotwo TWO</FONT></BLOCKQUOTE>
+<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
+twotwo TWO</FONT>
+<LI>
+<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
+jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
+fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
+kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
+twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
+TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
+two two two two two two twotwo TWO two two two two two two twotwo TWO two
+two two two two two twotwo TWO two two two two two two twotwo TWO two two
+two two two two twotwo TWO two two two two two two twotwo TWO two two two
+two two two twotwo TWO two two two two two two twotwo TWO two two two two
+two two twotwo TWO two two two two two two twotwo TWO</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
+jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
+fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
+kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
+twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
+TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
+two two two two two two twotwo TWO two two two two two two twotwo TWO two
+two two two two two twotwo TWO two two two two two two twotwo TWO two two
+two two two two twotwo TWO two two two two two two twotwo TWO two two two
+two two two twotwo TWO two two two two two two twotwo TWO two two two two
+two two twotwo TWO two two two two two two twotwo TWO</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
+jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
+fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
+kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
+twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
+TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
+two two two two two two twotwo TWO two two two two two two twotwo TWO two
+two two two two two twotwo TWO two two two two two two twotwo TWO two two
+two two two two twotwo TWO two two two two two two twotwo TWO two two two
+two two two twotwo TWO two two two two two two twotwo TWO two two two two
+two two twotwo TWO two two two two two two twotwo TWO</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
+jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
+fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
+kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
+
+<LI>
+<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
+twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
+TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
+two two two two two two twotwo TWO two two two two two two twotwo TWO</FONT></LI>
+
+<P><BR><FONT SIZE=-2>two two two two two two twotwo TWO two two two two
+two two twotwo TWO two two two two two two twotwo TWO two two two two two
+two twotwo TWO</FONT>
+<P><FONT SIZE=-2>two two two two two two twotwo TWO two two two two two
+two twotwo TWO two two two two two two twotwo TWO two two two two two two
+twotwo TWO</FONT>
+<LI>
+<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
+</OL>
+Now, you will see some PRE text:<p>
+<PRE>// This is sample C++ code:
+
+void main(int argc, char *argv[])
+{
+ printf("Go away, man!\n");
+ i = 666;
+ printf("\n\n\nCRASH\n DOWN NOW. . . \n");
+}</PRE>
+
+<H3>WWW</H3>
+<A HREF="http://www.kde.org">This is WWW link to KDE site!</A>
+<BR>
+
+
+
+
+
+
+<A HREF="http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html">(one folder up)</A>
+<BR>
+
+...
+<BR>
+...
+<BR>
+Link to normal text file : <a href="test.cpp">test.cpp</a>
+<BR>
+And link to BINARY : <a href="test">Unix</a> or <a href="test.exe">Windows</a>
+<BR>
+<a href="http://www.tue.nl">ANOTHER LINK(www.tue.nl)</a>
+
+
+</BODY>
+</HTML>
--- /dev/null
+#include "wx/msw/wx.rc"
+
--- /dev/null
+AUTOMAKE_OPTIONS = 1.3 no-dependencies
+
+SUFFIXES = .cpp
+
+DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
+
+noinst_PROGRAMS = virtual
+
+virtual_SOURCES = virtual.cpp
--- /dev/null
+<html>
+<head><title>VFS Demo</title></head>
+<body>
+<h3>Virtual File Systems demonstration</h3>
+
+Hello. This sample demonstrates VFS. Try the link (and have a look
+at status bar before clicking on them)
+<p>
+<a href="myVFS:node"><b>Enter top level Node...</b></a>
+
+</body>
+</html>
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: virtua;.cpp
+// Purpose: wxHtml testing example
+// demonstrates virtual file systems feature
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma implementation "test.cpp"
+ #pragma interface "test.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include <wx/wxprec.h>
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+ #include <wx/wx.h>
+#endif
+
+
+#include <wx/html/htmlwin.h>
+
+
+// new handler class:
+
+#include <wx/wfstream.h>
+#include <wx/mstream.h>
+
+
+
+class MyVFS : public wxFileSystemHandler
+{
+public:
+ MyVFS() : wxFileSystemHandler() {}
+
+ wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
+ bool CanOpen(const wxString& location);
+};
+
+
+bool MyVFS::CanOpen(const wxString& location)
+{
+ return (GetProtocol(location) == "myVFS");
+}
+
+
+
+wxFSFile* MyVFS::OpenFile(wxFileSystem& fs, const wxString& location)
+{
+ wxFSFile *f;
+ wxInputStream *str;
+ char *buf = (char*)malloc(1024);
+
+ sprintf(buf, "<html><body><h2><i>You're in Node <u>%s</u></i></h2><p>"
+ "Where do you want to go?<br><blockquote>"
+ "<a href=\"%s-1\">sub-1</a><br>"
+ "<a href=\"%s-2\">sub-2</a><br>"
+ "<a href=\"%s-3\">sub-3</a><br>"
+ "</blockquote></body></html>",
+ location.GetData(), location.GetData(), location.GetData(), location.GetData());
+ str = new wxMemoryInputStream(buf, strlen(buf));
+ f = new wxFSFile(str, location, "text/html", wxEmptyString);
+ return f;
+}
+
+
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+// Define a new application type, each program should derive a class from wxApp
+ class MyApp : public wxApp
+ {
+ public:
+ // override base class virtuals
+ // ----------------------------
+
+ // this one is called on application startup and is a good place for the app
+ // initialization (doing it here and not in the ctor allows to have an error
+ // return: if OnInit() returns false, the application terminates)
+ virtual bool OnInit();
+ };
+
+// Define a new frame type: this is going to be our main frame
+ class MyFrame : public wxFrame
+ {
+ public:
+ // ctor(s)
+ MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
+
+ // event handlers (these functions should _not_ be virtual)
+ void OnQuit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+ void OnBack(wxCommandEvent& event);
+ void OnForward(wxCommandEvent& event);
+
+ private:
+ // any class wishing to process wxWindows events must use this macro
+ DECLARE_EVENT_TABLE()
+ };
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+ enum
+ {
+ // menu items
+ Minimal_Quit = 1,
+ Minimal_About,
+ Minimal_Back,
+ Minimal_Forward,
+
+ // controls start here (the numbers are, of course, arbitrary)
+ Minimal_Text = 1000,
+ };
+
+// ----------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// ----------------------------------------------------------------------------
+
+// the event tables connect the wxWindows events with the functions (event
+// handlers) which process them. It can be also done at run-time, but for the
+// simple menu events like this the static method is much simpler.
+ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
+ EVT_MENU(Minimal_About, MyFrame::OnAbout)
+ EVT_MENU(Minimal_Back, MyFrame::OnBack)
+ EVT_MENU(Minimal_Forward, MyFrame::OnForward)
+ END_EVENT_TABLE()
+
+ // Create a new application object: this macro will allow wxWindows to create
+ // the application object during program execution (it's better than using a
+ // static object for many reasons) and also declares the accessor function
+ // wxGetApp() which will return the reference of the right type (i.e. MyApp and
+ // not wxApp)
+ IMPLEMENT_APP(MyApp)
+
+ // ============================================================================
+ // implementation
+ // ============================================================================
+
+ // ----------------------------------------------------------------------------
+ // the application class
+ // ----------------------------------------------------------------------------
+
+ // `Main program' equivalent: the program execution "starts" here
+ bool MyApp::OnInit()
+ {
+ // Create the main application window
+ MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
+ wxPoint(50, 50), wxSize(640, 480));
+
+ // Show it and tell the application that it's our main window
+ // @@@ what does it do exactly, in fact? is it necessary here?
+ frame->Show(TRUE);
+ SetTopWindow(frame);
+ wxFileSystem::AddHandler(new MyVFS);
+
+ // success: wxApp::OnRun() will be called which will enter the main message
+ // loop and the application will run. If we returned FALSE here, the
+ // application would exit immediately.
+ return TRUE;
+ }
+
+// ----------------------------------------------------------------------------
+// main frame
+// ----------------------------------------------------------------------------
+
+wxHtmlWindow *html;
+
+// frame constructor
+ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : wxFrame((wxFrame *)NULL, -1, title, pos, size)
+ {
+ // create a menu bar
+ wxMenu *menuFile = new wxMenu;
+ wxMenu *menuNav = new wxMenu;
+
+ menuFile->Append(Minimal_Quit, "E&xit");
+ menuNav->Append(Minimal_Back, "Go &BACK");
+ menuNav->Append(Minimal_Forward, "Go &FORWARD");
+
+ // now append the freshly created menu to the menu bar...
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(menuFile, "&File");
+ menuBar->Append(menuNav, "&Navigate");
+
+ // ... and attach this menu bar to the frame
+ SetMenuBar(menuBar);
+
+ CreateStatusBar(1);
+
+ html = new wxHtmlWindow(this);
+ html -> SetRelatedFrame(this, "VFS Demo: '%s'");
+ html -> SetRelatedStatusBar(1);
+ html -> LoadPage("start.htm");
+ }
+
+
+// event handlers
+
+ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+ {
+ // TRUE is to force the frame to close
+ Close(TRUE);
+ }
+
+ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+ {
+ }
+
+
+
+ void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
+ {
+ if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
+ }
+
+
+ void MyFrame::OnForward(wxCommandEvent& WXUNUSED(event))
+ {
+ if (!html -> HistoryForward()) wxMessageBox("No more items in history!");
+ }
--- /dev/null
+#include "wx/msw/wx.rc"
+
--- /dev/null
+AUTOMAKE_OPTIONS = 1.3 no-dependencies
+
+SUFFIXES = .cpp
+
+DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
+
+noinst_PROGRAMS = widget
+
+widget_SOURCES = widget.cpp
--- /dev/null
+<html>
+<head><title>Binder demo</title></head>
+<body>
+<h3>wxHtmlBinderCell demonstration</h3>
+
+There is binded window somewhere around. Enjoy it.
+
+<hr>
+<center>
+<mybind name="experimental binded window :-)" x=300 y=500>
+</center>
+<hr>
+
+<mybind name="(small one)" x=150 y=30>
+<hr>
+
+<mybind name="a widget with floating width, hurray :-)" float=y x="50" y=50>
+
+</body>
+</html>
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: virtua;.cpp
+// Purpose: wxHtml testing example
+// demonstrates virtual file systems feature
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma implementation "test.cpp"
+ #pragma interface "test.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include <wx/wxprec.h>
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+ #include <wx/wx.h>
+#endif
+
+
+#include <wx/html/htmlwin.h>
+
+
+
+
+/*
+
+
+TAG HANDER FOR 'MYBIND' TAG
+
+
+*/
+
+#include <wx/html/mod_templ.h>
+
+
+TAG_HANDLER_BEGIN(MYBIND, "MYBIND")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ wxWindow *wnd;
+ int ax, ay;
+ int fl = 0;
+
+ tag.ScanParam("X", "%i", &ax);
+ tag.ScanParam("Y", "%i", &ay);
+ if (tag.HasParam("FLOAT")) fl = ax;
+
+ wnd = new wxTextCtrl( m_WParser -> GetWindow(), -1, tag.GetParam("NAME"),
+ wxPoint(0,0), wxSize(ax, ay), wxTE_MULTILINE );
+ wnd -> Show(TRUE);
+
+ m_WParser -> OpenContainer() -> InsertCell(new wxHtmlWidgetCell(wnd, fl));
+
+ return FALSE;
+ }
+
+TAG_HANDLER_END(MYBIND)
+
+
+
+TAGS_MODULE_BEGIN(MyBind)
+
+ TAGS_MODULE_ADD(MYBIND)
+
+TAGS_MODULE_END(MyBind)
+
+
+
+
+
+
+
+
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+// Define a new application type, each program should derive a class from wxApp
+ class MyApp : public wxApp
+ {
+ public:
+ // override base class virtuals
+ // ----------------------------
+
+ // this one is called on application startup and is a good place for the app
+ // initialization (doing it here and not in the ctor allows to have an error
+ // return: if OnInit() returns false, the application terminates)
+ virtual bool OnInit();
+ };
+
+// Define a new frame type: this is going to be our main frame
+ class MyFrame : public wxFrame
+ {
+ public:
+ // ctor(s)
+ MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
+
+ // event handlers (these functions should _not_ be virtual)
+ void OnQuit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+ void OnBack(wxCommandEvent& event);
+ void OnForward(wxCommandEvent& event);
+
+ private:
+ // any class wishing to process wxWindows events must use this macro
+ DECLARE_EVENT_TABLE()
+ };
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+ enum
+ {
+ // menu items
+ Minimal_Quit = 1,
+ Minimal_About,
+ Minimal_Back,
+ Minimal_Forward,
+
+ // controls start here (the numbers are, of course, arbitrary)
+ Minimal_Text = 1000,
+ };
+
+// ----------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// ----------------------------------------------------------------------------
+
+// the event tables connect the wxWindows events with the functions (event
+// handlers) which process them. It can be also done at run-time, but for the
+// simple menu events like this the static method is much simpler.
+ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
+ EVT_MENU(Minimal_About, MyFrame::OnAbout)
+ EVT_MENU(Minimal_Back, MyFrame::OnBack)
+ EVT_MENU(Minimal_Forward, MyFrame::OnForward)
+ END_EVENT_TABLE()
+
+ // Create a new application object: this macro will allow wxWindows to create
+ // the application object during program execution (it's better than using a
+ // static object for many reasons) and also declares the accessor function
+ // wxGetApp() which will return the reference of the right type (i.e. MyApp and
+ // not wxApp)
+ IMPLEMENT_APP(MyApp)
+
+ // ============================================================================
+ // implementation
+ // ============================================================================
+
+ // ----------------------------------------------------------------------------
+ // the application class
+ // ----------------------------------------------------------------------------
+
+ // `Main program' equivalent: the program execution "starts" here
+ bool MyApp::OnInit()
+ {
+ // Create the main application window
+ MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
+ wxPoint(50, 50), wxSize(640, 480));
+
+ // Show it and tell the application that it's our main window
+ // @@@ what does it do exactly, in fact? is it necessary here?
+ frame->Show(TRUE);
+ SetTopWindow(frame);
+
+ // success: wxApp::OnRun() will be called which will enter the main message
+ // loop and the application will run. If we returned FALSE here, the
+ // application would exit immediately.
+ return TRUE;
+ }
+
+// ----------------------------------------------------------------------------
+// main frame
+// ----------------------------------------------------------------------------
+
+wxHtmlWindow *html;
+
+// frame constructor
+ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : wxFrame((wxFrame *)NULL, -1, title, pos, size)
+ {
+ // create a menu bar
+ wxMenu *menuFile = new wxMenu;
+ wxMenu *menuNav = new wxMenu;
+
+ menuFile->Append(Minimal_Quit, "E&xit");
+ menuNav->Append(Minimal_Back, "Go &BACK");
+ menuNav->Append(Minimal_Forward, "Go &FORWARD");
+
+ // now append the freshly created menu to the menu bar...
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(menuFile, "&File");
+ menuBar->Append(menuNav, "&Navigate");
+
+ // ... and attach this menu bar to the frame
+ SetMenuBar(menuBar);
+
+ CreateStatusBar(1);
+
+ html = new wxHtmlWindow(this);
+ html -> SetRelatedFrame(this, "VFS Demo: '%s'");
+ html -> SetRelatedStatusBar(1);
+ html -> LoadPage("start.htm");
+ }
+
+
+// event handlers
+
+ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+ {
+ // TRUE is to force the frame to close
+ Close(TRUE);
+ }
+
+ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+ {
+ }
+
+
+
+ void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
+ {
+ if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
+ }
+
+
+ void MyFrame::OnForward(wxCommandEvent& WXUNUSED(event))
+ {
+ if (!html -> HistoryForward()) wxMessageBox("No more items in history!");
+ }
+
+
+
+
+
+
--- /dev/null
+#include "wx/msw/wx.rc"
+
--- /dev/null
+AUTOMAKE_OPTIONS = 1.3 no-dependencies
+
+SUFFIXES = .cpp
+
+DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
+
+noinst_PROGRAMS = zip
+
+zip_SOURCES = zip.cpp
--- /dev/null
+<html><body>
+<h1>ZIP archive</h1>
+<h3>feature demo</h3>
+<p>
+Click on this <a href="pages.zip#zip:test.htm">link</a> to load page stored in ZIP
+archive (<a href="pages.zip">pages.zip</a>). Enjoy it!
+
+
+</body></html>
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: test.cpp
+// Purpose: wxHtml testing example
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma implementation "test.cpp"
+ #pragma interface "test.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include <wx/wxprec.h>
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+ #include <wx/wx.h>
+#endif
+
+#include <wx/image.h>
+#include <wx/html/htmlwin.h>
+#include <wx/fs_zip.h>
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+// Define a new application type, each program should derive a class from wxApp
+ class MyApp : public wxApp
+ {
+ public:
+ // override base class virtuals
+ // ----------------------------
+
+ // this one is called on application startup and is a good place for the app
+ // initialization (doing it here and not in the ctor allows to have an error
+ // return: if OnInit() returns false, the application terminates)
+ virtual bool OnInit();
+ };
+
+// Define a new frame type: this is going to be our main frame
+ class MyFrame : public wxFrame
+ {
+ public:
+ // ctor(s)
+ MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
+
+ // event handlers (these functions should _not_ be virtual)
+ void OnQuit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+ void OnBack(wxCommandEvent& event);
+ void OnForward(wxCommandEvent& event);
+
+ private:
+ // any class wishing to process wxWindows events must use this macro
+ DECLARE_EVENT_TABLE()
+ };
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+ enum
+ {
+ // menu items
+ Minimal_Quit = 1,
+ Minimal_About,
+ Minimal_Back,
+ Minimal_Forward,
+
+ // controls start here (the numbers are, of course, arbitrary)
+ Minimal_Text = 1000,
+ };
+
+// ----------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// ----------------------------------------------------------------------------
+
+// the event tables connect the wxWindows events with the functions (event
+// handlers) which process them. It can be also done at run-time, but for the
+// simple menu events like this the static method is much simpler.
+ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
+ EVT_MENU(Minimal_About, MyFrame::OnAbout)
+ EVT_MENU(Minimal_Back, MyFrame::OnBack)
+ EVT_MENU(Minimal_Forward, MyFrame::OnForward)
+ END_EVENT_TABLE()
+
+ // Create a new application object: this macro will allow wxWindows to create
+ // the application object during program execution (it's better than using a
+ // static object for many reasons) and also declares the accessor function
+ // wxGetApp() which will return the reference of the right type (i.e. MyApp and
+ // not wxApp)
+ IMPLEMENT_APP(MyApp)
+
+ // ============================================================================
+ // implementation
+ // ============================================================================
+
+ // ----------------------------------------------------------------------------
+ // the application class
+ // ----------------------------------------------------------------------------
+ // `Main program' equivalent: the program execution "starts" here
+ bool MyApp::OnInit()
+ {
+ #if wxUSE_LIBPNG
+ wxImage::AddHandler(new wxPNGHandler);
+ #endif
+ #if wxUSE_LIBJPEG
+ wxImage::AddHandler(new wxJPEGHandler);
+ #endif
+
+ wxFileSystem::AddHandler(new wxZipFSHandler);
+
+ // Create the main application window
+ MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
+ wxPoint(50, 50), wxSize(640, 480));
+
+ // Show it and tell the application that it's our main window
+ // @@@ what does it do exactly, in fact? is it necessary here?
+ frame->Show(TRUE);
+ SetTopWindow(frame);
+
+ // success: wxApp::OnRun() will be called which will enter the main message
+ // loop and the application will run. If we returned FALSE here, the
+ // application would exit immediately.
+ return TRUE;
+ }
+
+// ----------------------------------------------------------------------------
+// main frame
+// ----------------------------------------------------------------------------
+
+wxHtmlWindow *html;
+
+// frame constructor
+ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : wxFrame((wxFrame *)NULL, -1, title, pos, size)
+ {
+ // create a menu bar
+ wxMenu *menuFile = new wxMenu;
+ wxMenu *menuNav = new wxMenu;
+
+ menuFile->Append(Minimal_Quit, "E&xit");
+ menuNav->Append(Minimal_Back, "Go &BACK");
+ menuNav->Append(Minimal_Forward, "Go &FORWARD");
+
+ // now append the freshly created menu to the menu bar...
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(menuFile, "&File");
+ menuBar->Append(menuNav, "&Navigate");
+
+ // ... and attach this menu bar to the frame
+ SetMenuBar(menuBar);
+
+ CreateStatusBar(1);
+
+ {
+ html = new wxHtmlWindow(this);
+ html -> SetRelatedFrame(this, "HTML : %s");
+ html -> SetRelatedStatusBar(0);
+ html -> LoadPage("start.htm");
+ }
+ }
+
+
+// event handlers
+
+ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+ {
+ // TRUE is to force the frame to close
+ Close(TRUE);
+ }
+
+ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+ {
+ }
+
+
+
+ void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
+ {
+ if (!html -> HistoryBack()) wxMessageBox("You reached prehistory era!");
+ }
+
+
+ void MyFrame::OnForward(wxCommandEvent& WXUNUSED(event))
+ {
+ if (!html -> HistoryForward()) wxMessageBox("No more items in history!");
+ }
--- /dev/null
+#include "wx/msw/wx.rc"
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: filesys.cpp
+// Purpose: wxFileSystem class - interface for opening files
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/wfstream.h>
+#include <wx/url.h>
+#include <wx/module.h>
+#include <wx/filesys.h>
+
+
+
+//--------------------------------------------------------------------------------
+// wxFileSystemHandler
+//--------------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxFileSystemHandler, wxObject)
+
+wxMimeTypesManager wxFileSystemHandler::m_MimeMng;
+
+
+wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location)
+{
+ wxString ext = wxEmptyString, mime = wxEmptyString;
+ wxString loc = GetRightLocation(location);
+ char c;
+ int l = loc.Length(), l2;
+ wxFileType *ft;
+
+ l2 = l;
+ for (int i = l-1; i >= 0; i--) {
+ c = loc[i];
+ if (c == '#') l2 = i + 1;
+ if (c == '.') {ext = loc.Right(l2-i-1); break;}
+ if ((c == '/') || (c == '\\') || (c == ':')) {return wxEmptyString;}
+ }
+ ft = m_MimeMng.GetFileTypeFromExtension(ext);
+ if (ft && (ft -> GetMimeType(&mime))) return mime;
+ else return wxEmptyString;
+}
+
+
+
+wxString wxFileSystemHandler::GetProtocol(const wxString& location) const
+{
+ wxString s = wxEmptyString;
+ int i, l = location.Length();
+ bool fnd;
+
+ fnd = FALSE;
+ for (i = l-1; (i >= 0) && ((location[i] != '#') || (!fnd)); i--) {
+ if ((location[i] == ':') && (i != 1 /*win: C:\path*/)) fnd = TRUE;
+ }
+ if (!fnd) return "file";
+ for (++i; (i < l) && (location[i] != ':'); i++) s << location[i];
+ return s;
+}
+
+
+
+wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const
+{
+ int i;
+ bool fnd;
+
+ fnd = FALSE;
+ for (i = location.Length()-1; i >= 0; i--) {
+ if ((location[i] == ':') && (i != 1 /*win: C:\path*/)) fnd = TRUE;
+ else if (fnd && (location[i] == '#')) return location.Left(i);
+ }
+ return wxEmptyString;
+}
+
+
+
+wxString wxFileSystemHandler::GetRightLocation(const wxString& location) const
+{
+ int i, l = location.Length();
+ int l2 = l + 1;
+ for (i = l-1; (i >= 0) && ((location[i] != ':') || (i == 1) || (location[i-2] == ':')); i--) {if (location[i] == '#') l2 = i + 1;}
+ if (i == 0) return wxEmptyString;
+ else return location.Mid(i + 1, l2 - i - 2);
+}
+
+
+
+wxString wxFileSystemHandler::GetAnchor(const wxString& location) const
+{
+ char c;
+ int l = location.Length();
+
+ for (int i = l-1; i >= 0; i--) {
+ c = location[i];
+ if (c == '#') return location.Right(l-i-1);
+ else if ((c == '.') || (c == '/') || (c == '\\') || (c == ':')) return wxEmptyString;
+ }
+ return wxEmptyString;
+}
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxLocalFSHandler
+//--------------------------------------------------------------------------------
+
+class wxLocalFSHandler : public wxFileSystemHandler
+{
+ public:
+ virtual bool CanOpen(const wxString& location);
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
+};
+
+
+
+bool wxLocalFSHandler::CanOpen(const wxString& location)
+{
+ return GetProtocol(location) == "file";
+}
+
+
+
+wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
+{
+ wxString right = GetRightLocation(location);
+ if (wxFileExists(right))
+ return new wxFSFile(new wxFileInputStream(right),
+ right,
+ GetMimeTypeFromExt(location),
+ GetAnchor(location));
+ else return NULL;
+}
+
+
+
+
+
+
+//-----------------------------------------------------------------------------
+// wxFileSystem
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxFileSystem, wxObject)
+
+
+wxList wxFileSystem::m_Handlers;
+
+
+
+void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir)
+{
+ int i, pathpos = -1;
+ m_Path = location;
+
+ for (i = m_Path.Length()-1; i >= 0; i--)
+ if (m_Path[i] == '\\') m_Path.GetWritableChar(i) = '/'; // wanna be windows-safe
+
+ if (is_dir == FALSE) {
+ for (i = m_Path.Length()-1; i >= 0; i--) {
+ if (m_Path[i] == '/') {
+ if ((i > 1) && (m_Path[i-1] == '/') && (m_Path[i-2] == ':')) {
+ i -= 2;
+ continue;
+ }
+ else {
+ pathpos = i;
+ break;
+ }
+ }
+ else if (m_Path[i] == ':') {
+ pathpos = i;
+ break;
+ }
+ }
+ if (pathpos == -1) {
+ for (i = 0; i < (int) m_Path.Length(); i++) {
+ if (m_Path[i] == ':') {
+ //m_Path << '/';
+ m_Path.Remove(i+1);
+ break;
+ }
+ }
+ if (i == (int) m_Path.Length()) m_Path = wxEmptyString;
+ }
+ else {
+ if (m_Path[m_Path.Length()-1] != '/') m_Path << '/';
+ m_Path.Remove(pathpos+1);
+ }
+ }
+}
+
+
+
+wxFSFile* wxFileSystem::OpenFile(const wxString& location)
+{
+ wxString loc = location;
+ int i, ln;
+ char meta;
+ wxFSFile *s = NULL;
+ wxNode *node;
+
+ ln = loc.Length();
+ meta = 0;
+ for (i = 0; i < ln; i++) {
+ if (loc[i] == '\\') loc.GetWritableChar(i) = '/'; // wanna be windows-safe
+ if (!meta) switch (loc[i]) {
+ case '/' : case ':' : case '#' : meta = loc[i];
+ }
+ }
+ m_LastName = wxEmptyString;
+
+ // try relative paths first :
+ if (meta != ':') {
+ node = m_Handlers.GetFirst();
+ while (node){
+ wxFileSystemHandler *h = (wxFileSystemHandler*) node -> GetData();
+ if (h -> CanOpen(m_Path + location)) {
+ s = h -> OpenFile(*this, m_Path + location);
+ if (s) {m_LastName = m_Path + location; break;}
+ }
+ node = node -> GetNext();
+ }
+ }
+
+ // if failed, try absolute paths :
+ if (s == NULL) {
+ node = m_Handlers.GetFirst();
+ while (node){
+ wxFileSystemHandler *h = (wxFileSystemHandler*) node -> GetData();
+ if (h -> CanOpen(location)) {
+ s = h -> OpenFile(*this, location);
+ if (s) {m_LastName = location; break; }
+ }
+ node = node -> GetNext();
+ }
+ }
+ return (s);
+}
+
+
+
+void wxFileSystem::AddHandler(wxFileSystemHandler *handler)
+{
+ m_Handlers.Append(handler);
+}
+
+
+
+
+
+
+
+
+
+
+
+///// Module:
+
+class wxFileSystemModule : public wxModule
+{
+ DECLARE_DYNAMIC_CLASS(wxFileSystemModule)
+
+ public:
+ virtual bool OnInit()
+ {
+ wxFileSystem::AddHandler(new wxLocalFSHandler);
+ return TRUE;
+ }
+ virtual void OnExit() {}
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxFileSystemModule, wxModule)
+
+
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: fs_inet.cpp
+// Purpose: HTTP and FTP file system
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+
+REMARKS :
+
+This FS creates local cache (in /tmp directory). The cache is freed
+on program exit.
+
+Size of cache is limited to cca 1000 items (due to GetTempFileName
+limitation)
+
+
+*/
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include "wx/wfstream.h"
+#include "wx/url.h"
+#include "wx/filesys.h"
+#include "wx/fs_inet.h"
+
+class wxInetCacheNode : public wxObject
+{
+ private:
+ wxString m_Temp;
+ wxString m_Mime;
+
+ public:
+ wxInetCacheNode(const wxString& l, const wxString& m) : wxObject() {m_Temp = l; m_Mime = m;}
+ const wxString& GetTemp() const {return m_Temp;}
+ const wxString& GetMime() const {return m_Mime;}
+};
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxInternetFSHandler
+//--------------------------------------------------------------------------------
+
+
+bool wxInternetFSHandler::CanOpen(const wxString& location)
+{
+ wxString p = GetProtocol(location);
+ return (p == "http") || (p == "ftp");
+}
+
+
+
+
+wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
+{
+ wxString right = GetProtocol(location) + ":" + GetRightLocation(location);
+ wxInputStream *s;
+ wxString content;
+ wxInetCacheNode *info;
+
+ info = (wxInetCacheNode*) m_Cache.Get(right);
+
+ // Add item into cache:
+ if (info == NULL) {
+ wxURL url(right);
+ s = url.GetInputStream();
+ content = url.GetProtocol().GetContentType();
+ if (content == wxEmptyString) content = GetMimeTypeFromExt(location);
+ if (s) {
+ char buf[256];
+
+ wxGetTempFileName("wxhtml", buf);
+ info = new wxInetCacheNode(buf, content);
+ m_Cache.Put(right, info);
+
+ { // ok, now copy it:
+ wxFileOutputStream sout(buf);
+ s -> Read(sout); // copy the stream
+ }
+ delete s;
+ }
+ else return NULL; //we can't open the URL
+ }
+
+ // Load item from cache:
+ s = new wxFileInputStream(info -> GetTemp());
+ if (s) {
+ return new wxFSFile(s,
+ right,
+ info -> GetMime(),
+ GetAnchor(location));
+ }
+ else return NULL;
+}
+
+
+
+wxInternetFSHandler::~wxInternetFSHandler()
+{
+ wxNode *n;
+ wxInetCacheNode *n2;
+
+ m_Cache.BeginFind();
+ while ((n = m_Cache.Next()) != NULL) {
+ n2 = (wxInetCacheNode*) n -> GetData();
+ wxRemoveFile(n2 -> GetTemp());
+ delete n2;
+ }
+}
+
+
+
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: fs_zip.cpp
+// Purpose: ZIP file system
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include "wx/filesys.h"
+#include "wx/zipstream.h"
+#include "wx/fs_zip.h"
+
+
+//--------------------------------------------------------------------------------
+// wxZipFSHandler
+//--------------------------------------------------------------------------------
+
+
+
+bool wxZipFSHandler::CanOpen(const wxString& location)
+{
+ wxString p = GetProtocol(location);
+ return (p == "zip");
+}
+
+
+
+
+wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
+{
+ wxString right = GetRightLocation(location);
+ wxString left = GetLeftLocation(location);
+ wxInputStream *s;
+
+ if (GetProtocol(left) != "file") {
+ return NULL;
+ }
+
+ s = new wxZipInputStream(left, right);
+ if (s && (s -> LastError() == wxStream_NOERROR)) {
+ return new wxFSFile(s,
+ left + "#zip:" + right,
+ GetMimeTypeFromExt(location),
+ GetAnchor(location));
+ }
+ else return NULL;
+}
+
+
+
+wxZipFSHandler::~wxZipFSHandler()
+{
+}
+
+
+
+
+
+
+
--- /dev/null
+/* unzip.c -- IO on .zip files using zlib
+ Version 0.15 beta, Mar 19th, 1998,
+
+ Read unzip.h for more info
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "zlib.h"
+#include "unzip.h"
+
+#ifdef STDC
+# include <stddef.h>
+# include <string.h>
+# include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+ extern int errno;
+#else
+# include <errno.h>
+#endif
+
+
+#ifndef local
+# define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+
+
+#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \
+ !defined(CASESENSITIVITYDEFAULT_NO)
+#define CASESENSITIVITYDEFAULT_NO
+#endif
+
+
+#ifndef UNZ_BUFSIZE
+#define UNZ_BUFSIZE (16384)
+#endif
+
+#ifndef UNZ_MAXFILENAMEINZIP
+#define UNZ_MAXFILENAMEINZIP (256)
+#endif
+
+#ifndef ALLOC
+# define ALLOC(size) (malloc(size))
+#endif
+#ifndef TRYFREE
+# define TRYFREE(p) {if (p) free(p);}
+#endif
+
+#define SIZECENTRALDIRITEM (0x2e)
+#define SIZEZIPLOCALHEADER (0x1e)
+
+
+/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
+
+#ifndef SEEK_CUR
+#define SEEK_CUR 1
+#endif
+
+#ifndef SEEK_END
+#define SEEK_END 2
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+
+const char unz_copyright[] =
+ " unzip 0.15 Copyright 1998 Gilles Vollant ";
+
+/* unz_file_info_interntal contain internal info about a file in zipfile*/
+typedef struct unz_file_info_internal_s
+{
+ uLong offset_curfile;/* relative offset of local header 4 bytes */
+} unz_file_info_internal;
+
+
+/* file_in_zip_read_info_s contain internal information about a file in zipfile,
+ when reading and decompress it */
+typedef struct
+{
+ char *read_buffer; /* internal buffer for compressed data */
+ z_stream stream; /* zLib stream structure for inflate */
+
+ uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/
+ uLong stream_initialised; /* flag set if stream structure is initialised*/
+
+ uLong offset_local_extrafield;/* offset of the local extra field */
+ uInt size_local_extrafield;/* size of the local extra field */
+ uLong pos_local_extrafield; /* position in the local extra field in read*/
+
+ uLong crc32; /* crc32 of all data uncompressed */
+ uLong crc32_wait; /* crc32 we must obtain after decompress all */
+ uLong rest_read_compressed; /* number of byte to be decompressed */
+ uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/
+ FILE* file; /* io structore of the zipfile */
+ uLong compression_method; /* compression method (0==store) */
+ uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+} file_in_zip_read_info_s;
+
+
+/* unz_s contain internal information about the zipfile
+*/
+typedef struct
+{
+ FILE* file; /* io structore of the zipfile */
+ unz_global_info gi; /* public global information */
+ uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+ uLong num_file; /* number of the current file in the zipfile*/
+ uLong pos_in_central_dir; /* pos of the current file in the central dir*/
+ uLong current_file_ok; /* flag about the usability of the current file*/
+ uLong central_pos; /* position of the beginning of the central dir*/
+
+ uLong size_central_dir; /* size of the central directory */
+ uLong offset_central_dir; /* offset of start of central directory with
+ respect to the starting disk number */
+
+ unz_file_info cur_file_info; /* public info about the current file in zip*/
+ unz_file_info_internal cur_file_info_internal; /* private info about it*/
+ file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current
+ file if we are decompressing it */
+} unz_s;
+
+
+/* ===========================================================================
+ Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+ for end of file.
+ IN assertion: the stream s has been sucessfully opened for reading.
+*/
+
+
+local int unzlocal_getByte(fin,pi)
+ FILE *fin;
+ int *pi;
+{
+ unsigned char c;
+ int err = fread(&c, 1, 1, fin);
+ if (err==1)
+ {
+ *pi = (int)c;
+ return UNZ_OK;
+ }
+ else
+ {
+ if (ferror(fin))
+ return UNZ_ERRNO;
+ else
+ return UNZ_EOF;
+ }
+}
+
+
+/* ===========================================================================
+ Reads a long in LSB order from the given gz_stream. Sets
+*/
+local int unzlocal_getShort (fin,pX)
+ FILE* fin;
+ uLong *pX;
+{
+ uLong x ;
+ int i;
+ int err;
+
+ err = unzlocal_getByte(fin,&i);
+ x = (uLong)i;
+
+ if (err==UNZ_OK)
+ err = unzlocal_getByte(fin,&i);
+ x += ((uLong)i)<<8;
+
+ if (err==UNZ_OK)
+ *pX = x;
+ else
+ *pX = 0;
+ return err;
+}
+
+local int unzlocal_getLong (fin,pX)
+ FILE* fin;
+ uLong *pX;
+{
+ uLong x ;
+ int i;
+ int err;
+
+ err = unzlocal_getByte(fin,&i);
+ x = (uLong)i;
+
+ if (err==UNZ_OK)
+ err = unzlocal_getByte(fin,&i);
+ x += ((uLong)i)<<8;
+
+ if (err==UNZ_OK)
+ err = unzlocal_getByte(fin,&i);
+ x += ((uLong)i)<<16;
+
+ if (err==UNZ_OK)
+ err = unzlocal_getByte(fin,&i);
+ x += ((uLong)i)<<24;
+
+ if (err==UNZ_OK)
+ *pX = x;
+ else
+ *pX = 0;
+ return err;
+}
+
+
+/* My own strcmpi / strcasecmp */
+local int strcmpcasenosensitive_internal (fileName1,fileName2)
+ const char* fileName1;
+ const char* fileName2;
+{
+ for (;;)
+ {
+ char c1=*(fileName1++);
+ char c2=*(fileName2++);
+ if ((c1>='a') && (c1<='z'))
+ c1 -= 0x20;
+ if ((c2>='a') && (c2<='z'))
+ c2 -= 0x20;
+ if (c1=='\0')
+ return ((c2=='\0') ? 0 : -1);
+ if (c2=='\0')
+ return 1;
+ if (c1<c2)
+ return -1;
+ if (c1>c2)
+ return 1;
+ }
+}
+
+
+#ifdef CASESENSITIVITYDEFAULT_NO
+#define CASESENSITIVITYDEFAULTVALUE 2
+#else
+#define CASESENSITIVITYDEFAULTVALUE 1
+#endif
+
+#ifndef STRCMPCASENOSENTIVEFUNCTION
+#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
+#endif
+
+/*
+ Compare two filename (fileName1,fileName2).
+ If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+ If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+ or strcasecmp)
+ If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
+ (like 1 on Unix, 2 on Windows)
+
+*/
+extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
+ const char* fileName1;
+ const char* fileName2;
+ int iCaseSensitivity;
+{
+ if (iCaseSensitivity==0)
+ iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
+
+ if (iCaseSensitivity==1)
+ return strcmp(fileName1,fileName2);
+
+ return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
+}
+
+#define BUFREADCOMMENT (0x400)
+
+/*
+ Locate the Central directory of a zipfile (at the end, just before
+ the global comment)
+*/
+local uLong unzlocal_SearchCentralDir(fin)
+ FILE *fin;
+{
+ unsigned char* buf;
+ uLong uSizeFile;
+ uLong uBackRead;
+ uLong uMaxBack=0xffff; /* maximum size of global comment */
+ uLong uPosFound=0;
+
+ if (fseek(fin,0,SEEK_END) != 0)
+ return 0;
+
+
+ uSizeFile = ftell( fin );
+
+ if (uMaxBack>uSizeFile)
+ uMaxBack = uSizeFile;
+
+ buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
+ if (buf==NULL)
+ return 0;
+
+ uBackRead = 4;
+ while (uBackRead<uMaxBack)
+ {
+ uLong uReadSize,uReadPos ;
+ int i;
+ if (uBackRead+BUFREADCOMMENT>uMaxBack)
+ uBackRead = uMaxBack;
+ else
+ uBackRead+=BUFREADCOMMENT;
+ uReadPos = uSizeFile-uBackRead ;
+
+ uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
+ (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
+ if (fseek(fin,uReadPos,SEEK_SET)!=0)
+ break;
+
+ if (fread(buf,(uInt)uReadSize,1,fin)!=1)
+ break;
+
+ for (i=(int)uReadSize-3; (i--)>0;)
+ if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
+ ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
+ {
+ uPosFound = uReadPos+i;
+ break;
+ }
+
+ if (uPosFound!=0)
+ break;
+ }
+ TRYFREE(buf);
+ return uPosFound;
+}
+
+/*
+ Open a Zip file. path contain the full pathname (by example,
+ on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer
+ "zlib/zlib109.zip".
+ If the zipfile cannot be opened (file don't exist or in not valid), the
+ return value is NULL.
+ Else, the return value is a unzFile Handle, usable with other function
+ of this unzip package.
+*/
+extern unzFile ZEXPORT unzOpen (path)
+ const char *path;
+{
+ unz_s us;
+ unz_s *s;
+ uLong central_pos,uL;
+ FILE * fin ;
+
+ uLong number_disk; /* number of the current dist, used for
+ spaning ZIP, unsupported, always 0*/
+ uLong number_disk_with_CD; /* number the the disk with central dir, used
+ for spaning ZIP, unsupported, always 0*/
+ uLong number_entry_CD; /* total number of entries in
+ the central dir
+ (same than number_entry on nospan) */
+
+ int err=UNZ_OK;
+
+ if (unz_copyright[0]!=' ')
+ return NULL;
+
+ fin=fopen(path,"rb");
+ if (fin==NULL)
+ return NULL;
+
+ central_pos = unzlocal_SearchCentralDir(fin);
+ if (central_pos==0)
+ err=UNZ_ERRNO;
+
+ if (fseek(fin,central_pos,SEEK_SET)!=0)
+ err=UNZ_ERRNO;
+
+ /* the signature, already checked */
+ if (unzlocal_getLong(fin,&uL)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* number of this disk */
+ if (unzlocal_getShort(fin,&number_disk)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* number of the disk with the start of the central directory */
+ if (unzlocal_getShort(fin,&number_disk_with_CD)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* total number of entries in the central dir on this disk */
+ if (unzlocal_getShort(fin,&us.gi.number_entry)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* total number of entries in the central dir */
+ if (unzlocal_getShort(fin,&number_entry_CD)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if ((number_entry_CD!=us.gi.number_entry) ||
+ (number_disk_with_CD!=0) ||
+ (number_disk!=0))
+ err=UNZ_BADZIPFILE;
+
+ /* size of the central directory */
+ if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* offset of start of central directory with respect to the
+ starting disk number */
+ if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ /* zipfile comment length */
+ if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
+ (err==UNZ_OK))
+ err=UNZ_BADZIPFILE;
+
+ if (err!=UNZ_OK)
+ {
+ fclose(fin);
+ return NULL;
+ }
+
+ us.file=fin;
+ us.byte_before_the_zipfile = central_pos -
+ (us.offset_central_dir+us.size_central_dir);
+ us.central_pos = central_pos;
+ us.pfile_in_zip_read = NULL;
+
+
+ s=(unz_s*)ALLOC(sizeof(unz_s));
+ *s=us;
+ unzGoToFirstFile((unzFile)s);
+ return (unzFile)s;
+}
+
+
+/*
+ Close a ZipFile opened with unzipOpen.
+ If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
+ these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ return UNZ_OK if there is no problem. */
+extern int ZEXPORT unzClose (file)
+ unzFile file;
+{
+ unz_s* s;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+
+ if (s->pfile_in_zip_read!=NULL)
+ unzCloseCurrentFile(file);
+
+ fclose(s->file);
+ TRYFREE(s);
+ return UNZ_OK;
+}
+
+
+/*
+ Write info about the ZipFile in the *pglobal_info structure.
+ No preparation of the structure is needed
+ return UNZ_OK if there is no problem. */
+extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
+ unzFile file;
+ unz_global_info *pglobal_info;
+{
+ unz_s* s;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ *pglobal_info=s->gi;
+ return UNZ_OK;
+}
+
+
+/*
+ Translate date/time from Dos format to tm_unz (readable more easilty)
+*/
+local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
+ uLong ulDosDate;
+ tm_unz* ptm;
+{
+ uLong uDate;
+ uDate = (uLong)(ulDosDate>>16);
+ ptm->tm_mday = (uInt)(uDate&0x1f) ;
+ ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ;
+ ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;
+
+ ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);
+ ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ;
+ ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ;
+}
+
+/*
+ Get Info about the current file in the zipfile, with internal only info
+*/
+local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
+ unz_file_info *pfile_info,
+ unz_file_info_internal
+ *pfile_info_internal,
+ char *szFileName,
+ uLong fileNameBufferSize,
+ void *extraField,
+ uLong extraFieldBufferSize,
+ char *szComment,
+ uLong commentBufferSize));
+
+local int unzlocal_GetCurrentFileInfoInternal (file,
+ pfile_info,
+ pfile_info_internal,
+ szFileName, fileNameBufferSize,
+ extraField, extraFieldBufferSize,
+ szComment, commentBufferSize)
+ unzFile file;
+ unz_file_info *pfile_info;
+ unz_file_info_internal *pfile_info_internal;
+ char *szFileName;
+ uLong fileNameBufferSize;
+ void *extraField;
+ uLong extraFieldBufferSize;
+ char *szComment;
+ uLong commentBufferSize;
+{
+ unz_s* s;
+ unz_file_info file_info;
+ unz_file_info_internal file_info_internal;
+ int err=UNZ_OK;
+ uLong uMagic;
+ long lSeek=0;
+
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ if (fseek(s->file,s->pos_in_central_dir+s->byte_before_the_zipfile,SEEK_SET)!=0)
+ err=UNZ_ERRNO;
+
+
+ /* we check the magic */
+ if (err==UNZ_OK)
+ if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
+ err=UNZ_ERRNO;
+ else if (uMagic!=0x02014b50)
+ err=UNZ_BADZIPFILE;
+
+ if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(s->file,&file_info.version_needed) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(s->file,&file_info.flag) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(s->file,&file_info.compression_method) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(s->file,&file_info.dosDate) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date);
+
+ if (unzlocal_getLong(s->file,&file_info.crc) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(s->file,&file_info.compressed_size) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(s->file,&file_info.uncompressed_size) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(s->file,&file_info.size_filename) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(s->file,&file_info.size_file_extra) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(s->file,&file_info.size_file_comment) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(s->file,&file_info.disk_num_start) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(s->file,&file_info.internal_fa) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(s->file,&file_info.external_fa) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ lSeek+=file_info.size_filename;
+ if ((err==UNZ_OK) && (szFileName!=NULL))
+ {
+ uLong uSizeRead ;
+ if (file_info.size_filename<fileNameBufferSize)
+ {
+ *(szFileName+file_info.size_filename)='\0';
+ uSizeRead = file_info.size_filename;
+ }
+ else
+ uSizeRead = fileNameBufferSize;
+
+ if ((file_info.size_filename>0) && (fileNameBufferSize>0))
+ if (fread(szFileName,(uInt)uSizeRead,1,s->file)!=1)
+ err=UNZ_ERRNO;
+ lSeek -= uSizeRead;
+ }
+
+
+ if ((err==UNZ_OK) && (extraField!=NULL))
+ {
+ uLong uSizeRead ;
+ if (file_info.size_file_extra<extraFieldBufferSize)
+ uSizeRead = file_info.size_file_extra;
+ else
+ uSizeRead = extraFieldBufferSize;
+
+ if (lSeek!=0)
+ if (fseek(s->file,lSeek,SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
+ if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1)
+ err=UNZ_ERRNO;
+ lSeek += file_info.size_file_extra - uSizeRead;
+ }
+ else
+ lSeek+=file_info.size_file_extra;
+
+
+ if ((err==UNZ_OK) && (szComment!=NULL))
+ {
+ uLong uSizeRead ;
+ if (file_info.size_file_comment<commentBufferSize)
+ {
+ *(szComment+file_info.size_file_comment)='\0';
+ uSizeRead = file_info.size_file_comment;
+ }
+ else
+ uSizeRead = commentBufferSize;
+
+ if (lSeek!=0)
+ if (fseek(s->file,lSeek,SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ if ((file_info.size_file_comment>0) && (commentBufferSize>0))
+ if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1)
+ err=UNZ_ERRNO;
+ lSeek+=file_info.size_file_comment - uSizeRead;
+ }
+ else
+ lSeek+=file_info.size_file_comment;
+
+ if ((err==UNZ_OK) && (pfile_info!=NULL))
+ *pfile_info=file_info;
+
+ if ((err==UNZ_OK) && (pfile_info_internal!=NULL))
+ *pfile_info_internal=file_info_internal;
+
+ return err;
+}
+
+
+
+/*
+ Write info about the ZipFile in the *pglobal_info structure.
+ No preparation of the structure is needed
+ return UNZ_OK if there is no problem.
+*/
+extern int ZEXPORT unzGetCurrentFileInfo (file,
+ pfile_info,
+ szFileName, fileNameBufferSize,
+ extraField, extraFieldBufferSize,
+ szComment, commentBufferSize)
+ unzFile file;
+ unz_file_info *pfile_info;
+ char *szFileName;
+ uLong fileNameBufferSize;
+ void *extraField;
+ uLong extraFieldBufferSize;
+ char *szComment;
+ uLong commentBufferSize;
+{
+ return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
+ szFileName,fileNameBufferSize,
+ extraField,extraFieldBufferSize,
+ szComment,commentBufferSize);
+}
+
+/*
+ Set the current file of the zipfile to the first file.
+ return UNZ_OK if there is no problem
+*/
+extern int ZEXPORT unzGoToFirstFile (file)
+ unzFile file;
+{
+ int err=UNZ_OK;
+ unz_s* s;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ s->pos_in_central_dir=s->offset_central_dir;
+ s->num_file=0;
+ err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+ &s->cur_file_info_internal,
+ NULL,0,NULL,0,NULL,0);
+ s->current_file_ok = (err == UNZ_OK);
+ return err;
+}
+
+
+/*
+ Set the current file of the zipfile to the next file.
+ return UNZ_OK if there is no problem
+ return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+*/
+extern int ZEXPORT unzGoToNextFile (file)
+ unzFile file;
+{
+ unz_s* s;
+ int err;
+
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ if (!s->current_file_ok)
+ return UNZ_END_OF_LIST_OF_FILE;
+ if (s->num_file+1==s->gi.number_entry)
+ return UNZ_END_OF_LIST_OF_FILE;
+
+ s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
+ s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
+ s->num_file++;
+ err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
+ &s->cur_file_info_internal,
+ NULL,0,NULL,0,NULL,0);
+ s->current_file_ok = (err == UNZ_OK);
+ return err;
+}
+
+
+/*
+ Try locate the file szFileName in the zipfile.
+ For the iCaseSensitivity signification, see unzipStringFileNameCompare
+
+ return value :
+ UNZ_OK if the file is found. It becomes the current file.
+ UNZ_END_OF_LIST_OF_FILE if the file is not found
+*/
+extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
+ unzFile file;
+ const char *szFileName;
+ int iCaseSensitivity;
+{
+ unz_s* s;
+ int err;
+
+
+ uLong num_fileSaved;
+ uLong pos_in_central_dirSaved;
+
+
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+
+ if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
+ return UNZ_PARAMERROR;
+
+ s=(unz_s*)file;
+ if (!s->current_file_ok)
+ return UNZ_END_OF_LIST_OF_FILE;
+
+ num_fileSaved = s->num_file;
+ pos_in_central_dirSaved = s->pos_in_central_dir;
+
+ err = unzGoToFirstFile(file);
+
+ while (err == UNZ_OK)
+ {
+ char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
+ unzGetCurrentFileInfo(file,NULL,
+ szCurrentFileName,sizeof(szCurrentFileName)-1,
+ NULL,0,NULL,0);
+ if (unzStringFileNameCompare(szCurrentFileName,
+ szFileName,iCaseSensitivity)==0)
+ return UNZ_OK;
+ err = unzGoToNextFile(file);
+ }
+
+ s->num_file = num_fileSaved ;
+ s->pos_in_central_dir = pos_in_central_dirSaved ;
+ return err;
+}
+
+
+/*
+ Read the local header of the current zipfile
+ Check the coherency of the local header and info in the end of central
+ directory about this file
+ store in *piSizeVar the size of extra info in local header
+ (filename and size of extra field data)
+*/
+local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
+ poffset_local_extrafield,
+ psize_local_extrafield)
+ unz_s* s;
+ uInt* piSizeVar;
+ uLong *poffset_local_extrafield;
+ uInt *psize_local_extrafield;
+{
+ uLong uMagic,uData,uFlags;
+ uLong size_filename;
+ uLong size_extra_field;
+ int err=UNZ_OK;
+
+ *piSizeVar = 0;
+ *poffset_local_extrafield = 0;
+ *psize_local_extrafield = 0;
+
+ if (fseek(s->file,s->cur_file_info_internal.offset_curfile +
+ s->byte_before_the_zipfile,SEEK_SET)!=0)
+ return UNZ_ERRNO;
+
+
+ if (err==UNZ_OK)
+ if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
+ err=UNZ_ERRNO;
+ else if (uMagic!=0x04034b50)
+ err=UNZ_BADZIPFILE;
+
+ if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
+ err=UNZ_ERRNO;
+/*
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
+ err=UNZ_BADZIPFILE;
+*/
+ if (unzlocal_getShort(s->file,&uFlags) != UNZ_OK)
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
+ err=UNZ_BADZIPFILE;
+
+ if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
+ (s->cur_file_info.compression_method!=Z_DEFLATED))
+ err=UNZ_BADZIPFILE;
+
+ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */
+ err=UNZ_ERRNO;
+
+ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) &&
+ ((uFlags & 8)==0))
+ err=UNZ_BADZIPFILE;
+
+ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) &&
+ ((uFlags & 8)==0))
+ err=UNZ_BADZIPFILE;
+
+ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
+ ((uFlags & 8)==0))
+ err=UNZ_BADZIPFILE;
+
+
+ if (unzlocal_getShort(s->file,&size_filename) != UNZ_OK)
+ err=UNZ_ERRNO;
+ else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
+ err=UNZ_BADZIPFILE;
+
+ *piSizeVar += (uInt)size_filename;
+
+ if (unzlocal_getShort(s->file,&size_extra_field) != UNZ_OK)
+ err=UNZ_ERRNO;
+ *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
+ SIZEZIPLOCALHEADER + size_filename;
+ *psize_local_extrafield = (uInt)size_extra_field;
+
+ *piSizeVar += (uInt)size_extra_field;
+
+ return err;
+}
+
+/*
+ Open for reading data the current file in the zipfile.
+ If there is no error and the file is opened, the return value is UNZ_OK.
+*/
+extern int ZEXPORT unzOpenCurrentFile (file)
+ unzFile file;
+{
+ int err=UNZ_OK;
+ int Store;
+ uInt iSizeVar;
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ uLong offset_local_extrafield; /* offset of the local extra field */
+ uInt size_local_extrafield; /* size of the local extra field */
+
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ if (!s->current_file_ok)
+ return UNZ_PARAMERROR;
+
+ if (s->pfile_in_zip_read != NULL)
+ unzCloseCurrentFile(file);
+
+ if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
+ &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
+ return UNZ_BADZIPFILE;
+
+ pfile_in_zip_read_info = (file_in_zip_read_info_s*)
+ ALLOC(sizeof(file_in_zip_read_info_s));
+ if (pfile_in_zip_read_info==NULL)
+ return UNZ_INTERNALERROR;
+
+ pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
+ pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
+ pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
+ pfile_in_zip_read_info->pos_local_extrafield=0;
+
+ if (pfile_in_zip_read_info->read_buffer==NULL)
+ {
+ TRYFREE(pfile_in_zip_read_info);
+ return UNZ_INTERNALERROR;
+ }
+
+ pfile_in_zip_read_info->stream_initialised=0;
+
+ if ((s->cur_file_info.compression_method!=0) &&
+ (s->cur_file_info.compression_method!=Z_DEFLATED))
+ err=UNZ_BADZIPFILE;
+ Store = s->cur_file_info.compression_method==0;
+
+ pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
+ pfile_in_zip_read_info->crc32=0;
+ pfile_in_zip_read_info->compression_method =
+ s->cur_file_info.compression_method;
+ pfile_in_zip_read_info->file=s->file;
+ pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
+
+ pfile_in_zip_read_info->stream.total_out = 0;
+
+ if (!Store)
+ {
+ pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
+ pfile_in_zip_read_info->stream.zfree = (free_func)0;
+ pfile_in_zip_read_info->stream.opaque = (voidpf)0;
+
+ err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
+ if (err == Z_OK)
+ pfile_in_zip_read_info->stream_initialised=1;
+ /* windowBits is passed < 0 to tell that there is no zlib header.
+ * Note that in this case inflate *requires* an extra "dummy" byte
+ * after the compressed stream in order to complete decompression and
+ * return Z_STREAM_END.
+ * In unzip, i don't wait absolutely Z_STREAM_END because I known the
+ * size of both compressed and uncompressed data
+ */
+ }
+ pfile_in_zip_read_info->rest_read_compressed =
+ s->cur_file_info.compressed_size ;
+ pfile_in_zip_read_info->rest_read_uncompressed =
+ s->cur_file_info.uncompressed_size ;
+
+
+ pfile_in_zip_read_info->pos_in_zipfile =
+ s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
+ iSizeVar;
+
+ pfile_in_zip_read_info->stream.avail_in = (uInt)0;
+
+
+ s->pfile_in_zip_read = pfile_in_zip_read_info;
+ return UNZ_OK;
+}
+
+
+/*
+ Read bytes from the current file.
+ buf contain buffer where data must be copied
+ len the size of buf.
+
+ return the number of byte copied if somes bytes are copied
+ return 0 if the end of file was reached
+ return <0 with error code if there is an error
+ (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+*/
+extern int ZEXPORT unzReadCurrentFile (file, buf, len)
+ unzFile file;
+ voidp buf;
+ unsigned len;
+{
+ int err=UNZ_OK;
+ uInt iRead = 0;
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==NULL)
+ return UNZ_PARAMERROR;
+
+
+ if ((pfile_in_zip_read_info->read_buffer == NULL))
+ return UNZ_END_OF_LIST_OF_FILE;
+ if (len==0)
+ return 0;
+
+ pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
+
+ pfile_in_zip_read_info->stream.avail_out = (uInt)len;
+
+ if (len>pfile_in_zip_read_info->rest_read_uncompressed)
+ pfile_in_zip_read_info->stream.avail_out =
+ (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
+
+ while (pfile_in_zip_read_info->stream.avail_out>0)
+ {
+ if ((pfile_in_zip_read_info->stream.avail_in==0) &&
+ (pfile_in_zip_read_info->rest_read_compressed>0))
+ {
+ uInt uReadThis = UNZ_BUFSIZE;
+ if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
+ uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
+ if (uReadThis == 0)
+ return UNZ_EOF;
+ if (fseek(pfile_in_zip_read_info->file,
+ pfile_in_zip_read_info->pos_in_zipfile +
+ pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0)
+ return UNZ_ERRNO;
+ if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1,
+ pfile_in_zip_read_info->file)!=1)
+ return UNZ_ERRNO;
+ pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
+
+ pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
+
+ pfile_in_zip_read_info->stream.next_in =
+ (Bytef*)pfile_in_zip_read_info->read_buffer;
+ pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
+ }
+
+ if (pfile_in_zip_read_info->compression_method==0)
+ {
+ uInt uDoCopy,i ;
+ if (pfile_in_zip_read_info->stream.avail_out <
+ pfile_in_zip_read_info->stream.avail_in)
+ uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
+ else
+ uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
+
+ for (i=0;i<uDoCopy;i++)
+ *(pfile_in_zip_read_info->stream.next_out+i) =
+ *(pfile_in_zip_read_info->stream.next_in+i);
+
+ pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
+ pfile_in_zip_read_info->stream.next_out,
+ uDoCopy);
+ pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
+ pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
+ pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
+ pfile_in_zip_read_info->stream.next_out += uDoCopy;
+ pfile_in_zip_read_info->stream.next_in += uDoCopy;
+ pfile_in_zip_read_info->stream.total_out += uDoCopy;
+ iRead += uDoCopy;
+ }
+ else
+ {
+ uLong uTotalOutBefore,uTotalOutAfter;
+ const Bytef *bufBefore;
+ uLong uOutThis;
+ int flush=Z_SYNC_FLUSH;
+
+ uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
+ bufBefore = pfile_in_zip_read_info->stream.next_out;
+
+ /*
+ if ((pfile_in_zip_read_info->rest_read_uncompressed ==
+ pfile_in_zip_read_info->stream.avail_out) &&
+ (pfile_in_zip_read_info->rest_read_compressed == 0))
+ flush = Z_FINISH;
+ */
+ err=inflate(&pfile_in_zip_read_info->stream,flush);
+
+ uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
+ uOutThis = uTotalOutAfter-uTotalOutBefore;
+
+ pfile_in_zip_read_info->crc32 =
+ crc32(pfile_in_zip_read_info->crc32,bufBefore,
+ (uInt)(uOutThis));
+
+ pfile_in_zip_read_info->rest_read_uncompressed -=
+ uOutThis;
+
+ iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
+
+ if (err==Z_STREAM_END)
+ return (iRead==0) ? UNZ_EOF : iRead;
+ if (err!=Z_OK)
+ break;
+ }
+ }
+
+ if (err==Z_OK)
+ return iRead;
+ return err;
+}
+
+
+/*
+ Give the current position in uncompressed data
+*/
+extern z_off_t ZEXPORT unztell (file)
+ unzFile file;
+{
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==NULL)
+ return UNZ_PARAMERROR;
+
+ return (z_off_t)pfile_in_zip_read_info->stream.total_out;
+}
+
+
+/*
+ return 1 if the end of file was reached, 0 elsewhere
+*/
+extern int ZEXPORT unzeof (file)
+ unzFile file;
+{
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==NULL)
+ return UNZ_PARAMERROR;
+
+ if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
+ return 1;
+ else
+ return 0;
+}
+
+
+
+/*
+ Read extra field from the current file (opened by unzOpenCurrentFile)
+ This is the local-header version of the extra field (sometimes, there is
+ more info in the local-header version than in the central-header)
+
+ if buf==NULL, it return the size of the local extra field that can be read
+
+ if buf!=NULL, len is the size of the buffer, the extra header is copied in
+ buf.
+ the return value is the number of bytes copied in buf, or (if <0)
+ the error code
+*/
+extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
+ unzFile file;
+ voidp buf;
+ unsigned len;
+{
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ uInt read_now;
+ uLong size_to_read;
+
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==NULL)
+ return UNZ_PARAMERROR;
+
+ size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
+ pfile_in_zip_read_info->pos_local_extrafield);
+
+ if (buf==NULL)
+ return (int)size_to_read;
+
+ if (len>size_to_read)
+ read_now = (uInt)size_to_read;
+ else
+ read_now = (uInt)len ;
+
+ if (read_now==0)
+ return 0;
+
+ if (fseek(pfile_in_zip_read_info->file,
+ pfile_in_zip_read_info->offset_local_extrafield +
+ pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0)
+ return UNZ_ERRNO;
+
+ if (fread(buf,(uInt)size_to_read,1,pfile_in_zip_read_info->file)!=1)
+ return UNZ_ERRNO;
+
+ return (int)read_now;
+}
+
+/*
+ Close the file in zip opened with unzipOpenCurrentFile
+ Return UNZ_CRCERROR if all the file was read but the CRC is not good
+*/
+extern int ZEXPORT unzCloseCurrentFile (file)
+ unzFile file;
+{
+ int err=UNZ_OK;
+
+ unz_s* s;
+ file_in_zip_read_info_s* pfile_in_zip_read_info;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==NULL)
+ return UNZ_PARAMERROR;
+
+
+ if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
+ {
+ if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
+ err=UNZ_CRCERROR;
+ }
+
+
+ TRYFREE(pfile_in_zip_read_info->read_buffer);
+ pfile_in_zip_read_info->read_buffer = NULL;
+ if (pfile_in_zip_read_info->stream_initialised)
+ inflateEnd(&pfile_in_zip_read_info->stream);
+
+ pfile_in_zip_read_info->stream_initialised = 0;
+ TRYFREE(pfile_in_zip_read_info);
+
+ s->pfile_in_zip_read=NULL;
+
+ return err;
+}
+
+
+/*
+ Get the global comment string of the ZipFile, in the szComment buffer.
+ uSizeBuf is the size of the szComment buffer.
+ return the number of byte copied or an error code <0
+*/
+extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
+ unzFile file;
+ char *szComment;
+ uLong uSizeBuf;
+{
+ int err=UNZ_OK;
+ unz_s* s;
+ uLong uReadThis ;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz_s*)file;
+
+ uReadThis = uSizeBuf;
+ if (uReadThis>s->gi.size_comment)
+ uReadThis = s->gi.size_comment;
+
+ if (fseek(s->file,s->central_pos+22,SEEK_SET)!=0)
+ return UNZ_ERRNO;
+
+ if (uReadThis>0)
+ {
+ *szComment='\0';
+ if (fread(szComment,(uInt)uReadThis,1,s->file)!=1)
+ return UNZ_ERRNO;
+ }
+
+ if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
+ *(szComment+s->gi.size_comment)='\0';
+ return (int)uReadThis;
+}
--- /dev/null
+/* unzip.h -- IO for uncompress .zip files using zlib
+ Version 0.15 beta, Mar 19th, 1998,
+
+ Copyright (C) 1998 Gilles Vollant
+
+ This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
+ WinZip, InfoZip tools and compatible.
+ Encryption and multi volume ZipFile (span) are not supported.
+ Old compressions used by old PKZip 1.x are not supported
+
+ THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
+ CAN CHANGE IN FUTURE VERSION !!
+ I WAIT FEEDBACK at mail info@winimage.com
+ Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
+
+ Condition of use and distribution are the same than zlib :
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+
+*/
+/* for more info about .ZIP format, see
+ ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
+ PkWare has also a specification at :
+ ftp://ftp.pkware.com/probdesc.zip */
+
+#ifndef _unz_H
+#define _unz_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
+/* like the STRICT of WIN32, we define a pointer that cannot be converted
+ from (void*) without cast */
+typedef struct TagunzFile__ { int unused; } unzFile__;
+typedef unzFile__ *unzFile;
+#else
+typedef voidp unzFile;
+#endif
+
+
+#define UNZ_OK (0)
+#define UNZ_END_OF_LIST_OF_FILE (-100)
+#define UNZ_ERRNO (Z_ERRNO)
+#define UNZ_EOF (0)
+#define UNZ_PARAMERROR (-102)
+#define UNZ_BADZIPFILE (-103)
+#define UNZ_INTERNALERROR (-104)
+#define UNZ_CRCERROR (-105)
+
+/* tm_unz contain date/time info */
+typedef struct tm_unz_s
+{
+ uInt tm_sec; /* seconds after the minute - [0,59] */
+ uInt tm_min; /* minutes after the hour - [0,59] */
+ uInt tm_hour; /* hours since midnight - [0,23] */
+ uInt tm_mday; /* day of the month - [1,31] */
+ uInt tm_mon; /* months since January - [0,11] */
+ uInt tm_year; /* years - [1980..2044] */
+} tm_unz;
+
+/* unz_global_info structure contain global data about the ZIPfile
+ These data comes from the end of central dir */
+typedef struct unz_global_info_s
+{
+ uLong number_entry; /* total number of entries in
+ the central dir on this disk */
+ uLong size_comment; /* size of the global comment of the zipfile */
+} unz_global_info;
+
+
+/* unz_file_info contain information about a file in the zipfile */
+typedef struct unz_file_info_s
+{
+ uLong version; /* version made by 2 bytes */
+ uLong version_needed; /* version needed to extract 2 bytes */
+ uLong flag; /* general purpose bit flag 2 bytes */
+ uLong compression_method; /* compression method 2 bytes */
+ uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
+ uLong crc; /* crc-32 4 bytes */
+ uLong compressed_size; /* compressed size 4 bytes */
+ uLong uncompressed_size; /* uncompressed size 4 bytes */
+ uLong size_filename; /* filename length 2 bytes */
+ uLong size_file_extra; /* extra field length 2 bytes */
+ uLong size_file_comment; /* file comment length 2 bytes */
+
+ uLong disk_num_start; /* disk number start 2 bytes */
+ uLong internal_fa; /* internal file attributes 2 bytes */
+ uLong external_fa; /* external file attributes 4 bytes */
+
+ tm_unz tmu_date;
+} unz_file_info;
+
+extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
+ const char* fileName2,
+ int iCaseSensitivity));
+/*
+ Compare two filename (fileName1,fileName2).
+ If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+ If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
+ or strcasecmp)
+ If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
+ (like 1 on Unix, 2 on Windows)
+*/
+
+
+extern unzFile ZEXPORT unzOpen OF((const char *path));
+/*
+ Open a Zip file. path contain the full pathname (by example,
+ on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
+ "zlib/zlib111.zip".
+ If the zipfile cannot be opened (file don't exist or in not valid), the
+ return value is NULL.
+ Else, the return value is a unzFile Handle, usable with other function
+ of this unzip package.
+*/
+
+extern int ZEXPORT unzClose OF((unzFile file));
+/*
+ Close a ZipFile opened with unzipOpen.
+ If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
+ these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ return UNZ_OK if there is no problem. */
+
+extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
+ unz_global_info *pglobal_info));
+/*
+ Write info about the ZipFile in the *pglobal_info structure.
+ No preparation of the structure is needed
+ return UNZ_OK if there is no problem. */
+
+
+extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
+ char *szComment,
+ uLong uSizeBuf));
+/*
+ Get the global comment string of the ZipFile, in the szComment buffer.
+ uSizeBuf is the size of the szComment buffer.
+ return the number of byte copied or an error code <0
+*/
+
+
+/***************************************************************************/
+/* Unzip package allow you browse the directory of the zipfile */
+
+extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
+/*
+ Set the current file of the zipfile to the first file.
+ return UNZ_OK if there is no problem
+*/
+
+extern int ZEXPORT unzGoToNextFile OF((unzFile file));
+/*
+ Set the current file of the zipfile to the next file.
+ return UNZ_OK if there is no problem
+ return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+*/
+
+extern int ZEXPORT unzLocateFile OF((unzFile file,
+ const char *szFileName,
+ int iCaseSensitivity));
+/*
+ Try locate the file szFileName in the zipfile.
+ For the iCaseSensitivity signification, see unzStringFileNameCompare
+
+ return value :
+ UNZ_OK if the file is found. It becomes the current file.
+ UNZ_END_OF_LIST_OF_FILE if the file is not found
+*/
+
+
+extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
+ unz_file_info *pfile_info,
+ char *szFileName,
+ uLong fileNameBufferSize,
+ void *extraField,
+ uLong extraFieldBufferSize,
+ char *szComment,
+ uLong commentBufferSize));
+/*
+ Get Info about the current file
+ if pfile_info!=NULL, the *pfile_info structure will contain somes info about
+ the current file
+ if szFileName!=NULL, the filemane string will be copied in szFileName
+ (fileNameBufferSize is the size of the buffer)
+ if extraField!=NULL, the extra field information will be copied in extraField
+ (extraFieldBufferSize is the size of the buffer).
+ This is the Central-header version of the extra field
+ if szComment!=NULL, the comment string of the file will be copied in szComment
+ (commentBufferSize is the size of the buffer)
+*/
+
+/***************************************************************************/
+/* for reading the content of the current zipfile, you can open it, read data
+ from it, and close it (you can close it before reading all the file)
+ */
+
+extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
+/*
+ Open for reading data the current file in the zipfile.
+ If there is no error, the return value is UNZ_OK.
+*/
+
+extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
+/*
+ Close the file in zip opened with unzOpenCurrentFile
+ Return UNZ_CRCERROR if all the file was read but the CRC is not good
+*/
+
+
+extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
+ voidp buf,
+ unsigned len));
+/*
+ Read bytes from the current file (opened by unzOpenCurrentFile)
+ buf contain buffer where data must be copied
+ len the size of buf.
+
+ return the number of byte copied if somes bytes are copied
+ return 0 if the end of file was reached
+ return <0 with error code if there is an error
+ (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+*/
+
+extern z_off_t ZEXPORT unztell OF((unzFile file));
+/*
+ Give the current position in uncompressed data
+*/
+
+extern int ZEXPORT unzeof OF((unzFile file));
+/*
+ return 1 if the end of file was reached, 0 elsewhere
+*/
+
+extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
+ voidp buf,
+ unsigned len));
+/*
+ Read extra field from the current file (opened by unzOpenCurrentFile)
+ This is the local-header version of the extra field (sometimes, there is
+ more info in the local-header version than in the central-header)
+
+ if buf==NULL, it return the size of the local extra field
+
+ if buf!=NULL, len is the size of the buffer, the extra header is copied in
+ buf.
+ the return value is the number of bytes copied in buf, or (if <0)
+ the error code
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _unz_H */
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: zipstream.cpp
+// Purpose: input stream for ZIP archive access
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/stream.h>
+#include <wx/wfstream.h>
+#include <wx/zipstream.h>
+#include "unzip.h"
+
+
+
+
+wxZipInputStream::wxZipInputStream(const wxString& archive, const wxString& file) : wxInputStream()
+{
+ unz_file_info zinfo;
+
+ m_Pos = 0;
+ m_Size = 0;
+ m_Archive = (void*) unzOpen(archive);
+ if (m_Archive == NULL) {
+ m_lasterror = wxStream_READ_ERR;
+ return;
+ }
+ if (unzLocateFile((unzFile)m_Archive, file, 0) != UNZ_OK) {
+ m_lasterror = wxStream_READ_ERR;
+ return;
+ }
+ unzGetCurrentFileInfo((unzFile)m_Archive, &zinfo, NULL, 0, NULL, 0, NULL, 0);
+
+ if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK) {
+ m_lasterror = wxStream_READ_ERR;
+ return;
+ }
+ m_Size = zinfo.uncompressed_size;
+}
+
+
+
+wxZipInputStream::~wxZipInputStream()
+{
+ if (m_Archive) {
+ if (m_Size != 0)
+ unzCloseCurrentFile((unzFile)m_Archive);
+ unzClose((unzFile)m_Archive);
+ }
+}
+
+
+
+size_t wxZipInputStream::OnSysRead(void *buffer, size_t bufsize)
+{
+ if (m_Pos + bufsize > m_Size) bufsize = m_Size - m_Pos;
+ unzReadCurrentFile((unzFile)m_Archive, buffer, bufsize);
+ m_Pos += bufsize;
+ return bufsize;
+}
+
+
+
+off_t wxZipInputStream::OnSysSeek(off_t seek, wxSeekMode mode)
+{
+ off_t nextpos;
+ void *buf;
+
+ switch (mode) {
+ case wxFromCurrent : nextpos = seek + m_Pos; break;
+ case wxFromStart : nextpos = seek; break;
+ case wxFromEnd : nextpos = m_Size - 1 + seek; break;
+ default : nextpos = m_Pos; break; /* just to fool compiler, never happens */
+ }
+
+ // cheated seeking :
+ if (nextpos > m_Pos) {
+ buf = malloc(nextpos - m_Pos);
+ unzReadCurrentFile((unzFile)m_Archive, buf, nextpos - m_Pos);
+ free(buf);
+ }
+ else if (nextpos < m_Pos) {
+ unzCloseCurrentFile((unzFile)m_Archive);
+ if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK) {
+ m_lasterror = wxStream_READ_ERR;
+ return m_Pos;
+ }
+ buf = malloc(nextpos);
+ unzReadCurrentFile((unzFile)m_Archive, buf, nextpos);
+ free(buf);
+ }
+
+ m_Pos = nextpos;
+ return m_Pos;
+}
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: busyinfo.cpp
+// Purpose: Information window when app is busy
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include "wx/busyinfo.h"
+
+
+
+
+
+wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message)
+ : wxFrame(parent, -1, "", wxPoint(0, 0), wxSize(400, 80), wxTHICK_FRAME | wxSIMPLE_BORDER | wxFRAME_TOOL_WINDOW)
+{
+ wxPanel *p = new wxPanel(this);
+ wxStaticText *s = new wxStaticText(p, -1, message, wxPoint(20, 20), wxSize(360, 40), wxALIGN_CENTER);
+ Centre(wxBOTH);
+ p -> SetCursor(*wxHOURGLASS_CURSOR);
+ s -> SetCursor(*wxHOURGLASS_CURSOR);
+}
+
+
+
+
+wxBusyInfo::wxBusyInfo(const wxString& message) : wxObject()
+{
+ m_InfoFrame = new wxInfoFrame(NULL, message);
+ m_InfoFrame -> Show(TRUE);
+ wxYield();
+ m_InfoFrame -> Refresh();
+ wxYield();
+}
+
+
+
+wxBusyInfo::~wxBusyInfo()
+{
+ m_InfoFrame -> Show(FALSE);
+ m_InfoFrame -> Close();
+ wxYield();
+}
+
+
+
+
+
+
+
+
+
+
+
DEFS = $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
LIBS = $(GUILIBS)
-VPATH = .:${srcdir}:${srcdir}/../common:${srcdir}/../generic:${EXTRA_VPATH}
+VPATH = .:${srcdir}:${srcdir}/../common:${srcdir}/../generic:${srcdir}/../html:${EXTRA_VPATH}
lib_LTLIBRARIES = @WX_LIBRARY_NAME@
EXTRA_LTLIBRARIES = libwx_gtk.la libwx_motif.la libwx_msw.la
file.cpp \
fileconf.cpp \
filefn.cpp \
+ filesys.cpp \
framecmn.cpp \
+ fs_inet.cpp \
+ fs_zip.cpp \
ftp.cpp \
gdicmn.cpp \
hash.cpp \
time.cpp \
timercmn.cpp \
tokenzr.cpp \
+ unzip.c \
url.cpp \
utilscmn.cpp \
valgen.cpp \
wxchar.cpp \
wxexpr.cpp \
zstream.cpp \
+ zipstream.cpp \
\
db.cpp \
dbtable.cpp \
\
+ busyinfo.cpp \
caret.cpp \
colrdlgg.cpp \
dcpsg.cpp \
utilsgtk.cpp \
utilsres.cpp \
wave.cpp \
- window.cpp
+ window.cpp \
+\
+ htmlcell.cpp \
+ htmlfilter.cpp \
+ htmlhelp.cpp \
+ htmlhelp_io.cpp \
+ htmlparser.cpp \
+ htmltag.cpp \
+ htmlwin.cpp \
+ htmlwinparser.cpp \
+ mod_fonts.cpp \
+ mod_hline.cpp \
+ mod_image.cpp \
+ mod_layout.cpp \
+ mod_links.cpp \
+ mod_list.cpp \
+ mod_pre.cpp \
+ mod_tables.cpp \
+ search.cpp
+
# these are the sources which we build by our own rules
#
DEFS = $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
LIBS = $(GUILIBS)
-VPATH = .:${srcdir}:${srcdir}/../common:${srcdir}/../generic:${EXTRA_VPATH}
+VPATH = .:${srcdir}:${srcdir}/../common:${srcdir}/../generic:${srcdir}/../html:${EXTRA_VPATH}
lib_LTLIBRARIES = @WX_LIBRARY_NAME@
EXTRA_LTLIBRARIES = libwx_gtk.la libwx_motif.la libwx_msw.la
file.cpp \
fileconf.cpp \
filefn.cpp \
+ filesys.cpp \
framecmn.cpp \
+ fs_inet.cpp \
+ fs_zip.cpp \
ftp.cpp \
gdicmn.cpp \
hash.cpp \
time.cpp \
timercmn.cpp \
tokenzr.cpp \
+ unzip.c \
url.cpp \
utilscmn.cpp \
valgen.cpp \
wxchar.cpp \
wxexpr.cpp \
zstream.cpp \
+ zipstream.cpp \
\
db.cpp \
dbtable.cpp \
\
+ busyinfo.cpp \
caret.cpp \
colrdlgg.cpp \
dcpsg.cpp \
utilsgtk.cpp \
utilsres.cpp \
wave.cpp \
- window.cpp
+ window.cpp \
+\
+ htmlcell.cpp \
+ htmlfilter.cpp \
+ htmlhelp.cpp \
+ htmlhelp_io.cpp \
+ htmlparser.cpp \
+ htmltag.cpp \
+ htmlwin.cpp \
+ htmlwinparser.cpp \
+ mod_fonts.cpp \
+ mod_hline.cpp \
+ mod_image.cpp \
+ mod_layout.cpp \
+ mod_links.cpp \
+ mod_list.cpp \
+ mod_pre.cpp \
+ mod_tables.cpp \
+ search.cpp
+
# these are the sources which we build by our own rules
#
--- /dev/null
+/* XPM */
+static char * back_xpm[] = {
+"16 16 5 1",
+" c None",
+". c #000000",
+"+ c #C0E4CB",
+"@ c #77C490",
+"# c #808080",
+" ",
+" ",
+" . ",
+" .. ",
+" .+. ",
+" .++........ ",
+" .++@+++++++. ",
+" .++@@@@@@@@@. ",
+" .+@@@@@@@@@. ",
+" #.+@........ ",
+" #.+.####### ",
+" #..# ",
+" #.# ",
+" ## ",
+" # ",
+" "};
--- /dev/null
+/* XPM */
+static char * book_xpm[] = {
+"16 16 21 1",
+" c None",
+". c #007F7F",
+"+ c #660000",
+"@ c #CC0000",
+"# c #E50000",
+"$ c #FF0000",
+"% c #F20000",
+"& c #D80000",
+"* c #720000",
+"= c #7F0000",
+"- c #BFBFBF",
+"; c #E57F7F",
+"> c #7F7F7F",
+", c #FFFFFF",
+"' c #F2BFBF",
+") c #723F3F",
+"! c #A5A5A5",
+"~ c #E5E5E5",
+"{ c #B2B2B2",
+"] c #003F3F",
+"^ c #000000",
+" ",
+" ......... ",
+" +@#$$$$$%&+ ",
+" +##$$$$$$$* ",
+" +##$$$$$$$=- ",
+" +##$$$$$$$=;> ",
+" +##$$$$$$$=;,. ",
+" +##$$$$$$$=;,. ",
+" +##$$$$$$$=''. ",
+" +##$$$$$$$=,;. ",
+" +##$$$$$$%+,;. ",
+" +&++++++++),;. ",
+" ++!~~~~~~~~~,. ",
+" ++!~~~~~~~~~{. ",
+" ]^^^^^^^^^^^ ",
+" "};
--- /dev/null
+/* XPM */
+static char * folder_xpm[] = {
+"16 16 31 1",
+" c None",
+". c #000000",
+"+ c #7F6E54",
+"@ c #555555",
+"# c #7F6140",
+"$ c #FFCF94",
+"% c #FFFFFF",
+"& c #D5D5D5",
+"* c #4B4336",
+"= c #FFDCA8",
+"- c #BFA57E",
+"; c #EFEFEF",
+"> c #DFDFDF",
+", c #B8B8B9",
+"' c #6E6E6F",
+") c #BF7E42",
+"! c #FFA858",
+"~ c #FFC280",
+"{ c #CFCFCF",
+"] c #55402C",
+"^ c #3C2C2C",
+"/ c #7F542C",
+"( c #C0C0C0",
+"_ c #B0B0B2",
+": c #969698",
+"< c #A8A8AB",
+"[ c #A0A0A4",
+"} c #2C2C2C",
+"| c #7C7C7E",
+"1 c #161616",
+"2 c #3F2A16",
+" .+. ",
+".@#$+. ",
+".%&@#$+.+* ",
+".%%%&@#$==-. ",
+".%%;>,')!~$+ ",
+".%;>{{,']^/~. ",
+".;>{{((,,_:]/ ",
+".>{{((,,_<[}/ ",
+".{{((,,_<[[^/ ",
+"._((,,_<[[[}/ ",
+" }|_,_<[[[[}/ ",
+" .}|<[[[[[}/ ",
+" .}|[[[[}/ ",
+" .}|[[}/.. ",
+" .}|}/.. ",
+" .12. "};
--- /dev/null
+/* XPM */
+static char * forward_xpm[] = {
+"16 16 5 1",
+" c None",
+". c #000000",
+"+ c #C0E4CB",
+"@ c #77C490",
+"# c #808080",
+" ",
+" ",
+" . ",
+" .. ",
+" .+. ",
+" ........++. ",
+" .+++++++@++. ",
+" .@@@@@@@@@++. ",
+" .@@@@@@@@@+. ",
+" ........@+.# ",
+" #######.+.# ",
+" #..# ",
+" #.# ",
+" ## ",
+" # ",
+" "};
--- /dev/null
+/* XPM */
+static char * page_xpm[] = {
+/* width height ncolors chars_per_pixel */
+"16 16 3 1",
+/* colors */
+" s None c None",
+". c #000000",
+"+ c #ffffff",
+/* pixels */
+" ",
+" ........ ",
+" .++++++.. ",
+" .+.+.++.+. ",
+" .++++++.... ",
+" .+.+.+++++. ",
+" .+++++++++. ",
+" .+.+.+.+.+. ",
+" .+++++++++. ",
+" .+.+.+.+.+. ",
+" .+++++++++. ",
+" .+.+.+.+.+. ",
+" .+++++++++. ",
+" ........... ",
+" ",
+" "};
--- /dev/null
+/* XPM */
+static char * panel_xpm[] = {
+"16 15 104 2",
+" c None",
+". c #7F7C7C",
+"+ c #8A8E8E",
+"@ c #D03232",
+"# c #BA7E7E",
+"$ c #555858",
+"% c #5F5F5F",
+"& c #656565",
+"* c #5D5D5D",
+"= c #939696",
+"- c #FFFFFF",
+"; c #F4C8C8",
+"> c #DCDCF4",
+", c #D3D3D3",
+"' c #4E5151",
+") c #7E7E7E",
+"! c #9E9E9E",
+"~ c #A7A7A7",
+"{ c #5C5C5C",
+"] c #9B9E9E",
+"^ c #A3A3FF",
+"/ c #BBBBFF",
+"( c #DBDBDB",
+"_ c #808B8B",
+": c #5E5E5E",
+"< c #858571",
+"[ c #AEAE4B",
+"} c #90902D",
+"| c #8B8B8B",
+"1 c #000027",
+"2 c #D7D7FF",
+"3 c #C3C3FF",
+"4 c #A7A7FF",
+"5 c #9B9BFF",
+"6 c #D7D7D7",
+"7 c #717474",
+"8 c #727D7D",
+"9 c #575721",
+"0 c #BFBF7F",
+"a c #DFDF8F",
+"b c #DFDF60",
+"c c #7F7F3B",
+"d c #2F2F7F",
+"e c #AFAFF3",
+"f c #E7E7E7",
+"g c #9797E7",
+"h c #8787F3",
+"i c #AFAFC3",
+"j c #4F4F37",
+"k c #8E9898",
+"l c #484824",
+"m c #4D4D0B",
+"n c #8C8C8C",
+"o c #7D7D36",
+"p c #74742D",
+"q c #535353",
+"r c #636363",
+"s c #5C5C4C",
+"t c #818149",
+"u c #78784C",
+"v c #787840",
+"w c #7E7E40",
+"x c #787E46",
+"y c #757F7F",
+"z c #616121",
+"A c #87874B",
+"B c #C8C88C",
+"C c #F6F6B6",
+"D c #D4D498",
+"E c #6C6C30",
+"F c #424242",
+"G c #9D9D23",
+"H c #FDFD7B",
+"I c #FFFF7F",
+"J c #7F7F3F",
+"K c #737C7C",
+"L c #808038",
+"M c #6B6B5F",
+"N c #797935",
+"O c #6E6E62",
+"P c #8B8B43",
+"Q c #8D8D8D",
+"R c #1C4B4B",
+"S c #959523",
+"T c #F9F973",
+"U c #7F7F43",
+"V c #737D7D",
+"W c #939343",
+"X c #4FD3D3",
+"Y c #185353",
+"Z c #8D8D27",
+"` c #F5F56B",
+" . c #9B9B43",
+".. c #57CFCF",
+"+. c #145B5B",
+"@. c #85851E",
+"#. c #A3A343",
+"$. c #3BA7A7",
+"%. c #636300",
+"&. c #CFCF67",
+"*. c #F3F367",
+"=. c #909A9A",
+"-. c #4B4B07",
+";. c #434325",
+" . ",
+" + @ # ",
+" $ % & * = - ; > , ",
+" ' ) ! ~ ~ { ] - - ^ / - ( ",
+"_ : < [ [ } | 1 2 - 3 / 4 5 6 7 ",
+"8 9 0 a b c 3 d e f f g h i j ",
+"k l m n o p q r s t t t u v w x ",
+"y z A B C D E F G H I I I I I J ",
+"K I L M N O P Q R S T I I I I U ",
+"V I I I I I I W X Y Z ` I I I U ",
+"8 I I I I I I I ...+.@.I I I U ",
+"K I I I I I I I I #.$.%.I I I U ",
+"8 I I I I I I I I I &.*.I I I U ",
+"V I I I I I I I I I I I I I I U ",
+"=.-.-.-.-.-.-.-.-.-.-.-.-.-.-.;."};
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlcell.cpp
+// Purpose: wxHtmlCell - basic element of HTML output
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/html/htmlcell.h>
+#include <wx/html/htmlwin.h>
+#include <stdlib.h>
+
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlCell
+//-----------------------------------------------------------------------------
+
+
+void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, bool left, bool middle, bool right)
+{
+ if (GetLink() != wxEmptyString)
+ ((wxHtmlWindow*)parent) -> OnLinkClicked(GetLink());
+ // note : this overcasting is legal because parent is *always* wxHtmlWindow
+}
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlWordCell
+//-----------------------------------------------------------------------------
+
+wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell()
+{
+ m_Word = word;
+ m_Word.Replace(" ", " ", TRUE);
+ m_Word.Replace(""", "\"", TRUE);
+ m_Word.Replace("<", "<", TRUE);
+ m_Word.Replace(">", ">", TRUE);
+ m_Word.Replace("&", "&", TRUE);
+ dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent);
+}
+
+
+
+void wxHtmlWordCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ dc.DrawText(m_Word, x + m_PosX, y + m_PosY);
+ wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+}
+
+
+
+
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlContainerCell
+//-----------------------------------------------------------------------------
+
+
+wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCell()
+{
+ m_Cells = m_LastCell = NULL;
+ m_Parent = parent;
+ if (m_Parent) m_Parent -> InsertCell(this);
+ m_AlignHor = HTML_ALIGN_LEFT;
+ m_AlignVer = HTML_ALIGN_BOTTOM;
+ m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0;
+ m_WidthFloat = 100; m_WidthFloatUnits = HTML_UNITS_PERCENT;
+ m_UseBkColour = FALSE;
+ m_UseBorder = FALSE;
+ m_MinHeight = m_MaxLineWidth = 0;
+ m_MinHeightAlign = HTML_ALIGN_TOP;
+}
+
+
+
+void wxHtmlContainerCell::SetIndent(int i, int what, int units)
+{
+ int val = (units == HTML_UNITS_PIXELS) ? i : -i;
+ if (what & HTML_INDENT_LEFT) m_IndentLeft = val;
+ if (what & HTML_INDENT_RIGHT) m_IndentRight = val;
+ if (what & HTML_INDENT_TOP) m_IndentTop = val;
+ if (what & HTML_INDENT_BOTTOM) m_IndentBottom = val;
+}
+
+
+
+int wxHtmlContainerCell::GetIndent(int ind) const
+{
+ if (ind & HTML_INDENT_LEFT) return m_IndentLeft;
+ else if (ind & HTML_INDENT_RIGHT) return m_IndentRight;
+ else if (ind & HTML_INDENT_TOP) return m_IndentTop;
+ else if (ind & HTML_INDENT_BOTTOM) return m_IndentBottom;
+ else return -1; /* BUG! Should not be called... */
+}
+
+
+
+
+int wxHtmlContainerCell::GetIndentUnits(int ind) const
+{
+ bool p = FALSE;
+ if (ind & HTML_INDENT_LEFT) p = m_IndentLeft < 0;
+ else if (ind & HTML_INDENT_RIGHT) p = m_IndentRight < 0;
+ else if (ind & HTML_INDENT_TOP) p = m_IndentTop < 0;
+ else if (ind & HTML_INDENT_BOTTOM) p = m_IndentBottom < 0;
+ if (p) return HTML_UNITS_PERCENT;
+ else return HTML_UNITS_PIXELS;
+}
+
+
+
+void wxHtmlContainerCell::Layout(int w)
+{
+ wxHtmlCell *cell = m_Cells, *line = m_Cells;
+ long xpos = 0, ypos = m_IndentTop;
+ int xdelta = 0, ybasicpos = 0, ydiff;
+ int s_width, s_indent;
+ int ysizeup = 0, ysizedown = 0;
+
+ /*
+
+ WIDTH ADJUSTING :
+
+ */
+
+ if (m_WidthFloatUnits == HTML_UNITS_PERCENT) {
+ if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
+ else m_Width = m_WidthFloat * w / 100;
+ }
+ else {
+ if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
+ else m_Width = m_WidthFloat;
+ }
+
+ if (m_Cells) {
+ int l = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
+ int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
+ m_Cells -> Layout(m_Width - (l + r));
+ }
+
+ /*
+
+ LAYOUTING :
+
+ */
+
+ // adjust indentation:
+ s_indent = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
+ s_width = m_Width - s_indent - ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
+
+ m_MaxLineWidth = 0;
+
+ // my own layouting:
+ while (cell != NULL) {
+ switch (m_AlignVer) {
+ case HTML_ALIGN_TOP : ybasicpos = 0; break;
+ case HTML_ALIGN_BOTTOM : ybasicpos = - cell -> GetHeight(); break;
+ case HTML_ALIGN_CENTER : ybasicpos = - cell -> GetHeight() / 2; break;
+ }
+ ydiff = cell -> GetHeight() + ybasicpos;
+
+ if (cell -> GetDescent() + ydiff > ysizedown) ysizedown = cell -> GetDescent() + ydiff;
+ if (ybasicpos + cell -> GetDescent() < -ysizeup) ysizeup = - (ybasicpos + cell -> GetDescent());
+
+ cell -> SetPos(xpos, ybasicpos + cell -> GetDescent());
+ xpos += cell -> GetWidth();
+ cell = cell -> GetNext();
+
+ // force new line if occured:
+ if ((cell == NULL) || (xpos + cell -> GetWidth() > s_width)) {
+ if (xpos > m_MaxLineWidth) m_MaxLineWidth = xpos;
+ if (ysizeup < 0) ysizeup = 0;
+ if (ysizedown < 0) ysizedown = 0;
+ switch (m_AlignHor) {
+ case HTML_ALIGN_LEFT : xdelta = 0; break;
+ case HTML_ALIGN_RIGHT : xdelta = 0 + (s_width - xpos); break;
+ case HTML_ALIGN_CENTER : xdelta = 0 + (s_width - xpos) / 2; break;
+ }
+ if (xdelta < 0) xdelta = 0;
+ xdelta += s_indent;
+
+ ypos += ysizeup;
+ while (line != cell) {
+ line -> SetPos(line -> GetPosX() + xdelta, ypos + line -> GetPosY());
+ line = line -> GetNext();
+ }
+
+ ypos += ysizedown;
+ xpos = 0;
+ ysizeup = ysizedown = 0;
+ line = cell;
+ }
+ }
+
+ // setup height & width, depending on container layout:
+ m_Height = ypos + (ysizedown + ysizeup) + m_IndentBottom;
+
+ if (m_Height < m_MinHeight) {
+ if (m_MinHeightAlign != HTML_ALIGN_TOP) {
+ int diff = m_MinHeight - m_Height;
+ if (m_MinHeightAlign == HTML_ALIGN_CENTER) diff /= 2;
+ cell = m_Cells;
+ while (cell) {
+ cell -> SetPos(cell -> GetPosX(), cell -> GetPosY() + diff);
+ cell = cell -> GetNext();
+ }
+ }
+ m_Height = m_MinHeight;
+ }
+
+ m_MaxLineWidth += s_indent + ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
+ if (m_Width < m_MaxLineWidth) m_Width = m_MaxLineWidth;
+
+ wxHtmlCell::Layout(w);
+}
+
+
+#define mMin(a, b) (((a) < (b)) ? (a) : (b))
+#define mMax(a, b) (((a) < (b)) ? (b) : (a))
+
+void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ // container visible, draw it:
+ if ((y + m_PosY < view_y2) && (y + m_PosY + m_Height > view_y1)) {
+
+ if (m_UseBkColour) {
+ wxBrush myb = wxBrush(m_BkColour, wxSOLID);
+
+ int real_y1 = mMax(y + m_PosY, view_y1);
+ int real_y2 = mMin(y + m_PosY + m_Height - 1, view_y2);
+
+ dc.SetBrush(myb);
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(x + m_PosX, real_y1, m_Width, real_y2 - real_y1 + 1);
+ }
+
+ if (m_UseBorder) {
+ wxPen mypen1(m_BorderColour1, 1, wxSOLID);
+ wxPen mypen2(m_BorderColour2, 1, wxSOLID);
+
+ dc.SetPen(mypen1);
+ dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX, y + m_PosY + m_Height - 1);
+ dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX + m_Width - 1, y + m_PosY);
+ dc.SetPen(mypen2);
+ dc.DrawLine(x + m_PosX + m_Width - 1, y + m_PosY, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
+ dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
+ }
+
+ if (m_Cells) m_Cells -> Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
+ }
+ // container invisible, just proceed font+color changing:
+ else {
+ if (m_Cells) m_Cells -> DrawInvisible(dc, x + m_PosX, y + m_PosY);
+ }
+
+ wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+}
+
+
+
+void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y)
+{
+ if (m_Cells) m_Cells -> DrawInvisible(dc, x + m_PosX, y + m_PosY);
+ wxHtmlCell::DrawInvisible(dc, x, y);
+}
+
+
+
+wxString wxHtmlContainerCell::GetLink(int x, int y) const
+{
+ wxHtmlCell *c = m_Cells;
+ int cx, cy, cw, ch;
+
+ while (c) {
+ cx = c -> GetPosX(), cy = c -> GetPosY();
+ cw = c -> GetWidth(), ch = c -> GetHeight();
+ if ((x >= cx) && (x < cx + cw) && (y >= cy) && (y < cy + ch))
+ return c -> GetLink(x - cx, y - cy);
+ c = c -> GetNext();
+ }
+ return wxEmptyString;
+}
+
+
+
+void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
+{
+ if (!m_Cells) m_Cells = m_LastCell = f;
+ else {
+ m_LastCell -> SetNext(f);
+ m_LastCell = f;
+ if (m_LastCell) while (m_LastCell -> GetNext()) m_LastCell = m_LastCell -> GetNext();
+ }
+ f -> SetParent(this);
+}
+
+
+
+void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
+{
+ if (tag.HasParam("ALIGN")) {
+ wxString alg = tag.GetParam("ALIGN");
+ alg.MakeUpper();
+ if (alg == "CENTER")
+ SetAlignHor(HTML_ALIGN_CENTER);
+ else if (alg == "LEFT")
+ SetAlignHor(HTML_ALIGN_LEFT);
+ else if (alg == "RIGHT")
+ SetAlignHor(HTML_ALIGN_RIGHT);
+ }
+}
+
+
+
+void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag)
+{
+ if (tag.HasParam("WIDTH")) {
+ int wdi;
+ wxString wd = tag.GetParam("WIDTH");
+
+ if (wd[wd.Length()-1] == '%') {
+ sscanf(wd.c_str(), "%i%%", &wdi);
+ SetWidthFloat(wdi, HTML_UNITS_PERCENT);
+ }
+ else {
+ sscanf(wd.c_str(), "%i", &wdi);
+ SetWidthFloat(wdi, HTML_UNITS_PIXELS);
+ }
+ }
+}
+
+
+
+const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) const
+{
+ const wxHtmlCell *r = NULL;
+
+ if (m_Cells) {
+ r = m_Cells -> Find(condition, param);
+ if (r) return r;
+ }
+
+ return wxHtmlCell::Find(condition, param);
+}
+
+
+
+void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, bool left, bool middle, bool right)
+{
+ if (m_Cells) {
+ wxHtmlCell *c = m_Cells;
+ while (c) {
+ if ( (c -> GetPosX() <= x) &&
+ (c -> GetPosY() <= y) &&
+ (c -> GetPosX() + c -> GetWidth() > x) &&
+ (c -> GetPosY() + c -> GetHeight() > y)) {
+ c -> OnMouseClick(parent, x - c -> GetPosX(), y - c -> GetPosY(), left, middle, right);
+ break;
+ }
+ c = c -> GetNext();
+ }
+ }
+}
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlColourCell
+//--------------------------------------------------------------------------------
+
+void wxHtmlColourCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ if (m_Flags & HTML_CLR_FOREGROUND)
+ dc.SetTextForeground(m_Colour);
+ if (m_Flags & HTML_CLR_BACKGROUND) {
+ dc.SetBackground(wxBrush(m_Colour, wxSOLID));
+ dc.SetTextBackground(m_Colour);
+ }
+ wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+}
+
+void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y)
+{
+ if (m_Flags & HTML_CLR_FOREGROUND)
+ dc.SetTextForeground(m_Colour);
+ if (m_Flags & HTML_CLR_BACKGROUND) {
+ dc.SetBackground(wxBrush(m_Colour, wxSOLID));
+ dc.SetTextBackground(m_Colour);
+ }
+ wxHtmlCell::DrawInvisible(dc, x, y);
+}
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlFontCell
+//--------------------------------------------------------------------------------
+
+void wxHtmlFontCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ dc.SetFont(*m_Font);
+ wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+}
+
+void wxHtmlFontCell::DrawInvisible(wxDC& dc, int x, int y)
+{
+ dc.SetFont(*m_Font);
+ wxHtmlCell::DrawInvisible(dc, x, y);
+}
+
+
+
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlWidgetCell
+//--------------------------------------------------------------------------------
+
+wxHtmlWidgetCell::wxHtmlWidgetCell(wxWindow *wnd, int w)
+{
+ int sx, sy;
+ m_Wnd = wnd;
+ m_Wnd -> GetSize(&sx, &sy);
+ m_Width = sx, m_Height = sy;
+ m_WidthFloat = w;
+}
+
+
+void wxHtmlWidgetCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ int absx = 0, absy = 0, stx, sty;
+ wxHtmlCell *c = this;
+
+ while (c) {
+ absx += c -> GetPosX();
+ absy += c -> GetPosY();
+ c = c -> GetParent();
+ }
+
+ ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
+
+ m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height);
+// m_Wnd -> Refresh();
+
+ wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+}
+
+
+
+void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y)
+{
+ int absx = 0, absy = 0, stx, sty;
+ wxHtmlCell *c = this;
+
+ while (c) {
+ absx += c -> GetPosX();
+ absy += c -> GetPosY();
+ c = c -> GetParent();
+ }
+ ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
+
+ m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height);
+ wxHtmlCell::DrawInvisible(dc, x, y);
+}
+
+
+
+void wxHtmlWidgetCell::Layout(int w)
+{
+ if (m_WidthFloat != 0) {
+ m_Width = (w * m_WidthFloat) / 100;
+ m_Wnd -> SetSize(m_Width, m_Height);
+ }
+
+ wxHtmlCell::Layout(w);
+}
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: filter.cpp
+// Purpose: wxHtmlFilter - input filter for translating into HTML format
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/html/htmlfilter.h>
+#include <wx/html/htmlwin.h>
+
+
+/*
+
+There is code for several default filters:
+
+*/
+
+IMPLEMENT_ABSTRACT_CLASS(wxHtmlFilter, wxObject)
+
+//--------------------------------------------------------------------------------
+// wxHtmlFilterPlainText
+// filter for text/plain or uknown
+//--------------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterPlainText, wxHtmlFilter)
+
+bool wxHtmlFilterPlainText::CanRead(const wxFSFile& file)
+{
+ return TRUE;
+}
+
+
+
+wxString wxHtmlFilterPlainText::ReadFile(const wxFSFile& file)
+{
+ wxInputStream *s = file.GetStream();
+ char *src;
+ wxString doc, doc2;
+
+ if (s == NULL) return wxEmptyString;
+ src = (char*) malloc(s -> StreamSize());
+ src[s -> StreamSize()] = 0;
+ s -> Read(src, s -> StreamSize());
+ doc = src;
+ free(src);
+
+ doc.Replace("<", "<", TRUE);
+ doc.Replace(">", ">", TRUE);
+ doc2 = "<HTML><BODY><PRE>\n" + doc + "\n</PRE></BODY></HTML>";
+ return doc2;
+}
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlFilterImage
+// filter for image/*
+//--------------------------------------------------------------------------------
+
+class wxHtmlFilterImage : public wxHtmlFilter
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlFilterImage)
+
+ public:
+ virtual bool CanRead(const wxFSFile& file);
+ virtual wxString ReadFile(const wxFSFile& file);
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterImage, wxHtmlFilter)
+
+
+
+bool wxHtmlFilterImage::CanRead(const wxFSFile& file)
+{
+ return (file.GetMimeType().Left(6) == "image/");
+}
+
+
+
+wxString wxHtmlFilterImage::ReadFile(const wxFSFile& file)
+{
+ return ("<HTML><BODY><IMG SRC=\"" + file.GetLocation() + "\"></BODY></HTML>");
+}
+
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlFilterPlainText
+// filter for text/plain or uknown
+//--------------------------------------------------------------------------------
+
+class wxHtmlFilterHTML : public wxHtmlFilter
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML)
+
+ public:
+ virtual bool CanRead(const wxFSFile& file);
+ virtual wxString ReadFile(const wxFSFile& file);
+};
+
+
+IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterHTML, wxHtmlFilter)
+
+bool wxHtmlFilterHTML::CanRead(const wxFSFile& file)
+{
+ return (file.GetMimeType() == "text/html");
+}
+
+
+
+wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file)
+{
+ wxInputStream *s = file.GetStream();
+ char *src;
+ wxString doc;
+
+ if (s == NULL) return wxEmptyString;
+ src = (char*) malloc(s -> StreamSize() + 1);
+ src[s -> StreamSize()] = 0;
+ s -> Read(src, s -> StreamSize());
+ doc = src;
+ free(src);
+
+ return doc;
+}
+
+
+
+
+///// Module:
+
+class wxHtmlFilterModule : public wxModule
+{
+ DECLARE_DYNAMIC_CLASS(wxHtmlFilterModule)
+
+ public:
+ virtual bool OnInit()
+ {
+ wxHtmlWindow::AddFilter(new wxHtmlFilterHTML);
+ wxHtmlWindow::AddFilter(new wxHtmlFilterImage);
+ return TRUE;
+ }
+ virtual void OnExit() {}
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterModule, wxModule)
+
+#endif
\ No newline at end of file
--- /dev/null
+// Name: htmlhelp.cpp
+// Purpose: Help controller
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+
+#include <wx/notebook.h>
+#include <wx/imaglist.h>
+#include <wx/treectrl.h>
+#include <wx/tokenzr.h>
+#include <wx/wfstream.h>
+#include <wx/html/htmlwin.h>
+#include <wx/html/htmlhelp.h>
+#include <wx/busyinfo.h>
+
+#if !((wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)))
+#include <wx/progdlg.h>
+#endif
+
+
+// Bitmaps:
+
+#ifndef __WXMSW__
+#include "bitmaps/panel.xpm"
+#include "bitmaps/back.xpm"
+#include "bitmaps/forward.xpm"
+#include "bitmaps/book.xpm"
+#include "bitmaps/folder.xpm"
+#include "bitmaps/page.xpm"
+#endif
+
+#include "search.h"
+
+
+
+//-----------------------------------------------------------------------------
+// Helper constants
+//-----------------------------------------------------------------------------
+
+
+// Command IDs :
+
+enum {
+ wxID_HTML_PANEL = wxID_HIGHEST + 1,
+ wxID_HTML_BACK,
+ wxID_HTML_FORWARD,
+ wxID_HTML_TREECTRL,
+ wxID_HTML_INDEXPAGE,
+ wxID_HTML_INDEXLIST,
+ wxID_HTML_NOTEBOOK,
+ wxID_HTML_SEARCHPAGE,
+ wxID_HTML_SEARCHTEXT,
+ wxID_HTML_SEARCHLIST,
+ wxID_HTML_SEARCHBUTTON
+};
+
+
+// Images:
+
+enum {
+ IMG_Book = 0,
+ IMG_Folder,
+ IMG_Page
+};
+
+
+
+
+
+
+class HtmlHelpTreeItemData : public wxTreeItemData
+{
+ private:
+ wxString m_Page;
+
+ public:
+ HtmlHelpTreeItemData(HtmlContentsItem *it) : wxTreeItemData() {m_Page = it -> m_Book -> GetBasePath() + it -> m_Page;}
+ const wxString& GetPage() {return m_Page;}
+};
+
+
+
+
+
+#include <wx/arrimpl.cpp>
+WX_DEFINE_OBJARRAY(HtmlBookRecArray)
+
+
+
+
+
+
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlHelpController
+//-----------------------------------------------------------------------------
+
+
+IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxEvtHandler)
+
+
+wxHtmlHelpController::wxHtmlHelpController() : wxEvtHandler()
+{
+ m_Frame = NULL;
+ m_Config = NULL;
+ m_ConfigRoot = wxEmptyString;
+ m_TitleFormat = _("Help : %s");
+ m_TempPath = wxEmptyString;
+
+ m_Cfg.x = m_Cfg.y = 0;
+ m_Cfg.w = 700; m_Cfg.h = 480;
+ m_Cfg.sashpos = 240;
+ m_Cfg.navig_on = TRUE;
+
+ m_ContentsImageList = new wxImageList(12, 12);
+ m_ContentsImageList -> Add(wxICON(book));
+ m_ContentsImageList -> Add(wxICON(folder));
+ m_ContentsImageList -> Add(wxICON(page));
+
+ m_Contents = NULL;
+ m_ContentsCnt = 0;
+ m_Index = NULL;
+ m_IndexCnt = 0;
+}
+
+
+
+wxHtmlHelpController::~wxHtmlHelpController()
+{
+ int i;
+
+ m_BookRecords.Empty();
+ delete m_ContentsImageList;
+ if (m_Contents) {
+ for (i = 0; i < m_ContentsCnt; i++) {
+ free(m_Contents[i].m_Page);
+ free(m_Contents[i].m_Name);
+ }
+ free(m_Contents);
+ }
+ if (m_Index) {
+ for (i = 0; i < m_IndexCnt; i++) {
+ free(m_Index[i].m_Page);
+ free(m_Index[i].m_Name);
+ }
+ free(m_Index);
+ }
+}
+
+
+
+void wxHtmlHelpController::SetTempDir(const wxString& path)
+{
+ if (path == wxEmptyString) m_TempPath = path;
+ else {
+ if (wxIsAbsolutePath(path)) m_TempPath = path;
+ else m_TempPath = wxGetCwd() + "/" + path;
+
+ if (m_TempPath[m_TempPath.Length() - 1] != '/')
+ m_TempPath << "/";
+ }
+}
+
+
+
+
+// Reads one line, stores it into buf and returns pointer to new line or NULL.
+static char* ReadLine(char *line, char *buf)
+{
+ char *writeptr = buf, *readptr = line;
+
+ while (*readptr != 0 && *readptr != '\r' && *readptr != '\n') *(writeptr++) = *(readptr++);
+ *writeptr = 0;
+ while (*readptr == '\r' || *readptr == '\n') readptr++;
+ if (*readptr == 0) return NULL;
+ else return readptr;
+}
+
+
+static wxString SafeFileName(const wxString& s)
+{
+ wxString res = s;
+ res.Replace(":", "_", TRUE);
+ res.Replace(" ", "_", TRUE);
+ res.Replace("/", "_", TRUE);
+ res.Replace("\\", "_", TRUE);
+ res.Replace("#", "_", TRUE);
+ res.Replace(".", "_", TRUE);
+ return res;
+}
+
+
+static int IndexCompareFunc(const void *a, const void *b)
+{
+ return strcmp(((HtmlContentsItem*)a) -> m_Name, ((HtmlContentsItem*)b) -> m_Name);
+}
+
+
+
+bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg = FALSE)
+{
+ wxFSFile *fi;
+ wxFileSystem fsys;
+ wxInputStream *s;
+ HtmlBookRecord *bookr;
+ wxString bookFull;
+
+ int sz;
+ char *buff, *lineptr;
+ char linebuf[300];
+
+ wxString title = _("noname"),
+ safetitle,
+ start = wxEmptyString,
+ contents = wxEmptyString, index = wxEmptyString;
+
+ if (wxIsAbsolutePath(book)) bookFull = book;
+ else bookFull = wxGetCwd() + "/" + book;
+
+ fi = fsys.OpenFile(bookFull);
+ if (fi == NULL) return FALSE;
+ fsys.ChangePathTo(bookFull);
+ s = fi -> GetStream();
+ sz = s -> StreamSize();
+ buff = (char*) malloc(sz+1);
+ buff[sz] = 0;
+ s -> Read(buff, sz);
+ lineptr = buff;
+ delete fi;
+
+ while ((lineptr = ReadLine(lineptr, linebuf)) != NULL) {
+ if (strstr(linebuf, "Title=") == linebuf)
+ title = linebuf + strlen("Title=");
+ if (strstr(linebuf, "Default topic=") == linebuf)
+ start = linebuf + strlen("Default topic=");
+ if (strstr(linebuf, "Index file=") == linebuf)
+ index = linebuf + strlen("Index file=");
+ if (strstr(linebuf, "Contents file=") == linebuf)
+ contents = linebuf + strlen("Contents file=");
+ }
+ free(buff);
+
+ bookr = new HtmlBookRecord(fsys.GetPath(), title, start);
+
+ if (m_ContentsCnt % HTML_REALLOC_STEP == 0)
+ m_Contents = (HtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + HTML_REALLOC_STEP) * sizeof(HtmlContentsItem));
+ m_Contents[m_ContentsCnt].m_Level = 0;
+ m_Contents[m_ContentsCnt].m_ID = 0;
+ m_Contents[m_ContentsCnt].m_Page = (char*) malloc(start.Length() + 1);
+ strcpy(m_Contents[m_ContentsCnt].m_Page, start.c_str());
+ m_Contents[m_ContentsCnt].m_Name = (char*) malloc(title.Length() + 1);
+ strcpy(m_Contents[m_ContentsCnt].m_Name, title.c_str());
+ m_Contents[m_ContentsCnt].m_Book = bookr;
+ m_ContentsCnt++;
+
+ // Try to find cached binary versions:
+ safetitle = SafeFileName(title);
+ fi = fsys.OpenFile(safetitle + ".cached");
+ if (fi == NULL) fi = fsys.OpenFile(m_TempPath + safetitle + ".cached");
+ if ((fi == NULL) || (m_TempPath == wxEmptyString)) {
+ LoadMSProject(bookr, fsys, index, contents, show_wait_msg);
+ if (m_TempPath != wxEmptyString) {
+ wxFileOutputStream *outs = new wxFileOutputStream(m_TempPath + safetitle + ".cached");
+ SaveCachedBook(bookr, outs);
+ delete outs;
+ }
+ }
+ else {
+ LoadCachedBook(bookr, fi -> GetStream());
+ delete fi;
+ }
+
+ m_BookRecords.Add(bookr);
+ if (m_IndexCnt > 0)
+ qsort(m_Index, m_IndexCnt, sizeof(HtmlContentsItem), IndexCompareFunc);
+
+ return TRUE;
+}
+
+
+
+
+void wxHtmlHelpController::Display(const wxString& x)
+{
+ int cnt;
+ int i;
+ wxFileSystem fsys;
+ wxFSFile *f;
+
+ CreateHelpWindow();
+
+ /* 1. try to open given file: */
+
+ cnt = m_BookRecords.GetCount();
+ for (i = 0; i < cnt; i++) {
+ f = fsys.OpenFile(m_BookRecords[i].GetBasePath() + x);
+ if (f) {
+ m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + x);
+ delete f;
+ return;
+ }
+ }
+
+
+ /* 2. try to find a book: */
+
+ for (i = 0; i < cnt; i++) {
+ if (m_BookRecords[i].GetTitle() == x) {
+ m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + m_BookRecords[i].GetStart());
+ return;
+ }
+ }
+
+ /* 3. try to find in contents: */
+
+ cnt = m_ContentsCnt;
+ for (i = 0; i < cnt; i++) {
+ if (strcmp(m_Contents[i].m_Name, x) == 0) {
+ m_HtmlWin -> LoadPage(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page);
+ return;
+ }
+ }
+
+
+ /* 4. try to find in index: */
+
+ cnt = m_IndexCnt;
+ for (i = 0; i < cnt; i++) {
+ if (strcmp(m_Index[i].m_Name, x) == 0) {
+ m_HtmlWin -> LoadPage(m_Index[i].m_Book -> GetBasePath() + m_Index[i].m_Page);
+ return;
+ }
+ }
+
+
+ /* 5. if everything failed, search the documents: */
+
+ KeywordSearch(x);
+}
+
+
+
+void wxHtmlHelpController::Display(const int id)
+{
+ CreateHelpWindow();
+
+ for (int i = 0; i < m_ContentsCnt; i++) {
+ if (m_Contents[i].m_ID == id) {
+ m_HtmlWin -> LoadPage(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page);
+ return;
+ }
+ }
+}
+
+
+
+void wxHtmlHelpController::DisplayContents()
+{
+ CreateHelpWindow();
+ m_Frame -> Raise();
+ if (!m_Splitter -> IsSplit()) {
+ m_NavigPan -> Show(TRUE);
+ m_HtmlWin -> Show(TRUE);
+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ }
+ m_NavigPan -> SetSelection(0);
+}
+
+
+
+void wxHtmlHelpController::DisplayIndex()
+{
+ CreateHelpWindow();
+ m_Frame -> Raise();
+ if (!m_Splitter -> IsSplit()) {
+ m_NavigPan -> Show(TRUE);
+ m_HtmlWin -> Show(TRUE);
+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ }
+ m_NavigPan -> SetSelection(1);
+}
+
+
+
+
+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))
+
+class MyProgressDlg : public wxDialog
+{
+ public:
+ bool m_Canceled;
+
+ MyProgressDlg(wxWindow *parent) : wxDialog(parent, -1,
+ _("Searching..."),
+ wxPoint(0, 0),
+#ifdef __WXGTK__
+ wxSize(300, 110))
+#else
+ wxSize(300, 130))
+#endif
+ {m_Canceled = FALSE;}
+ void OnCancel(wxCommandEvent& event) {m_Canceled = TRUE;}
+ DECLARE_EVENT_TABLE()
+};
+BEGIN_EVENT_TABLE(MyProgressDlg, wxDialog)
+ EVT_BUTTON(wxID_CANCEL, MyProgressDlg::OnCancel)
+END_EVENT_TABLE()
+
+#endif
+
+
+bool wxHtmlHelpController::KeywordSearch(const wxString& keyword)
+{
+ int foundcnt = 0;
+
+ CreateHelpWindow();
+ m_Frame -> Raise();
+ if (!m_Splitter -> IsSplit()) {
+ m_NavigPan -> Show(TRUE);
+ m_HtmlWin -> Show(TRUE);
+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ }
+ m_NavigPan -> SetSelection(2);
+ m_SearchList -> Clear();
+ m_SearchText -> SetValue(keyword);
+ m_SearchButton -> Enable(FALSE);
+
+ {
+ int cnt = m_ContentsCnt;
+ wxSearchEngine engine;
+ wxFileSystem fsys;
+ wxFSFile *file;
+ wxString lastpage = wxEmptyString;
+ wxString foundstr;
+
+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))
+ MyProgressDlg progress(m_Frame);
+
+ wxStaticText *prompt = new wxStaticText(&progress, -1, "", wxPoint(20, 50), wxSize(260, 25), wxALIGN_CENTER);
+ wxGauge *gauge = new wxGauge(&progress, -1, cnt, wxPoint(20, 20), wxSize(260, 25));
+ wxButton *btn = new wxButton(&progress, wxID_CANCEL, _("Cancel"), wxPoint(110, 70), wxSize(80, 25));
+ btn = btn; /* fool compiler :-) */
+ prompt -> SetLabel(_("No matching page found yet"));
+
+ progress.Centre(wxBOTH);
+ progress.Show(TRUE);
+#else
+ wxProgressDialog progress(_("Searching..."), _("No matching page found yet"), cnt, m_Frame, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
+#endif
+
+ engine.LookFor(keyword);
+
+ for (int i = 0; i < cnt; i++) {
+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))
+ gauge -> SetValue(i);
+ if (progress.m_Canceled) break;
+#else
+ if (progress.Update(i) == FALSE) break;
+#endif
+ wxYield();
+
+ file = fsys.OpenFile(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page);
+ if (file) {
+ if (lastpage != file -> GetLocation()) {
+ lastpage = file -> GetLocation();
+ if (engine.Scan(file -> GetStream())) {
+ foundstr.Printf(_("Found %i matches"), ++foundcnt);
+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))
+ prompt -> SetLabel(foundstr);
+#else
+ progress.Update(i, foundstr);
+#endif
+ wxYield();
+ m_SearchList -> Append(m_Contents[i].m_Name, (char*)(m_Contents + i));
+ }
+ }
+ delete file;
+ }
+ }
+
+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))
+ progress.Close(TRUE);
+#endif
+ }
+
+ m_SearchButton -> Enable(TRUE);
+ m_SearchText -> SetSelection(0, keyword.Length());
+ m_SearchText -> SetFocus();
+ if (foundcnt) {
+ HtmlContentsItem *it = (HtmlContentsItem*) m_SearchList -> GetClientData(0);
+ if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+ }
+ return (foundcnt > 0);
+}
+
+
+
+
+
+
+void wxHtmlHelpController::CreateHelpWindow()
+{
+ wxBusyCursor cur;
+ wxString oldpath;
+ wxStatusBar *sbar;
+
+ if (m_Frame) {
+ m_Frame -> Raise();
+ m_Frame -> Show(TRUE);
+ return;
+ }
+
+ wxBusyInfo busyinfo(_("Preparing help window..."));
+
+ if (m_Config) ReadCustomization(m_Config, m_ConfigRoot);
+
+ m_Frame = new wxFrame(NULL, -1, "", wxPoint(m_Cfg.x, m_Cfg.y), wxSize(m_Cfg.w, m_Cfg.h));
+ m_Frame -> PushEventHandler(this);
+ sbar = m_Frame -> CreateStatusBar();
+
+ {
+ wxToolBar *toolBar;
+ toolBar = m_Frame -> CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE);
+ toolBar -> SetMargins(2, 2);
+ wxBitmap* toolBarBitmaps[3];
+
+#ifdef __WXMSW__
+ toolBarBitmaps[0] = new wxBitmap("panel");
+ toolBarBitmaps[1] = new wxBitmap("back");
+ toolBarBitmaps[2] = new wxBitmap("forward");
+ int width = 24;
+#else
+ toolBarBitmaps[0] = new wxBitmap(panel_xpm);
+ toolBarBitmaps[1] = new wxBitmap(back_xpm);
+ toolBarBitmaps[2] = new wxBitmap(forward_xpm);
+ int width = 16;
+#endif
+
+ int currentX = 5;
+
+ toolBar -> AddTool(wxID_HTML_PANEL, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Show/hide navigation panel"));
+ currentX += width + 5;
+ toolBar -> AddSeparator();
+ toolBar -> AddTool(wxID_HTML_BACK, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Go back to the previous HTML page"));
+ currentX += width + 5;
+ toolBar -> AddTool(wxID_HTML_FORWARD, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Go forward to the next HTML page"));
+ currentX += width + 5;
+
+ toolBar -> Realize();
+
+ // Can delete the bitmaps since they're reference counted
+ for (int i = 0; i < 3; i++) delete toolBarBitmaps[i];
+ }
+
+
+ {
+ m_Splitter = new wxSplitterWindow(m_Frame);
+
+ m_HtmlWin = new wxHtmlWindow(m_Splitter);
+ m_HtmlWin -> SetRelatedFrame(m_Frame, m_TitleFormat);
+ m_HtmlWin -> SetRelatedStatusBar(0);
+ if (m_Config) m_HtmlWin -> ReadCustomization(m_Config, m_ConfigRoot);
+
+ m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
+ {
+ m_ContentsBox = new wxTreeCtrl(m_NavigPan, wxID_HTML_TREECTRL, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
+ m_ContentsBox -> SetImageList(m_ContentsImageList);
+ m_NavigPan -> AddPage(m_ContentsBox, _("Contents"));
+ }
+
+ {
+ wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
+ wxLayoutConstraints *b1 = new wxLayoutConstraints;
+ b1 -> top.SameAs (dummy, wxTop, 0);
+ b1 -> left.SameAs (dummy, wxLeft, 0);
+ b1 -> width.PercentOf (dummy, wxWidth, 100);
+ b1 -> bottom.SameAs (dummy, wxBottom, 0);
+ m_IndexBox = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, 0);
+ m_IndexBox -> SetConstraints(b1);
+ dummy -> SetAutoLayout(TRUE);
+ m_NavigPan -> AddPage(dummy, _("Index"));
+ }
+
+ {
+ wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE);
+
+ wxLayoutConstraints *b1 = new wxLayoutConstraints;
+ m_SearchText = new wxTextCtrl(dummy, wxID_HTML_SEARCHTEXT);
+ b1 -> top.SameAs (dummy, wxTop, 0);
+ b1 -> left.SameAs (dummy, wxLeft, 0);
+ b1 -> right.SameAs (dummy, wxRight, 0);
+ b1 -> height.AsIs();
+ m_SearchText -> SetConstraints(b1);
+
+ wxLayoutConstraints *b2 = new wxLayoutConstraints;
+ m_SearchButton = new wxButton(dummy, wxID_HTML_SEARCHBUTTON, _("Search!"));
+ b2 -> top.Below (m_SearchText, 10);
+ b2 -> right.SameAs (dummy, wxRight, 10);
+ b2 -> width.AsIs();
+ b2 -> height.AsIs();
+ m_SearchButton -> SetConstraints(b2);
+
+ wxLayoutConstraints *b3 = new wxLayoutConstraints;
+ m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0);
+ b3 -> top.Below (m_SearchButton, 10);
+ b3 -> left.SameAs (dummy, wxLeft, 0);
+ b3 -> right.SameAs (dummy, wxRight, 0);
+ b3 -> bottom.SameAs (dummy, wxBottom, 0);
+ m_SearchList -> SetConstraints(b3);
+
+ dummy -> SetAutoLayout(TRUE);
+ dummy -> Layout();
+ m_NavigPan -> AddPage(dummy, _("Search"));
+ }
+
+ RefreshLists();
+ m_NavigPan -> Show(TRUE);
+ m_HtmlWin -> Show(TRUE);
+ m_Splitter -> SetMinimumPaneSize(20);
+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ if (!m_Cfg.navig_on) m_Splitter -> Unsplit(m_NavigPan);
+ wxYield();
+ }
+
+ m_Frame -> Show(TRUE);
+ wxYield();
+}
+
+
+
+#define MAX_ROOTS 64
+
+void wxHtmlHelpController::CreateContents()
+{
+ HtmlContentsItem *it;
+ wxTreeItemId roots[MAX_ROOTS];
+ bool imaged[MAX_ROOTS];
+ int count = m_ContentsCnt;
+
+ m_ContentsBox -> DeleteAllItems();
+ roots[0] = m_ContentsBox -> AddRoot(_("(Help)"));
+ imaged[0] = TRUE;
+
+ for (int i = 0; i < count; i++) {
+ it = m_Contents + i;
+ roots[it -> m_Level + 1] = m_ContentsBox -> AppendItem(roots[it -> m_Level], it -> m_Name, IMG_Page, -1, new HtmlHelpTreeItemData(it));
+ if (it -> m_Level == 0) {
+ m_ContentsBox -> SetItemBold(roots[1], TRUE);
+ m_ContentsBox -> SetItemImage(roots[1], IMG_Book);
+ m_ContentsBox -> SetItemSelectedImage(roots[1], IMG_Book);
+ imaged[1] = TRUE;
+ }
+ else imaged[it -> m_Level + 1] = FALSE;
+
+ if (!imaged[it -> m_Level]) {
+ m_ContentsBox -> SetItemImage(roots[it -> m_Level], IMG_Folder);
+ m_ContentsBox -> SetItemSelectedImage(roots[it -> m_Level], IMG_Folder);
+ imaged[it -> m_Level] = TRUE;
+ }
+ }
+
+ m_ContentsBox -> Expand(roots[0]);
+}
+
+
+
+
+void wxHtmlHelpController::CreateIndex()
+{
+ m_IndexBox -> Clear();
+
+ for (int i = 0; i < m_IndexCnt; i++)
+ m_IndexBox -> Append(m_Index[i].m_Name, (char*)(m_Index + i));
+}
+
+
+
+void wxHtmlHelpController::RefreshLists()
+{
+ if (m_Frame) {
+ CreateContents();
+ CreateIndex();
+ m_SearchList -> Clear();
+ }
+}
+
+
+
+
+
+
+
+void wxHtmlHelpController::ReadCustomization(wxConfigBase *cfg, wxString path)
+{
+ wxString oldpath;
+ wxString tmp;
+
+ if (path != wxEmptyString) {
+ oldpath = cfg -> GetPath();
+ cfg -> SetPath(path);
+ }
+
+ m_Cfg.navig_on = (bool) cfg -> Read("hcNavigPanel", m_Cfg.navig_on);
+ m_Cfg.sashpos = cfg -> Read("hcSashPos", m_Cfg.sashpos);
+ m_Cfg.x = cfg -> Read("hcX", m_Cfg.x);
+ m_Cfg.y = cfg -> Read("hcY", m_Cfg.y);
+ m_Cfg.w = cfg -> Read("hcW", m_Cfg.w);
+ m_Cfg.h = cfg -> Read("hcH", m_Cfg.h);
+
+ if (path != wxEmptyString)
+ cfg -> SetPath(oldpath);
+}
+
+
+
+void wxHtmlHelpController::WriteCustomization(wxConfigBase *cfg, wxString path)
+{
+ wxString oldpath;
+ wxString tmp;
+
+ if (path != wxEmptyString) {
+ oldpath = cfg -> GetPath();
+ cfg -> SetPath(path);
+ }
+
+ cfg -> Write("hcNavigPanel", m_Cfg.navig_on);
+ cfg -> Write("hcSashPos", (long)m_Cfg.sashpos);
+ cfg -> Write("hcX", (long)m_Cfg.x);
+ cfg -> Write("hcY", (long)m_Cfg.y);
+ cfg -> Write("hcW", (long)m_Cfg.w);
+ cfg -> Write("hcH", (long)m_Cfg.h);
+
+ if (path != wxEmptyString)
+ cfg -> SetPath(oldpath);
+}
+
+
+
+
+
+/*
+EVENT HANDLING :
+*/
+
+
+void wxHtmlHelpController::OnToolbar(wxCommandEvent& event)
+{
+ switch (event.GetId()) {
+ case wxID_HTML_BACK :
+ m_HtmlWin -> HistoryBack();
+ break;
+ case wxID_HTML_FORWARD :
+ m_HtmlWin -> HistoryForward();
+ break;
+ case wxID_HTML_PANEL :
+ if (m_Splitter -> IsSplit()) {
+ m_Cfg.sashpos = m_Splitter -> GetSashPosition();
+ m_Splitter -> Unsplit(m_NavigPan);
+ }
+ else {
+ m_NavigPan -> Show(TRUE);
+ m_HtmlWin -> Show(TRUE);
+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ }
+ break;
+ }
+}
+
+
+
+void wxHtmlHelpController::OnContentsSel(wxTreeEvent& event)
+{
+ HtmlHelpTreeItemData *pg;
+
+ pg = (HtmlHelpTreeItemData*) m_ContentsBox -> GetItemData(event.GetItem());
+ if (pg) m_HtmlWin -> LoadPage(pg -> GetPage());
+}
+
+
+
+void wxHtmlHelpController::OnIndexSel(wxCommandEvent& event)
+{
+ HtmlContentsItem *it = (HtmlContentsItem*) m_IndexBox -> GetClientData(m_IndexBox -> GetSelection());
+ if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+}
+
+
+
+void wxHtmlHelpController::OnSearchSel(wxCommandEvent& event)
+{
+ HtmlContentsItem *it = (HtmlContentsItem*) m_SearchList -> GetClientData(m_SearchList -> GetSelection());
+ if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+}
+
+
+
+void wxHtmlHelpController::OnCloseWindow(wxCloseEvent& event)
+{
+ int a, b;
+
+ m_Cfg.navig_on = m_Splitter -> IsSplit();
+ if (m_Cfg.navig_on)
+ m_Cfg.sashpos = m_Splitter -> GetSashPosition();
+ m_Frame -> GetPosition(&a, &b);
+ m_Cfg.x = a, m_Cfg.y = b;
+ m_Frame -> GetSize(&a, &b);
+ m_Cfg.w = a, m_Cfg.h = b;
+
+ if (m_Config) {
+ WriteCustomization(m_Config, m_ConfigRoot);
+ m_HtmlWin -> WriteCustomization(m_Config, m_ConfigRoot);
+ }
+ m_Frame = NULL;
+
+ event.Skip();
+}
+
+
+
+void wxHtmlHelpController::OnSearch(wxCommandEvent& event)
+{
+ wxString sr = m_SearchText -> GetLineText(0);
+
+ if (sr != wxEmptyString) KeywordSearch(sr);
+}
+
+
+
+BEGIN_EVENT_TABLE(wxHtmlHelpController, wxEvtHandler)
+ EVT_TOOL_RANGE(wxID_HTML_PANEL, wxID_HTML_FORWARD, wxHtmlHelpController::OnToolbar)
+ EVT_TREE_SEL_CHANGED(wxID_HTML_TREECTRL, wxHtmlHelpController::OnContentsSel)
+ EVT_LISTBOX(wxID_HTML_INDEXLIST, wxHtmlHelpController::OnIndexSel)
+ EVT_LISTBOX(wxID_HTML_SEARCHLIST, wxHtmlHelpController::OnSearchSel)
+ EVT_CLOSE(wxHtmlHelpController::OnCloseWindow)
+ EVT_BUTTON(wxID_HTML_SEARCHBUTTON, wxHtmlHelpController::OnSearch)
+ EVT_TEXT_ENTER(wxID_HTML_SEARCHTEXT, wxHtmlHelpController::OnSearch)
+END_EVENT_TABLE()
+
+
+
+#endif
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlhelp.cpp
+// Purpose: Help controller
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+//#ifdef __GNUG__
+//#pragma implementation "htmlhelp.h"
+//#endif
+// --- already in htmlhelp.cpp
+
+#include <wx/wxprec.h>
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+
+#include <wx/wxhtml.h>
+#include <wx/busyinfo.h>
+
+
+
+
+class HP_Parser : public wxHtmlParser
+{
+ public:
+ void AddText(const char* text) {}
+ wxObject* GetProduct() {return NULL;}
+};
+
+
+
+class HP_TagHandler : public wxHtmlTagHandler
+{
+ private:
+ wxString m_Name, m_Page;
+ int m_Level;
+ int m_ID;
+ int m_Index;
+ HtmlContentsItem *m_Items;
+ int m_ItemsCnt;
+ HtmlBookRecord *m_Book;
+
+ public:
+ HP_TagHandler(HtmlBookRecord *b) : wxHtmlTagHandler() {m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString; m_Level = 0;}
+ wxString GetSupportedTags() {return "UL,OBJECT,PARAM";}
+ bool HandleTag(const wxHtmlTag& tag);
+ void WriteOut(HtmlContentsItem*& array, int& size);
+ void ReadIn(HtmlContentsItem* array, int size);
+};
+
+
+bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
+{
+ if (tag.GetName() == "UL") {
+ m_Level++;
+ ParseInner(tag);
+ m_Level--;
+ return TRUE;
+ }
+
+ else if (tag.GetName() == "OBJECT") {
+ m_Name = m_Page = wxEmptyString;
+ ParseInner(tag);
+ if (m_Page != wxEmptyString) {
+ if (m_ItemsCnt % HTML_REALLOC_STEP == 0)
+ m_Items = (HtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + HTML_REALLOC_STEP) * sizeof(HtmlContentsItem));
+ m_Items[m_ItemsCnt].m_Level = m_Level;
+ m_Items[m_ItemsCnt].m_ID = m_ID;
+ m_Items[m_ItemsCnt].m_Page = (char*) malloc(m_Page.Length() + 1);
+ strcpy(m_Items[m_ItemsCnt].m_Page, m_Page.c_str());
+ m_Items[m_ItemsCnt].m_Name = (char*) malloc(m_Name.Length() + 1);
+ strcpy(m_Items[m_ItemsCnt].m_Name, m_Name.c_str());
+ m_Items[m_ItemsCnt].m_Book = m_Book;
+ m_ItemsCnt++;
+ }
+ return TRUE;
+ }
+
+ else { // "PARAM"
+ if (m_Name == wxEmptyString && tag.GetParam("NAME") == "Name") m_Name = tag.GetParam("VALUE");
+ if (tag.GetParam("NAME") == "Local") m_Page = tag.GetParam("VALUE");
+ if (tag.GetParam("NAME") == "ID") tag.ScanParam("VALUE", "%i", &m_ID);
+ return FALSE;
+ }
+}
+
+
+
+void HP_TagHandler::WriteOut(HtmlContentsItem*& array, int& size)
+{
+ array = m_Items;
+ size = m_ItemsCnt;
+ m_Items = NULL;
+ m_ItemsCnt = 0;
+}
+
+void HP_TagHandler::ReadIn(HtmlContentsItem* array, int size)
+{
+ m_Items = array;
+ m_ItemsCnt = size;
+}
+
+
+
+
+void wxHtmlHelpController::LoadMSProject(HtmlBookRecord *book, wxFileSystem& fsys, const wxString& indexfile, const wxString& contentsfile, bool show_wait_msg)
+{
+ wxFSFile *f;
+ char *buf;
+ int sz;
+ wxString string;
+ wxBusyInfo *busyinfo = (show_wait_msg) ? new wxBusyInfo(_("Importing help file : \n") + book -> m_Title) : NULL;
+
+ HP_Parser parser;
+ HP_TagHandler *handler = new HP_TagHandler(book);
+ parser.AddTagHandler(handler);
+
+ f = fsys.OpenFile(contentsfile);
+ if (f) {
+ sz = f -> GetStream() -> StreamSize();
+ buf = (char*) malloc(sz+1);
+ buf[sz] = 0;
+ f -> GetStream() -> Read(buf, sz);
+ delete f;
+ handler -> ReadIn(m_Contents, m_ContentsCnt);
+ parser.Parse(buf);
+ handler -> WriteOut(m_Contents, m_ContentsCnt);
+ free(buf);
+ }
+
+ f = fsys.OpenFile(indexfile);
+ if (f) {
+ sz = f -> GetStream() -> StreamSize();
+ buf = (char*) malloc(sz+1);
+ buf[sz] = 0;
+ f -> GetStream() -> Read(buf, sz);
+ delete f;
+ handler -> ReadIn(m_Index, m_IndexCnt);
+ parser.Parse(buf);
+ handler -> WriteOut(m_Index, m_IndexCnt);
+ free(buf);
+ }
+ if (show_wait_msg) delete busyinfo;
+}
+
+
+
+
+
+
+void wxHtmlHelpController::LoadCachedBook(HtmlBookRecord *book, wxInputStream *f)
+{
+ int i, st;
+ int x;
+
+ /* load contents : */
+
+ f -> Read(&x, sizeof(x));
+ st = m_ContentsCnt;
+ m_ContentsCnt += x;
+ m_Contents = (HtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt / HTML_REALLOC_STEP + 1) * HTML_REALLOC_STEP * sizeof(HtmlContentsItem));
+ for (i = st; i < m_ContentsCnt; i++) {
+ f -> Read(&x, sizeof(x));
+ m_Contents[i].m_Level = x;
+ f -> Read(&x, sizeof(x));
+ m_Contents[i].m_ID = x;
+ f -> Read(&x, sizeof(x));
+ m_Contents[i].m_Name = (char*) malloc(x);
+ f -> Read(m_Contents[i].m_Name, x);
+ f -> Read(&x, sizeof(x));
+ m_Contents[i].m_Page = (char*) malloc(x);
+ f -> Read(m_Contents[i].m_Page, x);
+ m_Contents[i].m_Book = book;
+ }
+
+ /* load index : */
+
+ f -> Read(&x, sizeof(x));
+ st = m_IndexCnt;
+ m_IndexCnt += x;
+ m_Index = (HtmlContentsItem*) realloc(m_Index, (m_IndexCnt / HTML_REALLOC_STEP + 1) * HTML_REALLOC_STEP * sizeof(HtmlContentsItem));
+ for (i = st; i < m_IndexCnt; i++) {
+ f -> Read(&x, sizeof(x));
+ m_Index[i].m_Name = (char*) malloc(x);
+ f -> Read(m_Index[i].m_Name, x);
+ f -> Read(&x, sizeof(x));
+ m_Index[i].m_Page = (char*) malloc(x);
+ f -> Read(m_Index[i].m_Page, x);
+ m_Index[i].m_Book = book;
+ }
+}
+
+
+
+
+
+
+void wxHtmlHelpController::SaveCachedBook(HtmlBookRecord *book, wxOutputStream *f)
+{
+ int i;
+ int x;
+
+ /* save contents : */
+
+ x = 0;
+ for (i = 0; i < m_ContentsCnt; i++) if (m_Contents[i].m_Book == book && m_Contents[i].m_Level > 0) x++;
+ f -> Write(&x, sizeof(x));
+ for (i = 0; i < m_ContentsCnt; i++) {
+ if (m_Contents[i].m_Book != book || m_Contents[i].m_Level == 0) continue;
+ x = m_Contents[i].m_Level;
+ f -> Write(&x, sizeof(x));
+ x = m_Contents[i].m_ID;
+ f -> Write(&x, sizeof(x));
+ x = strlen(m_Contents[i].m_Name) + 1;
+ f -> Write(&x, sizeof(x));
+ f -> Write(m_Contents[i].m_Name, x);
+ x = strlen(m_Contents[i].m_Page) + 1;
+ f -> Write(&x, sizeof(x));
+ f -> Write(m_Contents[i].m_Page, x);
+ }
+
+ /* save index : */
+
+ x = 0;
+ for (i = 0; i < m_IndexCnt; i++) if (m_Index[i].m_Book == book && m_Index[i].m_Level > 0) x++;
+ f -> Write(&x, sizeof(x));
+ for (i = 0; i < m_IndexCnt; i++) {
+ if (m_Index[i].m_Book != book || m_Index[i].m_Level == 0) continue;
+ x = strlen(m_Index[i].m_Name) + 1;
+ f -> Write(&x, sizeof(x));
+ f -> Write(m_Index[i].m_Name, x);
+ x = strlen(m_Index[i].m_Page) + 1;
+ f -> Write(&x, sizeof(x));
+ f -> Write(m_Index[i].m_Page, x);
+ }
+}
+
+#endif
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlparser.cpp
+// Purpose: wxHtmlParser class (generic parser)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/tokenzr.h>
+#include <wx/wfstream.h>
+#include <wx/url.h>
+#include <wx/html/htmldefs.h>
+#include <wx/html/htmlparser.h>
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlParser
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxHtmlParser,wxObject)
+
+
+wxObject* wxHtmlParser::Parse(const wxString& source)
+{
+ wxObject *result;
+
+ InitParser(source);
+ DoParsing();
+ result = GetProduct();
+ DoneParser();
+ return result;
+}
+
+
+
+void wxHtmlParser::InitParser(const wxString& source)
+{
+ m_Source = source;
+ m_Cache = new wxHtmlTagsCache(m_Source);
+}
+
+
+
+void wxHtmlParser::DoneParser()
+{
+ delete m_Cache;
+ m_Cache = NULL;
+}
+
+
+
+#define HTML_MAX_BUFLEN 1024
+
+void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
+{
+ char temp[HTML_BUFLEN], c;
+ int i;
+ int templen;
+
+ templen = 0;
+ i = begin_pos;
+
+ while (i < end_pos) {
+ c = m_Source[i];
+
+ // continue building word:
+ if (c != '<') {
+ temp[templen++] = c;
+ if (templen == HTML_BUFLEN-1) {
+ temp[templen] = 0;
+ AddText(temp);
+ templen = 0;
+ }
+ i++;
+ }
+
+ else if (c == '<') {
+ wxHtmlTag tag(m_Source, i, end_pos, m_Cache);
+
+ if (templen) {
+ temp[templen] = 0;
+ AddText(temp);
+ templen = 0;
+ }
+ AddTag(tag);
+ if (tag.HasEnding()) i = tag.GetEndPos2();
+ else i = tag.GetBeginPos();
+ }
+ }
+
+ if (templen) { // last word of block :-(
+ temp[templen] = 0;
+ AddText(temp);
+ }
+}
+
+
+
+void wxHtmlParser::AddTag(const wxHtmlTag& tag)
+{
+ wxHtmlTagHandler *h;
+ bool inner = FALSE;
+
+ h = (wxHtmlTagHandler*) m_HandlersHash.Get(tag.GetName());
+ if (h)
+ inner = h -> HandleTag(tag);
+ if (!inner) {
+ if (tag.HasEnding())
+ DoParsing(tag.GetBeginPos(), tag.GetEndPos1());
+ }
+}
+
+
+
+void wxHtmlParser::AddTagHandler(wxHtmlTagHandler *handler)
+{
+ wxString s(handler -> GetSupportedTags());
+ wxStringTokenizer tokenizer(s, ", ");
+
+#if (wxVERSION_NUMBER < 2100)
+ while (tokenizer.HasMoreToken())
+#else
+ while (tokenizer.HasMoreTokens())
+#endif
+ m_HandlersHash.Put(tokenizer.NextToken(), handler);
+
+ if (m_HandlersList.IndexOf(handler) == wxNOT_FOUND)
+ m_HandlersList.Append(handler);
+
+ handler -> SetParser(this);
+}
+
+
+
+wxHtmlParser::~wxHtmlParser()
+{
+ m_HandlersHash.Clear();
+ m_HandlersList.DeleteContents(TRUE);
+ m_HandlersList.Clear();
+}
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlTagHandler
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxHtmlTagHandler,wxObject)
+
+#endif
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmltag.cpp
+// Purpose: wxHtmlTag class (represents single tag)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/html/htmltag.h>
+#include <stdarg.h>
+
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlTagsCache
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_CLASS(wxHtmlTagsCache,wxObject)
+
+#define CACHE_INCREMENT 64
+
+wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
+{
+ const char *src = source.c_str();
+ int i, tg, pos, stpos;
+ int lng = source.Length();
+ char dummy[256];
+
+ m_Cache = NULL;
+ m_CacheSize = 0;
+ m_CachePos = 0;
+
+ pos = 0;
+ while (pos < lng) {
+ if (src[pos] == '<') { // tag found:
+ if (m_CacheSize % CACHE_INCREMENT == 0)
+ m_Cache = (sCacheItem*) realloc(m_Cache, (m_CacheSize + CACHE_INCREMENT) * sizeof(sCacheItem));
+ tg = m_CacheSize++;
+ m_Cache[tg].Key = stpos = pos++;
+ dummy[0] = 0; i = 0;
+ while ((src[pos] != '>') && (src[pos] != ' ')) {
+ dummy[i] = src[pos++];
+ if ((dummy[i] >= 'a') && (dummy[i] <= 'z')) dummy[i] -= ('a' - 'A');
+ i++;
+ }
+ dummy[i] = 0;
+ m_Cache[tg].Name = (char*) malloc(i+1);
+ memcpy(m_Cache[tg].Name, dummy, i+1);
+
+ while (src[pos] != '>') pos++;
+
+ if (src[stpos+1] == '/') { // ending tag:
+ m_Cache[tg].End1 = m_Cache[tg].End2 = -2;
+ // find matching begin tag:
+ for (i = tg; i >= 0; i--)
+ if ((m_Cache[i].End1 == -1) && (strcmp(m_Cache[i].Name, dummy+1) == 0)) {
+ m_Cache[i].End1 = stpos;
+ m_Cache[i].End2 = pos + 1;
+ break;
+ }
+ }
+ else {
+ m_Cache[tg].End1 = m_Cache[tg].End2 = -1;
+ }
+ }
+
+ pos++;
+ }
+
+ // ok, we're done, now we'll free .Name members of cache - we don't need it anymore:
+ for (i = 0; i < m_CacheSize; i++) {
+ free(m_Cache[i].Name);
+ m_Cache[i].Name = NULL;
+ }
+}
+
+
+
+void wxHtmlTagsCache::QueryTag(int at, int* end1, int* end2)
+{
+ if (m_Cache == NULL) return;
+ if (m_Cache[m_CachePos].Key != at) {
+ int delta = (at < m_Cache[m_CachePos].Key) ? -1 : 1;
+ do {m_CachePos += delta;} while (m_Cache[m_CachePos].Key != at);
+ }
+ *end1 = m_Cache[m_CachePos].End1;
+ *end2 = m_Cache[m_CachePos].End2;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlTag
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_CLASS(wxHtmlTag,wxObject)
+
+wxHtmlTag::wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache* cache) : wxObject()
+{
+ int i;
+ char c;
+
+ // fill-in name, params and begin pos:
+ m_Name = m_Params = wxEmptyString;
+ i = pos+1;
+ if (source[i] == '/') {m_Ending = TRUE; i++;}
+ else m_Ending = FALSE;
+
+ while ((i < end_pos) && ((c = source[i++]) != ' ') && (c != '>')) {
+ if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
+ m_Name += c;
+ }
+
+ if (source[i-1] != '>')
+ while ((i < end_pos) && ((c = source[i++]) != '>')) {
+ if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
+ m_Params += c;
+ if (c == '"') {
+ while ((i < end_pos) && ((c = source[i++]) != '"')) m_Params += c;
+ m_Params += c;
+ }
+ }
+ m_Begin = i;
+
+ cache -> QueryTag(pos, &m_End1, &m_End2);
+ if (m_End1 > end_pos) m_End1 = end_pos;
+ if (m_End2 > end_pos) m_End2 = end_pos;
+}
+
+
+
+bool wxHtmlTag::HasParam(const wxString& par) const
+{
+ const char *st = m_Params, *p = par;
+ const char *st2, *p2;
+
+ if (*st == 0) return FALSE;
+ if (*p == 0) return FALSE;
+ for (st2 = st, p2 = p; ; st2++) {
+ if (*p2 == 0) return TRUE;
+ if (*st2 == 0) return FALSE;
+ if (*p2 != *st2) p2 = p;
+ if (*p2 == *st2) p2++;
+ if (*st2 == ' ') p2 = p;
+ else if (*st2 == '=') {
+ p2 = p;
+ while (*st2 != ' ') {
+ if (*st2 == '"') {
+ st2++;
+ while (*st2 != '"') st2++;
+ }
+ st2++;
+ if (*st2 == 0) return FALSE;
+ }
+ }
+ }
+}
+
+
+
+wxString wxHtmlTag::GetParam(const wxString& par, bool with_commas) const
+{
+ const char *st = m_Params, *p = par;
+ const char *st2, *p2;
+ bool comma;
+
+ if (*st == 0) return "";
+ if (*p == 0) return "";
+ for (st2 = st, p2 = p; ; st2++) {
+ if (*p2 == 0) { // found
+ wxString fnd = "";
+ st2++; // '=' character
+ comma = FALSE;
+ if (!with_commas && (*(st2) == '"')) {st2++; comma = TRUE;}
+ while (*st2 != 0) {
+ if (*st2 == '"') comma = !comma;
+ else if ((*st2 == ' ') && (!comma)) break;
+ fnd += (*(st2++));
+ }
+ if (!with_commas && (*(st2-1) == '"')) fnd.RemoveLast();
+ return fnd;
+ }
+ if (*st2 == 0) return "";
+ if (*p2 != *st2) p2 = p;
+ if (*p2 == *st2) p2++;
+ if (*st2 == ' ') p2 = p;
+ else if (*st2 == '=') {
+ p2 = p;
+ while (*st2 != ' ') {
+ if (*st2 == '"') {
+ st2++;
+ while (*st2 != '"') st2++;
+ }
+ st2++;
+ }
+ }
+ }
+}
+
+
+
+void wxHtmlTag::ScanParam(const wxString& par, char *format, ...) const
+{
+ va_list argptr;
+ wxString parval = GetParam(par);
+
+ va_start(argptr, format);
+
+#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__VISUALC__)
+ sscanf((const char*)parval, format, va_arg(argptr, void *));
+#else
+ vsscanf((const char*)parval, format, argptr);
+#endif
+
+/*
+ --- vsscanf is not defined under Cygwin or Mingw32 or M$ Visual C++ environment
+ if this module doesn't compile with your compiler,
+ modify the def statement and let me know. Thanks...
+
+ So far wxHtml functions are scanning only _one_ value
+ so I workarounded this by supposing that there is only
+ one ...-parameter
+*/
+
+ va_end(argptr);
+}
+
+#endif
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlwin.cpp
+// Purpose: wxHtmlWindow class for parsing & displaying HTML (implementation)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/html/htmlwin.h>
+
+#include <wx/html/forcelink.h>
+
+///// This is my own wxBusyCursor. It works only with one window.
+
+#if (defined __WXGTK__) && (wxVERSION_NUMBER < 2100)
+class wxLocalBusyCursor
+#else
+class wxLocalBusyCursor : public wxBusyCursor
+#endif
+{
+ private:
+ wxWindow *m_Wnd;
+ public:
+#if (defined __WXGTK__) && (wxVERSION_NUMBER < 2100)
+ wxLocalBusyCursor(wxWindow *w) {m_Wnd = w; m_Wnd -> SetCursor(*wxHOURGLASS_CURSOR);}
+ ~wxLocalBusyCursor() {m_Wnd -> SetCursor(*wxSTANDARD_CURSOR);}
+#else
+ wxLocalBusyCursor(wxWindow *w) : wxBusyCursor() {}
+#endif
+};
+
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlWindow
+//-----------------------------------------------------------------------------
+
+
+
+#include <wx/arrimpl.cpp>
+WX_DEFINE_OBJARRAY(HtmlHistoryArray)
+
+
+wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
+ const wxString& name, bool scrollable) : wxScrolledWindow(parent, id, pos, size, wxVSCROLL, name)
+{
+ m_tmpMouseMoved = FALSE;
+ m_tmpCanDraw = TRUE;
+ m_FS = new wxFileSystem();
+ m_RelatedStatusBar = -1;
+ m_RelatedFrame = NULL;
+ m_TitleFormat = "%s";
+ m_OpenedPage = m_OpenedAnchor = wxEmptyString;
+ m_Cell = NULL;
+ m_Parser = new wxHtmlWinParser(this);
+ m_Parser -> SetFS(m_FS);
+ SetBorders(10);
+ m_HistoryPos = -1;
+ m_HistoryOn = TRUE;
+ m_Scrollable = scrollable;
+ SetPage("<html><body></body></html>");
+}
+
+
+
+wxHtmlWindow::~wxHtmlWindow()
+{
+ HistoryClear();
+
+ if (m_Cell) delete m_Cell;
+
+ wxList *parser_data = m_Parser -> GetTempData();
+ if (parser_data) delete parser_data;
+
+ delete m_Parser;
+ delete m_FS;
+}
+
+
+
+void wxHtmlWindow::SetRelatedFrame(wxFrame* frame, const wxString& format)
+{
+ m_RelatedFrame = frame;
+ m_TitleFormat = format;
+}
+
+
+
+void wxHtmlWindow::SetRelatedStatusBar(int bar)
+{
+ m_RelatedStatusBar = bar;
+}
+
+
+
+void wxHtmlWindow::SetFonts(wxString normal_face, int normal_italic_mode, wxString fixed_face, int fixed_italic_mode, int *sizes)
+{
+ m_Parser -> SetFonts(normal_face, normal_italic_mode, fixed_face, fixed_italic_mode, sizes);
+ if (!m_OpenedPage.IsEmpty()) LoadPage(m_OpenedPage);
+}
+
+
+
+bool wxHtmlWindow::SetPage(const wxString& source)
+{
+ wxClientDC *dc = new wxClientDC(this);
+
+ dc -> SetMapMode(wxMM_TEXT);
+ SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
+ m_OpenedPage = m_OpenedAnchor = wxEmptyString;
+ m_Parser -> SetDC(dc);
+ if (m_Cell) delete m_Cell;
+ m_Cell = (wxHtmlContainerCell*) m_Parser -> Parse(source);
+ delete dc;
+ m_Cell -> SetIndent(m_Borders, HTML_INDENT_ALL, HTML_UNITS_PIXELS);
+ m_Cell -> SetAlignHor(HTML_ALIGN_CENTER);
+ CreateLayout();
+ Refresh();
+ return TRUE;
+}
+
+
+bool wxHtmlWindow::LoadPage(const wxString& location)
+{
+ wxFSFile *f;
+ bool rt_val;
+ wxLocalBusyCursor b(this);
+
+ m_tmpCanDraw = FALSE;
+ if (m_HistoryOn && (m_HistoryPos != -1)) { // store scroll position into history item
+ int x, y;
+ ViewStart(&x, &y);
+ m_History[m_HistoryPos].SetPos(y);
+ }
+
+ if (location[0] == '#') { // local anchor
+ wxString anch = location.Mid(1) /*1 to end*/;
+ m_tmpCanDraw = TRUE;
+ rt_val = ScrollToAnchor(anch);
+ }
+
+ else {
+ // load&display it:
+ if (m_RelatedStatusBar != -1) {
+ m_RelatedFrame -> SetStatusText(_("Connecting..."), m_RelatedStatusBar);
+ Refresh();
+ }
+
+ f = m_FS -> OpenFile(location);
+ if (f == NULL) {
+ wxString err;
+
+ err.Printf(_("The browser is unable to open requested location :\n\n%s"), WXSTRINGCAST location);
+ wxMessageBox(err, "Error");
+ m_tmpCanDraw = TRUE;
+ return FALSE;
+ }
+
+ else {
+ wxNode *node;
+ wxString src = wxEmptyString;
+
+ if (m_RelatedStatusBar != -1) {
+ wxString msg = _("Loading : ") + location;
+ m_RelatedFrame -> SetStatusText(msg, m_RelatedStatusBar);
+ Refresh();
+ }
+
+ node = m_Filters.GetFirst();
+ while (node){
+ wxHtmlFilter *h = (wxHtmlFilter*) node -> GetData();
+ if (h -> CanRead(*f)) {
+ src = h -> ReadFile(*f);
+ break;
+ }
+ node = node -> GetNext();
+ }
+ if (src == wxEmptyString) src = m_DefaultFilter.ReadFile(*f);
+
+ m_FS -> ChangePathTo(f -> GetLocation());
+ rt_val = SetPage(src);
+ m_OpenedPage = f -> GetLocation();
+ if (f -> GetAnchor() != wxEmptyString) {
+ m_tmpCanDraw = TRUE;
+ ScrollToAnchor(f -> GetAnchor());
+ m_tmpCanDraw = FALSE;
+ }
+
+ delete f;
+
+ if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(_("Done"), m_RelatedStatusBar);
+ }
+ }
+
+ if (m_HistoryOn) { // add this page to history there:
+ int c = m_History.GetCount() - (m_HistoryPos + 1);
+
+ m_HistoryPos++;
+ for (int i = 0; i < c; i++)
+ m_History.Remove(m_HistoryPos);
+ m_History.Add(new HtmlHistoryItem(m_OpenedPage, m_OpenedAnchor));
+ }
+
+ m_tmpCanDraw = TRUE;
+ Refresh();
+ return rt_val;
+}
+
+
+
+bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
+{
+ const wxHtmlCell *c = m_Cell -> Find(HTML_COND_ISANCHOR, &anchor);
+ if (!c) return FALSE;
+ else {
+ int y;
+
+ for (y = 0; c != NULL; c = c -> GetParent()) y += c -> GetPosY();
+ Scroll(-1, y / HTML_SCROLL_STEP);
+ m_OpenedAnchor = anchor;
+ return TRUE;
+ }
+}
+
+
+void wxHtmlWindow::SetTitle(const wxString& title)
+{
+ if (m_RelatedFrame) {
+ wxString tit;
+ tit.Printf(m_TitleFormat, title.c_str());
+ m_RelatedFrame -> SetTitle(tit);
+ }
+}
+
+
+
+
+
+void wxHtmlWindow::CreateLayout()
+{
+ int ClientWidth, ClientHeight;
+
+ if (!m_Cell) return;
+ GetClientSize(&ClientWidth, &ClientHeight);
+ m_Cell -> Layout(ClientWidth);
+ if (m_Scrollable)
+ SetScrollbars(HTML_SCROLL_STEP, HTML_SCROLL_STEP,
+ m_Cell -> GetWidth() / HTML_SCROLL_STEP,
+ m_Cell -> GetHeight() / HTML_SCROLL_STEP
+ /*cheat: top-level frag is always container*/ );
+}
+
+
+
+void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
+{
+ wxString oldpath;
+ wxString tmp;
+
+ if (path != wxEmptyString) {
+ oldpath = cfg -> GetPath();
+ cfg -> SetPath(path);
+ }
+
+ m_Borders = cfg -> Read("wxHtmlWindow/Borders", m_Borders);
+ m_Parser -> m_FontFaceFixed = cfg -> Read("wxHtmlWindow/FontFaceFixed", m_Parser -> m_FontFaceFixed);
+ m_Parser -> m_FontFaceNormal = cfg -> Read("wxHtmlWindow/FontFaceNormal", m_Parser -> m_FontFaceNormal);
+ m_Parser -> m_ItalicModeFixed = cfg -> Read("wxHtmlWindow/ItalicModeFixed", m_Parser -> m_ItalicModeFixed);
+ m_Parser -> m_ItalicModeNormal = cfg -> Read("wxHtmlWindow/ItalicModeNormal", m_Parser -> m_ItalicModeNormal);
+ for (int i = 0; i < 7; i++) {
+ tmp.Printf("wxHtmlWindow/FontsSize%i", i);
+ m_Parser -> m_FontsSizes[i] = cfg -> Read(tmp, m_Parser -> m_FontsSizes[i]);
+ }
+
+ if (path != wxEmptyString)
+ cfg -> SetPath(oldpath);
+}
+
+
+
+void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
+{
+ wxString oldpath;
+ wxString tmp;
+
+ if (path != wxEmptyString) {
+ oldpath = cfg -> GetPath();
+ cfg -> SetPath(path);
+ }
+
+ cfg -> Write("wxHtmlWindow/Borders", (long) m_Borders);
+ cfg -> Write("wxHtmlWindow/FontFaceFixed", m_Parser -> m_FontFaceFixed);
+ cfg -> Write("wxHtmlWindow/FontFaceNormal", m_Parser -> m_FontFaceNormal);
+ cfg -> Write("wxHtmlWindow/ItalicModeFixed", (long) m_Parser -> m_ItalicModeFixed);
+ cfg -> Write("wxHtmlWindow/ItalicModeNormal", (long) m_Parser -> m_ItalicModeNormal);
+ for (int i = 0; i < 7; i++) {
+ tmp.Printf("wxHtmlWindow/FontsSize%i", i);
+ cfg -> Write(tmp, (long) m_Parser -> m_FontsSizes[i]);
+ }
+
+ if (path != wxEmptyString)
+ cfg -> SetPath(oldpath);
+}
+
+
+
+bool wxHtmlWindow::HistoryBack()
+{
+ wxString a, l;
+
+ if (m_HistoryPos < 1) return FALSE;
+
+ m_HistoryPos--;
+
+ l = m_History[m_HistoryPos].GetPage();
+ a = m_History[m_HistoryPos].GetAnchor();
+ m_HistoryOn = FALSE;
+ if (a == wxEmptyString) LoadPage(l);
+ else LoadPage(l + "#" + a);
+ m_HistoryOn = TRUE;
+ Scroll(0, m_History[m_HistoryPos].GetPos());
+ Refresh();
+ return TRUE;
+}
+
+
+
+bool wxHtmlWindow::HistoryForward()
+{
+ wxString a, l;
+
+ if (m_HistoryPos == -1) return FALSE;
+ if (m_HistoryPos >= (int)m_History.GetCount() - 1)return FALSE;
+
+ m_OpenedPage = wxEmptyString; // this will disable adding new entry into history in LoadPage()
+
+ m_HistoryPos++;
+ l = m_History[m_HistoryPos].GetPage();
+ a = m_History[m_HistoryPos].GetAnchor();
+ m_HistoryOn = FALSE;
+ if (a == wxEmptyString) LoadPage(l);
+ else LoadPage(l + "#" + a);
+ m_HistoryOn = TRUE;
+ Scroll(0, m_History[m_HistoryPos].GetPos());
+ Refresh();
+ return TRUE;
+}
+
+
+
+void wxHtmlWindow::HistoryClear()
+{
+ m_History.Empty();
+ m_HistoryPos = -1;
+}
+
+
+
+wxList wxHtmlWindow::m_Filters;
+wxHtmlFilterPlainText wxHtmlWindow::m_DefaultFilter;
+
+void wxHtmlWindow::AddFilter(wxHtmlFilter *filter)
+{
+ m_Filters.DeleteContents(TRUE);
+ m_Filters.Append(filter);
+}
+
+
+
+
+void wxHtmlWindow::OnLinkClicked(const wxString& link)
+{
+ LoadPage(link);
+}
+
+
+
+void wxHtmlWindow::OnDraw(wxDC& dc)
+{
+ int x, y;
+ wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
+ int v_y, v_h;
+
+ if (!m_tmpCanDraw) return;
+ dc.SetMapMode(wxMM_TEXT);
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
+ ::SetMapMode((HDC)dc.GetHDC(), MM_TEXT);
+#endif
+ dc.SetBackgroundMode(wxTRANSPARENT);
+ ViewStart(&x, &y);
+
+ while (upd) {
+ v_y = upd.GetY();
+ v_h = upd.GetH();
+ if (m_Cell) m_Cell -> Draw(dc, 0, 0, y * HTML_SCROLL_STEP + v_y, y * HTML_SCROLL_STEP + v_h + v_y);
+ upd++;
+ }
+}
+
+
+
+
+void wxHtmlWindow::OnSize(wxSizeEvent& event)
+{
+ wxScrolledWindow::OnSize(event);
+ CreateLayout();
+}
+
+
+
+void wxHtmlWindow::OnKeyDown(wxKeyEvent& event)
+{
+ int dummy;
+ int sty, szy, cliy;
+
+ ViewStart(&dummy, &sty);
+ GetClientSize(&dummy, &cliy); cliy /= HTML_SCROLL_STEP;
+ GetVirtualSize(&dummy, &szy); szy /= HTML_SCROLL_STEP;
+
+ switch (event.KeyCode()) {
+ case WXK_PAGEUP :
+ case WXK_PRIOR :
+ Scroll(-1, sty - cliy);
+ break;
+ case WXK_PAGEDOWN :
+ case WXK_NEXT :
+ Scroll(-1, sty + cliy);
+ break;
+ case WXK_HOME :
+ Scroll(-1, 0);
+ break;
+ case WXK_END :
+ Scroll(-1, szy - cliy);
+ break;
+ case WXK_UP :
+ Scroll(-1, sty - 1);
+ break;
+ case WXK_DOWN :
+ Scroll(-1, sty + 1);
+ break;
+ }
+}
+
+
+
+void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event)
+{
+ m_tmpMouseMoved = TRUE;
+
+ if (event.ButtonDown()) {
+ int sx, sy;
+ wxPoint pos;
+ wxString lnk;
+
+ ViewStart(&sx, &sy); sx *= HTML_SCROLL_STEP; sy *= HTML_SCROLL_STEP;
+ pos = event.GetPosition();
+
+ if (m_Cell)
+ m_Cell -> OnMouseClick(this, sx + pos.x, sy + pos.y, event.ButtonDown(1), event.ButtonDown(2), event.ButtonDown(3));
+ }
+}
+
+
+
+void wxHtmlWindow::OnIdle(wxIdleEvent& event)
+{
+ static wxCursor cur_hand(wxCURSOR_HAND), cur_arrow(wxCURSOR_ARROW);
+
+ if (m_tmpMouseMoved && (m_Cell != NULL)) {
+ int sx, sy;
+ int x, y;
+ wxString lnk;
+
+ ViewStart(&sx, &sy); sx *= HTML_SCROLL_STEP; sy *= HTML_SCROLL_STEP;
+ wxGetMousePosition(&x, &y);
+ ScreenToClient(&x, &y);
+ lnk = m_Cell -> GetLink(sx + x, sy + y);
+
+ if (lnk == wxEmptyString) {
+ SetCursor(cur_arrow);
+ if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(wxEmptyString, m_RelatedStatusBar);
+ }
+ else {
+ SetCursor(cur_hand);
+ if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(lnk, m_RelatedStatusBar);
+ }
+ m_tmpMouseMoved = FALSE;
+ }
+}
+
+
+
+
+IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindow,wxScrolledWindow)
+
+BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow)
+ EVT_SIZE(wxHtmlWindow::OnSize)
+ EVT_LEFT_DOWN(wxHtmlWindow::OnMouseEvent)
+ EVT_MOTION(wxHtmlWindow::OnMouseEvent)
+ EVT_IDLE(wxHtmlWindow::OnIdle)
+ EVT_KEY_DOWN(wxHtmlWindow::OnKeyDown)
+END_EVENT_TABLE()
+
+
+
+
+
+
+
+
+///// default mod handlers are forced there:
+
+FORCE_LINK(mod_layout)
+FORCE_LINK(mod_fonts)
+FORCE_LINK(mod_image)
+FORCE_LINK(mod_list)
+FORCE_LINK(mod_pre)
+FORCE_LINK(mod_hline)
+FORCE_LINK(mod_links)
+FORCE_LINK(mod_tables)
+
+
+#endif
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: htmlwinparser.cpp
+// Purpose: wxHtmlParser class (generic parser)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/html/htmldefs.h>
+#include <wx/html/htmlwinparser.h>
+#include <wx/html/htmlwin.h>
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlWinParser
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxHtmlWinParser,wxHtmlParser)
+
+wxList wxHtmlWinParser::m_Modules;
+
+wxHtmlWinParser::wxHtmlWinParser(wxWindow *wnd) : wxHtmlParser()
+{
+ m_Window = wnd;
+ m_Container = NULL;
+ m_DC = NULL;
+ m_CharHeight = m_CharWidth = 0;
+ m_UseLink = FALSE;
+
+ {
+ int i, j, k, l, m;
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
+ for (k = 0; k < 2; k++)
+ for (l = 0; l < 2; l++)
+ for (m = 0; m < 7; m++)
+ m_FontsTable[i][j][k][l][m] = NULL;
+#ifdef __WXMSW__
+ int default_sizes[7] = {7, 8, 10, 12, 16, 22, 30};
+#else
+ int default_sizes[7] = {10, 12, 14, 16, 19, 24, 32};
+#endif
+ SetFonts("", wxSLANT, "", wxSLANT, default_sizes);
+ }
+
+ // fill in wxHtmlParser's tables:
+ wxNode *node = m_Modules.GetFirst();
+ while (node){
+ wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node -> GetData();
+ mod -> FillHandlersTable(this);
+ node = node -> GetNext();
+ }
+}
+
+
+
+void wxHtmlWinParser::AddModule(wxHtmlTagsModule *module)
+{
+ m_Modules.Append(module);
+}
+
+
+
+void wxHtmlWinParser::SetFonts(wxString normal_face, int normal_italic_mode, wxString fixed_face, int fixed_italic_mode, int *sizes)
+{
+ for (int i = 0; i < 7; i++) m_FontsSizes[i] = sizes[i];
+ m_FontFaceFixed = fixed_face;
+ m_FontFaceNormal = normal_face;
+ m_ItalicModeFixed = fixed_italic_mode;
+ m_ItalicModeNormal = normal_italic_mode;
+}
+
+
+
+void wxHtmlWinParser::InitParser(const wxString& source)
+{
+ wxHtmlParser::InitParser(source);
+ wxASSERT_MSG(m_DC != NULL, _("no DC assigned to wxHtmlWinParser!!"));
+
+ m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE;
+ m_FontSize = 0;
+ CreateCurrentFont(); // we're selecting default font into
+ m_DC -> GetTextExtent("H", &m_CharWidth, &m_CharHeight);
+ /* NOTE : we're not using GetCharWidth/Height() because
+ of differences under X and win
+ */
+
+ m_Link = "";
+ m_LinkColor.Set(0, 0, 0xFF);
+ m_ActualColor.Set(0, 0, 0);
+ m_Align = HTML_ALIGN_LEFT;
+ m_tmpLastWasSpace = FALSE;
+
+ OpenContainer();
+
+ OpenContainer();
+ m_Container -> InsertCell(new wxHtmlColourCell(m_ActualColor));
+ m_Container -> InsertCell(new wxHtmlFontCell(CreateCurrentFont()));
+}
+
+
+
+void wxHtmlWinParser::DoneParser()
+{
+ m_Container = NULL;
+ wxHtmlParser::DoneParser();
+}
+
+
+
+wxObject* wxHtmlWinParser::GetProduct()
+{
+ wxHtmlContainerCell *top;
+
+ CloseContainer();
+ OpenContainer();
+ GetContainer() -> SetIndent(m_CharHeight, HTML_INDENT_TOP);
+ top = m_Container;
+ while (top -> GetParent()) top = top -> GetParent();
+ return top;
+}
+
+
+
+wxList* wxHtmlWinParser::GetTempData()
+{
+ int i, j, k, l, m;
+ wxFont *f;
+ wxList *lst = wxHtmlParser::GetTempData();
+
+ if (lst == NULL) lst = new wxList;
+ lst -> DeleteContents(TRUE);
+
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
+ for (k = 0; k < 2; k++)
+ for (l = 0; l < 2; l++)
+ for (m = 0; m < 7; m++) {
+ f = m_FontsTable[i][j][k][l][m];
+ if (f) lst -> Append(f);
+ }
+ return lst;
+}
+
+
+
+void wxHtmlWinParser::AddText(const char* txt)
+{
+ wxHtmlCell *c;
+ int i = 0, x, lng = strlen(txt);
+ char temp[HTML_BUFLEN];
+ register char d;
+ int templen = 0;
+
+ if (m_tmpLastWasSpace) {
+ while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++;
+ }
+
+ while (i < lng) {
+ x = 0;
+ d = temp[templen++] = txt[i];
+ if ((d == '\n') || (d == '\r') || (d == ' ') || (d == '\t')) {
+ i++, x++;
+ while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++, x++;
+ }
+ else i++;
+
+ if (x) {
+ temp[templen-1] = ' ';
+ temp[templen] = 0;
+ templen = 0;
+ c = new wxHtmlWordCell(temp, *(GetDC()));
+ if (m_UseLink) c -> SetLink(m_Link);
+ m_Container -> InsertCell(c);
+ m_tmpLastWasSpace = TRUE;
+ }
+ }
+ if (templen) {
+ temp[templen] = 0;
+ c = new wxHtmlWordCell(temp, *(GetDC()));
+ if (m_UseLink) c -> SetLink(m_Link);
+ m_Container -> InsertCell(c);
+ m_tmpLastWasSpace = FALSE;
+ }
+}
+
+
+
+wxHtmlContainerCell* wxHtmlWinParser::OpenContainer()
+{
+ m_Container = new wxHtmlContainerCell(m_Container);
+ m_Container -> SetAlignHor(m_Align);
+ m_tmpLastWasSpace = TRUE;
+ /* to avoid space being first character in paragraph */
+ return m_Container;
+}
+
+
+
+wxHtmlContainerCell* wxHtmlWinParser::SetContainer(wxHtmlContainerCell *c)
+{
+ m_tmpLastWasSpace = TRUE;
+ /* to avoid space being first character in paragraph */
+ return m_Container = c;
+}
+
+
+
+wxHtmlContainerCell* wxHtmlWinParser::CloseContainer()
+{
+ m_Container = m_Container -> GetParent();
+ return m_Container;
+}
+
+
+
+wxFont* wxHtmlWinParser::CreateCurrentFont()
+{
+ int fb = GetFontBold(),
+ fi = GetFontItalic(),
+ fu = GetFontUnderlined(),
+ ff = GetFontFixed(),
+ fs = GetFontSize() + 2 /*remap from <-2;4> to <0;7>*/ ;
+
+ if (m_FontsTable[fb][fi][fu][ff][fs] == NULL) {
+ m_FontsTable[fb][fi][fu][ff][fs] =
+ //wxTheFontList -> FindOrCreateFont(
+ new wxFont(
+ m_FontsSizes[fs],
+ ff ? wxMODERN : wxSWISS,
+ fi ? (ff ? m_ItalicModeFixed : m_ItalicModeNormal) : wxNORMAL,
+ fb ? wxBOLD : wxNORMAL,
+ fu ? TRUE : FALSE, ff ? m_FontFaceFixed : m_FontFaceNormal);
+ }
+ m_DC -> SetFont(*(m_FontsTable[fb][fi][fu][ff][fs]));
+ return (m_FontsTable[fb][fi][fu][ff][fs]);
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlWinTagHandler
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxHtmlWinTagHandler, wxHtmlTagHandler)
+
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlTagsModule
+//-----------------------------------------------------------------------------
+
+
+IMPLEMENT_DYNAMIC_CLASS(wxHtmlTagsModule, wxModule)
+
+
+bool wxHtmlTagsModule::OnInit()
+{
+ wxHtmlWinParser::AddModule(this);
+ return TRUE;
+}
+
+
+
+void wxHtmlTagsModule::OnExit()
+{
+}
+
+#endif
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: mod_fonts.cpp
+// Purpose: wxHtml module for fonts & colors of fonts
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/html/forcelink.h>
+#include <wx/html/mod_templ.h>
+
+FORCE_LINK_ME(mod_fonts)
+
+
+TAG_HANDLER_BEGIN(FONT, "FONT")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ unsigned long tmp;
+ wxColour oldclr = m_WParser -> GetActualColor();
+ int oldsize = m_WParser -> GetFontSize();
+
+ if (tag.HasParam("COLOR")) {
+ wxColour clr;
+ tag.ScanParam("COLOR", "#%lX", &tmp);
+ clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
+ m_WParser -> SetActualColor(clr);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr));
+ }
+
+ if (tag.HasParam("SIZE")) {
+ tag.ScanParam("SIZE", "%li", &tmp);
+ m_WParser -> SetFontSize(tmp);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ }
+
+ ParseInner(tag);
+
+ if (oldclr != m_WParser -> GetActualColor()) {
+ m_WParser -> SetActualColor(oldclr);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr));
+ }
+ if (oldsize != m_WParser -> GetFontSize()) {
+ m_WParser -> SetFontSize(oldsize);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ }
+ return TRUE;
+ }
+
+TAG_HANDLER_END(FONT)
+
+
+TAG_HANDLER_BEGIN(FACES, "U,I,B,TT")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ int fixed = m_WParser -> GetFontFixed(),
+ italic = m_WParser -> GetFontItalic(),
+ underlined = m_WParser -> GetFontUnderlined(),
+ bold = m_WParser -> GetFontBold();
+
+ if (tag.GetName() == "U")
+ m_WParser -> SetFontUnderlined(TRUE);
+ else if (tag.GetName() == "B")
+ m_WParser -> SetFontBold(TRUE);
+ else if (tag.GetName() == "I")
+ m_WParser -> SetFontItalic(TRUE);
+ else
+ m_WParser -> SetFontFixed(TRUE);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+
+ ParseInner(tag);
+
+ m_WParser -> SetFontUnderlined(underlined);
+ m_WParser -> SetFontBold(bold);
+ m_WParser -> SetFontItalic(italic);
+ m_WParser -> SetFontFixed(fixed);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ return TRUE;
+ }
+
+TAG_HANDLER_END(FACES)
+
+
+
+
+
+TAG_HANDLER_BEGIN(Hx, "H1,H2,H3,H4,H5,H6")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ int old_size, old_b, old_i, old_u, old_f, old_al;
+ wxHtmlContainerCell *c;
+
+ old_size = m_WParser -> GetFontSize();
+ old_b = m_WParser -> GetFontBold();
+ old_i = m_WParser -> GetFontItalic();
+ old_u = m_WParser -> GetFontUnderlined();
+ old_f = m_WParser -> GetFontFixed();
+ old_al = m_WParser -> GetAlign();
+
+ m_WParser -> SetFontBold(TRUE);
+ m_WParser -> SetFontItalic(FALSE);
+ m_WParser -> SetFontUnderlined(FALSE);
+ m_WParser -> SetFontFixed(FALSE);
+
+ if (tag.GetName() == "H1")
+ m_WParser -> SetFontSize(+4);
+ else if (tag.GetName() == "H2")
+ m_WParser -> SetFontSize(+3);
+ else if (tag.GetName() == "H3")
+ m_WParser -> SetFontSize(+2);
+ else if (tag.GetName() == "H4") {
+ m_WParser -> SetFontSize(+2);
+ m_WParser -> SetFontItalic(TRUE);
+ m_WParser -> SetFontBold(FALSE);
+ }
+ else if (tag.GetName() == "H5")
+ m_WParser -> SetFontSize(+1);
+ else if (tag.GetName() == "H6") {
+ m_WParser -> SetFontSize(+1);
+ m_WParser -> SetFontItalic(TRUE);
+ m_WParser -> SetFontBold(FALSE);
+ }
+
+ c = m_WParser -> GetContainer();
+ if (c -> GetFirstCell()) {
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ c = m_WParser -> GetContainer();
+ }
+ c = m_WParser -> GetContainer();
+
+ c -> SetAlign(tag);
+ c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_TOP);
+ m_WParser -> SetAlign(c -> GetAlignHor());
+
+ ParseInner(tag);
+
+ m_WParser -> SetFontSize(old_size);
+ m_WParser -> SetFontBold(old_b);
+ m_WParser -> SetFontItalic(old_i);
+ m_WParser -> SetFontUnderlined(old_u);
+ m_WParser -> SetFontFixed(old_f);
+ m_WParser -> SetAlign(old_al);
+
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ c = m_WParser -> GetContainer();
+ c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_TOP);
+
+ return TRUE;
+ }
+
+TAG_HANDLER_END(Hx)
+
+
+
+
+TAGS_MODULE_BEGIN(Fonts)
+
+ TAGS_MODULE_ADD(FONT)
+ TAGS_MODULE_ADD(FACES)
+ TAGS_MODULE_ADD(Hx)
+
+TAGS_MODULE_END(Fonts)
+
+
+#endif
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: mod_hline.cpp
+// Purpose: wxHtml module for horizontal line (HR tag)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/html/forcelink.h>
+#include <wx/html/mod_templ.h>
+
+#include <wx/html/htmlcell.h>
+
+FORCE_LINK_ME(mod_hline)
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlLineCell
+//-----------------------------------------------------------------------------
+
+class wxHtmlLineCell : public wxHtmlCell
+{
+ public:
+ wxHtmlLineCell(int size) : wxHtmlCell() {m_Height = size;}
+ void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+ void Layout(int w) {m_Width = w; if (m_Next) m_Next -> Layout(w);}
+};
+
+
+void wxHtmlLineCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ wxBrush mybrush("BLACK", wxSOLID);
+ wxPen mypen("BLACK", 1, wxSOLID);
+ dc.SetBrush(mybrush);
+ dc.SetPen(mypen);
+ dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
+ wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// The list handler:
+//-----------------------------------------------------------------------------
+
+
+TAG_HANDLER_BEGIN(HR, "HR")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ wxHtmlContainerCell *c;
+ int sz;
+
+ m_WParser -> CloseContainer();
+ c = m_WParser -> OpenContainer();
+
+ c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_VERTICAL);
+ c -> SetAlignHor(HTML_ALIGN_CENTER);
+ c -> SetAlign(tag);
+ c -> SetWidthFloat(tag);
+ if (tag.HasParam("SIZE")) tag.ScanParam("SIZE", "%i", &sz);
+ else sz = 1;
+ c -> InsertCell(new wxHtmlLineCell(sz));
+
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+
+ return FALSE;
+ }
+
+TAG_HANDLER_END(HR)
+
+
+
+
+
+TAGS_MODULE_BEGIN(HLine)
+
+ TAGS_MODULE_ADD(HR)
+
+TAGS_MODULE_END(HLine)
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: mod_image.cpp
+// Purpose: wxHtml module for displaying images
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/html/forcelink.h>
+#include <wx/html/mod_templ.h>
+
+#include <wx/wxhtml.h>
+#include <wx/image.h>
+
+FORCE_LINK_ME(mod_image)
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlImageCell
+// Image/bitmap
+//--------------------------------------------------------------------------------
+
+class wxHtmlImageCell : public wxHtmlCell
+{
+ public:
+ wxBitmap *m_Image;
+
+ wxHtmlImageCell(wxFSFile *input, int w = -1, int h = -1, int align = HTML_ALIGN_BOTTOM);
+ ~wxHtmlImageCell() {if (m_Image) delete m_Image;}
+ void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+};
+
+
+
+//--------------------------------------------------------------------------------
+// wxHtmlImageCell
+//--------------------------------------------------------------------------------
+
+wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, int align) : wxHtmlCell()
+{
+ wxImage *img;
+ int ww, hh;
+ wxString m = input -> GetMimeType();
+ wxInputStream *s = input -> GetStream();
+
+#if wxVERSION_NUMBER < 2100
+/* NOTE : use this *old* code only if you have old 2.0.1 wxWindows distribution
+ and don't want to upgrade it with stuffs from add-on/wxwin201 */
+ if (wxMimeTypesManager::IsOfType(m, "image/png")) img = new wxImage(*s, wxBITMAP_TYPE_PNG);
+ else if (wxMimeTypesManager::IsOfType(m, "image/jpeg")) img = new wxImage(*s, wxBITMAP_TYPE_JPEG);
+ else if (wxMimeTypesManager::IsOfType(m, "image/bmp")) img = new wxImage(*s, wxBITMAP_TYPE_BMP);
+ else if (wxMimeTypesManager::IsOfType(m, "image/gif")) img = new wxImage(*s, wxBITMAP_TYPE_GIF);
+ else if (wxMimeTypesManager::IsOfType(m, "image/tiff")) img = new wxImage(*s, wxBITMAP_TYPE_TIF);
+ else if (wxMimeTypesManager::IsOfType(m, "image/xpm")) img = new wxImage(*s, wxBITMAP_TYPE_XPM);
+ else if (wxMimeTypesManager::IsOfType(m, "image/xbm")) img = new wxImage(*s, wxBITMAP_TYPE_XBM);
+ else img = NULL;
+#else
+ img = new wxImage(*s, m);
+#endif
+
+ m_Image = NULL;
+ if (img && (img -> Ok())) {
+ ww = img -> GetWidth();
+ hh = img -> GetHeight();
+ if (w != -1) m_Width = w; else m_Width = ww;
+ if (h != -1) m_Height = h; else m_Height = hh;
+ if ((m_Width != ww) || (m_Height != hh)) {
+ wxImage img2 = img -> Scale(m_Width, m_Height);
+ m_Image = new wxBitmap(img2.ConvertToBitmap());
+ }
+ else
+ m_Image = new wxBitmap(img -> ConvertToBitmap());
+ delete img;
+ }
+ switch (align) {
+ case HTML_ALIGN_TOP :
+ m_Descent = m_Height; break;
+ case HTML_ALIGN_CENTER :
+ m_Descent = m_Height / 2; break;
+ case HTML_ALIGN_BOTTOM : default :
+ m_Descent = 0; break;
+ }
+}
+
+
+
+void wxHtmlImageCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ if (m_Image)
+ dc.DrawBitmap(*m_Image, x + m_PosX, y + m_PosY, TRUE);
+ wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+}
+
+
+
+
+
+//--------------------------------------------------------------------------------
+// tag handler
+//--------------------------------------------------------------------------------
+
+TAG_HANDLER_BEGIN(IMG, "IMG")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ if (tag.HasParam("SRC")) {
+ int w = -1, h = -1;
+ int al;
+ wxFSFile *str;
+ wxString tmp = tag.GetParam("SRC");
+
+ str = m_WParser -> GetFS() -> OpenFile(tmp);
+ if (tag.HasParam("WIDTH")) tag.ScanParam("WIDTH", "%i", &w);
+ if (tag.HasParam("HEIGHT")) tag.ScanParam("HEIGHT", "%i", &h);
+ al = HTML_ALIGN_BOTTOM;
+ if (tag.HasParam("ALIGN")) {
+ wxString alstr = tag.GetParam("ALIGN");
+ alstr.MakeUpper(); // for the case alignment was in ".."
+ if (alstr == "TEXTTOP") al = HTML_ALIGN_TOP;
+ else if ((alstr == "CENTER") || (alstr == "ABSCENTER")) al = HTML_ALIGN_CENTER;
+ }
+ if (str) {
+ wxHtmlCell *cel = new wxHtmlImageCell(str, w, h, al);
+ cel -> SetLink(m_WParser -> GetLink());
+ m_WParser -> GetContainer() -> InsertCell(cel);
+ delete str;
+ }
+ }
+
+ return FALSE;
+ }
+
+TAG_HANDLER_END(IMAGE)
+
+
+
+TAGS_MODULE_BEGIN(Image)
+
+ TAGS_MODULE_ADD(IMG)
+
+TAGS_MODULE_END(Image)
+
+
+#endif
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: mod_layout.cpp
+// Purpose: wxHtml module for basic paragraphs/layout handling
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/html/forcelink.h>
+#include <wx/html/mod_templ.h>
+
+#include <wx/html/htmlwin.h>
+
+FORCE_LINK_ME(mod_layout)
+
+
+TAG_HANDLER_BEGIN(P, "P")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ }
+ m_WParser -> GetContainer() -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_TOP);
+ m_WParser -> GetContainer() -> SetAlign(tag);
+ return FALSE;
+ }
+
+TAG_HANDLER_END(P)
+
+
+
+TAG_HANDLER_BEGIN(BR, "BR")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ int al = m_WParser -> GetContainer() -> GetAlignHor();
+ wxHtmlContainerCell *c;
+
+ m_WParser -> CloseContainer();
+ c = m_WParser -> OpenContainer();
+ c -> SetAlignHor(al);
+ c -> SetAlign(tag);
+ return FALSE;
+ }
+
+TAG_HANDLER_END(BR)
+
+
+
+TAG_HANDLER_BEGIN(CENTER, "CENTER")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ int old = m_WParser -> GetAlign();
+ wxHtmlContainerCell *c = m_WParser -> GetContainer();
+
+ m_WParser -> SetAlign(HTML_ALIGN_CENTER);
+ if (c -> GetFirstCell() != NULL) {
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ }
+ else
+ c -> SetAlignHor(HTML_ALIGN_CENTER);
+
+ if (tag.HasEnding()) {
+ ParseInner(tag);
+
+ m_WParser -> SetAlign(old);
+ if (c -> GetFirstCell() != NULL) {
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ }
+ else
+ c -> SetAlignHor(old);
+
+ return TRUE;
+ }
+ else return FALSE;
+ }
+
+TAG_HANDLER_END(CENTER)
+
+
+
+TAG_HANDLER_BEGIN(DIV, "DIV")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ int old = m_WParser -> GetAlign();
+ wxHtmlContainerCell *c = m_WParser -> GetContainer();
+ if (c -> GetFirstCell() != NULL) {
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ c = m_WParser -> GetContainer();
+ c -> SetAlign(tag);
+ m_WParser -> SetAlign(c -> GetAlignHor());
+ }
+ else {
+ c -> SetAlign(tag);
+ m_WParser -> SetAlign(c -> GetAlignHor());
+ }
+
+ ParseInner(tag);
+
+ m_WParser -> SetAlign(old);
+ if (c -> GetFirstCell() != NULL) {
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ }
+ else
+ c -> SetAlignHor(old);
+
+ return TRUE;
+ }
+
+TAG_HANDLER_END(DIV)
+
+
+
+
+TAG_HANDLER_BEGIN(TITLE, "TITLE")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ if (m_WParser -> GetWindow()) {
+ wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser -> GetWindow());
+ if (wfr) {
+ wxString title = "";
+ wxString *src = m_WParser -> GetSource();
+
+ for (int i = tag.GetBeginPos(); i < tag.GetEndPos1(); i++) title += (*src)[i];
+ wfr -> SetTitle(title);
+ }
+ }
+ return TRUE;
+ }
+
+TAG_HANDLER_END(TITLE)
+
+
+
+
+TAG_HANDLER_BEGIN(BODY, "BODY")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ unsigned long tmp;
+ wxColour clr;
+
+ if (tag.HasParam("TEXT")) {
+ tag.ScanParam("TEXT", "#%lX", &tmp);
+ clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
+ m_WParser -> SetActualColor(clr);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr));
+ }
+
+ if (tag.HasParam("LINK")) {
+ tag.ScanParam("LINK", "#%lX", &tmp);
+ clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
+ m_WParser -> SetLinkColor(clr);
+ }
+
+ if (tag.HasParam("BGCOLOR")) {
+ tag.ScanParam("BGCOLOR", "#%lX", &tmp);
+ clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr, HTML_CLR_BACKGROUND));
+ if (m_WParser -> GetWindow() != NULL)
+ m_WParser -> GetWindow() -> SetBackgroundColour(clr);
+ }
+ return FALSE;
+ }
+
+TAG_HANDLER_END(BODY)
+
+
+
+TAG_HANDLER_BEGIN(BLOCKQUOTE, "BLOCKQUOTE")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ wxHtmlContainerCell *c;
+
+ m_WParser -> CloseContainer();
+ c = m_WParser -> OpenContainer();
+ if (c -> GetAlignHor() == HTML_ALIGN_RIGHT)
+ c -> SetIndent(5 * m_WParser -> GetCharWidth(), HTML_INDENT_RIGHT);
+ else
+ c -> SetIndent(5 * m_WParser -> GetCharWidth(), HTML_INDENT_LEFT);
+ c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_TOP);
+ m_WParser -> OpenContainer();
+ ParseInner(tag);
+ c = m_WParser -> CloseContainer();
+ c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_BOTTOM);
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ return TRUE;
+ }
+
+TAG_HANDLER_END(BLOCKQUOTE)
+
+
+
+
+
+
+TAGS_MODULE_BEGIN(Layout)
+
+ TAGS_MODULE_ADD(P)
+ TAGS_MODULE_ADD(BR)
+ TAGS_MODULE_ADD(CENTER)
+ TAGS_MODULE_ADD(DIV)
+ TAGS_MODULE_ADD(TITLE)
+ TAGS_MODULE_ADD(BODY)
+ TAGS_MODULE_ADD(BLOCKQUOTE)
+
+TAGS_MODULE_END(Layout)
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: mod_links.cpp
+// Purpose: wxHtml module for links & anchors
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/html/forcelink.h>
+#include <wx/html/mod_templ.h>
+#include <wx/wxhtml.h>
+
+FORCE_LINK_ME(mod_links)
+
+
+class wxHtmlAnchorCell : public wxHtmlCell
+{
+ private:
+ wxString m_AnchorName;
+
+ public:
+ wxHtmlAnchorCell(const wxString& name) : wxHtmlCell() {m_AnchorName = name;}
+ virtual const wxHtmlCell* Find(int condition, const void* param) const
+ {
+ if ((condition == HTML_COND_ISANCHOR) && (m_AnchorName == (*((const wxString*)param))))
+ return this;
+ else
+ return wxHtmlCell::Find(condition, param);
+ }
+};
+
+
+
+TAG_HANDLER_BEGIN(A, "A")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ if (tag.HasParam("NAME")) {
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlAnchorCell(tag.GetParam("NAME")));
+ }
+
+ if (tag.HasParam("HREF")) {
+ wxString oldlnk = m_WParser -> GetLink();
+ wxColour oldclr = m_WParser -> GetActualColor();
+ int oldund = m_WParser -> GetFontUnderlined();
+
+ m_WParser -> SetActualColor(m_WParser -> GetLinkColor());
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(m_WParser -> GetLinkColor()));
+ m_WParser -> SetFontUnderlined(TRUE);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser -> SetLink(tag.GetParam("HREF"));
+
+ ParseInner(tag);
+
+ m_WParser -> SetLink(oldlnk);
+ m_WParser -> SetFontUnderlined(oldund);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser -> SetActualColor(oldclr);
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr));
+
+ return TRUE;
+ }
+ else return FALSE;
+ }
+
+TAG_HANDLER_END(A)
+
+
+
+TAGS_MODULE_BEGIN(Links)
+
+ TAGS_MODULE_ADD(A)
+
+TAGS_MODULE_END(Links)
+
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: mod_list.cpp
+// Purpose: wxHtml module for lists
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/html/forcelink.h>
+#include <wx/html/mod_templ.h>
+
+#include <wx/html/htmlcell.h>
+
+FORCE_LINK_ME(mod_list)
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlListmarkCell
+//-----------------------------------------------------------------------------
+
+class wxHtmlListmarkCell : public wxHtmlCell
+{
+ private:
+ wxBrush m_Brush;
+ public:
+ wxHtmlListmarkCell(wxDC *dc, const wxColour& clr);
+ void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+};
+
+wxHtmlListmarkCell::wxHtmlListmarkCell(wxDC* dc, const wxColour& clr) : wxHtmlCell(), m_Brush(clr, wxSOLID)
+{
+ m_Width = dc -> GetCharWidth();
+ m_Height = dc -> GetCharHeight();
+ m_Descent = 0;
+}
+
+
+
+void wxHtmlListmarkCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ dc.SetBrush(m_Brush);
+ dc.DrawEllipse(x + m_PosX + m_Width / 4, y + m_PosY + m_Height / 4, m_Width / 2, m_Width / 2);
+ wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// The list handler:
+//-----------------------------------------------------------------------------
+
+
+TAG_HANDLER_BEGIN(OLULLI, "OL,UL,LI")
+
+ TAG_HANDLER_VARS
+ int m_Numbering;
+ // this is number of actual item of list or 0 for dots
+
+ TAG_HANDLER_CONSTR(OLULLI)
+ {
+ m_Numbering = 0;
+ }
+
+ TAG_HANDLER_PROC(tag)
+ {
+ wxHtmlContainerCell *c;
+
+ // List Item:
+ if (tag.GetName() == "LI") {
+ if (!tag.IsEnding()) {
+ m_WParser -> CloseContainer();
+ m_WParser -> CloseContainer();
+
+ c = m_WParser -> OpenContainer();
+ c -> SetWidthFloat(2 * m_WParser -> GetCharWidth(), HTML_UNITS_PIXELS);
+ c -> SetAlignHor(HTML_ALIGN_RIGHT);
+ if (m_Numbering == 0)
+ c -> InsertCell(new wxHtmlListmarkCell(m_WParser -> GetDC(), m_WParser -> GetActualColor()));
+ else {
+ wxString mark;
+ mark.Printf("%i.", m_Numbering);
+ c -> InsertCell(new wxHtmlWordCell(mark, *(m_WParser -> GetDC())));
+ }
+ m_WParser -> CloseContainer();
+
+ c = m_WParser -> OpenContainer();
+ c -> SetIndent(m_WParser -> GetCharWidth() / 4, HTML_INDENT_LEFT);
+ c -> SetWidthFloat(-2 * m_WParser -> GetCharWidth(), HTML_UNITS_PIXELS);
+
+ m_WParser -> OpenContainer();
+
+ if (m_Numbering != 0) m_Numbering++;
+ }
+ return FALSE;
+ }
+
+ // Begin of List (not-numbered): "UL", "OL"
+ else {
+ int oldnum = m_Numbering;
+
+ if (tag.GetName() == "UL") m_Numbering = 0;
+ else m_Numbering = 1;
+
+ c = m_WParser -> GetContainer();
+ if (c -> GetFirstCell() != NULL) {
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ c = m_WParser -> GetContainer();
+ }
+ c -> SetAlignHor(HTML_ALIGN_LEFT);
+ c -> SetIndent(2 * m_WParser -> GetCharWidth(), HTML_INDENT_LEFT);
+ m_WParser -> OpenContainer() -> SetAlignVer(HTML_ALIGN_TOP);
+
+ m_WParser -> OpenContainer();
+ m_WParser -> OpenContainer();
+ ParseInner(tag);
+ m_WParser -> CloseContainer();
+
+ m_WParser -> CloseContainer();
+ m_WParser -> CloseContainer();
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+
+ m_Numbering = oldnum;
+ return TRUE;
+ }
+ }
+
+TAG_HANDLER_END(OLULLI)
+
+
+TAGS_MODULE_BEGIN(List)
+
+ TAGS_MODULE_ADD(OLULLI)
+
+TAGS_MODULE_END(List)
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: mod_pre.cpp
+// Purpose: wxHtml module for <PRE> ... </PRE> tag (code citation)
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#include <wx/html/forcelink.h>
+#include <wx/html/mod_templ.h>
+
+#include <wx/html/htmlcell.h>
+#include <wx/tokenzr.h>
+
+FORCE_LINK_ME(mod_pre)
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlCodeCell
+//-----------------------------------------------------------------------------
+
+class wxHtmlPRECell : public wxHtmlCell
+{
+ private:
+ wxString** m_Text;
+ // list of wxString objects.
+ int m_LinesCnt;
+ // number of lines
+ int m_LineHeight;
+ // height of single line of text
+
+ public:
+ wxHtmlPRECell(const wxString& s, wxDC& dc);
+ ~wxHtmlPRECell();
+ void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+};
+
+
+wxHtmlPRECell::wxHtmlPRECell(const wxString& s, wxDC& dc) : wxHtmlCell()
+{
+ wxStringTokenizer tokenizer(s, "\n");
+ wxString tmp;
+ long int x, z;
+ int i;
+
+ m_LineHeight = dc.GetCharHeight();
+ m_LinesCnt = 0;
+ m_Text = NULL;
+ m_Width = m_Height = 0;
+
+ i = 0;
+#if (wxVERSION_NUMBER < 2100)
+ while (tokenizer.HasMoreToken()) {
+#else
+ while (tokenizer.HasMoreTokens()) {
+#endif
+ if (i % 10 == 0) m_Text = (wxString**) realloc(m_Text, sizeof(wxString*) * (i + 10));
+ tmp = tokenizer.NextToken();
+ tmp.Replace(" ", " ", TRUE);
+ tmp.Replace(""", "\"", TRUE);
+ tmp.Replace("<", "<", TRUE);
+ tmp.Replace(">", ">", TRUE);
+ tmp.Replace("&", "&", TRUE);
+ tmp.Replace("\t", " ", TRUE);
+ tmp.Replace("\r", "", TRUE);
+ m_Text[i++] = new wxString(tmp);
+
+ dc.GetTextExtent(tmp, &x, &z, &z);
+ if (x > m_Width) m_Width = x;
+ m_Height += m_LineHeight;
+ m_LinesCnt++;
+ }
+}
+
+
+
+wxHtmlPRECell::~wxHtmlPRECell()
+{
+ for (int i = 0; i < m_LinesCnt; i++) delete m_Text[i];
+ free(m_Text);
+}
+
+
+void wxHtmlPRECell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+{
+ for (int i = 0; i < m_LinesCnt; i++)
+ dc.DrawText(*(m_Text[i]), x + m_PosX, y + m_PosY + m_LineHeight * i);
+
+ wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// The list handler:
+//-----------------------------------------------------------------------------
+
+
+TAG_HANDLER_BEGIN(PRE, "PRE")
+
+ TAG_HANDLER_PROC(tag)
+ {
+ wxHtmlContainerCell *c;
+
+ int fixed = m_WParser -> GetFontFixed(),
+ italic = m_WParser -> GetFontItalic(),
+ underlined = m_WParser -> GetFontUnderlined(),
+ bold = m_WParser -> GetFontBold(),
+ fsize = m_WParser -> GetFontSize();
+
+ m_WParser -> CloseContainer();
+ c = m_WParser -> OpenContainer();
+ c -> SetAlignHor(HTML_ALIGN_LEFT);
+ c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_VERTICAL);
+
+ m_WParser -> SetFontUnderlined(FALSE);
+ m_WParser -> SetFontBold(FALSE);
+ m_WParser -> SetFontItalic(FALSE);
+ m_WParser -> SetFontFixed(TRUE);
+ m_WParser -> SetFontSize(0);
+ c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+
+ {
+ wxString cit;
+ cit = m_WParser -> GetSource() -> Mid(tag.GetBeginPos(), tag.GetEndPos1() - tag.GetBeginPos());
+ c -> InsertCell(new wxHtmlPRECell(cit, *(m_WParser -> GetDC())));
+ }
+
+ m_WParser -> SetFontUnderlined(underlined);
+ m_WParser -> SetFontBold(bold);
+ m_WParser -> SetFontItalic(italic);
+ m_WParser -> SetFontFixed(fixed);
+ m_WParser -> SetFontSize(fsize);
+ c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+
+ m_WParser -> CloseContainer();
+ m_WParser -> OpenContainer();
+ return TRUE;
+ }
+
+TAG_HANDLER_END(PRE)
+
+
+
+
+
+TAGS_MODULE_BEGIN(Pre)
+
+ TAGS_MODULE_ADD(PRE)
+
+TAGS_MODULE_END(Pre)
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: mod_tables.cpp
+// Purpose: wxHtml module for tables
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+/*
+REMARKS:
+ 1. This version of mod_tables doesn't support auto-layout algorithm.
+ This means that all columns are of same width unless explicitly specified.
+*/
+
+
+#include <wx/html/forcelink.h>
+#include <wx/html/mod_templ.h>
+
+#include <wx/html/htmlcell.h>
+
+FORCE_LINK_ME(mod_tables)
+
+
+#define TABLE_BORDER_CLR_1 wxColour(0xC5, 0xC2, 0xC5)
+#define TABLE_BORDER_CLR_2 wxColour(0x62, 0x61, 0x62)
+
+
+//-----------------------------------------------------------------------------
+// wxHtmlTableCell
+//-----------------------------------------------------------------------------
+
+
+typedef struct {
+ int width, units; // universal
+ int leftpos, pixwidth, maxrealwidth; // temporary (depends on width of table)
+ } colStruct;
+
+typedef enum {
+ cellSpan,
+ cellUsed,
+ cellFree
+ } cellState;
+
+typedef struct {
+ wxHtmlContainerCell *cont;
+ int colspan, rowspan;
+ int minheight, valign;
+ cellState flag;
+ } cellStruct;
+
+
+class wxHtmlTableCell : public wxHtmlContainerCell
+{
+ protected:
+ /* These are real attributes: */
+ bool m_HasBorders;
+ // should we draw borders or not?
+ int m_NumCols, m_NumRows;
+ // number of columns; rows
+ colStruct *m_ColsInfo;
+ // array of column information
+ cellStruct **m_CellInfo;
+ // 2D array of all cells in the table : m_CellInfo[row][column]
+ int m_Spacing;
+ // spaces between cells
+ int m_Padding;
+ // cells internal indentation
+
+ private:
+ /* ...and these are valid only during parsing of table: */
+ int m_ActualCol, m_ActualRow;
+ // number of actual column (ranging from 0..m_NumCols)
+
+ // default values (for table and row):
+ int m_tBkg, m_rBkg;
+ wxString m_tValign, m_rValign;
+
+
+ public:
+ wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& tag);
+ ~wxHtmlTableCell();
+ virtual void Layout(int w);
+
+ void AddRow(const wxHtmlTag& tag);
+ void AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag);
+ private:
+ void ReallocCols(int cols);
+ void ReallocRows(int rows);
+ // reallocates memory to given number of cols/rows
+ // and changes m_NumCols/m_NumRows value to reflect this change
+ // NOTE! You CAN'T change m_NumCols/m_NumRows before calling this!!
+};
+
+
+
+wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& tag)
+ : wxHtmlContainerCell(parent)
+{
+ m_HasBorders = tag.HasParam("BORDER");
+ m_ColsInfo = NULL;
+ m_NumCols = m_NumRows = 0;
+ m_CellInfo = NULL;
+ m_ActualCol = m_ActualRow = -1;
+
+ /* scan params: */
+ m_tBkg = m_rBkg = -1;
+ if (tag.HasParam("BGCOLOR")) tag.ScanParam("BGCOLOR", "#%lX", &m_tBkg);
+ if (tag.HasParam("VALIGN")) m_tValign = tag.GetParam("VALIGN"); else m_tValign = wxEmptyString;
+ if (tag.HasParam("CELLSPACING")) tag.ScanParam("CELLSPACING", "%i", &m_Spacing); else m_Spacing = 2;
+ if (tag.HasParam("CELLPADDING")) tag.ScanParam("CELLPADDING", "%i", &m_Padding); else m_Padding = 3;
+
+ if (m_HasBorders)
+ SetBorder(TABLE_BORDER_CLR_1, TABLE_BORDER_CLR_2);
+}
+
+
+
+wxHtmlTableCell::~wxHtmlTableCell()
+{
+ if (m_ColsInfo) free(m_ColsInfo);
+ if (m_CellInfo) {
+ for (int i = 0; i < m_NumRows; i++)
+ free(m_CellInfo[i]);
+ free(m_CellInfo);
+ }
+}
+
+
+
+void wxHtmlTableCell::ReallocCols(int cols)
+{
+ int i,j;
+
+ for (i = 0; i < m_NumRows; i++) {
+ m_CellInfo[i] = (cellStruct*) realloc(m_CellInfo[i], sizeof(cellStruct) * cols);
+ for (j = m_NumCols; j < cols; j++)
+ m_CellInfo[i][j].flag = cellFree;
+ }
+
+ m_ColsInfo = (colStruct*) realloc(m_ColsInfo, sizeof(colStruct) * cols);
+ for (j = m_NumCols; j < cols; j++) {
+ m_ColsInfo[j].width = 0;
+ m_ColsInfo[j].units = HTML_UNITS_PERCENT;
+ }
+
+ m_NumCols = cols;
+}
+
+
+
+void wxHtmlTableCell::ReallocRows(int rows)
+{
+ m_CellInfo = (cellStruct**) realloc(m_CellInfo, sizeof(cellStruct*) * rows);
+ if (m_NumCols != 0) {
+ int x = rows - 1;
+ m_CellInfo[x] = (cellStruct*) malloc(sizeof(cellStruct) * m_NumCols);
+ for (int i = 0; i < m_NumCols; i++)
+ m_CellInfo[x][i].flag = cellFree;
+ }
+ else
+ m_CellInfo[rows - 1] = NULL;
+ m_NumRows = rows;
+}
+
+
+
+void wxHtmlTableCell::AddRow(const wxHtmlTag& tag)
+{
+ if (m_ActualRow + 1 > m_NumRows - 1)
+ ReallocRows(m_ActualRow + 2);
+ m_ActualRow++;
+ m_ActualCol = -1;
+
+ /* scan params: */
+ m_rBkg = m_tBkg;
+ if (tag.HasParam("BGCOLOR")) tag.ScanParam("BGCOLOR", "#%lX", &m_rBkg);
+ if (tag.HasParam("VALIGN")) m_rValign = tag.GetParam("VALIGN"); else m_rValign = m_tValign;
+}
+
+
+
+void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
+{
+ do {
+ m_ActualCol++;
+ } while ((m_ActualCol < m_NumCols) && (m_CellInfo[m_ActualRow][m_ActualCol].flag != cellFree));
+ if (m_ActualCol > m_NumCols - 1)
+ ReallocCols(m_ActualCol + 1);
+
+ int r = m_ActualRow, c = m_ActualCol;
+
+ m_CellInfo[r][c].cont = cell;
+ m_CellInfo[r][c].colspan = 1;
+ m_CellInfo[r][c].rowspan = 1;
+ m_CellInfo[r][c].flag = cellUsed;
+ m_CellInfo[r][c].minheight = 0;
+ m_CellInfo[r][c].valign = HTML_ALIGN_TOP;
+
+ /* scan for parameters: */
+
+ // width:
+ {
+ if (tag.HasParam("WIDTH")) {
+ wxString wd = tag.GetParam("WIDTH");
+
+ if (wd[wd.Length()-1] == '%') {
+ sscanf(wd.c_str(), "%i%%", &m_ColsInfo[c].width);
+ m_ColsInfo[c].units = HTML_UNITS_PERCENT;
+ }
+ else {
+ sscanf(wd.c_str(), "%i", &m_ColsInfo[c].width);
+ m_ColsInfo[c].units = HTML_UNITS_PIXELS;
+ }
+ }
+ }
+
+
+ // spanning:
+ {
+ if (tag.HasParam("COLSPAN")) tag.ScanParam("COLSPAN", "%i", &m_CellInfo[r][c].colspan);
+ if (tag.HasParam("ROWSPAN")) tag.ScanParam("ROWSPAN", "%i", &m_CellInfo[r][c].rowspan);
+ if ((m_CellInfo[r][c].colspan != 1) || (m_CellInfo[r][c].rowspan != 1)) {
+ int i, j;
+
+ if (r + m_CellInfo[r][c].rowspan > m_NumRows) ReallocRows(r + m_CellInfo[r][c].rowspan);
+ if (c + m_CellInfo[r][c].colspan > m_NumCols) ReallocCols(c + m_CellInfo[r][c].colspan);
+ for (i = r; i < r + m_CellInfo[r][c].rowspan; i++)
+ for (j = c; j < c + m_CellInfo[r][c].colspan; j++)
+ m_CellInfo[i][j].flag = cellSpan;
+ m_CellInfo[r][c].flag = cellUsed;
+ }
+ }
+
+ //background color:
+ {
+ int bk = m_rBkg;
+ if (tag.HasParam("BGCOLOR")) tag.ScanParam("BGCOLOR", "#%lX", &bk);
+ if (bk != -1) {
+ wxColour clr = wxColour((bk & 0xFF0000) >> 16 , (bk & 0x00FF00) >> 8, (bk & 0x0000FF));
+ cell -> SetBackgroundColour(clr);
+ }
+ }
+ if (m_HasBorders)
+ cell -> SetBorder(TABLE_BORDER_CLR_2, TABLE_BORDER_CLR_1);
+
+ // vertical alignment:
+ {
+ wxString valign;
+ if (tag.HasParam("VALIGN")) valign = tag.GetParam("VALIGN"); else valign = m_tValign;
+ valign.MakeUpper();
+ if (valign == "TOP") m_CellInfo[r][c].valign = HTML_ALIGN_TOP;
+ else if (valign == "BOTTOM") m_CellInfo[r][c].valign = HTML_ALIGN_BOTTOM;
+ else m_CellInfo[r][c].valign = HTML_ALIGN_CENTER;
+ }
+
+ cell -> SetIndent(m_Padding, HTML_INDENT_ALL, HTML_UNITS_PIXELS);
+}
+
+
+
+
+
+void wxHtmlTableCell::Layout(int w)
+{
+ /*
+
+ WIDTH ADJUSTING :
+
+ */
+
+ if (m_WidthFloatUnits == HTML_UNITS_PERCENT) {
+ if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
+ else m_Width = m_WidthFloat * w / 100;
+ }
+ else {
+ if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
+ else m_Width = m_WidthFloat;
+ }
+
+
+ /*
+
+ LAYOUTING :
+
+ */
+
+ /* 1. setup columns widths: */
+ {
+ int wpix = m_Width - (m_NumCols + 1) * m_Spacing;
+ int i, j;
+ int wtemp = 0;
+
+ // 1a. setup fixed-width columns:
+ for (i = 0; i < m_NumCols; i++)
+ if (m_ColsInfo[i].units == HTML_UNITS_PIXELS)
+ wpix -= (m_ColsInfo[i].pixwidth = m_ColsInfo[i].width);
+
+ // 1b. setup floating-width columns:
+ for (i = 0; i < m_NumCols; i++)
+ if ((m_ColsInfo[i].units == HTML_UNITS_PERCENT) && (m_ColsInfo[i].width != 0))
+ wtemp += (m_ColsInfo[i].pixwidth = m_ColsInfo[i].width * wpix / 100);
+ wpix -= wtemp;
+
+ // 1c. setup defalut columns (no width specification supplied):
+ // NOTE! This algorithm doesn't conform to HTML standard : it assigns equal widths
+ // instead of optimal
+ for (i = j = 0; i < m_NumCols; i++)
+ if (m_ColsInfo[i].width == 0) j++;
+ for (i = 0; i < m_NumCols; i++)
+ if (m_ColsInfo[i].width == 0)
+ m_ColsInfo[i].pixwidth = wpix / j;
+ }
+
+ /* 2. compute positions of columns: */
+ {
+ int wpos = m_Spacing;
+ for (int i = 0; i < m_NumCols; i++) {
+ m_ColsInfo[i].leftpos = wpos;
+ wpos += m_ColsInfo[i].pixwidth + m_Spacing;
+ }
+ }
+
+ /* 3. sub-layout all cells: */
+ {
+ int *ypos = (int*) malloc(sizeof(int) * (m_NumRows + 1));
+
+ int actcol, actrow;
+ int fullwid;
+ wxHtmlContainerCell *actcell;
+
+ for (actrow = 0; actrow <= m_NumRows; actrow++) ypos[actrow] = m_Spacing;
+
+ for (actrow = 0; actrow < m_NumRows; actrow++) {
+
+ // 3a. sub-layout and detect max height:
+
+ for (actcol = 0; actcol < m_NumCols; actcol++) {
+ if (m_CellInfo[actrow][actcol].flag != cellUsed) continue;
+ actcell = m_CellInfo[actrow][actcol].cont;
+ fullwid = 0;
+ for (int i = actcol; i < m_CellInfo[actrow][actcol].colspan + actcol; i++)
+ fullwid += m_ColsInfo[i].pixwidth;
+ actcell -> SetMinHeight(m_CellInfo[actrow][actcol].minheight, m_CellInfo[actrow][actcol].valign);
+ actcell -> Layout(fullwid);
+
+ if (ypos[actrow] + actcell -> GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing > ypos[actrow + m_CellInfo[actrow][actcol].rowspan])
+ ypos[actrow + m_CellInfo[actrow][actcol].rowspan] =
+ ypos[actrow] + actcell -> GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing;
+ }
+ }
+
+
+ for (actrow = 0; actrow < m_NumRows; actrow++) {
+
+ // 3b. place cells in row & let'em all have same height:
+
+ for (actcol = 0; actcol < m_NumCols; actcol++) {
+ if (m_CellInfo[actrow][actcol].flag != cellUsed) continue;
+ actcell = m_CellInfo[actrow][actcol].cont;
+ actcell -> SetMinHeight(
+ ypos[actrow + m_CellInfo[actrow][actcol].rowspan] - ypos[actrow] - m_CellInfo[actrow][actcol].rowspan * m_Spacing,
+ m_CellInfo[actrow][actcol].valign);
+ fullwid = 0;
+ for (int i = actcol; i < m_CellInfo[actrow][actcol].colspan + actcol; i++)
+ fullwid += m_ColsInfo[i].pixwidth;
+ actcell -> Layout(fullwid);
+ actcell -> SetPos(m_ColsInfo[actcol].leftpos, ypos[actrow]);
+ }
+
+ }
+ m_Height = ypos[m_NumRows];
+ free(ypos);
+ }
+}
+
+
+
+
+
+
+//-----------------------------------------------------------------------------
+// The tables handler:
+//-----------------------------------------------------------------------------
+
+
+TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
+
+ TAG_HANDLER_VARS
+ wxHtmlTableCell* m_Table;
+ wxString m_tAlign, m_rAlign;
+ int m_OldAlign;
+
+ TAG_HANDLER_CONSTR(TABLE)
+ {
+ m_Table = NULL;
+ m_tAlign = m_rAlign = wxEmptyString;
+ m_OldAlign = HTML_ALIGN_LEFT;
+ }
+
+
+ TAG_HANDLER_PROC(tag)
+ {
+ wxHtmlContainerCell *c;
+
+ // new table started, backup upper-level table (if any) and create new:
+ if (tag.GetName() == "TABLE") {
+ wxHtmlTableCell *oldt = m_Table;
+ wxHtmlContainerCell *oldcont;
+ int m_OldAlign;
+
+ oldcont = c = m_WParser -> OpenContainer();
+
+ c -> SetWidthFloat(tag);
+ m_Table = new wxHtmlTableCell(c, tag);
+ m_OldAlign = m_WParser -> GetAlign();
+ m_tAlign = wxEmptyString;
+ if (tag.HasParam("ALIGN")) m_tAlign = tag.GetParam("ALIGN");
+
+ ParseInner(tag);
+
+ m_WParser -> SetAlign(m_OldAlign);
+ m_WParser -> SetContainer(oldcont);
+ m_WParser -> CloseContainer();
+ m_Table = oldt;
+ return TRUE;
+ }
+
+
+ else if (m_Table && !tag.IsEnding()) {
+ // new row in table
+ if (tag.GetName() == "TR") {
+ m_Table -> AddRow(tag);
+ m_rAlign = m_tAlign;
+ if (tag.HasParam("ALIGN")) m_rAlign = tag.GetParam("ALIGN");
+ }
+
+ // new cell
+ else {
+ m_WParser -> SetAlign(m_OldAlign);
+ c = m_WParser -> SetContainer(new wxHtmlContainerCell(m_Table));
+ m_Table -> AddCell(c, tag);
+
+ m_WParser -> OpenContainer();
+
+ if (tag.GetName() == "TH") /*header style*/ {
+ m_WParser -> SetAlign(HTML_ALIGN_CENTER);
+ }
+
+ {
+ wxString als;
+
+ als = m_rAlign;
+ if (tag.HasParam("ALIGN")) als = tag.GetParam("ALIGN");
+ als.MakeUpper();
+ if (als == "RIGHT") m_WParser -> SetAlign(HTML_ALIGN_RIGHT);
+ else if (als == "CENTER") m_WParser -> SetAlign(HTML_ALIGN_CENTER);
+ }
+ m_WParser -> OpenContainer();
+ }
+ }
+ return FALSE;
+ }
+
+TAG_HANDLER_END(TABLE)
+
+
+
+
+
+TAGS_MODULE_BEGIN(Tables)
+
+ TAGS_MODULE_ADD(TABLE)
+
+TAGS_MODULE_END(Tables)
+
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: search.cpp
+// Purpose: search engine
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <wx/wxprec.h>
+
+#include <wx/defs.h>
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include "search.h"
+
+
+
+//--------------------------------------------------------------------------------
+// wxSearchEngine
+//--------------------------------------------------------------------------------
+
+void wxSearchEngine::LookFor(const wxString& keyword)
+{
+ if (m_Keyword) free(m_Keyword);
+ m_Keyword = (char*) malloc(keyword.Length() + 1);
+ strcpy(m_Keyword, keyword.c_str());
+ for (int i = strlen(m_Keyword) - 1; i >= 0; i--)
+ if ((m_Keyword[i] >= 'A') && (m_Keyword[i] <= 'Z'))
+ m_Keyword[i] += 'a' - 'A';
+}
+
+
+
+bool wxSearchEngine::Scan(wxInputStream *stream)
+{
+ wxASSERT_MSG(m_Keyword != NULL, _("wxSearchEngine::LookFor must be called before scanning!"));
+
+ int i, j;
+ int lng = stream -> StreamSize();
+ int wrd = strlen(m_Keyword);
+ bool found = FALSE;
+ char *buf = (char*) malloc(lng + 1);
+ stream -> Read(buf, lng);
+ buf[lng] = 0;
+
+ for (i = 0; i < lng; i++)
+ if ((buf[i] >= 'A') && (buf[i] <= 'Z')) buf[i] += 'a' - 'A';
+
+ for (i = 0; i < lng - wrd; i++) {
+ j = 0;
+ while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
+ if (j == wrd) {found = TRUE; break;}
+ }
+
+ free(buf);
+ return found;
+}
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: search.h
+// Purpose: wxSearchEngine - class for searching keywords
+// Author: Vaclav Slavik
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#if wxUSE_HTML
+
+#ifndef __SEARCH_H__
+#define __SEARCH_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+
+#include <wx/stream.h>
+
+//--------------------------------------------------------------------------------
+// wxSearchEngine
+// This class takes input streams and scans them for occurence
+// of keyword(s)
+//--------------------------------------------------------------------------------
+
+
+class wxSearchEngine : public wxObject
+{
+ private:
+ char *m_Keyword;
+
+ public:
+ wxSearchEngine() : wxObject() {m_Keyword = NULL;}
+ ~wxSearchEngine() {if (m_Keyword) free(m_Keyword);}
+
+ virtual void LookFor(const wxString& keyword);
+ // Sets the keyword we will be searching for
+
+ virtual bool Scan(wxInputStream *stream);
+ // Scans the stream for the keyword.
+ // Returns TRUE if the stream contains keyword, fALSE otherwise
+};
+
+
+
+
+#endif
+
+#endif
\ No newline at end of file
event.cpp \
file.cpp \
fileconf.cpp \
+ filesys.cpp \
+ fs_inet.cpp \
+ fs_zip.cpp \
framecmn.cpp \
ftp.cpp \
gdicmn.cpp \
wfstream.cpp \
wincmn.cpp \
wxexpr.cpp \
+ unzip.c \
+ zipstream.cpp \
zstream.cpp \
\
+ busyinfo.cpp \
caret.cpp \
choicdgg.cpp \
colrdlgg.cpp \
timer.cpp \
toolbar.cpp \
utils.cpp \
- window.cpp
+ window.cpp \
+\
+ htmlcell.cpp \
+ htmlfilter.cpp \
+ htmlhelp.cpp \
+ htmlhelp_io.cpp \
+ htmlparser.cpp \
+ htmltag.cpp \
+ htmlwin.cpp \
+ htmlwinparser.cpp \
+ mod_fonts.cpp \
+ mod_hline.cpp \
+ mod_image.cpp \
+ mod_layout.cpp \
+ mod_links.cpp \
+ mod_list.cpp \
+ mod_pre.cpp \
+ mod_tables.cpp \
+ search.cpp
# propform.cpp \
# proplist.cpp \