*** empty log message ***
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2963 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
8
samples/html/Makefile.am
Normal file
8
samples/html/Makefile.am
Normal file
@@ -0,0 +1,8 @@
|
||||
## 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
|
||||
|
9
samples/html/about/Makefile.am
Normal file
9
samples/html/about/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = 1.3 no-dependencies
|
||||
|
||||
SUFFIXES = .cpp
|
||||
|
||||
DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
|
||||
|
||||
noinst_PROGRAMS = about
|
||||
|
||||
about_SOURCES = about.cpp
|
174
samples/html/about/about.cpp
Normal file
174
samples/html/about/about.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
2
samples/html/about/about.rc
Normal file
2
samples/html/about/about.rc
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "wx/msw/wx.rc"
|
||||
|
17
samples/html/about/data/about.htm
Normal file
17
samples/html/about/data/about.htm
Normal file
@@ -0,0 +1,17 @@
|
||||
<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>
|
BIN
samples/html/about/data/logo.png
Normal file
BIN
samples/html/about/data/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
9
samples/html/help/Makefile.am
Normal file
9
samples/html/help/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = 1.3 no-dependencies
|
||||
|
||||
SUFFIXES = .cpp
|
||||
|
||||
DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
|
||||
|
||||
noinst_PROGRAMS = help
|
||||
|
||||
help_SOURCES = help.cpp
|
85
samples/html/help/help.cpp
Normal file
85
samples/html/help/help.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
2
samples/html/help/help.rc
Normal file
2
samples/html/help/help.rc
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "wx/msw/wx.rc"
|
||||
#include "wx/html/msw/wxhtml.rc"
|
24
samples/html/help/helpfiles/Index.hhk
Normal file
24
samples/html/help/helpfiles/Index.hhk
Normal file
@@ -0,0 +1,24 @@
|
||||
<!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>
|
4
samples/html/help/helpfiles/book1.htm
Normal file
4
samples/html/help/helpfiles/book1.htm
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><title>Book 1</title><body>
|
||||
<h2>Book 1.</h2>
|
||||
How do you enjoy <i> book one</i>??
|
||||
</body></html>
|
5
samples/html/help/helpfiles/book2.htm
Normal file
5
samples/html/help/helpfiles/book2.htm
Normal file
@@ -0,0 +1,5 @@
|
||||
<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>
|
33
samples/html/help/helpfiles/contents.hhc
Normal file
33
samples/html/help/helpfiles/contents.hhc
Normal file
@@ -0,0 +1,33 @@
|
||||
<!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>
|
5
samples/html/help/helpfiles/main.htm
Normal file
5
samples/html/help/helpfiles/main.htm
Normal file
@@ -0,0 +1,5 @@
|
||||
<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>
|
5
samples/html/help/helpfiles/page2-b.htm
Normal file
5
samples/html/help/helpfiles/page2-b.htm
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
<font color="#FF0000" size=+4 face="Tahoma">
|
||||
Hello, you're on sub page of page 2 !!!
|
||||
</font>
|
||||
</body></html>
|
15
samples/html/help/helpfiles/testing.hhp
Normal file
15
samples/html/help/helpfiles/testing.hhp
Normal file
@@ -0,0 +1,15 @@
|
||||
[OPTIONS]
|
||||
Compatibility=1.1
|
||||
Compiled file=testing.chm
|
||||
Contents file=contents.hhc
|
||||
Display compile progress=No
|
||||
Index file=Index.hhk
|
||||
Language=0x405 <20>esky
|
||||
Title=Testing HELPFILE :-)
|
||||
Default topic=main.htm
|
||||
|
||||
[FILES]
|
||||
main.htm
|
||||
book1.htm
|
||||
book2.htm
|
||||
page2-b.htm
|
9
samples/html/printing/Makefile.am
Normal file
9
samples/html/printing/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = 1.3 no-dependencies
|
||||
|
||||
SUFFIXES = .cpp
|
||||
|
||||
DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
|
||||
|
||||
noinst_PROGRAMS = printing
|
||||
|
||||
printing_SOURCES = printing.cpp
|
BIN
samples/html/printing/mondrian.ico
Normal file
BIN
samples/html/printing/mondrian.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
44
samples/html/printing/mondrian.xpm
Normal file
44
samples/html/printing/mondrian.xpm
Normal file
@@ -0,0 +1,44 @@
|
||||
/* 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 ++++ ",
|
||||
" "
|
||||
};
|
BIN
samples/html/printing/pic.png
Normal file
BIN
samples/html/printing/pic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
312
samples/html/printing/printing.cpp
Normal file
312
samples/html/printing/printing.cpp
Normal file
@@ -0,0 +1,312 @@
|
||||
/*
|
||||
* 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());
|
||||
}
|
||||
|
||||
|
||||
|
76
samples/html/printing/printing.h
Normal file
76
samples/html/printing/printing.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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
|
||||
|
3
samples/html/printing/printing.rc
Normal file
3
samples/html/printing/printing.rc
Normal file
@@ -0,0 +1,3 @@
|
||||
mondrian ICON "mondrian.ico"
|
||||
#include "wx/msw/wx.rc"
|
||||
|
126
samples/html/printing/test.htm
Normal file
126
samples/html/printing/test.htm
Normal file
@@ -0,0 +1,126 @@
|
||||
<!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>
|
9
samples/html/test/Makefile.am
Normal file
9
samples/html/test/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = 1.3 no-dependencies
|
||||
|
||||
SUFFIXES = .cpp
|
||||
|
||||
DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
|
||||
|
||||
noinst_PROGRAMS = test
|
||||
|
||||
test_SOURCES = test.cpp
|
2474
samples/html/test/f.html
Normal file
2474
samples/html/test/f.html
Normal file
File diff suppressed because it is too large
Load Diff
144
samples/html/test/fft.html
Normal file
144
samples/html/test/fft.html
Normal file
@@ -0,0 +1,144 @@
|
||||
<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>
|
BIN
samples/html/test/pic.png
Normal file
BIN
samples/html/test/pic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
samples/html/test/pic2.bmp
Normal file
BIN
samples/html/test/pic2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
116
samples/html/test/tables.htm
Normal file
116
samples/html/test/tables.htm
Normal file
@@ -0,0 +1,116 @@
|
||||
<!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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
203
samples/html/test/test.cpp
Normal file
203
samples/html/test/test.cpp
Normal file
@@ -0,0 +1,203 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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!");
|
||||
}
|
266
samples/html/test/test.htm
Normal file
266
samples/html/test/test.htm
Normal file
@@ -0,0 +1,266 @@
|
||||
<!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>
|
2
samples/html/test/test.rc
Normal file
2
samples/html/test/test.rc
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "wx/msw/wx.rc"
|
||||
|
9
samples/html/virtual/Makefile.am
Normal file
9
samples/html/virtual/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = 1.3 no-dependencies
|
||||
|
||||
SUFFIXES = .cpp
|
||||
|
||||
DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
|
||||
|
||||
noinst_PROGRAMS = virtual
|
||||
|
||||
virtual_SOURCES = virtual.cpp
|
12
samples/html/virtual/start.htm
Normal file
12
samples/html/virtual/start.htm
Normal file
@@ -0,0 +1,12 @@
|
||||
<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>
|
231
samples/html/virtual/virtual.cpp
Normal file
231
samples/html/virtual/virtual.cpp
Normal file
@@ -0,0 +1,231 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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!");
|
||||
}
|
2
samples/html/virtual/virtual.rc
Normal file
2
samples/html/virtual/virtual.rc
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "wx/msw/wx.rc"
|
||||
|
9
samples/html/widget/Makefile.am
Normal file
9
samples/html/widget/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = 1.3 no-dependencies
|
||||
|
||||
SUFFIXES = .cpp
|
||||
|
||||
DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
|
||||
|
||||
noinst_PROGRAMS = widget
|
||||
|
||||
widget_SOURCES = widget.cpp
|
20
samples/html/widget/start.htm
Normal file
20
samples/html/widget/start.htm
Normal file
@@ -0,0 +1,20 @@
|
||||
<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>
|
244
samples/html/widget/widget.cpp
Normal file
244
samples/html/widget/widget.cpp
Normal file
@@ -0,0 +1,244 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
2
samples/html/widget/widget.rc
Normal file
2
samples/html/widget/widget.rc
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "wx/msw/wx.rc"
|
||||
|
9
samples/html/zip/Makefile.am
Normal file
9
samples/html/zip/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = 1.3 no-dependencies
|
||||
|
||||
SUFFIXES = .cpp
|
||||
|
||||
DEFS = @DEFS@ $(TOOLKIT_DEF) $(WXDEBUG_DEFINE)
|
||||
|
||||
noinst_PROGRAMS = zip
|
||||
|
||||
zip_SOURCES = zip.cpp
|
BIN
samples/html/zip/pages.zip
Normal file
BIN
samples/html/zip/pages.zip
Normal file
Binary file not shown.
9
samples/html/zip/start.htm
Normal file
9
samples/html/zip/start.htm
Normal file
@@ -0,0 +1,9 @@
|
||||
<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>
|
195
samples/html/zip/zip.cpp
Normal file
195
samples/html/zip/zip.cpp
Normal file
@@ -0,0 +1,195 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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!");
|
||||
}
|
2
samples/html/zip/zip.rc
Normal file
2
samples/html/zip/zip.rc
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "wx/msw/wx.rc"
|
||||
|
Reference in New Issue
Block a user