other f*h header reviews
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53536 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -13,8 +13,8 @@
|
|||||||
wxFileConfig implements wxConfigBase interface for
|
wxFileConfig implements wxConfigBase interface for
|
||||||
storing and retrieving configuration information using plain text files. The
|
storing and retrieving configuration information using plain text files. The
|
||||||
files have a simple format reminiscent of Windows INI files with lines of the
|
files have a simple format reminiscent of Windows INI files with lines of the
|
||||||
form @c key = value defining the keys and lines of special form
|
form @c "key = value" defining the keys and lines of special form
|
||||||
@c [group] indicating the start of each group.
|
@c "[group]" indicating the start of each group.
|
||||||
|
|
||||||
This class is used by default for wxConfig on Unix platforms but may also be
|
This class is used by default for wxConfig on Unix platforms but may also be
|
||||||
used explicitly if you want to use files and not the registry even under
|
used explicitly if you want to use files and not the registry even under
|
||||||
@@ -50,14 +50,13 @@ public:
|
|||||||
user-specific, file if it were constructed with @a basename as "local filename"
|
user-specific, file if it were constructed with @a basename as "local filename"
|
||||||
parameter in the constructor.
|
parameter in the constructor.
|
||||||
|
|
||||||
@a style has the same meaning as in @ref wxConfigBase::ctor constructor
|
@a style has the same meaning as in @ref wxConfigBase::wxConfigBase "wxConfig constructor"
|
||||||
and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is
|
and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is
|
||||||
examined by this function.
|
examined by this function.
|
||||||
|
|
||||||
Notice that this function cannot be used if @a basename is already a full path name.
|
Notice that this function cannot be used if @a basename is already a full path name.
|
||||||
*/
|
*/
|
||||||
static wxFileName GetLocalFile(const wxString& basename,
|
static wxFileName GetLocalFile(const wxString& basename, int style = 0);
|
||||||
int style = 0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Saves all config data to the given stream, returns @true if data was saved
|
Saves all config data to the given stream, returns @true if data was saved
|
||||||
|
@@ -1,24 +1,36 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: filesys.h
|
// Name: filesys.h
|
||||||
// Purpose: interface of wxFileSystem
|
// Purpose: interface of wxFileSystem, wxFileSystemHandler, wxFSFile
|
||||||
// Author: wxWidgets team
|
// Author: wxWidgets team
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Open Bit Flags
|
||||||
|
*/
|
||||||
|
enum wxFileSystemOpenFlags
|
||||||
|
{
|
||||||
|
wxFS_READ = 1, /**< Open for reading */
|
||||||
|
wxFS_SEEKABLE = 4 /**< Returned stream will be seekable */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class wxFileSystem
|
@class wxFileSystem
|
||||||
@wxheader{filesys.h}
|
@wxheader{filesys.h}
|
||||||
|
|
||||||
This class provides an interface for opening files on different
|
This class provides an interface for opening files on different file systems.
|
||||||
file systems. It can handle absolute and/or local filenames.
|
It can handle absolute and/or local filenames.
|
||||||
It uses a system of handlers() to
|
|
||||||
provide access to user-defined virtual file systems.
|
It uses a system of handlers (see wxFileSystemHandler) to provide access to
|
||||||
|
user-defined virtual file systems.
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{vfs}
|
@category{vfs}
|
||||||
|
|
||||||
@see wxFileSystemHandler, wxFSFile, Overview()
|
@see wxFileSystemHandler, wxFSFile, @ref overview_fs
|
||||||
*/
|
*/
|
||||||
class wxFileSystem : public wxObject
|
class wxFileSystem : public wxObject
|
||||||
{
|
{
|
||||||
@@ -29,41 +41,65 @@ public:
|
|||||||
wxFileSystem();
|
wxFileSystem();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This static function adds new handler into the list of
|
This static function adds new handler into the list of handlers
|
||||||
handlers() which provide access to virtual FS.
|
(see wxFileSystemHandler) which provide access to virtual FS.
|
||||||
Note that if two handlers for the same protocol are added, the last one added
|
|
||||||
takes precedence.
|
Note that if two handlers for the same protocol are added, the last
|
||||||
|
added one takes precedence.
|
||||||
|
|
||||||
|
@note You can call:
|
||||||
|
@code
|
||||||
|
wxFileSystem::AddHandler(new My_FS_Handler);
|
||||||
|
@endcode
|
||||||
|
This is because (a) AddHandler is a static method, and (b) the
|
||||||
|
handlers are deleted in wxFileSystem's destructor so that you
|
||||||
|
don't have to care about it.
|
||||||
*/
|
*/
|
||||||
static void AddHandler(wxFileSystemHandler handler);
|
static void AddHandler(wxFileSystemHandler handler);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the current location. @a location parameter passed to
|
Sets the current location. @a location parameter passed to OpenFile() is
|
||||||
OpenFile() is relative to this path.
|
relative to this path.
|
||||||
@b Caution! Unless @a is_dir is @true the @a location parameter
|
|
||||||
is not the directory name but the name of the file in this directory. All these
|
@remarks Unless @a is_dir is @true the @a location parameter is not the
|
||||||
commands change the path to "dir/subdir/":
|
directory name but the name of the file in this directory.
|
||||||
|
|
||||||
|
All these commands change the path to "dir/subdir/":
|
||||||
|
|
||||||
|
@code
|
||||||
|
ChangePathTo("dir/subdir/xh.htm");
|
||||||
|
ChangePathTo("dir/subdir", true);
|
||||||
|
ChangePathTo("dir/subdir/", true);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
f = fs->OpenFile("hello.htm"); // opens file 'hello.htm'
|
||||||
|
fs->ChangePathTo("subdir/folder", true);
|
||||||
|
f = fs->OpenFile("hello.htm"); // opens file 'subdir/folder/hello.htm' !!
|
||||||
|
@endcode
|
||||||
|
|
||||||
@param location
|
@param location
|
||||||
the new location. Its meaning depends on the value of is_dir
|
the new location. Its meaning depends on the value of is_dir
|
||||||
@param is_dir
|
@param is_dir
|
||||||
if @true location is new directory. If @false (default)
|
if @true location is new directory.
|
||||||
location is file in the new directory.
|
If @false (the default) location is file in the new directory.
|
||||||
*/
|
*/
|
||||||
void ChangePathTo(const wxString& location, bool is_dir = false);
|
void ChangePathTo(const wxString& location, bool is_dir = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts filename into URL.
|
Converts a wxFileName into an URL.
|
||||||
|
|
||||||
@see URLToFileName(), wxFileName
|
@see URLToFileName(), wxFileName
|
||||||
*/
|
*/
|
||||||
static wxString FileNameToURL(wxFileName filename);
|
static wxString FileNameToURL(const wxFileName& filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Looks for the file with the given name @a file in a colon or semi-colon
|
Looks for the file with the given name @a file in a colon or semi-colon
|
||||||
(depending on the current platform) separated list of directories in
|
(depending on the current platform) separated list of directories in @a path.
|
||||||
@e path. If the file is found in any directory, returns @true and the full
|
|
||||||
path of the file in @e str, otherwise returns @false and doesn't modify
|
If the file is found in any directory, returns @true and the full path
|
||||||
@e str.
|
of the file in @a str, otherwise returns @false and doesn't modify @a str.
|
||||||
|
|
||||||
@param str
|
@param str
|
||||||
Receives the full path of the file, must not be @NULL
|
Receives the full path of the file, must not be @NULL
|
||||||
@@ -76,50 +112,57 @@ public:
|
|||||||
const wxString& file);
|
const wxString& file);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Works like wxFindFirstFile(). Returns name of the first
|
Works like ::wxFindFirstFile().
|
||||||
filename (within filesystem's current path) that matches @e wildcard. @a flags
|
|
||||||
may be one of
|
Returns the name of the first filename (within filesystem's current path)
|
||||||
wxFILE (only files), wxDIR (only directories) or 0 (both).
|
that matches @a wildcard.
|
||||||
|
|
||||||
|
@param wildcard
|
||||||
|
The wildcard that the filename must match
|
||||||
|
@param flags
|
||||||
|
One of wxFILE (only files), wxDIR (only directories) or 0 (both).
|
||||||
*/
|
*/
|
||||||
wxString FindFirst(const wxString& wildcard, int flags = 0);
|
wxString FindFirst(const wxString& wildcard, int flags = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the next filename that matches parameters passed to FindFirst().
|
Returns the next filename that matches the parameters passed to FindFirst().
|
||||||
*/
|
*/
|
||||||
wxString FindNext();
|
wxString FindNext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns actual path (set by wxFileSystem::ChangePathTo).
|
Returns the actual path (set by wxFileSystem::ChangePathTo).
|
||||||
*/
|
*/
|
||||||
wxString GetPath();
|
wxString GetPath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This static function returns @true if there is a registered handler which can
|
This static function returns @true if there is a registered handler which can
|
||||||
open the given
|
open the given location.
|
||||||
location.
|
|
||||||
*/
|
*/
|
||||||
static bool HasHandlerForPath(const wxString& location);
|
static bool HasHandlerForPath(const wxString& location);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Opens the file and returns a pointer to a wxFSFile object
|
Opens the file and returns a pointer to a wxFSFile object or @NULL if failed.
|
||||||
or @NULL if failed. It first tries to open the file in relative scope
|
|
||||||
(based on value passed to ChangePathTo() method) and then as an
|
It first tries to open the file in relative scope (based on value passed to
|
||||||
absolute path. Note that the user is responsible for deleting the returned
|
ChangePathTo() method) and then as an absolute path.
|
||||||
wxFSFile.
|
|
||||||
@a flags can be one or more of the following bit values ored together:
|
Note that the user is responsible for deleting the returned wxFSFile.
|
||||||
|
@a flags can be one or more of the ::wxFileSystemOpenFlags values
|
||||||
|
combined together.
|
||||||
|
|
||||||
A stream opened with just the default @e wxFS_READ flag may
|
A stream opened with just the default @e wxFS_READ flag may
|
||||||
or may not be seekable depending on the underlying source.
|
or may not be seekable depending on the underlying source.
|
||||||
Passing @e wxFS_READ | wxFS_SEEKABLE for @a flags will
|
|
||||||
back a stream that is not natively seekable with memory or a file
|
Passing @e "wxFS_READ | wxFS_SEEKABLE" for @a flags will back
|
||||||
|
a stream that is not natively seekable with memory or a file
|
||||||
and return a stream that is always seekable.
|
and return a stream that is always seekable.
|
||||||
*/
|
*/
|
||||||
wxFSFile* OpenFile(const wxString& location,
|
wxFSFile* OpenFile(const wxString& location,
|
||||||
int flags = wxFS_READ);
|
int flags = wxFS_READ);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts URL into a well-formed filename. The URL must use the @c file
|
Converts URL into a well-formed filename.
|
||||||
protocol.
|
The URL must use the @c file protocol.
|
||||||
*/
|
*/
|
||||||
static wxFileName URLToFileName(const wxString& url);
|
static wxFileName URLToFileName(const wxString& url);
|
||||||
};
|
};
|
||||||
@@ -134,22 +177,44 @@ public:
|
|||||||
It provides more information than wxWindow's input stream
|
It provides more information than wxWindow's input stream
|
||||||
(stream, filename, mime type, anchor).
|
(stream, filename, mime type, anchor).
|
||||||
|
|
||||||
@note Any pointer returned by a method of wxFSFile is valid
|
@note Any pointer returned by a method of wxFSFile is valid only as long as
|
||||||
only as long as the wxFSFile object exists. For example a call to GetStream()
|
the wxFSFile object exists. For example a call to GetStream()
|
||||||
doesn't @e create the stream but only returns the pointer to it. In
|
doesn't @e create the stream but only returns the pointer to it.
|
||||||
other words after 10 calls to GetStream() you will have obtained ten identical
|
In other words after 10 calls to GetStream() you will have obtained
|
||||||
pointers.
|
ten identical pointers.
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{vfs}
|
@category{vfs}
|
||||||
|
|
||||||
@see wxFileSystemHandler, wxFileSystem, Overview()
|
@see wxFileSystemHandler, wxFileSystem, @ref overview_fs
|
||||||
*/
|
*/
|
||||||
class wxFSFile : public wxObject
|
class wxFSFile : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor. You probably won't use it. See Notes for details.
|
Constructor. You probably won't use it. See the Note for details.
|
||||||
|
|
||||||
|
It is seldom used by the application programmer but you will need it if
|
||||||
|
you are writing your own virtual FS. For example you may need something
|
||||||
|
similar to wxMemoryInputStream, but because wxMemoryInputStream doesn't
|
||||||
|
free the memory when destroyed and thus passing a memory stream pointer
|
||||||
|
into wxFSFile constructor would lead to memory leaks, you can write your
|
||||||
|
own class derived from wxFSFile:
|
||||||
|
|
||||||
|
@code
|
||||||
|
class wxMyFSFile : public wxFSFile
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void *m_Mem;
|
||||||
|
public:
|
||||||
|
wxMyFSFile(.....)
|
||||||
|
~wxMyFSFile() {free(m_Mem);}
|
||||||
|
// of course dtor is virtual ;-)
|
||||||
|
};
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If you are not sure of the meaning of these params, see the description
|
||||||
|
of the GetXXXX() functions.
|
||||||
|
|
||||||
@param stream
|
@param stream
|
||||||
The input stream that will be used to access data
|
The input stream that will be used to access data
|
||||||
@@ -168,9 +233,10 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Detaches the stream from the wxFSFile object. That is, the
|
Detaches the stream from the wxFSFile object. That is, the
|
||||||
stream obtained with @c GetStream() will continue its existance
|
stream obtained with GetStream() will continue its existance
|
||||||
after the wxFSFile object is deleted. You will have to delete
|
after the wxFSFile object is deleted.
|
||||||
the stream yourself.
|
|
||||||
|
You will have to delete the stream yourself.
|
||||||
*/
|
*/
|
||||||
void DetachStream();
|
void DetachStream();
|
||||||
|
|
||||||
@@ -178,25 +244,40 @@ public:
|
|||||||
Returns anchor (if present). The term of @b anchor can be easily
|
Returns anchor (if present). The term of @b anchor can be easily
|
||||||
explained using few examples:
|
explained using few examples:
|
||||||
|
|
||||||
|
@verbatim
|
||||||
|
index.htm#anchor // 'anchor' is anchor
|
||||||
|
index/wx001.htm // NO anchor here!
|
||||||
|
archive/main.zip#zip:index.htm#global // 'global'
|
||||||
|
archive/main.zip#zip:index.htm // NO anchor here!
|
||||||
|
@endverbatim
|
||||||
|
|
||||||
Usually an anchor is presented only if the MIME type is 'text/html'.
|
Usually an anchor is presented only if the MIME type is 'text/html'.
|
||||||
But it may have some meaning with other files;
|
But it may have some meaning with other files; for example myanim.avi#200
|
||||||
for example myanim.avi#200 may refer to position in animation
|
may refer to position in animation or reality.wrl#MyView may refer
|
||||||
or reality.wrl#MyView may refer to a predefined view in VRML.
|
to a predefined view in VRML.
|
||||||
*/
|
*/
|
||||||
const wxString GetAnchor() const;
|
const wxString& GetAnchor() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns full location of the file, including path and protocol.
|
Returns full location of the file, including path and protocol.
|
||||||
Examples :
|
|
||||||
|
Examples:
|
||||||
|
@verbatim
|
||||||
|
http://www.wxwidgets.org
|
||||||
|
http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/archive.zip#zip:info.txt
|
||||||
|
file:/home/vasek/index.htm
|
||||||
|
relative-file.htm
|
||||||
|
@endverbatim
|
||||||
*/
|
*/
|
||||||
const wxString GetLocation() const;
|
const wxString& GetLocation() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the MIME type of the content of this file. It is either
|
Returns the MIME type of the content of this file.
|
||||||
extension-based (see wxMimeTypesManager) or extracted from
|
|
||||||
|
It is either extension-based (see wxMimeTypesManager) or extracted from
|
||||||
HTTP protocol Content-Type header.
|
HTTP protocol Content-Type header.
|
||||||
*/
|
*/
|
||||||
const wxString GetMimeType() const;
|
const wxString& GetMimeType() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns time when this file was modified.
|
Returns time when this file was modified.
|
||||||
@@ -204,9 +285,10 @@ public:
|
|||||||
wxDateTime GetModificationTime() const;
|
wxDateTime GetModificationTime() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns pointer to the stream. You can use the returned
|
Returns pointer to the stream.
|
||||||
stream to directly access data. You may suppose
|
|
||||||
that the stream provide Seek and GetSize functionality
|
You can use the returned stream to directly access data.
|
||||||
|
You may suppose that the stream provide Seek and GetSize functionality
|
||||||
(even in the case of the HTTP protocol which doesn't provide
|
(even in the case of the HTTP protocol which doesn't provide
|
||||||
this by default. wxHtml uses local cache to work around
|
this by default. wxHtml uses local cache to work around
|
||||||
this and to speed up the connection).
|
this and to speed up the connection).
|
||||||
@@ -220,26 +302,38 @@ public:
|
|||||||
@class wxFileSystemHandler
|
@class wxFileSystemHandler
|
||||||
@wxheader{filesys.h}
|
@wxheader{filesys.h}
|
||||||
|
|
||||||
Classes derived from wxFileSystemHandler are used
|
Classes derived from wxFileSystemHandler are used to access virtual file systems.
|
||||||
to access virtual file systems. Its public interface consists
|
|
||||||
of two methods: wxFileSystemHandler::CanOpen
|
|
||||||
and wxFileSystemHandler::OpenFile.
|
|
||||||
It provides additional protected methods to simplify the process
|
|
||||||
of opening the file: GetProtocol, GetLeftLocation, GetRightLocation,
|
|
||||||
GetAnchor, GetMimeTypeFromExt.
|
|
||||||
|
|
||||||
Please have a look at overview() if you don't know how locations
|
Its public interface consists of two methods: wxFileSystemHandler::CanOpen
|
||||||
|
and wxFileSystemHandler::OpenFile.
|
||||||
|
|
||||||
|
It provides additional protected methods to simplify the process
|
||||||
|
of opening the file: GetProtocol(), GetLeftLocation(), GetRightLocation(),
|
||||||
|
GetAnchor(), GetMimeTypeFromExt().
|
||||||
|
|
||||||
|
Please have a look at overview (see wxFileSystem) if you don't know how locations
|
||||||
are constructed.
|
are constructed.
|
||||||
|
|
||||||
Also consult @ref overview_fs "list of available handlers".
|
Also consult the @ref overview_fs_wxhtmlfs "list of available handlers".
|
||||||
|
|
||||||
@b wxPerl note: In wxPerl, you need to derive your file system handler class
|
Note that the handlers are shared by all instances of wxFileSystem.
|
||||||
|
|
||||||
|
@remarks
|
||||||
|
wxHTML library provides handlers for local files and HTTP or FTP protocol.
|
||||||
|
|
||||||
|
@note
|
||||||
|
The location parameter passed to OpenFile() or CanOpen() methods is always an
|
||||||
|
absolute path. You don't need to check the FS's current path.
|
||||||
|
|
||||||
|
@beginWxPerlOnly
|
||||||
|
In wxPerl, you need to derive your file system handler class
|
||||||
from Wx::PlFileSystemHandler.
|
from Wx::PlFileSystemHandler.
|
||||||
|
@endWxPerlOnly
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{vfs}
|
@category{vfs}
|
||||||
|
|
||||||
@see wxFileSystem, wxFSFile, Overview()
|
@see wxFileSystem, wxFSFile, @ref overview_fs
|
||||||
*/
|
*/
|
||||||
class wxFileSystemHandler : public wxObject
|
class wxFileSystemHandler : public wxObject
|
||||||
{
|
{
|
||||||
@@ -254,15 +348,24 @@ public:
|
|||||||
check whether the file exists or not, it only checks if it knows the protocol.
|
check whether the file exists or not, it only checks if it knows the protocol.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
@code
|
||||||
|
bool MyHand::CanOpen(const wxString& location)
|
||||||
|
{
|
||||||
|
return (GetProtocol(location) == "http");
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
Must be overridden in derived handlers.
|
Must be overridden in derived handlers.
|
||||||
*/
|
*/
|
||||||
virtual bool CanOpen(const wxString& location);
|
virtual bool CanOpen(const wxString& location);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Works like wxFindFirstFile(). Returns name of the first
|
Works like ::wxFindFirstFile().
|
||||||
filename (within filesystem's current path) that matches @e wildcard. @a flags
|
|
||||||
may be one of
|
Returns the name of the first filename (within filesystem's current path)
|
||||||
wxFILE (only files), wxDIR (only directories) or 0 (both).
|
that matches @e wildcard. @a flags may be one of wxFILE (only files),
|
||||||
|
wxDIR (only directories) or 0 (both).
|
||||||
|
|
||||||
This method is only called if CanOpen() returns @true.
|
This method is only called if CanOpen() returns @true.
|
||||||
*/
|
*/
|
||||||
virtual wxString FindFirst(const wxString& wildcard,
|
virtual wxString FindFirst(const wxString& wildcard,
|
||||||
@@ -270,43 +373,64 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns next filename that matches parameters passed to wxFileSystem::FindFirst.
|
Returns next filename that matches parameters passed to wxFileSystem::FindFirst.
|
||||||
This method is only called if CanOpen() returns @true and FindFirst
|
|
||||||
|
This method is only called if CanOpen() returns @true and FindFirst()
|
||||||
returned a non-empty string.
|
returned a non-empty string.
|
||||||
*/
|
*/
|
||||||
virtual wxString FindNext();
|
virtual wxString FindNext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the anchor if present in the location.
|
Returns the anchor if present in the location.
|
||||||
See @ref wxFSFile::getanchor wxFSFile for details.
|
See wxFSFile::GetAnchor for details.
|
||||||
Example: GetAnchor("index.htm#chapter2") == "chapter2"
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
GetAnchor("index.htm#chapter2") == "chapter2"
|
||||||
|
@endcode
|
||||||
|
|
||||||
@note the anchor is NOT part of the left location.
|
@note the anchor is NOT part of the left location.
|
||||||
*/
|
*/
|
||||||
wxString GetAnchor(const wxString& location) const;
|
wxString GetAnchor(const wxString& location) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the left location string extracted from @e location.
|
Returns the left location string extracted from @e location.
|
||||||
Example: GetLeftLocation("file:myzipfile.zip#zip:index.htm") ==
|
|
||||||
"file:myzipfile.zip"
|
Example:
|
||||||
|
@code
|
||||||
|
GetLeftLocation("file:myzipfile.zip#zip:index.htm") == "file:myzipfile.zip"
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
wxString GetLeftLocation(const wxString& location) const;
|
wxString GetLeftLocation(const wxString& location) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the MIME type based on @b extension of @e location. (While
|
Returns the MIME type based on @b extension of @a location.
|
||||||
wxFSFile::GetMimeType
|
(While wxFSFile::GetMimeType() returns real MIME type - either
|
||||||
returns real MIME type - either extension-based or queried from HTTP.)
|
extension-based or queried from HTTP.)
|
||||||
Example : GetMimeTypeFromExt("index.htm") == "text/html"
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
GetMimeTypeFromExt("index.htm") == "text/html"
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
wxString GetMimeTypeFromExt(const wxString& location);
|
wxString GetMimeTypeFromExt(const wxString& location);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the protocol string extracted from @e location.
|
Returns the protocol string extracted from @a location.
|
||||||
Example: GetProtocol("file:myzipfile.zip#zip:index.htm") == "zip"
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
GetProtocol("file:myzipfile.zip#zip:index.htm") == "zip"
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
wxString GetProtocol(const wxString& location) const;
|
wxString GetProtocol(const wxString& location) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the right location string extracted from @e location.
|
Returns the right location string extracted from @a location.
|
||||||
Example : GetRightLocation("file:myzipfile.zip#zip:index.htm") == "index.htm"
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
GetRightLocation("file:myzipfile.zip#zip:index.htm") == "index.htm"
|
||||||
|
@endcode
|
||||||
*/
|
*/
|
||||||
wxString GetRightLocation(const wxString& location) const;
|
wxString GetRightLocation(const wxString& location) const;
|
||||||
|
|
||||||
@@ -315,8 +439,8 @@ public:
|
|||||||
Must be overridden in derived handlers.
|
Must be overridden in derived handlers.
|
||||||
|
|
||||||
@param fs
|
@param fs
|
||||||
Parent FS (the FS from that OpenFile was called). See ZIP handler
|
Parent FS (the FS from that OpenFile was called).
|
||||||
for details of how to use it.
|
See the ZIP handler for details of how to use it.
|
||||||
@param location
|
@param location
|
||||||
The absolute location of file.
|
The absolute location of file.
|
||||||
*/
|
*/
|
||||||
|
@@ -10,15 +10,32 @@
|
|||||||
@class wxFrame
|
@class wxFrame
|
||||||
@wxheader{frame.h}
|
@wxheader{frame.h}
|
||||||
|
|
||||||
A frame is a window whose size and position can (usually) be changed by the
|
A frame is a window whose size and position can (usually) be changed by the user.
|
||||||
user. It usually has thick borders and a title bar, and can optionally contain
|
|
||||||
a menu bar, toolbar and status bar. A frame can contain any window that is not
|
It usually has thick borders and a title bar, and can optionally contain a
|
||||||
|
menu bar, toolbar and status bar. A frame can contain any window that is not
|
||||||
a frame or dialog.
|
a frame or dialog.
|
||||||
|
|
||||||
A frame that has a status bar and toolbar created via the
|
A frame that has a status bar and toolbar, created via the CreateStatusBar() and
|
||||||
CreateStatusBar/CreateToolBar functions manages these windows, and adjusts the
|
CreateToolBar() functions, manages these windows and adjusts the value returned
|
||||||
value returned by GetClientSize to reflect the remaining size available to
|
by GetClientSize() to reflect the remaining size available to application windows.
|
||||||
application windows.
|
|
||||||
|
@remarks An application should normally define an wxCloseEvent handler for the
|
||||||
|
frame to respond to system close events, for example so that related
|
||||||
|
data and subwindows can be cleaned up.
|
||||||
|
|
||||||
|
|
||||||
|
@section wxframe_defaultevent Default event processing
|
||||||
|
|
||||||
|
wxFrame processes the following events:
|
||||||
|
|
||||||
|
@li @c wxEVT_SIZE: if the frame has exactly one child window, not counting the
|
||||||
|
status and toolbar, this child is resized to take the entire frame client area.
|
||||||
|
If two or more windows are present, they should be laid out explicitly either
|
||||||
|
by manually handling wxEVT_SIZE or using sizers;
|
||||||
|
@li @c wxEVT_MENU_HIGHLIGHT: the default implementation displays the help string
|
||||||
|
associated with the selected item in the first pane of the status bar, if there is one.
|
||||||
|
|
||||||
|
|
||||||
@beginStyleTable
|
@beginStyleTable
|
||||||
@style{wxDEFAULT_FRAME_STYLE}
|
@style{wxDEFAULT_FRAME_STYLE}
|
||||||
@@ -54,12 +71,26 @@
|
|||||||
and thus it might be better to use this style only without
|
and thus it might be better to use this style only without
|
||||||
wxMINIMIZE_BOX style). In wxGTK, the flag is respected only if GTK+
|
wxMINIMIZE_BOX style). In wxGTK, the flag is respected only if GTK+
|
||||||
is at least version 2.2 and the window manager supports
|
is at least version 2.2 and the window manager supports
|
||||||
_NET_WM_STATE_SKIP_TASKBAR hint. Has no effect under other
|
_NET_WM_STATE_SKIP_TASKBAR hint. Has no effect under other platforms.
|
||||||
platforms.
|
|
||||||
@style{wxFRAME_FLOAT_ON_PARENT}
|
@style{wxFRAME_FLOAT_ON_PARENT}
|
||||||
The frame will always be on top of its parent (unlike
|
The frame will always be on top of its parent (unlike wxSTAY_ON_TOP).
|
||||||
wxSTAY_ON_TOP). A frame created with this style must have a
|
A frame created with this style must have a non-@NULL parent.
|
||||||
non-@NULL parent.
|
@style{wxFRAME_SHAPED}
|
||||||
|
Windows with this style are allowed to have their shape changed
|
||||||
|
with the SetShape() method.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
The default frame style is for normal, resizeable frames.
|
||||||
|
To create a frame which can not be resized by user, you may use the following
|
||||||
|
combination of styles:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxRESIZE_BOX | wxMAXIMIZE_BOX)
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
See also the @ref overview_windowstyles.
|
||||||
|
|
||||||
|
@beginExtraStyleTable
|
||||||
@style{wxFRAME_EX_CONTEXTHELP}
|
@style{wxFRAME_EX_CONTEXTHELP}
|
||||||
Under Windows, puts a query button on the caption. When pressed,
|
Under Windows, puts a query button on the caption. When pressed,
|
||||||
Windows will go into a context-sensitive help mode and wxWidgets
|
Windows will go into a context-sensitive help mode and wxWidgets
|
||||||
@@ -71,13 +102,10 @@
|
|||||||
wxDEFAULT_FRAME_STYLE ~ (wxMINIMIZE_BOX | wxMAXIMIZE_BOX) for the
|
wxDEFAULT_FRAME_STYLE ~ (wxMINIMIZE_BOX | wxMAXIMIZE_BOX) for the
|
||||||
frames having this style (the dialogs don't have a minimize or a
|
frames having this style (the dialogs don't have a minimize or a
|
||||||
maximize box by default)
|
maximize box by default)
|
||||||
@style{wxFRAME_SHAPED}
|
|
||||||
Windows with this style are allowed to have their shape changed
|
|
||||||
with the SetShape method.
|
|
||||||
@style{wxFRAME_EX_METAL}
|
@style{wxFRAME_EX_METAL}
|
||||||
On Mac OS X, frames with this style will be shown with a metallic
|
On Mac OS X, frames with this style will be shown with a metallic
|
||||||
look. This is an extra style.
|
look. This is an extra style.
|
||||||
@endStyleTable
|
@endExtraStyleTable
|
||||||
|
|
||||||
@library{wxcore}
|
@library{wxcore}
|
||||||
@category{managedwnd}
|
@category{managedwnd}
|
||||||
|
@@ -10,12 +10,13 @@
|
|||||||
@class wxMemoryFSHandler
|
@class wxMemoryFSHandler
|
||||||
@wxheader{fs_mem.h}
|
@wxheader{fs_mem.h}
|
||||||
|
|
||||||
This wxFileSystem handler can store arbitrary
|
This wxFileSystem handler can store arbitrary data in memory stream and make
|
||||||
data in memory stream and make them accessible via URL. It is particularly
|
them accessible via an URL.
|
||||||
suitable for storing bitmaps from resources or included XPM files so that
|
|
||||||
they can be used with wxHTML.
|
|
||||||
|
|
||||||
Filenames are prefixed with "memory:", e.g. "memory:myfile.html".
|
It is particularly suitable for storing bitmaps from resources or included XPM
|
||||||
|
files so that they can be used with wxHTML.
|
||||||
|
|
||||||
|
Filenames are prefixed with @c "memory:", e.g. @c "memory:myfile.html".
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@@ -30,26 +31,26 @@
|
|||||||
wxFileSystem::AddHandler(new wxMemoryFSHandler);
|
wxFileSystem::AddHandler(new wxMemoryFSHandler);
|
||||||
wxMemoryFSHandler::AddFile("logo.pcx", wxBITMAP(logo), wxBITMAP_TYPE_PCX);
|
wxMemoryFSHandler::AddFile("logo.pcx", wxBITMAP(logo), wxBITMAP_TYPE_PCX);
|
||||||
wxMemoryFSHandler::AddFile("about.htm",
|
wxMemoryFSHandler::AddFile("about.htm",
|
||||||
"htmlbodyAbout: "
|
"<html><body>About: "
|
||||||
"img src=\"memory:logo.pcx\"/body/html");
|
"<img src=\"memory:logo.pcx\"></body></html>");
|
||||||
|
|
||||||
wxDialog dlg(this, -1, wxString(_("About")));
|
wxDialog dlg(this, -1, wxString(_("About")));
|
||||||
wxBoxSizer *topsizer;
|
wxBoxSizer *topsizer;
|
||||||
wxHtmlWindow *html;
|
wxHtmlWindow *html;
|
||||||
topsizer = new wxBoxSizer(wxVERTICAL);
|
topsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
html = new wxHtmlWindow(, -1, wxDefaultPosition,
|
html = new wxHtmlWindow(&dlg, -1, wxDefaultPosition,
|
||||||
wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
|
wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
|
||||||
html-SetBorders(0);
|
html->SetBorders(0);
|
||||||
html-LoadPage("memory:about.htm");
|
html->LoadPage("memory:about.htm");
|
||||||
html-SetSize(html-GetInternalRepresentation()-GetWidth(),
|
html->SetSize(html->GetInternalRepresentation()->GetWidth(),
|
||||||
html-GetInternalRepresentation()-GetHeight());
|
html->GetInternalRepresentation()->GetHeight());
|
||||||
topsizer-Add(html, 1, wxALL, 10);
|
topsizer->Add(html, 1, wxALL, 10);
|
||||||
topsizer-Add(new wxStaticLine(, -1), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
topsizer->Add(new wxStaticLine(&dlg, -1), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||||
topsizer-Add(new wxButton(, wxID_OK, "Ok"),
|
topsizer->Add(new wxButton(&dlg, wxID_OK, "Ok"),
|
||||||
0, wxALL | wxALIGN_RIGHT, 15);
|
0, wxALL | wxALIGN_RIGHT, 15);
|
||||||
dlg.SetAutoLayout(@true);
|
dlg.SetAutoLayout(true);
|
||||||
dlg.SetSizer(topsizer);
|
dlg.SetSizer(topsizer);
|
||||||
topsizer-Fit();
|
topsizer->Fit(&dlg);
|
||||||
dlg.Centre();
|
dlg.Centre();
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{FIXME}
|
@category{vfs}
|
||||||
|
|
||||||
@see wxMemoryFSHandler::AddFileWithMimeType
|
@see wxMemoryFSHandler::AddFileWithMimeType
|
||||||
*/
|
*/
|
||||||
@@ -73,29 +74,26 @@ public:
|
|||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Add file to list of files stored in memory. Stored
|
Adds a file to the list of the files stored in memory.
|
||||||
data (bitmap, text or raw data)
|
|
||||||
will be copied into private memory stream and available under
|
Stored data (bitmap, text or raw data) will be copied into private memory
|
||||||
name "memory:" + @e filename.
|
stream and available under name @c "memory:" + @e filename.
|
||||||
The @a type argument is one of @c wxBITMAP_TYPE_XXX constants.
|
|
||||||
Note that you must use a @a type value (aka image format)
|
@note you must use a @a type value (aka image format) that wxWidgets
|
||||||
that wxWidgets can save (e.g. JPG, PNG, see wxImage
|
can save (e.g. JPG, PNG, see wxImage documentation)!
|
||||||
documentation())!
|
|
||||||
|
|
||||||
@see AddFileWithMimeType()
|
@see AddFileWithMimeType()
|
||||||
*/
|
*/
|
||||||
static void AddFile(const wxString& filename, wxImage& image,
|
static void AddFile(const wxString& filename, wxImage& image, wxBitmapType type);
|
||||||
long type);
|
static void AddFile(const wxString& filename, const wxBitmap& bitmap, wxBitmapType type);
|
||||||
static void AddFile(const wxString& filename,
|
|
||||||
const wxBitmap& bitmap,
|
|
||||||
long type);
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Like AddFile(), but lets you explicitly
|
Like AddFile(), but lets you explicitly specify added file's MIME type.
|
||||||
specify added file's MIME type. This version should be used whenever you know
|
|
||||||
the MIME type, because it makes accessing the files faster.
|
This version should be used whenever you know the MIME type, because it
|
||||||
|
makes accessing the files faster.
|
||||||
|
|
||||||
@since 2.8.5
|
@since 2.8.5
|
||||||
|
|
||||||
@@ -111,7 +109,7 @@ public:
|
|||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove file from memory FS and free occupied memory.
|
Removes a file from memory FS and frees the occupied memory.
|
||||||
*/
|
*/
|
||||||
static void RemoveFile(const wxString& filename);
|
static void RemoveFile(const wxString& filename);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user