added interface headers with latest discussed changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -36,7 +36,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO
|
|||||||
OPTIMIZE_OUTPUT_JAVA = NO
|
OPTIMIZE_OUTPUT_JAVA = NO
|
||||||
BUILTIN_STL_SUPPORT = NO
|
BUILTIN_STL_SUPPORT = NO
|
||||||
CPP_CLI_SUPPORT = NO
|
CPP_CLI_SUPPORT = NO
|
||||||
DISTRIBUTE_GROUP_DOC = NO
|
DISTRIBUTE_GROUP_DOC = YES
|
||||||
SUBGROUPING = YES
|
SUBGROUPING = YES
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -65,7 +65,7 @@ ALIASES += endExtraStyleTable="\n"
|
|||||||
ALIASES += library{1}="\section class_lib Library\n Belongs to library \ref page_libs_\1."
|
ALIASES += library{1}="\section class_lib Library\n Belongs to library \ref page_libs_\1."
|
||||||
ALIASES += nolibrary="\section class_lib Library\n None; this class implementation is entirely header-based."
|
ALIASES += nolibrary="\section class_lib Library\n None; this class implementation is entirely header-based."
|
||||||
ALIASES += stdobjects="\section class_stdobj Predefined objects\n \b"
|
ALIASES += stdobjects="\section class_stdobj Predefined objects\n \b"
|
||||||
ALIASES += category{1}="\section class_category Category\n \1"
|
ALIASES += category{1}="\section class_category Category\n \ref page_class_cat_\1"
|
||||||
|
|
||||||
# aliases with references to wxWidgets ports
|
# aliases with references to wxWidgets ports
|
||||||
ALIASES += nativeimpl{1}="\section class_impl Implementations\n Native implementations are used for \ref page_port_\1 port; generic implementation is used elsewhere."
|
ALIASES += nativeimpl{1}="\section class_impl Implementations\n Native implementations are used for \ref page_port_\1 port; generic implementation is used elsewhere."
|
||||||
@@ -170,8 +170,8 @@ EXTRACT_STATIC = YES
|
|||||||
EXTRACT_LOCAL_CLASSES = YES
|
EXTRACT_LOCAL_CLASSES = YES
|
||||||
EXTRACT_LOCAL_METHODS = NO
|
EXTRACT_LOCAL_METHODS = NO
|
||||||
EXTRACT_ANON_NSPACES = YES
|
EXTRACT_ANON_NSPACES = YES
|
||||||
HIDE_UNDOC_MEMBERS = YES
|
HIDE_UNDOC_MEMBERS = NO
|
||||||
HIDE_UNDOC_CLASSES = YES
|
HIDE_UNDOC_CLASSES = NO
|
||||||
HIDE_FRIEND_COMPOUNDS = NO
|
HIDE_FRIEND_COMPOUNDS = NO
|
||||||
HIDE_IN_BODY_DOCS = NO
|
HIDE_IN_BODY_DOCS = NO
|
||||||
INTERNAL_DOCS = NO
|
INTERNAL_DOCS = NO
|
||||||
@@ -180,7 +180,7 @@ HIDE_SCOPE_NAMES = NO
|
|||||||
SHOW_INCLUDE_FILES = YES
|
SHOW_INCLUDE_FILES = YES
|
||||||
INLINE_INFO = YES
|
INLINE_INFO = YES
|
||||||
SORT_MEMBER_DOCS = YES
|
SORT_MEMBER_DOCS = YES
|
||||||
SORT_BRIEF_DOCS = YES
|
SORT_BRIEF_DOCS = NO # don't set it to YES! see http://bugzilla.gnome.org/show_bug.cgi?id=312655
|
||||||
SORT_BY_SCOPE_NAME = NO
|
SORT_BY_SCOPE_NAME = NO
|
||||||
GENERATE_TODOLIST = YES
|
GENERATE_TODOLIST = YES
|
||||||
GENERATE_TESTLIST = YES
|
GENERATE_TESTLIST = YES
|
||||||
@@ -192,7 +192,7 @@ ENABLED_SECTIONS =
|
|||||||
|
|
||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
SHOW_DIRECTORIES = NO
|
SHOW_DIRECTORIES = YES
|
||||||
FILE_VERSION_FILTER =
|
FILE_VERSION_FILTER =
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -200,16 +200,16 @@ FILE_VERSION_FILTER =
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
QUIET = NO
|
QUIET = NO
|
||||||
WARNINGS = YES
|
WARNINGS = YES
|
||||||
WARN_IF_UNDOCUMENTED = NO
|
WARN_IF_UNDOCUMENTED = YES
|
||||||
WARN_IF_DOC_ERROR = YES
|
WARN_IF_DOC_ERROR = YES
|
||||||
WARN_NO_PARAMDOC = NO
|
WARN_NO_PARAMDOC = YES
|
||||||
WARN_FORMAT = "$file:$line: $text "
|
WARN_FORMAT = "$file:$line: $text "
|
||||||
WARN_LOGFILE = doxygen.log
|
WARN_LOGFILE = doxygen.log
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the input files
|
# configuration options related to the input files
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
INPUT = ./mainpages ./overviews #../../interface
|
INPUT = ./mainpages ./overviews ../../interface
|
||||||
INPUT_ENCODING = UTF-8
|
INPUT_ENCODING = UTF-8
|
||||||
FILE_PATTERNS = *.h *.txt
|
FILE_PATTERNS = *.h *.txt
|
||||||
RECURSIVE = YES
|
RECURSIVE = YES
|
||||||
|
|||||||
223
interface/aboutdlg.h
Normal file
223
interface/aboutdlg.h
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: aboutdlg.h
|
||||||
|
// Purpose: documentation for wxAboutDialogInfo class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAboutDialogInfo
|
||||||
|
@wxheader{aboutdlg.h}
|
||||||
|
|
||||||
|
wxAboutDialogInfo contains information shown in the standard @e About
|
||||||
|
dialog displayed by the wxAboutBox function.
|
||||||
|
|
||||||
|
This class contains the general information about the program, such as its
|
||||||
|
name, version, copyright and so on, as well as lists of the program developers,
|
||||||
|
documentation writers, artists and translators. The simple properties from the
|
||||||
|
former group are represented as a string with the exception of the program icon
|
||||||
|
and the program web site, while the lists from the latter group are stored as
|
||||||
|
wxArrayString and can be either set entirely at once
|
||||||
|
using wxAboutDialogInfo::SetDevelopers and similar
|
||||||
|
functions or built one by one using wxAboutDialogInfo::AddDeveloper
|
||||||
|
etc.
|
||||||
|
|
||||||
|
Please also notice that while all the main platforms have the native
|
||||||
|
implementation of the about dialog, they are often more limited than the
|
||||||
|
generic version provided by wxWidgets and so the generic version is used if
|
||||||
|
wxAboutDialogInfo has any fields not supported by the native version. Currently
|
||||||
|
GTK+ version supports all the possible fields natively but MSW and Mac versions
|
||||||
|
don't support URLs, licence text nor custom icons in the about dialog and if
|
||||||
|
either of those is used, wxAboutBox will automatically
|
||||||
|
use the generic version so you should avoid specifying these fields to achieve
|
||||||
|
more native look and feel.
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxAboutDialogInfo::SetArtists
|
||||||
|
*/
|
||||||
|
class wxAboutDialogInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Default constructor leaves all fields are initially uninitialized, in general
|
||||||
|
you should call at least SetVersion(),
|
||||||
|
SetCopyright() and
|
||||||
|
SetDescription().
|
||||||
|
*/
|
||||||
|
wxAboutDialogInfo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds an artist name to be shown in the program credits.
|
||||||
|
|
||||||
|
@sa SetArtists()
|
||||||
|
*/
|
||||||
|
void AddArtist(const wxString& artist);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds a developer name to be shown in the program credits.
|
||||||
|
|
||||||
|
@sa SetDevelopers()
|
||||||
|
*/
|
||||||
|
void AddDeveloper(const wxString& developer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds a documentation writer name to be shown in the program credits.
|
||||||
|
|
||||||
|
@sa SetDocWriters()
|
||||||
|
*/
|
||||||
|
void AddDocWriter(const wxString& docwriter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds a translator name to be shown in the program credits. Notice that if no
|
||||||
|
translator names are specified explicitely, wxAboutBox
|
||||||
|
will try to use the translation of the string @c translator-credits from
|
||||||
|
the currently used message catalog -- this can be used to show just the name of
|
||||||
|
the translator of the program in the current language.
|
||||||
|
|
||||||
|
@sa SetTranslators()
|
||||||
|
*/
|
||||||
|
void AddTranslator(const wxString& translator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the the list of artists to be shown in the program credits.
|
||||||
|
|
||||||
|
@sa AddArtist()
|
||||||
|
*/
|
||||||
|
void SetArtists(const wxArrayString& artists);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the short string containing the program copyright information. Notice that
|
||||||
|
any occurrences of @c "(C)" in @e copyright will be replaced by the
|
||||||
|
copyright symbol (circled C) automatically, which means that you can avoid
|
||||||
|
using this symbol in the program source code which can be problematic,
|
||||||
|
*/
|
||||||
|
void SetCopyright(const wxString& copyright);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set brief, but possibly multiline, description of the program.
|
||||||
|
*/
|
||||||
|
void SetDescription(const wxString& desc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the list of developers of the program.
|
||||||
|
|
||||||
|
@sa AddDeveloper()
|
||||||
|
*/
|
||||||
|
void SetDevelopers(const wxArrayString& developers);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the list of documentation writers.
|
||||||
|
|
||||||
|
@sa AddDocWriter()
|
||||||
|
*/
|
||||||
|
void SetDocWriters(const wxArrayString& docwriters);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the icon to be shown in the dialog. By default the icon of the main frame
|
||||||
|
will be shown if the native about dialog supports custom icons. If it doesn't
|
||||||
|
but a valid icon is specified using this method, the generic about dialog is
|
||||||
|
used instead so you should avoid calling this function for maximally native
|
||||||
|
look and feel.
|
||||||
|
*/
|
||||||
|
void SetIcon(const wxIcon& icon);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the long, multiline string containing the text of the program licence.
|
||||||
|
|
||||||
|
Only GTK+ version supports showing the licence text in the native about dialog
|
||||||
|
currently so the generic version will be used under all the other platforms if
|
||||||
|
this method is called. To preserve the native look and feel it is advised that
|
||||||
|
you do not call this method but provide a separate menu item in the
|
||||||
|
@c "Help" menu for displaying the text of your program licence.
|
||||||
|
*/
|
||||||
|
void SetLicence(const wxString& licence);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is the same as SetLicence().
|
||||||
|
*/
|
||||||
|
void SetLicense(const wxString& licence);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the name of the program. If this method is not called, the string returned
|
||||||
|
by wxApp::GetAppName will be shown in the dialog.
|
||||||
|
*/
|
||||||
|
void SetName(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the list of translators. Please see
|
||||||
|
AddTranslator() for additional
|
||||||
|
discussion.
|
||||||
|
*/
|
||||||
|
void SetTranslators(const wxArrayString& translators);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the version of the program. The version is in free format, i.e. not
|
||||||
|
necessarily in the @c x.y.z form but it shouldn't contain the "version"
|
||||||
|
word.
|
||||||
|
*/
|
||||||
|
void SetVersion(const wxString& version);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the web site for the program and its description (which defaults to URL
|
||||||
|
itself if empty).
|
||||||
|
|
||||||
|
Please notice that only GTK+ version currently supports showing the link in the
|
||||||
|
native about dialog so if this method is called, the generic version will be
|
||||||
|
used under all the other platforms.
|
||||||
|
*/
|
||||||
|
void SetWebSite(const wxString& url,
|
||||||
|
const wxString& desc = wxEmptyString);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function shows the standard about dialog containing the information
|
||||||
|
specified in @e info. If the current platform has a native about dialog
|
||||||
|
which is capable of showing all the fields in @e info, the native dialog is
|
||||||
|
used, otherwise the function falls back to the generic wxWidgets version of the
|
||||||
|
dialog, i.e. does the same thing as wxGenericAboutBox.
|
||||||
|
|
||||||
|
Here is an example of how this function may be used:
|
||||||
|
|
||||||
|
@code
|
||||||
|
void MyFrame::ShowSimpleAboutDialog(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxAboutDialogInfo info;
|
||||||
|
info.SetName(_("My Program"));
|
||||||
|
info.SetVersion(_("1.2.3 Beta"));
|
||||||
|
info.SetDescription(_("This program does something great."));
|
||||||
|
info.SetCopyright(_T("(C) 2007 Me my@email.addre.ss"));
|
||||||
|
|
||||||
|
wxAboutBox(info);
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Please see the @ref overview_sampledialogs "dialogs sample" for more examples of
|
||||||
|
using this function and wxAboutDialogInfo for the
|
||||||
|
description of the information which can be shown in the about dialog.
|
||||||
|
*/
|
||||||
|
void wxAboutBox(const wxAboutDialogInfo& info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function does the same thing as wxAboutBox except
|
||||||
|
that it always uses the generic wxWidgets version of the dialog instead of the
|
||||||
|
native one. This is mainly useful if you need to customize the dialog by e.g.
|
||||||
|
adding custom controls to it (customizing the native dialog is not currently
|
||||||
|
supported).
|
||||||
|
|
||||||
|
See the @ref overview_sampledialogs "dialogs sample" for an example of about
|
||||||
|
dialog
|
||||||
|
customization.
|
||||||
|
|
||||||
|
@sa wxAboutDialogInfo
|
||||||
|
*/
|
||||||
|
void wxGenericAboutBox(const wxAboutDialogInfo& info);
|
||||||
|
|
||||||
140
interface/accel.h
Normal file
140
interface/accel.h
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: accel.h
|
||||||
|
// Purpose: documentation for wxAcceleratorEntry class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAcceleratorEntry
|
||||||
|
@wxheader{accel.h}
|
||||||
|
|
||||||
|
An object used by an application wishing to create an @ref
|
||||||
|
overview_wxacceleratortable "accelerator table".
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxAcceleratorTable, wxWindow::SetAcceleratorTable
|
||||||
|
*/
|
||||||
|
class wxAcceleratorEntry
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
@param flags
|
||||||
|
One of wxACCEL_ALT, wxACCEL_SHIFT, wxACCEL_CTRL and wxACCEL_NORMAL. Indicates
|
||||||
|
which modifier key is held down.
|
||||||
|
|
||||||
|
@param keyCode
|
||||||
|
The keycode to be detected. See Keycodes for a full list of keycodes.
|
||||||
|
|
||||||
|
@param cmd
|
||||||
|
The menu or control command identifier.
|
||||||
|
*/
|
||||||
|
wxAcceleratorEntry();
|
||||||
|
wxAcceleratorEntry(int flags, int keyCode, int cmd);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the command identifier for the accelerator table entry.
|
||||||
|
*/
|
||||||
|
int GetCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the flags for the accelerator table entry.
|
||||||
|
*/
|
||||||
|
int GetFlags();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the keycode for the accelerator table entry.
|
||||||
|
*/
|
||||||
|
int GetKeyCode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the accelerator entry parameters.
|
||||||
|
|
||||||
|
@param flags
|
||||||
|
One of wxACCEL_ALT, wxACCEL_SHIFT, wxACCEL_CTRL and wxACCEL_NORMAL. Indicates
|
||||||
|
which modifier key is held down.
|
||||||
|
|
||||||
|
@param keyCode
|
||||||
|
The keycode to be detected. See Keycodes for a full list of keycodes.
|
||||||
|
|
||||||
|
@param cmd
|
||||||
|
The menu or control command identifier.
|
||||||
|
*/
|
||||||
|
#define void Set(int flags, int keyCode, int cmd) /* implementation is private */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAcceleratorTable
|
||||||
|
@wxheader{accel.h}
|
||||||
|
|
||||||
|
An accelerator table allows the application to specify a table of keyboard
|
||||||
|
shortcuts for
|
||||||
|
menus or other commands. On Windows and Mac OS X, menu or button commands are
|
||||||
|
supported; on GTK,
|
||||||
|
only menu commands are supported.
|
||||||
|
|
||||||
|
The object @b wxNullAcceleratorTable is defined to be a table with no data, and
|
||||||
|
is the
|
||||||
|
initial accelerator table for a window.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{misc}
|
||||||
|
|
||||||
|
@stdobjects
|
||||||
|
Objects:
|
||||||
|
wxNullAcceleratorTable
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxAcceleratorEntry, wxWindow::SetAcceleratorTable
|
||||||
|
*/
|
||||||
|
class wxAcceleratorTable : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Loads the accelerator table from a Windows resource (Windows only).
|
||||||
|
|
||||||
|
@param n
|
||||||
|
Number of accelerator entries.
|
||||||
|
|
||||||
|
@param entries
|
||||||
|
The array of entries.
|
||||||
|
|
||||||
|
@param resource
|
||||||
|
Name of a Windows accelerator.
|
||||||
|
*/
|
||||||
|
wxAcceleratorTable();
|
||||||
|
wxAcceleratorTable(const wxAcceleratorTable& bitmap);
|
||||||
|
wxAcceleratorTable(int n, wxAcceleratorEntry entries[]);
|
||||||
|
wxAcceleratorTable(const wxString& resource);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroys the wxAcceleratorTable object.
|
||||||
|
See @ref overview_refcountdestruct "reference-counted object destruction" for
|
||||||
|
more info.
|
||||||
|
*/
|
||||||
|
~wxAcceleratorTable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the accelerator table is valid.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assignment operator, using @ref overview_trefcount "reference counting".
|
||||||
|
|
||||||
|
@param accel
|
||||||
|
Accelerator table to assign.
|
||||||
|
*/
|
||||||
|
wxAcceleratorTable operator =(const wxAcceleratorTable& accel);
|
||||||
|
};
|
||||||
210
interface/access.h
Normal file
210
interface/access.h
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: access.h
|
||||||
|
// Purpose: documentation for wxAccessible class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAccessible
|
||||||
|
@wxheader{access.h}
|
||||||
|
|
||||||
|
The wxAccessible class allows wxWidgets applications, and
|
||||||
|
wxWidgets itself, to return extended information about user interface elements
|
||||||
|
to client applications such as screen readers. This is the
|
||||||
|
main way in which wxWidgets implements accessibility features.
|
||||||
|
|
||||||
|
At present, only Microsoft Active Accessibility is supported
|
||||||
|
by this class.
|
||||||
|
|
||||||
|
To use this class, derive from wxAccessible, implement appropriate
|
||||||
|
functions, and associate an object of the class with a
|
||||||
|
window using wxWindow::SetAccessible.
|
||||||
|
|
||||||
|
All functions return an indication of success, failure, or not implemented
|
||||||
|
using values of the wxAccStatus enum type.
|
||||||
|
|
||||||
|
If you return wxACC_NOT_IMPLEMENTED from any function, the system will try to
|
||||||
|
implement the appropriate functionality. However this will not work with
|
||||||
|
all functions.
|
||||||
|
|
||||||
|
Most functions work with an @e object id, which can be zero to refer to
|
||||||
|
'this' UI element, or greater than zero to refer to the nth child element.
|
||||||
|
This allows you to specify elements that don't have a corresponding wxWindow or
|
||||||
|
wxAccessible; for example, the sash of a splitter window.
|
||||||
|
|
||||||
|
For details on the semantics of functions and types, please refer to the
|
||||||
|
Microsoft Active Accessibility 1.2 documentation.
|
||||||
|
|
||||||
|
This class is compiled into wxWidgets only if the wxUSE_ACCESSIBILITY setup
|
||||||
|
symbol is set to 1.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
*/
|
||||||
|
class wxAccessible : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor, taking an optional window. The object can be associated with
|
||||||
|
a window later.
|
||||||
|
*/
|
||||||
|
wxAccessible(wxWindow* win = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxAccessible();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Performs the default action for the object. @e childId is 0 (the action for
|
||||||
|
this object)
|
||||||
|
or greater than 0 (the action for a child). Return wxACC_NOT_SUPPORTED if there
|
||||||
|
is no default action for this window (e.g. an edit control).
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus DoDefaultAction(int childId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the specified child (starting from 1). If @e child is @NULL and the return
|
||||||
|
value is wxACC_OK,
|
||||||
|
this means that the child is a simple element and not an accessible object.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetChild(int childId, wxAccessible** child);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of children in @e childCount.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetChildCount(int* childCount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the default action for this object (0) or a child (greater than 0).
|
||||||
|
Return wxACC_OK even if there is no action. @e actionName is the action, or the
|
||||||
|
empty
|
||||||
|
string if there is no action. The retrieved string describes the action that is
|
||||||
|
performed on an object,
|
||||||
|
not what the object does as a result. For example, a toolbar button that prints
|
||||||
|
a document has a default action of "Press" rather than "Prints the current
|
||||||
|
document."
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetDefaultAction(int childId,
|
||||||
|
wxString* actionName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the description for this object or a child.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetDescription(int childId,
|
||||||
|
wxString* description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the window with the keyboard focus. If childId is 0 and child is @NULL, no
|
||||||
|
object in
|
||||||
|
this subhierarchy has the focus. If this object has the focus, child should be
|
||||||
|
'this'.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetFocus(int* childId, wxAccessible** child);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns help text for this object or a child, similar to tooltip text.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetHelpText(int childId, wxString* helpText);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the keyboard shortcut for this object or child.
|
||||||
|
Return e.g. ALT+K.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetKeyboardShortcut(int childId,
|
||||||
|
wxString* shortcut);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the rectangle for this object (id is 0) or a child element (id is
|
||||||
|
greater than 0).
|
||||||
|
@e rect is in screen coordinates.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetLocation(wxRect& rect, int elementId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the name of the specified object.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetName(int childId, wxString* name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the parent of this object, or @NULL.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetParent(wxAccessible** parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a role constant describing this object. See wxAccessible for a list
|
||||||
|
of these roles.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetRole(int childId, wxAccRole* role);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets a variant representing the selected children
|
||||||
|
of this object.
|
||||||
|
|
||||||
|
Acceptable values are:
|
||||||
|
|
||||||
|
a null variant (IsNull() returns TRUE)
|
||||||
|
a list variant (GetType() == wxT("list"))
|
||||||
|
an integer representing the selected child element,
|
||||||
|
or 0 if this object is selected (GetType() == wxT("long"))
|
||||||
|
a "void*" pointer to a wxAccessible child object
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetSelections(wxVariant* selections);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a state constant. See wxAccessible for a list
|
||||||
|
of these states.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetState(int childId, long* state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a localized string representing the value for the object
|
||||||
|
or child.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus GetValue(int childId, wxString* strValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the window associated with this object.
|
||||||
|
*/
|
||||||
|
wxWindow* GetWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a status value and object id to indicate whether the given point was on
|
||||||
|
this or
|
||||||
|
a child object. Can return either a child object, or an integer
|
||||||
|
representing the child element, starting from 1.
|
||||||
|
|
||||||
|
@e pt is in screen coordinates.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus HitTest(const wxPoint& pt, int* childId,
|
||||||
|
wxAccessible** childObject);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Navigates from @e fromId to @e toId/@e toObject.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus Navigate(wxNavDir navDir, int fromId,
|
||||||
|
int* toId,
|
||||||
|
wxAccessible** toObject);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Allows the application to send an event when something changes in an accessible
|
||||||
|
object.
|
||||||
|
*/
|
||||||
|
virtual static void NotifyEvent(int eventType, wxWindow* window,
|
||||||
|
wxAccObject objectType,
|
||||||
|
int objectType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Selects the object or child. See wxAccessible for a list
|
||||||
|
of the selection actions.
|
||||||
|
*/
|
||||||
|
virtual wxAccStatus Select(int childId,
|
||||||
|
wxAccSelectionFlags selectFlags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the window associated with this object.
|
||||||
|
*/
|
||||||
|
void SetWindow(wxWindow* window);
|
||||||
|
};
|
||||||
296
interface/animate.h
Normal file
296
interface/animate.h
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: animate.h
|
||||||
|
// Purpose: documentation for wxAnimationCtrl class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAnimationCtrl
|
||||||
|
@wxheader{animate.h}
|
||||||
|
|
||||||
|
This is a static control which displays an animation.
|
||||||
|
wxAnimationCtrl API is simple as possible and won't give you full control on the
|
||||||
|
animation; if you need it then use wxMediaCtrl.
|
||||||
|
|
||||||
|
This control is useful to display a (small) animation while doing a long task
|
||||||
|
(e.g. a "throbber").
|
||||||
|
|
||||||
|
It is only available if @c wxUSE_ANIMATIONCTRL is set to 1 (the default).
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxAC_DEFAULT_STYLE}:
|
||||||
|
The default style: wxBORDER_NONE.
|
||||||
|
@style{wxAC_NO_AUTORESIZE}:
|
||||||
|
By default, the control will adjust its size to exactly fit to the
|
||||||
|
size of the animation when SetAnimation is called. If this style
|
||||||
|
flag is given, the control will not change its size
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{animationctrl.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxAnimation
|
||||||
|
*/
|
||||||
|
class wxAnimationCtrl : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Initializes the object and calls Create() with
|
||||||
|
all the parameters.
|
||||||
|
*/
|
||||||
|
wxAnimationCtrl(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxAnimation& anim,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxAC_DEFAULT_STYLE,
|
||||||
|
const wxString& name = "animationctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
After control creation you must explicitely call Play()
|
||||||
|
to start to play the animation. Until that function won't be called, the first
|
||||||
|
frame
|
||||||
|
of the animation is displayed.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window, must be non-@NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The identifier for the control.
|
||||||
|
|
||||||
|
@param anim
|
||||||
|
The initial animation shown in the control.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Initial position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Initial size.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style, see wxAC_* flags.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Control name.
|
||||||
|
|
||||||
|
@returns @true if the control was successfully created or @false if
|
||||||
|
creation failed.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxAnimation& anim,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxAC_DEFAULT_STYLE,
|
||||||
|
const wxString& name = "animationctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the animation associated with this control.
|
||||||
|
*/
|
||||||
|
wxAnimation GetAnimation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the inactive bitmap shown in this control when the;
|
||||||
|
see SetInactiveBitmap() for more info.
|
||||||
|
*/
|
||||||
|
wxBitmap GetInactiveBitmap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the animation is being played.
|
||||||
|
*/
|
||||||
|
bool IsPlaying();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads the animation from the given file and calls SetAnimation().
|
||||||
|
See wxAnimation::LoadFile for more info.
|
||||||
|
*/
|
||||||
|
bool LoadFile(const wxString & file,
|
||||||
|
wxAnimationType animType = wxANIMATION_TYPE_ANY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Starts playing the animation.
|
||||||
|
The animation is always played in loop mode (unless the last frame of the
|
||||||
|
animation
|
||||||
|
has an infinite delay time) and always start from the first frame
|
||||||
|
(even if you @ref stop() stopped it while some other frame was
|
||||||
|
displayed).
|
||||||
|
*/
|
||||||
|
bool Play();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the animation to play in this control.
|
||||||
|
If the previous animation is being played, it's @ref stop() Stopped.
|
||||||
|
|
||||||
|
Until Play() isn't called, a static image, the first
|
||||||
|
frame of the given animation or the background colour will be shown
|
||||||
|
(see SetInactiveBitmap() for more info).
|
||||||
|
*/
|
||||||
|
void SetAnimation(const wxAnimation & anim);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the bitmap to show on the control when it's not playing an animation.
|
||||||
|
If you set as inactive bitmap @c wxNullBitmap (which is the default), then the
|
||||||
|
first frame of the animation is instead shown when the control is inactive; in
|
||||||
|
this case,
|
||||||
|
if there's no valid animation associated with the control (see
|
||||||
|
wxAnimationCtrl::SetAnimation),
|
||||||
|
then the background colour of the window is shown.
|
||||||
|
|
||||||
|
If the control is not playing the animation, the given bitmap will be
|
||||||
|
immediately
|
||||||
|
shown, otherwise it will be shown as soon as Stop()
|
||||||
|
is called.
|
||||||
|
|
||||||
|
Note that the inactive bitmap, if smaller than the control's size, will be
|
||||||
|
centered in
|
||||||
|
the control; if bigger, it will be stretched to fit it.
|
||||||
|
*/
|
||||||
|
void SetInactiveBitmap(const wxBitmap& bmp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Stops playing the animation.
|
||||||
|
The control will show the first frame of the animation, a custom static image or
|
||||||
|
the window's background colour as specified by the
|
||||||
|
last SetInactiveBitmap() call.
|
||||||
|
*/
|
||||||
|
void Stop();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAnimation
|
||||||
|
@wxheader{animate.h}
|
||||||
|
|
||||||
|
This class encapsulates the concept of a platform-dependent animation.
|
||||||
|
An animation is a sequence of frames of the same size.
|
||||||
|
Sound is not supported by wxAnimation.
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@stdobjects
|
||||||
|
Objects:
|
||||||
|
wxNullAnimation
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxAnimationCtrl
|
||||||
|
*/
|
||||||
|
class wxAnimation : public wxGDIObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Loads an animation from a file.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The name of the file to load.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
See LoadFile for more info.
|
||||||
|
*/
|
||||||
|
wxAnimation();
|
||||||
|
wxAnimation(const wxAnimation& anim);
|
||||||
|
wxAnimation(const wxString& name,
|
||||||
|
wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
See @ref overview_refcountdestruct "reference-counted object destruction" for
|
||||||
|
more info.
|
||||||
|
*/
|
||||||
|
~wxAnimation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the delay for the i-th frame in milliseconds.
|
||||||
|
If @c -1 is returned the frame is to be displayed forever.
|
||||||
|
*/
|
||||||
|
int GetDelay(unsigned int i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the i-th frame as a wxImage.
|
||||||
|
*/
|
||||||
|
wxImage GetFrame(unsigned int i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of frames for this animation.
|
||||||
|
*/
|
||||||
|
unsigned int GetFrameCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the size of the animation.
|
||||||
|
*/
|
||||||
|
wxSize GetSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if animation data is present.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads an animation from the given stream.
|
||||||
|
|
||||||
|
@param stream
|
||||||
|
The stream to use to load the animation.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
One of the following values:
|
||||||
|
|
||||||
|
|
||||||
|
wxANIMATION_TYPE_GIF
|
||||||
|
|
||||||
|
|
||||||
|
Load an animated GIF file.
|
||||||
|
|
||||||
|
wxANIMATION_TYPE_ANI
|
||||||
|
|
||||||
|
|
||||||
|
Load an ANI file.
|
||||||
|
|
||||||
|
wxANIMATION_TYPE_ANY
|
||||||
|
|
||||||
|
|
||||||
|
Try to autodetect the filetype.
|
||||||
|
|
||||||
|
@returns @true if the operation succeeded, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool Load(wxInputStream& stream,
|
||||||
|
wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads an animation from a file.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
A filename.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
One of the following values:
|
||||||
|
|
||||||
|
|
||||||
|
wxANIMATION_TYPE_GIF
|
||||||
|
|
||||||
|
|
||||||
|
Load an animated GIF file.
|
||||||
|
|
||||||
|
wxANIMATION_TYPE_ANI
|
||||||
|
|
||||||
|
|
||||||
|
Load an ANI file.
|
||||||
|
|
||||||
|
wxANIMATION_TYPE_ANY
|
||||||
|
|
||||||
|
|
||||||
|
Try to autodetect the filetype.
|
||||||
|
|
||||||
|
@returns @true if the operation succeeded, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool LoadFile(const wxString& name,
|
||||||
|
wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assignment operator, using @ref overview_trefcount "reference counting".
|
||||||
|
*/
|
||||||
|
wxAnimation operator =(const wxAnimation& brush);
|
||||||
|
};
|
||||||
937
interface/app.h
Normal file
937
interface/app.h
Normal file
@@ -0,0 +1,937 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: app.h
|
||||||
|
// Purpose: documentation for wxApp class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxApp
|
||||||
|
@wxheader{app.h}
|
||||||
|
|
||||||
|
The @b wxApp class represents the application itself. It is used
|
||||||
|
to:
|
||||||
|
|
||||||
|
set and get application-wide properties;
|
||||||
|
implement the windowing system message or event loop;
|
||||||
|
initiate application processing via wxApp::OnInit;
|
||||||
|
allow default processing of events not handled by other
|
||||||
|
objects in the application.
|
||||||
|
|
||||||
|
You should use the macro IMPLEMENT_APP(appClass) in your application
|
||||||
|
implementation
|
||||||
|
file to tell wxWidgets how to create an instance of your application class.
|
||||||
|
|
||||||
|
Use DECLARE_APP(appClass) in a header file if you want the wxGetApp function
|
||||||
|
(which returns
|
||||||
|
a reference to your application object) to be visible to other files.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{appmanagement}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxappoverview "wxApp overview"
|
||||||
|
*/
|
||||||
|
class wxApp : public wxEvtHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Called implicitly with a definition of a wxApp object.
|
||||||
|
*/
|
||||||
|
wxApp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor. Will be called implicitly on program exit if the wxApp
|
||||||
|
object is created on the stack.
|
||||||
|
*/
|
||||||
|
~wxApp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a wxLog class for the application to use for logging errors. The default
|
||||||
|
implementation returns a new wxLogGui class.
|
||||||
|
|
||||||
|
@sa wxLog
|
||||||
|
*/
|
||||||
|
virtual wxLog* CreateLogTarget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the wxAppTraits object when GetTraits()
|
||||||
|
needs it for the first time.
|
||||||
|
|
||||||
|
@sa wxAppTraits
|
||||||
|
*/
|
||||||
|
virtual wxAppTraits * CreateTraits();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Dispatches the next event in the windowing system event queue.
|
||||||
|
|
||||||
|
This can be used for programming event loops, e.g.
|
||||||
|
|
||||||
|
@sa Pending()
|
||||||
|
*/
|
||||||
|
virtual void Dispatch();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Call this to explicitly exit the main message (event) loop.
|
||||||
|
You should normally exit the main loop (and the application) by deleting
|
||||||
|
the top window.
|
||||||
|
*/
|
||||||
|
virtual void ExitMainLoop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called before processing any event and allows the application
|
||||||
|
to preempt the processing of some events. If this method returns -1 the event
|
||||||
|
is processed normally, otherwise either @true or @false should be
|
||||||
|
returned and the event processing stops immediately considering that the event
|
||||||
|
had been already processed (for the former return value) or that it is not
|
||||||
|
going to be processed at all (for the latter one).
|
||||||
|
*/
|
||||||
|
int FilterEvent(wxEvent& event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the user-readable application name. The difference between this string
|
||||||
|
and the one returned by GetAppName() is that this one
|
||||||
|
is meant to be shown to the user and so should be used for the window titles,
|
||||||
|
page headers and so on while the other one should be only used internally, e.g.
|
||||||
|
for the file names or configuration file keys.
|
||||||
|
|
||||||
|
By default, returns the same string as GetAppName().
|
||||||
|
|
||||||
|
This function is new since wxWidgets version 2.9.0
|
||||||
|
*/
|
||||||
|
wxString GetAppDisplayName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the application name.
|
||||||
|
|
||||||
|
@remarks wxWidgets sets this to a reasonable default before calling
|
||||||
|
OnInit(), but the application can reset it at
|
||||||
|
will.
|
||||||
|
|
||||||
|
@sa GetAppDisplayName()
|
||||||
|
*/
|
||||||
|
wxString GetAppName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the class name of the application. The class name may be used in a
|
||||||
|
platform specific
|
||||||
|
manner to refer to the application.
|
||||||
|
|
||||||
|
@sa SetClassName()
|
||||||
|
*/
|
||||||
|
wxString GetClassName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the application will exit when the top-level window is deleted,
|
||||||
|
@false
|
||||||
|
otherwise.
|
||||||
|
|
||||||
|
@sa SetExitOnFrameDelete(), @ref overview_wxappshutdownoverview "wxApp
|
||||||
|
shutdown overview"
|
||||||
|
*/
|
||||||
|
bool GetExitOnFrameDelete();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the one and only global application object.
|
||||||
|
Usually @c wxTheApp is usead instead.
|
||||||
|
|
||||||
|
@sa SetInstance()
|
||||||
|
*/
|
||||||
|
static wxAppConsole * GetInstance();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the top window.
|
||||||
|
|
||||||
|
@remarks If the top window hasn't been set using SetTopWindow(),
|
||||||
|
this function will find the first top-level window
|
||||||
|
(frame or dialog) and return that.
|
||||||
|
|
||||||
|
@sa SetTopWindow()
|
||||||
|
*/
|
||||||
|
virtual wxWindow * GetTopWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the wxAppTraits object for the application.
|
||||||
|
If you want to customize the wxAppTraits object, you must override the
|
||||||
|
CreateTraits() function.
|
||||||
|
*/
|
||||||
|
wxAppTraits * GetTraits();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the application will use the best visual on systems that support
|
||||||
|
different visuals, @false otherwise.
|
||||||
|
|
||||||
|
@sa SetUseBestVisual()
|
||||||
|
*/
|
||||||
|
bool GetUseBestVisual();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the user-readable vendor name. The difference between this string
|
||||||
|
and the one returned by GetVendorName() is that this one
|
||||||
|
is meant to be shown to the user and so should be used for the window titles,
|
||||||
|
page headers and so on while the other one should be only used internally, e.g.
|
||||||
|
for the file names or configuration file keys.
|
||||||
|
|
||||||
|
By default, returns the same string as GetVendorName().
|
||||||
|
|
||||||
|
This function is new since wxWidgets version 2.9.0
|
||||||
|
*/
|
||||||
|
wxString GetVendorDisplayName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the application's vendor name.
|
||||||
|
*/
|
||||||
|
wxString GetVendorName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function simply invokes the given method @e func of the specified
|
||||||
|
event handler @e handler with the @e event as parameter. It exists solely
|
||||||
|
to allow to catch the C++ exceptions which could be thrown by all event
|
||||||
|
handlers in the application in one place: if you want to do this, override this
|
||||||
|
function in your wxApp-derived class and add try/catch clause(s) to it.
|
||||||
|
*/
|
||||||
|
virtual void HandleEvent(wxEvtHandler handler,
|
||||||
|
wxEventFunction func,
|
||||||
|
wxEvent& event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the application is active, i.e. if one of its windows is
|
||||||
|
currently in the foreground. If this function returns @false and you need to
|
||||||
|
attract users attention to the application, you may use
|
||||||
|
wxTopLevelWindow::RequestUserAttention
|
||||||
|
to do it.
|
||||||
|
*/
|
||||||
|
bool IsActive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the main event loop is currently running, i.e. if the
|
||||||
|
application is inside OnRun().
|
||||||
|
|
||||||
|
This can be useful to test whether events can be dispatched. For example,
|
||||||
|
if this function returns @false, non-blocking sockets cannot be used because
|
||||||
|
the events from them would never be processed.
|
||||||
|
*/
|
||||||
|
static bool IsMainLoopRunning();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Mac specific. Called in response of an "open-application" Apple event.
|
||||||
|
Override this to create a new document in your app.
|
||||||
|
*/
|
||||||
|
void MacNewFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Mac specific. Called in response of an "open-document" Apple event. You need to
|
||||||
|
override this method in order to open a document file after the
|
||||||
|
user double clicked on it or if the document file was dropped
|
||||||
|
on either the running application or the application icon in
|
||||||
|
Finder.
|
||||||
|
*/
|
||||||
|
void MacOpenFile(const wxString& fileName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Mac specific. Called in response of a "get-url" Apple event.
|
||||||
|
*/
|
||||||
|
void MacOpenURL(const wxString& url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Mac specific. Called in response of a "print-document" Apple event.
|
||||||
|
*/
|
||||||
|
void MacPrintFile(const wxString& fileName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Mac specific. Called in response of a "reopen-application" Apple event.
|
||||||
|
*/
|
||||||
|
void MacReopenApp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called by wxWidgets on creation of the application. Override this if you wish
|
||||||
|
to provide your own (environment-dependent) main loop.
|
||||||
|
|
||||||
|
@returns Returns 0 under X, and the wParam of the WM_QUIT message under
|
||||||
|
Windows.
|
||||||
|
*/
|
||||||
|
virtual int MainLoop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called when an assert failure occurs, i.e. the condition
|
||||||
|
specified in wxASSERT macro evaluated to @false.
|
||||||
|
It is only called in debug mode (when @c __WXDEBUG__ is defined) as
|
||||||
|
asserts are not left in the release code at all.
|
||||||
|
|
||||||
|
The base class version shows the default assert failure dialog box proposing to
|
||||||
|
the user to stop the program, continue or ignore all subsequent asserts.
|
||||||
|
|
||||||
|
@param file
|
||||||
|
the name of the source file where the assert occurred
|
||||||
|
|
||||||
|
@param line
|
||||||
|
the line number in this file where the assert occurred
|
||||||
|
|
||||||
|
@param func
|
||||||
|
the name of the function where the assert occurred, may be
|
||||||
|
empty if the compiler doesn't support C99 __FUNCTION__
|
||||||
|
|
||||||
|
@param cond
|
||||||
|
the condition of the failed assert in text form
|
||||||
|
|
||||||
|
@param msg
|
||||||
|
the message specified as argument to
|
||||||
|
wxASSERT_MSG or wxFAIL_MSG, will
|
||||||
|
be @NULL if just wxASSERT or wxFAIL
|
||||||
|
was used
|
||||||
|
*/
|
||||||
|
void OnAssertFailure(const wxChar file, int line,
|
||||||
|
const wxChar func,
|
||||||
|
const wxChar cond,
|
||||||
|
const wxChar msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called when command line parsing fails (i.e. an incorrect command line option
|
||||||
|
was specified by the user). The default behaviour is to show the program usage
|
||||||
|
text and abort the program.
|
||||||
|
|
||||||
|
Return @true to continue normal execution or @false to return
|
||||||
|
@false from OnInit() thus terminating the program.
|
||||||
|
|
||||||
|
@sa OnInitCmdLine()
|
||||||
|
*/
|
||||||
|
bool OnCmdLineError(wxCmdLineParser& parser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called when the help option (@c --help) was specified on the command line.
|
||||||
|
The default behaviour is to show the program usage text and abort the program.
|
||||||
|
|
||||||
|
Return @true to continue normal execution or @false to return
|
||||||
|
@false from OnInit() thus terminating the program.
|
||||||
|
|
||||||
|
@sa OnInitCmdLine()
|
||||||
|
*/
|
||||||
|
bool OnCmdLineHelp(wxCmdLineParser& parser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called after the command line had been successfully parsed. You may override
|
||||||
|
this method to test for the values of the various parameters which could be
|
||||||
|
set from the command line.
|
||||||
|
|
||||||
|
Don't forget to call the base class version unless you want to suppress
|
||||||
|
processing of the standard command line options.
|
||||||
|
|
||||||
|
Return @true to continue normal execution or @false to return
|
||||||
|
@false from OnInit() thus terminating the program.
|
||||||
|
|
||||||
|
@sa OnInitCmdLine()
|
||||||
|
*/
|
||||||
|
bool OnCmdLineParsed(wxCmdLineParser& parser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called if an unhandled exception occurs inside the main
|
||||||
|
application event loop. It can return @true to ignore the exception and to
|
||||||
|
continue running the loop or @false to exit the loop and terminate the
|
||||||
|
program. In the latter case it can also use C++ @c throw keyword to
|
||||||
|
rethrow the current exception.
|
||||||
|
|
||||||
|
The default behaviour of this function is the latter in all ports except under
|
||||||
|
Windows where a dialog is shown to the user which allows him to choose between
|
||||||
|
the different options. You may override this function in your class to do
|
||||||
|
something more appropriate.
|
||||||
|
|
||||||
|
Finally note that if the exception is rethrown from here, it can be caught in
|
||||||
|
OnUnhandledException().
|
||||||
|
*/
|
||||||
|
virtual bool OnExceptionInMainLoop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override this member function for any processing which needs to be
|
||||||
|
done as the application is about to exit. OnExit is called after
|
||||||
|
destroying all application windows and controls, but before
|
||||||
|
wxWidgets cleanup. Note that it is not called at all if
|
||||||
|
OnInit() failed.
|
||||||
|
|
||||||
|
The return value of this function is currently ignored, return the same value
|
||||||
|
as returned by the base class method if you override it.
|
||||||
|
*/
|
||||||
|
virtual int OnExit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function may be called if something fatal happens: an unhandled
|
||||||
|
exception under Win32 or a a fatal signal under Unix, for example. However,
|
||||||
|
this will not happen by default: you have to explicitly call
|
||||||
|
wxHandleFatalExceptions to enable this.
|
||||||
|
|
||||||
|
Generally speaking, this function should only show a message to the user and
|
||||||
|
return. You may attempt to save unsaved data but this is not guaranteed to
|
||||||
|
work and, in fact, probably won't.
|
||||||
|
|
||||||
|
@sa wxHandleFatalExceptions
|
||||||
|
*/
|
||||||
|
void OnFatalException();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This must be provided by the application, and will usually create the
|
||||||
|
application's main window, optionally calling
|
||||||
|
SetTopWindow(). You may use
|
||||||
|
OnExit() to clean up anything initialized here, provided
|
||||||
|
that the function returns @true.
|
||||||
|
|
||||||
|
Notice that if you want to to use the command line processing provided by
|
||||||
|
wxWidgets you have to call the base class version in the derived class
|
||||||
|
OnInit().
|
||||||
|
|
||||||
|
Return @true to continue processing, @false to exit the application
|
||||||
|
immediately.
|
||||||
|
*/
|
||||||
|
bool OnInit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called from OnInit() and may be used to initialize the
|
||||||
|
parser with the command line options for this application. The base class
|
||||||
|
versions adds support for a few standard options only.
|
||||||
|
*/
|
||||||
|
void OnInitCmdLine(wxCmdLineParser& parser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This virtual function is where the execution of a program written in wxWidgets
|
||||||
|
starts. The default implementation just enters the main loop and starts
|
||||||
|
handling the events until it terminates, either because
|
||||||
|
ExitMainLoop() has been explicitly called or because
|
||||||
|
the last frame has been deleted and
|
||||||
|
GetExitOnFrameDelete() flag is @true (this
|
||||||
|
is the default).
|
||||||
|
|
||||||
|
The return value of this function becomes the exit code of the program, so it
|
||||||
|
should return 0 in case of successful termination.
|
||||||
|
*/
|
||||||
|
virtual int OnRun();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called when an unhandled C++ exception occurs inside
|
||||||
|
OnRun() (the exceptions which occur during the program
|
||||||
|
startup and shutdown might not be caught at all). Notice that by now the main
|
||||||
|
event loop has been terminated and the program will exit, if you want to
|
||||||
|
prevent this from happening (i.e. continue running after catching an exception)
|
||||||
|
you need to override OnExceptionInMainLoop().
|
||||||
|
|
||||||
|
The default implementation shows information about the exception in debug build
|
||||||
|
but does nothing in the release build.
|
||||||
|
*/
|
||||||
|
virtual void OnUnhandledException();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if unprocessed events are in the window system event queue.
|
||||||
|
|
||||||
|
@sa Dispatch()
|
||||||
|
*/
|
||||||
|
virtual bool Pending();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Windows-only function for processing a message. This function
|
||||||
|
is called from the main message loop, checking for windows that
|
||||||
|
may wish to process it. The function returns @true if the message
|
||||||
|
was processed, @false otherwise. If you use wxWidgets with another class
|
||||||
|
library with its own message loop, you should make sure that this
|
||||||
|
function is called to allow wxWidgets to receive messages. For example,
|
||||||
|
to allow co-existence with the Microsoft Foundation Classes, override
|
||||||
|
the PreTranslateMessage function:
|
||||||
|
*/
|
||||||
|
bool ProcessMessage(WXMSG * msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sends idle events to a window and its children.
|
||||||
|
|
||||||
|
Please note that this function is internal to wxWidgets and shouldn't be used
|
||||||
|
by user code.
|
||||||
|
|
||||||
|
@remarks These functions poll the top-level windows, and their children,
|
||||||
|
for idle event processing. If @true is returned, more
|
||||||
|
OnIdle processing is requested by one or more window.
|
||||||
|
|
||||||
|
@sa wxIdleEvent
|
||||||
|
*/
|
||||||
|
bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the application name to be used in the user-visible places such as window
|
||||||
|
titles. See GetAppDisplayName() for more about
|
||||||
|
the differences between the display name and name.
|
||||||
|
*/
|
||||||
|
void SetAppDisplayName(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the name of the application. This name should be used for file names,
|
||||||
|
configuration file entries and other internal strings. For the user-visible
|
||||||
|
strings, such as the window titles, the application display name set by
|
||||||
|
SetAppDisplayName() is used instead.
|
||||||
|
|
||||||
|
By default the application name is set to the name of its executable file.
|
||||||
|
|
||||||
|
@sa GetAppName()
|
||||||
|
*/
|
||||||
|
void SetAppName(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the class name of the application. This may be used in a platform specific
|
||||||
|
manner to refer to the application.
|
||||||
|
|
||||||
|
@sa GetClassName()
|
||||||
|
*/
|
||||||
|
void SetClassName(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Allows the programmer to specify whether the application will exit when the
|
||||||
|
top-level frame is deleted.
|
||||||
|
|
||||||
|
@param flag
|
||||||
|
If @true (the default), the application will exit when the top-level frame is
|
||||||
|
deleted. If @false, the application will continue to run.
|
||||||
|
|
||||||
|
@sa GetExitOnFrameDelete(), @ref overview_wxappshutdownoverview "wxApp
|
||||||
|
shutdown overview"
|
||||||
|
*/
|
||||||
|
void SetExitOnFrameDelete(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Allows external code to modify global @c wxTheApp, but you should really
|
||||||
|
know what you're doing if you call it.
|
||||||
|
|
||||||
|
@param app
|
||||||
|
Replacement for the global application object.
|
||||||
|
|
||||||
|
@sa GetInstance()
|
||||||
|
*/
|
||||||
|
static void SetInstance(wxAppConsole* app);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Allows runtime switching of the UI environment theme. Currently implemented for
|
||||||
|
wxGTK2-only.
|
||||||
|
|
||||||
|
Return @true if theme was successfully changed.
|
||||||
|
|
||||||
|
@param theme
|
||||||
|
The name of the new theme or an absolute path to a gtkrc-theme-file
|
||||||
|
*/
|
||||||
|
bool SetNativeTheme();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the 'top' window. You can call this from within OnInit() to
|
||||||
|
let wxWidgets know which is the main window. You don't have to set the top
|
||||||
|
window;
|
||||||
|
it is only a convenience so that (for example) certain dialogs without parents
|
||||||
|
can use a
|
||||||
|
specific window as the top window. If no top window is specified by the
|
||||||
|
application,
|
||||||
|
wxWidgets just uses the first frame or dialog in its top-level window list,
|
||||||
|
when it
|
||||||
|
needs to use the top window.
|
||||||
|
|
||||||
|
@param window
|
||||||
|
The new top window.
|
||||||
|
|
||||||
|
@sa GetTopWindow(), OnInit()
|
||||||
|
*/
|
||||||
|
void SetTopWindow(wxWindow* window);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Allows the programmer to specify whether the application will use the best
|
||||||
|
visual
|
||||||
|
on systems that support several visual on the same display. This is typically
|
||||||
|
the
|
||||||
|
case under Solaris and IRIX, where the default visual is only 8-bit whereas
|
||||||
|
certain
|
||||||
|
applications are supposed to run in TrueColour mode.
|
||||||
|
|
||||||
|
If @e forceTrueColour is @true then the application will try to force
|
||||||
|
using a TrueColour visual and abort the app if none is found.
|
||||||
|
|
||||||
|
Note that this function has to be called in the constructor of the @c wxApp
|
||||||
|
instance and won't have any effect when called later on.
|
||||||
|
|
||||||
|
This function currently only has effect under GTK.
|
||||||
|
|
||||||
|
@param flag
|
||||||
|
If @true, the app will use the best visual.
|
||||||
|
*/
|
||||||
|
void SetUseBestVisual(bool flag, bool forceTrueColour = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the vendor name to be used in the user-visible places. See
|
||||||
|
GetVendorDisplayName() for more about
|
||||||
|
the differences between the display name and name.
|
||||||
|
*/
|
||||||
|
void SetVendorDisplayName(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the name of application's vendor. The name will be used
|
||||||
|
in registry access. A default name is set by
|
||||||
|
wxWidgets.
|
||||||
|
|
||||||
|
@sa GetVendorName()
|
||||||
|
*/
|
||||||
|
void SetVendorName(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Yields control to pending messages in the windowing system. This can be useful,
|
||||||
|
for example, when a
|
||||||
|
time-consuming process writes to a text window. Without an occasional
|
||||||
|
yield, the text window will not be updated properly, and on systems with
|
||||||
|
cooperative multitasking, such as Windows 3.1 other processes will not respond.
|
||||||
|
|
||||||
|
Caution should be exercised, however, since yielding may allow the
|
||||||
|
user to perform actions which are not compatible with the current task.
|
||||||
|
Disabling menu items or whole menus during processing can avoid unwanted
|
||||||
|
reentrance of code: see ::wxSafeYield for a better
|
||||||
|
function.
|
||||||
|
|
||||||
|
Note that Yield() will not flush the message logs. This is intentional as
|
||||||
|
calling Yield() is usually done to quickly update the screen and popping up a
|
||||||
|
message box dialog may be undesirable. If you do wish to flush the log
|
||||||
|
messages immediately (otherwise it will be done during the next idle loop
|
||||||
|
iteration), call wxLog::FlushActive.
|
||||||
|
|
||||||
|
Calling Yield() recursively is normally an error and an assert failure is
|
||||||
|
raised in debug build if such situation is detected. However if the
|
||||||
|
@e onlyIfNeeded parameter is @true, the method will just silently
|
||||||
|
return @false instead.
|
||||||
|
*/
|
||||||
|
bool Yield(bool onlyIfNeeded = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
int argc
|
||||||
|
|
||||||
|
Number of command line arguments (after environment-specific processing).
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
wxChar ** argv
|
||||||
|
|
||||||
|
Command line arguments (after environment-specific processing).
|
||||||
|
Under Windows and Linux/Unix, you should parse the command line
|
||||||
|
arguments and check for files to be opened when starting your
|
||||||
|
application. Under OS X, you need to override MacOpenFile()
|
||||||
|
since command line arguments are used differently there.
|
||||||
|
|
||||||
|
You may use the wxCmdLineParser to
|
||||||
|
parse command line arguments.
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
For all normal, informational messages. They also appear in a message box by
|
||||||
|
default (but it can be changed).
|
||||||
|
*/
|
||||||
|
void wxLogMessage(const char * formatString, ... );
|
||||||
|
void wxVLogMessage(const char * formatString, va_list argPtr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
For verbose output. Normally, it is suppressed, but
|
||||||
|
might be activated if the user wishes to know more details about the program
|
||||||
|
progress (another, but possibly confusing name for the same function is @b
|
||||||
|
wxLogInfo).
|
||||||
|
*/
|
||||||
|
void wxLogVerbose(const char * formatString, ... );
|
||||||
|
void wxVLogVerbose(const char * formatString, va_list argPtr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is used in headers to create a forward declaration of the
|
||||||
|
wxGetApp function implemented by
|
||||||
|
wxIMPLEMENT_APP. It creates the declaration
|
||||||
|
@c className wxGetApp(void).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
wxDECLARE_APP(MyApp)
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
#define wxDECLARE_APP() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Exits application after calling wxApp::OnExit.
|
||||||
|
Should only be used in an emergency: normally the top-level frame
|
||||||
|
should be deleted (after deleting all other frames) to terminate the
|
||||||
|
application. See wxCloseEvent and wxApp.
|
||||||
|
*/
|
||||||
|
void wxExit();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
For warnings - they are also normally shown to the user, but don't interrupt
|
||||||
|
the program work.
|
||||||
|
*/
|
||||||
|
void wxLogWarning(const char * formatString, ... );
|
||||||
|
void wxVLogWarning(const char * formatString, va_list argPtr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Like wxLogError, but also
|
||||||
|
terminates the program with the exit code 3. Using @e abort() standard
|
||||||
|
function also terminates the program with this exit code.
|
||||||
|
*/
|
||||||
|
void wxLogFatalError(const char * formatString, ... );
|
||||||
|
void wxVLogFatalError(const char * formatString,
|
||||||
|
va_list argPtr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
If @e doIt is @true, the fatal exceptions (also known as general protection
|
||||||
|
faults under Windows or segmentation violations in the Unix world) will be
|
||||||
|
caught and passed to wxApp::OnFatalException.
|
||||||
|
By default, i.e. before this function is called, they will be handled in the
|
||||||
|
normal way which usually just means that the application will be terminated.
|
||||||
|
Calling wxHandleFatalExceptions() with @e doIt equal to @false will restore
|
||||||
|
this default behaviour.
|
||||||
|
|
||||||
|
Notice that this function is only available if
|
||||||
|
@c wxUSE_ON_FATAL_EXCEPTION is 1 and under Windows platform this
|
||||||
|
requires a compiler with support for SEH (structured exception handling) which
|
||||||
|
currently means only Microsoft Visual C++ or a recent Borland C++ version.
|
||||||
|
*/
|
||||||
|
bool wxHandleFatalExceptions(bool doIt = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is used in the application class implementation file to make the
|
||||||
|
application class known to
|
||||||
|
wxWidgets for dynamic construction. You use this instead of
|
||||||
|
|
||||||
|
Old form:
|
||||||
|
@code
|
||||||
|
MyApp myApp;
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
New form:
|
||||||
|
@code
|
||||||
|
IMPLEMENT_APP(MyApp)
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
See also DECLARE_APP.
|
||||||
|
*/
|
||||||
|
#define IMPLEMENT_APP() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the error code from the last system call. This function uses
|
||||||
|
@c errno on Unix platforms and @c GetLastError under Win32.
|
||||||
|
|
||||||
|
@sa wxSysErrorMsg, wxLogSysError
|
||||||
|
*/
|
||||||
|
unsigned long wxSysErrorCode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
In a GUI application, this function posts @e event to the specified @e dest
|
||||||
|
object using wxEvtHandler::AddPendingEvent.
|
||||||
|
Otherwise, it dispatches @e event immediately using
|
||||||
|
wxEvtHandler::ProcessEvent.
|
||||||
|
See the respective documentation for details (and caveats).
|
||||||
|
*/
|
||||||
|
void wxPostEvent(wxEvtHandler * dest, wxEvent& event);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The functions to use for error messages, i.e. the messages that must be shown
|
||||||
|
to the user. The default processing is to pop up a message box to inform the
|
||||||
|
user about it.
|
||||||
|
*/
|
||||||
|
void wxLogError(const char * formatString, ... );
|
||||||
|
void wxVLogError(const char * formatString, va_list argPtr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
As @b wxLogDebug, trace functions only do something in debug build and
|
||||||
|
expand to nothing in the release one. The reason for making
|
||||||
|
it a separate function from it is that usually there are a lot of trace
|
||||||
|
messages, so it might make sense to separate them from other debug messages.
|
||||||
|
|
||||||
|
The trace messages also usually can be separated into different categories and
|
||||||
|
the second and third versions of this function only log the message if the
|
||||||
|
@e mask which it has is currently enabled in wxLog. This
|
||||||
|
allows to selectively trace only some operations and not others by changing
|
||||||
|
the value of the trace mask (possible during the run-time).
|
||||||
|
|
||||||
|
For the second function (taking a string mask), the message is logged only if
|
||||||
|
the mask has been previously enabled by the call to
|
||||||
|
wxLog::AddTraceMask or by setting
|
||||||
|
@ref overview_envvars "@c WXTRACE environment variable".
|
||||||
|
The predefined string trace masks
|
||||||
|
used by wxWidgets are:
|
||||||
|
|
||||||
|
wxTRACE_MemAlloc: trace memory allocation (new/delete)
|
||||||
|
wxTRACE_Messages: trace window messages/X callbacks
|
||||||
|
wxTRACE_ResAlloc: trace GDI resource allocation
|
||||||
|
wxTRACE_RefCount: trace various ref counting operations
|
||||||
|
wxTRACE_OleCalls: trace OLE method calls (Win32 only)
|
||||||
|
|
||||||
|
@b Caveats: since both the mask and the format string are strings,
|
||||||
|
this might lead to function signature confusion in some cases:
|
||||||
|
if you intend to call the format string only version of wxLogTrace,
|
||||||
|
then add a %s format string parameter and then supply a second string parameter
|
||||||
|
for that %s, the string mask version of wxLogTrace will erroneously get called instead, since you are supplying two string parameters to the function.
|
||||||
|
In this case you'll unfortunately have to avoid having two leading
|
||||||
|
string parameters, e.g. by adding a bogus integer (with its %d format string).
|
||||||
|
|
||||||
|
The third version of the function only logs the message if all the bits
|
||||||
|
corresponding to the @e mask are set in the wxLog trace mask which can be
|
||||||
|
set by wxLog::SetTraceMask. This version is less
|
||||||
|
flexible than the previous one because it doesn't allow defining the user
|
||||||
|
trace masks easily - this is why it is deprecated in favour of using string
|
||||||
|
trace masks.
|
||||||
|
|
||||||
|
wxTraceMemAlloc: trace memory allocation (new/delete)
|
||||||
|
wxTraceMessages: trace window messages/X callbacks
|
||||||
|
wxTraceResAlloc: trace GDI resource allocation
|
||||||
|
wxTraceRefCount: trace various ref counting operations
|
||||||
|
wxTraceOleCalls: trace OLE method calls (Win32 only)
|
||||||
|
*/
|
||||||
|
void wxLogTrace(const char * formatString, ... );
|
||||||
|
void wxVLogTrace(const char * formatString, va_list argPtr);
|
||||||
|
void wxLogTrace(const char * mask, const char * formatString,
|
||||||
|
... );
|
||||||
|
void wxVLogTrace(const char * mask,
|
||||||
|
const char * formatString,
|
||||||
|
va_list argPtr);
|
||||||
|
void wxLogTrace(wxTraceMask mask, const char * formatString,
|
||||||
|
... );
|
||||||
|
void wxVLogTrace(wxTraceMask mask, const char * formatString,
|
||||||
|
va_list argPtr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the error message corresponding to the given system error code. If
|
||||||
|
@e errCode is 0 (default), the last error code (as returned by
|
||||||
|
wxSysErrorCode) is used.
|
||||||
|
|
||||||
|
@sa wxSysErrorCode, wxLogSysError
|
||||||
|
*/
|
||||||
|
const wxChar * wxSysErrorMsg(unsigned long errCode = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is for use in console (wxBase) programs only. It must be called
|
||||||
|
once for each previous successful call to wxInitialize.
|
||||||
|
*/
|
||||||
|
void wxUninitialize();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The right functions for debug output. They only do something in debug
|
||||||
|
mode (when the preprocessor symbol __WXDEBUG__ is defined) and expand to
|
||||||
|
nothing in release mode (otherwise).
|
||||||
|
*/
|
||||||
|
void wxLogDebug(const char * formatString, ... );
|
||||||
|
void wxVLogDebug(const char * formatString, va_list argPtr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function doesn't exist in wxWidgets but it is created by using
|
||||||
|
the IMPLEMENT_APP macro. Thus, before using it
|
||||||
|
anywhere but in the same module where this macro is used, you must make it
|
||||||
|
available using DECLARE_APP.
|
||||||
|
|
||||||
|
The advantage of using this function compared to directly using the global
|
||||||
|
wxTheApp pointer is that the latter is of type @c wxApp * and so wouldn't
|
||||||
|
allow you to access the functions specific to your application class but not
|
||||||
|
present in wxApp while wxGetApp() returns the object of the right type.
|
||||||
|
*/
|
||||||
|
wxAppDerivedClass wxGetApp();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Messages logged by these functions will appear in the statusbar of the @e frame
|
||||||
|
or of the top level application window by default (i.e. when using
|
||||||
|
the second version of the functions).
|
||||||
|
|
||||||
|
If the target frame doesn't have a statusbar, the message will be lost.
|
||||||
|
*/
|
||||||
|
void wxLogStatus(wxFrame * frame, const char * formatString,
|
||||||
|
... );
|
||||||
|
void wxVLogStatus(wxFrame * frame, const char * formatString,
|
||||||
|
va_list argPtr);
|
||||||
|
void wxLogStatus(const char * formatString, ... );
|
||||||
|
void wxVLogStatus(const char * formatString, va_list argPtr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is used in wxBase only and only if you don't create
|
||||||
|
wxApp object at all. In this case you must call it from your
|
||||||
|
@c main() function before calling any other wxWidgets functions.
|
||||||
|
|
||||||
|
If the function returns @false the initialization could not be performed,
|
||||||
|
in this case the library cannot be used and
|
||||||
|
wxUninitialize shouldn't be called neither.
|
||||||
|
|
||||||
|
This function may be called several times but
|
||||||
|
wxUninitialize must be called for each successful
|
||||||
|
call to this function.
|
||||||
|
*/
|
||||||
|
bool wxInitialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is used in headers to create a forward declaration of the
|
||||||
|
wxGetApp function implemented by
|
||||||
|
IMPLEMENT_APP. It creates the declaration
|
||||||
|
@c className wxGetApp(void).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
@code
|
||||||
|
DECLARE_APP(MyApp)
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
#define DECLARE_APP() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Calls wxApp::Yield.
|
||||||
|
|
||||||
|
This function is kept only for backwards compatibility. Please use
|
||||||
|
the wxApp::Yield method instead in any new code.
|
||||||
|
*/
|
||||||
|
bool wxYield();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Mostly used by wxWidgets itself, but might be handy for logging errors after
|
||||||
|
system call (API function) failure. It logs the specified message text as well
|
||||||
|
as the last system error code (@e errno or @e ::GetLastError() depending
|
||||||
|
on the platform) and the corresponding error message. The second form
|
||||||
|
of this function takes the error code explicitly as the first argument.
|
||||||
|
|
||||||
|
@sa wxSysErrorCode, wxSysErrorMsg
|
||||||
|
*/
|
||||||
|
void wxLogSysError(const char * formatString, ... );
|
||||||
|
void wxVLogSysError(const char * formatString,
|
||||||
|
va_list argPtr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
This initializes wxWidgets in a platform-dependent way. Use this if you are not
|
||||||
|
using the default wxWidgets entry code (e.g. main or WinMain). For example, you
|
||||||
|
can initialize wxWidgets from an Microsoft Foundation Classes application using
|
||||||
|
this function.
|
||||||
|
|
||||||
|
The following overload of wxEntry is available under all platforms:
|
||||||
|
|
||||||
|
(notice that under Windows CE platform, and only there, the type of
|
||||||
|
@e pCmdLine is @c wchar_t *, otherwise it is @c char *, even in
|
||||||
|
Unicode build).
|
||||||
|
|
||||||
|
@remarks To clean up wxWidgets, call wxApp::OnExit followed by the static
|
||||||
|
function wxApp::CleanUp. For example, if exiting from
|
||||||
|
an MFC application that also uses wxWidgets:
|
||||||
|
|
||||||
|
@sa wxEntryStart
|
||||||
|
*/
|
||||||
|
int wxEntry(int& argc, wxChar ** argv);
|
||||||
|
int wxEntry(HINSTANCE hInstance,
|
||||||
|
HINSTANCE hPrevInstance = @NULL,
|
||||||
|
char * pCmdLine = @NULL,
|
||||||
|
int nCmdShow = SW_SHOWNORMAL);
|
||||||
|
//@}
|
||||||
|
|
||||||
120
interface/apptrait.h
Normal file
120
interface/apptrait.h
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: apptrait.h
|
||||||
|
// Purpose: documentation for wxAppTraits class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAppTraits
|
||||||
|
@wxheader{apptrait.h}
|
||||||
|
|
||||||
|
The @b wxAppTraits class defines various configurable aspects of a wxApp.
|
||||||
|
You can access it using wxApp::GetTraits function and you can
|
||||||
|
create your own wxAppTraits overriding the
|
||||||
|
wxApp::CreateTraits function.
|
||||||
|
|
||||||
|
By default, wxWidgets creates a @c wxConsoleAppTraits object for console
|
||||||
|
applications
|
||||||
|
(i.e. those applications linked against wxBase library only - see the
|
||||||
|
@ref overview_librarieslist "Libraries list" page) and a @c wxGUIAppTraits
|
||||||
|
object for GUI
|
||||||
|
applications.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxappoverview "wxApp overview", wxApp
|
||||||
|
*/
|
||||||
|
class wxAppTraits
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Called by wxWidgets to create the default configuration object for the
|
||||||
|
application. The default version creates a registry-based
|
||||||
|
wxRegConfig class under MSW and
|
||||||
|
wxFileConfig under all other platforms. The
|
||||||
|
wxApp wxApp::GetAppName and
|
||||||
|
wxApp::GetVendorName methods are used to determine the
|
||||||
|
registry key or file name.
|
||||||
|
*/
|
||||||
|
virtual wxConfigBase * CreateConfig();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the global font mapper object used for encodings/charset mapping.
|
||||||
|
*/
|
||||||
|
virtual wxFontMapper * CreateFontMapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the default log target for the application.
|
||||||
|
*/
|
||||||
|
virtual wxLog * CreateLogTarget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the global object used for printing out messages.
|
||||||
|
*/
|
||||||
|
virtual wxMessageOutput * CreateMessageOutput();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the renderer to use for drawing the generic controls (return value may
|
||||||
|
be @NULL
|
||||||
|
in which case the default renderer for the current platform is used);
|
||||||
|
this is used in GUI mode only and always returns @NULL in console.
|
||||||
|
|
||||||
|
NOTE: returned pointer will be deleted by the caller.
|
||||||
|
*/
|
||||||
|
virtual wxRendererNative * CreateRenderer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method returns the name of the desktop environment currently
|
||||||
|
running in a Unix desktop. Currently only "KDE" or "GNOME" are
|
||||||
|
supported and the code uses the X11 session protocol vendor name
|
||||||
|
to figure out, which desktop environment is running. The method
|
||||||
|
returns an empty string otherwise and on all other platforms.
|
||||||
|
*/
|
||||||
|
virtual wxString GetDesktopEnvironment();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the wxStandardPaths object for the application.
|
||||||
|
It's normally the same for wxBase and wxGUI except in the case of wxMac and
|
||||||
|
wxCocoa.
|
||||||
|
*/
|
||||||
|
virtual wxStandardPaths GetStandardPaths();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the wxWidgets port ID used by the running program and eventually
|
||||||
|
fills the given pointers with the values of the major and minor digits
|
||||||
|
of the native toolkit currently used.
|
||||||
|
The version numbers returned are thus detected at run-time and not compile-time
|
||||||
|
(except when this is not possible e.g. wxMotif).
|
||||||
|
|
||||||
|
E.g. if your program is using wxGTK port this function will return wxPORT_GTK
|
||||||
|
and
|
||||||
|
put in given pointers the versions of the GTK library in use.
|
||||||
|
|
||||||
|
See wxPlatformInfo for more details.
|
||||||
|
*/
|
||||||
|
virtual wxPortId GetToolkitVersion(int * major = @NULL,
|
||||||
|
int * minor = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if @c fprintf(stderr) goes somewhere, @false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool HasStderr();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the library was built as wxUniversal. Always returns
|
||||||
|
@false for wxBase-only apps.
|
||||||
|
*/
|
||||||
|
bool IsUsingUniversalWidgets();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the assert dialog with the specified message in GUI mode or just prints
|
||||||
|
the string to stderr in console mode.
|
||||||
|
|
||||||
|
Returns @true to suppress subsequent asserts, @false to continue as before.
|
||||||
|
*/
|
||||||
|
virtual bool ShowAssertDialog(const wxString & msg);
|
||||||
|
};
|
||||||
589
interface/archive.h
Normal file
589
interface/archive.h
Normal file
@@ -0,0 +1,589 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: archive.h
|
||||||
|
// Purpose: documentation for wxArchiveInputStream class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxArchiveInputStream
|
||||||
|
@wxheader{archive.h}
|
||||||
|
|
||||||
|
An abstract base class which serves as a common interface to
|
||||||
|
archive input streams such as wxZipInputStream.
|
||||||
|
|
||||||
|
wxArchiveInputStream::GetNextEntry returns an
|
||||||
|
wxArchiveEntry object containing the meta-data
|
||||||
|
for the next entry in the archive (and gives away ownership). Reading from
|
||||||
|
the wxArchiveInputStream then returns the entry's data. Eof() becomes @true
|
||||||
|
after an attempt has been made to read past the end of the entry's data.
|
||||||
|
When there are no more entries, GetNextEntry() returns @NULL and sets Eof().
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxarc "Archive formats such as zip", wxArchiveEntry,
|
||||||
|
wxArchiveOutputStream
|
||||||
|
*/
|
||||||
|
class wxArchiveInputStream : public wxFilterInputStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Closes the current entry. On a non-seekable stream reads to the end of
|
||||||
|
the current entry first.
|
||||||
|
*/
|
||||||
|
bool CloseEntry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Closes the current entry if one is open, then reads the meta-data for
|
||||||
|
the next entry and returns it in a wxArchiveEntry
|
||||||
|
object, giving away ownership. Reading this wxArchiveInputStream then
|
||||||
|
returns the entry's data.
|
||||||
|
*/
|
||||||
|
wxArchiveEntry* GetNextEntry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Closes the current entry if one is open, then opens the entry specified
|
||||||
|
by the wxArchiveEntry object.
|
||||||
|
|
||||||
|
@e entry must be from the same archive file that this
|
||||||
|
wxArchiveInputStream is reading, and it must be reading it from a
|
||||||
|
seekable stream.
|
||||||
|
*/
|
||||||
|
bool OpenEntry(wxArchiveEntry& entry);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxArchiveOutputStream
|
||||||
|
@wxheader{archive.h}
|
||||||
|
|
||||||
|
An abstract base class which serves as a common interface to
|
||||||
|
archive output streams such as wxZipOutputStream.
|
||||||
|
|
||||||
|
wxArchiveOutputStream::PutNextEntry is used
|
||||||
|
to create a new entry in the output archive, then the entry's data is
|
||||||
|
written to the wxArchiveOutputStream. Another call to PutNextEntry()
|
||||||
|
closes the current entry and begins the next.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxarc "Archive formats such as zip", wxArchiveEntry,
|
||||||
|
wxArchiveInputStream
|
||||||
|
*/
|
||||||
|
class wxArchiveOutputStream : public wxFilterOutputStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Calls Close() if it has not already
|
||||||
|
been called.
|
||||||
|
*/
|
||||||
|
~wxArchiveOutputStream();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Closes the archive, returning @true if it was successfully written.
|
||||||
|
Called by the destructor if not called explicitly.
|
||||||
|
*/
|
||||||
|
bool Close();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Close the current entry. It is called implicitly whenever another new
|
||||||
|
entry is created with CopyEntry()
|
||||||
|
or PutNextEntry(), or
|
||||||
|
when the archive is closed.
|
||||||
|
*/
|
||||||
|
bool CloseEntry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Some archive formats have additional meta-data that applies to the archive
|
||||||
|
as a whole. For example in the case of zip there is a comment, which
|
||||||
|
is stored at the end of the zip file. CopyArchiveMetaData() can be used
|
||||||
|
to transfer such information when writing a modified copy of an archive.
|
||||||
|
|
||||||
|
Since the position of the meta-data can vary between the various archive
|
||||||
|
formats, it is best to call CopyArchiveMetaData() before transferring
|
||||||
|
the entries. The wxArchiveOutputStream
|
||||||
|
will then hold on to the meta-data and write it at the correct point in
|
||||||
|
the output file.
|
||||||
|
|
||||||
|
When the input archive is being read from a non-seekable stream, the
|
||||||
|
meta-data may not be available when CopyArchiveMetaData() is called,
|
||||||
|
in which case the two streams set up a link and transfer the data
|
||||||
|
when it becomes available.
|
||||||
|
*/
|
||||||
|
bool CopyArchiveMetaData(wxArchiveInputStream& stream);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Takes ownership of @e entry and uses it to create a new entry in the
|
||||||
|
archive. @e entry is then opened in the input stream @e stream
|
||||||
|
and its contents copied to this stream.
|
||||||
|
|
||||||
|
For archive types which compress entry data, CopyEntry() is likely to be
|
||||||
|
much more efficient than transferring the data using Read() and Write()
|
||||||
|
since it will copy them without decompressing and recompressing them.
|
||||||
|
|
||||||
|
@e entry must be from the same archive file that @e stream is
|
||||||
|
accessing. For non-seekable streams, @e entry must also be the last
|
||||||
|
thing read from @e stream.
|
||||||
|
*/
|
||||||
|
bool CopyEntry(wxArchiveEntry* entry,
|
||||||
|
wxArchiveInputStream& stream);
|
||||||
|
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
Create a new directory entry
|
||||||
|
(see wxArchiveEntry::IsDir)
|
||||||
|
with the given name and timestamp.
|
||||||
|
|
||||||
|
PutNextEntry() can
|
||||||
|
also be used to create directory entries, by supplying a name with
|
||||||
|
a trailing path separator.
|
||||||
|
*/
|
||||||
|
bool PutNextDirEntry(const wxString& name);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
, @b off_t@e size = wxInvalidOffset)
|
||||||
|
|
||||||
|
Create a new entry with the given name, timestamp and size. The entry's
|
||||||
|
data can then be written by writing to this wxArchiveOutputStream.
|
||||||
|
*/
|
||||||
|
bool PutNextEntry(wxArchiveEntry* entry);
|
||||||
|
bool PutNextEntry(const wxString& name);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxArchiveEntry
|
||||||
|
@wxheader{archive.h}
|
||||||
|
|
||||||
|
An abstract base class which serves as a common interface to
|
||||||
|
archive entry classes such as wxZipEntry.
|
||||||
|
These hold the meta-data (filename, timestamp, etc.), for entries
|
||||||
|
in archive files such as zips and tars.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxarc "Archive formats such as zip", @ref overview_wxarcgeneric
|
||||||
|
"Generic archive programming", wxArchiveInputStream, wxArchiveOutputStream, wxArchiveNotifier
|
||||||
|
*/
|
||||||
|
class wxArchiveEntry : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Returns a copy of this entry object.
|
||||||
|
*/
|
||||||
|
wxArchiveEntry* Clone();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The entry's timestamp.
|
||||||
|
*/
|
||||||
|
wxDateTime GetDateTime();
|
||||||
|
void SetDateTime(const wxDateTime& dt);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The entry's name, by default in the native format. The name can include
|
||||||
|
directory components, i.e. it can be a full path.
|
||||||
|
|
||||||
|
If this is a directory entry, (i.e. if IsDir()
|
||||||
|
is @true) then GetName() returns the name with a trailing path separator.
|
||||||
|
|
||||||
|
Similarly, setting a name with a trailing path separator sets IsDir().
|
||||||
|
*/
|
||||||
|
wxString GetName(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
void SetName(const wxString& name,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The size of the entry's data in bytes.
|
||||||
|
*/
|
||||||
|
off_t GetSize();
|
||||||
|
void SetSize(off_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the path format used internally within the archive to store
|
||||||
|
filenames.
|
||||||
|
*/
|
||||||
|
wxPathFormat GetInternalFormat();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the entry's filename in the internal format used within the
|
||||||
|
archive. The name can include directory components, i.e. it can be a
|
||||||
|
full path.
|
||||||
|
|
||||||
|
The names of directory entries are returned without any trailing path
|
||||||
|
separator. This gives a canonical name that can be used in comparisons.
|
||||||
|
|
||||||
|
@sa @ref overview_wxarcbyname "Looking up an archive entry by name"
|
||||||
|
*/
|
||||||
|
wxString GetInternalName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a numeric value unique to the entry within the archive.
|
||||||
|
*/
|
||||||
|
off_t GetOffset();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
True if this is a directory entry.
|
||||||
|
|
||||||
|
Directory entries are entries with no data, which are used to store
|
||||||
|
the meta-data of directories. They also make it possible for completely
|
||||||
|
empty directories to be stored.
|
||||||
|
|
||||||
|
The names of entries within an archive can be complete paths, and
|
||||||
|
unarchivers typically create whatever directories are necessary as they
|
||||||
|
restore files, even if the archive contains no explicit directory entries.
|
||||||
|
*/
|
||||||
|
bool IsDir();
|
||||||
|
void SetIsDir(bool isDir = @true);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
True if the entry is a read-only file.
|
||||||
|
*/
|
||||||
|
bool IsReadOnly();
|
||||||
|
void SetIsReadOnly(bool isReadOnly = @true);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Sets the notifier for this entry.
|
||||||
|
Whenever the wxArchiveInputStream updates
|
||||||
|
this entry, it will then invoke the associated
|
||||||
|
notifier's wxArchiveNotifier::OnEntryUpdated
|
||||||
|
method.
|
||||||
|
|
||||||
|
Setting a notifier is not usually necessary. It is used to handle
|
||||||
|
certain cases when modifying an archive in a pipeline (i.e. between
|
||||||
|
non-seekable streams).
|
||||||
|
*/
|
||||||
|
void SetNotifier(wxArchiveNotifier& notifier);
|
||||||
|
void UnsetNotifier();
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxArchiveClassFactory
|
||||||
|
@wxheader{archive.h}
|
||||||
|
|
||||||
|
Allows the creation of streams to handle archive formats such
|
||||||
|
as zip and tar.
|
||||||
|
|
||||||
|
For example, given a filename you can search for a factory that will
|
||||||
|
handle it and create a stream to read it:
|
||||||
|
|
||||||
|
@code
|
||||||
|
factory = wxArchiveClassFactory::Find(filename, wxSTREAM_FILEEXT);
|
||||||
|
if (factory)
|
||||||
|
stream = factory-NewStream(new wxFFileInputStream(filename));
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
wxArchiveClassFactory::Find can also search
|
||||||
|
for a factory by MIME type or wxFileSystem protocol.
|
||||||
|
The available factories can be enumerated
|
||||||
|
using @ref wxArchiveClassFactory::getfirst "GetFirst() and GetNext".
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxarc "Archive formats such as zip", @ref overview_wxarcgeneric
|
||||||
|
"Generic archive programming", wxArchiveEntry, wxArchiveInputStream, wxArchiveOutputStream, wxFilterClassFactory
|
||||||
|
*/
|
||||||
|
class wxArchiveClassFactory : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Returns @true if this factory can handle the given protocol, MIME type
|
||||||
|
or file extension.
|
||||||
|
|
||||||
|
When using wxSTREAM_FILEEXT for the second parameter, the first parameter
|
||||||
|
can be a complete filename rather than just an extension.
|
||||||
|
*/
|
||||||
|
bool CanHandle(const wxChar* protocol,
|
||||||
|
wxStreamProtocolType type = wxSTREAM_PROTOCOL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
A static member that finds a factory that can handle a given protocol, MIME
|
||||||
|
type or file extension. Returns a pointer to the class factory if found, or
|
||||||
|
@NULL otherwise. It does not give away ownership of the factory.
|
||||||
|
|
||||||
|
When using wxSTREAM_FILEEXT for the second parameter, the first parameter
|
||||||
|
can be a complete filename rather than just an extension.
|
||||||
|
*/
|
||||||
|
static const wxArchiveClassFactory* Find(const wxChar* protocol,
|
||||||
|
wxStreamProtocolType type = wxSTREAM_PROTOCOL);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The wxMBConv object that the created streams
|
||||||
|
will use when translating meta-data. The initial default, set by the
|
||||||
|
constructor, is wxConvLocal.
|
||||||
|
*/
|
||||||
|
wxMBConv GetConv();
|
||||||
|
void SetConv(wxMBConv& conv);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
GetFirst and GetNext can be used to enumerate the available factories.
|
||||||
|
|
||||||
|
For example, to list them:
|
||||||
|
GetFirst()/GetNext() return a pointer to a factory or @NULL if no more
|
||||||
|
are available. They do not give away ownership of the factory.
|
||||||
|
*/
|
||||||
|
static const wxArchiveClassFactory* GetFirst();
|
||||||
|
const wxArchiveClassFactory* GetNext();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Calls the static GetInternalName() function for the archive entry type,
|
||||||
|
for example
|
||||||
|
wxZipEntry::GetInternalName.
|
||||||
|
*/
|
||||||
|
wxString GetInternalName(const wxString& name,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the wxFileSystem protocol supported by this factory. Equivalent
|
||||||
|
to wxString(*GetProtcols()).
|
||||||
|
*/
|
||||||
|
wxString GetProtocol();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the protocols, MIME types or file extensions supported by this
|
||||||
|
factory, as an array of null terminated strings. It does not give away
|
||||||
|
ownership of the array or strings.
|
||||||
|
|
||||||
|
For example, to list the file extensions a factory supports:
|
||||||
|
*/
|
||||||
|
const wxChar * const* GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create a new wxArchiveEntry object of the
|
||||||
|
appropriate type.
|
||||||
|
*/
|
||||||
|
wxArchiveEntry* NewEntry();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Create a new input or output stream to read or write an archive.
|
||||||
|
|
||||||
|
If the parent stream is passed as a pointer then the new archive stream
|
||||||
|
takes ownership of it. If it is passed by reference then it does not.
|
||||||
|
*/
|
||||||
|
wxArchiveInputStream* NewStream(wxInputStream& stream);
|
||||||
|
wxArchiveOutputStream* NewStream(wxOutputStream& stream);
|
||||||
|
wxArchiveInputStream* NewStream(wxInputStream* stream);
|
||||||
|
wxArchiveOutputStream* NewStream(wxOutputStream* stream);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds this class factory to the list returned
|
||||||
|
by @ref getfirst() GetFirst()/GetNext.
|
||||||
|
|
||||||
|
It is not necessary to do this to use the archive streams. It is usually
|
||||||
|
used when implementing streams, typically the implementation will
|
||||||
|
add a static instance of its factory class.
|
||||||
|
|
||||||
|
It can also be used to change the order of a factory already in the list,
|
||||||
|
bringing it to the front. This isn't a thread safe operation
|
||||||
|
so can't be done when other threads are running that will be using the list.
|
||||||
|
|
||||||
|
The list does not take ownership of the factory.
|
||||||
|
*/
|
||||||
|
void PushFront();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes this class factory from the list returned
|
||||||
|
by @ref getfirst() GetFirst()/GetNext.
|
||||||
|
|
||||||
|
Removing from the list isn't a thread safe operation
|
||||||
|
so can't be done when other threads are running that will be using the list.
|
||||||
|
|
||||||
|
The list does not own the factories, so removing a factory does not delete it.
|
||||||
|
*/
|
||||||
|
void Remove();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxArchiveNotifier
|
||||||
|
@wxheader{archive.h}
|
||||||
|
|
||||||
|
If you need to know when a
|
||||||
|
wxArchiveInputStream updates a
|
||||||
|
wxArchiveEntry object, you can create
|
||||||
|
a notifier by deriving from this abstract base class, overriding
|
||||||
|
wxArchiveNotifier::OnEntryUpdated. An instance
|
||||||
|
of your notifier class can then be assigned to the wxArchiveEntry object
|
||||||
|
using wxArchiveEntry::SetNotifier.
|
||||||
|
Your OnEntryUpdated() method will then be invoked whenever the input
|
||||||
|
stream updates the entry.
|
||||||
|
|
||||||
|
Setting a notifier is not usually necessary. It is used to handle
|
||||||
|
certain cases when modifying an archive in a pipeline (i.e. between
|
||||||
|
non-seekable streams).
|
||||||
|
See @ref overview_wxarcnoseek "Archives on non-seekable streams".
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxarcnoseek "Archives on non-seekable streams", wxArchiveEntry,
|
||||||
|
wxArchiveInputStream, wxArchiveOutputStream
|
||||||
|
*/
|
||||||
|
class wxArchiveNotifier
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
This method must be overridden in your derived class.
|
||||||
|
*/
|
||||||
|
void OnEntryUpdated(class wxArchiveEntry& entry);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxArchiveIterator
|
||||||
|
@wxheader{archive.h}
|
||||||
|
|
||||||
|
An input iterator template class that can be used to transfer an archive's
|
||||||
|
catalogue to a container. It is only available if wxUSE_STL is set to 1
|
||||||
|
in setup.h, and the uses for it outlined below require a compiler which
|
||||||
|
supports member templates.
|
||||||
|
|
||||||
|
@code
|
||||||
|
template class Arc, class T = typename Arc::entry_type*
|
||||||
|
class wxArchiveIterator
|
||||||
|
{
|
||||||
|
// this constructor creates an 'end of sequence' object
|
||||||
|
wxArchiveIterator();
|
||||||
|
|
||||||
|
// template parameter 'Arc' should be the type of an archive input stream
|
||||||
|
wxArchiveIterator(Arc& arc) {
|
||||||
|
|
||||||
|
/* ... */
|
||||||
|
};
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The first template parameter should be the type of archive input stream
|
||||||
|
(e.g. wxArchiveInputStream) and the
|
||||||
|
second can either be a pointer to an entry
|
||||||
|
(e.g. wxArchiveEntry*), or a string/pointer pair
|
||||||
|
(e.g. std::pairwxString, wxArchiveEntry*).
|
||||||
|
|
||||||
|
The @c wx/archive.h header defines the following typedefs:
|
||||||
|
|
||||||
|
@code
|
||||||
|
typedef wxArchiveIteratorwxArchiveInputStream wxArchiveIter;
|
||||||
|
|
||||||
|
typedef wxArchiveIteratorwxArchiveInputStream,
|
||||||
|
std::pairwxString, wxArchiveEntry* wxArchivePairIter;
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The header for any implementation of this interface should define similar
|
||||||
|
typedefs for its types, for example in @c wx/zipstrm.h there is:
|
||||||
|
|
||||||
|
@code
|
||||||
|
typedef wxArchiveIteratorwxZipInputStream wxZipIter;
|
||||||
|
|
||||||
|
typedef wxArchiveIteratorwxZipInputStream,
|
||||||
|
std::pairwxString, wxZipEntry* wxZipPairIter;
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Transferring the catalogue of an archive @e arc to a vector @e cat,
|
||||||
|
can then be done something like this:
|
||||||
|
|
||||||
|
@code
|
||||||
|
std::vectorwxArchiveEntry* cat((wxArchiveIter)arc, wxArchiveIter());
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
When the iterator is dereferenced, it gives away ownership of an entry
|
||||||
|
object. So in the above example, when you have finished with @e cat
|
||||||
|
you must delete the pointers it contains.
|
||||||
|
|
||||||
|
If you have smart pointers with normal copy semantics (i.e. not auto_ptr
|
||||||
|
or wxScopedPtr), then you can create an iterator
|
||||||
|
which uses them instead. For example, with a smart pointer class for
|
||||||
|
zip entries @e ZipEntryPtr:
|
||||||
|
|
||||||
|
@code
|
||||||
|
typedef std::vectorZipEntryPtr ZipCatalog;
|
||||||
|
typedef wxArchiveIteratorwxZipInputStream, ZipEntryPtr ZipIter;
|
||||||
|
ZipCatalog cat((ZipIter)zip, ZipIter());
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Iterators that return std::pair objects can be used to
|
||||||
|
populate a std::multimap, to allow entries to be looked
|
||||||
|
up by name. The string is initialised using the wxArchiveEntry object's
|
||||||
|
wxArchiveEntry::GetInternalName function.
|
||||||
|
|
||||||
|
@code
|
||||||
|
typedef std::multimapwxString, wxZipEntry* ZipCatalog;
|
||||||
|
ZipCatalog cat((wxZipPairIter)zip, wxZipPairIter());
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
Note that this iterator also gives away ownership of an entry
|
||||||
|
object each time it is dereferenced. So in the above example, when
|
||||||
|
you have finished with @e cat you must delete the pointers it contains.
|
||||||
|
|
||||||
|
Or if you have them, a pair containing a smart pointer can be used
|
||||||
|
(again @e ZipEntryPtr), no worries about ownership:
|
||||||
|
|
||||||
|
@code
|
||||||
|
typedef std::multimapwxString, ZipEntryPtr ZipCatalog;
|
||||||
|
typedef wxArchiveIteratorwxZipInputStream,
|
||||||
|
std::pairwxString, ZipEntryPtr ZipPairIter;
|
||||||
|
ZipCatalog cat((ZipPairIter)zip, ZipPairIter());
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxArchiveEntry, wxArchiveInputStream, wxArchiveOutputStream
|
||||||
|
*/
|
||||||
|
class wxArchiveIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Construct iterator that returns all the entries in the archive input
|
||||||
|
stream @e arc.
|
||||||
|
*/
|
||||||
|
wxArchiveIterator();
|
||||||
|
wxArchiveIterator(Arc& arc);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns an entry object from the archive input stream, giving away
|
||||||
|
ownership.
|
||||||
|
*/
|
||||||
|
const T operator*();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Position the input iterator at the next entry in the archive input stream.
|
||||||
|
*/
|
||||||
|
wxArchiveIterator operator++();
|
||||||
|
wxArchiveIterator operator++(int );
|
||||||
|
//@}
|
||||||
|
};
|
||||||
269
interface/arrstr.h
Normal file
269
interface/arrstr.h
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: arrstr.h
|
||||||
|
// Purpose: documentation for wxArrayString class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxArrayString
|
||||||
|
@wxheader{arrstr.h}
|
||||||
|
|
||||||
|
wxArrayString is an efficient container for storing
|
||||||
|
wxString objects. It has the same features as all
|
||||||
|
wxArray classes, i.e. it dynamically expands when new items
|
||||||
|
are added to it (so it is as easy to use as a linked list), but the access
|
||||||
|
time to the elements is constant, instead of being linear in number of
|
||||||
|
elements as in the case of linked lists. It is also very size efficient and
|
||||||
|
doesn't take more space than a C array @e wxString[] type (wxArrayString
|
||||||
|
uses its knowledge of internals of wxString class to achieve this).
|
||||||
|
|
||||||
|
This class is used in the same way as other dynamic arrays,
|
||||||
|
except that no @e WX_DEFINE_ARRAY declaration is needed for it. When a
|
||||||
|
string is added or inserted in the array, a copy of the string is created, so
|
||||||
|
the original string may be safely deleted (e.g. if it was a @e wxChar *
|
||||||
|
pointer the memory it was using can be freed immediately after this). In
|
||||||
|
general, there is no need to worry about string memory deallocation when using
|
||||||
|
this class - it will always free the memory it uses itself.
|
||||||
|
|
||||||
|
The references returned by wxArrayString::Item,
|
||||||
|
wxArrayString::Last or
|
||||||
|
@ref wxArrayString::operatorindex operator[] are not constant, so the
|
||||||
|
array elements may be modified in place like this
|
||||||
|
|
||||||
|
@code
|
||||||
|
array.Last().MakeUpper();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
There is also a variant of wxArrayString called wxSortedArrayString which has
|
||||||
|
exactly the same methods as wxArrayString, but which always keeps the string
|
||||||
|
in it in (alphabetical) order. wxSortedArrayString uses binary search in its
|
||||||
|
wxArrayString::Index function (instead of linear search for
|
||||||
|
wxArrayString::Index) which makes it much more efficient if you add strings to
|
||||||
|
the array rarely (because, of course, you have to pay for Index() efficiency
|
||||||
|
by having Add() be slower) but search for them often. Several methods should
|
||||||
|
not be used with sorted array (basically, all which break the order of items)
|
||||||
|
which is mentioned in their description.
|
||||||
|
|
||||||
|
Final word: none of the methods of wxArrayString is virtual including its
|
||||||
|
destructor, so this class should not be used as a base class.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{containers}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxArray, wxString, @ref overview_wxstringoverview "wxString overview"
|
||||||
|
*/
|
||||||
|
class wxArrayString : public wxArray
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor from a wxString array. Pass a size @e sz and array @e arr.
|
||||||
|
*/
|
||||||
|
wxArrayString();
|
||||||
|
wxArrayString(const wxArrayString& array);
|
||||||
|
wxArrayString(size_t sz, const char** arr);
|
||||||
|
wxArrayString(size_t sz, const wchar_t** arr);
|
||||||
|
wxArrayString(size_t sz, const wxString* arr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor frees memory occupied by the array strings. For the performance
|
||||||
|
reasons it is not virtual, so this class should not be derived from.
|
||||||
|
*/
|
||||||
|
~wxArrayString();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Appends the given number of @e copies of the new item @e str to the
|
||||||
|
array and returns the index of the first new item in the array.
|
||||||
|
|
||||||
|
@b Warning: For sorted arrays, the index of the inserted item will not be,
|
||||||
|
in general, equal to GetCount() - 1 because
|
||||||
|
the item is inserted at the correct position to keep the array sorted and not
|
||||||
|
appended.
|
||||||
|
|
||||||
|
See also: Insert()
|
||||||
|
*/
|
||||||
|
#define size_t Add(const wxString& str, size_t copies = 1) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Preallocates enough memory to store @e nCount items. This function may be
|
||||||
|
used to improve array class performance before adding a known number of items
|
||||||
|
consecutively.
|
||||||
|
|
||||||
|
See also: @ref wxArray::memorymanagement "Dynamic array memory management"
|
||||||
|
*/
|
||||||
|
void Alloc(size_t nCount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Clears the array contents and frees memory.
|
||||||
|
|
||||||
|
See also: Empty()
|
||||||
|
*/
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Empties the array: after a call to this function
|
||||||
|
GetCount() will return 0. However, this
|
||||||
|
function does not free the memory used by the array and so should be used when
|
||||||
|
the array is going to be reused for storing other strings. Otherwise, you
|
||||||
|
should use Clear() to empty the array and free
|
||||||
|
memory.
|
||||||
|
*/
|
||||||
|
void Empty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of items in the array.
|
||||||
|
*/
|
||||||
|
size_t GetCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Search the element in the array, starting from the beginning if
|
||||||
|
@e bFromEnd is @false or from end otherwise. If @e bCase, comparison is
|
||||||
|
case sensitive (default), otherwise the case is ignored.
|
||||||
|
|
||||||
|
This function uses linear search for wxArrayString and binary search for
|
||||||
|
wxSortedArrayString, but it ignores the @e bCase and @e bFromEnd
|
||||||
|
parameters in the latter case.
|
||||||
|
|
||||||
|
Returns index of the first item matched or @c wxNOT_FOUND if there is no match.
|
||||||
|
*/
|
||||||
|
int Index(const wxString& sz, bool bCase = @true,
|
||||||
|
bool bFromEnd = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Insert the given number of @e copies of the new element in the array before the
|
||||||
|
position @e nIndex. Thus, for
|
||||||
|
example, to insert the string in the beginning of the array you would write
|
||||||
|
If @e nIndex is equal to @e GetCount() this function behaves as
|
||||||
|
Add().
|
||||||
|
|
||||||
|
@b Warning: this function should not be used with sorted arrays because it
|
||||||
|
could break the order of items and, for example, subsequent calls to
|
||||||
|
Index() would then not work!
|
||||||
|
*/
|
||||||
|
void Insert(const wxString& str, size_t nIndex,
|
||||||
|
size_t copies = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the array is empty, @false otherwise. This function returns the
|
||||||
|
same result as @e GetCount() == 0 but is probably easier to read.
|
||||||
|
*/
|
||||||
|
bool IsEmpty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the array element at position @e nIndex. An assert failure will
|
||||||
|
result from an attempt to access an element beyond the end of array in debug
|
||||||
|
mode, but no check is done in release mode.
|
||||||
|
|
||||||
|
See also @ref operatorindex() operator[] for the operator
|
||||||
|
version.
|
||||||
|
*/
|
||||||
|
wxString Item(size_t nIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the last element of the array. Attempt to access the last element of
|
||||||
|
an empty array will result in assert failure in debug build, however no checks
|
||||||
|
are done in release mode.
|
||||||
|
*/
|
||||||
|
wxString Last();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the first item matching this value. An assert failure is provoked by
|
||||||
|
an attempt to remove an element which does not exist in debug build.
|
||||||
|
|
||||||
|
See also: Index()
|
||||||
|
*/
|
||||||
|
void Remove(const wxString& sz);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes @e count items starting at position @e nIndex from the array.
|
||||||
|
*/
|
||||||
|
void RemoveAt(size_t nIndex, size_t count = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Releases the extra memory allocated by the array. This function is useful to
|
||||||
|
minimize the array memory consumption.
|
||||||
|
|
||||||
|
See also: Alloc(), @ref wxArray::memorymanagement "Dynamic array memory
|
||||||
|
management"
|
||||||
|
*/
|
||||||
|
void Shrink();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Sorts the array using the specified @e compareFunction for item comparison.
|
||||||
|
@e CompareFunction is defined as a function taking two @e const
|
||||||
|
wxString parameters and returning an @e int value less than, equal to or
|
||||||
|
greater than 0 if the first string is less than, equal to or greater than the
|
||||||
|
second one.
|
||||||
|
*/
|
||||||
|
void Sort(bool reverseOrder = @false);
|
||||||
|
Warning: void Sort(CompareFunction compareFunction);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Compares 2 arrays respecting the case. Returns @true if the arrays have
|
||||||
|
different number of elements or if the elements don't match pairwise.
|
||||||
|
*/
|
||||||
|
bool operator !=(const wxArrayString& array);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assignment operator.
|
||||||
|
*/
|
||||||
|
wxArrayString operator =(const wxArrayString& array);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Compares 2 arrays respecting the case. Returns @true only if the arrays have
|
||||||
|
the same number of elements and the same strings in the same order.
|
||||||
|
*/
|
||||||
|
bool operator ==(const wxArrayString& array);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the array element at position @e nIndex. An assert failure will
|
||||||
|
result from an attempt to access an element beyond the end of array in debug
|
||||||
|
mode, but no check is done in release mode.
|
||||||
|
|
||||||
|
This is the operator version of Item() method.
|
||||||
|
*/
|
||||||
|
wxString operator[](size_t nIndex);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
Splits the given wxString object using the separator @e sep and returns the
|
||||||
|
result as a wxArrayString.
|
||||||
|
|
||||||
|
If the @e escape character is non-@NULL, then the occurrences of @e sep
|
||||||
|
immediately prefixed
|
||||||
|
with @e escape are not considered as separators.
|
||||||
|
|
||||||
|
Note that empty tokens will be generated if there are two or more adjacent
|
||||||
|
separators.
|
||||||
|
|
||||||
|
@sa wxJoin
|
||||||
|
*/
|
||||||
|
wxArrayString wxSplit(const wxString& str, const wxChar sep,
|
||||||
|
const wxChar escape = '
|
||||||
|
');
|
||||||
|
|
||||||
|
/**
|
||||||
|
Concatenate all lines of the given wxArrayString object using the separator @e
|
||||||
|
sep and returns
|
||||||
|
the result as a wxString.
|
||||||
|
|
||||||
|
If the @e escape character is non-@NULL, then it's used as prefix for each
|
||||||
|
occurrence of @e sep
|
||||||
|
in the strings contained in @e arr before joining them which is necessary
|
||||||
|
in order to be able to recover the original array contents from the string
|
||||||
|
later using wxSplit.
|
||||||
|
*/
|
||||||
|
wxString wxJoin(const wxArrayString& arr, const wxChar sep,
|
||||||
|
const wxChar escape = '\');
|
||||||
|
|
||||||
342
interface/artprov.h
Normal file
342
interface/artprov.h
Normal file
@@ -0,0 +1,342 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: artprov.h
|
||||||
|
// Purpose: documentation for wxArtProvider class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxArtProvider
|
||||||
|
@wxheader{artprov.h}
|
||||||
|
|
||||||
|
wxArtProvider class is used to customize the look of wxWidgets application.
|
||||||
|
When wxWidgets needs to display an icon or a bitmap (e.g. in the standard file
|
||||||
|
dialog), it does not use a hard-coded resource but asks wxArtProvider for it
|
||||||
|
instead. This way users can plug in their own wxArtProvider class and easily
|
||||||
|
replace standard art with their own version. All
|
||||||
|
that is needed is to derive a class from wxArtProvider, override either its
|
||||||
|
wxArtProvider::CreateBitmap and/or its
|
||||||
|
wxArtProvider::CreateIconBundle methods
|
||||||
|
and register the provider with
|
||||||
|
wxArtProvider::Push:
|
||||||
|
|
||||||
|
@code
|
||||||
|
class MyProvider : public wxArtProvider
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
wxBitmap CreateBitmap(const wxArtID& id,
|
||||||
|
const wxArtClient& client,
|
||||||
|
const wxSize size)
|
||||||
|
|
||||||
|
// optionally override this one as well
|
||||||
|
wxIconBundle CreateIconBundle(const wxArtID& id,
|
||||||
|
const wxArtClient& client)
|
||||||
|
{ ... }
|
||||||
|
};
|
||||||
|
...
|
||||||
|
wxArtProvider::Push(new MyProvider);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If you need bitmap images (of the same artwork) that should be displayed at
|
||||||
|
different sizes
|
||||||
|
you should probably consider overriding wxArtProvider::CreateIconBundle
|
||||||
|
and supplying icon bundles that contain different bitmap sizes.
|
||||||
|
|
||||||
|
There's another way of taking advantage of this class: you can use it in your
|
||||||
|
code and use
|
||||||
|
platform native icons as provided by wxArtProvider::GetBitmap or
|
||||||
|
wxArtProvider::GetIcon (NB: this is not yet really
|
||||||
|
possible as of wxWidgets 2.3.3, the set of wxArtProvider bitmaps is too
|
||||||
|
small).
|
||||||
|
|
||||||
|
|
||||||
|
wxArtProvider::~wxArtProvider
|
||||||
|
wxArtProvider::CreateBitmap
|
||||||
|
wxArtProvider::CreateIconBundle
|
||||||
|
wxArtProvider::Delete
|
||||||
|
wxArtProvider::GetBitmap
|
||||||
|
wxArtProvider::GetIconBundle
|
||||||
|
wxArtProvider::GetIcon
|
||||||
|
wxArtProvider::Insert
|
||||||
|
wxArtProvider::Pop
|
||||||
|
wxArtProvider::Push
|
||||||
|
wxArtProvider::Remove
|
||||||
|
|
||||||
|
|
||||||
|
Identifying art resources
|
||||||
|
|
||||||
|
Every bitmap and icon bundle are known to wxArtProvider under an unique ID that
|
||||||
|
is used when
|
||||||
|
requesting a resource from it. The ID is represented by wxArtID type and can
|
||||||
|
have one of these predefined values (you can see bitmaps represented by these
|
||||||
|
constants in the artprov sample):
|
||||||
|
|
||||||
|
wxART_ERROR
|
||||||
|
wxART_QUESTION
|
||||||
|
wxART_WARNING
|
||||||
|
wxART_INFORMATION
|
||||||
|
wxART_ADD_BOOKMARK
|
||||||
|
wxART_DEL_BOOKMARK
|
||||||
|
wxART_HELP_SIDE_PANEL
|
||||||
|
wxART_HELP_SETTINGS
|
||||||
|
wxART_HELP_BOOK
|
||||||
|
wxART_HELP_FOLDER
|
||||||
|
wxART_HELP_PAGE
|
||||||
|
wxART_GO_BACK
|
||||||
|
wxART_GO_FORWARD
|
||||||
|
wxART_GO_UP
|
||||||
|
wxART_GO_DOWN
|
||||||
|
wxART_GO_TO_PARENT
|
||||||
|
wxART_GO_HOME
|
||||||
|
wxART_PRINT
|
||||||
|
wxART_HELP
|
||||||
|
wxART_TIP
|
||||||
|
wxART_REPORT_VIEW
|
||||||
|
wxART_LIST_VIEW
|
||||||
|
wxART_NEW_DIR
|
||||||
|
wxART_FOLDER
|
||||||
|
wxART_FOLDER_OPEN
|
||||||
|
wxART_GO_DIR_UP
|
||||||
|
wxART_EXECUTABLE_FILE
|
||||||
|
wxART_NORMAL_FILE
|
||||||
|
wxART_TICK_MARK
|
||||||
|
wxART_CROSS_MARK
|
||||||
|
wxART_MISSING_IMAGE
|
||||||
|
wxART_NEW
|
||||||
|
wxART_FILE_OPEN
|
||||||
|
wxART_FILE_SAVE
|
||||||
|
wxART_FILE_SAVE_AS
|
||||||
|
wxART_DELETE
|
||||||
|
wxART_COPY
|
||||||
|
wxART_CUT
|
||||||
|
wxART_PASTE
|
||||||
|
wxART_UNDO
|
||||||
|
wxART_REDO
|
||||||
|
wxART_QUIT
|
||||||
|
wxART_FIND
|
||||||
|
wxART_FIND_AND_REPLACE
|
||||||
|
wxART_HARDDISK
|
||||||
|
wxART_FLOPPY
|
||||||
|
wxART_CDROM
|
||||||
|
wxART_REMOVABLE
|
||||||
|
|
||||||
|
|
||||||
|
Additionally, any string recognized by custom art providers registered using
|
||||||
|
wxArtProvider::Push may be used.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
See the artprov sample for an example of wxArtProvider usage.
|
||||||
|
*/
|
||||||
|
class wxArtProvider : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
The destructor automatically removes the provider from the provider stack used
|
||||||
|
by GetBitmap().
|
||||||
|
*/
|
||||||
|
~wxArtProvider();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Client is the entity that calls wxArtProvider's GetBitmap or GetIcon
|
||||||
|
function. It is represented by wxClientID type and can have one of these
|
||||||
|
values:
|
||||||
|
|
||||||
|
wxART_TOOLBAR
|
||||||
|
wxART_MENU
|
||||||
|
wxART_BUTTON
|
||||||
|
wxART_FRAME_ICON
|
||||||
|
wxART_CMN_DIALOG
|
||||||
|
wxART_HELP_BROWSER
|
||||||
|
wxART_MESSAGE_BOX
|
||||||
|
wxART_OTHER (used for all requests that don't fit into any of the categories
|
||||||
|
above)
|
||||||
|
|
||||||
|
Client ID servers as a hint to wxArtProvider that is supposed to help it to
|
||||||
|
choose the best looking bitmap. For example it is often desirable to use
|
||||||
|
slightly different icons in menus and toolbars even though they represent the
|
||||||
|
same action (e.g. @c wx_ART_FILE_OPEN). Remember that this is really
|
||||||
|
only a hint for wxArtProvider -- it is common that
|
||||||
|
GetBitmap()
|
||||||
|
returns identical bitmap for different @e client values!
|
||||||
|
|
||||||
|
@sa See the artprov sample for an example of wxArtProvider usage.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Derived art provider classes must override this method to create requested art
|
||||||
|
resource. Note that returned bitmaps are cached by wxArtProvider and it is
|
||||||
|
therefore not necessary to optimize CreateBitmap() for speed (e.g. you may
|
||||||
|
create wxBitmap objects from XPMs here).
|
||||||
|
|
||||||
|
@param id
|
||||||
|
wxArtID unique identifier of the bitmap.
|
||||||
|
|
||||||
|
@param client
|
||||||
|
wxArtClient identifier of the client (i.e. who is asking for the bitmap).
|
||||||
|
This only servers as a hint.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Preferred size of the bitmap. The function may return a bitmap of different
|
||||||
|
dimensions, it will be automatically rescaled to meet client's request.
|
||||||
|
|
||||||
|
@sa CreateIconBundle()
|
||||||
|
*/
|
||||||
|
wxBitmap CreateBitmap(const wxArtID& id,
|
||||||
|
const wxArtClient& client,
|
||||||
|
const wxSize& size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method is similar to CreateBitmap() but
|
||||||
|
can be used when a bitmap (or an icon) exists in several sizes.
|
||||||
|
*/
|
||||||
|
wxIconBundle CreateIconBundle(const wxArtID& id,
|
||||||
|
const wxArtClient& client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Delete the given @e provider.
|
||||||
|
*/
|
||||||
|
static bool Delete(wxArtProvider* provider);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Query registered providers for bitmap with given ID.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
wxArtID unique identifier of the bitmap.
|
||||||
|
|
||||||
|
@param client
|
||||||
|
wxArtClient identifier of the client (i.e. who is asking for the bitmap).
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Size of the returned bitmap or wxDefaultSize if size doesn't matter.
|
||||||
|
|
||||||
|
@returns The bitmap if one of registered providers recognizes the ID or
|
||||||
|
wxNullBitmap otherwise.
|
||||||
|
*/
|
||||||
|
static wxBitmap GetBitmap(const wxArtID& id,
|
||||||
|
const wxArtClient& client = wxART_OTHER,
|
||||||
|
const wxSize& size = wxDefaultSize);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns a suitable size hint for the given @e wxArtClient. If
|
||||||
|
@e platform_default is @true, return a size based on the current platform,
|
||||||
|
otherwise return the size from the topmost wxArtProvider. @e wxDefaultSize may
|
||||||
|
be
|
||||||
|
returned if the client doesn't have a specified size, like wxART_OTHER for
|
||||||
|
example.
|
||||||
|
*/
|
||||||
|
static wxIcon GetIcon(const wxArtID& id,
|
||||||
|
const wxArtClient& client = wxART_OTHER,
|
||||||
|
const wxSize& size = wxDefaultSize);
|
||||||
|
static wxSize GetSizeHint(const wxArtClient& client,
|
||||||
|
bool platform_default = @false);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Query registered providers for icon bundle with given ID.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
wxArtID unique identifier of the icon bundle.
|
||||||
|
|
||||||
|
@param client
|
||||||
|
wxArtClient identifier of the client (i.e. who is asking for the icon bundle).
|
||||||
|
|
||||||
|
@returns The icon bundle if one of registered providers recognizes the ID
|
||||||
|
or wxNullIconBundle otherwise.
|
||||||
|
*/
|
||||||
|
static wxIconBundle GetIconBundle(const wxArtID& id,
|
||||||
|
const wxArtClient& client = wxART_OTHER);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Every bitmap and icon bundle are known to wxArtProvider under an unique ID that
|
||||||
|
is used when
|
||||||
|
requesting a resource from it. The ID is represented by wxArtID type and can
|
||||||
|
have one of these predefined values (you can see bitmaps represented by these
|
||||||
|
constants in the artprov sample):
|
||||||
|
|
||||||
|
wxART_ERROR
|
||||||
|
wxART_QUESTION
|
||||||
|
wxART_WARNING
|
||||||
|
wxART_INFORMATION
|
||||||
|
wxART_ADD_BOOKMARK
|
||||||
|
wxART_DEL_BOOKMARK
|
||||||
|
wxART_HELP_SIDE_PANEL
|
||||||
|
wxART_HELP_SETTINGS
|
||||||
|
wxART_HELP_BOOK
|
||||||
|
wxART_HELP_FOLDER
|
||||||
|
wxART_HELP_PAGE
|
||||||
|
wxART_GO_BACK
|
||||||
|
wxART_GO_FORWARD
|
||||||
|
wxART_GO_UP
|
||||||
|
wxART_GO_DOWN
|
||||||
|
wxART_GO_TO_PARENT
|
||||||
|
wxART_GO_HOME
|
||||||
|
wxART_PRINT
|
||||||
|
wxART_HELP
|
||||||
|
wxART_TIP
|
||||||
|
wxART_REPORT_VIEW
|
||||||
|
wxART_LIST_VIEW
|
||||||
|
wxART_NEW_DIR
|
||||||
|
wxART_FOLDER
|
||||||
|
wxART_FOLDER_OPEN
|
||||||
|
wxART_GO_DIR_UP
|
||||||
|
wxART_EXECUTABLE_FILE
|
||||||
|
wxART_NORMAL_FILE
|
||||||
|
wxART_TICK_MARK
|
||||||
|
wxART_CROSS_MARK
|
||||||
|
wxART_MISSING_IMAGE
|
||||||
|
wxART_NEW
|
||||||
|
wxART_FILE_OPEN
|
||||||
|
wxART_FILE_SAVE
|
||||||
|
wxART_FILE_SAVE_AS
|
||||||
|
wxART_DELETE
|
||||||
|
wxART_COPY
|
||||||
|
wxART_CUT
|
||||||
|
wxART_PASTE
|
||||||
|
wxART_UNDO
|
||||||
|
wxART_REDO
|
||||||
|
wxART_QUIT
|
||||||
|
wxART_FIND
|
||||||
|
wxART_FIND_AND_REPLACE
|
||||||
|
wxART_HARDDISK
|
||||||
|
wxART_FLOPPY
|
||||||
|
wxART_CDROM
|
||||||
|
wxART_REMOVABLE
|
||||||
|
|
||||||
|
Additionally, any string recognized by custom art providers registered using
|
||||||
|
Push() may be used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Register new art provider and add it to the bottom of providers stack (i.e.
|
||||||
|
it will be queried as the last one).
|
||||||
|
|
||||||
|
@sa Push()
|
||||||
|
*/
|
||||||
|
static void Insert(wxArtProvider* provider);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Remove latest added provider and delete it.
|
||||||
|
*/
|
||||||
|
#define static bool Pop() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Register new art provider and add it to the top of providers stack (i.e. it
|
||||||
|
will be queried as the first provider).
|
||||||
|
|
||||||
|
@sa Insert()
|
||||||
|
*/
|
||||||
|
static void Push(wxArtProvider* provider);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Remove a provider from the stack if it is on it. The provider is not
|
||||||
|
deleted, unlike when using Delete().
|
||||||
|
*/
|
||||||
|
static bool Remove(wxArtProvider* provider);
|
||||||
|
};
|
||||||
15
interface/atomic.h
Normal file
15
interface/atomic.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: atomic.h
|
||||||
|
// Purpose: documentation for global functions
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function increments @e value in an atomic manner.
|
||||||
|
*/
|
||||||
|
void wxAtomicInc(wxAtomicInt& value);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
689
interface/aui/aui.h
Normal file
689
interface/aui/aui.h
Normal file
@@ -0,0 +1,689 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: aui/aui.h
|
||||||
|
// Purpose: documentation for wxAuiManager class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAuiManager
|
||||||
|
@headerfile aui.h wx/aui/aui.h
|
||||||
|
|
||||||
|
wxAuiManager is the central class of the wxAUI class framework.
|
||||||
|
|
||||||
|
See also @ref overview_wxauioverview "wxAUI overview".
|
||||||
|
|
||||||
|
wxAuiManager manages the panes associated with it
|
||||||
|
for a particular wxFrame, using a pane's wxAuiPaneInfo information to
|
||||||
|
determine each pane's docking and floating behavior. wxAuiManager
|
||||||
|
uses wxWidgets' sizer mechanism to plan the layout of each frame. It
|
||||||
|
uses a replaceable dock art class to do all drawing, so all drawing is
|
||||||
|
localized in one area, and may be customized depending on an
|
||||||
|
application's specific needs.
|
||||||
|
|
||||||
|
wxAuiManager works as follows: the programmer adds panes to the class,
|
||||||
|
or makes changes to existing pane properties (dock position, floating
|
||||||
|
state, show state, etc.). To apply these changes, wxAuiManager's
|
||||||
|
Update() function is called. This batch processing can be used to avoid
|
||||||
|
flicker, by modifying more than one pane at a time, and then "committing"
|
||||||
|
all of the changes at once by calling Update().
|
||||||
|
|
||||||
|
Panes can be added quite easily:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxTextCtrl* text1 = new wxTextCtrl(this, -1);
|
||||||
|
wxTextCtrl* text2 = new wxTextCtrl(this, -1);
|
||||||
|
m_mgr.AddPane(text1, wxLEFT, wxT("Pane Caption"));
|
||||||
|
m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Caption"));
|
||||||
|
m_mgr.Update();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Later on, the positions can be modified easily. The following will float
|
||||||
|
an existing pane in a tool window:
|
||||||
|
|
||||||
|
@code
|
||||||
|
m_mgr.GetPane(text1).Float();
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{aui}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxAuiPaneInfo, wxAuiDockArt
|
||||||
|
*/
|
||||||
|
class wxAuiManager : public wxEvtHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. @e managed_wnd specifies the wxFrame which should be managed.
|
||||||
|
@e flags specifies options which allow the frame management behavior
|
||||||
|
to be modified.
|
||||||
|
*/
|
||||||
|
wxAuiManager(wxWindow* managed_wnd = @NULL,
|
||||||
|
unsigned int flags = wxAUI_MGR_DEFAULT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
*/
|
||||||
|
~wxAuiManager();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
AddPane() tells the frame manager to start managing a child window. There are
|
||||||
|
several versions of this function. The first version allows the full spectrum of pane parameter possibilities. The second version is used for simpler user interfaces which do not require as much configuration. The last version allows a drop position to be specified, which will determine where the pane will be added.
|
||||||
|
*/
|
||||||
|
bool AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info);
|
||||||
|
bool AddPane(wxWindow* window, int direction = wxLEFT,
|
||||||
|
const wxString& caption = wxEmptyString);
|
||||||
|
bool AddPane(wxWindow* window,
|
||||||
|
const wxAuiPaneInfo& pane_info,
|
||||||
|
const wxPoint& drop_pos);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tells the wxAuiManager to stop managing the pane specified by window.
|
||||||
|
The window, if in a floated frame, is reparented to the frame managed
|
||||||
|
by wxAuiManager.
|
||||||
|
*/
|
||||||
|
bool DetachPane(wxWindow* window);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns an array of all panes managed by the frame manager.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfoArray GetAllPanes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current art provider being used.
|
||||||
|
|
||||||
|
See also: wxAuiDockArt.
|
||||||
|
*/
|
||||||
|
wxAuiDockArt* GetArtProvider();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current dock constraint values. See SetDockSizeConstraint() for
|
||||||
|
more information.
|
||||||
|
*/
|
||||||
|
void GetDockSizeConstraint(double* widthpct, double* heightpct);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current manager's flags.
|
||||||
|
*/
|
||||||
|
unsigned int GetFlags();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the frame currently being managed by wxAuiManager.
|
||||||
|
*/
|
||||||
|
wxWindow* GetManagedWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Calling this method will return the wxAuiManager for a given window. The @e
|
||||||
|
window parameter should
|
||||||
|
specify any child window or sub-child window of the frame or window managed by
|
||||||
|
wxAuiManager.
|
||||||
|
The @e window parameter need not be managed by the manager itself, nor does it
|
||||||
|
even need to be a child
|
||||||
|
or sub-child of a managed window. It must however be inside the window
|
||||||
|
hierarchy underneath the managed
|
||||||
|
window.
|
||||||
|
*/
|
||||||
|
static wxAuiManager* GetManager(wxWindow* window);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
@e GetPane is used to lookup a wxAuiPaneInfo object
|
||||||
|
either by window pointer or by pane name, which acts as a unique id for
|
||||||
|
a window pane. The returned wxAuiPaneInfo object may then be modified to
|
||||||
|
change a pane's look, state or position. After one or more
|
||||||
|
modifications to wxAuiPaneInfo, wxAuiManager::Update() should be called
|
||||||
|
to commit the changes to the user interface. If the lookup failed
|
||||||
|
(meaning the pane could not be found in the manager), a call to the
|
||||||
|
returned wxAuiPaneInfo's IsOk() method will return @false.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo GetPane(wxWindow* window);
|
||||||
|
wxAuiPaneInfo GetPane(const wxString& name);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
HideHint() hides any docking hint that may be visible.
|
||||||
|
*/
|
||||||
|
void HideHint();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method is used to insert either a previously unmanaged pane window
|
||||||
|
into the frame manager, or to insert a currently managed pane somewhere
|
||||||
|
else. @e InsertPane will push all panes, rows, or docks aside and
|
||||||
|
insert the window into the position specified by @e insert_location.
|
||||||
|
Because @e insert_location can specify either a pane, dock row, or dock
|
||||||
|
layer, the @e insert_level parameter is used to disambiguate this. The
|
||||||
|
parameter @e insert_level can take a value of wxAUI_INSERT_PANE,
|
||||||
|
wxAUI_INSERT_ROW
|
||||||
|
or wxAUI_INSERT_DOCK.
|
||||||
|
*/
|
||||||
|
bool InsertPane(wxWindow* window,
|
||||||
|
const wxAuiPaneInfo& insert_location,
|
||||||
|
int insert_level = wxAUI_INSERT_PANE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
LoadPaneInfo() is similar to to LoadPerspective, with the exception that it
|
||||||
|
only loads information about a single pane. It is used in combination with SavePaneInfo().
|
||||||
|
*/
|
||||||
|
void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo& pane);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads a saved perspective. If update is @true, wxAuiManager::Update()
|
||||||
|
is automatically invoked, thus realizing the saved perspective on screen.
|
||||||
|
*/
|
||||||
|
bool LoadPerspective(const wxString& perspective,
|
||||||
|
bool update = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
ProcessDockResult() is a protected member of the wxAUI layout manager. It can
|
||||||
|
be overridden by derived classes to provide custom docking calculations.
|
||||||
|
*/
|
||||||
|
bool ProcessDockResult(wxAuiPaneInfo& target,
|
||||||
|
const wxAuiPaneInfo& new_pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
SavePaneInfo() is similar to SavePerspective, with the exception that it only
|
||||||
|
saves information about a single pane. It is used in combination with LoadPaneInfo().
|
||||||
|
*/
|
||||||
|
wxString SavePaneInfo(wxAuiPaneInfo& pane);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Saves the entire user interface layout into an encoded wxString, which
|
||||||
|
can then be stored by the application (probably using wxConfig). When
|
||||||
|
a perspective is restored using LoadPerspective(), the entire user
|
||||||
|
interface will return to the state it was when the perspective was saved.
|
||||||
|
*/
|
||||||
|
wxString SavePerspective();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Instructs wxAuiManager to use art provider specified by parameter
|
||||||
|
@e art_provider for all drawing calls. This allows plugable
|
||||||
|
look-and-feel features. The previous art provider object, if any,
|
||||||
|
will be deleted by wxAuiManager.
|
||||||
|
|
||||||
|
See also: wxAuiDockArt.
|
||||||
|
*/
|
||||||
|
void SetArtProvider(wxAuiDockArt* art_provider);
|
||||||
|
|
||||||
|
/**
|
||||||
|
When a user creates a new dock by dragging a window into a docked position,
|
||||||
|
often times the large size of the
|
||||||
|
window will create a dock that is unwieldly large. wxAuiManager by default
|
||||||
|
limits the size of any
|
||||||
|
new dock to 1/3 of the window size. For horizontal docks, this would be 1/3 of
|
||||||
|
the window height. For
|
||||||
|
vertical docks, 1/3 of the width. Calling this function will adjust this
|
||||||
|
constraint value. The numbers
|
||||||
|
must be between 0.0 and 1.0. For instance, calling SetDockSizeContraint with
|
||||||
|
0.5, 0.5 will cause new
|
||||||
|
docks to be limited to half of the size of the entire managed window.
|
||||||
|
*/
|
||||||
|
void SetDockSizeConstraint(double widthpct, double heightpct);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method is used to specify wxAuiManager's settings flags. @e flags
|
||||||
|
specifies options which allow the frame management behavior to be modified.
|
||||||
|
*/
|
||||||
|
void SetFlags(unsigned int flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called to specify the frame or window which is to be managed by wxAuiManager.
|
||||||
|
Frame management is not restricted to just frames. Child windows or custom controls are also allowed.
|
||||||
|
*/
|
||||||
|
void SetManagedWindow(wxWindow* managed_wnd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is used by controls to explicitly show a hint window at the
|
||||||
|
specified rectangle. It is rarely called, and is mostly used by controls implementing custom pane drag/drop behaviour. The specified rectangle should be in screen coordinates.
|
||||||
|
*/
|
||||||
|
void ShowHint(const wxRect& rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Uninitializes the framework and should be called before a managed frame or
|
||||||
|
window is destroyed. UnInit() is usually called in the managed wxFrame's destructor. It is necessary to call this function before the managed frame or window is destroyed, otherwise the manager cannot remove its custom event handlers from a window.
|
||||||
|
*/
|
||||||
|
void UnInit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method is called after any number of changes are
|
||||||
|
made to any of the managed panes. Update() must be invoked after
|
||||||
|
AddPane() or InsertPane() are called in order to "realize" or "commit"
|
||||||
|
the changes. In addition, any number of changes may be made to
|
||||||
|
wxAuiPaneInfo structures (retrieved with wxAuiManager::GetPane), but to
|
||||||
|
realize the changes, Update() must be called. This construction allows
|
||||||
|
pane flicker to be avoided by updating the whole layout at one time.
|
||||||
|
*/
|
||||||
|
void Update();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAuiPaneInfo
|
||||||
|
@headerfile aui.h wx/aui/aui.h
|
||||||
|
|
||||||
|
wxAuiPaneInfo is part of the wxAUI class framework.
|
||||||
|
See also @ref overview_wxauioverview "wxAUI overview".
|
||||||
|
|
||||||
|
wxAuiPaneInfo specifies all the parameters for a pane.
|
||||||
|
These parameters specify where the pane is on the
|
||||||
|
screen, whether it is docked or floating, or hidden.
|
||||||
|
In addition, these parameters specify the pane's
|
||||||
|
docked position, floating position, preferred size,
|
||||||
|
minimum size, caption text among many other parameters.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{aui}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxAuiManager, wxAuiDockArt
|
||||||
|
*/
|
||||||
|
class wxAuiPaneInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Copy constructor.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo();
|
||||||
|
wxAuiPaneInfo(const wxAuiPaneInfo& c);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
BestSize() sets the ideal size for the pane. The docking manager will attempt
|
||||||
|
to use this size as much as possible when docking or floating the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo BestSize(const wxSize& size);
|
||||||
|
wxAuiPaneInfo BestSize(int x, int y);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Bottom() sets the pane dock position to the bottom side of the frame. This is
|
||||||
|
the same thing as calling Direction(wxAUI_DOCK_BOTTOM).
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Bottom();
|
||||||
|
|
||||||
|
/**
|
||||||
|
BottomDockable() indicates whether a pane can be docked at the bottom of the
|
||||||
|
frame.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo BottomDockable(bool b = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Caption() sets the caption of the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Caption(const wxString& c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
CaptionVisible indicates that a pane caption should be visible. If @false, no
|
||||||
|
pane caption is drawn.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo CaptionVisible(bool visible = @true);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Center() sets the pane dock position to the left side of the frame.
|
||||||
|
The centre pane is the space in the middle after all border panes (left, top,
|
||||||
|
right, bottom) are subtracted from the layout.
|
||||||
|
|
||||||
|
This is the same thing as calling Direction(wxAUI_DOCK_CENTRE).
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Centre();
|
||||||
|
wxAuiPaneInfo Center();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
CentrePane() specifies that the pane should adopt the default center pane
|
||||||
|
settings. Centre panes usually do not have caption bars. This function provides an easy way of preparing a pane to be displayed in the center dock position.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo CentrePane();
|
||||||
|
wxAuiPaneInfo CenterPane();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
CloseButton() indicates that a close button should be drawn for the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo CloseButton(bool visible = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
DefaultPane() specifies that the pane should adopt the default pane settings.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo DefaultPane();
|
||||||
|
|
||||||
|
/**
|
||||||
|
DestroyOnClose() indicates whether a pane should be detroyed when it is closed.
|
||||||
|
Normally a pane is simply hidden when the close button is clicked. Setting DestroyOnClose to @true will cause the window to be destroyed when the user clicks the pane's close button.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo DestroyOnClose(bool b = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Direction() determines the direction of the docked pane. It is functionally the
|
||||||
|
same as calling Left(), Right(), Top() or Bottom(), except that docking direction may be specified programmatically via the parameter.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Direction(int direction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Dock() indicates that a pane should be docked. It is the opposite of Float().
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Dock();
|
||||||
|
|
||||||
|
/**
|
||||||
|
DockFixed() causes the containing dock to have no resize sash. This is useful
|
||||||
|
for creating panes that span the entire width or height of a dock, but should not be resizable in the other direction.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo DockFixed(bool b = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Dockable() specifies whether a frame can be docked or not. It is the same as
|
||||||
|
specifying TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b).
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Dockable(bool b = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Fixed() forces a pane to be fixed size so that it cannot be resized. After
|
||||||
|
calling Fixed(), IsFixed() will return @true.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Fixed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Float() indicates that a pane should be floated. It is the opposite of Dock().
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Float();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Floatable() sets whether the user will be able to undock a pane and turn it
|
||||||
|
into a floating window.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Floatable(bool b = @true);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
FloatingPosition() sets the position of the floating pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo FloatingPosition(const wxPoint& pos);
|
||||||
|
wxAuiPaneInfo FloatingPosition(int x, int y);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
FloatingSize() sets the size of the floating pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo FloatingSize(const wxSize& size);
|
||||||
|
wxAuiPaneInfo FloatingSize(int x, int y);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gripper() indicates that a gripper should be drawn for the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Gripper(bool visible = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
GripperTop() indicates that a gripper should be drawn at the top of the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo GripperTop(bool attop = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasBorder() returns @true if the pane displays a border.
|
||||||
|
*/
|
||||||
|
bool HasBorder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasCaption() returns @true if the pane displays a caption.
|
||||||
|
*/
|
||||||
|
bool HasCaption();
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasCloseButton() returns @true if the pane displays a button to close the pane.
|
||||||
|
*/
|
||||||
|
bool HasCloseButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasFlag() returns @true if the the property specified by flag is active for the
|
||||||
|
pane.
|
||||||
|
*/
|
||||||
|
bool HasFlag(unsigned int flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasGripper() returns @true if the pane displays a gripper.
|
||||||
|
*/
|
||||||
|
bool HasGripper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasGripper() returns @true if the pane displays a gripper at the top.
|
||||||
|
*/
|
||||||
|
bool HasGripperTop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasMaximizeButton() returns @true if the pane displays a button to maximize the
|
||||||
|
pane.
|
||||||
|
*/
|
||||||
|
bool HasMaximizeButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasMinimizeButton() returns @true if the pane displays a button to minimize the
|
||||||
|
pane.
|
||||||
|
*/
|
||||||
|
bool HasMinimizeButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasPinButton() returns @true if the pane displays a button to float the pane.
|
||||||
|
*/
|
||||||
|
bool HasPinButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Hide() indicates that a pane should be hidden.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Hide();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsBottomDockable() returns @true if the pane can be docked at the bottom of the
|
||||||
|
managed frame.
|
||||||
|
*/
|
||||||
|
bool IsBottomDockable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsDocked() returns @true if the pane is docked.
|
||||||
|
*/
|
||||||
|
bool IsDocked();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsFixed() returns @true if the pane cannot be resized.
|
||||||
|
*/
|
||||||
|
bool IsFixed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsFloatable() returns @true if the pane can be undocked and displayed as a
|
||||||
|
floating window.
|
||||||
|
*/
|
||||||
|
bool IsFloatable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsFloating() returns @true if the pane is floating.
|
||||||
|
*/
|
||||||
|
bool IsFloating();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsLeftDockable() returns @true if the pane can be docked on the left of the
|
||||||
|
managed frame.
|
||||||
|
*/
|
||||||
|
bool IsLeftDockable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsMoveable() returns @true if the docked frame can be undocked or moved to
|
||||||
|
another dock position.
|
||||||
|
*/
|
||||||
|
bool IsMovable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsOk() returns @true if the wxAuiPaneInfo structure is valid. A pane structure
|
||||||
|
is valid if it has an associated window.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsResizable() returns @true if the pane can be resized.
|
||||||
|
*/
|
||||||
|
bool IsResizable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsRightDockable() returns @true if the pane can be docked on the right of the
|
||||||
|
managed frame.
|
||||||
|
*/
|
||||||
|
bool IsRightDockable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsShown() returns @true if the pane is currently shown.
|
||||||
|
*/
|
||||||
|
bool IsShown();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsToolbar() returns @true if the pane contains a toolbar.
|
||||||
|
*/
|
||||||
|
bool IsToolbar();
|
||||||
|
|
||||||
|
/**
|
||||||
|
IsTopDockable() returns @true if the pane can be docked at the top of the
|
||||||
|
managed frame.
|
||||||
|
*/
|
||||||
|
bool IsTopDockable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Layer() determines the layer of the docked pane. The dock layer is similar to
|
||||||
|
an onion, the inner-most layer being layer 0. Each shell moving in the outward direction has a higher layer number. This allows for more complex docking layout formation.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Layer(int layer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Left() sets the pane dock position to the left side of the frame. This is the
|
||||||
|
same thing as calling Direction(wxAUI_DOCK_LEFT).
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Left();
|
||||||
|
|
||||||
|
/**
|
||||||
|
LeftDockable() indicates whether a pane can be docked on the left of the frame.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo LeftDockable(bool b = @true);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
MaxSize() sets the maximum size of the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo MaxSize(const wxSize& size);
|
||||||
|
wxAuiPaneInfo MaxSize(int x, int y);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
MaximizeButton() indicates that a maximize button should be drawn for the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo MaximizeButton(bool visible = @true);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
MinSize() sets the minimum size of the pane. Please note that this is only
|
||||||
|
partially supported as of this writing.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo MinSize(const wxSize& size);
|
||||||
|
wxAuiPaneInfo MinSize(int x, int y);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
MinimizeButton() indicates that a minimize button should be drawn for the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo MinimizeButton(bool visible = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Movable indicates whether a frame can be moved.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Movable(bool b = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Name() sets the name of the pane so it can be referenced in lookup functions.
|
||||||
|
If a name is not specified by the user, a random name is assigned to the pane when it is added to the manager.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Name(const wxString& n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
PaneBorder indicates that a border should be drawn for the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo PaneBorder(bool visible = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
PinButton() indicates that a pin button should be drawn for the pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo PinButton(bool visible = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Position() determines the position of the docked pane.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Position(int pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resizable() allows a pane to be resized if the parameter is @true, and forces it
|
||||||
|
to be a fixed size if the parameter is @false. This is simply an antonym for Fixed().
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Resizable(bool resizable = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Right() sets the pane dock position to the right side of the frame.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Right();
|
||||||
|
|
||||||
|
/**
|
||||||
|
RightDockable() indicates whether a pane can be docked on the right of the
|
||||||
|
frame.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo RightDockable(bool b = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Row() determines the row of the docked pane.
|
||||||
|
*/
|
||||||
|
#define wxAuiPaneInfo Row(int row) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
|
||||||
|
used on loading perspectives etc.
|
||||||
|
*/
|
||||||
|
void SafeSet(wxAuiPaneInfo source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
SetFlag() turns the property given by flag on or off with the option_state
|
||||||
|
parameter.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo SetFlag(unsigned int flag, bool option_state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Show() indicates that a pane should be shown.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Show(bool show = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
ToolbarPane() specifies that the pane should adopt the default toolbar pane
|
||||||
|
settings.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo ToolbarPane();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Top() sets the pane dock position to the top of the frame.
|
||||||
|
*/
|
||||||
|
#define wxAuiPaneInfo Top() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
TopDockable() indicates whether a pane can be docked at the top of the frame.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo TopDockable(bool b = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Window() assigns the window pointer that the wxAuiPaneInfo should use. This
|
||||||
|
normally does not need to be specified, as the window pointer is automatically assigned to the wxAuiPaneInfo structure as soon as it is added to the manager.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo Window(wxWindow* w);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Makes a copy of the wxAuiPaneInfo object.
|
||||||
|
*/
|
||||||
|
wxAuiPaneInfo& operator operator=(const wxAuiPaneInfo& c);
|
||||||
|
};
|
||||||
342
interface/aui/auibook.h
Normal file
342
interface/aui/auibook.h
Normal file
@@ -0,0 +1,342 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: aui/auibook.h
|
||||||
|
// Purpose: documentation for wxAuiNotebook class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAuiNotebook
|
||||||
|
@headerfile auibook.h wx/aui/auibook.h
|
||||||
|
|
||||||
|
wxAuiNotebook is part of the wxAUI class framework.
|
||||||
|
See also @ref overview_wxauioverview "wxAUI overview".
|
||||||
|
|
||||||
|
wxAuiNotebook is a notebook control which implements many features common in
|
||||||
|
applications with dockable panes.
|
||||||
|
Specifically, wxAuiNotebook implements functionality which allows the user to
|
||||||
|
rearrange tab order via drag-and-drop,
|
||||||
|
split the tab window into many different splitter configurations, and toggle
|
||||||
|
through different themes to customize
|
||||||
|
the control's look and feel.
|
||||||
|
|
||||||
|
An effort has been made to try to maintain an API as similar to that of
|
||||||
|
wxNotebook.
|
||||||
|
|
||||||
|
The default theme that is used is wxAuiDefaultTabArt, which provides a modern,
|
||||||
|
glossy look and feel.
|
||||||
|
The theme can be changed by calling wxAuiNotebook::SetArtProvider.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxAUI_NB_DEFAULT_STYLE}:
|
||||||
|
Defined as wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE |
|
||||||
|
wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB.
|
||||||
|
@style{wxAUI_NB_TAB_SPLIT}:
|
||||||
|
Allows the tab control to be split by dragging a tab.
|
||||||
|
@style{wxAUI_NB_TAB_MOVE}:
|
||||||
|
Allows a tab to be moved horizontally by dragging.
|
||||||
|
@style{wxAUI_NB_TAB_EXTERNAL_MOVE}:
|
||||||
|
Allows a tab to be moved to another tab control.
|
||||||
|
@style{wxAUI_NB_TAB_FIXED_WIDTH}:
|
||||||
|
With this style, all tabs have the same width.
|
||||||
|
@style{wxAUI_NB_SCROLL_BUTTONS}:
|
||||||
|
With this style, left and right scroll buttons are displayed.
|
||||||
|
@style{wxAUI_NB_WINDOWLIST_BUTTON}:
|
||||||
|
With this style, a drop-down list of windows is available.
|
||||||
|
@style{wxAUI_NB_CLOSE_BUTTON}:
|
||||||
|
With this style, a close button is available on the tab bar.
|
||||||
|
@style{wxAUI_NB_CLOSE_ON_ACTIVE_TAB}:
|
||||||
|
With this style, the close button is visible on the active tab.
|
||||||
|
@style{wxAUI_NB_CLOSE_ON_ALL_TABS}:
|
||||||
|
With this style, the close button is visible on all tabs.
|
||||||
|
@style{wxAUI_NB_TOP}:
|
||||||
|
With this style, tabs are drawn along the top of the notebook.
|
||||||
|
@style{wxAUI_NB_BOTTOM}:
|
||||||
|
With this style, tabs are drawn along the bottom of the notebook.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxaui}
|
||||||
|
@category{aui}
|
||||||
|
*/
|
||||||
|
class wxAuiNotebook : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor. Creates a wxAuiNotebok control.
|
||||||
|
*/
|
||||||
|
wxAuiNotebook();
|
||||||
|
wxAuiNotebook(wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxAUI_NB_DEFAULT_STYLE);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds a page. If the @e select parameter is @true, calling this will generate a
|
||||||
|
page change event.
|
||||||
|
*/
|
||||||
|
bool AddPage(wxWindow* page, const wxString& caption,
|
||||||
|
bool select = @false,
|
||||||
|
const wxBitmap& bitmap = wxNullBitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the selection to the next or previous page.
|
||||||
|
*/
|
||||||
|
void AdvanceSelection(bool forward = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the notebook window.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Deletes a page at the given index. Calling this method will generate a page
|
||||||
|
change event.
|
||||||
|
*/
|
||||||
|
bool DeletePage(size_t page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the associated art provider.
|
||||||
|
*/
|
||||||
|
wxAuiTabArt* GetArtProvider();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the desired height of the notebook for the given page height. Use this
|
||||||
|
to fit the notebook to
|
||||||
|
a given page size.
|
||||||
|
*/
|
||||||
|
int GetHeightForPageHeight(int pageHeight);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the page specified by the given index.
|
||||||
|
*/
|
||||||
|
wxWindow* GetPage(size_t page_idx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the tab bitmap for the page.
|
||||||
|
*/
|
||||||
|
wxBitmap GetPageBitmap(size_t page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of pages in the notebook.
|
||||||
|
*/
|
||||||
|
size_t GetPageCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the page index for the specified window. If the window is not found in
|
||||||
|
the notebook, wxNOT_FOUND is returned.
|
||||||
|
*/
|
||||||
|
int GetPageIndex(wxWindow* page_wnd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the tab label for the page.
|
||||||
|
*/
|
||||||
|
wxString GetPageText(size_t page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the currently selected page.
|
||||||
|
*/
|
||||||
|
int GetSelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the height of the tab control.
|
||||||
|
*/
|
||||||
|
int GetTabCtrlHeight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
InsertPage() is similar to AddPage, but allows the ability to specify the
|
||||||
|
insert location.
|
||||||
|
If the @e select parameter is @true, calling this will generate a page change
|
||||||
|
event.
|
||||||
|
*/
|
||||||
|
bool InsertPage(size_t page_idx, wxWindow* page,
|
||||||
|
const wxString& caption,
|
||||||
|
bool select = @false,
|
||||||
|
const wxBitmap& bitmap = wxNullBitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes a page, without deleting the window pointer.
|
||||||
|
*/
|
||||||
|
bool RemovePage(size_t page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the art provider to be used by the notebook.
|
||||||
|
*/
|
||||||
|
void SetArtProvider(wxAuiTabArt* art);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font for drawing the tab labels, using a bold version of the font for
|
||||||
|
selected tab labels.
|
||||||
|
*/
|
||||||
|
bool SetFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font for measuring tab labels.
|
||||||
|
*/
|
||||||
|
void SetMeasuringFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font for drawing unselected tab labels.
|
||||||
|
*/
|
||||||
|
void SetNormalFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the bitmap for the page. To remove a bitmap from the tab caption, pass
|
||||||
|
wxNullBitmap.
|
||||||
|
*/
|
||||||
|
bool SetPageBitmap(size_t page, const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the tab label for the page.
|
||||||
|
*/
|
||||||
|
bool SetPageText(size_t page, const wxString& text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font for drawing selected tab labels.
|
||||||
|
*/
|
||||||
|
void SetSelectedFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the page selection. Calling this method will generate a page change event.
|
||||||
|
*/
|
||||||
|
size_t SetSelection(size_t new_page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the tab height. By default, the tab control height is calculated
|
||||||
|
by measuring the text height and bitmap sizes on the tab captions. Calling this
|
||||||
|
method will override that calculation and set the tab control to the specified
|
||||||
|
height parameter. A call to this method will override any call to
|
||||||
|
SetUniformBitmapSize().
|
||||||
|
Specifying -1 as the height will return the control to its default auto-sizing
|
||||||
|
behaviour.
|
||||||
|
*/
|
||||||
|
void SetTabCtrlHeight(int height);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Split performs a split operation programmatically. The argument @e page
|
||||||
|
indicates
|
||||||
|
the page that will be split off. This page will also become the active page
|
||||||
|
after the
|
||||||
|
split. The @e direction argument specifies where the pane should go, it should
|
||||||
|
be one
|
||||||
|
of the following: wxTOP, wxBOTTOM, wxLEFT, or wxRIGHT.
|
||||||
|
*/
|
||||||
|
void SetUniformBitmapSize(const wxSize& size);
|
||||||
|
void Split(size_t page, int direction);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the window menu for the active tab control associated with this notebook,
|
||||||
|
and returns @true if a selection was made.
|
||||||
|
*/
|
||||||
|
bool ShowWindowMenu();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAuiTabArt
|
||||||
|
@headerfile auibook.h wx/aui/auibook.h
|
||||||
|
|
||||||
|
Tab art class.
|
||||||
|
|
||||||
|
@library{wxaui}
|
||||||
|
@category{aui}
|
||||||
|
*/
|
||||||
|
class wxAuiTabArt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxAuiTabArt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Clones the art object.
|
||||||
|
*/
|
||||||
|
wxAuiTabArt* Clone();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a background on the given area.
|
||||||
|
*/
|
||||||
|
void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a button.
|
||||||
|
*/
|
||||||
|
void DrawButton(wxDC& dc, wxWindow* wnd, const wxRect& in_rect,
|
||||||
|
int bitmap_id,
|
||||||
|
int button_state,
|
||||||
|
int orientation,
|
||||||
|
const wxBitmap& bitmap_override,
|
||||||
|
wxRect* out_rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a tab.
|
||||||
|
*/
|
||||||
|
void DrawTab(wxDC& dc, wxWindow* wnd, const wxRect& in_rect,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
bool active,
|
||||||
|
int close_button_state,
|
||||||
|
wxRect* out_tab_rect,
|
||||||
|
wxRect* out_button_rect,
|
||||||
|
int* x_extent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the tab control size.
|
||||||
|
*/
|
||||||
|
int GetBestTabCtrlSize(wxWindow* wnd,
|
||||||
|
wxAuiNotebookPageArray& pages);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the indent size.
|
||||||
|
*/
|
||||||
|
int GetIndentSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the tab size for the given caption, bitmap and state.
|
||||||
|
*/
|
||||||
|
wxSize GetTabSize(wxDC& dc, wxWindow* wnd,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
bool active,
|
||||||
|
int close_button_state,
|
||||||
|
int* x_extent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets flags.
|
||||||
|
*/
|
||||||
|
void SetFlags(unsigned int flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font used for calculating measurements.
|
||||||
|
*/
|
||||||
|
void SetMeasuringFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the normal font for drawing labels.
|
||||||
|
*/
|
||||||
|
void SetNormalFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font for drawing text for selected UI elements.
|
||||||
|
*/
|
||||||
|
void SetSelectedFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets sizing information.
|
||||||
|
*/
|
||||||
|
void SetSizingInfo(const wxSize& tab_ctrl_size, size_t tab_count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pops up a menu to show the list of windows managed by wxAui.
|
||||||
|
*/
|
||||||
|
int ShowWindowList(wxWindow* wnd, const wxArrayString& items,
|
||||||
|
int active_idx);
|
||||||
|
};
|
||||||
143
interface/aui/dockart.h
Normal file
143
interface/aui/dockart.h
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: aui/dockart.h
|
||||||
|
// Purpose: documentation for wxAuiDockArt class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAuiDockArt
|
||||||
|
@headerfile dockart.h wx/aui/dockart.h
|
||||||
|
|
||||||
|
wxAuiDockArt is part of the wxAUI class framework.
|
||||||
|
See also @ref overview_wxauioverview "wxAUI overview".
|
||||||
|
|
||||||
|
Dock art provider code - a dock provider provides all drawing
|
||||||
|
functionality to the wxAui dock manager. This allows the dock
|
||||||
|
manager to have a plugable look-and-feel.
|
||||||
|
|
||||||
|
By default, a wxAuiManager uses an
|
||||||
|
instance of this class called @b wxAuiDefaultDockArt which
|
||||||
|
provides bitmap art and a colour scheme that is adapted to
|
||||||
|
the major platforms' look. You can either derive from that
|
||||||
|
class to alter its behaviour or write a completely new dock
|
||||||
|
art class. Call wxAuiManager::SetArtProvider
|
||||||
|
to make use this new dock art.
|
||||||
|
|
||||||
|
@library{wxaui}
|
||||||
|
@category{aui}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxAuiManager, wxAuiPaneInfo
|
||||||
|
*/
|
||||||
|
class wxAuiDockArt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxAuiDockArt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxAuiDockArt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a background.
|
||||||
|
*/
|
||||||
|
virtual void DrawBackground(wxDC& dc, wxWindow* window,
|
||||||
|
int orientation,
|
||||||
|
const wxRect& rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a border.
|
||||||
|
*/
|
||||||
|
virtual void DrawBorder(wxDC& dc, wxWindow* window,
|
||||||
|
const wxRect& rect,
|
||||||
|
wxAuiPaneInfo& pane);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a caption.
|
||||||
|
*/
|
||||||
|
virtual void DrawCaption(wxDC& dc, wxWindow* window,
|
||||||
|
const wxString& text,
|
||||||
|
const wxRect& rect,
|
||||||
|
wxAuiPaneInfo& pane);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a gripper.
|
||||||
|
*/
|
||||||
|
virtual void DrawGripper(wxDC& dc, wxWindow* window,
|
||||||
|
const wxRect& rect,
|
||||||
|
wxAuiPaneInfo& pane);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a button in the pane's title bar.
|
||||||
|
|
||||||
|
@e button can be one of the values of @b wxAuiButtonId.
|
||||||
|
|
||||||
|
@e button_state can be one of the values of @b wxAuiPaneButtonState.
|
||||||
|
*/
|
||||||
|
virtual void DrawPaneButton(wxDC& dc, wxWindow* window,
|
||||||
|
int button,
|
||||||
|
int button_state,
|
||||||
|
const wxRect& rect,
|
||||||
|
wxAuiPaneInfo& pane);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a sash between two windows.
|
||||||
|
*/
|
||||||
|
virtual void DrawSash(wxDC& dc, wxWindow* window,
|
||||||
|
int orientation,
|
||||||
|
const wxRect& rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The same as GetColour().
|
||||||
|
*/
|
||||||
|
virtual wxColour GetColor(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the colour of a certain setting.
|
||||||
|
|
||||||
|
@e id can be one of the colour values of @b wxAuiPaneDockArtSetting.
|
||||||
|
*/
|
||||||
|
virtual wxColour GetColour(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get a font setting.
|
||||||
|
*/
|
||||||
|
virtual wxFont GetFont(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the value of a certain setting.
|
||||||
|
|
||||||
|
@e id can be one of the size values of @b wxAuiPaneDockArtSetting.
|
||||||
|
*/
|
||||||
|
virtual int GetMetric(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The same as SetColour().
|
||||||
|
*/
|
||||||
|
virtual void SetColor(int id, const wxColour& color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set a certain setting with the value @e colour.
|
||||||
|
|
||||||
|
@e id can be one of the colour values of @b wxAuiPaneDockArtSetting.
|
||||||
|
*/
|
||||||
|
virtual void SetColour(int id, const wxColor& colour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set a font setting.
|
||||||
|
*/
|
||||||
|
virtual void SetFont(int id, const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set a certain setting with the value @e new_val.
|
||||||
|
|
||||||
|
@e id can be one of the size values of @b wxAuiPaneDockArtSetting.
|
||||||
|
*/
|
||||||
|
virtual void SetMetric(int id, int new_val);
|
||||||
|
};
|
||||||
111
interface/base64.h
Normal file
111
interface/base64.h
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: base64.h
|
||||||
|
// Purpose: documentation for global functions
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
These functions encode the given data using base64. The first of them is the
|
||||||
|
raw encoding function writing the output string into provided buffer while the
|
||||||
|
other ones return the output as wxString. There is no error return for these
|
||||||
|
functions except for the first one which returns @c wxCONV_FAILED if the
|
||||||
|
output buffer is too small. To allocate the buffer of the correct size, use
|
||||||
|
wxBase64EncodedSize or call this function with
|
||||||
|
@e dst set to @NULL -- it will then return the necessary buffer size.
|
||||||
|
|
||||||
|
@param dst
|
||||||
|
The output buffer, may be @NULL to retrieve the needed buffer
|
||||||
|
size.
|
||||||
|
|
||||||
|
@param dstLen
|
||||||
|
The output buffer size, ignored if dst is @NULL.
|
||||||
|
|
||||||
|
@param src
|
||||||
|
The input buffer, must not be @NULL.
|
||||||
|
|
||||||
|
@param srcLen
|
||||||
|
The length of the input data.
|
||||||
|
*/
|
||||||
|
size_t wxBase64Encode(char * dst, size_t dstLen,
|
||||||
|
const void * src,
|
||||||
|
size_t srcLen);
|
||||||
|
wxString wxBase64Encode(const void * src, size_t srcLen);
|
||||||
|
wxString wxBase64Encode(const wxMemoryBuffer& buf);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the size of the buffer necessary to contain the data encoded in a
|
||||||
|
base64 string of length @e srcLen. This can be useful for allocating a
|
||||||
|
buffer to be passed to wxBase64Decode.
|
||||||
|
*/
|
||||||
|
size_t wxBase64DecodedSize(size_t srcLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the length of the string with base64 representation of a buffer of
|
||||||
|
specified size @e len. This can be useful for allocating the buffer passed
|
||||||
|
to wxBase64Encode.
|
||||||
|
*/
|
||||||
|
size_t wxBase64EncodedSize(size_t len);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
These function decode a Base64-encoded string. The first version is a raw
|
||||||
|
decoding function and decodes the data into the provided buffer @e dst of
|
||||||
|
the given size @e dstLen. An error is returned if the buffer is not large
|
||||||
|
enough -- that is not at least wxBase64DecodedSize(srcLen)
|
||||||
|
bytes. The second version allocates memory internally and returns it as
|
||||||
|
wxMemoryBuffer and is recommended for normal use.
|
||||||
|
|
||||||
|
The first version returns the number of bytes written to the buffer or the
|
||||||
|
necessary buffer size if @e dst was @NULL or @c wxCONV_FAILED on
|
||||||
|
error, e.g. if the output buffer is too small or invalid characters were
|
||||||
|
encountered in the input string. The second version returns a buffer with the
|
||||||
|
base64 decoded binary equivalent of the input string. In neither case is the
|
||||||
|
buffer NUL-terminated.
|
||||||
|
|
||||||
|
@param dst
|
||||||
|
Pointer to output buffer, may be @NULL to just compute the
|
||||||
|
necessary buffer size.
|
||||||
|
|
||||||
|
@param dstLen
|
||||||
|
The size of the output buffer, ignored if dst is
|
||||||
|
@NULL.
|
||||||
|
|
||||||
|
@param src
|
||||||
|
The input string, must not be @NULL. For the version using
|
||||||
|
wxString, the input string should contain only ASCII characters.
|
||||||
|
|
||||||
|
@param srcLen
|
||||||
|
The length of the input string or special value
|
||||||
|
wxNO_LEN if the string is NUL-terminated and the length should be
|
||||||
|
computed by this function itself.
|
||||||
|
|
||||||
|
@param mode
|
||||||
|
This parameter specifies the function behaviour when invalid
|
||||||
|
characters are encountered in input. By default, any such character stops the
|
||||||
|
decoding with error. If the mode is wxBase64DecodeMode_SkipWS, then the white
|
||||||
|
space characters are silently skipped instead. And if it is
|
||||||
|
wxBase64DecodeMode_Relaxed, then all invalid characters are skipped.
|
||||||
|
|
||||||
|
@param posErr
|
||||||
|
If this pointer is non-@NULL and an error occurs during
|
||||||
|
decoding, it is filled with the index of the invalid character.
|
||||||
|
*/
|
||||||
|
size_t wxBase64Decode(void * dst, size_t dstLen,
|
||||||
|
const char * src,
|
||||||
|
size_t srcLen = wxNO_LEN,
|
||||||
|
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
|
||||||
|
size_t posErr = @NULL);
|
||||||
|
wxMemoryBuffer wxBase64Decode(const char * src,
|
||||||
|
size_t srcLen = wxNO_LEN,
|
||||||
|
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
|
||||||
|
size_t posErr = @NULL);
|
||||||
|
wxMemoryBuffer wxBase64Decode(const wxString& src,
|
||||||
|
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
|
||||||
|
size_t posErr = @NULL);
|
||||||
|
//@}
|
||||||
|
|
||||||
697
interface/bitmap.h
Normal file
697
interface/bitmap.h
Normal file
@@ -0,0 +1,697 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: bitmap.h
|
||||||
|
// Purpose: documentation for wxBitmapHandler class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxBitmapHandler
|
||||||
|
@wxheader{bitmap.h}
|
||||||
|
|
||||||
|
Overview
|
||||||
|
|
||||||
|
This is the base class for implementing bitmap file loading/saving, and bitmap
|
||||||
|
creation from data.
|
||||||
|
It is used within wxBitmap and is not normally seen by the application.
|
||||||
|
|
||||||
|
If you wish to extend the capabilities of wxBitmap, derive a class from
|
||||||
|
wxBitmapHandler
|
||||||
|
and add the handler using wxBitmap::AddHandler in your
|
||||||
|
application initialisation.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxBitmap, wxIcon, wxCursor
|
||||||
|
*/
|
||||||
|
class wxBitmapHandler : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Default constructor. In your own default constructor, initialise the members
|
||||||
|
m_name, m_extension and m_type.
|
||||||
|
*/
|
||||||
|
wxBitmapHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroys the wxBitmapHandler object.
|
||||||
|
*/
|
||||||
|
~wxBitmapHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a bitmap from the given data, which can be of arbitrary type. The
|
||||||
|
wxBitmap object @e bitmap is
|
||||||
|
manipulated by this function.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
The wxBitmap object.
|
||||||
|
|
||||||
|
@param width
|
||||||
|
The width of the bitmap in pixels.
|
||||||
|
|
||||||
|
@param height
|
||||||
|
The height of the bitmap in pixels.
|
||||||
|
|
||||||
|
@param depth
|
||||||
|
The depth of the bitmap in pixels. If this is -1, the screen depth is used.
|
||||||
|
|
||||||
|
@param data
|
||||||
|
Data whose type depends on the value of type.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
A bitmap type identifier - see wxBitmapHandler() for a list
|
||||||
|
of possible values.
|
||||||
|
|
||||||
|
@returns @true if the call succeeded, @false otherwise (the default).
|
||||||
|
*/
|
||||||
|
virtual bool Create(wxBitmap* bitmap, const void* data, int type,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int depth = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the file extension associated with this handler.
|
||||||
|
*/
|
||||||
|
const wxString GetExtension();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the name of this handler.
|
||||||
|
*/
|
||||||
|
const wxString GetName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the bitmap type associated with this handler.
|
||||||
|
*/
|
||||||
|
long GetType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads a bitmap from a file or resource, putting the resulting data into @e
|
||||||
|
bitmap.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
The bitmap object which is to be affected by this operation.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Either a filename or a Windows resource name.
|
||||||
|
The meaning of name is determined by the type parameter.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
See wxBitmap::wxBitmap for values this can take.
|
||||||
|
|
||||||
|
@returns @true if the operation succeeded, @false otherwise.
|
||||||
|
|
||||||
|
@sa wxBitmap::LoadFile, wxBitmap::SaveFile, SaveFile()
|
||||||
|
*/
|
||||||
|
bool LoadFile(wxBitmap* bitmap, const wxString& name, long type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Saves a bitmap in the named file.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
The bitmap object which is to be affected by this operation.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
A filename. The meaning of name is determined by the type parameter.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
See wxBitmap::wxBitmap for values this can take.
|
||||||
|
|
||||||
|
@param palette
|
||||||
|
An optional palette used for saving the bitmap.
|
||||||
|
|
||||||
|
@returns @true if the operation succeeded, @false otherwise.
|
||||||
|
|
||||||
|
@sa wxBitmap::LoadFile, wxBitmap::SaveFile, LoadFile()
|
||||||
|
*/
|
||||||
|
bool SaveFile(wxBitmap* bitmap, const wxString& name, int type,
|
||||||
|
wxPalette* palette = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the handler extension.
|
||||||
|
|
||||||
|
@param extension
|
||||||
|
Handler extension.
|
||||||
|
*/
|
||||||
|
void SetExtension(const wxString& extension);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the handler name.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Handler name.
|
||||||
|
*/
|
||||||
|
void SetName(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the handler type.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Handler type.
|
||||||
|
*/
|
||||||
|
void SetType(long type);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxBitmap
|
||||||
|
@wxheader{bitmap.h}
|
||||||
|
|
||||||
|
This class encapsulates the concept of a platform-dependent bitmap,
|
||||||
|
either monochrome or colour or colour with alpha channel support.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{gdi}
|
||||||
|
|
||||||
|
@stdobjects
|
||||||
|
Objects:
|
||||||
|
wxNullBitmap
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxbitmapoverview "wxBitmap overview", @ref
|
||||||
|
overview_supportedbitmapformats "supported bitmap file formats", wxDC::Blit, wxIcon, wxCursor, wxBitmap, wxMemoryDC
|
||||||
|
*/
|
||||||
|
class wxBitmap : public wxGDIObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Creates bitmap object from the image. This has to be done
|
||||||
|
to actually display an image as you cannot draw an image directly on a window.
|
||||||
|
The resulting bitmap will use the provided colour depth (or that of the
|
||||||
|
current system if depth is -1) which entails that a colour reduction has
|
||||||
|
to take place.
|
||||||
|
|
||||||
|
When in 8-bit mode (PseudoColour mode), the GTK port will use a color cube
|
||||||
|
created
|
||||||
|
on program start-up to look up colors. This ensures a very fast conversion, but
|
||||||
|
the image quality won't be perfect (and could be better for photo images using
|
||||||
|
more
|
||||||
|
sophisticated dithering algorithms).
|
||||||
|
|
||||||
|
On Windows, if there is a palette present (set with SetPalette), it will be
|
||||||
|
used when
|
||||||
|
creating the wxBitmap (most useful in 8-bit display mode). On other platforms,
|
||||||
|
the palette is currently ignored.
|
||||||
|
|
||||||
|
@param bits
|
||||||
|
Specifies an array of pixel values.
|
||||||
|
|
||||||
|
@param width
|
||||||
|
Specifies the width of the bitmap.
|
||||||
|
|
||||||
|
@param height
|
||||||
|
Specifies the height of the bitmap.
|
||||||
|
|
||||||
|
@param depth
|
||||||
|
Specifies the depth of the bitmap. If this is omitted, the display depth of the
|
||||||
|
screen is used.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
This can refer to a resource name under MS Windows, or a filename under MS
|
||||||
|
Windows and X.
|
||||||
|
Its meaning is determined by the type parameter.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
May be one of the following:
|
||||||
|
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_BMP
|
||||||
|
|
||||||
|
|
||||||
|
Load a Windows bitmap file.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_BMP_RESOURCE
|
||||||
|
|
||||||
|
|
||||||
|
Load a Windows bitmap resource from the executable. Windows only.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_PICT_RESOURCE
|
||||||
|
|
||||||
|
|
||||||
|
Load a PICT image resource from the executable. Mac OS only.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_GIF
|
||||||
|
|
||||||
|
|
||||||
|
Load a GIF bitmap file.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_XBM
|
||||||
|
|
||||||
|
|
||||||
|
Load an X bitmap file.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_XPM
|
||||||
|
|
||||||
|
|
||||||
|
Load an XPM bitmap file.
|
||||||
|
|
||||||
|
The validity of these flags depends on the platform and wxWidgets configuration.
|
||||||
|
If all possible wxWidgets settings are used, the Windows platform supports BMP
|
||||||
|
file, BMP resource,
|
||||||
|
XPM data, and XPM. Under wxGTK, the available formats are BMP file, XPM data,
|
||||||
|
XPM file, and PNG file.
|
||||||
|
Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM file.
|
||||||
|
|
||||||
|
In addition, wxBitmap can read all formats that wxImage can, which currently
|
||||||
|
include
|
||||||
|
wxBITMAP_TYPE_JPEG, wxBITMAP_TYPE_TIF, wxBITMAP_TYPE_PNG, wxBITMAP_TYPE_GIF,
|
||||||
|
wxBITMAP_TYPE_PCX,
|
||||||
|
and wxBITMAP_TYPE_PNM. Of course, you must have wxImage handlers loaded.
|
||||||
|
|
||||||
|
@param img
|
||||||
|
Platform-independent wxImage object.
|
||||||
|
|
||||||
|
@remarks The first form constructs a bitmap object with no data; an
|
||||||
|
assignment or another member function such as Create
|
||||||
|
or LoadFile must be called subsequently.
|
||||||
|
|
||||||
|
@sa LoadFile()
|
||||||
|
*/
|
||||||
|
wxBitmap();
|
||||||
|
wxBitmap(const wxBitmap& bitmap);
|
||||||
|
wxBitmap(const void* data, int type, int width, int height,
|
||||||
|
int depth = -1);
|
||||||
|
wxBitmap(const char bits[], int width, int height,
|
||||||
|
int depth = 1);
|
||||||
|
wxBitmap(int width, int height, int depth = -1);
|
||||||
|
wxBitmap(const char* const* bits);
|
||||||
|
wxBitmap(const wxString& name, long type);
|
||||||
|
wxBitmap(const wxImage& img, int depth = -1);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
See @ref overview_refcountdestruct "reference-counted object destruction" for
|
||||||
|
more info.
|
||||||
|
|
||||||
|
If the application omits to delete the bitmap explicitly, the bitmap will be
|
||||||
|
destroyed automatically by wxWidgets when the application exits.
|
||||||
|
|
||||||
|
Do not delete a bitmap that is selected into a memory device context.
|
||||||
|
*/
|
||||||
|
~wxBitmap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds a handler to the end of the static list of format handlers.
|
||||||
|
|
||||||
|
@param handler
|
||||||
|
A new bitmap format handler object. There is usually only one instance
|
||||||
|
of a given handler class in an application session.
|
||||||
|
|
||||||
|
@sa wxBitmapHandler
|
||||||
|
*/
|
||||||
|
static void AddHandler(wxBitmapHandler* handler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Deletes all bitmap handlers.
|
||||||
|
|
||||||
|
This function is called by wxWidgets on exit.
|
||||||
|
*/
|
||||||
|
static void CleanUpHandlers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates an image from a platform-dependent bitmap. This preserves
|
||||||
|
mask information so that bitmaps and images can be converted back
|
||||||
|
and forth without loss in that respect.
|
||||||
|
*/
|
||||||
|
wxImage ConvertToImage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the bitmap from an icon.
|
||||||
|
*/
|
||||||
|
bool CopyFromIcon(const wxIcon& icon);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Creates a bitmap from the given data, which can be of arbitrary type.
|
||||||
|
|
||||||
|
@param width
|
||||||
|
The width of the bitmap in pixels.
|
||||||
|
|
||||||
|
@param height
|
||||||
|
The height of the bitmap in pixels.
|
||||||
|
|
||||||
|
@param depth
|
||||||
|
The depth of the bitmap in pixels. If this is -1, the screen depth is used.
|
||||||
|
|
||||||
|
@param data
|
||||||
|
Data whose type depends on the value of type.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
A bitmap type identifier - see wxBitmap() for a list
|
||||||
|
of possible values.
|
||||||
|
|
||||||
|
@returns @true if the call succeeded, @false otherwise.
|
||||||
|
|
||||||
|
@remarks The first form works on all platforms. The portability of the
|
||||||
|
second form depends on the type of data.
|
||||||
|
|
||||||
|
@sa wxBitmap()
|
||||||
|
*/
|
||||||
|
virtual bool Create(int width, int height, int depth = -1);
|
||||||
|
virtual bool Create(const void* data, int type, int width,
|
||||||
|
int height,
|
||||||
|
int depth = -1);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Finds the handler associated with the given bitmap type.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The handler name.
|
||||||
|
|
||||||
|
@param extension
|
||||||
|
The file extension, such as "bmp".
|
||||||
|
|
||||||
|
@param bitmapType
|
||||||
|
The bitmap type, such as wxBITMAP_TYPE_BMP.
|
||||||
|
|
||||||
|
@returns A pointer to the handler if found, @NULL otherwise.
|
||||||
|
|
||||||
|
@sa wxBitmapHandler
|
||||||
|
*/
|
||||||
|
static wxBitmapHandler* FindHandler(const wxString& name);
|
||||||
|
static wxBitmapHandler* FindHandler(const wxString& extension,
|
||||||
|
wxBitmapType bitmapType);
|
||||||
|
static wxBitmapHandler* FindHandler(wxBitmapType bitmapType);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the colour depth of the bitmap. A value of 1 indicates a
|
||||||
|
monochrome bitmap.
|
||||||
|
*/
|
||||||
|
int GetDepth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the static list of bitmap format handlers.
|
||||||
|
|
||||||
|
@sa wxBitmapHandler
|
||||||
|
*/
|
||||||
|
static wxList GetHandlers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the height of the bitmap in pixels.
|
||||||
|
*/
|
||||||
|
int GetHeight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the associated mask (if any) which may have been loaded from a file
|
||||||
|
or set for the bitmap.
|
||||||
|
|
||||||
|
@sa SetMask(), wxMask
|
||||||
|
*/
|
||||||
|
wxMask* GetMask();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the associated palette (if any) which may have been loaded from a file
|
||||||
|
or set for the bitmap.
|
||||||
|
|
||||||
|
@sa wxPalette
|
||||||
|
*/
|
||||||
|
wxPalette* GetPalette();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a sub bitmap of the current one as long as the rect belongs entirely to
|
||||||
|
the bitmap. This function preserves bit depth and mask information.
|
||||||
|
*/
|
||||||
|
wxBitmap GetSubBitmap(const wxRect& rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the width of the bitmap in pixels.
|
||||||
|
|
||||||
|
@sa GetHeight()
|
||||||
|
*/
|
||||||
|
int GetWidth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds the standard bitmap format handlers, which, depending on wxWidgets
|
||||||
|
configuration, can be handlers for Windows bitmap, Windows bitmap resource, and
|
||||||
|
XPM.
|
||||||
|
|
||||||
|
This function is called by wxWidgets on startup.
|
||||||
|
|
||||||
|
@sa wxBitmapHandler
|
||||||
|
*/
|
||||||
|
static void InitStandardHandlers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds a handler at the start of the static list of format handlers.
|
||||||
|
|
||||||
|
@param handler
|
||||||
|
A new bitmap format handler object. There is usually only one instance
|
||||||
|
of a given handler class in an application session.
|
||||||
|
|
||||||
|
@sa wxBitmapHandler
|
||||||
|
*/
|
||||||
|
static void InsertHandler(wxBitmapHandler* handler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if bitmap data is present.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads a bitmap from a file or resource.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Either a filename or a Windows resource name.
|
||||||
|
The meaning of name is determined by the type parameter.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
One of the following values:
|
||||||
|
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_BMP
|
||||||
|
|
||||||
|
|
||||||
|
Load a Windows bitmap file.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_BMP_RESOURCE
|
||||||
|
|
||||||
|
|
||||||
|
Load a Windows bitmap resource from the executable.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_PICT_RESOURCE
|
||||||
|
|
||||||
|
|
||||||
|
Load a PICT image resource from the executable. Mac OS only.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_GIF
|
||||||
|
|
||||||
|
|
||||||
|
Load a GIF bitmap file.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_XBM
|
||||||
|
|
||||||
|
|
||||||
|
Load an X bitmap file.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_XPM
|
||||||
|
|
||||||
|
|
||||||
|
Load an XPM bitmap file.
|
||||||
|
|
||||||
|
The validity of these flags depends on the platform and wxWidgets configuration.
|
||||||
|
|
||||||
|
In addition, wxBitmap can read all formats that wxImage can
|
||||||
|
(wxBITMAP_TYPE_JPEG, wxBITMAP_TYPE_PNG, wxBITMAP_TYPE_GIF, wxBITMAP_TYPE_PCX,
|
||||||
|
wxBITMAP_TYPE_PNM).
|
||||||
|
(Of course you must have wxImage handlers loaded.)
|
||||||
|
|
||||||
|
@returns @true if the operation succeeded, @false otherwise.
|
||||||
|
|
||||||
|
@remarks A palette may be associated with the bitmap if one exists
|
||||||
|
(especially for colour Windows bitmaps), and if the
|
||||||
|
code supports it. You can check if one has been
|
||||||
|
created by using the GetPalette member.
|
||||||
|
|
||||||
|
@sa SaveFile()
|
||||||
|
*/
|
||||||
|
bool LoadFile(const wxString& name, wxBitmapType type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Finds the handler with the given name, and removes it. The handler
|
||||||
|
is not deleted.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The handler name.
|
||||||
|
|
||||||
|
@returns @true if the handler was found and removed, @false otherwise.
|
||||||
|
|
||||||
|
@sa wxBitmapHandler
|
||||||
|
*/
|
||||||
|
static bool RemoveHandler(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Saves a bitmap in the named file.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
A filename. The meaning of name is determined by the type parameter.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
One of the following values:
|
||||||
|
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_BMP
|
||||||
|
|
||||||
|
|
||||||
|
Save a Windows bitmap file.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_GIF
|
||||||
|
|
||||||
|
|
||||||
|
Save a GIF bitmap file.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_XBM
|
||||||
|
|
||||||
|
|
||||||
|
Save an X bitmap file.
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_XPM
|
||||||
|
|
||||||
|
|
||||||
|
Save an XPM bitmap file.
|
||||||
|
|
||||||
|
The validity of these flags depends on the platform and wxWidgets configuration.
|
||||||
|
|
||||||
|
In addition, wxBitmap can save all formats that wxImage can
|
||||||
|
(wxBITMAP_TYPE_JPEG, wxBITMAP_TYPE_PNG).
|
||||||
|
(Of course you must have wxImage handlers loaded.)
|
||||||
|
|
||||||
|
@param palette
|
||||||
|
An optional palette used for saving the bitmap.
|
||||||
|
|
||||||
|
@returns @true if the operation succeeded, @false otherwise.
|
||||||
|
|
||||||
|
@remarks Depending on how wxWidgets has been configured, not all formats
|
||||||
|
may be available.
|
||||||
|
|
||||||
|
@sa LoadFile()
|
||||||
|
*/
|
||||||
|
bool SaveFile(const wxString& name, wxBitmapType type,
|
||||||
|
wxPalette* palette = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the depth member (does not affect the bitmap data).
|
||||||
|
|
||||||
|
@param depth
|
||||||
|
Bitmap depth.
|
||||||
|
*/
|
||||||
|
void SetDepth(int depth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the height member (does not affect the bitmap data).
|
||||||
|
|
||||||
|
@param height
|
||||||
|
Bitmap height in pixels.
|
||||||
|
*/
|
||||||
|
void SetHeight(int height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the mask for this bitmap.
|
||||||
|
|
||||||
|
@remarks The bitmap object owns the mask once this has been called.
|
||||||
|
|
||||||
|
@sa GetMask(), wxMask
|
||||||
|
*/
|
||||||
|
void SetMask(wxMask* mask);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the associated palette. (Not implemented under GTK+).
|
||||||
|
|
||||||
|
@param palette
|
||||||
|
The palette to set.
|
||||||
|
|
||||||
|
@sa wxPalette
|
||||||
|
*/
|
||||||
|
void SetPalette(const wxPalette& palette);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the width member (does not affect the bitmap data).
|
||||||
|
|
||||||
|
@param width
|
||||||
|
Bitmap width in pixels.
|
||||||
|
*/
|
||||||
|
void SetWidth(int width);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assignment operator, using @ref overview_trefcount "reference counting".
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
Bitmap to assign.
|
||||||
|
*/
|
||||||
|
wxBitmap operator =(const wxBitmap& bitmap);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxMask
|
||||||
|
@wxheader{bitmap.h}
|
||||||
|
|
||||||
|
This class encapsulates a monochrome mask bitmap, where the masked area is
|
||||||
|
black and
|
||||||
|
the unmasked area is white. When associated with a bitmap and drawn in a device
|
||||||
|
context,
|
||||||
|
the unmasked area of the bitmap will be drawn, and the masked area will not be
|
||||||
|
drawn.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{gdi}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxBitmap, wxDC::Blit, wxMemoryDC
|
||||||
|
*/
|
||||||
|
class wxMask : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructs a mask from a bitmap and a palette index that indicates the
|
||||||
|
background. Not
|
||||||
|
yet implemented for GTK.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
A valid bitmap.
|
||||||
|
|
||||||
|
@param colour
|
||||||
|
A colour specifying the transparency RGB values.
|
||||||
|
|
||||||
|
@param index
|
||||||
|
Index into a palette, specifying the transparency colour.
|
||||||
|
*/
|
||||||
|
wxMask();
|
||||||
|
wxMask(const wxBitmap& bitmap);
|
||||||
|
wxMask(const wxBitmap& bitmap,
|
||||||
|
const wxColour& colour);
|
||||||
|
wxMask(const wxBitmap& bitmap, int index);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroys the wxMask object and the underlying bitmap data.
|
||||||
|
*/
|
||||||
|
~wxMask();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructs a mask from a bitmap and a palette index that indicates the
|
||||||
|
background. Not
|
||||||
|
yet implemented for GTK.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
A valid bitmap.
|
||||||
|
|
||||||
|
@param colour
|
||||||
|
A colour specifying the transparency RGB values.
|
||||||
|
|
||||||
|
@param index
|
||||||
|
Index into a palette, specifying the transparency colour.
|
||||||
|
*/
|
||||||
|
bool Create(const wxBitmap& bitmap);
|
||||||
|
bool Create(const wxBitmap& bitmap, const wxColour& colour);
|
||||||
|
bool Create(const wxBitmap& bitmap, int index);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
222
interface/bmpbuttn.h
Normal file
222
interface/bmpbuttn.h
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: bmpbuttn.h
|
||||||
|
// Purpose: documentation for wxBitmapButton class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxBitmapButton
|
||||||
|
@wxheader{bmpbuttn.h}
|
||||||
|
|
||||||
|
A bitmap button is a control that contains a bitmap.
|
||||||
|
It may be placed on a @ref overview_wxdialog "dialog box" or panel, or indeed
|
||||||
|
almost any other window.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxBU_AUTODRAW}:
|
||||||
|
If this is specified, the button will be drawn automatically using
|
||||||
|
the label bitmap only, providing a 3D-look border. If this style is
|
||||||
|
not specified, the button will be drawn without borders and using
|
||||||
|
all provided bitmaps. WIN32 only.
|
||||||
|
@style{wxBU_LEFT}:
|
||||||
|
Left-justifies the bitmap label. WIN32 only.
|
||||||
|
@style{wxBU_TOP}:
|
||||||
|
Aligns the bitmap label to the top of the button. WIN32 only.
|
||||||
|
@style{wxBU_RIGHT}:
|
||||||
|
Right-justifies the bitmap label. WIN32 only.
|
||||||
|
@style{wxBU_BOTTOM}:
|
||||||
|
Aligns the bitmap label to the bottom of the button. WIN32 only.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@beginEventTable
|
||||||
|
@event{EVT_BUTTON(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is
|
||||||
|
clicked.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{bitmapbutton.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxButton
|
||||||
|
*/
|
||||||
|
class wxBitmapButton : public wxButton
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a button.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Button identifier. The value wxID_ANY indicates a default value.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
Bitmap to be displayed.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Button position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Button size. If wxDefaultSize is specified then the button is sized
|
||||||
|
appropriately for the bitmap.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. See wxBitmapButton.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
|
||||||
|
@remarks The bitmap parameter is normally the only bitmap you need to
|
||||||
|
provide, and wxWidgets will draw the button correctly
|
||||||
|
in its different states. If you want more control,
|
||||||
|
call any of the functions
|
||||||
|
SetBitmapSelected(),
|
||||||
|
SetBitmapFocus(),
|
||||||
|
SetBitmapDisabled().
|
||||||
|
|
||||||
|
@sa Create(), wxValidator
|
||||||
|
*/
|
||||||
|
wxBitmapButton();
|
||||||
|
wxBitmapButton(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxBU_AUTODRAW,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "button");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor, destroying the button.
|
||||||
|
*/
|
||||||
|
~wxBitmapButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Button creation function for two-step creation. For more details, see
|
||||||
|
wxBitmapButton().
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator,
|
||||||
|
const wxString& name = "button");
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns the bitmap for the disabled state, may be invalid.
|
||||||
|
|
||||||
|
@returns A reference to the disabled state bitmap.
|
||||||
|
|
||||||
|
@sa SetBitmapDisabled()
|
||||||
|
*/
|
||||||
|
const wxBitmap GetBitmapDisabled();
|
||||||
|
wxBitmap GetBitmapDisabled();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns the bitmap for the focused state, may be invalid.
|
||||||
|
|
||||||
|
@returns A reference to the focused state bitmap.
|
||||||
|
|
||||||
|
@sa SetBitmapFocus()
|
||||||
|
*/
|
||||||
|
const wxBitmap GetBitmapFocus();
|
||||||
|
wxBitmap GetBitmapFocus();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns the bitmap used when the mouse is over the button, may be invalid.
|
||||||
|
|
||||||
|
@sa SetBitmapHover()
|
||||||
|
*/
|
||||||
|
const wxBitmap GetBitmapHover();
|
||||||
|
wxBitmap GetBitmapHover();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns the label bitmap (the one passed to the constructor), always valid.
|
||||||
|
|
||||||
|
@returns A reference to the button's label bitmap.
|
||||||
|
|
||||||
|
@sa SetBitmapLabel()
|
||||||
|
*/
|
||||||
|
const wxBitmap GetBitmapLabel();
|
||||||
|
wxBitmap GetBitmapLabel();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the bitmap for the selected state.
|
||||||
|
|
||||||
|
@returns A reference to the selected state bitmap.
|
||||||
|
|
||||||
|
@sa SetBitmapSelected()
|
||||||
|
*/
|
||||||
|
wxBitmap GetBitmapSelected();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the bitmap for the disabled button appearance.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
The bitmap to set.
|
||||||
|
|
||||||
|
@sa GetBitmapDisabled(), SetBitmapLabel(),
|
||||||
|
SetBitmapSelected(), SetBitmapFocus()
|
||||||
|
*/
|
||||||
|
void SetBitmapDisabled(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the bitmap for the button appearance when it has the keyboard focus.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
The bitmap to set.
|
||||||
|
|
||||||
|
@sa GetBitmapFocus(), SetBitmapLabel(),
|
||||||
|
SetBitmapSelected(), SetBitmapDisabled()
|
||||||
|
*/
|
||||||
|
void SetBitmapFocus(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the bitmap to be shown when the mouse is over the button.
|
||||||
|
|
||||||
|
This function is new since wxWidgets version 2.7.0 and the hover bitmap is
|
||||||
|
currently only supported in wxMSW.
|
||||||
|
|
||||||
|
@sa GetBitmapHover()
|
||||||
|
*/
|
||||||
|
void SetBitmapHover(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the bitmap label for the button.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
The bitmap label to set.
|
||||||
|
|
||||||
|
@remarks This is the bitmap used for the unselected state, and for all
|
||||||
|
other states if no other bitmaps are provided.
|
||||||
|
|
||||||
|
@sa GetBitmapLabel()
|
||||||
|
*/
|
||||||
|
void SetBitmapLabel(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the bitmap for the selected (depressed) button appearance.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
The bitmap to set.
|
||||||
|
*/
|
||||||
|
void SetBitmapSelected(const wxBitmap& bitmap);
|
||||||
|
};
|
||||||
181
interface/bmpcbox.h
Normal file
181
interface/bmpcbox.h
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: bmpcbox.h
|
||||||
|
// Purpose: documentation for wxBitmapComboBox class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxBitmapComboBox
|
||||||
|
@wxheader{bmpcbox.h}
|
||||||
|
|
||||||
|
A combobox that displays bitmap in front of the list items.
|
||||||
|
It currently only allows using bitmaps of one size, and resizes itself
|
||||||
|
so that a bitmap can be shown next to the text field.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCB_READONLY}:
|
||||||
|
Creates a combobox without a text editor. On some platforms the
|
||||||
|
control may appear very different when this style is used.
|
||||||
|
@style{wxCB_SORT}:
|
||||||
|
Sorts the entries in the list alphabetically.
|
||||||
|
@style{wxTE_PROCESS_ENTER}:
|
||||||
|
The control will generate the event wxEVT_COMMAND_TEXT_ENTER
|
||||||
|
(otherwise pressing Enter key is either processed internally by the
|
||||||
|
control or used for navigation between dialog controls). Windows
|
||||||
|
only.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@beginEventTable
|
||||||
|
@event{EVT_COMBOBOX(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on
|
||||||
|
the list is selected.
|
||||||
|
@event{EVT_TEXT(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_TEXT_UPDATED event, when the combobox text
|
||||||
|
changes.
|
||||||
|
@event{EVT_TEXT_ENTER(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_TEXT_ENTER event, when RETURN is pressed in
|
||||||
|
the combobox.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{bitmapcombobox.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxCommandEvent
|
||||||
|
*/
|
||||||
|
class wxBitmapComboBox : public wxComboBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a combobox.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Window identifier. The value wxID_ANY indicates a default value.
|
||||||
|
|
||||||
|
@param value
|
||||||
|
Initial selection string. An empty string indicates no selection.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Window position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Window size. If wxDefaultSize is specified then the window is sized
|
||||||
|
appropriately.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
Number of strings with which to initialise the control.
|
||||||
|
|
||||||
|
@param choices
|
||||||
|
An array of strings with which to initialise the control.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. See wxBitmapComboBox.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
|
||||||
|
@sa Create(), wxValidator
|
||||||
|
*/
|
||||||
|
wxBitmapComboBox();
|
||||||
|
wxBitmapComboBox(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value = "",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
int n = 0,
|
||||||
|
const wxString choices[] = @NULL,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboBox");
|
||||||
|
wxBitmapComboBox(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
const wxArrayString& choices,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboBox");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor, destroying the combobox.
|
||||||
|
*/
|
||||||
|
~wxBitmapComboBox();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Adds the item to the end of the combo box, associating the given, typed or
|
||||||
|
untyped, client data pointer with the item.
|
||||||
|
*/
|
||||||
|
int Append(const wxString& item,
|
||||||
|
const wxBitmap& bitmap = wxNullBitmap);
|
||||||
|
int Append(const wxString& item, const wxBitmap& bitmap,
|
||||||
|
void * clientData);
|
||||||
|
int Append(const wxString& item, const wxBitmap& bitmap,
|
||||||
|
wxClientData * clientData);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Creates the combobox for two-step construction. Derived classes
|
||||||
|
should call or replace this function. See wxBitmapComboBox()
|
||||||
|
for further details.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value = "",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
int n, const wxString choices[],
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboBox");
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
const wxArrayString& choices,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboBox");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns size of bitmaps used in the list.
|
||||||
|
*/
|
||||||
|
wxSize GetBitmapSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the bitmap of the item with the given index.
|
||||||
|
*/
|
||||||
|
wxBitmap GetItemBitmap(unsigned int n);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Inserts the item into the list before pos, associating the given, typed or
|
||||||
|
untyped, client data pointer with the item.
|
||||||
|
Not valid for @c wxCB_SORT style, use Append instead.
|
||||||
|
*/
|
||||||
|
int Insert(const wxString& item, const wxBitmap& bitmap,
|
||||||
|
unsigned int pos);
|
||||||
|
int Insert(const wxString& item, const wxBitmap& bitmap,
|
||||||
|
unsigned int pos,
|
||||||
|
void * clientData);
|
||||||
|
int Insert(const wxString& item, const wxBitmap& bitmap,
|
||||||
|
unsigned int pos,
|
||||||
|
wxClientData * clientData);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the bitmap for the given item.
|
||||||
|
*/
|
||||||
|
void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
|
||||||
|
};
|
||||||
333
interface/brush.h
Normal file
333
interface/brush.h
Normal file
@@ -0,0 +1,333 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: brush.h
|
||||||
|
// Purpose: documentation for wxBrush class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxBrush
|
||||||
|
@wxheader{brush.h}
|
||||||
|
|
||||||
|
A brush is a drawing tool for filling in areas. It is used for painting
|
||||||
|
the background of rectangles, ellipses, etc. It has a colour and a
|
||||||
|
style.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{gdi}
|
||||||
|
|
||||||
|
@stdobjects
|
||||||
|
Objects:
|
||||||
|
wxNullBrush
|
||||||
|
Pointers:
|
||||||
|
wxBLUE_BRUSH
|
||||||
|
|
||||||
|
wxGREEN_BRUSH
|
||||||
|
|
||||||
|
wxWHITE_BRUSH
|
||||||
|
|
||||||
|
wxBLACK_BRUSH
|
||||||
|
|
||||||
|
wxGREY_BRUSH
|
||||||
|
|
||||||
|
wxMEDIUM_GREY_BRUSH
|
||||||
|
|
||||||
|
wxLIGHT_GREY_BRUSH
|
||||||
|
|
||||||
|
wxTRANSPARENT_BRUSH
|
||||||
|
|
||||||
|
wxCYAN_BRUSH
|
||||||
|
|
||||||
|
wxRED_BRUSH
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxBrushList, wxDC, wxDC::SetBrush
|
||||||
|
*/
|
||||||
|
class wxBrush : public wxGDIObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Copy constructor, uses @ref overview_trefcount "reference counting".
|
||||||
|
|
||||||
|
@param colour
|
||||||
|
Colour object.
|
||||||
|
|
||||||
|
@param colourName
|
||||||
|
Colour name. The name will be looked up in the colour database.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
One of:
|
||||||
|
|
||||||
|
wxTRANSPARENT
|
||||||
|
|
||||||
|
|
||||||
|
Transparent (no fill).
|
||||||
|
|
||||||
|
wxSOLID
|
||||||
|
|
||||||
|
|
||||||
|
Solid.
|
||||||
|
|
||||||
|
wxSTIPPLE
|
||||||
|
|
||||||
|
|
||||||
|
Uses a bitmap as a stipple.
|
||||||
|
|
||||||
|
wxBDIAGONAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Backward diagonal hatch.
|
||||||
|
|
||||||
|
wxCROSSDIAG_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Cross-diagonal hatch.
|
||||||
|
|
||||||
|
wxFDIAGONAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Forward diagonal hatch.
|
||||||
|
|
||||||
|
wxCROSS_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Cross hatch.
|
||||||
|
|
||||||
|
wxHORIZONTAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Horizontal hatch.
|
||||||
|
|
||||||
|
wxVERTICAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Vertical hatch.
|
||||||
|
|
||||||
|
@param brush
|
||||||
|
Pointer or reference to a brush to copy.
|
||||||
|
|
||||||
|
@param stippleBitmap
|
||||||
|
A bitmap to use for stippling.
|
||||||
|
|
||||||
|
@remarks If a stipple brush is created, the brush style will be set to
|
||||||
|
wxSTIPPLE.
|
||||||
|
|
||||||
|
@sa wxBrushList, wxColour, wxColourDatabase
|
||||||
|
*/
|
||||||
|
wxBrush();
|
||||||
|
wxBrush(const wxColour& colour, int style = wxSOLID);
|
||||||
|
wxBrush(const wxString& colourName, int style);
|
||||||
|
wxBrush(const wxBitmap& stippleBitmap);
|
||||||
|
wxBrush(const wxBrush& brush);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
See @ref overview_refcountdestruct "reference-counted object destruction" for
|
||||||
|
more info.
|
||||||
|
|
||||||
|
@remarks Although all remaining brushes are deleted when the application
|
||||||
|
exits, the application should try to clean up all
|
||||||
|
brushes itself. This is because wxWidgets cannot know
|
||||||
|
if a pointer to the brush object is stored in an
|
||||||
|
application data structure, and there is a risk of
|
||||||
|
double deletion.
|
||||||
|
*/
|
||||||
|
~wxBrush();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a reference to the brush colour.
|
||||||
|
|
||||||
|
@sa SetColour()
|
||||||
|
*/
|
||||||
|
wxColour GetColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets a pointer to the stipple bitmap. If the brush does not have a wxSTIPPLE
|
||||||
|
style,
|
||||||
|
this bitmap may be non-@NULL but uninitialised (@ref wxBitmap::isok
|
||||||
|
wxBitmap:IsOk returns @false).
|
||||||
|
|
||||||
|
@sa SetStipple()
|
||||||
|
*/
|
||||||
|
wxBitmap * GetStipple();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the brush style, one of:
|
||||||
|
|
||||||
|
@b wxTRANSPARENT
|
||||||
|
|
||||||
|
|
||||||
|
Transparent (no fill).
|
||||||
|
|
||||||
|
@b wxSOLID
|
||||||
|
|
||||||
|
|
||||||
|
Solid.
|
||||||
|
|
||||||
|
@b wxBDIAGONAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Backward diagonal hatch.
|
||||||
|
|
||||||
|
@b wxCROSSDIAG_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Cross-diagonal hatch.
|
||||||
|
|
||||||
|
@b wxFDIAGONAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Forward diagonal hatch.
|
||||||
|
|
||||||
|
@b wxCROSS_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Cross hatch.
|
||||||
|
|
||||||
|
@b wxHORIZONTAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Horizontal hatch.
|
||||||
|
|
||||||
|
@b wxVERTICAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Vertical hatch.
|
||||||
|
|
||||||
|
@b wxSTIPPLE
|
||||||
|
|
||||||
|
|
||||||
|
Stippled using a bitmap.
|
||||||
|
|
||||||
|
@b wxSTIPPLE_MASK_OPAQUE
|
||||||
|
|
||||||
|
|
||||||
|
Stippled using a bitmap's mask.
|
||||||
|
|
||||||
|
|
||||||
|
@sa SetStyle(), SetColour(), SetStipple()
|
||||||
|
*/
|
||||||
|
int GetStyle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the style of the brush is any of hatched fills.
|
||||||
|
|
||||||
|
@sa GetStyle()
|
||||||
|
*/
|
||||||
|
bool IsHatch();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the brush is initialised. It will return @false if the default
|
||||||
|
constructor has been used (for example, the brush is a member of a class, or
|
||||||
|
@NULL has been assigned to it).
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Sets the brush colour using red, green and blue values.
|
||||||
|
|
||||||
|
@sa GetColour()
|
||||||
|
*/
|
||||||
|
void SetColour(wxColour& colour);
|
||||||
|
void SetColour(const wxString& colourName);
|
||||||
|
void SetColour(unsigned char red, unsigned char green,
|
||||||
|
unsigned char blue);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the stipple bitmap.
|
||||||
|
|
||||||
|
@param bitmap
|
||||||
|
The bitmap to use for stippling.
|
||||||
|
|
||||||
|
@remarks The style will be set to wxSTIPPLE, unless the bitmap has a mask
|
||||||
|
associated to it, in which case the style will be set
|
||||||
|
to wxSTIPPLE_MASK_OPAQUE.
|
||||||
|
|
||||||
|
@sa wxBitmap
|
||||||
|
*/
|
||||||
|
void SetStipple(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the brush style.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
One of:
|
||||||
|
|
||||||
|
wxTRANSPARENT
|
||||||
|
|
||||||
|
|
||||||
|
Transparent (no fill).
|
||||||
|
|
||||||
|
wxSOLID
|
||||||
|
|
||||||
|
|
||||||
|
Solid.
|
||||||
|
|
||||||
|
wxBDIAGONAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Backward diagonal hatch.
|
||||||
|
|
||||||
|
wxCROSSDIAG_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Cross-diagonal hatch.
|
||||||
|
|
||||||
|
wxFDIAGONAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Forward diagonal hatch.
|
||||||
|
|
||||||
|
wxCROSS_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Cross hatch.
|
||||||
|
|
||||||
|
wxHORIZONTAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Horizontal hatch.
|
||||||
|
|
||||||
|
wxVERTICAL_HATCH
|
||||||
|
|
||||||
|
|
||||||
|
Vertical hatch.
|
||||||
|
|
||||||
|
wxSTIPPLE
|
||||||
|
|
||||||
|
|
||||||
|
Stippled using a bitmap.
|
||||||
|
|
||||||
|
wxSTIPPLE_MASK_OPAQUE
|
||||||
|
|
||||||
|
|
||||||
|
Stippled using a bitmap's mask.
|
||||||
|
|
||||||
|
@sa GetStyle()
|
||||||
|
*/
|
||||||
|
void SetStyle(int style);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Inequality operator.
|
||||||
|
See @ref overview_refcountequality "reference-counted object comparison" for
|
||||||
|
more info.
|
||||||
|
*/
|
||||||
|
bool operator !=(const wxBrush& brush);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assignment operator, using @ref overview_trefcount "reference counting".
|
||||||
|
*/
|
||||||
|
wxBrush operator =(const wxBrush& brush);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Equality operator.
|
||||||
|
See @ref overview_refcountequality "reference-counted object comparison" for
|
||||||
|
more info.
|
||||||
|
*/
|
||||||
|
bool operator ==(const wxBrush& brush);
|
||||||
|
};
|
||||||
112
interface/buffer.h
Normal file
112
interface/buffer.h
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: buffer.h
|
||||||
|
// Purpose: documentation for wxMemoryBuffer class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxMemoryBuffer
|
||||||
|
@wxheader{buffer.h}
|
||||||
|
|
||||||
|
A @b wxMemoryBuffer is a useful data structure for storing arbitrary sized
|
||||||
|
blocks
|
||||||
|
of memory. wxMemoryBuffer guarantees deletion of the memory block when the
|
||||||
|
object
|
||||||
|
is destroyed.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
*/
|
||||||
|
class wxMemoryBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Create a new buffer.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
size of new buffer.
|
||||||
|
*/
|
||||||
|
wxMemoryBuffer(const wxMemoryBuffer& src);
|
||||||
|
wxMemoryBuffer(size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Append a single byte to the buffer.
|
||||||
|
|
||||||
|
@param data
|
||||||
|
New byte to append to the buffer.
|
||||||
|
*/
|
||||||
|
void AppendByte(char data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Ensure that the buffer is big enough and return a pointer to the start
|
||||||
|
of the empty space in the buffer. This pointer can be used to directly
|
||||||
|
write data into the buffer, this new data will be appended to
|
||||||
|
the existing data.
|
||||||
|
|
||||||
|
@param sizeNeeded
|
||||||
|
Amount of extra space required in the buffer for
|
||||||
|
the append operation
|
||||||
|
*/
|
||||||
|
void * GetAppendBuf(size_t sizeNeeded);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the size of the buffer.
|
||||||
|
*/
|
||||||
|
size_t GetBufSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return a pointer to the data in the buffer.
|
||||||
|
*/
|
||||||
|
void* GetData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the length of the valid data in the buffer.
|
||||||
|
*/
|
||||||
|
size_t GetDataLen();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Ensure the buffer is big enough and return a pointer to the
|
||||||
|
buffer which can be used to directly write into the buffer
|
||||||
|
up to @e sizeNeeded bytes.
|
||||||
|
*/
|
||||||
|
void * GetWriteBuf(size_t sizeNeeded);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Ensures the buffer has at least @e size bytes available.
|
||||||
|
*/
|
||||||
|
void SetBufSize(size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the length of the data stored in the buffer. Mainly useful for truncating
|
||||||
|
existing data.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
New length of the valid data in the buffer. This is
|
||||||
|
distinct from the allocated size
|
||||||
|
*/
|
||||||
|
void SetDataLen(size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Update the length after completing a direct append, which
|
||||||
|
you must have used GetAppendBuf() to initialise.
|
||||||
|
|
||||||
|
@param sizeUsed
|
||||||
|
This is the amount of new data that has been
|
||||||
|
appended.
|
||||||
|
*/
|
||||||
|
void UngetAppendBuf(size_t sizeUsed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Update the buffer after completing a direct write, which
|
||||||
|
you must have used GetWriteBuf() to initialise.
|
||||||
|
|
||||||
|
@param sizeUsed
|
||||||
|
The amount of data written in to buffer
|
||||||
|
by the direct write
|
||||||
|
*/
|
||||||
|
void UngetWriteBuf(size_t sizeUsed);
|
||||||
|
};
|
||||||
73
interface/busyinfo.h
Normal file
73
interface/busyinfo.h
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: busyinfo.h
|
||||||
|
// Purpose: documentation for wxBusyInfo class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxBusyInfo
|
||||||
|
@wxheader{busyinfo.h}
|
||||||
|
|
||||||
|
This class makes it easy to tell your user that the program is temporarily busy.
|
||||||
|
Just create a wxBusyInfo object on the stack, and within the current scope,
|
||||||
|
a message window will be shown.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxBusyInfo wait("Please wait, working...");
|
||||||
|
|
||||||
|
for (int i = 0; i 100000; i++)
|
||||||
|
{
|
||||||
|
DoACalculation();
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
It works by creating a window in the constructor,
|
||||||
|
and deleting it in the destructor.
|
||||||
|
|
||||||
|
You may also want to call wxTheApp-Yield() to refresh the window
|
||||||
|
periodically (in case it had been obscured by other windows, for
|
||||||
|
example) like this:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxWindowDisabler disableAll;
|
||||||
|
|
||||||
|
wxBusyInfo wait("Please wait, working...");
|
||||||
|
|
||||||
|
for (int i = 0; i 100000; i++)
|
||||||
|
{
|
||||||
|
DoACalculation();
|
||||||
|
|
||||||
|
if ( !(i % 1000) )
|
||||||
|
wxTheApp-Yield();
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
but take care to not cause undesirable reentrancies when doing it (see
|
||||||
|
wxApp::Yield for more details). The simplest way to do
|
||||||
|
it is to use wxWindowDisabler class as illustrated
|
||||||
|
in the above example.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
*/
|
||||||
|
class wxBusyInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructs a busy info window as child of @e parent and displays @e msg
|
||||||
|
in it.
|
||||||
|
|
||||||
|
@b NB: If @e parent is not @NULL you must ensure that it is not
|
||||||
|
closed while the busy info is shown.
|
||||||
|
*/
|
||||||
|
wxBusyInfo(const wxString& msg, wxWindow* parent = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Hides and closes the window containing the information text.
|
||||||
|
*/
|
||||||
|
~wxBusyInfo();
|
||||||
|
};
|
||||||
150
interface/button.h
Normal file
150
interface/button.h
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: button.h
|
||||||
|
// Purpose: documentation for wxButton class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxButton
|
||||||
|
@wxheader{button.h}
|
||||||
|
|
||||||
|
A button is a control that contains a text string,
|
||||||
|
and is one of the most common elements of a GUI. It may be placed on a
|
||||||
|
@ref overview_wxdialog "dialog box" or panel, or indeed
|
||||||
|
almost any other window.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxBU_LEFT}:
|
||||||
|
Left-justifies the label. Windows and GTK+ only.
|
||||||
|
@style{wxBU_TOP}:
|
||||||
|
Aligns the label to the top of the button. Windows and GTK+ only.
|
||||||
|
@style{wxBU_RIGHT}:
|
||||||
|
Right-justifies the bitmap label. Windows and GTK+ only.
|
||||||
|
@style{wxBU_BOTTOM}:
|
||||||
|
Aligns the label to the bottom of the button. Windows and GTK+ only.
|
||||||
|
@style{wxBU_EXACTFIT}:
|
||||||
|
Creates the button as small as possible instead of making it of the
|
||||||
|
standard size (which is the default behaviour ).
|
||||||
|
@style{wxBORDER_NONE}:
|
||||||
|
Creates a flat button. Windows and GTK+ only.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@beginEventTable
|
||||||
|
@event{EVT_BUTTON(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is
|
||||||
|
clicked.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{button.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxBitmapButton
|
||||||
|
*/
|
||||||
|
class wxButton : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a button.
|
||||||
|
|
||||||
|
The preferred way to create standard buttons is to use default value of
|
||||||
|
@e label. If no label is supplied and @e id is one of standard IDs from
|
||||||
|
@ref overview_stockitems "this list", standard label will be used. In addition
|
||||||
|
to
|
||||||
|
that, the button will be decorated with stock icons under GTK+ 2.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Button identifier. A value of wxID_ANY indicates a default value.
|
||||||
|
|
||||||
|
@param label
|
||||||
|
Text to be displayed on the button.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Button position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Button size. If the default size is specified then the button is sized
|
||||||
|
appropriately for the text.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. See wxButton.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
|
||||||
|
@sa Create(), wxValidator
|
||||||
|
*/
|
||||||
|
wxButton();
|
||||||
|
wxButton(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& label = wxEmptyString,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "button");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor, destroying the button.
|
||||||
|
*/
|
||||||
|
~wxButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Button creation function for two-step creation. For more details, see
|
||||||
|
wxButton().
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& label = wxEmptyString,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator,
|
||||||
|
const wxString& name = "button");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the default size for the buttons. It is advised to make all the dialog
|
||||||
|
buttons of the same size and this function allows to retrieve the (platform and
|
||||||
|
current font dependent size) which should be the best suited for this.
|
||||||
|
*/
|
||||||
|
wxSize GetDefaultSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string label for the button.
|
||||||
|
|
||||||
|
@returns The button's label.
|
||||||
|
|
||||||
|
@sa SetLabel()
|
||||||
|
*/
|
||||||
|
wxString GetLabel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This sets the button to be the default item for the panel or dialog
|
||||||
|
box.
|
||||||
|
|
||||||
|
@remarks Under Windows, only dialog box buttons respond to this function.
|
||||||
|
As normal under Windows and Motif, pressing return
|
||||||
|
causes the default button to be depressed when the
|
||||||
|
return key is pressed. See also wxWindow::SetFocus
|
||||||
|
which sets the keyboard focus for windows and text
|
||||||
|
panel items, and wxTopLevelWindow::SetDefaultItem.
|
||||||
|
*/
|
||||||
|
void SetDefault();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the string label for the button.
|
||||||
|
|
||||||
|
@param label
|
||||||
|
The label to set.
|
||||||
|
*/
|
||||||
|
void SetLabel(const wxString& label);
|
||||||
|
};
|
||||||
373
interface/calctrl.h
Normal file
373
interface/calctrl.h
Normal file
@@ -0,0 +1,373 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: calctrl.h
|
||||||
|
// Purpose: documentation for wxCalendarEvent class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCalendarEvent
|
||||||
|
@wxheader{calctrl.h}
|
||||||
|
|
||||||
|
The wxCalendarEvent class is used together with
|
||||||
|
wxCalendarCtrl.
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{events}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxCalendarCtrl
|
||||||
|
*/
|
||||||
|
class wxCalendarEvent : public wxDateEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Returns the week day on which the user clicked in
|
||||||
|
@c EVT_CALENDAR_WEEKDAY_CLICKED handler. It doesn't make sense to call
|
||||||
|
this function in other handlers.
|
||||||
|
*/
|
||||||
|
wxDateTime::WeekDay GetWeekDay();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the week day carried by the event, normally only used by the library
|
||||||
|
internally.
|
||||||
|
*/
|
||||||
|
void SetWeekDay(wxDateTime::WeekDay day);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCalendarDateAttr
|
||||||
|
@wxheader{calctrl.h}
|
||||||
|
|
||||||
|
wxCalendarDateAttr is a custom attributes for a calendar date. The objects of
|
||||||
|
this class are used with wxCalendarCtrl.
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{misc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxCalendarCtrl
|
||||||
|
*/
|
||||||
|
class wxCalendarDateAttr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The constructors.
|
||||||
|
*/
|
||||||
|
wxCalendarDateAttr();
|
||||||
|
wxCalendarDateAttr(const wxColour& colText,
|
||||||
|
const wxColour& colBack = wxNullColour,
|
||||||
|
const wxColour& colBorder = wxNullColour,
|
||||||
|
const wxFont& font = wxNullFont,
|
||||||
|
wxCalendarDateBorder border = wxCAL_BORDER_NONE);
|
||||||
|
wxCalendarDateAttr(wxCalendarDateBorder border,
|
||||||
|
const wxColour& colBorder = wxNullColour);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the background colour to use for the item with this attribute.
|
||||||
|
*/
|
||||||
|
const wxColour GetBackgroundColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the border to use for the item with this attribute.
|
||||||
|
*/
|
||||||
|
wxCalendarDateBorder GetBorder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the border colour to use for the item with this attribute.
|
||||||
|
*/
|
||||||
|
const wxColour GetBorderColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the font to use for the item with this attribute.
|
||||||
|
*/
|
||||||
|
const wxFont GetFont();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the text colour to use for the item with this attribute.
|
||||||
|
*/
|
||||||
|
const wxColour GetTextColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this attribute specifies a non-default text background
|
||||||
|
colour.
|
||||||
|
*/
|
||||||
|
bool HasBackgroundColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this attribute specifies a non-default (i.e. any) border.
|
||||||
|
*/
|
||||||
|
bool HasBorder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this attribute specifies a non-default border colour.
|
||||||
|
*/
|
||||||
|
bool HasBorderColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this attribute specifies a non-default font.
|
||||||
|
*/
|
||||||
|
bool HasFont();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this item has a non-default text foreground colour.
|
||||||
|
*/
|
||||||
|
bool HasTextColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this attribute specifies that this item should be
|
||||||
|
displayed as a holiday.
|
||||||
|
*/
|
||||||
|
bool IsHoliday();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the text background colour to use.
|
||||||
|
*/
|
||||||
|
void SetBackgroundColour(const wxColour& colBack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the @ref overview_wxcalendardateattr "border kind"
|
||||||
|
*/
|
||||||
|
void SetBorder(wxCalendarDateBorder border);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the border colour to use.
|
||||||
|
*/
|
||||||
|
void SetBorderColour(const wxColour& col);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font to use.
|
||||||
|
*/
|
||||||
|
void SetFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Display the date with this attribute as a holiday.
|
||||||
|
*/
|
||||||
|
void SetHoliday(bool holiday);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the text (foreground) colour to use.
|
||||||
|
*/
|
||||||
|
void SetTextColour(const wxColour& colText);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCalendarCtrl
|
||||||
|
@wxheader{calctrl.h}
|
||||||
|
|
||||||
|
The calendar control allows the user to pick a date. For this,
|
||||||
|
it displays a window containing several parts: a control at the top to pick the
|
||||||
|
month
|
||||||
|
and the year (either or both of them may be disabled), and a month
|
||||||
|
area below them which shows all the days in the month. The user can move the
|
||||||
|
current selection using the keyboard and select the date (generating
|
||||||
|
@c EVT_CALENDAR event) by pressing @c Return or double clicking it.
|
||||||
|
|
||||||
|
It has advanced possibilities for the customization of its display. All global
|
||||||
|
settings (such as colours and fonts used) can, of course, be changed. But
|
||||||
|
also, the display style for each day in the month can be set independently
|
||||||
|
using wxCalendarDateAttr class.
|
||||||
|
|
||||||
|
An item without custom attributes is drawn with the default colours and
|
||||||
|
font and without border, but setting custom attributes with
|
||||||
|
wxCalendarCtrl::SetAttr allows to modify its appearance. Just
|
||||||
|
create a custom attribute object and set it for the day you want to be
|
||||||
|
displayed specially (note that the control will take ownership of the pointer,
|
||||||
|
i.e. it will delete it itself). A day may be marked as being a holiday, even
|
||||||
|
if it is not recognized as one by wxDateTime using
|
||||||
|
wxCalendarDateAttr::SetHoliday method.
|
||||||
|
|
||||||
|
As the attributes are specified for each day, they may change when the month
|
||||||
|
is changed, so you will often want to update them in
|
||||||
|
@c EVT_CALENDAR_MONTH event handler.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCAL_SUNDAY_FIRST}:
|
||||||
|
Show Sunday as the first day in the week
|
||||||
|
@style{wxCAL_MONDAY_FIRST}:
|
||||||
|
Show Monday as the first day in the week
|
||||||
|
@style{wxCAL_SHOW_HOLIDAYS}:
|
||||||
|
Highlight holidays in the calendar
|
||||||
|
@style{wxCAL_NO_YEAR_CHANGE}:
|
||||||
|
Disable the year changing
|
||||||
|
@style{wxCAL_NO_MONTH_CHANGE}:
|
||||||
|
Disable the month (and, implicitly, the year) changing
|
||||||
|
@style{wxCAL_SHOW_SURROUNDING_WEEKS}:
|
||||||
|
Show the neighbouring weeks in the previous and next months
|
||||||
|
@style{wxCAL_SEQUENTIAL_MONTH_SELECTION}:
|
||||||
|
Use alternative, more compact, style for the month and year
|
||||||
|
selection controls.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{calendarctrl.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_samplecalendar "Calendar sample", wxCalendarDateAttr,
|
||||||
|
wxCalendarEvent
|
||||||
|
*/
|
||||||
|
class wxCalendarCtrl : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Does the same as Create() method.
|
||||||
|
*/
|
||||||
|
wxCalendarCtrl();
|
||||||
|
wxCalendarCtrl(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxDateTime& date = wxDefaultDateTime,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxCAL_SHOW_HOLIDAYS,
|
||||||
|
const wxString& name = wxCalendarNameStr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroys the control.
|
||||||
|
*/
|
||||||
|
~wxCalendarCtrl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the control. See @ref wxWindow::ctor wxWindow for the meaning of
|
||||||
|
the parameters and the control overview for the possible styles.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxDateTime& date = wxDefaultDateTime,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxCAL_SHOW_HOLIDAYS,
|
||||||
|
const wxString& name = wxCalendarNameStr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function should be used instead of changing @c wxCAL_SHOW_HOLIDAYS
|
||||||
|
style bit directly. It enables or disables the special highlighting of the
|
||||||
|
holidays.
|
||||||
|
*/
|
||||||
|
void EnableHolidayDisplay(bool display = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function should be used instead of changing
|
||||||
|
@c wxCAL_NO_MONTH_CHANGE style bit. It allows or disallows the user to
|
||||||
|
change the month interactively. Note that if the month can not be changed, the
|
||||||
|
year can not be changed neither.
|
||||||
|
*/
|
||||||
|
void EnableMonthChange(bool enable = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function should be used instead of changing @c wxCAL_NO_YEAR_CHANGE
|
||||||
|
style bit directly. It allows or disallows the user to change the year
|
||||||
|
interactively.
|
||||||
|
*/
|
||||||
|
void EnableYearChange(bool enable = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the attribute for the given date (should be in the range 1...31).
|
||||||
|
|
||||||
|
The returned pointer may be @NULL.
|
||||||
|
*/
|
||||||
|
wxCalendarDateAttr * GetAttr(size_t day);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the currently selected date.
|
||||||
|
*/
|
||||||
|
const wxDateTime GetDate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the background colour of the header part of the calendar window.
|
||||||
|
|
||||||
|
@sa SetHeaderColours()
|
||||||
|
*/
|
||||||
|
const wxColour GetHeaderColourBg();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the foreground colour of the header part of the calendar window.
|
||||||
|
|
||||||
|
@sa SetHeaderColours()
|
||||||
|
*/
|
||||||
|
const wxColour GetHeaderColourFg();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the background highlight colour.
|
||||||
|
|
||||||
|
@sa SetHighlightColours()
|
||||||
|
*/
|
||||||
|
const wxColour GetHighlightColourBg();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the foreground highlight colour.
|
||||||
|
|
||||||
|
@sa SetHighlightColours()
|
||||||
|
*/
|
||||||
|
const wxColour GetHighlightColourFg();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the background colour currently used for holiday highlighting.
|
||||||
|
|
||||||
|
@sa SetHolidayColours()
|
||||||
|
*/
|
||||||
|
const wxColour GetHolidayColourBg();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the foreground colour currently used for holiday highlighting.
|
||||||
|
|
||||||
|
@sa SetHolidayColours()
|
||||||
|
*/
|
||||||
|
const wxColour GetHolidayColourFg();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns one of @c wxCAL_HITTEST_XXX
|
||||||
|
constants and fills either @e date or
|
||||||
|
@e wd pointer with the corresponding value depending on the hit test code.
|
||||||
|
*/
|
||||||
|
wxCalendarHitTestResult HitTest(const wxPoint& pos,
|
||||||
|
wxDateTime* date = @NULL,
|
||||||
|
wxDateTime::WeekDay* wd = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Clears any attributes associated with the given day (in the range
|
||||||
|
1...31).
|
||||||
|
*/
|
||||||
|
void ResetAttr(size_t day);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Associates the attribute with the specified date (in the range 1...31).
|
||||||
|
|
||||||
|
If the pointer is @NULL, the items attribute is cleared.
|
||||||
|
*/
|
||||||
|
void SetAttr(size_t day, wxCalendarDateAttr* attr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current date.
|
||||||
|
*/
|
||||||
|
void SetDate(const wxDateTime& date);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the colours used for painting the weekdays at the top of the control.
|
||||||
|
*/
|
||||||
|
void SetHeaderColours(const wxColour& colFg,
|
||||||
|
const wxColour& colBg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the colours to be used for highlighting the currently selected date.
|
||||||
|
*/
|
||||||
|
void SetHighlightColours(const wxColour& colFg,
|
||||||
|
const wxColour& colBg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Marks the specified day as being a holiday in the current month.
|
||||||
|
*/
|
||||||
|
void SetHoliday(size_t day);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the colours to be used for the holidays highlighting (only used if the
|
||||||
|
window style includes @c wxCAL_SHOW_HOLIDAYS flag).
|
||||||
|
*/
|
||||||
|
void SetHolidayColours(const wxColour& colFg,
|
||||||
|
const wxColour& colBg);
|
||||||
|
};
|
||||||
155
interface/caret.h
Normal file
155
interface/caret.h
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: caret.h
|
||||||
|
// Purpose: documentation for wxCaret class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCaret
|
||||||
|
@wxheader{caret.h}
|
||||||
|
|
||||||
|
A caret is a blinking cursor showing the position where the typed text will
|
||||||
|
appear. The text controls usually have a caret but wxCaret class also allows
|
||||||
|
to use a caret in other windows.
|
||||||
|
|
||||||
|
Currently, the caret appears as a rectangle of the given size. In the future,
|
||||||
|
it will be possible to specify a bitmap to be used for the caret shape.
|
||||||
|
|
||||||
|
A caret is always associated with a window and the current caret can be
|
||||||
|
retrieved using wxWindow::GetCaret. The same caret
|
||||||
|
can't be reused in two different windows.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{misc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxCaret::GetBlinkTime
|
||||||
|
*/
|
||||||
|
class wxCaret
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Create the caret of given (in pixels) width and height and associates it
|
||||||
|
with the given window.
|
||||||
|
*/
|
||||||
|
wxCaret();
|
||||||
|
wxCaret(wxWindow* window, int width, int height);
|
||||||
|
wxCaret(wxWindowBase* window, const wxSize& size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Create the caret of given (in pixels) width and height and associates it
|
||||||
|
with the given window (same as constructor).
|
||||||
|
*/
|
||||||
|
bool Create(wxWindowBase* window, int width, int height);
|
||||||
|
bool Create(wxWindowBase* window, const wxSize& size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the blink time which is measured in milliseconds and is the time elapsed
|
||||||
|
between 2 inversions of the caret (blink time of the caret is the same
|
||||||
|
for all carets, so this functions is static).
|
||||||
|
*/
|
||||||
|
static int GetBlinkTime();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Get the caret position (in pixels).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@b GetPosition()
|
||||||
|
|
||||||
|
|
||||||
|
Returns a Wx::Point
|
||||||
|
|
||||||
|
@b GetPositionXY()
|
||||||
|
|
||||||
|
|
||||||
|
Returns a 2-element list
|
||||||
|
@c ( x, y )
|
||||||
|
*/
|
||||||
|
void GetPosition(int* x, int* y);
|
||||||
|
wxPoint GetPosition();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Get the caret size.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@b GetSize()
|
||||||
|
|
||||||
|
|
||||||
|
Returns a Wx::Size
|
||||||
|
|
||||||
|
@b GetSizeWH()
|
||||||
|
|
||||||
|
|
||||||
|
Returns a 2-element list
|
||||||
|
@c ( width, height )
|
||||||
|
*/
|
||||||
|
void GetSize(int* width, int* height);
|
||||||
|
wxSize GetSize();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the window the caret is associated with.
|
||||||
|
*/
|
||||||
|
wxWindow* GetWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Same as wxCaret::Show(@false).
|
||||||
|
*/
|
||||||
|
void Hide();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the caret was created successfully.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the caret is visible and @false if it is permanently
|
||||||
|
hidden (if it is is blinking and not shown currently but will be after the
|
||||||
|
next blink, this method still returns @true).
|
||||||
|
*/
|
||||||
|
bool IsVisible();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Move the caret to given position (in logical coordinates).
|
||||||
|
*/
|
||||||
|
void Move(int x, int y);
|
||||||
|
void Move(const wxPoint& pt);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the blink time for all the carets.
|
||||||
|
|
||||||
|
@remarks Under Windows, this function will change the blink time for all
|
||||||
|
carets permanently (until the next time it is
|
||||||
|
called), even for the carets in other applications.
|
||||||
|
|
||||||
|
@sa GetBlinkTime()
|
||||||
|
*/
|
||||||
|
static void SetBlinkTime(int milliseconds);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Changes the size of the caret.
|
||||||
|
*/
|
||||||
|
void SetSize(int width, int height);
|
||||||
|
void SetSize(const wxSize& size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows or hides the caret. Notice that if the caret was hidden N times, it
|
||||||
|
must be shown N times as well to reappear on the screen.
|
||||||
|
*/
|
||||||
|
void Show(bool show = @true);
|
||||||
|
};
|
||||||
47
interface/chartype.h
Normal file
47
interface/chartype.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: chartype.h
|
||||||
|
// Purpose: documentation for global functions
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
wxT() is a macro which can be used with character and string literals (in other
|
||||||
|
words, @c 'x' or @c "foo") to automatically convert them to Unicode in
|
||||||
|
Unicode build configuration. Please see the
|
||||||
|
@ref overview_unicode "Unicode overview" for more information.
|
||||||
|
|
||||||
|
This macro is simply returns the value passed to it without changes in ASCII
|
||||||
|
build. In fact, its definition is:
|
||||||
|
|
||||||
|
@code
|
||||||
|
#ifdef UNICODE
|
||||||
|
#define wxT(x) L ## x
|
||||||
|
#else // !Unicode
|
||||||
|
#define wxT(x) x
|
||||||
|
#endif
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
wxChar wxT(char ch);
|
||||||
|
const wxChar * wxT(const char * s);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
wxS is macro which can be used with character and string literals to either
|
||||||
|
convert them to wide characters or strings in @c wchar_t-based Unicode
|
||||||
|
builds or keep them unchanged in UTF-8 builds. The use of this macro is
|
||||||
|
optional as the translation will always be done at run-time even if there is a
|
||||||
|
mismatch between the kind of the literal used and wxStringCharType used in the
|
||||||
|
current build, but using it can be beneficial in performance-sensitive code to
|
||||||
|
do the conversion at compile-time instead.
|
||||||
|
|
||||||
|
@sa wxT
|
||||||
|
*/
|
||||||
|
wxStringCharType wxS(char ch);
|
||||||
|
const wxStringCharType * wxS(const char * s);
|
||||||
|
//@}
|
||||||
|
|
||||||
157
interface/checkbox.h
Normal file
157
interface/checkbox.h
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: checkbox.h
|
||||||
|
// Purpose: documentation for wxCheckBox class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCheckBox
|
||||||
|
@wxheader{checkbox.h}
|
||||||
|
|
||||||
|
A checkbox is a labelled box which by default is either on (checkmark is
|
||||||
|
visible) or off (no checkmark). Optionally (when the wxCHK_3STATE style flag
|
||||||
|
is set) it can have a third state, called the mixed or undetermined state.
|
||||||
|
Often this is used as a "Does Not Apply" state.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCHK_2STATE}:
|
||||||
|
Create a 2-state checkbox. This is the default.
|
||||||
|
@style{wxCHK_3STATE}:
|
||||||
|
Create a 3-state checkbox. Not implemented in wxMGL, wxOS2 and
|
||||||
|
wxGTK built against GTK+ 1.2.
|
||||||
|
@style{wxCHK_ALLOW_3RD_STATE_FOR_USER}:
|
||||||
|
By default a user can't set a 3-state checkbox to the third state.
|
||||||
|
It can only be done from code. Using this flags allows the user to
|
||||||
|
set the checkbox to the third state by clicking.
|
||||||
|
@style{wxALIGN_RIGHT}:
|
||||||
|
Makes the text appear on the left of the checkbox.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@beginEventTable
|
||||||
|
@event{EVT_CHECKBOX(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_CHECKBOX_CLICKED event, when the checkbox
|
||||||
|
is clicked.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{checkbox.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxRadioButton, wxCommandEvent
|
||||||
|
*/
|
||||||
|
class wxCheckBox : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a checkbox.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Checkbox identifier. The value wxID_ANY indicates a default value.
|
||||||
|
|
||||||
|
@param label
|
||||||
|
Text to be displayed next to the checkbox.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Checkbox position. If wxDefaultPosition is specified then a default
|
||||||
|
position is chosen.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Checkbox size. If wxDefaultSize is specified then a default size is
|
||||||
|
chosen.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. See wxCheckBox.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
|
||||||
|
@sa Create(), wxValidator
|
||||||
|
*/
|
||||||
|
wxCheckBox();
|
||||||
|
wxCheckBox(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& val,
|
||||||
|
const wxString& name = "checkBox");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor, destroying the checkbox.
|
||||||
|
*/
|
||||||
|
~wxCheckBox();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the checkbox for two-step construction. See wxCheckBox()
|
||||||
|
for details.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& val,
|
||||||
|
const wxString& name = "checkBox");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the state of a 3-state checkbox.
|
||||||
|
|
||||||
|
@returns Returns wxCHK_UNCHECKED when the checkbox is unchecked,
|
||||||
|
wxCHK_CHECKED when it is checked and
|
||||||
|
wxCHK_UNDETERMINED when it's in the undetermined
|
||||||
|
state. Asserts when the function is used with a
|
||||||
|
2-state checkbox.
|
||||||
|
*/
|
||||||
|
wxCheckBoxState Get3StateValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the state of a 2-state checkbox.
|
||||||
|
|
||||||
|
@returns Returns @true if it is checked, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool GetValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns whether or not the checkbox is a 3-state checkbox.
|
||||||
|
|
||||||
|
@returns Returns @true if this checkbox is a 3-state checkbox, @false if
|
||||||
|
it's a 2-state checkbox.
|
||||||
|
*/
|
||||||
|
bool Is3State();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns whether or not the user can set the checkbox to the third state.
|
||||||
|
|
||||||
|
@returns Returns @true if the user can set the third state of this
|
||||||
|
checkbox, @false if it can only be set
|
||||||
|
programmatically or if it's a 2-state checkbox.
|
||||||
|
*/
|
||||||
|
bool Is3rdStateAllowedForUser();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is just a maybe more readable synonym for
|
||||||
|
GetValue(): just as the latter, it returns
|
||||||
|
@true if the checkbox is checked and @false otherwise.
|
||||||
|
*/
|
||||||
|
bool IsChecked();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the checkbox to the given state. This does not cause a
|
||||||
|
wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.
|
||||||
|
|
||||||
|
@param state
|
||||||
|
If @true, the check is on, otherwise it is off.
|
||||||
|
*/
|
||||||
|
void SetValue(bool state);
|
||||||
|
};
|
||||||
105
interface/checklst.h
Normal file
105
interface/checklst.h
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: checklst.h
|
||||||
|
// Purpose: documentation for wxCheckListBox class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCheckListBox
|
||||||
|
@wxheader{checklst.h}
|
||||||
|
|
||||||
|
A checklistbox is like a listbox, but allows items to be checked or unchecked.
|
||||||
|
|
||||||
|
When using this class under Windows wxWidgets must be compiled with
|
||||||
|
USE_OWNER_DRAWN set to 1.
|
||||||
|
|
||||||
|
Only the new functions for this class are documented; see also wxListBox.
|
||||||
|
|
||||||
|
Please note that wxCheckListBox uses client data in its implementation,
|
||||||
|
and therefore this is not available to the application.
|
||||||
|
|
||||||
|
@beginEventTable
|
||||||
|
@event{EVT_CHECKLISTBOX(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event, when an item in
|
||||||
|
the check list box is checked or unchecked.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{checklistbox.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxListBox, wxChoice, wxComboBox, wxListCtrl, wxCommandEvent
|
||||||
|
*/
|
||||||
|
class wxCheckListBox : public wxListBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a list box.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Window identifier. The value wxID_ANY indicates a default value.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Window position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Window size. If wxDefaultSize is specified then the window is sized
|
||||||
|
appropriately.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
Number of strings with which to initialise the control.
|
||||||
|
|
||||||
|
@param choices
|
||||||
|
An array of strings with which to initialise the control.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. See wxCheckListBox.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
*/
|
||||||
|
wxCheckListBox();
|
||||||
|
wxCheckListBox(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
int n,
|
||||||
|
const wxString choices[] = @NULL,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "listBox");
|
||||||
|
wxCheckListBox(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
const wxArrayString& choices,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "listBox");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor, destroying the list box.
|
||||||
|
*/
|
||||||
|
~wxCheckListBox();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Checks the given item. Note that calling this method doesn't result in
|
||||||
|
wxEVT_COMMAND_CHECKLISTBOX_TOGGLE being emitted.
|
||||||
|
|
||||||
|
@param item
|
||||||
|
Index of item to check.
|
||||||
|
|
||||||
|
@param check
|
||||||
|
@true if the item is to be checked, @false otherwise.
|
||||||
|
*/
|
||||||
|
void Check(int item, bool check = @true);
|
||||||
|
};
|
||||||
349
interface/choicdlg.h
Normal file
349
interface/choicdlg.h
Normal file
@@ -0,0 +1,349 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: choicdlg.h
|
||||||
|
// Purpose: documentation for wxMultiChoiceDialog class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxMultiChoiceDialog
|
||||||
|
@wxheader{choicdlg.h}
|
||||||
|
|
||||||
|
This class represents a dialog that shows a list of strings, and allows
|
||||||
|
the user to select one or more.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{cmndlg}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxmultichoicedialogoverview "wxMultiChoiceDialog overview",
|
||||||
|
wxSingleChoiceDialog
|
||||||
|
*/
|
||||||
|
class wxMultiChoiceDialog : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor taking an array of wxString choices.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window.
|
||||||
|
|
||||||
|
@param message
|
||||||
|
Message to show on the dialog.
|
||||||
|
|
||||||
|
@param caption
|
||||||
|
The dialog caption.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The number of choices.
|
||||||
|
|
||||||
|
@param choices
|
||||||
|
An array of strings, or a string list, containing the choices.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
A dialog style (bitlist) containing flags chosen from standard
|
||||||
|
dialog styles and the following:
|
||||||
|
|
||||||
|
|
||||||
|
wxOK
|
||||||
|
|
||||||
|
|
||||||
|
Show an OK button.
|
||||||
|
|
||||||
|
wxCANCEL
|
||||||
|
|
||||||
|
|
||||||
|
Show a Cancel button.
|
||||||
|
|
||||||
|
wxCENTRE
|
||||||
|
|
||||||
|
|
||||||
|
Centre the message. Not Windows.
|
||||||
|
|
||||||
|
The default value is equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER |
|
||||||
|
wxOK | wxCANCEL | wxCENTRE.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Dialog position. Not Windows.
|
||||||
|
|
||||||
|
@remarks Use ShowModal() to show the dialog.
|
||||||
|
*/
|
||||||
|
wxMultiChoiceDialog(wxWindow* parent, const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
int n,
|
||||||
|
const wxString* choices,
|
||||||
|
long style = wxCHOICEDLG_STYLE,
|
||||||
|
const wxPoint& pos = wxDefaultPosition);
|
||||||
|
wxMultiChoiceDialog(wxWindow* parent,
|
||||||
|
const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxArrayString& choices,
|
||||||
|
long style = wxCHOICEDLG_STYLE,
|
||||||
|
const wxPoint& pos = wxDefaultPosition);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns array with indexes of selected items.
|
||||||
|
*/
|
||||||
|
wxArrayInt GetSelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets selected items from the array of selected items' indexes.
|
||||||
|
*/
|
||||||
|
void SetSelections(const wxArrayInt& selections);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the dialog, returning either wxID_OK or wxID_CANCEL.
|
||||||
|
*/
|
||||||
|
int ShowModal();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxSingleChoiceDialog
|
||||||
|
@wxheader{choicdlg.h}
|
||||||
|
|
||||||
|
This class represents a dialog that shows a list of strings, and allows the
|
||||||
|
user to select one. Double-clicking on a list item is equivalent to
|
||||||
|
single-clicking and then pressing OK.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{cmndlg}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxsinglechoicedialogoverview "wxSingleChoiceDialog overview",
|
||||||
|
wxMultiChoiceDialog
|
||||||
|
*/
|
||||||
|
class wxSingleChoiceDialog : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, taking an array of wxString choices and optional client data.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window.
|
||||||
|
|
||||||
|
@param message
|
||||||
|
Message to show on the dialog.
|
||||||
|
|
||||||
|
@param caption
|
||||||
|
The dialog caption.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The number of choices.
|
||||||
|
|
||||||
|
@param choices
|
||||||
|
An array of strings, or a string list, containing the choices.
|
||||||
|
|
||||||
|
@param clientData
|
||||||
|
An array of client data to be associated with the items.
|
||||||
|
See GetSelectionClientData.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
A dialog style (bitlist) containing flags chosen from standard
|
||||||
|
dialog styles and the following:
|
||||||
|
|
||||||
|
|
||||||
|
wxOK
|
||||||
|
|
||||||
|
|
||||||
|
Show an OK button.
|
||||||
|
|
||||||
|
wxCANCEL
|
||||||
|
|
||||||
|
|
||||||
|
Show a Cancel button.
|
||||||
|
|
||||||
|
wxCENTRE
|
||||||
|
|
||||||
|
|
||||||
|
Centre the message. Not Windows.
|
||||||
|
|
||||||
|
The default value is equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER |
|
||||||
|
wxOK | wxCANCEL | wxCENTRE.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Dialog position. Not Windows.
|
||||||
|
|
||||||
|
@remarks Use ShowModal() to show the dialog.
|
||||||
|
*/
|
||||||
|
wxSingleChoiceDialog(wxWindow* parent, const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
int n,
|
||||||
|
const wxString* choices,
|
||||||
|
void** clientData = @NULL,
|
||||||
|
long style = wxCHOICEDLG_STYLE,
|
||||||
|
const wxPoint& pos = wxDefaultPosition);
|
||||||
|
wxSingleChoiceDialog(wxWindow* parent,
|
||||||
|
const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxArrayString& choices,
|
||||||
|
void** clientData = @NULL,
|
||||||
|
long style = wxCHOICEDLG_STYLE,
|
||||||
|
const wxPoint& pos = wxDefaultPosition);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the index of selected item.
|
||||||
|
*/
|
||||||
|
int GetSelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the client data associated with the selection.
|
||||||
|
*/
|
||||||
|
char* GetSelectionClientData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the selected string.
|
||||||
|
*/
|
||||||
|
wxString GetStringSelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the index of the initially selected item.
|
||||||
|
*/
|
||||||
|
void SetSelection(int selection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the dialog, returning either wxID_OK or wxID_CANCEL.
|
||||||
|
*/
|
||||||
|
int ShowModal();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
As @b wxGetSingleChoice but returns the index representing the selected
|
||||||
|
string. If the user pressed cancel, -1 is returned.
|
||||||
|
*/
|
||||||
|
int wxGetSingleChoiceIndex(const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxArrayString& aChoices,
|
||||||
|
wxWindow * parent = @NULL,
|
||||||
|
int x = -1,
|
||||||
|
int y = -1,
|
||||||
|
bool centre = @true,
|
||||||
|
int width=150,
|
||||||
|
int height=200);
|
||||||
|
int wxGetSingleChoiceIndex(const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
int n,
|
||||||
|
const wxString& choices[],
|
||||||
|
wxWindow * parent = @NULL,
|
||||||
|
int x = -1,
|
||||||
|
int y = -1,
|
||||||
|
bool centre = @true,
|
||||||
|
int width=150,
|
||||||
|
int height=200);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Pops up a dialog box containing a message, OK/Cancel buttons and a
|
||||||
|
single-selection listbox. The user may choose an item and press OK to return a
|
||||||
|
string or Cancel to return the empty string. Use
|
||||||
|
wxGetSingleChoiceIndex if empty string is a
|
||||||
|
valid choice and if you want to be able to detect pressing Cancel reliably.
|
||||||
|
|
||||||
|
You may pass the list of strings to choose from either using @e choices
|
||||||
|
which is an array of @e n strings for the listbox or by using a single
|
||||||
|
@e aChoices parameter of type wxArrayString.
|
||||||
|
|
||||||
|
If @e centre is @true, the message text (which may include new line
|
||||||
|
characters) is centred; if @false, the message is left-justified.
|
||||||
|
*/
|
||||||
|
wxString wxGetSingleChoice(const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxArrayString& aChoices,
|
||||||
|
wxWindow * parent = @NULL,
|
||||||
|
int x = -1,
|
||||||
|
int y = -1,
|
||||||
|
bool centre = @true,
|
||||||
|
int width=150,
|
||||||
|
int height=200);
|
||||||
|
wxString wxGetSingleChoice(const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
int n,
|
||||||
|
const wxString& choices[],
|
||||||
|
wxWindow * parent = @NULL,
|
||||||
|
int x = -1,
|
||||||
|
int y = -1,
|
||||||
|
bool centre = @true,
|
||||||
|
int width=150,
|
||||||
|
int height=200);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
As @b wxGetSingleChoice but takes an array of client data pointers
|
||||||
|
corresponding to the strings, and returns one of these pointers or @NULL if
|
||||||
|
Cancel was pressed. The @e client_data array must have the same number of
|
||||||
|
elements as @e choices or @e aChoices!
|
||||||
|
*/
|
||||||
|
wxString wxGetSingleChoiceData(const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxArrayString& aChoices,
|
||||||
|
const wxString& client_data[],
|
||||||
|
wxWindow * parent = @NULL,
|
||||||
|
int x = -1,
|
||||||
|
int y = -1,
|
||||||
|
bool centre = @true,
|
||||||
|
int width=150,
|
||||||
|
int height=200);
|
||||||
|
wxString wxGetSingleChoiceData(const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
int n,
|
||||||
|
const wxString& choices[],
|
||||||
|
const wxString& client_data[],
|
||||||
|
wxWindow * parent = @NULL,
|
||||||
|
int x = -1,
|
||||||
|
int y = -1,
|
||||||
|
bool centre = @true,
|
||||||
|
int width=150,
|
||||||
|
int height=200);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Pops up a dialog box containing a message, OK/Cancel buttons and a
|
||||||
|
multiple-selection listbox. The user may choose an arbitrary (including 0)
|
||||||
|
number of items in the listbox whose indices will be returned in
|
||||||
|
@e selection array. The initial contents of this array will be used to
|
||||||
|
select the items when the dialog is shown.
|
||||||
|
|
||||||
|
You may pass the list of strings to choose from either using @e choices
|
||||||
|
which is an array of @e n strings for the listbox or by using a single
|
||||||
|
@e aChoices parameter of type wxArrayString.
|
||||||
|
|
||||||
|
If @e centre is @true, the message text (which may include new line
|
||||||
|
characters) is centred; if @false, the message is left-justified.
|
||||||
|
*/
|
||||||
|
size_t wxGetMultipleChoices(wxArrayInt& selections,
|
||||||
|
const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxArrayString& aChoices,
|
||||||
|
wxWindow * parent = @NULL,
|
||||||
|
int x = -1,
|
||||||
|
int y = -1,
|
||||||
|
bool centre = @true,
|
||||||
|
int width=150,
|
||||||
|
int height=200);
|
||||||
|
size_t wxGetMultipleChoices(wxArrayInt& selections,
|
||||||
|
const wxString& message,
|
||||||
|
const wxString& caption,
|
||||||
|
int n,
|
||||||
|
const wxString& choices[],
|
||||||
|
wxWindow * parent = @NULL,
|
||||||
|
int x = -1,
|
||||||
|
int y = -1,
|
||||||
|
bool centre = @true,
|
||||||
|
int width=150,
|
||||||
|
int height=200);
|
||||||
|
//@}
|
||||||
|
|
||||||
142
interface/choice.h
Normal file
142
interface/choice.h
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: choice.h
|
||||||
|
// Purpose: documentation for wxChoice class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxChoice
|
||||||
|
@wxheader{choice.h}
|
||||||
|
|
||||||
|
A choice item is used to select one of a list of strings. Unlike a
|
||||||
|
listbox, only the selection is visible until the user pulls down the
|
||||||
|
menu of choices.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCB_SORT}:
|
||||||
|
Sorts the entries alphabetically.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@beginEventTable
|
||||||
|
@event{EVT_CHOICE(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the
|
||||||
|
list is selected.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{choice.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxListBox, wxComboBox, wxCommandEvent
|
||||||
|
*/
|
||||||
|
class wxChoice : public wxControlWithItems
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a choice.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Window identifier. The value wxID_ANY indicates a default value.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Window position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Window size. If wxDefaultSize is specified then the choice is sized
|
||||||
|
appropriately.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
Number of strings with which to initialise the choice control.
|
||||||
|
|
||||||
|
@param choices
|
||||||
|
An array of strings with which to initialise the choice control.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. See wxChoice.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
|
||||||
|
@sa Create(), wxValidator
|
||||||
|
*/
|
||||||
|
wxChoice();
|
||||||
|
wxChoice(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size, int n,
|
||||||
|
const wxString choices[],
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "choice");
|
||||||
|
wxChoice(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
const wxArrayString& choices,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "choice");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor, destroying the choice item.
|
||||||
|
*/
|
||||||
|
~wxChoice();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Creates the choice for two-step construction. See wxChoice().
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id, const wxPoint& pos,
|
||||||
|
const wxSize& size, int n,
|
||||||
|
const wxString choices[],
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "choice");
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
const wxArrayString& choices,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "choice");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the number of columns in this choice item.
|
||||||
|
|
||||||
|
@remarks This is implemented for Motif only and always returns 1 for the
|
||||||
|
other platforms.
|
||||||
|
*/
|
||||||
|
int GetColumns();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Unlike wxControlWithItems::GetSelection which only
|
||||||
|
returns the accepted selection value, i.e. the selection in the control once
|
||||||
|
the user closes the dropdown list, this function returns the current selection.
|
||||||
|
That is, while the dropdown list is shown, it returns the currently selected
|
||||||
|
item in it. When it is not shown, its result is the same as for the other
|
||||||
|
function.
|
||||||
|
|
||||||
|
This function is new since wxWidgets version 2.6.2 (before this version
|
||||||
|
wxControlWithItems::GetSelection itself behaved like
|
||||||
|
this).
|
||||||
|
*/
|
||||||
|
int GetCurrentSelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the number of columns in this choice item.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
Number of columns.
|
||||||
|
*/
|
||||||
|
void SetColumns(int n = 1);
|
||||||
|
};
|
||||||
62
interface/choicebk.h
Normal file
62
interface/choicebk.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: choicebk.h
|
||||||
|
// Purpose: documentation for wxChoicebook class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxChoicebook
|
||||||
|
@wxheader{choicebk.h}
|
||||||
|
|
||||||
|
wxChoicebook is a class similar to wxNotebook but which
|
||||||
|
uses a wxChoice to show the labels instead of the
|
||||||
|
tabs.
|
||||||
|
|
||||||
|
There is no documentation for this class yet but its usage is
|
||||||
|
identical to wxNotebook (except for the features clearly related to tabs
|
||||||
|
only), so please refer to that class documentation for now. You can also
|
||||||
|
use the @ref overview_samplenotebook "notebook sample" to see wxChoicebook in
|
||||||
|
action.
|
||||||
|
|
||||||
|
wxChoicebook allows the use of wxBookCtrl::GetControlSizer, allowing a program
|
||||||
|
to add other controls next to the choice control. This is particularly useful
|
||||||
|
when screen space is restricted, as it often is when wxChoicebook is being
|
||||||
|
employed.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCHB_DEFAULT}:
|
||||||
|
Choose the default location for the labels depending on the current
|
||||||
|
platform (left everywhere except Mac where it is top).
|
||||||
|
@style{wxCHB_TOP}:
|
||||||
|
Place labels above the page area.
|
||||||
|
@style{wxCHB_LEFT}:
|
||||||
|
Place labels on the left side.
|
||||||
|
@style{wxCHB_RIGHT}:
|
||||||
|
Place labels on the right side.
|
||||||
|
@style{wxCHB_BOTTOM}:
|
||||||
|
Place labels below the page area.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{miscwnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxBookCtrl, wxNotebook, @ref overview_samplenotebook "notebook sample"
|
||||||
|
*/
|
||||||
|
class wxChoicebook : public wxBookCtrl overview
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructs a choicebook control.
|
||||||
|
*/
|
||||||
|
wxChoicebook();
|
||||||
|
wxChoicebook(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxEmptyStr);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
82
interface/clipboard.h
Normal file
82
interface/clipboard.h
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: clipboard.h
|
||||||
|
// Purpose: documentation for global functions
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the name of a registered clipboard format, and puts it into the buffer @e
|
||||||
|
formatName which is of maximum
|
||||||
|
length @e maxCount. @e dataFormat must not specify a predefined clipboard
|
||||||
|
format.
|
||||||
|
*/
|
||||||
|
bool wxGetClipboardFormatName(int dataFormat,
|
||||||
|
const wxString& formatName,
|
||||||
|
int maxCount);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets data from the clipboard.
|
||||||
|
|
||||||
|
@e dataFormat may be one of:
|
||||||
|
|
||||||
|
wxCF_TEXT or wxCF_OEMTEXT: returns a pointer to new memory containing a
|
||||||
|
null-terminated text string.
|
||||||
|
wxCF_BITMAP: returns a new wxBitmap.
|
||||||
|
|
||||||
|
The clipboard must have previously been opened for this call to succeed.
|
||||||
|
*/
|
||||||
|
wxObject * wxGetClipboardData(int dataFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the given data format is available on the clipboard.
|
||||||
|
*/
|
||||||
|
bool wxIsClipboardFormatAvailable(int dataFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Opens the clipboard for passing data to it or getting data from it.
|
||||||
|
*/
|
||||||
|
bool wxOpenClipboard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Empties the clipboard.
|
||||||
|
*/
|
||||||
|
bool wxEmptyClipboard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this application has already opened the clipboard.
|
||||||
|
*/
|
||||||
|
bool wxClipboardOpen();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Registers the clipboard data format name and returns an identifier.
|
||||||
|
*/
|
||||||
|
int wxRegisterClipboardFormat(const wxString& formatName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Closes the clipboard to allow other applications to use it.
|
||||||
|
*/
|
||||||
|
bool wxCloseClipboard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enumerates the formats found in a list of available formats that belong
|
||||||
|
to the clipboard. Each call to this function specifies a known
|
||||||
|
available format; the function returns the format that appears next in
|
||||||
|
the list.
|
||||||
|
|
||||||
|
@e dataFormat specifies a known format. If this parameter is zero,
|
||||||
|
the function returns the first format in the list.
|
||||||
|
|
||||||
|
The return value specifies the next known clipboard data format if the
|
||||||
|
function is successful. It is zero if the @e dataFormat parameter specifies
|
||||||
|
the last format in the list of available formats, or if the clipboard
|
||||||
|
is not open.
|
||||||
|
|
||||||
|
Before it enumerates the formats function, an application must open the
|
||||||
|
clipboard by using the
|
||||||
|
wxOpenClipboard function.
|
||||||
|
*/
|
||||||
|
int wxEnumClipboardFormats(int dataFormat);
|
||||||
|
|
||||||
170
interface/clipbrd.h
Normal file
170
interface/clipbrd.h
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: clipbrd.h
|
||||||
|
// Purpose: documentation for wxClipboard class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxClipboard
|
||||||
|
@wxheader{clipbrd.h}
|
||||||
|
|
||||||
|
A class for manipulating the clipboard. Note that this is not compatible with
|
||||||
|
the
|
||||||
|
clipboard class from wxWidgets 1.xx, which has the same name but a different
|
||||||
|
implementation.
|
||||||
|
|
||||||
|
To use the clipboard, you call member functions of the global @b wxTheClipboard
|
||||||
|
object.
|
||||||
|
|
||||||
|
See also the @ref overview_wxdataobjectoverview "wxDataObject overview" for
|
||||||
|
further information.
|
||||||
|
|
||||||
|
Call wxClipboard::Open to get ownership of the clipboard. If this operation
|
||||||
|
returns @true, you
|
||||||
|
now own the clipboard. Call wxClipboard::SetData to put data
|
||||||
|
on the clipboard, or wxClipboard::GetData to
|
||||||
|
retrieve data from the clipboard. Call wxClipboard::Close to close
|
||||||
|
the clipboard and relinquish ownership. You should keep the clipboard open only
|
||||||
|
momentarily.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
@code
|
||||||
|
// Write some text to the clipboard
|
||||||
|
if (wxTheClipboard-Open())
|
||||||
|
{
|
||||||
|
// This data objects are held by the clipboard,
|
||||||
|
// so do not delete them in the app.
|
||||||
|
wxTheClipboard-SetData( new wxTextDataObject("Some text") );
|
||||||
|
wxTheClipboard-Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read some text
|
||||||
|
if (wxTheClipboard-Open())
|
||||||
|
{
|
||||||
|
if (wxTheClipboard-IsSupported( wxDF_TEXT ))
|
||||||
|
{
|
||||||
|
wxTextDataObject data;
|
||||||
|
wxTheClipboard-GetData( data );
|
||||||
|
wxMessageBox( data.GetText() );
|
||||||
|
}
|
||||||
|
wxTheClipboard-Close();
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Drag and drop overview", wxDataObject
|
||||||
|
*/
|
||||||
|
class wxClipboard : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxClipboard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxClipboard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Call this function to add the data object to the clipboard. You may call
|
||||||
|
this function repeatedly after having cleared the clipboard using Clear().
|
||||||
|
|
||||||
|
After this function has been called, the clipboard owns the data, so do not
|
||||||
|
delete
|
||||||
|
the data explicitly.
|
||||||
|
|
||||||
|
@sa SetData()
|
||||||
|
*/
|
||||||
|
bool AddData(wxDataObject* data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Clears the global clipboard object and the system's clipboard if possible.
|
||||||
|
*/
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Call this function to close the clipboard, having opened it with Open().
|
||||||
|
*/
|
||||||
|
void Close();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Flushes the clipboard: this means that the data which is currently on
|
||||||
|
clipboard will stay available even after the application exits (possibly
|
||||||
|
eating memory), otherwise the clipboard will be emptied on exit.
|
||||||
|
Returns @false if the operation is unsuccessful for any reason.
|
||||||
|
*/
|
||||||
|
bool Flush();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Call this function to fill @e data with data on the clipboard, if available in
|
||||||
|
the required
|
||||||
|
format. Returns @true on success.
|
||||||
|
*/
|
||||||
|
bool GetData(wxDataObject& data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the clipboard has been opened.
|
||||||
|
*/
|
||||||
|
bool IsOpened();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if there is data which matches the data format of the given data
|
||||||
|
object currently @b available (IsSupported sounds like a misnomer, FIXME: better deprecate this name?) on the clipboard.
|
||||||
|
*/
|
||||||
|
bool IsSupported(const wxDataFormat& format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if we are using the primary selection, @false if clipboard
|
||||||
|
one.
|
||||||
|
See @ref useprimary() UsePrimarySelection for more information.
|
||||||
|
*/
|
||||||
|
bool IsUsingPrimarySelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Call this function to open the clipboard before calling SetData()
|
||||||
|
and GetData().
|
||||||
|
|
||||||
|
Call Close() when you have finished with the clipboard. You
|
||||||
|
should keep the clipboard open for only a very short time.
|
||||||
|
|
||||||
|
Returns @true on success. This should be tested (as in the sample shown above).
|
||||||
|
*/
|
||||||
|
bool Open();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Call this function to set the data object to the clipboard. This function will
|
||||||
|
clear all previous contents in the clipboard, so calling it several times
|
||||||
|
does not make any sense.
|
||||||
|
|
||||||
|
After this function has been called, the clipboard owns the data, so do not
|
||||||
|
delete
|
||||||
|
the data explicitly.
|
||||||
|
|
||||||
|
@sa AddData()
|
||||||
|
*/
|
||||||
|
bool SetData(wxDataObject* data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
On platforms supporting it (all X11-based ports), wxClipboard uses the
|
||||||
|
CLIPBOARD X11 selection by default. When this function is called with @true
|
||||||
|
argument, all subsequent clipboard operations will use PRIMARY selection until
|
||||||
|
this function is called again with @false.
|
||||||
|
|
||||||
|
On the other platforms, there is no PRIMARY selection and so all clipboard
|
||||||
|
operations will fail. This allows to implement the standard X11 handling of the
|
||||||
|
clipboard which consists in copying data to the CLIPBOARD selection only when
|
||||||
|
the user explicitly requests it (i.e. by selection @c "Copy" menu
|
||||||
|
command) but putting the currently selected text into the PRIMARY selection
|
||||||
|
automatically, without overwriting the normal clipboard contents with the
|
||||||
|
currently selected text on the other platforms.
|
||||||
|
*/
|
||||||
|
void UsePrimarySelection(bool primary = @true);
|
||||||
|
};
|
||||||
142
interface/clntdata.h
Normal file
142
interface/clntdata.h
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: clntdata.h
|
||||||
|
// Purpose: documentation for wxClientDataContainer class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxClientDataContainer
|
||||||
|
@wxheader{clntdata.h}
|
||||||
|
|
||||||
|
This class is a mixin that provides storage and management of "client
|
||||||
|
data." This data can either be of type void - in which case the data
|
||||||
|
@e container does not take care of freeing the data again
|
||||||
|
or it is of type wxClientData or its derivatives. In that case the
|
||||||
|
container will free the memory itself later.
|
||||||
|
Note that you @e must not assign both void data and data
|
||||||
|
derived from the wxClientData class to a container.
|
||||||
|
|
||||||
|
NOTE: This functionality is currently duplicated in wxEvtHandler in
|
||||||
|
order to avoid having more than one vtable in that class hierarchy.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxEvtHandler, wxClientData
|
||||||
|
*/
|
||||||
|
class wxClientDataContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
|
||||||
|
*/
|
||||||
|
wxClientDataContainer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
*/
|
||||||
|
~wxClientDataContainer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the untyped client data.
|
||||||
|
*/
|
||||||
|
void* GetClientData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get a pointer to the client data object.
|
||||||
|
*/
|
||||||
|
wxClientData* GetClientObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the untyped client data.
|
||||||
|
*/
|
||||||
|
void SetClientData(void* data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the client data object. Any previous object will be deleted.
|
||||||
|
*/
|
||||||
|
void SetClientObject(wxClientData* data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxClientData
|
||||||
|
@wxheader{clntdata.h}
|
||||||
|
|
||||||
|
All classes deriving from wxEvtHandler
|
||||||
|
(such as all controls and wxApp)
|
||||||
|
can hold arbitrary data which is here referred to as "client data".
|
||||||
|
This is useful e.g. for scripting languages which need to handle
|
||||||
|
shadow objects for most of wxWidgets' classes and which store
|
||||||
|
a handle to such a shadow class as client data in that class.
|
||||||
|
This data can either be of type void - in which case the data
|
||||||
|
@e container does not take care of freeing the data again
|
||||||
|
or it is of type wxClientData or its derivatives. In that case the
|
||||||
|
container (e.g. a control) will free the memory itself later.
|
||||||
|
Note that you @e must not assign both void data and data
|
||||||
|
derived from the wxClientData class to a container.
|
||||||
|
|
||||||
|
Some controls can hold various items and these controls can
|
||||||
|
additionally hold client data for each item. This is the case for
|
||||||
|
wxChoice, wxComboBox
|
||||||
|
and wxListBox. wxTreeCtrl
|
||||||
|
has a specialized class wxTreeItemData
|
||||||
|
for each item in the tree.
|
||||||
|
|
||||||
|
If you want to add client data to your own classes, you may
|
||||||
|
use the mix-in class wxClientDataContainer.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxEvtHandler, wxTreeItemData, wxStringClientData, wxClientDataContainer
|
||||||
|
*/
|
||||||
|
class wxClientData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxClientData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Virtual destructor.
|
||||||
|
*/
|
||||||
|
~wxClientData();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxStringClientData
|
||||||
|
@wxheader{clntdata.h}
|
||||||
|
|
||||||
|
Predefined client data class for holding a string.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
*/
|
||||||
|
class wxStringClientData : public wxClientData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Create client data with string.
|
||||||
|
*/
|
||||||
|
wxStringClientData();
|
||||||
|
wxStringClientData(const wxString& data);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get string client data.
|
||||||
|
*/
|
||||||
|
const wxString GetData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set string client data.
|
||||||
|
*/
|
||||||
|
void SetData(const wxString& data);
|
||||||
|
};
|
||||||
138
interface/clrpicker.h
Normal file
138
interface/clrpicker.h
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: clrpicker.h
|
||||||
|
// Purpose: documentation for wxColourPickerCtrl class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxColourPickerCtrl
|
||||||
|
@wxheader{clrpicker.h}
|
||||||
|
|
||||||
|
This control allows the user to select a colour. The generic implementation is
|
||||||
|
a button which brings up a wxColourDialog when clicked. Native implementation
|
||||||
|
may differ but this is usually a (small) widget which give access to the
|
||||||
|
colour-chooser
|
||||||
|
dialog.
|
||||||
|
It is only available if @c wxUSE_COLOURPICKERCTRL is set to 1 (the default).
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCLRP_DEFAULT_STYLE}:
|
||||||
|
The default style: 0.
|
||||||
|
@style{wxCLRP_USE_TEXTCTRL}:
|
||||||
|
Creates a text control to the left of the picker button which is
|
||||||
|
completely managed by the wxColourPickerCtrl and which can be used
|
||||||
|
by the user to specify a colour (see SetColour). The text control
|
||||||
|
is automatically synchronized with button's value. Use functions
|
||||||
|
defined in wxPickerBase to modify the text control.
|
||||||
|
@style{wxCLRP_SHOW_LABEL}:
|
||||||
|
Shows the colour in HTML form (AABBCC) as colour button label
|
||||||
|
(instead of no label at all).
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{miscpickers}
|
||||||
|
@appearance{colourpickerctrl.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxColourDialog, wxColourPickerEvent
|
||||||
|
*/
|
||||||
|
class wxColourPickerCtrl : public wxPickerBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Initializes the object and calls Create() with
|
||||||
|
all the parameters.
|
||||||
|
*/
|
||||||
|
wxColourPickerCtrl(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxColour& colour = wxBLACK,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxCLRP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "colourpickerctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param parent
|
||||||
|
Parent window, must not be non-@NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The identifier for the control.
|
||||||
|
|
||||||
|
@param colour
|
||||||
|
The initial colour shown in the control.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Initial position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Initial size.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style, see wxCRLP_* flags.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Validator which can be used for additional date checks.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Control name.
|
||||||
|
|
||||||
|
@returns @true if the control was successfully created or @false if
|
||||||
|
creation failed.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxColour& colour = wxBLACK,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxCLRP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "colourpickerctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the currently selected colour.
|
||||||
|
*/
|
||||||
|
wxColour GetColour();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Sets the currently selected colour. See wxColour::Set.
|
||||||
|
*/
|
||||||
|
void SetColour(const wxColour & col);
|
||||||
|
void SetColour(const wxString & colname);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxColourPickerEvent
|
||||||
|
@wxheader{clrpicker.h}
|
||||||
|
|
||||||
|
This event class is used for the events generated by
|
||||||
|
wxColourPickerCtrl.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxColourPickerCtrl
|
||||||
|
*/
|
||||||
|
class wxColourPickerEvent : public wxCommandEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
The constructor is not normally used by the user code.
|
||||||
|
*/
|
||||||
|
wxColourPickerEvent(wxObject * generator, int id,
|
||||||
|
const wxColour& colour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieve the colour the user has just selected.
|
||||||
|
*/
|
||||||
|
wxColour GetColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the colour associated with the event.
|
||||||
|
*/
|
||||||
|
void SetColour(const wxColour & pos);
|
||||||
|
};
|
||||||
304
interface/cmdline.h
Normal file
304
interface/cmdline.h
Normal file
@@ -0,0 +1,304 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: cmdline.h
|
||||||
|
// Purpose: documentation for wxCmdLineParser class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCmdLineParser
|
||||||
|
@wxheader{cmdline.h}
|
||||||
|
|
||||||
|
wxCmdLineParser is a class for parsing the command line.
|
||||||
|
|
||||||
|
It has the following features:
|
||||||
|
|
||||||
|
distinguishes options, switches and parameters; allows option grouping
|
||||||
|
allows both short and long options
|
||||||
|
automatically generates the usage message from the command line description
|
||||||
|
does type checks on the options values (number, date, ...).
|
||||||
|
|
||||||
|
To use it you should follow these steps:
|
||||||
|
|
||||||
|
@ref wxCmdLineParser::construction construct an object of this class
|
||||||
|
giving it the command line to parse and optionally its description or use
|
||||||
|
@c AddXXX() functions later
|
||||||
|
call @c Parse()
|
||||||
|
use @c Found() to retrieve the results
|
||||||
|
|
||||||
|
In the documentation below the following terminology is used:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
switch
|
||||||
|
|
||||||
|
|
||||||
|
This is a boolean option which can be given or not, but
|
||||||
|
which doesn't have any value. We use the word switch to distinguish such boolean
|
||||||
|
options from more generic options like those described below. For example,
|
||||||
|
@c -v might be a switch meaning "enable verbose mode".
|
||||||
|
|
||||||
|
|
||||||
|
option
|
||||||
|
|
||||||
|
|
||||||
|
Option for us here is something which comes with a value 0
|
||||||
|
unlike a switch. For example, @c -o:filename might be an option which allows
|
||||||
|
to specify the name of the output file.
|
||||||
|
|
||||||
|
|
||||||
|
parameter
|
||||||
|
|
||||||
|
|
||||||
|
This is a required program argument.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{appmanagement}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxApp::argc and wxApp::argv, console sample
|
||||||
|
*/
|
||||||
|
class wxCmdLineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Specifies both the command line (in Windows format) and the
|
||||||
|
@ref setdesc() "command line description".
|
||||||
|
*/
|
||||||
|
wxCmdLineParser();
|
||||||
|
wxCmdLineParser(int argc, char** argv);
|
||||||
|
wxCmdLineParser(int argc, wchar_t** argv);
|
||||||
|
wxCmdLineParser(const wxString& cmdline);
|
||||||
|
wxCmdLineParser(const wxCmdLineEntryDesc* desc);
|
||||||
|
wxCmdLineParser(const wxCmdLineEntryDesc* desc, int argc,
|
||||||
|
char** argv);
|
||||||
|
wxCmdLineParser(const wxCmdLineEntryDesc* desc,
|
||||||
|
const wxString& cmdline);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Frees resources allocated by the object.
|
||||||
|
|
||||||
|
@b NB: destructor is not virtual, don't use this class polymorphically.
|
||||||
|
*/
|
||||||
|
~wxCmdLineParser();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Add an option @e name with an optional long name @e lng (no long name if
|
||||||
|
it is empty, which is default) taking a value of the given type (string by
|
||||||
|
default) to the command line description.
|
||||||
|
*/
|
||||||
|
void AddOption(const wxString& name,
|
||||||
|
const wxString& lng = wxEmptyString,
|
||||||
|
const wxString& desc = wxEmptyString,
|
||||||
|
wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Add a parameter of the given @e type to the command line description.
|
||||||
|
*/
|
||||||
|
void AddParam(const wxString& desc = wxEmptyString,
|
||||||
|
wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Add a switch @e name with an optional long name @e lng (no long name if it
|
||||||
|
is empty, which is default), description @e desc and flags @e flags to the
|
||||||
|
command line description.
|
||||||
|
*/
|
||||||
|
void AddSwitch(const wxString& name,
|
||||||
|
const wxString& lng = wxEmptyString,
|
||||||
|
const wxString& desc = wxEmptyString,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if long options are enabled, otherwise @false.
|
||||||
|
|
||||||
|
@sa EnableLongOptions()
|
||||||
|
*/
|
||||||
|
bool AreLongOptionsEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Before Parse() can be called, the command line
|
||||||
|
parser object must have the command line to parse and also the rules saying
|
||||||
|
which switches, options and parameters are valid - this is called command line
|
||||||
|
description in what follows.
|
||||||
|
|
||||||
|
You have complete freedom of choice as to when specify the required information,
|
||||||
|
the only restriction is that it must be done before calling
|
||||||
|
Parse().
|
||||||
|
|
||||||
|
To specify the command line to parse you may use either one of constructors
|
||||||
|
accepting it (@c wxCmdLineParser(argc, argv) or @c wxCmdLineParser(const
|
||||||
|
wxString) usually)
|
||||||
|
or, if you use the default constructor, you can do it later by calling
|
||||||
|
SetCmdLine().
|
||||||
|
|
||||||
|
The same holds for command line description: it can be specified either in
|
||||||
|
the @ref wxcmdlineparserctor() constructor (with or without
|
||||||
|
the command line itself) or constructed later using either
|
||||||
|
SetDesc() or combination of
|
||||||
|
AddSwitch(),
|
||||||
|
AddOption() and
|
||||||
|
AddParam() methods.
|
||||||
|
|
||||||
|
Using constructors or SetDesc() uses a (usually
|
||||||
|
@c const static) table containing the command line description. If you want
|
||||||
|
to decide which options to accept during the run-time, using one of the
|
||||||
|
@c AddXXX() functions above might be preferable.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Breaks down the string containing the full command line in words. The words are
|
||||||
|
separated by whitespace. The quotes can be used in the input string to quote
|
||||||
|
the white space and the back slashes can be used to quote the quotes.
|
||||||
|
*/
|
||||||
|
static wxArrayString ConvertStringToArgs(const wxChar cmdline);
|
||||||
|
|
||||||
|
/**
|
||||||
|
wxCmdLineParser has several global options which may be changed by the
|
||||||
|
application. All of the functions described in this section should be called
|
||||||
|
before Parse().
|
||||||
|
|
||||||
|
First global option is the support for long (also known as GNU-style) options.
|
||||||
|
The long options are the ones which start with two dashes (@c "--") and look
|
||||||
|
like this: @c --verbose, i.e. they generally are complete words and not some
|
||||||
|
abbreviations of them. As long options are used by more and more applications,
|
||||||
|
they are enabled by default, but may be disabled with
|
||||||
|
DisableLongOptions().
|
||||||
|
|
||||||
|
Another global option is the set of characters which may be used to start an
|
||||||
|
option (otherwise, the word on the command line is assumed to be a parameter).
|
||||||
|
Under Unix, @c '-' is always used, but Windows has at least two common
|
||||||
|
choices for this: @c '-' and @c '/'. Some programs also use @c '+'.
|
||||||
|
The default is to use what suits most the current platform, but may be changed
|
||||||
|
with SetSwitchChars() method.
|
||||||
|
|
||||||
|
Finally, SetLogo() can be used to show some
|
||||||
|
application-specific text before the explanation given by
|
||||||
|
Usage() function.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Identical to @ref enablelongoptions() EnableLongOptions(@false).
|
||||||
|
*/
|
||||||
|
void DisableLongOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enable or disable support for the long options.
|
||||||
|
|
||||||
|
As long options are not (yet) POSIX-compliant, this option allows to disable
|
||||||
|
them.
|
||||||
|
|
||||||
|
@sa Customization() and AreLongOptionsEnabled()
|
||||||
|
*/
|
||||||
|
void EnableLongOptions(bool enable = @true);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if an option taking a date value was found and stores the
|
||||||
|
value in the provided pointer (which should not be @NULL).
|
||||||
|
*/
|
||||||
|
bool Found(const wxString& name);
|
||||||
|
bool Found(const wxString& name, wxString* value);
|
||||||
|
bool Found(const wxString& name, long* value);
|
||||||
|
bool Found(const wxString& name, wxDateTime* value);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the value of Nth parameter (as string only).
|
||||||
|
*/
|
||||||
|
wxString GetParam(size_t n = 0u);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of parameters found. This function makes sense mostly if you
|
||||||
|
had used @c wxCMD_LINE_PARAM_MULTIPLE flag.
|
||||||
|
*/
|
||||||
|
size_t GetParamCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
After calling Parse() (and if it returned 0),
|
||||||
|
you may access the results of parsing using one of overloaded @c Found()
|
||||||
|
methods.
|
||||||
|
|
||||||
|
For a simple switch, you will simply call
|
||||||
|
Found() to determine if the switch was given
|
||||||
|
or not, for an option or a parameter, you will call a version of @c Found()
|
||||||
|
which also returns the associated value in the provided variable. All
|
||||||
|
@c Found() functions return @true if the switch or option were found in the
|
||||||
|
command line or @false if they were not specified.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Parse the command line, return 0 if ok, -1 if @c "-h" or @c "--help"
|
||||||
|
option was encountered and the help message was given or a positive value if a
|
||||||
|
syntax error occurred.
|
||||||
|
|
||||||
|
@param giveUsage
|
||||||
|
If @true (default), the usage message is given if a
|
||||||
|
syntax error was encountered while parsing the command line or if help was
|
||||||
|
requested. If @false, only error messages about possible syntax errors
|
||||||
|
are given, use Usage to show the usage message
|
||||||
|
from the caller if needed.
|
||||||
|
*/
|
||||||
|
int Parse(bool giveUsage = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
After the command line description was constructed and the desired options were
|
||||||
|
set, you can finally call Parse() method.
|
||||||
|
It returns 0 if the command line was correct and was parsed, -1 if the help
|
||||||
|
option was specified (this is a separate case as, normally, the program will
|
||||||
|
terminate after this) or a positive number if there was an error during the
|
||||||
|
command line parsing.
|
||||||
|
|
||||||
|
In the latter case, the appropriate error message and usage information are
|
||||||
|
logged by wxCmdLineParser itself using the standard wxWidgets logging functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Set command line to parse after using one of the constructors which don't do it.
|
||||||
|
*/
|
||||||
|
void SetCmdLine(int argc, char** argv);
|
||||||
|
void SetCmdLine(int argc, wchar_t** argv);
|
||||||
|
void SetCmdLine(const wxString& cmdline);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Construct the command line description
|
||||||
|
|
||||||
|
Take the command line description from the wxCMD_LINE_NONE terminated table.
|
||||||
|
|
||||||
|
Example of usage:
|
||||||
|
*/
|
||||||
|
void SetDesc(const wxCmdLineEntryDesc* desc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@e logo is some extra text which will be shown by
|
||||||
|
Usage() method.
|
||||||
|
*/
|
||||||
|
void SetLogo(const wxString& logo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@e switchChars contains all characters with which an option or switch may
|
||||||
|
start. Default is @c "-" for Unix, @c "-/" for Windows.
|
||||||
|
*/
|
||||||
|
void SetSwitchChars(const wxString& switchChars);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Give the standard usage message describing all program options. It will use the
|
||||||
|
options and parameters descriptions specified earlier, so the resulting message
|
||||||
|
will not be helpful to the user unless the descriptions were indeed specified.
|
||||||
|
|
||||||
|
@sa SetLogo()
|
||||||
|
*/
|
||||||
|
void Usage();
|
||||||
|
};
|
||||||
235
interface/cmdproc.h
Normal file
235
interface/cmdproc.h
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: cmdproc.h
|
||||||
|
// Purpose: documentation for wxCommand class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCommand
|
||||||
|
@wxheader{cmdproc.h}
|
||||||
|
|
||||||
|
wxCommand is a base class for modelling an application command,
|
||||||
|
which is an action usually performed by selecting a menu item, pressing
|
||||||
|
a toolbar button or any other means provided by the application to
|
||||||
|
change the data or view.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
Overview
|
||||||
|
*/
|
||||||
|
class wxCommand : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. wxCommand is an abstract class, so you will need to derive
|
||||||
|
a new class and call this constructor from your own constructor.
|
||||||
|
|
||||||
|
@e canUndo tells the command processor whether this command is undo-able. You
|
||||||
|
can achieve the same functionality by overriding the CanUndo member function
|
||||||
|
(if for example
|
||||||
|
the criteria for undoability is context-dependent).
|
||||||
|
|
||||||
|
@e name must be supplied for the command processor to display the command name
|
||||||
|
in the application's edit menu.
|
||||||
|
*/
|
||||||
|
wxCommand(bool canUndo = @false, const wxString& name = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the command can be undone, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool CanUndo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override this member function to execute the appropriate action when called.
|
||||||
|
Return @true to indicate that the action has taken place, @false otherwise.
|
||||||
|
Returning @false will indicate to the command processor that the action is
|
||||||
|
not undoable and should not be added to the command history.
|
||||||
|
*/
|
||||||
|
#define bool Do() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the command name.
|
||||||
|
*/
|
||||||
|
wxString GetName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override this member function to un-execute a previous Do.
|
||||||
|
Return @true to indicate that the action has taken place, @false otherwise.
|
||||||
|
Returning @false will indicate to the command processor that the action is
|
||||||
|
not redoable and no change should be made to the command history.
|
||||||
|
|
||||||
|
How you implement this command is totally application dependent, but typical
|
||||||
|
strategies include:
|
||||||
|
|
||||||
|
Perform an inverse operation on the last modified piece of
|
||||||
|
data in the document. When redone, a copy of data stored in command
|
||||||
|
is pasted back or some operation reapplied. This relies on the fact that
|
||||||
|
you know the ordering of Undos; the user can never Undo at an arbitrary position
|
||||||
|
in the command history.
|
||||||
|
Restore the entire document state (perhaps using document transactioning).
|
||||||
|
Potentially very inefficient, but possibly easier to code if the user interface
|
||||||
|
and data are complex, and an 'inverse execute' operation is hard to write.
|
||||||
|
|
||||||
|
The docview sample uses the first method, to remove or restore segments
|
||||||
|
in the drawing.
|
||||||
|
*/
|
||||||
|
bool Undo();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCommandProcessor
|
||||||
|
@wxheader{cmdproc.h}
|
||||||
|
|
||||||
|
wxCommandProcessor is a class that maintains a history of wxCommands,
|
||||||
|
with undo/redo functionality built-in. Derive a new class from this
|
||||||
|
if you want different behaviour.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxcommandprocessoroverview "wxCommandProcessor overview",
|
||||||
|
wxCommand
|
||||||
|
*/
|
||||||
|
class wxCommandProcessor : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
@e maxCommands may be set to a positive integer to limit the number of
|
||||||
|
commands stored to it, otherwise (and by default) the list of commands can grow
|
||||||
|
arbitrarily.
|
||||||
|
*/
|
||||||
|
wxCommandProcessor(int maxCommands = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxCommandProcessor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the currently-active command can be undone, @false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool CanUndo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Deletes all commands in the list and sets the current command pointer to @c
|
||||||
|
@NULL.
|
||||||
|
*/
|
||||||
|
virtual void ClearCommands();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the list of commands.
|
||||||
|
*/
|
||||||
|
wxList GetCommands();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the edit menu associated with the command processor.
|
||||||
|
*/
|
||||||
|
wxMenu* GetEditMenu();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the maximum number of commands that the command processor stores.
|
||||||
|
*/
|
||||||
|
int GetMaxCommands();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string that will be appended to the Redo menu item.
|
||||||
|
*/
|
||||||
|
const wxString GetRedoAccelerator();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string that will be shown for the redo menu item.
|
||||||
|
*/
|
||||||
|
wxString GetRedoMenuLabel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string that will be appended to the Undo menu item.
|
||||||
|
*/
|
||||||
|
const wxString GetUndoAccelerator();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string that will be shown for the undo menu item.
|
||||||
|
*/
|
||||||
|
wxString GetUndoMenuLabel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initializes the command processor, setting the current command to the
|
||||||
|
last in the list (if any), and updating the edit menu (if one has been
|
||||||
|
specified).
|
||||||
|
*/
|
||||||
|
virtual void Initialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a boolean value that indicates if changes have been made since
|
||||||
|
the last save operation. This only works if
|
||||||
|
MarkAsSaved()
|
||||||
|
is called whenever the project is saved.
|
||||||
|
*/
|
||||||
|
virtual bool IsDirty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
You must call this method whenever the project is saved if you plan to use
|
||||||
|
IsDirty().
|
||||||
|
*/
|
||||||
|
virtual void MarkAsSaved();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Executes (redoes) the current command (the command that has just been undone if
|
||||||
|
any).
|
||||||
|
*/
|
||||||
|
virtual bool Redo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tells the command processor to update the Undo and Redo items on this
|
||||||
|
menu as appropriate. Set this to @NULL if the menu is about to be
|
||||||
|
destroyed and command operations may still be performed, or the command
|
||||||
|
processor may try to access an invalid pointer.
|
||||||
|
*/
|
||||||
|
void SetEditMenu(wxMenu* menu);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the menu labels according to the currently set menu and the current
|
||||||
|
command state.
|
||||||
|
*/
|
||||||
|
void SetMenuStrings();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the string that will be appended to the Redo menu item.
|
||||||
|
*/
|
||||||
|
void SetRedoAccelerator(const wxString& accel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the string that will be appended to the Undo menu item.
|
||||||
|
*/
|
||||||
|
void SetUndoAccelerator(const wxString& accel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Submits a new command to the command processor. The command processor
|
||||||
|
calls wxCommand::Do to execute the command; if it succeeds, the command
|
||||||
|
is stored in the history list, and the associated edit menu (if any) updated
|
||||||
|
appropriately. If it fails, the command is deleted
|
||||||
|
immediately. Once Submit has been called, the passed command should not
|
||||||
|
be deleted directly by the application.
|
||||||
|
|
||||||
|
@e storeIt indicates whether the successful command should be stored
|
||||||
|
in the history list.
|
||||||
|
*/
|
||||||
|
virtual bool Submit(wxCommand * command, bool storeIt = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Undoes the command just executed.
|
||||||
|
*/
|
||||||
|
virtual bool Undo();
|
||||||
|
};
|
||||||
768
interface/cmndata.h
Normal file
768
interface/cmndata.h
Normal file
@@ -0,0 +1,768 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: cmndata.h
|
||||||
|
// Purpose: documentation for wxFontData class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFontData
|
||||||
|
@wxheader{cmndata.h}
|
||||||
|
|
||||||
|
@ref overview_wxfontdialogoverview "wxFontDialog overview"
|
||||||
|
|
||||||
|
This class holds a variety of information related to font dialogs.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
Overview, wxFont, wxFontDialog
|
||||||
|
*/
|
||||||
|
class wxFontData : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Initializes @e fontColour to black, @e showHelp to black,
|
||||||
|
@e allowSymbols to @true, @e enableEffects to @true,
|
||||||
|
@e minSize to 0 and @e maxSize to 0.
|
||||||
|
*/
|
||||||
|
wxFontData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables 'effects' under MS Windows or generic only. This refers to
|
||||||
|
the
|
||||||
|
controls for manipulating colour, strikeout and underline properties.
|
||||||
|
|
||||||
|
The default value is @true.
|
||||||
|
*/
|
||||||
|
void EnableEffects(bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Under MS Windows, returns a flag determining whether symbol fonts can be
|
||||||
|
selected. Has no
|
||||||
|
effect on other platforms.
|
||||||
|
|
||||||
|
The default value is @true.
|
||||||
|
*/
|
||||||
|
bool GetAllowSymbols();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the font chosen by the user if the user pressed OK
|
||||||
|
(wxFontDialog::ShowModal returned wxID_OK).
|
||||||
|
*/
|
||||||
|
wxFont GetChosenFont();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the colour associated with the font dialog.
|
||||||
|
|
||||||
|
The default value is black.
|
||||||
|
*/
|
||||||
|
wxColour GetColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines whether 'effects' are enabled under Windows. This refers to the
|
||||||
|
controls for manipulating colour, strikeout and underline properties.
|
||||||
|
|
||||||
|
The default value is @true.
|
||||||
|
*/
|
||||||
|
bool GetEnableEffects();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the font that will be initially used by the font dialog. This should have
|
||||||
|
previously been set by the application.
|
||||||
|
*/
|
||||||
|
wxFont GetInitialFont();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the Help button will be shown (Windows only).
|
||||||
|
|
||||||
|
The default value is @false.
|
||||||
|
*/
|
||||||
|
bool GetShowHelp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Under MS Windows, determines whether symbol fonts can be selected. Has no
|
||||||
|
effect on other platforms.
|
||||||
|
|
||||||
|
The default value is @true.
|
||||||
|
*/
|
||||||
|
void SetAllowSymbols(bool allowSymbols);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font that will be returned to the user (for internal use only).
|
||||||
|
*/
|
||||||
|
void SetChosenFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the colour that will be used for the font foreground colour.
|
||||||
|
|
||||||
|
The default colour is black.
|
||||||
|
*/
|
||||||
|
void SetColour(const wxColour& colour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font that will be initially used by the font dialog.
|
||||||
|
*/
|
||||||
|
void SetInitialFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the valid range for the font point size (Windows only).
|
||||||
|
|
||||||
|
The default is 0, 0 (unrestricted range).
|
||||||
|
*/
|
||||||
|
void SetRange(int min, int max);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines whether the Help button will be displayed in the font dialog
|
||||||
|
(Windows only).
|
||||||
|
|
||||||
|
The default value is @false.
|
||||||
|
*/
|
||||||
|
void SetShowHelp(bool showHelp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assignment operator for the font data.
|
||||||
|
*/
|
||||||
|
void operator =(const wxFontData& data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxPageSetupDialogData
|
||||||
|
@wxheader{cmndata.h}
|
||||||
|
|
||||||
|
This class holds a variety of information related to wxPageSetupDialog.
|
||||||
|
|
||||||
|
It contains a wxPrintData member which is used to hold basic printer
|
||||||
|
configuration data (as opposed to the
|
||||||
|
user-interface configuration settings stored by wxPageSetupDialogData).
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{printing}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_printingoverview "Printing framework overview", wxPageSetupDialog
|
||||||
|
*/
|
||||||
|
class wxPageSetupDialogData : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Construct an object from a print data object.
|
||||||
|
*/
|
||||||
|
wxPageSetupDialogData();
|
||||||
|
wxPageSetupDialogData(wxPageSetupDialogData& data);
|
||||||
|
wxPageSetupDialogData(wxPrintData& printData);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxPageSetupDialogData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables the 'Help' button (Windows only).
|
||||||
|
*/
|
||||||
|
void EnableHelp(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables the margin controls (Windows only).
|
||||||
|
*/
|
||||||
|
void EnableMargins(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables the orientation control (Windows only).
|
||||||
|
*/
|
||||||
|
void EnableOrientation(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables the paper size control (Windows only).
|
||||||
|
*/
|
||||||
|
void EnablePaper(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables the @b Printer button, which invokes a printer setup dialog.
|
||||||
|
*/
|
||||||
|
void EnablePrinter(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the dialog will simply return default printer information (such
|
||||||
|
as orientation)
|
||||||
|
instead of showing a dialog. Windows only.
|
||||||
|
*/
|
||||||
|
bool GetDefaultInfo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the page setup dialog will take its minimum margin values from
|
||||||
|
the currently
|
||||||
|
selected printer properties. Windows only.
|
||||||
|
*/
|
||||||
|
bool GetDefaultMinMargins();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the printer setup button is enabled.
|
||||||
|
*/
|
||||||
|
bool GetEnableHelp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the margin controls are enabled (Windows only).
|
||||||
|
*/
|
||||||
|
bool GetEnableMargins();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the orientation control is enabled (Windows only).
|
||||||
|
*/
|
||||||
|
bool GetEnableOrientation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the paper size control is enabled (Windows only).
|
||||||
|
*/
|
||||||
|
bool GetEnablePaper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the printer setup button is enabled.
|
||||||
|
*/
|
||||||
|
bool GetEnablePrinter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the right (x) and bottom (y) margins in millimetres.
|
||||||
|
*/
|
||||||
|
wxPoint GetMarginBottomRight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the left (x) and top (y) margins in millimetres.
|
||||||
|
*/
|
||||||
|
wxPoint GetMarginTopLeft();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the right (x) and bottom (y) minimum margins the user can enter
|
||||||
|
(Windows only). Units
|
||||||
|
are in millimetres
|
||||||
|
*/
|
||||||
|
wxPoint GetMinMarginBottomRight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the left (x) and top (y) minimum margins the user can enter (Windows
|
||||||
|
only). Units
|
||||||
|
are in millimetres
|
||||||
|
*/
|
||||||
|
wxPoint GetMinMarginTopLeft();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the paper id (stored in the internal wxPrintData object).
|
||||||
|
|
||||||
|
For further information, see wxPrintData::SetPaperId.
|
||||||
|
*/
|
||||||
|
wxPaperSize GetPaperId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the paper size in millimetres.
|
||||||
|
*/
|
||||||
|
wxSize GetPaperSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a reference to the @ref overview_wxprintdata "print data" associated
|
||||||
|
with this object.
|
||||||
|
*/
|
||||||
|
wxPrintData GetPrintData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the print data associated with the dialog data is valid.
|
||||||
|
This can return @false on Windows if the current printer is not set, for example.
|
||||||
|
On all other platforms, it returns @true.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pass @true if the dialog will simply return default printer information (such as
|
||||||
|
orientation)
|
||||||
|
instead of showing a dialog. Windows only.
|
||||||
|
*/
|
||||||
|
void SetDefaultInfo(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pass @true if the page setup dialog will take its minimum margin values from the
|
||||||
|
currently
|
||||||
|
selected printer properties. Windows only. Units are in millimetres
|
||||||
|
*/
|
||||||
|
void SetDefaultMinMargins(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the right (x) and bottom (y) margins in millimetres.
|
||||||
|
*/
|
||||||
|
void SetMarginBottomRight(const wxPoint& pt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the left (x) and top (y) margins in millimetres.
|
||||||
|
*/
|
||||||
|
void SetMarginTopLeft(const wxPoint& pt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the right (x) and bottom (y) minimum margins the user can enter (Windows
|
||||||
|
only). Units are
|
||||||
|
in millimetres.
|
||||||
|
*/
|
||||||
|
void SetMinMarginBottomRight(const wxPoint& pt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the left (x) and top (y) minimum margins the user can enter (Windows
|
||||||
|
only). Units are
|
||||||
|
in millimetres.
|
||||||
|
*/
|
||||||
|
void SetMinMarginTopLeft(const wxPoint& pt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the paper size id. For further information, see wxPrintData::SetPaperId.
|
||||||
|
|
||||||
|
Calling this function overrides the explicit paper dimensions passed in
|
||||||
|
SetPaperSize().
|
||||||
|
*/
|
||||||
|
void SetPaperId(wxPaperSize& id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the paper size in millimetres. If a corresponding paper id is found, it
|
||||||
|
will be set in the
|
||||||
|
internal wxPrintData object, otherwise the paper size overrides the paper id.
|
||||||
|
*/
|
||||||
|
void SetPaperSize(const wxSize& size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the @ref overview_wxprintdata "print data" associated with this object.
|
||||||
|
*/
|
||||||
|
void SetPrintData(const wxPrintData& printData);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Assigns page setup data to this object.
|
||||||
|
*/
|
||||||
|
void operator =(const wxPrintData& data);
|
||||||
|
void operator =(const wxPageSetupDialogData& data);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxColourData
|
||||||
|
@wxheader{cmndata.h}
|
||||||
|
|
||||||
|
This class holds a variety of information related to colour dialogs.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxColour, wxColourDialog, @ref overview_wxcolourdialogoverview "wxColourDialog
|
||||||
|
overview"
|
||||||
|
*/
|
||||||
|
class wxColourData : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Initializes the custom colours to @c wxNullColour,
|
||||||
|
the @e data colour setting
|
||||||
|
to black, and the @e choose full setting to @true.
|
||||||
|
*/
|
||||||
|
wxColourData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxColourData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Under Windows, determines whether the Windows colour dialog will display the
|
||||||
|
full dialog
|
||||||
|
with custom colour selection controls. Under PalmOS, determines whether colour
|
||||||
|
dialog
|
||||||
|
will display full rgb colour picker or only available palette indexer.
|
||||||
|
Has no meaning under other platforms.
|
||||||
|
|
||||||
|
The default value is @true.
|
||||||
|
*/
|
||||||
|
bool GetChooseFull();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the current colour associated with the colour dialog.
|
||||||
|
|
||||||
|
The default colour is black.
|
||||||
|
*/
|
||||||
|
wxColour GetColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the @e ith custom colour associated with the colour dialog. @e i should
|
||||||
|
be an integer between 0 and 15.
|
||||||
|
|
||||||
|
The default custom colours are invalid colours.
|
||||||
|
*/
|
||||||
|
wxColour GetCustomColour(int i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Under Windows, tells the Windows colour dialog to display the full dialog
|
||||||
|
with custom colour selection controls. Under other platforms, has no effect.
|
||||||
|
|
||||||
|
The default value is @true.
|
||||||
|
*/
|
||||||
|
void SetChooseFull(const bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the default colour for the colour dialog.
|
||||||
|
|
||||||
|
The default colour is black.
|
||||||
|
*/
|
||||||
|
void SetColour(const wxColour& colour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the @e ith custom colour for the colour dialog. @e i should
|
||||||
|
be an integer between 0 and 15.
|
||||||
|
|
||||||
|
The default custom colours are invalid colours.
|
||||||
|
*/
|
||||||
|
void SetCustomColour(int i, const wxColour& colour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assignment operator for the colour data.
|
||||||
|
*/
|
||||||
|
void operator =(const wxColourData& data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxPrintData
|
||||||
|
@wxheader{cmndata.h}
|
||||||
|
|
||||||
|
This class holds a variety of information related to printers and
|
||||||
|
printer device contexts. This class is used to create a wxPrinterDC
|
||||||
|
and a wxPostScriptDC. It is also used as a data member of wxPrintDialogData
|
||||||
|
and wxPageSetupDialogData, as part of the mechanism for transferring data
|
||||||
|
between the print dialogs and the application.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{printing}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_printingoverview "Printing framework overview", wxPrintDialog,
|
||||||
|
wxPageSetupDialog, wxPrintDialogData, wxPageSetupDialogData, @ref overview_wxprintdialogoverview "wxPrintDialog Overview", wxPrinterDC, wxPostScriptDC
|
||||||
|
*/
|
||||||
|
class wxPrintData : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Copy constructor.
|
||||||
|
*/
|
||||||
|
wxPrintData();
|
||||||
|
wxPrintData(const wxPrintData& data);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxPrintData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current bin (papersource). By default, the system is left to select
|
||||||
|
the bin (@c wxPRINTBIN_DEFAULT is returned).
|
||||||
|
|
||||||
|
See SetBin() for the full list of bin values.
|
||||||
|
*/
|
||||||
|
wxPrintBin GetBin();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if collation is on.
|
||||||
|
*/
|
||||||
|
bool GetCollate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if colour printing is on.
|
||||||
|
*/
|
||||||
|
bool GetColour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
|
||||||
|
wxDUPLEX_VERTICAL.
|
||||||
|
*/
|
||||||
|
wxDuplexMode GetDuplex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of copies requested by the user.
|
||||||
|
*/
|
||||||
|
int GetNoCopies();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
|
||||||
|
*/
|
||||||
|
int GetOrientation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the paper size id. For more information, see SetPaperId().
|
||||||
|
*/
|
||||||
|
wxPaperSize GetPaperId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the printer name. If the printer name is the empty string, it indicates
|
||||||
|
that the default
|
||||||
|
printer should be used.
|
||||||
|
*/
|
||||||
|
const wxString GetPrinterName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current print quality. This can be a positive integer, denoting the
|
||||||
|
number of dots per inch, or
|
||||||
|
one of the following identifiers:
|
||||||
|
On input you should pass one of these identifiers, but on return you may get
|
||||||
|
back a positive integer
|
||||||
|
indicating the current resolution setting.
|
||||||
|
*/
|
||||||
|
wxPrintQuality GetQuality();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the print data is valid for using in print dialogs.
|
||||||
|
This can return @false on Windows if the current printer is not set, for example.
|
||||||
|
On all other platforms, it returns @true.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current bin. Possible values are:
|
||||||
|
*/
|
||||||
|
void SetBin(wxPrintBin flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets collation to on or off.
|
||||||
|
*/
|
||||||
|
void SetCollate(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets colour printing on or off.
|
||||||
|
*/
|
||||||
|
void SetColour(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
|
||||||
|
wxDUPLEX_VERTICAL.
|
||||||
|
*/
|
||||||
|
void SetDuplex(wxDuplexMode mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the default number of copies to be printed out.
|
||||||
|
*/
|
||||||
|
void SetNoCopies(int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
|
||||||
|
*/
|
||||||
|
void SetOrientation(int orientation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the paper id. This indicates the type of paper to be used. For a mapping
|
||||||
|
between
|
||||||
|
paper id, paper size and string name, see wxPrintPaperDatabase in @c paper.h
|
||||||
|
(not yet documented).
|
||||||
|
|
||||||
|
@e paperId can be one of:
|
||||||
|
*/
|
||||||
|
void SetPaperId(wxPaperSize paperId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the printer name. This can be the empty string to indicate that the default
|
||||||
|
printer should be used.
|
||||||
|
*/
|
||||||
|
void SetPrinterName(const wxString& printerName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the desired print quality. This can be a positive integer, denoting the
|
||||||
|
number of dots per inch, or
|
||||||
|
one of the following identifiers:
|
||||||
|
On input you should pass one of these identifiers, but on return you may get
|
||||||
|
back a positive integer
|
||||||
|
indicating the current resolution setting.
|
||||||
|
*/
|
||||||
|
void SetQuality(wxPrintQuality quality);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Assigns print setup data to this object. wxPrintSetupData is deprecated,
|
||||||
|
but retained for backward compatibility.
|
||||||
|
*/
|
||||||
|
void operator =(const wxPrintData& data);
|
||||||
|
void operator =(const wxPrintSetupData& data);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxPrintDialogData
|
||||||
|
@wxheader{cmndata.h}
|
||||||
|
|
||||||
|
This class holds information related to the visual characteristics of
|
||||||
|
wxPrintDialog.
|
||||||
|
It contains a wxPrintData object with underlying printing settings.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{printing}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_printingoverview "Printing framework overview", wxPrintDialog,
|
||||||
|
@ref overview_wxprintdialogoverview "wxPrintDialog Overview"
|
||||||
|
*/
|
||||||
|
class wxPrintDialogData : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Construct an object from a print dialog data object.
|
||||||
|
*/
|
||||||
|
wxPrintDialogData();
|
||||||
|
wxPrintDialogData(wxPrintDialogData& dialogData);
|
||||||
|
wxPrintDialogData(wxPrintData& printData);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxPrintDialogData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables the 'Help' button.
|
||||||
|
*/
|
||||||
|
void EnableHelp(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables the 'Page numbers' controls.
|
||||||
|
*/
|
||||||
|
void EnablePageNumbers(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables the 'Print to file' checkbox.
|
||||||
|
*/
|
||||||
|
void EnablePrintToFile(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables the 'Selection' radio button.
|
||||||
|
*/
|
||||||
|
void EnableSelection(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the user requested that all pages be printed.
|
||||||
|
*/
|
||||||
|
bool GetAllPages();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the user requested that the document(s) be collated.
|
||||||
|
*/
|
||||||
|
bool GetCollate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the @e from page number, as entered by the user.
|
||||||
|
*/
|
||||||
|
int GetFromPage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the @e maximum page number.
|
||||||
|
*/
|
||||||
|
int GetMaxPage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the @e minimum page number.
|
||||||
|
*/
|
||||||
|
int GetMinPage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of copies requested by the user.
|
||||||
|
*/
|
||||||
|
int GetNoCopies();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a reference to the internal wxPrintData object.
|
||||||
|
*/
|
||||||
|
wxPrintData GetPrintData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the user has selected printing to a file.
|
||||||
|
*/
|
||||||
|
bool GetPrintToFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the user requested that the selection be printed (where
|
||||||
|
'selection' is
|
||||||
|
a concept specific to the application).
|
||||||
|
*/
|
||||||
|
bool GetSelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the @e to page number, as entered by the user.
|
||||||
|
*/
|
||||||
|
int GetToPage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the print data is valid for using in print dialogs.
|
||||||
|
This can return @false on Windows if the current printer is not set, for example.
|
||||||
|
On all other platforms, it returns @true.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the 'Collate' checkbox to @true or @false.
|
||||||
|
*/
|
||||||
|
void SetCollate(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the @e from page number.
|
||||||
|
*/
|
||||||
|
void SetFromPage(int page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the @e maximum page number.
|
||||||
|
*/
|
||||||
|
void SetMaxPage(int page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the @e minimum page number.
|
||||||
|
*/
|
||||||
|
void SetMinPage(int page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the default number of copies the user has requested to be printed out.
|
||||||
|
*/
|
||||||
|
void SetNoCopies(int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the internal wxPrintData.
|
||||||
|
*/
|
||||||
|
void SetPrintData(const wxPrintData& printData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the 'Print to file' checkbox to @true or @false.
|
||||||
|
*/
|
||||||
|
void SetPrintToFile(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Selects the 'Selection' radio button. The effect of printing the selection
|
||||||
|
depends on how the application
|
||||||
|
implements this command, if at all.
|
||||||
|
*/
|
||||||
|
void SetSelection(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines whether the dialog to be shown will be the Print dialog
|
||||||
|
(pass @false) or Print Setup dialog (pass @true).
|
||||||
|
|
||||||
|
This function has been deprecated since version 2.5.4.
|
||||||
|
*/
|
||||||
|
void SetSetupDialog(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the @e to page number.
|
||||||
|
*/
|
||||||
|
void SetToPage(int page);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Assigns another print dialog data object to this object.
|
||||||
|
*/
|
||||||
|
void operator =(const wxPrintData& data);
|
||||||
|
void operator =(const wxPrintDialogData& data);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
179
interface/collpane.h
Normal file
179
interface/collpane.h
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: collpane.h
|
||||||
|
// Purpose: documentation for wxCollapsiblePaneEvent class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCollapsiblePaneEvent
|
||||||
|
@wxheader{collpane.h}
|
||||||
|
|
||||||
|
This event class is used for the events generated by
|
||||||
|
wxCollapsiblePane.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxCollapsiblePane
|
||||||
|
*/
|
||||||
|
class wxCollapsiblePaneEvent : public wxCommandEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
The constructor is not normally used by the user code.
|
||||||
|
*/
|
||||||
|
wxCollapsiblePaneEvent(wxObject * generator, int id,
|
||||||
|
bool collapsed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the pane has been collapsed.
|
||||||
|
*/
|
||||||
|
bool GetCollapsed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets this as a collapsed pane event (if @e collapsed is @true) or as an
|
||||||
|
expanded
|
||||||
|
pane event (if @e collapsed is @false).
|
||||||
|
*/
|
||||||
|
void SetCollapsed(bool collapsed);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCollapsiblePane
|
||||||
|
@wxheader{collpane.h}
|
||||||
|
|
||||||
|
A collapsible pane is a container with an embedded button-like control which
|
||||||
|
can be
|
||||||
|
used by the user to collapse or expand the pane's contents.
|
||||||
|
|
||||||
|
Once constructed you should use the wxCollapsiblePane::GetPane
|
||||||
|
function to access the pane and add your controls inside it (i.e. use the
|
||||||
|
wxCollapsiblePane::GetPane's returned pointer as parent for the
|
||||||
|
controls which must go in the pane, NOT the wxCollapsiblePane itself!).
|
||||||
|
|
||||||
|
Note that because of its nature of control which can dynamically (and
|
||||||
|
drastically)
|
||||||
|
change its size at run-time under user-input, when putting wxCollapsiblePane
|
||||||
|
inside
|
||||||
|
a wxSizer you should be careful to add it with a proportion value
|
||||||
|
of zero; this is because otherwise all other windows with non-null proportion
|
||||||
|
values
|
||||||
|
would automatically get resized each time the user expands or collapse the pane
|
||||||
|
window
|
||||||
|
resulting usually in a weird, flickering effect.
|
||||||
|
|
||||||
|
Usage sample:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY,
|
||||||
|
wxT("Details:"));
|
||||||
|
|
||||||
|
// add the pane with a zero proportion value to the 'sz' sizer which
|
||||||
|
contains it
|
||||||
|
sz-Add(collpane, 0, wxGROW|wxALL, 5);
|
||||||
|
|
||||||
|
// now add a test label in the collapsible pane using a sizer to layout it:
|
||||||
|
wxWindow *win = collpane-GetPane();
|
||||||
|
wxSizer *paneSz = new wxBoxSizer(wxVERTICAL);
|
||||||
|
paneSz-Add(new wxStaticText(win, wxID_ANY, wxT("test!")), 1, wxGROW|wxALL,
|
||||||
|
2);
|
||||||
|
win-SetSizer(paneSz);
|
||||||
|
paneSz-SetSizeHints(win);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
It is only available if @c wxUSE_COLLPANE is set to 1 (the default).
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCP_DEFAULT_STYLE}:
|
||||||
|
The default style: 0.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{collapsiblepane.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxPanel, wxCollapsiblePaneEvent
|
||||||
|
*/
|
||||||
|
class wxCollapsiblePane : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Initializes the object and calls Create() with
|
||||||
|
all the parameters.
|
||||||
|
*/
|
||||||
|
wxCollapsiblePane(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxCP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "collapsiblePane");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Collapses or expands the pane window.
|
||||||
|
*/
|
||||||
|
void Collapse(bool collapse = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param parent
|
||||||
|
Parent window, must not be non-@NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The identifier for the control.
|
||||||
|
|
||||||
|
@param label
|
||||||
|
The initial label shown in the button which allows the user to expand or
|
||||||
|
collapse the pane window.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Initial position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Initial size.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style, see wxCP_* flags.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Validator which can be used for additional date checks.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Control name.
|
||||||
|
|
||||||
|
@returns @true if the control was successfully created or @false if
|
||||||
|
creation failed.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxCP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "collapsiblePane");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Same as @c wxCollapsiblePane::Collapse(@false).
|
||||||
|
*/
|
||||||
|
void Expand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the pane window. Add controls to the returned wxWindow
|
||||||
|
to make them collapsible.
|
||||||
|
*/
|
||||||
|
wxWindow * GetPane();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the pane window is currently hidden.
|
||||||
|
*/
|
||||||
|
bool IsCollapsed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the pane window is currently shown.
|
||||||
|
*/
|
||||||
|
bool IsExpanded();
|
||||||
|
};
|
||||||
88
interface/colordlg.h
Normal file
88
interface/colordlg.h
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: colordlg.h
|
||||||
|
// Purpose: documentation for wxColourDialog class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxColourDialog
|
||||||
|
@wxheader{colordlg.h}
|
||||||
|
|
||||||
|
This class represents the colour chooser dialog.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{cmndlg}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxcolourdialogoverview "wxColourDialog Overview", wxColour,
|
||||||
|
wxColourData, wxGetColourFromUser
|
||||||
|
*/
|
||||||
|
class wxColourDialog : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Pass a parent window, and optionally a pointer to a block of colour
|
||||||
|
data, which will be copied to the colour dialog's colour data. Custom
|
||||||
|
colours from colour data object will be be used in dialog's colour palette.
|
||||||
|
Invalid entries in custom colours list will be ignored on some platforms (GTK)
|
||||||
|
or replaced with white colour on platforms where custom colours palette has
|
||||||
|
fixed size (MSW).
|
||||||
|
|
||||||
|
@sa wxColourData
|
||||||
|
*/
|
||||||
|
wxColourDialog(wxWindow* parent, wxColourData* data = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxColourDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Same as @ref ctor() constructor.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxColourData* data = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the @ref overview_wxcolourdata "colour data" associated with the colour
|
||||||
|
dialog.
|
||||||
|
*/
|
||||||
|
wxColourData GetColourData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL
|
||||||
|
otherwise.
|
||||||
|
*/
|
||||||
|
int ShowModal();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the colour selection dialog and returns the colour selected by user or
|
||||||
|
invalid colour (use @ref wxColour::isok wxColour:IsOk to test whether a colour
|
||||||
|
is valid) if the dialog was cancelled.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
The parent window for the colour selection dialog
|
||||||
|
|
||||||
|
@param colInit
|
||||||
|
If given, this will be the colour initially selected in the dialog.
|
||||||
|
|
||||||
|
@param caption
|
||||||
|
If given, this will be used for the dialog caption.
|
||||||
|
|
||||||
|
@param data
|
||||||
|
Optional object storing additional colour dialog settings, such
|
||||||
|
as custom colours. If none is provided the same settings as the last time are
|
||||||
|
used.
|
||||||
|
*/
|
||||||
|
wxColour wxGetColourFromUser(wxWindow * parent,
|
||||||
|
const wxColour& colInit,
|
||||||
|
const wxString& caption = wxEmptyString,
|
||||||
|
wxColourData * data = @NULL);
|
||||||
|
|
||||||
180
interface/colour.h
Normal file
180
interface/colour.h
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: colour.h
|
||||||
|
// Purpose: documentation for wxColour class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxColour
|
||||||
|
@wxheader{colour.h}
|
||||||
|
|
||||||
|
A colour is an object representing a combination of Red, Green, and Blue (RGB)
|
||||||
|
intensity values,
|
||||||
|
and is used to determine drawing colours. See the
|
||||||
|
entry for wxColourDatabase for how a pointer to a predefined,
|
||||||
|
named colour may be returned instead of creating a new colour.
|
||||||
|
|
||||||
|
Valid RGB values are in the range 0 to 255.
|
||||||
|
|
||||||
|
You can retrieve the current system colour settings with wxSystemSettings.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{gdi}
|
||||||
|
|
||||||
|
@stdobjects
|
||||||
|
Objects:
|
||||||
|
wxNullColour
|
||||||
|
Pointers:
|
||||||
|
wxBLACK
|
||||||
|
|
||||||
|
wxWHITE
|
||||||
|
|
||||||
|
wxRED
|
||||||
|
|
||||||
|
wxBLUE
|
||||||
|
|
||||||
|
wxGREEN
|
||||||
|
|
||||||
|
wxCYAN
|
||||||
|
|
||||||
|
wxLIGHT_GREY
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxColourDatabase, wxPen, wxBrush, wxColourDialog, wxSystemSettings
|
||||||
|
*/
|
||||||
|
class wxColour : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Copy constructor.
|
||||||
|
|
||||||
|
@param red
|
||||||
|
The red value.
|
||||||
|
|
||||||
|
@param green
|
||||||
|
The green value.
|
||||||
|
|
||||||
|
@param blue
|
||||||
|
The blue value.
|
||||||
|
|
||||||
|
@param alpha
|
||||||
|
The alpha value. Alpha values range from 0 (wxALPHA_TRANSPARENT) to 255
|
||||||
|
(wxALPHA_OPAQUE).
|
||||||
|
|
||||||
|
@param colourName
|
||||||
|
The colour name.
|
||||||
|
|
||||||
|
@param colour
|
||||||
|
The colour to copy.
|
||||||
|
|
||||||
|
@sa wxColourDatabase
|
||||||
|
*/
|
||||||
|
wxColour();
|
||||||
|
wxColour(unsigned char red, unsigned char green,
|
||||||
|
unsigned char blue,
|
||||||
|
unsigned char alpha=wxALPHA_OPAQUE);
|
||||||
|
wxColour(const wxString& colourNname);
|
||||||
|
wxColour(const wxColour& colour);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the alpha value, on platforms where alpha is not yet supported, this
|
||||||
|
always returns wxALPHA_OPAQUE.
|
||||||
|
*/
|
||||||
|
unsigned char Alpha();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the blue intensity.
|
||||||
|
*/
|
||||||
|
unsigned char Blue();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
is not
|
||||||
|
specified in flags.
|
||||||
|
|
||||||
|
This function is new since wxWidgets version 2.7.0
|
||||||
|
*/
|
||||||
|
wxString GetAsString(long flags);
|
||||||
|
wxC2S_NAME wxC2S_CSS_SYNTAX, to obtain
|
||||||
|
the colour in the "rgb(r,g,b)" or "rgba(r,g,b,a)" syntax
|
||||||
|
(e.g. wxColour(255,0,0,85) - "rgba(255,0,0,0.333)"), and
|
||||||
|
wxC2S_HTML_SYNTAX, to obtain the colour as "#" followed
|
||||||
|
by 6 hexadecimal digits (e.g. wxColour(255,0,0) - "#FF0000").
|
||||||
|
This function never fails and always returns a non-empty string but asserts if
|
||||||
|
the colour has alpha channel (i.e. is non opaque) but
|
||||||
|
wxC2S_CSS_SYNTAX();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pixel value which is platform-dependent. On Windows, a COLORREF is
|
||||||
|
returned.
|
||||||
|
On X, an allocated pixel value is returned.
|
||||||
|
|
||||||
|
-1 is returned if the pixel is invalid (on X, unallocated).
|
||||||
|
*/
|
||||||
|
long GetPixel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the green intensity.
|
||||||
|
*/
|
||||||
|
unsigned char Green();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the colour object is valid (the colour has been initialised
|
||||||
|
with RGB values).
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the red intensity.
|
||||||
|
*/
|
||||||
|
#define unsigned char Red() /* implementation is private */
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Sets the RGB intensity values using the given values (first overload),
|
||||||
|
extracting them from the packed long (second overload), using the given string (third overloard).
|
||||||
|
|
||||||
|
When using third form, Set() accepts: colour names (those listed in
|
||||||
|
wxTheColourDatabase), the CSS-like
|
||||||
|
@c "rgb(r,g,b)" or @c "rgba(r,g,b,a)" syntax (case insensitive)
|
||||||
|
and the HTML-like syntax (i.e. @c "#" followed by 6 hexadecimal digits
|
||||||
|
for red, green, blue components).
|
||||||
|
|
||||||
|
Returns @true if the conversion was successful, @false otherwise.
|
||||||
|
|
||||||
|
This function is new since wxWidgets version 2.7.0
|
||||||
|
*/
|
||||||
|
void Set(unsigned char red, unsigned char green,
|
||||||
|
unsigned char blue,
|
||||||
|
unsigned char alpha=wxALPHA_OPAQUE);
|
||||||
|
void Set(unsigned long RGB);
|
||||||
|
bool Set(const wxString & str);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tests the inequality of two colours by comparing individual red, green, blue
|
||||||
|
colours and alpha values.
|
||||||
|
*/
|
||||||
|
bool operator !=(const wxColour& colour);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Assignment operator, using a colour name to be found in the colour database.
|
||||||
|
|
||||||
|
@sa wxColourDatabase
|
||||||
|
*/
|
||||||
|
wxColour operator =(const wxColour& colour);
|
||||||
|
wxColour operator =(const wxString& colourName);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tests the equality of two colours by comparing individual red, green, blue
|
||||||
|
colours and alpha values.
|
||||||
|
*/
|
||||||
|
bool operator ==(const wxColour& colour);
|
||||||
|
};
|
||||||
658
interface/combo.h
Normal file
658
interface/combo.h
Normal file
@@ -0,0 +1,658 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: combo.h
|
||||||
|
// Purpose: documentation for wxComboPopup class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxComboPopup
|
||||||
|
@wxheader{combo.h}
|
||||||
|
|
||||||
|
In order to use a custom popup with wxComboCtrl,
|
||||||
|
an interface class must be derived from wxComboPopup. For more information
|
||||||
|
how to use it, see @ref overview_wxcomboctrl "Setting Custom Popup for
|
||||||
|
wxComboCtrl".
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxComboCtrl
|
||||||
|
*/
|
||||||
|
class wxComboPopup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Default constructor. It is recommended that internal variables
|
||||||
|
are prepared in Init() instead
|
||||||
|
(because @ref mcombo() m_combo is not valid in constructor).
|
||||||
|
*/
|
||||||
|
wxComboPopup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class must implement this to create the popup control.
|
||||||
|
|
||||||
|
@returns @true if the call succeeded, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Utility function that hides the popup.
|
||||||
|
*/
|
||||||
|
void Dismiss();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class may implement this to return adjusted size
|
||||||
|
for the popup control, according to the variables given.
|
||||||
|
|
||||||
|
@param minWidth
|
||||||
|
Preferred minimum width.
|
||||||
|
|
||||||
|
@param prefHeight
|
||||||
|
Preferred height. May be -1 to indicate
|
||||||
|
no preference.
|
||||||
|
|
||||||
|
@param maxWidth
|
||||||
|
Max height for window, as limited by
|
||||||
|
screen size.
|
||||||
|
|
||||||
|
@remarks Called each time popup is about to be shown.
|
||||||
|
*/
|
||||||
|
wxSize GetAdjustedSize(int minWidth, int prefHeight,
|
||||||
|
int maxHeight);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class must implement this to return pointer
|
||||||
|
to the associated control created in Create().
|
||||||
|
*/
|
||||||
|
wxWindow* GetControl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class must implement this to return
|
||||||
|
string representation of the value.
|
||||||
|
*/
|
||||||
|
wxString GetStringValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class must implement this to initialize
|
||||||
|
its internal variables. This method is called immediately
|
||||||
|
after construction finishes. @ref mcombo() m_combo
|
||||||
|
member variable has been initialized before the call.
|
||||||
|
*/
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Utility method that returns @true if Create has been called.
|
||||||
|
|
||||||
|
Useful in conjunction with LazyCreate().
|
||||||
|
*/
|
||||||
|
bool IsCreated();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class may implement this to return
|
||||||
|
@true if it wants to delay call to Create()
|
||||||
|
until the popup is shown for the first time. It is more
|
||||||
|
efficient, but on the other hand it is often more convenient
|
||||||
|
to have the control created immediately.
|
||||||
|
|
||||||
|
@remarks Base implementation returns @false.
|
||||||
|
*/
|
||||||
|
bool LazyCreate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class may implement this to do something
|
||||||
|
when the parent wxComboCtrl gets double-clicked.
|
||||||
|
*/
|
||||||
|
void OnComboDoubleClick();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class may implement this to receive
|
||||||
|
key events from the parent wxComboCtrl.
|
||||||
|
|
||||||
|
Events not handled should be skipped, as usual.
|
||||||
|
*/
|
||||||
|
void OnComboKeyEvent(wxKeyEvent& event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class may implement this to do
|
||||||
|
special processing when popup is hidden.
|
||||||
|
*/
|
||||||
|
void OnDismiss();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class may implement this to do
|
||||||
|
special processing when popup is shown.
|
||||||
|
*/
|
||||||
|
void OnPopup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class may implement this to paint
|
||||||
|
the parent wxComboCtrl.
|
||||||
|
|
||||||
|
Default implementation draws value as string.
|
||||||
|
*/
|
||||||
|
void PaintComboControl(wxDC& dc, const wxRect& rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The derived class must implement this to receive
|
||||||
|
string value changes from wxComboCtrl.
|
||||||
|
*/
|
||||||
|
void SetStringValue(const wxString& value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
wxComboCtrl m_combo
|
||||||
|
|
||||||
|
Parent wxComboCtrl. This is parameter has
|
||||||
|
been prepared before Init() is called.
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxComboCtrl
|
||||||
|
@wxheader{combo.h}
|
||||||
|
|
||||||
|
A combo control is a generic combobox that allows totally
|
||||||
|
custom popup. In addition it has other customization features.
|
||||||
|
For instance, position and size of the dropdown button
|
||||||
|
can be changed.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCB_READONLY}:
|
||||||
|
Text will not be editable.
|
||||||
|
@style{wxCB_SORT}:
|
||||||
|
Sorts the entries in the list alphabetically.
|
||||||
|
@style{wxTE_PROCESS_ENTER}:
|
||||||
|
The control will generate the event wxEVT_COMMAND_TEXT_ENTER
|
||||||
|
(otherwise pressing Enter key is either processed internally by the
|
||||||
|
control or used for navigation between dialog controls). Windows
|
||||||
|
only.
|
||||||
|
@style{wxCC_SPECIAL_DCLICK}:
|
||||||
|
Double-clicking triggers a call to popup's OnComboDoubleClick.
|
||||||
|
Actual behaviour is defined by a derived class. For instance,
|
||||||
|
wxOwnerDrawnComboBox will cycle an item. This style only applies if
|
||||||
|
wxCB_READONLY is used as well.
|
||||||
|
@style{wxCC_STD_BUTTON}:
|
||||||
|
Drop button will behave more like a standard push button.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@beginEventTable
|
||||||
|
@event{EVT_TEXT(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_TEXT_UPDATED event, when the text changes.
|
||||||
|
@event{EVT_TEXT_ENTER(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_TEXT_ENTER event, when RETURN is pressed in
|
||||||
|
the combo control.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{comboctrl.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxComboPopup, wxCommandEvent
|
||||||
|
*/
|
||||||
|
class wxComboCtrl : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a combo control.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Window identifier. The value wxID_ANY indicates a default value.
|
||||||
|
|
||||||
|
@param value
|
||||||
|
Initial selection string. An empty string indicates no selection.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Window position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Window size. If wxDefaultSize is specified then the window is sized
|
||||||
|
appropriately.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. See wxComboCtrl.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
|
||||||
|
@sa Create(), wxValidator
|
||||||
|
*/
|
||||||
|
wxComboCtrl();
|
||||||
|
wxComboCtrl(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value = "",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboCtrl");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor, destroying the combo control.
|
||||||
|
*/
|
||||||
|
~wxComboCtrl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This member function is not normally called in application code.
|
||||||
|
Instead, it can be implemented in a derived class to create a
|
||||||
|
custom popup animation.
|
||||||
|
|
||||||
|
@returns @true if animation finishes before the function returns. @false
|
||||||
|
otherwise. In the latter case you need to manually
|
||||||
|
call DoShowPopup after the animation ends.
|
||||||
|
*/
|
||||||
|
virtual bool AnimateShow(const wxRect& rect, int flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copies the selected text to the clipboard.
|
||||||
|
*/
|
||||||
|
void Copy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the combo control for two-step construction. Derived classes
|
||||||
|
should call or replace this function. See wxComboCtrl()
|
||||||
|
for further details.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value = "",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboCtrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copies the selected text to the clipboard and removes the selection.
|
||||||
|
*/
|
||||||
|
#define void Cut() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
This member function is not normally called in application code.
|
||||||
|
Instead, it can be implemented in a derived class to return
|
||||||
|
default wxComboPopup, incase @c popup is @NULL.
|
||||||
|
|
||||||
|
@b Note: If you have implemented OnButtonClick to do
|
||||||
|
something else than show the popup, then DoSetPopupControl
|
||||||
|
must always return @NULL.
|
||||||
|
*/
|
||||||
|
void DoSetPopupControl(wxComboPopup* popup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This member function is not normally called in application code.
|
||||||
|
Instead, it must be called in a derived class to make sure popup
|
||||||
|
is properly shown after a popup animation has finished (but only
|
||||||
|
if AnimateShow() did not finish
|
||||||
|
the animation within it's function scope).
|
||||||
|
|
||||||
|
@param rect
|
||||||
|
Position to show the popup window at, in screen coordinates.
|
||||||
|
|
||||||
|
@param flags
|
||||||
|
Combination of any of the following:
|
||||||
|
*/
|
||||||
|
virtual void DoShowPopup(const wxRect& rect, int flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enables or disables popup animation, if any, depending on the value of
|
||||||
|
the argument.
|
||||||
|
*/
|
||||||
|
void EnablePopupAnimation(bool enable = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns disabled button bitmap that has been set with
|
||||||
|
SetButtonBitmaps().
|
||||||
|
|
||||||
|
@returns A reference to the disabled state bitmap.
|
||||||
|
*/
|
||||||
|
const wxBitmap GetBitmapDisabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns button mouse hover bitmap that has been set with
|
||||||
|
SetButtonBitmaps().
|
||||||
|
|
||||||
|
@returns A reference to the mouse hover state bitmap.
|
||||||
|
*/
|
||||||
|
const wxBitmap GetBitmapHover();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns default button bitmap that has been set with
|
||||||
|
SetButtonBitmaps().
|
||||||
|
|
||||||
|
@returns A reference to the normal state bitmap.
|
||||||
|
*/
|
||||||
|
const wxBitmap GetBitmapNormal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns depressed button bitmap that has been set with
|
||||||
|
SetButtonBitmaps().
|
||||||
|
|
||||||
|
@returns A reference to the depressed state bitmap.
|
||||||
|
*/
|
||||||
|
const wxBitmap GetBitmapPressed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns current size of the dropdown button.
|
||||||
|
*/
|
||||||
|
wxSize GetButtonSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns custom painted area in control.
|
||||||
|
|
||||||
|
@sa SetCustomPaintWidth().
|
||||||
|
*/
|
||||||
|
int GetCustomPaintWidth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns features supported by wxComboCtrl. If needed feature is missing,
|
||||||
|
you need to instead use wxGenericComboCtrl, which however may lack
|
||||||
|
native look and feel (but otherwise sports identical API).
|
||||||
|
|
||||||
|
@returns Value returned is a combination of following flags:
|
||||||
|
*/
|
||||||
|
static int GetFeatures();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the insertion point for the combo control's text field.
|
||||||
|
|
||||||
|
@b Note: Under wxMSW, this function always returns 0 if the combo control
|
||||||
|
doesn't have the focus.
|
||||||
|
*/
|
||||||
|
long GetInsertionPoint();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the last position in the combo control text field.
|
||||||
|
*/
|
||||||
|
long GetLastPosition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns current popup interface that has been set with SetPopupControl.
|
||||||
|
*/
|
||||||
|
wxComboPopup* GetPopupControl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns popup window containing the popup control.
|
||||||
|
*/
|
||||||
|
wxWindow* GetPopupWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the text control which is part of the combo control.
|
||||||
|
*/
|
||||||
|
wxTextCtrl* GetTextCtrl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns actual indentation in pixels.
|
||||||
|
*/
|
||||||
|
wxCoord GetTextIndent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns area covered by the text field (includes everything except
|
||||||
|
borders and the dropdown button).
|
||||||
|
*/
|
||||||
|
const wxRect GetTextRect();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns text representation of the current value. For writable
|
||||||
|
combo control it always returns the value in the text field.
|
||||||
|
*/
|
||||||
|
wxString GetValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Dismisses the popup window.
|
||||||
|
*/
|
||||||
|
void HidePopup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the popup is currently shown
|
||||||
|
*/
|
||||||
|
bool IsPopupShown();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the popup window is in the given state.
|
||||||
|
Possible values are:
|
||||||
|
|
||||||
|
|
||||||
|
@c Hidden()
|
||||||
|
|
||||||
|
|
||||||
|
Popup window is hidden.
|
||||||
|
|
||||||
|
@c Animating()
|
||||||
|
|
||||||
|
|
||||||
|
Popup window is being shown, but the
|
||||||
|
popup animation has not yet finished.
|
||||||
|
|
||||||
|
@c Visible()
|
||||||
|
|
||||||
|
|
||||||
|
Popup window is fully visible.
|
||||||
|
*/
|
||||||
|
bool IsPopupWindowState(int state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Implement in a derived class to define what happens on
|
||||||
|
dropdown button click.
|
||||||
|
|
||||||
|
Default action is to show the popup.
|
||||||
|
|
||||||
|
@b Note: If you implement this to do something else than
|
||||||
|
show the popup, you must then also implement
|
||||||
|
DoSetPopupControl() to always
|
||||||
|
return @NULL.
|
||||||
|
*/
|
||||||
|
void OnButtonClick();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pastes text from the clipboard to the text field.
|
||||||
|
*/
|
||||||
|
void Paste();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the text between the two positions in the combo control text field.
|
||||||
|
|
||||||
|
@param from
|
||||||
|
The first position.
|
||||||
|
|
||||||
|
@param to
|
||||||
|
The last position.
|
||||||
|
*/
|
||||||
|
void Remove(long from, long to);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Replaces the text between two positions with the given text, in the combo
|
||||||
|
control text field.
|
||||||
|
|
||||||
|
@param from
|
||||||
|
The first position.
|
||||||
|
|
||||||
|
@param to
|
||||||
|
The second position.
|
||||||
|
|
||||||
|
@param text
|
||||||
|
The text to insert.
|
||||||
|
*/
|
||||||
|
void Replace(long from, long to, const wxString& value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets custom dropdown button graphics.
|
||||||
|
|
||||||
|
@param bmpNormal
|
||||||
|
Default button image.
|
||||||
|
|
||||||
|
@param pushButtonBg
|
||||||
|
If @true, blank push button background is painted
|
||||||
|
below the image.
|
||||||
|
|
||||||
|
@param bmpPressed
|
||||||
|
Depressed button image.
|
||||||
|
|
||||||
|
@param bmpHover
|
||||||
|
Button image when mouse hovers above it. This
|
||||||
|
should be ignored on platforms and themes that do not generally draw
|
||||||
|
different kind of button on mouse hover.
|
||||||
|
|
||||||
|
@param bmpDisabled
|
||||||
|
Disabled button image.
|
||||||
|
*/
|
||||||
|
void SetButtonBitmaps(const wxBitmap& bmpNormal,
|
||||||
|
bool pushButtonBg = @false,
|
||||||
|
const wxBitmap& bmpPressed = wxNullBitmap,
|
||||||
|
const wxBitmap& bmpHover = wxNullBitmap,
|
||||||
|
const wxBitmap& bmpDisabled = wxNullBitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets size and position of dropdown button.
|
||||||
|
|
||||||
|
@param width
|
||||||
|
Button width. Value = 0 specifies default.
|
||||||
|
|
||||||
|
@param height
|
||||||
|
Button height. Value = 0 specifies default.
|
||||||
|
|
||||||
|
@param side
|
||||||
|
Indicates which side the button will be placed.
|
||||||
|
Value can be wxLEFT or wxRIGHT.
|
||||||
|
|
||||||
|
@param spacingX
|
||||||
|
Horizontal spacing around the button. Default is 0.
|
||||||
|
*/
|
||||||
|
void SetButtonPosition(int width = -1, int height = -1,
|
||||||
|
int side = wxRIGHT,
|
||||||
|
int spacingX = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set width, in pixels, of custom painted area in control without @c wxCB_READONLY
|
||||||
|
style. In read-only wxOwnerDrawnComboBox, this is used
|
||||||
|
to indicate area that is not covered by the focus rectangle.
|
||||||
|
*/
|
||||||
|
void SetCustomPaintWidth(int width);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the insertion point in the text field.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
The new insertion point.
|
||||||
|
*/
|
||||||
|
void SetInsertionPoint(long pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the insertion point at the end of the combo control text field.
|
||||||
|
*/
|
||||||
|
void SetInsertionPointEnd();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set side of the control to which the popup will align itself. Valid values are
|
||||||
|
@c wxLEFT, @c wxRIGHT and 0. The default value 0 means that the most appropriate
|
||||||
|
side is used (which, currently, is always @c wxLEFT).
|
||||||
|
*/
|
||||||
|
void SetPopupAnchor(int anchorSide);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set popup interface class derived from wxComboPopup.
|
||||||
|
This method should be called as soon as possible after the control
|
||||||
|
has been created, unless OnButtonClick()
|
||||||
|
has been overridden.
|
||||||
|
*/
|
||||||
|
void SetPopupControl(wxComboPopup* popup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Extends popup size horizontally, relative to the edges of the combo control.
|
||||||
|
|
||||||
|
@param extLeft
|
||||||
|
How many pixel to extend beyond the left edge of the
|
||||||
|
control. Default is 0.
|
||||||
|
|
||||||
|
@param extRight
|
||||||
|
How many pixel to extend beyond the right edge of the
|
||||||
|
control. Default is 0.
|
||||||
|
|
||||||
|
@remarks Popup minimum width may override arguments.
|
||||||
|
*/
|
||||||
|
void SetPopupExtents(int extLeft, int extRight);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets preferred maximum height of the popup.
|
||||||
|
|
||||||
|
@remarks Value -1 indicates the default.
|
||||||
|
*/
|
||||||
|
void SetPopupMaxHeight(int height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets minimum width of the popup. If wider than combo control, it will extend to
|
||||||
|
the left.
|
||||||
|
|
||||||
|
@remarks Value -1 indicates the default.
|
||||||
|
*/
|
||||||
|
void SetPopupMinWidth(int width);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Selects the text between the two positions, in the combo control text field.
|
||||||
|
|
||||||
|
@param from
|
||||||
|
The first position.
|
||||||
|
|
||||||
|
@param to
|
||||||
|
The second position.
|
||||||
|
*/
|
||||||
|
void SetSelection(long from, long to);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the text for the text field without affecting the
|
||||||
|
popup. Thus, unlike SetValue(), it works
|
||||||
|
equally well with combo control using @c wxCB_READONLY style.
|
||||||
|
*/
|
||||||
|
void SetText(const wxString& value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This will set the space in pixels between left edge of the control and the
|
||||||
|
text, regardless whether control is read-only or not. Value -1 can be
|
||||||
|
given to indicate platform default.
|
||||||
|
*/
|
||||||
|
void SetTextIndent(int indent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the text for the combo control text field.
|
||||||
|
|
||||||
|
@b NB: For a combo control with @c wxCB_READONLY style the
|
||||||
|
string must be accepted by the popup (for instance, exist in the dropdown
|
||||||
|
list), otherwise the call to SetValue() is ignored
|
||||||
|
*/
|
||||||
|
void SetValue(const wxString& value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Same as SetValue, but also sends wxCommandEvent of type
|
||||||
|
wxEVT_COMMAND_TEXT_UPDATED
|
||||||
|
if @c withEvent is @true.
|
||||||
|
*/
|
||||||
|
void SetValueWithEvent(const wxString& value,
|
||||||
|
bool withEvent = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Show the popup.
|
||||||
|
*/
|
||||||
|
void ShowPopup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Undoes the last edit in the text field. Windows only.
|
||||||
|
*/
|
||||||
|
void Undo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enable or disable usage of an alternative popup window, which guarantees
|
||||||
|
ability to focus the popup control, and allows common native controls to
|
||||||
|
function normally. This alternative popup window is usually a wxDialog,
|
||||||
|
and as such, when it is shown, its parent top-level window will appear
|
||||||
|
as if the focus has been lost from it.
|
||||||
|
*/
|
||||||
|
void UseAltPopupWindow(bool enable = @true);
|
||||||
|
};
|
||||||
306
interface/combobox.h
Normal file
306
interface/combobox.h
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: combobox.h
|
||||||
|
// Purpose: documentation for wxComboBox class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxComboBox
|
||||||
|
@wxheader{combobox.h}
|
||||||
|
|
||||||
|
A combobox is like a combination of an edit control and a listbox. It can be
|
||||||
|
displayed as static list with editable or read-only text field; or a drop-down
|
||||||
|
list with
|
||||||
|
text field; or a drop-down list without a text field.
|
||||||
|
|
||||||
|
A combobox permits a single selection only. Combobox items are numbered from
|
||||||
|
zero.
|
||||||
|
|
||||||
|
If you need a customized combobox, have a look at wxComboCtrl,
|
||||||
|
wxOwnerDrawnComboBox, wxComboPopup
|
||||||
|
and the ready-to-use wxBitmapComboBox.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCB_SIMPLE}:
|
||||||
|
Creates a combobox with a permanently displayed list. Windows only.
|
||||||
|
@style{wxCB_DROPDOWN}:
|
||||||
|
Creates a combobox with a drop-down list.
|
||||||
|
@style{wxCB_READONLY}:
|
||||||
|
Same as wxCB_DROPDOWN but only the strings specified as the
|
||||||
|
combobox choices can be selected, it is impossible to select (even
|
||||||
|
from a program) a string which is not in the choices list.
|
||||||
|
@style{wxCB_SORT}:
|
||||||
|
Sorts the entries in the list alphabetically.
|
||||||
|
@style{wxTE_PROCESS_ENTER}:
|
||||||
|
The control will generate the event wxEVT_COMMAND_TEXT_ENTER
|
||||||
|
(otherwise pressing Enter key is either processed internally by the
|
||||||
|
control or used for navigation between dialog controls). Windows
|
||||||
|
only.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@beginEventTable
|
||||||
|
@event{EVT_COMBOBOX(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on
|
||||||
|
the list is selected. Note that calling GetValue returns the new
|
||||||
|
value of selection.
|
||||||
|
@event{EVT_TEXT(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_TEXT_UPDATED event, when the combobox text
|
||||||
|
changes.
|
||||||
|
@event{EVT_TEXT_ENTER(id\, func)}:
|
||||||
|
Process a wxEVT_COMMAND_TEXT_ENTER event, when RETURN is pressed in
|
||||||
|
the combobox (notice that the combobox must have been created with
|
||||||
|
wxTE_PROCESS_ENTER style to receive this event).
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{combobox.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxListBox, wxTextCtrl, wxChoice, wxCommandEvent
|
||||||
|
*/
|
||||||
|
class wxComboBox : public wxControlWithItems
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a combobox.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Window identifier. The value wxID_ANY indicates a default value.
|
||||||
|
|
||||||
|
@param value
|
||||||
|
Initial selection string. An empty string indicates no selection.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Window position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Window size. If wxDefaultSize is specified then the window is sized
|
||||||
|
appropriately.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
Number of strings with which to initialise the control.
|
||||||
|
|
||||||
|
@param choices
|
||||||
|
An array of strings with which to initialise the control.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. See wxComboBox.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Window validator.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
|
||||||
|
@sa Create(), wxValidator
|
||||||
|
*/
|
||||||
|
wxComboBox();
|
||||||
|
wxComboBox(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value = "",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
int n = 0,
|
||||||
|
const wxString choices[] = @NULL,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboBox");
|
||||||
|
wxComboBox(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
const wxArrayString& choices,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboBox");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor, destroying the combobox.
|
||||||
|
*/
|
||||||
|
~wxComboBox();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the combobox is editable and there is a text selection to copy
|
||||||
|
to the clipboard.
|
||||||
|
Only available on Windows.
|
||||||
|
*/
|
||||||
|
bool CanCopy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the combobox is editable and there is a text selection to copy
|
||||||
|
to the clipboard.
|
||||||
|
Only available on Windows.
|
||||||
|
*/
|
||||||
|
bool CanCut();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the combobox is editable and there is text on the clipboard
|
||||||
|
that can be pasted into the
|
||||||
|
text field. Only available on Windows.
|
||||||
|
*/
|
||||||
|
bool CanPaste();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the combobox is editable and the last undo can be redone.
|
||||||
|
Only available on Windows.
|
||||||
|
*/
|
||||||
|
bool CanRedo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the combobox is editable and the last edit can be undone.
|
||||||
|
Only available on Windows.
|
||||||
|
*/
|
||||||
|
bool CanUndo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copies the selected text to the clipboard.
|
||||||
|
*/
|
||||||
|
void Copy();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Creates the combobox for two-step construction. Derived classes
|
||||||
|
should call or replace this function. See wxComboBox()
|
||||||
|
for further details.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value = "",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
int n, const wxString choices[],
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboBox");
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& value,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
const wxArrayString& choices,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "comboBox");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copies the selected text to the clipboard and removes the selection.
|
||||||
|
*/
|
||||||
|
#define void Cut() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function does the same things as
|
||||||
|
wxChoice::GetCurrentSelection and
|
||||||
|
returns the item currently selected in the dropdown list if it's open or the
|
||||||
|
same thing as wxControlWithItems::GetSelection otherwise.
|
||||||
|
*/
|
||||||
|
int GetCurrentSelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the insertion point for the combobox's text field.
|
||||||
|
|
||||||
|
@b Note: Under wxMSW, this function always returns 0 if the combobox
|
||||||
|
doesn't have the focus.
|
||||||
|
*/
|
||||||
|
long GetInsertionPoint();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the last position in the combobox text field.
|
||||||
|
*/
|
||||||
|
virtual wxTextPos GetLastPosition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is the same as wxTextCtrl::GetSelection
|
||||||
|
for the text control which is part of the combobox. Notice that this is a
|
||||||
|
different method from wxControlWithItems::GetSelection.
|
||||||
|
|
||||||
|
Currently this method is only implemented in wxMSW and wxGTK.
|
||||||
|
*/
|
||||||
|
void GetSelection(long * from, long * to);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current value in the combobox text field.
|
||||||
|
*/
|
||||||
|
wxString GetValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pastes text from the clipboard to the text field.
|
||||||
|
*/
|
||||||
|
void Paste();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Redoes the last undo in the text field. Windows only.
|
||||||
|
*/
|
||||||
|
void Redo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the text between the two positions in the combobox text field.
|
||||||
|
|
||||||
|
@param from
|
||||||
|
The first position.
|
||||||
|
|
||||||
|
@param to
|
||||||
|
The last position.
|
||||||
|
*/
|
||||||
|
void Remove(long from, long to);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Replaces the text between two positions with the given text, in the combobox
|
||||||
|
text field.
|
||||||
|
|
||||||
|
@param from
|
||||||
|
The first position.
|
||||||
|
|
||||||
|
@param to
|
||||||
|
The second position.
|
||||||
|
|
||||||
|
@param text
|
||||||
|
The text to insert.
|
||||||
|
*/
|
||||||
|
void Replace(long from, long to, const wxString& text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the insertion point in the combobox text field.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
The new insertion point.
|
||||||
|
*/
|
||||||
|
void SetInsertionPoint(long pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the insertion point at the end of the combobox text field.
|
||||||
|
*/
|
||||||
|
void SetInsertionPointEnd();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Selects the text between the two positions, in the combobox text field.
|
||||||
|
|
||||||
|
@param from
|
||||||
|
The first position.
|
||||||
|
|
||||||
|
@param to
|
||||||
|
The second position.
|
||||||
|
*/
|
||||||
|
void SetSelection(long from, long to);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the text for the combobox text field.
|
||||||
|
|
||||||
|
@b NB: For a combobox with @c wxCB_READONLY style the string must be in
|
||||||
|
the combobox choices list, otherwise the call to SetValue() is ignored.
|
||||||
|
|
||||||
|
@param text
|
||||||
|
The text to set.
|
||||||
|
*/
|
||||||
|
void SetValue(const wxString& text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Undoes the last edit in the text field. Windows only.
|
||||||
|
*/
|
||||||
|
void Undo();
|
||||||
|
};
|
||||||
606
interface/config.h
Normal file
606
interface/config.h
Normal file
@@ -0,0 +1,606 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: config.h
|
||||||
|
// Purpose: documentation for wxConfigBase class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxConfigBase
|
||||||
|
@wxheader{config.h}
|
||||||
|
|
||||||
|
wxConfigBase class defines the basic interface of all config classes. It can
|
||||||
|
not be used by itself (it is an abstract base class) and you will always use one
|
||||||
|
of its derivations: wxFileConfig,
|
||||||
|
wxRegConfig or any other.
|
||||||
|
|
||||||
|
However, usually you don't even need to know the precise nature of the class
|
||||||
|
you're working with but you would just use the wxConfigBase methods. This
|
||||||
|
allows you to write the same code regardless of whether you're working with
|
||||||
|
the registry under Win32 or text-based config files under Unix (or even
|
||||||
|
Windows 3.1 .INI files if you're really unlucky). To make writing the portable
|
||||||
|
code even easier, wxWidgets provides a typedef wxConfig
|
||||||
|
which is mapped onto the native wxConfigBase implementation on the given
|
||||||
|
platform: i.e. wxRegConfig under Win32 and
|
||||||
|
wxFileConfig otherwise.
|
||||||
|
|
||||||
|
See @ref overview_wxconfigoverview "config overview" for the descriptions of all
|
||||||
|
features of this class.
|
||||||
|
|
||||||
|
It is highly recommended to use static functions @e Get() and/or @e Set(),
|
||||||
|
so please have a @ref overview_wxconfigstaticfunctions "look at them."
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{misc}
|
||||||
|
*/
|
||||||
|
class wxConfigBase : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
This is the default and only constructor of the wxConfigBase class, and
|
||||||
|
derived classes.
|
||||||
|
|
||||||
|
@param appName
|
||||||
|
The application name. If this is empty, the class will
|
||||||
|
normally use wxApp::GetAppName to set it. The
|
||||||
|
application name is used in the registry key on Windows, and can be used to
|
||||||
|
deduce the local filename parameter if that is missing.
|
||||||
|
|
||||||
|
@param vendorName
|
||||||
|
The vendor name. If this is empty, it is assumed that
|
||||||
|
no vendor name is wanted, if this is optional for the current config class.
|
||||||
|
The vendor name is appended to the application name for wxRegConfig.
|
||||||
|
|
||||||
|
@param localFilename
|
||||||
|
Some config classes require a local filename. If this
|
||||||
|
is not present, but required, the application name will be used instead.
|
||||||
|
|
||||||
|
@param globalFilename
|
||||||
|
Some config classes require a global filename. If
|
||||||
|
this is not present, but required, the application name will be used instead.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Can be one of wxCONFIG_USE_LOCAL_FILE and
|
||||||
|
wxCONFIG_USE_GLOBAL_FILE. The style interpretation depends on the config
|
||||||
|
class and is ignored by some implementations. For wxFileConfig, these styles
|
||||||
|
determine whether a local or global config file is created or used: if
|
||||||
|
wxCONFIG_USE_GLOBAL_FILE is used, then settings are read from the global
|
||||||
|
config file and if wxCONFIG_USE_LOCAL_FILE is used, settings are read from
|
||||||
|
and written to local config file (if they are both set, global file is read
|
||||||
|
first, then local file, overwriting global settings). If the
|
||||||
|
flag is present but the parameter is empty, the parameter will be set to a
|
||||||
|
default. If the parameter is present but the style flag not, the relevant flag
|
||||||
|
will be added to the style. For wxRegConfig, thie GLOBAL flag refers to HKLM
|
||||||
|
key while LOCAL one is for the usual HKCU one.
|
||||||
|
|
||||||
|
For wxFileConfig you can also add wxCONFIG_USE_RELATIVE_PATH by logically
|
||||||
|
or'ing it to either of the _FILE options to tell wxFileConfig to use relative
|
||||||
|
instead of absolute paths.
|
||||||
|
|
||||||
|
On non-VMS Unix systems, the default local configuration file is ~/.appname.
|
||||||
|
However, this path may be also used as user data directory
|
||||||
|
(see wxStandardPaths::GetUserDataDir) if
|
||||||
|
the application has several data files. In this case wxCONFIG_USE_SUBDIR
|
||||||
|
flag, which changes the default local configuration file to ~/.appname/appname
|
||||||
|
should be used. Notice that this flag is ignored if localFilename is
|
||||||
|
provided. This function is new since wxWidgets version 2.8.2
|
||||||
|
|
||||||
|
For wxFileConfig, you can also add wxCONFIG_USE_NO_ESCAPE_CHARACTERS which
|
||||||
|
will turn off character escaping for the values of entries stored in the config
|
||||||
|
file: for example a foo key with some backslash characters will be stored
|
||||||
|
as foo=C:\mydir instead of the usual storage of
|
||||||
|
foo=C:\\mydir.
|
||||||
|
|
||||||
|
The wxCONFIG_USE_NO_ESCAPE_CHARACTERS style can be helpful if your config
|
||||||
|
file must be read or written to by a non-wxWidgets program (which might not
|
||||||
|
understand the escape characters). Note, however, that if
|
||||||
|
wxCONFIG_USE_NO_ESCAPE_CHARACTERS style is used, it is is now
|
||||||
|
your application's responsibility to ensure that there is no newline or
|
||||||
|
other illegal characters in a value, before writing that value to the file.
|
||||||
|
|
||||||
|
@param conv
|
||||||
|
This parameter is only used by wxFileConfig when compiled
|
||||||
|
in Unicode mode. It specifies the encoding in which the configuration file
|
||||||
|
is written.
|
||||||
|
|
||||||
|
@remarks By default, environment variable expansion is on and recording
|
||||||
|
defaults is off.
|
||||||
|
*/
|
||||||
|
wxConfigBase(const wxString& appName = wxEmptyString,
|
||||||
|
const wxString& vendorName = wxEmptyString,
|
||||||
|
const wxString& localFilename = wxEmptyString,
|
||||||
|
const wxString& globalFilename = wxEmptyString,
|
||||||
|
long style = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Empty but ensures that dtor of all derived classes is virtual.
|
||||||
|
*/
|
||||||
|
~wxConfigBase();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@ref ctor() wxConfigBase
|
||||||
|
|
||||||
|
@ref dtor() ~wxConfigBase
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create a new config object: this function will create the "best"
|
||||||
|
implementation of wxConfig available for the current platform, see comments
|
||||||
|
near the definition of wxCONFIG_WIN32_NATIVE for details. It returns the
|
||||||
|
created object and also sets it as the current one.
|
||||||
|
*/
|
||||||
|
static wxConfigBase * Create();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The functions in this section delete entries and/or groups of entries from the
|
||||||
|
config file. @e DeleteAll() is especially useful if you want to erase all
|
||||||
|
traces of your program presence: for example, when you uninstall it.
|
||||||
|
|
||||||
|
DeleteEntry()
|
||||||
|
|
||||||
|
DeleteGroup()
|
||||||
|
|
||||||
|
DeleteAll()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Delete the whole underlying object (disk file, registry key, ...). Primarly
|
||||||
|
for use by uninstallation routine.
|
||||||
|
*/
|
||||||
|
bool DeleteAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Deletes the specified entry and the group it belongs to if it was the last key
|
||||||
|
in it and the second parameter is @true.
|
||||||
|
*/
|
||||||
|
bool DeleteEntry(const wxString& key,
|
||||||
|
bool bDeleteGroupIfEmpty = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Delete the group (with all subgroups). If the current path is under the group
|
||||||
|
being deleted it is changed to its deepest still existing component. E.g. if
|
||||||
|
the current path is @c /A/B/C/D and the group @c C is deleted the
|
||||||
|
path becomes @c /A/B.
|
||||||
|
*/
|
||||||
|
bool DeleteGroup(const wxString& key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Calling this function will prevent @e Get() from automatically creating a
|
||||||
|
new config object if the current one is @NULL. It might be useful to call it
|
||||||
|
near the program end to prevent "accidental" creation of a new config object.
|
||||||
|
*/
|
||||||
|
void DontCreateOnDemand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The functions in this section allow to enumerate all entries and groups in the
|
||||||
|
config file. All functions here return @false when there are no more items.
|
||||||
|
|
||||||
|
You must pass the same index to GetNext and GetFirst (don't modify it).
|
||||||
|
Please note that it is @b not the index of the current item (you will have
|
||||||
|
some great surprises with wxRegConfig if you assume this) and you shouldn't
|
||||||
|
even look at it: it is just a "cookie" which stores the state of the
|
||||||
|
enumeration. It can't be stored inside the class because it would prevent you
|
||||||
|
from running several enumerations simultaneously, that's why you must pass it
|
||||||
|
explicitly.
|
||||||
|
|
||||||
|
Having said all this, enumerating the config entries/groups is very simple:
|
||||||
|
There are also functions to get the number of entries/subgroups without
|
||||||
|
actually enumerating them, but you will probably never need them.
|
||||||
|
|
||||||
|
GetFirstGroup()
|
||||||
|
|
||||||
|
GetNextGroup()
|
||||||
|
|
||||||
|
GetFirstEntry()
|
||||||
|
|
||||||
|
GetNextEntry()
|
||||||
|
|
||||||
|
GetNumberOfEntries()
|
||||||
|
|
||||||
|
GetNumberOfGroups()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
returns @true if either a group or an entry with a given name exists
|
||||||
|
*/
|
||||||
|
bool Exists(wxString& strName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
permanently writes all changes (otherwise, they're only written from object's
|
||||||
|
destructor)
|
||||||
|
*/
|
||||||
|
bool Flush(bool bCurrentOnly = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the current config object. If there is no current object and
|
||||||
|
@e CreateOnDemand is @true, creates one
|
||||||
|
(using @e Create) unless DontCreateOnDemand was called previously.
|
||||||
|
*/
|
||||||
|
#define static wxConfigBase * Get(bool CreateOnDemand = @true) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the application name.
|
||||||
|
*/
|
||||||
|
wxString GetAppName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the type of the given entry or @e Unknown if the entry doesn't
|
||||||
|
exist. This function should be used to decide which version of Read() should
|
||||||
|
be used because some of wxConfig implementations will complain about type
|
||||||
|
mismatch otherwise: e.g., an attempt to read a string value from an integer
|
||||||
|
key with wxRegConfig will fail.
|
||||||
|
|
||||||
|
The result is an element of enum EntryType:
|
||||||
|
*/
|
||||||
|
enum wxConfigBase::EntryType GetEntryType(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the first entry.
|
||||||
|
*/
|
||||||
|
bool GetFirstEntry(wxString& str, long& index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the first group.
|
||||||
|
*/
|
||||||
|
bool GetFirstGroup(wxString& str, long& index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the next entry.
|
||||||
|
*/
|
||||||
|
bool GetNextEntry(wxString& str, long& index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the next group.
|
||||||
|
*/
|
||||||
|
bool GetNextGroup(wxString& str, long& index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
*/
|
||||||
|
uint GetNumberOfEntries(bool bRecursive = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get number of entries/subgroups in the current group, with or without its
|
||||||
|
subgroups.
|
||||||
|
*/
|
||||||
|
uint GetNumberOfGroups(bool bRecursive = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieve the current path (always as absolute path).
|
||||||
|
*/
|
||||||
|
const wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the vendor name.
|
||||||
|
*/
|
||||||
|
wxString GetVendorName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
returns @true if the entry by this name exists
|
||||||
|
*/
|
||||||
|
bool HasEntry(wxString& strName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
returns @true if the group by this name exists
|
||||||
|
*/
|
||||||
|
bool HasGroup(const wxString& strName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if we are expanding environment variables in key values.
|
||||||
|
*/
|
||||||
|
bool IsExpandingEnvVars();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if we are writing defaults back to the config file.
|
||||||
|
*/
|
||||||
|
bool IsRecordingDefaults();
|
||||||
|
|
||||||
|
/**
|
||||||
|
These function are the core of wxConfigBase class: they allow you to read and
|
||||||
|
write config file data. All @e Read function take a default value which
|
||||||
|
will be returned if the specified key is not found in the config file.
|
||||||
|
|
||||||
|
Currently, supported types of data are:
|
||||||
|
wxString, @e long, @e double, @e bool,
|
||||||
|
wxColour and any other types,
|
||||||
|
for which functions wxToString
|
||||||
|
and wxFromString are defined.
|
||||||
|
|
||||||
|
Try not to read long values into string variables and vice versa: although it
|
||||||
|
just might work with wxFileConfig, you will get a system error with
|
||||||
|
wxRegConfig because in the Windows registry the different types of entries are
|
||||||
|
indeed used.
|
||||||
|
|
||||||
|
Final remark: the @e szKey parameter for all these functions can contain an
|
||||||
|
arbitrary path (either relative or absolute), not just the key name.
|
||||||
|
|
||||||
|
Read()
|
||||||
|
|
||||||
|
Write()
|
||||||
|
|
||||||
|
Flush()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
GetAppName()
|
||||||
|
|
||||||
|
GetVendorName()
|
||||||
|
|
||||||
|
wxFileConfig::SetUmask
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Some aspects of wxConfigBase behaviour can be changed during run-time. The
|
||||||
|
first of them is the expansion of environment variables in the string values
|
||||||
|
read from the config file: for example, if you have the following in your
|
||||||
|
config file:
|
||||||
|
the call to @c config-Read("UserData") will return something like
|
||||||
|
@c "/home/zeitlin/data" if you're lucky enough to run a Linux system ;-)
|
||||||
|
|
||||||
|
Although this feature is very useful, it may be annoying if you read a value
|
||||||
|
which containts '$' or '%' symbols (% is used for environment variables
|
||||||
|
expansion under Windows) which are not used for environment variable
|
||||||
|
expansion. In this situation you may call SetExpandEnvVars(@false) just before
|
||||||
|
reading this value and SetExpandEnvVars(@true) just after. Another solution
|
||||||
|
would be to prefix the offending symbols with a backslash.
|
||||||
|
|
||||||
|
The following functions control this option:
|
||||||
|
|
||||||
|
IsExpandingEnvVars()
|
||||||
|
|
||||||
|
SetExpandEnvVars()
|
||||||
|
|
||||||
|
SetRecordDefaults()
|
||||||
|
|
||||||
|
IsRecordingDefaults()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
As explained in @ref overview_wxconfigoverview "config overview", the config
|
||||||
|
classes
|
||||||
|
support a file system-like hierarchy of keys (files) and groups (directories).
|
||||||
|
As in the file system case, to specify a key in the config class you must use
|
||||||
|
a path to it. Config classes also support the notion of the current group,
|
||||||
|
which makes it possible to use the relative paths. To clarify all this, here
|
||||||
|
is an example (it is only for the sake of demonstration, it doesn't do anything
|
||||||
|
sensible!):
|
||||||
|
@e Warning: it is probably a good idea to always restore the path to its
|
||||||
|
old value on function exit:
|
||||||
|
because otherwise the assert in the following example will surely fail
|
||||||
|
(we suppose here that @e foo() function is the same as above except that it
|
||||||
|
doesn't save and restore the path):
|
||||||
|
Finally, the path separator in wxConfigBase and derived classes is always '/',
|
||||||
|
regardless of the platform (i.e. it is @b not '\\' under Windows).
|
||||||
|
|
||||||
|
SetPath()
|
||||||
|
|
||||||
|
GetPath()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Reads a value of type T, for which function
|
||||||
|
wxFromString is defined,
|
||||||
|
returning @true if the value was found.
|
||||||
|
If the value was not found, @e defaultVal is used instead.
|
||||||
|
|
||||||
|
bool Read(const wxStringkey, T* value) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@b Read(key, default="")
|
||||||
|
|
||||||
|
|
||||||
|
Returns a string
|
||||||
|
|
||||||
|
@b ReadInt(key, default=0)
|
||||||
|
|
||||||
|
|
||||||
|
Returns an integer
|
||||||
|
|
||||||
|
@b ReadFloat(key, default=0.0)
|
||||||
|
|
||||||
|
|
||||||
|
Returns a floating point number
|
||||||
|
|
||||||
|
@b ReadBool(key, default=0)
|
||||||
|
|
||||||
|
|
||||||
|
Returns a boolean
|
||||||
|
*/
|
||||||
|
bool Read(const wxString& key, wxString* str);
|
||||||
|
bool Read(const wxString& key, wxString* str,
|
||||||
|
const wxString& defaultVal);
|
||||||
|
wxString Read(const wxString& key,
|
||||||
|
const
|
||||||
|
wxString& defaultVal);
|
||||||
|
bool Read(const wxString& key, long* l);
|
||||||
|
bool Read(const wxString& key, long* l, long defaultVal);
|
||||||
|
bool Read(const wxString& key, double* d);
|
||||||
|
bool Read(const wxString& key, double* d, double defaultVal);
|
||||||
|
bool Read(const wxString& key, bool* b);
|
||||||
|
bool Read(const wxString& key, bool* d, bool defaultVal);
|
||||||
|
bool Read(const wxString& key, wxMemoryBuffer* buf);
|
||||||
|
bool Read(const wxString& key, T* value);
|
||||||
|
bool Read(const wxString& key, T* value,
|
||||||
|
T const& defaultVal);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a bool value from the key and returns it. @e defaultVal is returned
|
||||||
|
if the key is not found.
|
||||||
|
*/
|
||||||
|
long ReadBool(const wxString& key, bool defaultVal);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a double value from the key and returns it. @e defaultVal is returned
|
||||||
|
if the key is not found.
|
||||||
|
*/
|
||||||
|
long ReadDouble(const wxString& key, double defaultVal);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a long value from the key and returns it. @e defaultVal is returned
|
||||||
|
if the key is not found.
|
||||||
|
*/
|
||||||
|
long ReadLong(const wxString& key, long defaultVal);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a value of type T, for which function
|
||||||
|
wxFromString is defined, from the key and returns it.
|
||||||
|
@e defaultVal is returned if the key is not found.
|
||||||
|
*/
|
||||||
|
T ReadObject(const wxString& key, T const& defaultVal);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The functions in this section allow to rename entries or subgroups of the
|
||||||
|
current group. They will return @false on error. typically because either the
|
||||||
|
entry/group with the original name doesn't exist, because the entry/group with
|
||||||
|
the new name already exists or because the function is not supported in this
|
||||||
|
wxConfig implementation.
|
||||||
|
|
||||||
|
RenameEntry()
|
||||||
|
|
||||||
|
RenameGroup()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Renames an entry in the current group. The entries names (both the old and
|
||||||
|
the new one) shouldn't contain backslashes, i.e. only simple names and not
|
||||||
|
arbitrary paths are accepted by this function.
|
||||||
|
|
||||||
|
Returns @false if @e oldName doesn't exist or if @e newName already
|
||||||
|
exists.
|
||||||
|
*/
|
||||||
|
bool RenameEntry(const wxString& oldName,
|
||||||
|
const wxString& newName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Renames a subgroup of the current group. The subgroup names (both the old and
|
||||||
|
the new one) shouldn't contain backslashes, i.e. only simple names and not
|
||||||
|
arbitrary paths are accepted by this function.
|
||||||
|
|
||||||
|
Returns @false if @e oldName doesn't exist or if @e newName already
|
||||||
|
exists.
|
||||||
|
*/
|
||||||
|
bool RenameGroup(const wxString& oldName,
|
||||||
|
const wxString& newName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the config object as the current one, returns the pointer to the previous
|
||||||
|
current object (both the parameter and returned value may be @NULL)
|
||||||
|
*/
|
||||||
|
#define static wxConfigBase * Set(wxConfigBase * pConfig) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determine whether we wish to expand environment variables in key values.
|
||||||
|
*/
|
||||||
|
void SetExpandEnvVars(bool bDoIt = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set current path: if the first character is '/', it is the absolute path,
|
||||||
|
otherwise it is a relative path. '..' is supported. If strPath doesn't
|
||||||
|
exist it is created.
|
||||||
|
*/
|
||||||
|
void SetPath(const wxString& strPath);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets whether defaults are recorded to the config file whenever an attempt to
|
||||||
|
read the value which is not present in it is done.
|
||||||
|
|
||||||
|
If on (default is off) all default values for the settings used by the program
|
||||||
|
are written back to the config file. This allows the user to see what config
|
||||||
|
options may be changed and is probably useful only for wxFileConfig.
|
||||||
|
*/
|
||||||
|
void SetRecordDefaults(bool bDoIt = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
These functions deal with the "default" config object. Although its usage is
|
||||||
|
not at all mandatory it may be convenient to use a global config object
|
||||||
|
instead of creating and deleting the local config objects each time you need
|
||||||
|
one (especially because creating a wxFileConfig object might be a time
|
||||||
|
consuming operation). In this case, you may create this global config object
|
||||||
|
in the very start of the program and @e Set() it as the default. Then, from
|
||||||
|
anywhere in your program, you may access it using the @e Get() function.
|
||||||
|
This global wxConfig object will be deleted by wxWidgets automatically if it
|
||||||
|
exists. Note that this implies that if you do delete this object yourself
|
||||||
|
(usually in wxApp::OnExit) you must use @e Set(@NULL)
|
||||||
|
to prevent wxWidgets from deleting it the second time.
|
||||||
|
|
||||||
|
As it happens, you may even further simplify the procedure described above:
|
||||||
|
you may forget about calling @e Set(). When @e Get() is called and there
|
||||||
|
is no current object, it will create one using @e Create() function. To
|
||||||
|
disable this behaviour @e DontCreateOnDemand() is provided.
|
||||||
|
|
||||||
|
@b Note: You should use either @e Set() or @e Get() because wxWidgets
|
||||||
|
library itself would take advantage of it and could save various information
|
||||||
|
in it. For example wxFontMapper or Unix version
|
||||||
|
of wxFileDialog have the ability to use wxConfig class.
|
||||||
|
|
||||||
|
Set()
|
||||||
|
|
||||||
|
Get()
|
||||||
|
|
||||||
|
Create()
|
||||||
|
|
||||||
|
DontCreateOnDemand()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
HasGroup()
|
||||||
|
|
||||||
|
HasEntry()
|
||||||
|
|
||||||
|
Exists()
|
||||||
|
|
||||||
|
GetEntryType()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
These functions write the specified value to the config file and return @true
|
||||||
|
on success. In the last one, function wxToString must be
|
||||||
|
defined for type @e T.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@b Write(key, value)
|
||||||
|
|
||||||
|
|
||||||
|
Writes a string
|
||||||
|
|
||||||
|
@b WriteInt(key, value)
|
||||||
|
|
||||||
|
|
||||||
|
Writes an integer
|
||||||
|
|
||||||
|
@b WriteFloat(key, value)
|
||||||
|
|
||||||
|
|
||||||
|
Writes a floating point number
|
||||||
|
|
||||||
|
@b WriteBool(key, value)
|
||||||
|
|
||||||
|
|
||||||
|
Writes a boolean
|
||||||
|
*/
|
||||||
|
bool Write(const wxString& key, const wxString& value);
|
||||||
|
bool Write(const wxString& key, long value);
|
||||||
|
bool Write(const wxString& key, double value);
|
||||||
|
bool Write(const wxString& key, bool value);
|
||||||
|
bool Write(const wxString& key, const wxMemoryBuffer& buf);
|
||||||
|
bool Write(const wxString& key, const T& buf);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
62
interface/control.h
Normal file
62
interface/control.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: control.h
|
||||||
|
// Purpose: documentation for wxControl class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxControl
|
||||||
|
@wxheader{control.h}
|
||||||
|
|
||||||
|
This is the base class for a control or "widget''.
|
||||||
|
|
||||||
|
A control is generally a small window which processes user input and/or
|
||||||
|
displays one or more item of data.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{control.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxValidator
|
||||||
|
*/
|
||||||
|
class wxControl : public wxWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Simulates the effect of the user issuing a command to the item. See
|
||||||
|
wxCommandEvent.
|
||||||
|
*/
|
||||||
|
void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the control's text.
|
||||||
|
|
||||||
|
Note that the returned string contains the mnemonics (@c characters) if
|
||||||
|
any, use GetLabelText() if they are
|
||||||
|
undesired.
|
||||||
|
*/
|
||||||
|
wxString GetLabel();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns the control's label, or the given @e label string for the static
|
||||||
|
version, without the mnemonics characters.
|
||||||
|
*/
|
||||||
|
const wxString GetLabelText();
|
||||||
|
static wxString GetLabelText(const wxString& label);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the item's text.
|
||||||
|
|
||||||
|
The @c characters in the @e label are special and indicate that the
|
||||||
|
following character is a mnemonic for this control and can be used to activate
|
||||||
|
it from the keyboard (typically by using @e Alt key in combination with
|
||||||
|
it). To insert a literal ampersand character, you need to double it, i.e. use
|
||||||
|
@c "".
|
||||||
|
*/
|
||||||
|
void SetLabel(const wxString& label);
|
||||||
|
};
|
||||||
98
interface/convauto.h
Normal file
98
interface/convauto.h
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: convauto.h
|
||||||
|
// Purpose: documentation for wxConvAuto class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxConvAuto
|
||||||
|
@wxheader{convauto.h}
|
||||||
|
|
||||||
|
This class implements a Unicode to/from multibyte converter capable of
|
||||||
|
automatically recognizing the encoding of the multibyte text on input. The
|
||||||
|
logic used is very simple: the class uses the BOM (byte order mark) if it's
|
||||||
|
present and tries to interpret the input as UTF-8 otherwise. If this fails, the
|
||||||
|
input is interpreted as being in the default multibyte encoding which can be
|
||||||
|
specified in the constructor of a wxConvAuto instance and, in turn, defaults to
|
||||||
|
the value of @ref wxConvAuto::getdefaultmbencoding GetFallbackEncoding if
|
||||||
|
not explicitly given.
|
||||||
|
|
||||||
|
For the conversion from Unicode to multibyte, the same encoding as was
|
||||||
|
previously used for multibyte to Unicode conversion is reused. If there had
|
||||||
|
been no previous multibyte to Unicode conversion, UTF-8 is used by default.
|
||||||
|
Notice that once the multibyte encoding is automatically detected, it doesn't
|
||||||
|
change any more, i.e. it is entirely determined by the first use of wxConvAuto
|
||||||
|
object in the multibyte-to-Unicode direction. However creating a copy of
|
||||||
|
wxConvAuto object, either via the usual copy constructor or assignment
|
||||||
|
operator, or using wxMBConv::Clone method, resets the
|
||||||
|
automatically detected encoding so that the new copy will try to detect the
|
||||||
|
encoding of the input on first use.
|
||||||
|
|
||||||
|
This class is used by default in wxWidgets classes and functions reading text
|
||||||
|
from files such as wxFile, wxFFile,
|
||||||
|
wxTextFile, wxFileConfig and
|
||||||
|
various stream classes so the encoding set with its
|
||||||
|
@ref wxConvAuto::setdefaultmbencoding SetFallbackEncoding method will
|
||||||
|
affect how these classes treat input files. In particular, use this method
|
||||||
|
to change the fall-back multibyte encoding used to interpret the contents of
|
||||||
|
the files whose contents isn't valid UTF-8 or to disallow it completely.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_mbconvclasses "wxMBConv classes overview"
|
||||||
|
*/
|
||||||
|
class wxConvAuto : public wxMBConv
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructs a new wxConvAuto instance. The object will try to detect the input
|
||||||
|
of the multibyte text given to its wxMBConv::ToWChar method
|
||||||
|
automatically but if the automatic detection of Unicode encodings fails, the
|
||||||
|
fall-back encoding @e enc will be used to interpret it as multibyte text.
|
||||||
|
The default value of this parameter, @c wxFONTENCODING_DEFAULT means
|
||||||
|
that the global default value which can be set using
|
||||||
|
@ref setdefaultmbencoding() SetFallbackEncoding method should be
|
||||||
|
used. As with that method, passing @c wxFONTENCODING_MAX inhibits using
|
||||||
|
this encoding completely so the input multibyte text will always be interpreted
|
||||||
|
as UTF-8 in the absence of BOM and the conversion will fail if the input
|
||||||
|
doesn't form valid UTF-8 sequence. Another special value is
|
||||||
|
@c wxFONTENCODING_SYSTEM which means to use the encoding currently used
|
||||||
|
on the user system, i.e. the encoding returned by
|
||||||
|
wxLocale::GetSystemEncoding. Any other
|
||||||
|
encoding will be used as is, e.g. passing @c wxFONTENCODING_ISO8859_1
|
||||||
|
ensures that non-UTF-8 input will be treated as latin1.
|
||||||
|
*/
|
||||||
|
wxConvAuto(wxFontEncoding enc = wxFONTENCODING_DEFAULT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Disable the use of the fall back encoding: if the input doesn't have a BOM and
|
||||||
|
is not valid UTF-8, the conversion will fail.
|
||||||
|
*/
|
||||||
|
static void DisableFallbackEncoding();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the encoding used by default by wxConvAuto if no other encoding is
|
||||||
|
explicitly specified in constructor. By default, returns
|
||||||
|
@c wxFONTENCODING_ISO8859_1 but can be changed using
|
||||||
|
@ref setdefaultmbencoding() SetFallbackEncoding method.
|
||||||
|
*/
|
||||||
|
static wxFontEncoding GetFallbackEncoding();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Changes the encoding used by default by wxConvAuto if no other encoding is
|
||||||
|
explicitly specified in constructor. The default value, which can be retrieved
|
||||||
|
using @ref getdefaultmbencoding() GetFallbackEncoding, is
|
||||||
|
@c wxFONTENCODING_ISO8859_1.
|
||||||
|
|
||||||
|
Special values of @c wxFONTENCODING_SYSTEM or
|
||||||
|
@c wxFONTENCODING_MAX can be used for @e enc parameter to use the
|
||||||
|
encoding of the current user locale as fall back or not use any encoding for
|
||||||
|
fall back at all, respectively (just as with the similar constructor
|
||||||
|
parameter). However @c wxFONTENCODING_DEFAULT value cannot be used here.
|
||||||
|
*/
|
||||||
|
static void SetFallbackEncoding(wxFontEncoding enc);
|
||||||
|
};
|
||||||
40
interface/cpp.h
Normal file
40
interface/cpp.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: cpp.h
|
||||||
|
// Purpose: documentation for global functions
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
These macro return the concatenation of the tokens passed as their arguments.
|
||||||
|
Unlike when using the preprocessor @c operator, the arguments undergo
|
||||||
|
the macro expansion before being concatenated.
|
||||||
|
*/
|
||||||
|
wxCONCAT(x1, x2);
|
||||||
|
wxCONCAT3(x1, x2, x3);
|
||||||
|
wxCONCAT4(x1, x2, x3, x4);
|
||||||
|
wxCONCAT5(x1, x2, x3, x4, x5);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string representation of the given symbol which can be either a
|
||||||
|
literal or a macro (hence the advantage of using this macro instead of the
|
||||||
|
standard preprocessor @c # operator which doesn't work with macros).
|
||||||
|
|
||||||
|
Notice that this macro always produces a @c char string, use
|
||||||
|
wxSTRINGIZE_T to build a wide string Unicode build.
|
||||||
|
|
||||||
|
@sa wxCONCAT
|
||||||
|
*/
|
||||||
|
#define wxSTRINGIZE(x) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string representation of the given symbol as either an ASCII or
|
||||||
|
Unicode string, depending on the current build. This is the Unicode-friendly
|
||||||
|
equivalent of wxSTRINGIZE.
|
||||||
|
*/
|
||||||
|
#define wxSTRINGIZE_T(x) /* implementation is private */
|
||||||
|
|
||||||
296
interface/cshelp.h
Normal file
296
interface/cshelp.h
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: cshelp.h
|
||||||
|
// Purpose: documentation for wxHelpProvider class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxHelpProvider
|
||||||
|
@wxheader{cshelp.h}
|
||||||
|
|
||||||
|
wxHelpProvider is an abstract class used by a program implementing
|
||||||
|
context-sensitive help to
|
||||||
|
show the help text for the given window.
|
||||||
|
|
||||||
|
The current help provider must be explicitly set by the application using
|
||||||
|
wxHelpProvider::Set().
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{help}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxContextHelp, wxContextHelpButton, wxSimpleHelpProvider,
|
||||||
|
wxHelpControllerHelpProvider, wxWindow::SetHelpText, wxWindow::GetHelpTextAtPoint
|
||||||
|
*/
|
||||||
|
class wxHelpProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Virtual destructor for any base class.
|
||||||
|
*/
|
||||||
|
~wxHelpProvider();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Associates the text with the given window or id. Although all help
|
||||||
|
providers have these functions to allow making wxWindow::SetHelpText
|
||||||
|
work, not all of them implement the functions.
|
||||||
|
*/
|
||||||
|
void AddHelp(wxWindowBase* window, const wxString& text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Unlike some other classes, the help provider is not created on demand.
|
||||||
|
This must be explicitly done by the application.
|
||||||
|
*/
|
||||||
|
#define wxHelpProvider* Get() /* implementation is private */
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
This version associates the given text with all windows with this id.
|
||||||
|
May be used to set the same help string for all Cancel buttons in
|
||||||
|
the application, for example.
|
||||||
|
*/
|
||||||
|
wxString GetHelp(const wxWindowBase* window);
|
||||||
|
void AddHelp(wxWindowID id, const wxString& text);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the association between the window pointer and the help text. This is
|
||||||
|
called by the wxWindow destructor. Without this, the table of help strings will
|
||||||
|
fill up
|
||||||
|
and when window pointers are reused, the wrong help string will be found.
|
||||||
|
*/
|
||||||
|
void RemoveHelp(wxWindowBase* window);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get/set the current, application-wide help provider. Returns
|
||||||
|
the previous one.
|
||||||
|
*/
|
||||||
|
#define wxHelpProvider* Set(wxHelpProvider* helpProvider) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows help for the given window. Override this function if the help doesn't
|
||||||
|
depend on the exact position inside the window, otherwise you need to override
|
||||||
|
ShowHelpAtPoint().
|
||||||
|
|
||||||
|
Returns @true if help was shown, or @false if no help was available for this
|
||||||
|
window.
|
||||||
|
*/
|
||||||
|
bool ShowHelp(wxWindowBase* window);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function may be overridden to show help for the window when it should
|
||||||
|
depend on the position inside the window, By default this method forwards to
|
||||||
|
ShowHelp(), so it is enough to only implement
|
||||||
|
the latter if the help doesn't depend on the position.
|
||||||
|
|
||||||
|
Returns @true if help was shown, or @false if no help was available for this
|
||||||
|
window.
|
||||||
|
|
||||||
|
@param window
|
||||||
|
Window to show help text for.
|
||||||
|
|
||||||
|
@param point
|
||||||
|
Coordinates of the mouse at the moment of help event emission.
|
||||||
|
|
||||||
|
@param origin
|
||||||
|
Help event origin, see wxHelpEvent::GetOrigin.
|
||||||
|
*/
|
||||||
|
bool ShowHelpAtPoint(wxWindowBase* window, const wxPoint point,
|
||||||
|
wxHelpEvent::Origin origin);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxHelpControllerHelpProvider
|
||||||
|
@wxheader{cshelp.h}
|
||||||
|
|
||||||
|
wxHelpControllerHelpProvider is an implementation of wxHelpProvider which
|
||||||
|
supports
|
||||||
|
both context identifiers and plain text help strings. If the help text is an
|
||||||
|
integer,
|
||||||
|
it is passed to wxHelpController::DisplayContextPopup. Otherwise, it shows the
|
||||||
|
string
|
||||||
|
in a tooltip as per wxSimpleHelpProvider. If you use this with a
|
||||||
|
wxCHMHelpController instance
|
||||||
|
on windows, it will use the native style of tip window instead of wxTipWindow.
|
||||||
|
|
||||||
|
You can use the convenience function @b wxContextId to convert an integer
|
||||||
|
context
|
||||||
|
id to a string for passing to wxWindow::SetHelpText.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{help}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxHelpProvider, wxSimpleHelpProvider, wxContextHelp, wxWindow::SetHelpText,
|
||||||
|
wxWindow::GetHelpTextAtPoint
|
||||||
|
*/
|
||||||
|
class wxHelpControllerHelpProvider : public wxSimpleHelpProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Note that the instance doesn't own the help controller. The help controller
|
||||||
|
should be deleted separately.
|
||||||
|
*/
|
||||||
|
wxHelpControllerHelpProvider(wxHelpControllerBase* hc = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the help controller associated with this help provider.
|
||||||
|
*/
|
||||||
|
wxHelpControllerBase* GetHelpController();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the help controller associated with this help provider.
|
||||||
|
*/
|
||||||
|
void SetHelpController(wxHelpControllerBase* hc);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxContextHelp
|
||||||
|
@wxheader{cshelp.h}
|
||||||
|
|
||||||
|
This class changes the cursor to a query and puts the application into a
|
||||||
|
'context-sensitive help mode'.
|
||||||
|
When the user left-clicks on a window within the specified window, a wxEVT_HELP
|
||||||
|
event is
|
||||||
|
sent to that control, and the application may respond to it by popping up some
|
||||||
|
help.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxContextHelp contextHelp(myWindow);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
There are a couple of ways to invoke this behaviour implicitly:
|
||||||
|
|
||||||
|
Use the wxDIALOG_EX_CONTEXTHELP style for a dialog (Windows only). This will
|
||||||
|
put a question mark
|
||||||
|
in the titlebar, and Windows will put the application into context-sensitive
|
||||||
|
help mode automatically,
|
||||||
|
with further programming.
|
||||||
|
Create a wxContextHelpButton, whose predefined behaviour is to create a
|
||||||
|
context help object.
|
||||||
|
Normally you will write your application so that this button is only added to a
|
||||||
|
dialog for non-Windows platforms
|
||||||
|
(use wxDIALOG_EX_CONTEXTHELP on Windows).
|
||||||
|
|
||||||
|
Note that on Mac OS X, the cursor does not change when in context-sensitive
|
||||||
|
help mode.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{help}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxHelpEvent, wxHelpController, wxContextHelpButton
|
||||||
|
*/
|
||||||
|
class wxContextHelp : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructs a context help object, calling BeginContextHelp() if
|
||||||
|
@e doNow is @true (the default).
|
||||||
|
|
||||||
|
If @e window is @NULL, the top window is used.
|
||||||
|
*/
|
||||||
|
wxContextHelp(wxWindow* window = @NULL, bool doNow = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroys the context help object.
|
||||||
|
*/
|
||||||
|
~wxContextHelp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Puts the application into context-sensitive help mode. @e window is the window
|
||||||
|
which will be used to catch events; if @NULL, the top window will be used.
|
||||||
|
|
||||||
|
Returns @true if the application was successfully put into context-sensitive
|
||||||
|
help mode.
|
||||||
|
This function only returns when the event loop has finished.
|
||||||
|
*/
|
||||||
|
bool BeginContextHelp(wxWindow* window = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Ends context-sensitive help mode. Not normally called by the application.
|
||||||
|
*/
|
||||||
|
bool EndContextHelp();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxContextHelpButton
|
||||||
|
@wxheader{cshelp.h}
|
||||||
|
|
||||||
|
Instances of this class may be used to add a question mark button that when
|
||||||
|
pressed, puts the
|
||||||
|
application into context-help mode. It does this by creating a wxContextHelp
|
||||||
|
object which itself
|
||||||
|
generates a wxEVT_HELP event when the user clicks on a window.
|
||||||
|
|
||||||
|
On Windows, you may add a question-mark icon to a dialog by use of the
|
||||||
|
wxDIALOG_EX_CONTEXTHELP extra style, but
|
||||||
|
on other platforms you will have to add a button explicitly, usually next to
|
||||||
|
OK, Cancel or similar buttons.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{help}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxBitmapButton, wxContextHelp
|
||||||
|
*/
|
||||||
|
class wxContextHelpButton : public wxBitmapButton
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a context help button.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Button identifier. Defaults to wxID_CONTEXT_HELP.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Button position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Button size. If wxDefaultSize is specified then the button is sized
|
||||||
|
appropriately for the question mark bitmap.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style.
|
||||||
|
*/
|
||||||
|
wxContextHelpButton();
|
||||||
|
wxContextHelpButton(wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_CONTEXT_HELP,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxBU_AUTODRAW);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxSimpleHelpProvider
|
||||||
|
@wxheader{cshelp.h}
|
||||||
|
|
||||||
|
wxSimpleHelpProvider is an implementation of wxHelpProvider which supports
|
||||||
|
only plain text help strings, and shows the string associated with the
|
||||||
|
control (if any) in a tooltip.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{help}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxHelpProvider, wxHelpControllerHelpProvider, wxContextHelp,
|
||||||
|
wxWindow::SetHelpText, wxWindow::GetHelpTextAtPoint
|
||||||
|
*/
|
||||||
|
class wxSimpleHelpProvider : public wxHelpProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
};
|
||||||
355
interface/ctrlsub.h
Normal file
355
interface/ctrlsub.h
Normal file
@@ -0,0 +1,355 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: ctrlsub.h
|
||||||
|
// Purpose: documentation for wxControlWithItems class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxControlWithItems
|
||||||
|
@wxheader{ctrlsub.h}
|
||||||
|
|
||||||
|
This class is an abstract base class for some wxWidgets controls which contain
|
||||||
|
several items, such as wxListBox and
|
||||||
|
wxCheckListBox derived from it,
|
||||||
|
wxChoice and wxComboBox.
|
||||||
|
|
||||||
|
It defines the methods for accessing the controls items and although each of
|
||||||
|
the derived classes implements them differently, they still all conform to the
|
||||||
|
same interface.
|
||||||
|
|
||||||
|
The items in a wxControlWithItems have (non-empty) string labels and,
|
||||||
|
optionally, client data associated with them. Client data may be of two
|
||||||
|
different kinds: either simple untyped (@c void *) pointers which are simply
|
||||||
|
stored by the control but not used in any way by it, or typed pointers
|
||||||
|
(@c wxClientData *) which are owned by the control meaning that the typed
|
||||||
|
client data (and only it) will be deleted when an item is
|
||||||
|
@ref wxControlWithItems::delete deleted or the entire control is
|
||||||
|
@ref wxControlWithItems::clear cleared (which also happens when it is
|
||||||
|
destroyed). Finally note that in the same control all items must have client
|
||||||
|
data of the same type (typed or untyped), if any. This type is determined by
|
||||||
|
the first call to wxControlWithItems::Append (the version with
|
||||||
|
client data pointer) or wxControlWithItems::SetClientData.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxControlWithItems::Clear
|
||||||
|
*/
|
||||||
|
class wxControlWithItems : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Appends several items at once to the control. Notice that calling this method
|
||||||
|
is usually much faster than appending them one by one if you need to add a lot
|
||||||
|
of items.
|
||||||
|
|
||||||
|
@param item
|
||||||
|
String to add.
|
||||||
|
|
||||||
|
@param stringsArray
|
||||||
|
Contains items to append to the control.
|
||||||
|
|
||||||
|
@param strings
|
||||||
|
Array of strings of size n.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
Number of items in the strings array.
|
||||||
|
|
||||||
|
@param clientData
|
||||||
|
Array of client data pointers of size n to associate with the new items.
|
||||||
|
|
||||||
|
@returns When appending a single item, the return value is the index of
|
||||||
|
the newly added item which may be different from the
|
||||||
|
last one if the control is sorted (e.g. has wxLB_SORT
|
||||||
|
or wxCB_SORT style).
|
||||||
|
*/
|
||||||
|
int Append(const wxString& item);
|
||||||
|
int Append(const wxString& item, void * clientData);
|
||||||
|
int Append(const wxString& item, wxClientData * clientData);
|
||||||
|
void Append(const wxArrayString& strings);
|
||||||
|
void Append(unsigned int n, const wxString* strings);
|
||||||
|
void Append(unsigned int n, const wxString* strings,
|
||||||
|
void ** clientData);
|
||||||
|
void Append(unsigned int n, const wxString* strings,
|
||||||
|
wxClientData ** clientData);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes all items from the control.
|
||||||
|
|
||||||
|
@e Clear() also deletes the client data of the existing items if it is owned
|
||||||
|
by the control.
|
||||||
|
*/
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Deletes an item from the control. The client data associated with the item
|
||||||
|
will be also deleted if it is owned by the control.
|
||||||
|
|
||||||
|
Note that it is an error (signalled by an assert failure in debug builds) to
|
||||||
|
remove an item with the index negative or greater or equal than the number of
|
||||||
|
items in the control.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The zero-based item index.
|
||||||
|
|
||||||
|
@sa Clear()
|
||||||
|
*/
|
||||||
|
void Delete(unsigned int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Finds an item whose label matches the given string.
|
||||||
|
|
||||||
|
@param string
|
||||||
|
String to find.
|
||||||
|
|
||||||
|
@param caseSensitive
|
||||||
|
Whether search is case sensitive (default is not).
|
||||||
|
|
||||||
|
@returns The zero-based position of the item, or wxNOT_FOUND if the
|
||||||
|
string was not found.
|
||||||
|
*/
|
||||||
|
int FindString(const wxString& string,
|
||||||
|
bool caseSensitive = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the client data associated with the given item (if any).
|
||||||
|
It is an error to call this function for a control which doesn't have untyped
|
||||||
|
client data at all although it is ok to call it even if the given item doesn't
|
||||||
|
have any client data associated with it (but other items do).
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The zero-based position of the item.
|
||||||
|
|
||||||
|
@returns A pointer to the client data, or @NULL if not present.
|
||||||
|
*/
|
||||||
|
void * GetClientData(unsigned int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the client data associated with the given item (if any).
|
||||||
|
It is an error to call this function for a control which doesn't have typed
|
||||||
|
client data at all although it is ok to call it even if the given item doesn't
|
||||||
|
have any client data associated with it (but other items do).
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The zero-based position of the item.
|
||||||
|
|
||||||
|
@returns A pointer to the client data, or @NULL if not present.
|
||||||
|
*/
|
||||||
|
wxClientData * GetClientObject(unsigned int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of items in the control.
|
||||||
|
|
||||||
|
@sa IsEmpty()
|
||||||
|
*/
|
||||||
|
unsigned int GetCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the index of the selected item or @c wxNOT_FOUND if no item is
|
||||||
|
selected.
|
||||||
|
|
||||||
|
@returns The position of the current selection.
|
||||||
|
|
||||||
|
@remarks This method can be used with single selection list boxes only,
|
||||||
|
you should use wxListBox::GetSelections for the list
|
||||||
|
boxes with wxLB_MULTIPLE style.
|
||||||
|
|
||||||
|
@sa SetSelection(), GetStringSelection()
|
||||||
|
*/
|
||||||
|
int GetSelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the label of the item with the given index.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The zero-based index.
|
||||||
|
|
||||||
|
@returns The label of the item or an empty string if the position was
|
||||||
|
invalid.
|
||||||
|
*/
|
||||||
|
wxString GetString(unsigned int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the label of the selected item or an empty string if no item is
|
||||||
|
selected.
|
||||||
|
|
||||||
|
@sa GetSelection()
|
||||||
|
*/
|
||||||
|
wxString GetStringSelection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the array of the labels of all items in the control.
|
||||||
|
*/
|
||||||
|
wxArrayString GetStrings();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Inserts several items at once into the control. Notice that calling this method
|
||||||
|
is usually much faster than inserting them one by one if you need to insert a
|
||||||
|
lot
|
||||||
|
of items.
|
||||||
|
|
||||||
|
@param item
|
||||||
|
String to add.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Position to insert item before, zero based.
|
||||||
|
|
||||||
|
@param stringsArray
|
||||||
|
Contains items to insert into the control content
|
||||||
|
|
||||||
|
@param strings
|
||||||
|
Array of strings of size n.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
Number of items in the strings array.
|
||||||
|
|
||||||
|
@param clientData
|
||||||
|
Array of client data pointers of size n to associate with the new items.
|
||||||
|
|
||||||
|
@returns The return value is the index of the newly inserted item. If the
|
||||||
|
insertion failed for some reason, -1 is returned.
|
||||||
|
*/
|
||||||
|
int Insert(const wxString& item, unsigned int pos);
|
||||||
|
int Insert(const wxString& item, unsigned int pos,
|
||||||
|
void * clientData);
|
||||||
|
int Insert(const wxString& item, unsigned int pos,
|
||||||
|
wxClientData * clientData);
|
||||||
|
void Insert(const wxArrayString& strings, unsigned int pos);
|
||||||
|
void Insert(const wxArrayString& strings, unsigned int pos);
|
||||||
|
void Insert(unsigned int n, const wxString* strings,
|
||||||
|
unsigned int pos);
|
||||||
|
void Insert(unsigned int n, const wxString* strings,
|
||||||
|
unsigned int pos,
|
||||||
|
void ** clientData);
|
||||||
|
void Insert(unsigned int n, const wxString* strings,
|
||||||
|
unsigned int pos,
|
||||||
|
wxClientData ** clientData);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the control is empty or @false if it has some items.
|
||||||
|
|
||||||
|
@sa GetCount()
|
||||||
|
*/
|
||||||
|
bool IsEmpty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is the same as SetSelection() and
|
||||||
|
exists only because it is slightly more natural for controls which support
|
||||||
|
multiple selection.
|
||||||
|
*/
|
||||||
|
void Select(int n);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Replaces the current control contents with the given items. Notice that calling
|
||||||
|
this method is much faster than appending the items one by one if you need to
|
||||||
|
append a lot of them.
|
||||||
|
|
||||||
|
@param item
|
||||||
|
The single item to insert into the control.
|
||||||
|
|
||||||
|
@param stringsArray
|
||||||
|
Contains items to set as control content.
|
||||||
|
|
||||||
|
@param strings
|
||||||
|
Raw C++ array of strings. Only used in conjunction with 'n'.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
Number of items passed in 'strings'. Only used in conjunction with 'strings'.
|
||||||
|
|
||||||
|
@param clientData
|
||||||
|
Client data to associate with the item(s).
|
||||||
|
|
||||||
|
@returns When the control is sorted (e.g. has wxLB_SORT or wxCB_SORT
|
||||||
|
style) the return value could be different from
|
||||||
|
(GetCount() - 1). When setting a single item to the
|
||||||
|
container, the return value is the index of the newly
|
||||||
|
added item which may be different from the last one
|
||||||
|
if the control is sorted (e.g. has wxLB_SORT or
|
||||||
|
wxCB_SORT style).
|
||||||
|
*/
|
||||||
|
int Set(const wxString& item);
|
||||||
|
int Set(const wxString& item, void * clientData);
|
||||||
|
int Set(const wxString& item, wxClientData * clientData);
|
||||||
|
void Set(const wxArrayString& stringsArray);
|
||||||
|
void Set(unsigned int n, const wxString* strings);
|
||||||
|
void Set(unsigned int n, const wxString* strings,
|
||||||
|
void ** clientData);
|
||||||
|
void Set(unsigned int n, const wxString* strings,
|
||||||
|
wxClientData ** clientData);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Associates the given untyped client data pointer with the given item. Note that
|
||||||
|
it is an error to call this function if any typed client data pointers had been
|
||||||
|
associated with the control items before.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The zero-based item index.
|
||||||
|
|
||||||
|
@param data
|
||||||
|
The client data to associate with the item.
|
||||||
|
*/
|
||||||
|
void SetClientData(unsigned int n, void * data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Associates the given typed client data pointer with the given item: the
|
||||||
|
@e data object will be deleted when the item is deleted (either explicitly
|
||||||
|
by using @ref delete() Deletes or implicitly when the
|
||||||
|
control itself is destroyed).
|
||||||
|
|
||||||
|
Note that it is an error to call this function if any untyped client data
|
||||||
|
pointers had been associated with the control items before.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The zero-based item index.
|
||||||
|
|
||||||
|
@param data
|
||||||
|
The client data to associate with the item.
|
||||||
|
*/
|
||||||
|
void SetClientObject(unsigned int n, wxClientData * data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the selection to the given item @e n or removes the selection entirely
|
||||||
|
if @e n == @c wxNOT_FOUND.
|
||||||
|
|
||||||
|
Note that this does not cause any command events to be emitted nor does it
|
||||||
|
deselect any other items in the controls which support multiple selections.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The string position to select, starting from zero.
|
||||||
|
|
||||||
|
@sa SetString(), SetStringSelection()
|
||||||
|
*/
|
||||||
|
void SetSelection(int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the label for the given item.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The zero-based item index.
|
||||||
|
|
||||||
|
@param string
|
||||||
|
The label to set.
|
||||||
|
*/
|
||||||
|
void SetString(unsigned int n, const wxString& string);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Selects the item with the specified string in the control. This doesn't cause
|
||||||
|
any command events to be emitted.
|
||||||
|
|
||||||
|
@param string
|
||||||
|
The string to select.
|
||||||
|
|
||||||
|
@returns @true if the specified string has been selected, @false if it
|
||||||
|
wasn't found in the control.
|
||||||
|
*/
|
||||||
|
bool SetStringSelection(const wxString& string);
|
||||||
|
};
|
||||||
282
interface/cursor.h
Normal file
282
interface/cursor.h
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: cursor.h
|
||||||
|
// Purpose: documentation for wxCursor class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCursor
|
||||||
|
@wxheader{cursor.h}
|
||||||
|
|
||||||
|
A cursor is a small bitmap usually used for denoting where the mouse
|
||||||
|
pointer is, with a picture that might indicate the interpretation of a
|
||||||
|
mouse click. As with icons, cursors in X and MS Windows are created
|
||||||
|
in a different manner. Therefore, separate cursors will be created for the
|
||||||
|
different environments. Platform-specific methods for creating a @b wxCursor
|
||||||
|
object are catered for, and this is an occasion where
|
||||||
|
conditional compilation will probably be required (see wxIcon for
|
||||||
|
an example).
|
||||||
|
|
||||||
|
A single cursor object may be used in many windows (any subwindow type).
|
||||||
|
The wxWidgets convention is to set the cursor for a window, as in X,
|
||||||
|
rather than to set it globally as in MS Windows, although a
|
||||||
|
global ::wxSetCursor is also available for MS Windows use.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{gdi}
|
||||||
|
|
||||||
|
@stdobjects
|
||||||
|
Objects:
|
||||||
|
wxNullCursor
|
||||||
|
Pointers:
|
||||||
|
wxSTANDARD_CURSOR
|
||||||
|
|
||||||
|
wxHOURGLASS_CURSOR
|
||||||
|
|
||||||
|
wxCROSS_CURSOR
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxBitmap, wxIcon, wxWindow::SetCursor, ::wxSetCursor
|
||||||
|
*/
|
||||||
|
class wxCursor : public wxBitmap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Copy constructor, uses @ref overview_trefcount "reference counting".
|
||||||
|
|
||||||
|
@param bits
|
||||||
|
An array of bits.
|
||||||
|
|
||||||
|
@param maskBits
|
||||||
|
Bits for a mask bitmap.
|
||||||
|
|
||||||
|
@param width
|
||||||
|
Cursor width.
|
||||||
|
|
||||||
|
@param height
|
||||||
|
Cursor height.
|
||||||
|
|
||||||
|
@param hotSpotX
|
||||||
|
Hotspot x coordinate.
|
||||||
|
|
||||||
|
@param hotSpotY
|
||||||
|
Hotspot y coordinate.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
Icon type to load. Under Motif, type defaults to wxBITMAP_TYPE_XBM. Under
|
||||||
|
Windows,
|
||||||
|
it defaults to wxBITMAP_TYPE_CUR_RESOURCE. Under MacOS, it defaults to
|
||||||
|
wxBITMAP_TYPE_MACCURSOR_RESOURCE.
|
||||||
|
|
||||||
|
Under X, the permitted cursor types are:
|
||||||
|
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_XBM
|
||||||
|
|
||||||
|
|
||||||
|
Load an X bitmap file.
|
||||||
|
|
||||||
|
Under Windows, the permitted types are:
|
||||||
|
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_CUR
|
||||||
|
|
||||||
|
|
||||||
|
Load a cursor from a .cur cursor file (only if USE_RESOURCE_LOADING_IN_MSW
|
||||||
|
is enabled in setup.h).
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_CUR_RESOURCE
|
||||||
|
|
||||||
|
|
||||||
|
Load a Windows resource (as specified in the .rc file).
|
||||||
|
|
||||||
|
wxBITMAP_TYPE_ICO
|
||||||
|
|
||||||
|
|
||||||
|
Load a cursor from a .ico icon file (only if USE_RESOURCE_LOADING_IN_MSW
|
||||||
|
is enabled in setup.h). Specify hotSpotX and hotSpotY.
|
||||||
|
|
||||||
|
@param cursorId
|
||||||
|
A stock cursor identifier. May be one of:
|
||||||
|
|
||||||
|
|
||||||
|
wxCURSOR_ARROW
|
||||||
|
|
||||||
|
|
||||||
|
A standard arrow cursor.
|
||||||
|
|
||||||
|
wxCURSOR_RIGHT_ARROW
|
||||||
|
|
||||||
|
|
||||||
|
A standard arrow cursor
|
||||||
|
pointing to the right.
|
||||||
|
|
||||||
|
wxCURSOR_BLANK
|
||||||
|
|
||||||
|
|
||||||
|
Transparent cursor.
|
||||||
|
|
||||||
|
wxCURSOR_BULLSEYE
|
||||||
|
|
||||||
|
|
||||||
|
Bullseye cursor.
|
||||||
|
|
||||||
|
wxCURSOR_CHAR
|
||||||
|
|
||||||
|
|
||||||
|
Rectangular character cursor.
|
||||||
|
|
||||||
|
wxCURSOR_CROSS
|
||||||
|
|
||||||
|
|
||||||
|
A cross cursor.
|
||||||
|
|
||||||
|
wxCURSOR_HAND
|
||||||
|
|
||||||
|
|
||||||
|
A hand cursor.
|
||||||
|
|
||||||
|
wxCURSOR_IBEAM
|
||||||
|
|
||||||
|
|
||||||
|
An I-beam cursor (vertical line).
|
||||||
|
|
||||||
|
wxCURSOR_LEFT_BUTTON
|
||||||
|
|
||||||
|
|
||||||
|
Represents a mouse with the left button depressed.
|
||||||
|
|
||||||
|
wxCURSOR_MAGNIFIER
|
||||||
|
|
||||||
|
|
||||||
|
A magnifier icon.
|
||||||
|
|
||||||
|
wxCURSOR_MIDDLE_BUTTON
|
||||||
|
|
||||||
|
|
||||||
|
Represents a mouse with the middle button depressed.
|
||||||
|
|
||||||
|
wxCURSOR_NO_ENTRY
|
||||||
|
|
||||||
|
|
||||||
|
A no-entry sign cursor.
|
||||||
|
|
||||||
|
wxCURSOR_PAINT_BRUSH
|
||||||
|
|
||||||
|
|
||||||
|
A paintbrush cursor.
|
||||||
|
|
||||||
|
wxCURSOR_PENCIL
|
||||||
|
|
||||||
|
|
||||||
|
A pencil cursor.
|
||||||
|
|
||||||
|
wxCURSOR_POINT_LEFT
|
||||||
|
|
||||||
|
|
||||||
|
A cursor that points left.
|
||||||
|
|
||||||
|
wxCURSOR_POINT_RIGHT
|
||||||
|
|
||||||
|
|
||||||
|
A cursor that points right.
|
||||||
|
|
||||||
|
wxCURSOR_QUESTION_ARROW
|
||||||
|
|
||||||
|
|
||||||
|
An arrow and question mark.
|
||||||
|
|
||||||
|
wxCURSOR_RIGHT_BUTTON
|
||||||
|
|
||||||
|
|
||||||
|
Represents a mouse with the right button depressed.
|
||||||
|
|
||||||
|
wxCURSOR_SIZENESW
|
||||||
|
|
||||||
|
|
||||||
|
A sizing cursor pointing NE-SW.
|
||||||
|
|
||||||
|
wxCURSOR_SIZENS
|
||||||
|
|
||||||
|
|
||||||
|
A sizing cursor pointing N-S.
|
||||||
|
|
||||||
|
wxCURSOR_SIZENWSE
|
||||||
|
|
||||||
|
|
||||||
|
A sizing cursor pointing NW-SE.
|
||||||
|
|
||||||
|
wxCURSOR_SIZEWE
|
||||||
|
|
||||||
|
|
||||||
|
A sizing cursor pointing W-E.
|
||||||
|
|
||||||
|
wxCURSOR_SIZING
|
||||||
|
|
||||||
|
|
||||||
|
A general sizing cursor.
|
||||||
|
|
||||||
|
wxCURSOR_SPRAYCAN
|
||||||
|
|
||||||
|
|
||||||
|
A spraycan cursor.
|
||||||
|
|
||||||
|
wxCURSOR_WAIT
|
||||||
|
|
||||||
|
|
||||||
|
A wait cursor.
|
||||||
|
|
||||||
|
wxCURSOR_WATCH
|
||||||
|
|
||||||
|
|
||||||
|
A watch cursor.
|
||||||
|
|
||||||
|
wxCURSOR_ARROWWAIT
|
||||||
|
|
||||||
|
|
||||||
|
A cursor with both an arrow and
|
||||||
|
an hourglass, (windows.)
|
||||||
|
|
||||||
|
Note that not all cursors are available on all platforms.
|
||||||
|
|
||||||
|
@param cursor
|
||||||
|
Pointer or reference to a cursor to copy.
|
||||||
|
*/
|
||||||
|
wxCursor();
|
||||||
|
wxCursor(const char bits[], int width, int height,
|
||||||
|
int hotSpotX=-1, int hotSpotY=-1,
|
||||||
|
const char maskBits[]=@NULL,
|
||||||
|
wxColour* fg=@NULL,
|
||||||
|
wxColour* bg=@NULL);
|
||||||
|
wxCursor(const wxString& cursorName, long type,
|
||||||
|
int hotSpotX=0, int hotSpotY=0);
|
||||||
|
wxCursor(int cursorId);
|
||||||
|
wxCursor(const wxImage& image);
|
||||||
|
wxCursor(const wxCursor& cursor);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroys the cursor.
|
||||||
|
See @ref overview_refcountdestruct "reference-counted object destruction" for
|
||||||
|
more info.
|
||||||
|
|
||||||
|
A cursor can be reused for more
|
||||||
|
than one window, and does not get destroyed when the window is
|
||||||
|
destroyed. wxWidgets destroys all cursors on application exit, although
|
||||||
|
it is best to clean them up explicitly.
|
||||||
|
*/
|
||||||
|
~wxCursor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if cursor data is present.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assignment operator, using @ref overview_trefcount "reference counting".
|
||||||
|
*/
|
||||||
|
wxCursor operator =(const wxCursor& cursor);
|
||||||
|
};
|
||||||
711
interface/dataobj.h
Normal file
711
interface/dataobj.h
Normal file
@@ -0,0 +1,711 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dataobj.h
|
||||||
|
// Purpose: documentation for wxCustomDataObject class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxCustomDataObject
|
||||||
|
@wxheader{dataobj.h}
|
||||||
|
|
||||||
|
wxCustomDataObject is a specialization of
|
||||||
|
wxDataObjectSimple for some
|
||||||
|
application-specific data in arbitrary (either custom or one of the standard
|
||||||
|
ones). The only restriction is that it is supposed that this data can be
|
||||||
|
copied bitwise (i.e. with @c memcpy()), so it would be a bad idea to make
|
||||||
|
it contain a C++ object (though C struct is fine).
|
||||||
|
|
||||||
|
By default, wxCustomDataObject stores the data inside in a buffer. To put the
|
||||||
|
data into the buffer you may use either
|
||||||
|
wxCustomDataObject::SetData or
|
||||||
|
wxCustomDataObject::TakeData depending on whether you want
|
||||||
|
the object to make a copy of data or not.
|
||||||
|
|
||||||
|
If you already store the data in another place, it may be more convenient and
|
||||||
|
efficient to provide the data on-demand which is possible too if you override
|
||||||
|
the virtual functions mentioned below.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDataObject
|
||||||
|
*/
|
||||||
|
class wxCustomDataObject : public wxDataObjectSimple
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
The constructor accepts a @e format argument which specifies the (single)
|
||||||
|
format supported by this object. If it isn't set here,
|
||||||
|
wxDataObjectSimple::SetFormat should be used.
|
||||||
|
*/
|
||||||
|
wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The destructor will free the data hold by the object. Notice that although it
|
||||||
|
calls a virtual Free() function, the base
|
||||||
|
class version will always be called (C++ doesn't allow calling virtual
|
||||||
|
functions from constructors or destructors), so if you override @c Free(), you
|
||||||
|
should override the destructor in your class as well (which would probably
|
||||||
|
just call the derived class' version of @c Free()).
|
||||||
|
*/
|
||||||
|
~wxCustomDataObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called to allocate @e size bytes of memory from SetData().
|
||||||
|
The default version just uses the operator new.
|
||||||
|
*/
|
||||||
|
virtual void * Alloc(size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called when the data is freed, you may override it to anything
|
||||||
|
you want (or may be nothing at all). The default version calls operator
|
||||||
|
delete[] on the data.
|
||||||
|
*/
|
||||||
|
virtual void Free();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the data.
|
||||||
|
*/
|
||||||
|
virtual void * GetData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the data size in bytes.
|
||||||
|
*/
|
||||||
|
virtual size_t GetSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the data. The data object will make an internal copy.
|
||||||
|
*/
|
||||||
|
virtual void SetData(size_t size, const void data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Like SetData(), but doesn't copy the data -
|
||||||
|
instead the object takes ownership of the pointer.
|
||||||
|
|
||||||
|
@b wxPython note: This method expects a string in wxPython. You can pass
|
||||||
|
nearly any object by pickling it first.
|
||||||
|
*/
|
||||||
|
virtual void TakeData(size_t size, const void data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDataObjectComposite
|
||||||
|
@wxheader{dataobj.h}
|
||||||
|
|
||||||
|
wxDataObjectComposite is the simplest
|
||||||
|
wxDataObject derivation which may be used to support
|
||||||
|
multiple formats. It contains several
|
||||||
|
wxDataObjectSimple objects and supports any
|
||||||
|
format supported by at least one of them. Only one of these data objects is
|
||||||
|
@e preferred (the first one if not explicitly changed by using the second
|
||||||
|
parameter of wxDataObjectComposite::Add) and its format determines
|
||||||
|
the preferred format of the composite data object as well.
|
||||||
|
|
||||||
|
See wxDataObject documentation for the reasons why you
|
||||||
|
might prefer to use wxDataObject directly instead of wxDataObjectComposite for
|
||||||
|
efficiency reasons.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Clipboard and drag and drop overview",
|
||||||
|
wxDataObject, wxDataObjectSimple, wxFileDataObject, wxTextDataObject, wxBitmapDataObject
|
||||||
|
*/
|
||||||
|
class wxDataObjectComposite : public wxDataObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
The default constructor.
|
||||||
|
*/
|
||||||
|
wxDataObjectComposite();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds the @e dataObject to the list of supported objects and it becomes the
|
||||||
|
preferred object if @e preferred is @true.
|
||||||
|
*/
|
||||||
|
#define void Add(wxDataObjectSimple dataObject, bool preferred = @false) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Report the format passed to the SetData method. This should be the
|
||||||
|
format of the data object within the composite that recieved data from
|
||||||
|
the clipboard or the DnD operation. You can use this method to find
|
||||||
|
out what kind of data object was recieved.
|
||||||
|
*/
|
||||||
|
wxDataFormat GetReceivedFormat();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDataObjectSimple
|
||||||
|
@wxheader{dataobj.h}
|
||||||
|
|
||||||
|
This is the simplest possible implementation of the
|
||||||
|
wxDataObject class. The data object of (a class derived
|
||||||
|
from) this class only supports one format, so the number of virtual functions
|
||||||
|
to be implemented is reduced.
|
||||||
|
|
||||||
|
Notice that this is still an abstract base class and cannot be used but should
|
||||||
|
be derived from.
|
||||||
|
|
||||||
|
@b wxPython note: If you wish to create a derived wxDataObjectSimple class in
|
||||||
|
wxPython you should derive the class from wxPyDataObjectSimple
|
||||||
|
in order to get Python-aware capabilities for the various virtual
|
||||||
|
methods.
|
||||||
|
|
||||||
|
@b wxPerl note: In wxPerl, you need to derive your data object class
|
||||||
|
from Wx::PlDataObjectSimple.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Clipboard and drag and drop overview", @ref
|
||||||
|
overview_samplednd "DnD sample", wxFileDataObject, wxTextDataObject, wxBitmapDataObject
|
||||||
|
*/
|
||||||
|
class wxDataObjectSimple : public wxDataObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor accepts the supported format (none by default) which may also be
|
||||||
|
set later with SetFormat().
|
||||||
|
*/
|
||||||
|
wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copy the data to the buffer, return @true on success. Must be implemented in the
|
||||||
|
derived class if the object supports rendering its data.
|
||||||
|
*/
|
||||||
|
virtual bool GetDataHere(void buf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the size of our data. Must be implemented in the derived class if the
|
||||||
|
object supports rendering its data.
|
||||||
|
*/
|
||||||
|
virtual size_t GetDataSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the (one and only one) format supported by this object. It is supposed
|
||||||
|
that the format is supported in both directions.
|
||||||
|
*/
|
||||||
|
const wxDataFormat GetFormat();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copy the data from the buffer, return @true on success. Must be implemented in
|
||||||
|
the derived class if the object supports setting its data.
|
||||||
|
|
||||||
|
@b wxPython note: When implementing this method in wxPython, the data comes
|
||||||
|
as a single string parameter rather than the two shown here.
|
||||||
|
*/
|
||||||
|
virtual bool SetData(size_t len, const void buf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the supported format.
|
||||||
|
*/
|
||||||
|
void SetFormat(const wxDataFormat& format);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxBitmapDataObject
|
||||||
|
@wxheader{dataobj.h}
|
||||||
|
|
||||||
|
wxBitmapDataObject is a specialization of wxDataObject for bitmap data. It can
|
||||||
|
be used without change to paste data into the
|
||||||
|
wxClipboard or a wxDropSource. A
|
||||||
|
user may wish to derive a new class from this class for providing a bitmap
|
||||||
|
on-demand in order to minimize memory consumption when offering data in several
|
||||||
|
formats, such as a bitmap and GIF.
|
||||||
|
|
||||||
|
@b wxPython note: If you wish to create a derived wxBitmapDataObject class in
|
||||||
|
wxPython you should derive the class from wxPyBitmapDataObject
|
||||||
|
in order to get Python-aware capabilities for the various virtual
|
||||||
|
methods.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Clipboard and drag and drop overview",
|
||||||
|
wxDataObject, wxDataObjectSimple, wxFileDataObject, wxTextDataObject, wxDataObject
|
||||||
|
*/
|
||||||
|
class wxBitmapDataObject : public wxDataObjectSimple
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor, optionally passing a bitmap (otherwise use
|
||||||
|
SetBitmap() later).
|
||||||
|
*/
|
||||||
|
wxBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the bitmap associated with the data object. You may wish to override
|
||||||
|
this method when offering data on-demand, but this is not required by
|
||||||
|
wxWidgets' internals. Use this method to get data in bitmap form from
|
||||||
|
the wxClipboard.
|
||||||
|
*/
|
||||||
|
virtual wxBitmap GetBitmap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the bitmap associated with the data object. This method is called when the
|
||||||
|
data object receives data. Usually there will be no reason to override this
|
||||||
|
function.
|
||||||
|
*/
|
||||||
|
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDataFormat
|
||||||
|
@wxheader{dataobj.h}
|
||||||
|
|
||||||
|
A wxDataFormat is an encapsulation of a platform-specific format handle which
|
||||||
|
is used by the system for the clipboard and drag and drop operations. The
|
||||||
|
applications are usually only interested in, for example, pasting data from the
|
||||||
|
clipboard only if the data is in a format the program understands and a data
|
||||||
|
format is something which uniquely identifies this format.
|
||||||
|
|
||||||
|
On the system level, a data format is usually just a number (@c CLIPFORMAT
|
||||||
|
under Windows or @c Atom under X11, for example) and the standard formats
|
||||||
|
are, indeed, just numbers which can be implicitly converted to wxDataFormat.
|
||||||
|
The standard formats are:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
wxDF_INVALID
|
||||||
|
|
||||||
|
|
||||||
|
An invalid format - used as default argument for
|
||||||
|
functions taking a wxDataFormat argument sometimes
|
||||||
|
|
||||||
|
|
||||||
|
wxDF_TEXT
|
||||||
|
|
||||||
|
|
||||||
|
Text format (wxString)
|
||||||
|
|
||||||
|
|
||||||
|
wxDF_BITMAP
|
||||||
|
|
||||||
|
|
||||||
|
A bitmap (wxBitmap)
|
||||||
|
|
||||||
|
|
||||||
|
wxDF_METAFILE
|
||||||
|
|
||||||
|
|
||||||
|
A metafile (wxMetafile, Windows only)
|
||||||
|
|
||||||
|
|
||||||
|
wxDF_FILENAME
|
||||||
|
|
||||||
|
|
||||||
|
A list of filenames
|
||||||
|
|
||||||
|
|
||||||
|
wxDF_HTML
|
||||||
|
|
||||||
|
|
||||||
|
An HTML string. This is only valid when passed to wxSetClipboardData
|
||||||
|
when compiled with Visual C++ in non-Unicode mode
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
As mentioned above, these standard formats may be passed to any function taking
|
||||||
|
wxDataFormat argument because wxDataFormat has an implicit conversion from
|
||||||
|
them (or, to be precise from the type @c wxDataFormat::NativeFormat which is
|
||||||
|
the type used by the underlying platform for data formats).
|
||||||
|
|
||||||
|
Aside the standard formats, the application may also use custom formats which
|
||||||
|
are identified by their names (strings) and not numeric identifiers. Although
|
||||||
|
internally custom format must be created (or @e registered) first, you
|
||||||
|
shouldn't care about it because it is done automatically the first time the
|
||||||
|
wxDataFormat object corresponding to a given format name is created. The only
|
||||||
|
implication of this is that you should avoid having global wxDataFormat objects
|
||||||
|
with non-default constructor because their constructors are executed before the
|
||||||
|
program has time to perform all necessary initialisations and so an attempt to
|
||||||
|
do clipboard format registration at this time will usually lead to a crash!
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Clipboard and drag and drop overview", @ref
|
||||||
|
overview_samplednd "DnD sample", wxDataObject
|
||||||
|
*/
|
||||||
|
class wxDataFormat
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructs a data format object for a custom format identified by its name
|
||||||
|
@e format.
|
||||||
|
*/
|
||||||
|
wxDataFormat(const wxChar format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the name of a custom format (this function will fail for a standard
|
||||||
|
format).
|
||||||
|
*/
|
||||||
|
wxString GetId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the platform-specific number identifying the format.
|
||||||
|
*/
|
||||||
|
NativeFormat GetType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the format to be the custom format identified by the given name.
|
||||||
|
*/
|
||||||
|
void SetId(const wxChar format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the format to the given value, which should be one of wxDF_XXX constants.
|
||||||
|
*/
|
||||||
|
void SetType(NativeFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the formats are different.
|
||||||
|
*/
|
||||||
|
bool operator !=(const wxDataFormat& format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the formats are equal.
|
||||||
|
*/
|
||||||
|
bool operator ==(const wxDataFormat& format);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxURLDataObject
|
||||||
|
@wxheader{dataobj.h}
|
||||||
|
|
||||||
|
wxURLDataObject is a wxDataObject containing an URL
|
||||||
|
and can be used e.g. when you need to put an URL on or retrieve it from the
|
||||||
|
clipboard:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxTheClipboard-SetData(new wxURLDataObject(url));
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Clipboard and drag and drop overview", wxDataObject
|
||||||
|
*/
|
||||||
|
class wxURLDataObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor, may be used to initialize the URL. If @e url is empty,
|
||||||
|
SetURL() can be used later.
|
||||||
|
*/
|
||||||
|
wxURLDataObject(const wxString& url = wxEmptyString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the URL stored by this object, as a string.
|
||||||
|
*/
|
||||||
|
#define wxString GetURL() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the URL stored by this object.
|
||||||
|
*/
|
||||||
|
#define void SetURL(const wxString& url) /* implementation is private */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDataObject
|
||||||
|
@wxheader{dataobj.h}
|
||||||
|
|
||||||
|
A wxDataObject represents data that can be copied to or from the clipboard, or
|
||||||
|
dragged and dropped. The important thing about wxDataObject is that this is a
|
||||||
|
'smart' piece of data unlike 'dumb' data containers such as memory
|
||||||
|
buffers or files. Being 'smart' here means that the data object itself should
|
||||||
|
know what data formats it supports and how to render itself in each of
|
||||||
|
its supported formats.
|
||||||
|
|
||||||
|
A supported format, incidentally, is exactly the format in which the data can
|
||||||
|
be requested from a data object or from which the data object may be set. In
|
||||||
|
the general case, an object may support different formats on 'input' and
|
||||||
|
'output', i.e. it may be able to render itself in a given format but not be
|
||||||
|
created from data on this format or vice versa. wxDataObject defines an
|
||||||
|
enumeration type
|
||||||
|
|
||||||
|
@code
|
||||||
|
enum Direction
|
||||||
|
{
|
||||||
|
Get = 0x01, // format is supported by GetDataHere()
|
||||||
|
Set = 0x02 // format is supported by SetData()
|
||||||
|
};
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
which distinguishes between them. See
|
||||||
|
wxDataFormat documentation for more about formats.
|
||||||
|
|
||||||
|
Not surprisingly, being 'smart' comes at a price of added complexity. This is
|
||||||
|
reasonable for the situations when you really need to support multiple formats,
|
||||||
|
but may be annoying if you only want to do something simple like cut and paste
|
||||||
|
text.
|
||||||
|
|
||||||
|
To provide a solution for both cases, wxWidgets has two predefined classes
|
||||||
|
which derive from wxDataObject: wxDataObjectSimple and
|
||||||
|
wxDataObjectComposite.
|
||||||
|
wxDataObjectSimple is
|
||||||
|
the simplest wxDataObject possible and only holds data in a single format (such
|
||||||
|
as HTML or text) and wxDataObjectComposite is
|
||||||
|
the simplest way to implement a wxDataObject that does support multiple formats
|
||||||
|
because it achieves this by simply holding several wxDataObjectSimple objects.
|
||||||
|
|
||||||
|
So, you have several solutions when you need a wxDataObject class (and you need
|
||||||
|
one as soon as you want to transfer data via the clipboard or drag and drop):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@b 1. Use one of the built-in classes
|
||||||
|
|
||||||
|
|
||||||
|
You may use wxTextDataObject,
|
||||||
|
wxBitmapDataObject or wxFileDataObject in the simplest cases when you only need
|
||||||
|
to support one format and your data is either text, bitmap or list of files.
|
||||||
|
|
||||||
|
|
||||||
|
@b 2. Use wxDataObjectSimple
|
||||||
|
|
||||||
|
|
||||||
|
Deriving from wxDataObjectSimple is the simplest
|
||||||
|
solution for custom data - you will only support one format and so probably
|
||||||
|
won't be able to communicate with other programs, but data transfer will work
|
||||||
|
in your program (or between different copies of it).
|
||||||
|
|
||||||
|
|
||||||
|
@b 3. Use wxDataObjectComposite
|
||||||
|
|
||||||
|
|
||||||
|
This is a simple but powerful
|
||||||
|
solution which allows you to support any number of formats (either
|
||||||
|
standard or custom if you combine it with the previous solution).
|
||||||
|
|
||||||
|
|
||||||
|
@b 4. Use wxDataObject directly
|
||||||
|
|
||||||
|
|
||||||
|
This is the solution for
|
||||||
|
maximal flexibility and efficiency, but it is also the most difficult to
|
||||||
|
implement.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Please note that the easiest way to use drag and drop and the clipboard with
|
||||||
|
multiple formats is by using wxDataObjectComposite, but it is not the most
|
||||||
|
efficient one as each wxDataObjectSimple would contain the whole data in its
|
||||||
|
respective formats. Now imagine that you want to paste 200 pages of text in
|
||||||
|
your proprietary format, as well as Word, RTF, HTML, Unicode and plain text to
|
||||||
|
the clipboard and even today's computers are in trouble. For this case, you
|
||||||
|
will have to derive from wxDataObject directly and make it enumerate its
|
||||||
|
formats and provide the data in the requested format on demand.
|
||||||
|
|
||||||
|
Note that neither the GTK+ data transfer mechanisms for clipboard and
|
||||||
|
drag and drop, nor OLE data transfer, copy any data until another application
|
||||||
|
actually requests the data. This is in contrast to the 'feel' offered to the
|
||||||
|
user of a program who would normally think that the data resides in the
|
||||||
|
clipboard after having pressed 'Copy' - in reality it is only declared to be
|
||||||
|
available.
|
||||||
|
|
||||||
|
There are several predefined data object classes derived from
|
||||||
|
wxDataObjectSimple: wxFileDataObject,
|
||||||
|
wxTextDataObject,
|
||||||
|
wxBitmapDataObject and
|
||||||
|
wxURLDataObject
|
||||||
|
which can be used without change.
|
||||||
|
|
||||||
|
You may also derive your own data object classes from
|
||||||
|
wxCustomDataObject for user-defined types. The
|
||||||
|
format of user-defined data is given as a mime-type string literal, such as
|
||||||
|
"application/word" or "image/png". These strings are used as they are under
|
||||||
|
Unix (so far only GTK+) to identify a format and are translated into their
|
||||||
|
Windows equivalent under Win32 (using the OLE IDataObject for data exchange to
|
||||||
|
and from the clipboard and for drag and drop). Note that the format string
|
||||||
|
translation under Windows is not yet finished.
|
||||||
|
|
||||||
|
@b wxPython note: At this time this class is not directly usable from wxPython.
|
||||||
|
Derive a class from wxPyDataObjectSimple
|
||||||
|
instead.
|
||||||
|
|
||||||
|
@b wxPerl note: This class is not currently usable from wxPerl; you may
|
||||||
|
use Wx::PlDataObjectSimple instead.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Clipboard and drag and drop overview", @ref
|
||||||
|
overview_samplednd "DnD sample", wxFileDataObject, wxTextDataObject, wxBitmapDataObject, wxCustomDataObject, wxDropTarget, wxDropSource, wxTextDropTarget, wxFileDropTarget
|
||||||
|
*/
|
||||||
|
class wxDataObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxDataObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxDataObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copy all supported formats in the given direction to the array pointed to by
|
||||||
|
@e formats. There is enough space for GetFormatCount(dir) formats in it.
|
||||||
|
*/
|
||||||
|
virtual void GetAllFormats(wxDataFormat * formats,
|
||||||
|
Direction dir = Get);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The method will write the data of the format @e format in the buffer @e buf and
|
||||||
|
return @true on success, @false on failure.
|
||||||
|
*/
|
||||||
|
virtual bool GetDataHere(const wxDataFormat& format, void buf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the data size of the given format @e format.
|
||||||
|
*/
|
||||||
|
virtual size_t GetDataSize(const wxDataFormat& format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of available formats for rendering or setting the data.
|
||||||
|
*/
|
||||||
|
virtual size_t GetFormatCount(Direction dir = Get);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the preferred format for either rendering the data (if @e dir is @c Get,
|
||||||
|
its default value) or for setting it. Usually this will be the
|
||||||
|
native format of the wxDataObject.
|
||||||
|
*/
|
||||||
|
virtual wxDataFormat GetPreferredFormat(Direction dir = Get);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the data in the format @e format of the length @e len provided in the
|
||||||
|
buffer @e buf.
|
||||||
|
|
||||||
|
Returns @true on success, @false on failure.
|
||||||
|
*/
|
||||||
|
virtual bool SetData(const wxDataFormat& format, size_t len,
|
||||||
|
const void buf);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxTextDataObject
|
||||||
|
@wxheader{dataobj.h}
|
||||||
|
|
||||||
|
wxTextDataObject is a specialization of wxDataObject for text data. It can be
|
||||||
|
used without change to paste data into the wxClipboard
|
||||||
|
or a wxDropSource. A user may wish to derive a new
|
||||||
|
class from this class for providing text on-demand in order to minimize memory
|
||||||
|
consumption when offering data in several formats, such as plain text and RTF
|
||||||
|
because by default the text is stored in a string in this class, but it might
|
||||||
|
as well be generated when requested. For this,
|
||||||
|
wxTextDataObject::GetTextLength and
|
||||||
|
wxTextDataObject::GetText will have to be overridden.
|
||||||
|
|
||||||
|
Note that if you already have the text inside a string, you will not achieve
|
||||||
|
any efficiency gain by overriding these functions because copying wxStrings is
|
||||||
|
already a very efficient operation (data is not actually copied because
|
||||||
|
wxStrings are reference counted).
|
||||||
|
|
||||||
|
@b wxPython note: If you wish to create a derived wxTextDataObject class in
|
||||||
|
wxPython you should derive the class from wxPyTextDataObject
|
||||||
|
in order to get Python-aware capabilities for the various virtual
|
||||||
|
methods.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Clipboard and drag and drop overview",
|
||||||
|
wxDataObject, wxDataObjectSimple, wxFileDataObject, wxBitmapDataObject
|
||||||
|
*/
|
||||||
|
class wxTextDataObject : public wxDataObjectSimple
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor, may be used to initialise the text (otherwise
|
||||||
|
SetText() should be used later).
|
||||||
|
*/
|
||||||
|
wxTextDataObject(const wxString& text = wxEmptyString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the text associated with the data object. You may wish to override
|
||||||
|
this method when offering data on-demand, but this is not required by
|
||||||
|
wxWidgets' internals. Use this method to get data in text form from
|
||||||
|
the wxClipboard.
|
||||||
|
*/
|
||||||
|
virtual wxString GetText();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the data size. By default, returns the size of the text data
|
||||||
|
set in the constructor or using SetText().
|
||||||
|
This can be overridden to provide text size data on-demand. It is recommended
|
||||||
|
to return the text length plus 1 for a trailing zero, but this is not
|
||||||
|
strictly required.
|
||||||
|
*/
|
||||||
|
virtual size_t GetTextLength();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the text associated with the data object. This method is called
|
||||||
|
when the data object receives the data and, by default, copies the text into
|
||||||
|
the member variable. If you want to process the text on the fly you may wish to
|
||||||
|
override this function.
|
||||||
|
*/
|
||||||
|
virtual void SetText(const wxString& strText);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileDataObject
|
||||||
|
@wxheader{dataobj.h}
|
||||||
|
|
||||||
|
wxFileDataObject is a specialization of wxDataObject
|
||||||
|
for file names. The program works with it just as if it were a list of absolute
|
||||||
|
file
|
||||||
|
names, but internally it uses the same format as
|
||||||
|
Explorer and other compatible programs under Windows or GNOME/KDE filemanager
|
||||||
|
under Unix which makes it possible to receive files from them using this
|
||||||
|
class.
|
||||||
|
|
||||||
|
@b Warning: Under all non-Windows platforms this class is currently
|
||||||
|
"input-only", i.e. you can receive the files from another application, but
|
||||||
|
copying (or dragging) file(s) from a wxWidgets application is not currently
|
||||||
|
supported. PS: GTK2 should work as well.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDataObject, wxDataObjectSimple, wxTextDataObject, wxBitmapDataObject,
|
||||||
|
wxDataObject
|
||||||
|
*/
|
||||||
|
class wxFileDataObject : public wxDataObjectSimple
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxFileDataObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@b MSW only: adds a file to the file list represented by this data object.
|
||||||
|
*/
|
||||||
|
virtual void AddFile(const wxString& file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the array of file names.
|
||||||
|
*/
|
||||||
|
const wxArrayString GetFilenames();
|
||||||
|
};
|
||||||
1919
interface/dataview.h
Normal file
1919
interface/dataview.h
Normal file
File diff suppressed because it is too large
Load Diff
166
interface/datectrl.h
Normal file
166
interface/datectrl.h
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: datectrl.h
|
||||||
|
// Purpose: documentation for wxDatePickerCtrl class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDatePickerCtrl
|
||||||
|
@wxheader{datectrl.h}
|
||||||
|
|
||||||
|
This control allows the user to select a date. Unlike
|
||||||
|
wxCalendarCtrl, which is a relatively big control,
|
||||||
|
wxDatePickerCtrl is implemented as a small window showing the currently
|
||||||
|
selected date.
|
||||||
|
The control can be edited using the keyboard, and can also display a popup
|
||||||
|
window for more user-friendly date selection, depending on the styles used and
|
||||||
|
the platform, except PalmOS where date is selected using native dialog.
|
||||||
|
|
||||||
|
It is only available if @c wxUSE_DATEPICKCTRL is set to 1.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxDP_SPIN}:
|
||||||
|
Creates a control without a month calendar drop down but with
|
||||||
|
spin-control-like arrows to change individual date components. This
|
||||||
|
style is not supported by the generic version.
|
||||||
|
@style{wxDP_DROPDOWN}:
|
||||||
|
Creates a control with a month calendar drop-down part from which
|
||||||
|
the user can select a date.
|
||||||
|
@style{wxDP_DEFAULT}:
|
||||||
|
Creates a control with the style that is best supported for the
|
||||||
|
current platform (currently wxDP_SPIN under Windows and
|
||||||
|
wxDP_DROPDOWN elsewhere).
|
||||||
|
@style{wxDP_ALLOWNONE}:
|
||||||
|
With this style, the control allows the user to not enter any valid
|
||||||
|
date at all. Without it - the default - the control always has some
|
||||||
|
valid date.
|
||||||
|
@style{wxDP_SHOWCENTURY}:
|
||||||
|
Forces display of the century in the default date format. Without
|
||||||
|
this style the century could be displayed, or not, depending on the
|
||||||
|
default date representation in the system.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@beginEventTable
|
||||||
|
@event{EVT_DATE_CHANGED(id\, func)}:
|
||||||
|
This event fires when the user changes the current selection in the
|
||||||
|
control.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{miscpickers}
|
||||||
|
@appearance{datepickerctrl.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxCalendarCtrl, wxDateEvent
|
||||||
|
*/
|
||||||
|
class wxDatePickerCtrl : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Initializes the object and calls Create() with
|
||||||
|
all the parameters.
|
||||||
|
*/
|
||||||
|
wxDatePickerCtrl(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxDateTime& dt = wxDefaultDateTime,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "datectrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param parent
|
||||||
|
Parent window, must not be non-@NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The identifier for the control.
|
||||||
|
|
||||||
|
@param dt
|
||||||
|
The initial value of the control, if an invalid date (such as the
|
||||||
|
default value) is used, the control is set to today.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Initial position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Initial size. If left at default value, the control chooses its
|
||||||
|
own best size by using the height approximately equal to a text control and
|
||||||
|
width large enough to show the date string fully.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style, should be left at 0 as there are no
|
||||||
|
special styles for this control in this version.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Validator which can be used for additional date checks.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Control name.
|
||||||
|
|
||||||
|
@returns @true if the control was successfully created or @false if
|
||||||
|
creation failed.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxDateTime& dt = wxDefaultDateTime,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "datectrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
If the control had been previously limited to a range of dates using
|
||||||
|
SetRange(), returns the lower and upper
|
||||||
|
bounds of this range. If no range is set (or only one of the bounds is set),
|
||||||
|
@e dt1 and/or @e dt2 are set to be invalid.
|
||||||
|
|
||||||
|
@param dt1
|
||||||
|
Pointer to the object which receives the lower range limit or
|
||||||
|
becomes invalid if it is not set. May be @NULL if the caller is not
|
||||||
|
interested in lower limit
|
||||||
|
|
||||||
|
@param dt2
|
||||||
|
Same as above but for the upper limit
|
||||||
|
|
||||||
|
@returns @false if no range limits are currently set, @true if at least one
|
||||||
|
bound is set.
|
||||||
|
*/
|
||||||
|
bool GetRange(wxDateTime * dt1, wxDateTime dt2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the currently selected. If there is no selection or the selection is
|
||||||
|
outside of the current range, an invalid object is returned.
|
||||||
|
*/
|
||||||
|
wxDateTime GetValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Please note that this function is only available in the generic version of this
|
||||||
|
control. The native version always uses the current system locale.
|
||||||
|
|
||||||
|
Sets the display format for the date in the control. See wxDateTime for the
|
||||||
|
meaning of format strings.
|
||||||
|
|
||||||
|
@remarks If the format parameter is invalid, the behaviour is undefined.
|
||||||
|
*/
|
||||||
|
void SetFormat(const wxChar* format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the valid range for the date selection. If @e dt1 is valid, it becomes
|
||||||
|
the earliest date (inclusive) accepted by the control. If @e dt2 is valid,
|
||||||
|
it becomes the latest possible date.
|
||||||
|
|
||||||
|
@remarks If the current value of the control is outside of the newly set
|
||||||
|
range bounds, the behaviour is undefined.
|
||||||
|
*/
|
||||||
|
void SetRange(const wxDateTime& dt1, const wxDateTime& dt2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Changes the current value of the control. The date should be valid and included
|
||||||
|
in the currently selected range, if any.
|
||||||
|
|
||||||
|
Calling this method does not result in a date change event.
|
||||||
|
*/
|
||||||
|
void SetValue(const wxDateTime& dt);
|
||||||
|
};
|
||||||
33
interface/dateevt.h
Normal file
33
interface/dateevt.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dateevt.h
|
||||||
|
// Purpose: documentation for wxDateEvent class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDateEvent
|
||||||
|
@wxheader{dateevt.h}
|
||||||
|
|
||||||
|
This event class holds information about a date change and is used together
|
||||||
|
with wxDatePickerCtrl. It also serves as a base class
|
||||||
|
for wxCalendarEvent.
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{events}
|
||||||
|
*/
|
||||||
|
class wxDateEvent : public wxCommandEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Returns the date.
|
||||||
|
*/
|
||||||
|
const wxDateTime GetDate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the date carried by the event, normally only used by the library
|
||||||
|
internally.
|
||||||
|
*/
|
||||||
|
void SetDate(const wxDateTime& date);
|
||||||
|
};
|
||||||
1797
interface/datetime.h
Normal file
1797
interface/datetime.h
Normal file
File diff suppressed because it is too large
Load Diff
263
interface/datstrm.h
Normal file
263
interface/datstrm.h
Normal file
@@ -0,0 +1,263 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: datstrm.h
|
||||||
|
// Purpose: documentation for wxDataOutputStream class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDataOutputStream
|
||||||
|
@wxheader{datstrm.h}
|
||||||
|
|
||||||
|
This class provides functions that write binary data types in a
|
||||||
|
portable way. Data can be written in either big-endian or little-endian
|
||||||
|
format, little-endian being the default on all architectures.
|
||||||
|
|
||||||
|
If you want to write data to text files (or streams) use
|
||||||
|
wxTextOutputStream instead.
|
||||||
|
|
||||||
|
The operator is overloaded and you can use this class like a standard
|
||||||
|
C++ iostream. See wxDataInputStream for its
|
||||||
|
usage and caveats.
|
||||||
|
|
||||||
|
See also wxDataInputStream.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{streams}
|
||||||
|
*/
|
||||||
|
class wxDataOutputStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
Constructs a datastream object from an output stream. Only write methods will
|
||||||
|
be available. The second form is only available in Unicode build of wxWidgets.
|
||||||
|
|
||||||
|
@param stream
|
||||||
|
The output stream.
|
||||||
|
|
||||||
|
@param conv
|
||||||
|
Charset conversion object object used to encoding Unicode
|
||||||
|
strings before writing them to the stream
|
||||||
|
in Unicode mode (see WriteString()
|
||||||
|
documentation for detailed description). Note that you must not destroy
|
||||||
|
conv before you destroy this wxDataOutputStream instance! It is
|
||||||
|
recommended to use default value (UTF-8).
|
||||||
|
*/
|
||||||
|
wxDataOutputStream(wxOutputStream& stream);
|
||||||
|
wxDataOutputStream(wxOutputStream& stream);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroys the wxDataOutputStream object.
|
||||||
|
*/
|
||||||
|
~wxDataOutputStream();
|
||||||
|
|
||||||
|
/**
|
||||||
|
If @e be_order is @true, all data will be written in big-endian
|
||||||
|
order, e.g. for reading on a Sparc or from Java-Streams (which
|
||||||
|
always use big-endian order), otherwise data will be written in
|
||||||
|
little-endian order.
|
||||||
|
*/
|
||||||
|
void BigEndianOrdered(bool be_order);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Writes an array of 16 bit unsigned integer to the stream. The amount of
|
||||||
|
16 bit unsigned integer to write is specified with the @e size variable.
|
||||||
|
*/
|
||||||
|
void Write16(wxUint16 i16);
|
||||||
|
void Write16(const wxUint16 * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Writes an array of 32 bit unsigned integer to the stream. The amount of
|
||||||
|
32 bit unsigned integer to write is specified with the @e size variable.
|
||||||
|
*/
|
||||||
|
void Write32(wxUint32 i32);
|
||||||
|
void Write32(const wxUint32 * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Writes an array of 64 bit unsigned integer to the stream. The amount of
|
||||||
|
64 bit unsigned integer to write is specified with the @e size variable.
|
||||||
|
*/
|
||||||
|
void Write64(wxUint64 i64);
|
||||||
|
void Write64(const wxUint64 * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Writes an array of bytes to the stream. The amount of bytes to write is
|
||||||
|
specified with the @e size variable.
|
||||||
|
*/
|
||||||
|
void Write8(wxUint8 i8);
|
||||||
|
void Write8(const wxUint8 * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Writes an array of double to the stream. The amount of double to write is
|
||||||
|
specified with the @e size variable.
|
||||||
|
*/
|
||||||
|
void WriteDouble(double f);
|
||||||
|
void WriteDouble(const double * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes @e string to the stream. Actually, this method writes the size of
|
||||||
|
the string before writing @e string itself.
|
||||||
|
|
||||||
|
In ANSI build of wxWidgets, the string is written to the stream in exactly
|
||||||
|
same way it is represented in memory. In Unicode build, however, the string
|
||||||
|
is first converted to multibyte representation with @e conv object passed
|
||||||
|
to stream's constructor (consequently, ANSI application can read data
|
||||||
|
written by Unicode application, as long as they agree on encoding) and this
|
||||||
|
representation is written to the stream. UTF-8 is used by default.
|
||||||
|
*/
|
||||||
|
void WriteString(const wxString& string);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDataInputStream
|
||||||
|
@wxheader{datstrm.h}
|
||||||
|
|
||||||
|
This class provides functions that read binary data types in a
|
||||||
|
portable way. Data can be read in either big-endian or little-endian
|
||||||
|
format, little-endian being the default on all architectures.
|
||||||
|
|
||||||
|
If you want to read data from text files (or streams) use
|
||||||
|
wxTextInputStream instead.
|
||||||
|
|
||||||
|
The operator is overloaded and you can use this class like a standard C++
|
||||||
|
iostream.
|
||||||
|
Note, however, that the arguments are the fixed size types wxUint32, wxInt32 etc
|
||||||
|
and on a typical 32-bit computer, none of these match to the "long" type
|
||||||
|
(wxInt32
|
||||||
|
is defined as signed int on 32-bit architectures) so that you cannot use long.
|
||||||
|
To avoid
|
||||||
|
problems (here and elsewhere), make use of the wxInt32, wxUint32, etc types.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxFileInputStream input( "mytext.dat" );
|
||||||
|
wxDataInputStream store( input );
|
||||||
|
wxUint8 i1;
|
||||||
|
float f2;
|
||||||
|
wxString line;
|
||||||
|
|
||||||
|
store i1; // read a 8 bit integer.
|
||||||
|
store i1 f2; // read a 8 bit integer followed by float.
|
||||||
|
store line; // read a text line
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
See also wxDataOutputStream.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{streams}
|
||||||
|
*/
|
||||||
|
class wxDataInputStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
Constructs a datastream object from an input stream. Only read methods will
|
||||||
|
be available. The second form is only available in Unicode build of wxWidgets.
|
||||||
|
|
||||||
|
@param stream
|
||||||
|
The input stream.
|
||||||
|
|
||||||
|
@param conv
|
||||||
|
Charset conversion object object used to decode strings in Unicode
|
||||||
|
mode (see ReadString()
|
||||||
|
documentation for detailed description). Note that you must not destroy
|
||||||
|
conv before you destroy this wxDataInputStream instance!
|
||||||
|
*/
|
||||||
|
wxDataInputStream(wxInputStream& stream);
|
||||||
|
wxDataInputStream(wxInputStream& stream);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroys the wxDataInputStream object.
|
||||||
|
*/
|
||||||
|
~wxDataInputStream();
|
||||||
|
|
||||||
|
/**
|
||||||
|
If @e be_order is @true, all data will be read in big-endian
|
||||||
|
order, such as written by programs on a big endian architecture
|
||||||
|
(e.g. Sparc) or written by Java-Streams (which always use
|
||||||
|
big-endian order).
|
||||||
|
*/
|
||||||
|
void BigEndianOrdered(bool be_order);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Reads 16 bit unsigned integers from the stream in a specified buffer. the
|
||||||
|
amount of 16 bit unsigned integer to read is specified by the @e size variable.
|
||||||
|
*/
|
||||||
|
wxUint16 Read16();
|
||||||
|
void Read16(wxUint16 * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Reads 32 bit unsigned integers from the stream in a specified buffer. the
|
||||||
|
amount of
|
||||||
|
32 bit unsigned integer to read is specified by the @e size variable.
|
||||||
|
*/
|
||||||
|
wxUint32 Read32();
|
||||||
|
void Read32(wxUint32 * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Reads 64 bit unsigned integers from the stream in a specified buffer. the
|
||||||
|
amount of
|
||||||
|
64 bit unsigned integer to read is specified by the @e size variable.
|
||||||
|
*/
|
||||||
|
wxUint64 Read64();
|
||||||
|
void Read64(wxUint64 * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Reads bytes from the stream in a specified buffer. The amount of
|
||||||
|
bytes to read is specified by the @e size variable.
|
||||||
|
*/
|
||||||
|
wxUint8 Read8();
|
||||||
|
void Read8(wxUint8 * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Reads double data (IEEE encoded) from the stream in a specified buffer. the
|
||||||
|
amount of
|
||||||
|
double to read is specified by the @e size variable.
|
||||||
|
*/
|
||||||
|
double ReadDouble();
|
||||||
|
void ReadDouble(double * buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a string from a stream. Actually, this function first reads a long
|
||||||
|
integer specifying the length of the string (without the last null character)
|
||||||
|
and then reads the string.
|
||||||
|
|
||||||
|
In Unicode build of wxWidgets, the fuction first reads multibyte (char*)
|
||||||
|
string from the stream and then converts it to Unicode using the @e conv
|
||||||
|
object passed to constructor and returns the result as wxString. You are
|
||||||
|
responsible for using the same convertor as when writing the stream.
|
||||||
|
|
||||||
|
See also wxDataOutputStream::WriteString.
|
||||||
|
*/
|
||||||
|
wxString ReadString();
|
||||||
|
};
|
||||||
1088
interface/dc.h
Normal file
1088
interface/dc.h
Normal file
File diff suppressed because it is too large
Load Diff
187
interface/dcbuffer.h
Normal file
187
interface/dcbuffer.h
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dcbuffer.h
|
||||||
|
// Purpose: documentation for wxBufferedDC class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxBufferedDC
|
||||||
|
@wxheader{dcbuffer.h}
|
||||||
|
|
||||||
|
This class provides a simple way to avoid flicker: when drawing on it,
|
||||||
|
everything is in fact first drawn on an in-memory buffer (a
|
||||||
|
wxBitmap) and then copied to the screen, using the
|
||||||
|
associated wxDC, only once, when this object is destroyed. wxBufferedDC itself
|
||||||
|
is typically associated with wxClientDC, if you want to
|
||||||
|
use it in your @c EVT_PAINT handler, you should look at
|
||||||
|
wxBufferedPaintDC instead.
|
||||||
|
|
||||||
|
When used like this, a valid @e dc must be specified in the constructor
|
||||||
|
while the @e buffer bitmap doesn't have to be explicitly provided, by
|
||||||
|
default this class will allocate the bitmap of required size itself. However
|
||||||
|
using a dedicated bitmap can speed up the redrawing process by eliminating the
|
||||||
|
repeated creation and destruction of a possibly big bitmap. Otherwise,
|
||||||
|
wxBufferedDC can be used in the same way as any other device context.
|
||||||
|
|
||||||
|
There is another possible use for wxBufferedDC is to use it to maintain a
|
||||||
|
backing store for the window contents. In this case, the associated @e dc
|
||||||
|
may be @NULL but a valid backing store bitmap should be specified.
|
||||||
|
|
||||||
|
Finally, please note that GTK+ 2.0 as well as OS X provide double buffering
|
||||||
|
themselves natively. You can either use wxWindow::IsDoubleBuffered
|
||||||
|
to determine whether you need to use buffering or not, or use
|
||||||
|
wxAutoBufferedPaintDC to avoid needless double
|
||||||
|
buffering on the systems which already do it automatically.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDC, wxMemoryDC, wxBufferedPaintDC, wxAutoBufferedPaintDC
|
||||||
|
*/
|
||||||
|
class wxBufferedDC : public wxMemoryDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
If you use the first, default, constructor, you must call one of the
|
||||||
|
Init() methods later in order to use the object.
|
||||||
|
|
||||||
|
The other constructors initialize the object immediately and @c Init()
|
||||||
|
must not be called after using them.
|
||||||
|
|
||||||
|
@param dc
|
||||||
|
The underlying DC: everything drawn to this object will be
|
||||||
|
flushed to this DC when this object is destroyed. You may pass @NULL
|
||||||
|
in order to just initialize the buffer, and not flush it.
|
||||||
|
|
||||||
|
@param area
|
||||||
|
The size of the bitmap to be used for buffering (this bitmap is
|
||||||
|
created internally when it is not given explicitly).
|
||||||
|
|
||||||
|
@param buffer
|
||||||
|
Explicitly provided bitmap to be used for buffering: this is
|
||||||
|
the most efficient solution as the bitmap doesn't have to be recreated each
|
||||||
|
time but it also requires more memory as the bitmap is never freed. The bitmap
|
||||||
|
should have appropriate size, anything drawn outside of its bounds is clipped.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
wxBUFFER_CLIENT_AREA to indicate that just the client area of
|
||||||
|
the window is buffered, or wxBUFFER_VIRTUAL_AREA to indicate that the buffer
|
||||||
|
bitmap
|
||||||
|
covers the virtual area (in which case PrepareDC is automatically called for
|
||||||
|
the actual window
|
||||||
|
device context).
|
||||||
|
*/
|
||||||
|
wxBufferedDC();
|
||||||
|
wxBufferedDC(wxDC * dc, const wxSize& area,
|
||||||
|
int style = wxBUFFER_CLIENT_AREA);
|
||||||
|
wxBufferedDC(wxDC * dc, wxBitmap& buffer,
|
||||||
|
int style = wxBUFFER_CLIENT_AREA);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copies everything drawn on the DC so far to the underlying DC associated with
|
||||||
|
this object, if any.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
These functions initialize the object created using the default constructor.
|
||||||
|
Please see @ref ctor() "constructors documentation" for details.
|
||||||
|
*/
|
||||||
|
void Init(wxDC * dc, const wxSize& area,
|
||||||
|
int style = wxBUFFER_CLIENT_AREA);
|
||||||
|
void Init(wxDC * dc, wxBitmap& buffer,
|
||||||
|
int style = wxBUFFER_CLIENT_AREA);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxAutoBufferedPaintDC
|
||||||
|
@wxheader{dcbuffer.h}
|
||||||
|
|
||||||
|
This wxDC derivative can be used inside of an @c OnPaint() event handler to
|
||||||
|
achieve
|
||||||
|
double-buffered drawing. Just create an object of this class instead of
|
||||||
|
wxPaintDC
|
||||||
|
and make sure wxWindow::SetBackgroundStyle is called
|
||||||
|
with wxBG_STYLE_CUSTOM somewhere in the class initialization code, and that's
|
||||||
|
all you have
|
||||||
|
to do to (mostly) avoid flicker.
|
||||||
|
|
||||||
|
The difference between wxBufferedPaintDC and this class,
|
||||||
|
is the lightweigthness - on platforms which have native double-buffering,
|
||||||
|
wxAutoBufferedPaintDC is simply
|
||||||
|
a typedef of wxPaintDC. Otherwise, it is a typedef of wxBufferedPaintDC.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{dc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDC, wxBufferedPaintDC
|
||||||
|
*/
|
||||||
|
class wxAutoBufferedPaintDC : public wxBufferedPaintDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Pass a pointer to the window on which you wish to paint.
|
||||||
|
*/
|
||||||
|
wxAutoBufferedPaintDC(wxWindow * window);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxBufferedPaintDC
|
||||||
|
@wxheader{dcbuffer.h}
|
||||||
|
|
||||||
|
This is a subclass of wxBufferedDC which can be used
|
||||||
|
inside of an @c OnPaint() event handler. Just create an object of this class
|
||||||
|
instead
|
||||||
|
of wxPaintDC and make sure wxWindow::SetBackgroundStyle
|
||||||
|
is called with wxBG_STYLE_CUSTOM somewhere in the class initialization code,
|
||||||
|
and that's all
|
||||||
|
you have to do to (mostly) avoid flicker. The only thing to watch out for is
|
||||||
|
that if you are
|
||||||
|
using this class together with wxScrolledWindow, you probably
|
||||||
|
do @b not want to call wxScrolledWindow::PrepareDC on it as it
|
||||||
|
already does this internally for the real underlying wxPaintDC.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDC, wxBufferedDC, wxAutoBufferedPaintDC
|
||||||
|
*/
|
||||||
|
class wxBufferedPaintDC : public wxBufferedDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
As with @ref wxBufferedDC::ctor wxBufferedDC, you may either provide the
|
||||||
|
bitmap to be used for buffering or let this object create one internally (in
|
||||||
|
the latter case, the size of the client part of the window is used).
|
||||||
|
|
||||||
|
Pass wxBUFFER_CLIENT_AREA for the @e style parameter to indicate that just the
|
||||||
|
client area of
|
||||||
|
the window is buffered, or wxBUFFER_VIRTUAL_AREA to indicate that the buffer
|
||||||
|
bitmap
|
||||||
|
covers the virtual area (in which case PrepareDC is automatically called for
|
||||||
|
the actual window
|
||||||
|
device context).
|
||||||
|
*/
|
||||||
|
wxBufferedPaintDC(wxWindow * window, wxBitmap& buffer,
|
||||||
|
int style = wxBUFFER_CLIENT_AREA);
|
||||||
|
wxBufferedPaintDC(wxWindow * window,
|
||||||
|
int style = wxBUFFER_CLIENT_AREA);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copies everything drawn on the DC so far to the window associated with this
|
||||||
|
object, using a wxPaintDC.
|
||||||
|
*/
|
||||||
|
};
|
||||||
105
interface/dcclient.h
Normal file
105
interface/dcclient.h
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dcclient.h
|
||||||
|
// Purpose: documentation for wxPaintDC class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxPaintDC
|
||||||
|
@wxheader{dcclient.h}
|
||||||
|
|
||||||
|
A wxPaintDC must be constructed if an application wishes to paint on the
|
||||||
|
client area of a window from within an @b OnPaint event.
|
||||||
|
This should normally be constructed as a temporary stack object; don't store
|
||||||
|
a wxPaintDC object. If you have an OnPaint handler, you @e must create a
|
||||||
|
wxPaintDC
|
||||||
|
object within it even if you don't actually use it.
|
||||||
|
|
||||||
|
Using wxPaintDC within OnPaint is important because it automatically
|
||||||
|
sets the clipping area to the damaged area of the window. Attempts to draw
|
||||||
|
outside this area do not appear.
|
||||||
|
|
||||||
|
To draw on a window from outside @b OnPaint, construct a wxClientDC object.
|
||||||
|
|
||||||
|
To draw on the whole window including decorations, construct a wxWindowDC object
|
||||||
|
(Windows only).
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDC, wxMemoryDC, wxPaintDC, wxWindowDC, wxScreenDC
|
||||||
|
*/
|
||||||
|
class wxPaintDC : public wxWindowDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Pass a pointer to the window on which you wish to paint.
|
||||||
|
*/
|
||||||
|
wxPaintDC(wxWindow* window);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxClientDC
|
||||||
|
@wxheader{dcclient.h}
|
||||||
|
|
||||||
|
A wxClientDC must be constructed if an application wishes to paint on the
|
||||||
|
client area of a window from outside an @b OnPaint event.
|
||||||
|
This should normally be constructed as a temporary stack object; don't store
|
||||||
|
a wxClientDC object.
|
||||||
|
|
||||||
|
To draw on a window from within @b OnPaint, construct a wxPaintDC object.
|
||||||
|
|
||||||
|
To draw on the whole window including decorations, construct a wxWindowDC object
|
||||||
|
(Windows only).
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDC, wxMemoryDC, wxPaintDC, wxWindowDC, wxScreenDC
|
||||||
|
*/
|
||||||
|
class wxClientDC : public wxWindowDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Pass a pointer to the window on which you wish to paint.
|
||||||
|
*/
|
||||||
|
wxClientDC(wxWindow* window);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxWindowDC
|
||||||
|
@wxheader{dcclient.h}
|
||||||
|
|
||||||
|
A wxWindowDC must be constructed if an application wishes to paint on the
|
||||||
|
whole area of a window (client and decorations).
|
||||||
|
This should normally be constructed as a temporary stack object; don't store
|
||||||
|
a wxWindowDC object.
|
||||||
|
|
||||||
|
To draw on a window from inside @b OnPaint, construct a wxPaintDC object.
|
||||||
|
|
||||||
|
To draw on the client area of a window from outside @b OnPaint, construct a
|
||||||
|
wxClientDC object.
|
||||||
|
|
||||||
|
To draw on the whole window including decorations, construct a wxWindowDC object
|
||||||
|
(Windows only).
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDC, wxMemoryDC, wxPaintDC, wxClientDC, wxScreenDC
|
||||||
|
*/
|
||||||
|
class wxWindowDC : public wxDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Pass a pointer to the window on which you wish to paint.
|
||||||
|
*/
|
||||||
|
wxWindowDC(wxWindow* window);
|
||||||
|
};
|
||||||
72
interface/dcmemory.h
Normal file
72
interface/dcmemory.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dcmemory.h
|
||||||
|
// Purpose: documentation for wxMemoryDC class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxMemoryDC
|
||||||
|
@wxheader{dcmemory.h}
|
||||||
|
|
||||||
|
A memory device context provides a means to draw graphics onto a bitmap. When
|
||||||
|
drawing in to a mono-bitmap, using @c wxWHITE, @c wxWHITE_PEN and
|
||||||
|
@c wxWHITE_BRUSH
|
||||||
|
will draw the background colour (i.e. 0) whereas all other colours will draw the
|
||||||
|
foreground colour (i.e. 1).
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxBitmap, wxDC
|
||||||
|
*/
|
||||||
|
class wxMemoryDC : public wxDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructs a new memory device context and calls SelectObject()
|
||||||
|
with the given bitmap.
|
||||||
|
Use the wxDC::IsOk member to test whether the constructor was successful
|
||||||
|
in creating a usable device context.
|
||||||
|
*/
|
||||||
|
wxMemoryDC();
|
||||||
|
wxMemoryDC(wxBitmap& bitmap);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Works exactly like SelectObjectAsSource() but
|
||||||
|
this is the function you should use when you select a bitmap because you want
|
||||||
|
to modify
|
||||||
|
it, e.g. drawing on this DC.
|
||||||
|
|
||||||
|
Using SelectObjectAsSource() when modifying
|
||||||
|
the bitmap may incurr some problems related to wxBitmap being a reference
|
||||||
|
counted object
|
||||||
|
(see @ref overview_trefcount "reference counting overview").
|
||||||
|
|
||||||
|
Also, before using the updated bitmap data, make sure to select it out of
|
||||||
|
context first
|
||||||
|
(for example by selecting wxNullBitmap into the device context).
|
||||||
|
|
||||||
|
@sa wxDC::DrawBitmap
|
||||||
|
*/
|
||||||
|
void SelectObject(wxBitmap& bitmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Selects the given bitmap into the device context, to use as the memory
|
||||||
|
bitmap. Selecting the bitmap into a memory DC allows you to draw into
|
||||||
|
the DC (and therefore the bitmap) and also to use wxDC::Blit to copy
|
||||||
|
the bitmap to a window. For this purpose, you may find wxDC::DrawIcon
|
||||||
|
easier to use instead.
|
||||||
|
|
||||||
|
If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the
|
||||||
|
current bitmap is
|
||||||
|
selected out of the device context, and the original bitmap restored, allowing
|
||||||
|
the current bitmap to
|
||||||
|
be destroyed safely.
|
||||||
|
*/
|
||||||
|
void SelectObjectAsSource(const wxBitmap& bitmap);
|
||||||
|
};
|
||||||
35
interface/dcmirror.h
Normal file
35
interface/dcmirror.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dcmirror.h
|
||||||
|
// Purpose: documentation for wxMirrorDC class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxMirrorDC
|
||||||
|
@wxheader{dcmirror.h}
|
||||||
|
|
||||||
|
wxMirrorDC is a simple wrapper class which is always associated with a real
|
||||||
|
wxDC object and either forwards all of its operations to it
|
||||||
|
without changes (no mirroring takes place) or exchanges @e x and @e y
|
||||||
|
coordinates which makes it possible to reuse the same code to draw a figure and
|
||||||
|
its mirror -- i.e. reflection related to the diagonal line x == y.
|
||||||
|
|
||||||
|
wxMirrorDC has been added in wxWidgets version 2.5.0.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dc}
|
||||||
|
*/
|
||||||
|
class wxMirrorDC : public wxDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Creates a (maybe) mirrored DC associated with the real @e dc. Everything
|
||||||
|
drawn on wxMirrorDC will appear (and maybe mirrored) on @e dc.
|
||||||
|
|
||||||
|
@e mirror specifies if we do mirror (if it is @true) or not (if it is
|
||||||
|
@false).
|
||||||
|
*/
|
||||||
|
wxMirrorDC(wxDC& dc, bool mirror);
|
||||||
|
};
|
||||||
55
interface/dcprint.h
Normal file
55
interface/dcprint.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dcprint.h
|
||||||
|
// Purpose: documentation for wxPrinterDC class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxPrinterDC
|
||||||
|
@wxheader{dcprint.h}
|
||||||
|
|
||||||
|
A printer device context is specific to MSW and Mac, and allows access to any
|
||||||
|
printer with a Windows or Macintosh driver. See wxDC for further
|
||||||
|
information on device contexts, and wxDC::GetSize for
|
||||||
|
advice on achieving the correct scaling for the page.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{printing}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_printingoverview "Printing framework overview", wxDC
|
||||||
|
*/
|
||||||
|
class wxPrinterDC : public wxDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor. With empty strings for the first three arguments, the default
|
||||||
|
printer dialog is
|
||||||
|
displayed. @e device indicates the type of printer and @e output
|
||||||
|
is an optional file for printing to. The @e driver parameter is
|
||||||
|
currently unused. Use the @e Ok member to test whether the
|
||||||
|
constructor was successful in creating a usable device context.
|
||||||
|
|
||||||
|
This constructor is deprecated and retained only for backward compatibility.
|
||||||
|
*/
|
||||||
|
wxPrinterDC(const wxPrintData& printData);
|
||||||
|
wxPrinterDC(const wxString& driver, const wxString& device,
|
||||||
|
const wxString& output,
|
||||||
|
const bool interactive = @true,
|
||||||
|
int orientation = wxPORTRAIT);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the rectangle in device coordinates that corresponds to the full paper
|
||||||
|
area, including the nonprinting regions of the paper. The point (0,0) in device
|
||||||
|
coordinates is the top left corner of the page rectangle, which is the printable
|
||||||
|
area on MSW and Mac. The coordinates of the top left corner of the paper
|
||||||
|
rectangle will therefore have small negative values, while the bottom right
|
||||||
|
coordinates will be somewhat larger than the values returned by
|
||||||
|
wxDC::GetSize.
|
||||||
|
*/
|
||||||
|
wxRect wxPrinterDC::GetPaperRect();
|
||||||
|
};
|
||||||
145
interface/dcps.h
Normal file
145
interface/dcps.h
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dcps.h
|
||||||
|
// Purpose: documentation for wxPostScriptDC class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxPostScriptDC
|
||||||
|
@wxheader{dcps.h}
|
||||||
|
|
||||||
|
This defines the wxWidgets Encapsulated PostScript device context,
|
||||||
|
which can write PostScript files on any platform. See wxDC for
|
||||||
|
descriptions of the member functions.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{dc}
|
||||||
|
*/
|
||||||
|
class wxPostScriptDC : public wxDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor. @e output is an optional file for printing to, and if
|
||||||
|
@e interactive is @true a dialog box will be displayed for adjusting
|
||||||
|
various parameters. @e parent is the parent of the printer dialog box.
|
||||||
|
|
||||||
|
Use the @e Ok member to test whether the constructor was successful
|
||||||
|
in creating a usable device context.
|
||||||
|
|
||||||
|
See @ref overview_printersettings "Printer settings" for functions to set and
|
||||||
|
get PostScript printing settings.
|
||||||
|
|
||||||
|
This constructor and the global printer settings are now deprecated;
|
||||||
|
use the wxPrintData constructor instead.
|
||||||
|
*/
|
||||||
|
wxPostScriptDC(const wxPrintData& printData);
|
||||||
|
wxPostScriptDC(const wxString& output,
|
||||||
|
bool interactive = @true,
|
||||||
|
wxWindow * parent);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return resolution used in PostScript output. See
|
||||||
|
SetResolution().
|
||||||
|
*/
|
||||||
|
static int GetResolution();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set resolution (in pixels per inch) that will be used in PostScript
|
||||||
|
output. Default is 720ppi.
|
||||||
|
*/
|
||||||
|
static void SetResolution(int ppi);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the printer command used to print a file. The default is @c lpr.
|
||||||
|
*/
|
||||||
|
wxString wxGetPrinterCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the printer command used to print a file. The default is @c lpr.
|
||||||
|
*/
|
||||||
|
void wxSetPrinterCommand(const wxString& command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the orientation (PS_PORTRAIT or PS_LANDSCAPE). The default is PS_PORTRAIT.
|
||||||
|
*/
|
||||||
|
int wxGetPrinterOrientation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the additional options for the print command (e.g. specific printer). The
|
||||||
|
default is nothing.
|
||||||
|
*/
|
||||||
|
void wxSetPrinterOptions(const wxString& options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the translation (from the top left corner) for PostScript output. The
|
||||||
|
default is 0.0, 0.0.
|
||||||
|
*/
|
||||||
|
void wxGetPrinterTranslation(float * x, float * y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the scaling factor for PostScript output. The default is 1.0, 1.0.
|
||||||
|
*/
|
||||||
|
void wxSetPrinterScaling(float x, float y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the orientation (PS_PORTRAIT or PS_LANDSCAPE). The default is PS_PORTRAIT.
|
||||||
|
*/
|
||||||
|
void wxSetPrinterOrientation(int orientation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the printing mode controlling where output is sent (PS_PREVIEW, PS_FILE or
|
||||||
|
PS_PRINTER).
|
||||||
|
The default is PS_PREVIEW.
|
||||||
|
*/
|
||||||
|
void wxSetPrinterMode(int mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the PostScript output filename.
|
||||||
|
*/
|
||||||
|
void wxSetPrinterFile(const wxString& filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the PostScript output filename.
|
||||||
|
*/
|
||||||
|
wxString wxGetPrinterFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the additional options for the print command (e.g. specific printer). The
|
||||||
|
default is nothing.
|
||||||
|
*/
|
||||||
|
wxString wxGetPrinterOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the command used to view a PostScript file. The default depends on the
|
||||||
|
platform.
|
||||||
|
*/
|
||||||
|
wxString wxGetPrinterPreviewCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the printing mode controlling where output is sent (PS_PREVIEW, PS_FILE or
|
||||||
|
PS_PRINTER).
|
||||||
|
The default is PS_PREVIEW.
|
||||||
|
*/
|
||||||
|
int wxGetPrinterMode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the scaling factor for PostScript output. The default is 1.0, 1.0.
|
||||||
|
*/
|
||||||
|
void wxGetPrinterScaling(float * x, float * y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the command used to view a PostScript file. The default depends on the
|
||||||
|
platform.
|
||||||
|
*/
|
||||||
|
void wxSetPrinterPreviewCommand(const wxString& command);
|
||||||
|
|
||||||
72
interface/dcscreen.h
Normal file
72
interface/dcscreen.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dcscreen.h
|
||||||
|
// Purpose: documentation for wxScreenDC class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxScreenDC
|
||||||
|
@wxheader{dcscreen.h}
|
||||||
|
|
||||||
|
A wxScreenDC can be used to paint on the screen.
|
||||||
|
This should normally be constructed as a temporary stack object; don't store
|
||||||
|
a wxScreenDC object.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDC, wxMemoryDC, wxPaintDC, wxClientDC, wxWindowDC
|
||||||
|
*/
|
||||||
|
class wxScreenDC : public wxDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxScreenDC();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use this in conjunction with StartDrawingOnTop().
|
||||||
|
|
||||||
|
This function destroys the temporary window created to implement on-top drawing
|
||||||
|
(X only).
|
||||||
|
*/
|
||||||
|
bool EndDrawingOnTop();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Use this in conjunction with EndDrawingOnTop() to
|
||||||
|
ensure that drawing to the screen occurs on top of existing windows. Without
|
||||||
|
this,
|
||||||
|
some window systems (such as X) only allow drawing to take place underneath
|
||||||
|
other windows.
|
||||||
|
|
||||||
|
By using the first form of this function, an application is specifying that
|
||||||
|
the area that will be drawn on coincides with the given window.
|
||||||
|
|
||||||
|
By using the second form, an application can specify an area of the screen
|
||||||
|
which is to be drawn on. If @NULL is passed, the whole screen is available.
|
||||||
|
|
||||||
|
It is recommended that an area of the screen is specified because with large
|
||||||
|
regions,
|
||||||
|
flickering effects are noticeable when destroying the temporary transparent
|
||||||
|
window used
|
||||||
|
to implement this feature.
|
||||||
|
|
||||||
|
You might use this pair of functions when implementing a drag feature, for
|
||||||
|
example
|
||||||
|
as in the wxSplitterWindow implementation.
|
||||||
|
|
||||||
|
@remarks This function is probably obsolete since the X implementations
|
||||||
|
allow drawing directly on the screen now. However,
|
||||||
|
the fact that this function allows the screen to be
|
||||||
|
refreshed afterwards, may be useful to some
|
||||||
|
applications.
|
||||||
|
*/
|
||||||
|
bool StartDrawingOnTop(wxWindow* window);
|
||||||
|
bool StartDrawingOnTop(wxRect* rect = @NULL);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
680
interface/dcsvg.h
Normal file
680
interface/dcsvg.h
Normal file
@@ -0,0 +1,680 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dcsvg.h
|
||||||
|
// Purpose: documentation for wxSVGFileDC class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxSVGFileDC
|
||||||
|
@wxheader{dcsvg.h}
|
||||||
|
|
||||||
|
A wxSVGFileDC is a @e device context onto which graphics and text can be drawn,
|
||||||
|
and the output
|
||||||
|
produced as a vector file, in the SVG format
|
||||||
|
(see W3C specifications).
|
||||||
|
This format can be read by a range of programs, including a Netscape plugin
|
||||||
|
(Adobe), full details
|
||||||
|
in the SVG Implementation and Resource Directory.
|
||||||
|
Vector formats may often be smaller than raster formats.
|
||||||
|
|
||||||
|
The intention behind wxSVGFileDC is that it can be used to produce a file
|
||||||
|
corresponding
|
||||||
|
to the screen display context, wxSVGFileDC, by passing the wxSVGFileDC as a
|
||||||
|
parameter instead of a wxSVGFileDC. Thus the wxSVGFileDC is a write-only class.
|
||||||
|
|
||||||
|
As the wxSVGFileDC is a vector format, raster operations like GetPixel are
|
||||||
|
unlikely to be supported.
|
||||||
|
However, the SVG specification allows for PNG format raster files to be
|
||||||
|
embedded in the SVG, and so
|
||||||
|
bitmaps, icons and blit operations into the wxSVGFileDC are supported.
|
||||||
|
|
||||||
|
A more substantial SVG library (for reading and writing) is available at the
|
||||||
|
wxArt2D website.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@b Members
|
||||||
|
*/
|
||||||
|
class wxSVGFileDC : public wxDC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructors:
|
||||||
|
a filename @e f with default size 340x240 at 72.0 dots per inch (a frequent
|
||||||
|
screen resolution).
|
||||||
|
a filename @e f with size @e Width by @e Height at 72.0 dots per inch
|
||||||
|
a filename @e f with size @e Width by @e Height at @e dpi resolution.
|
||||||
|
*/
|
||||||
|
wxSVGFileDC(wxString f);
|
||||||
|
wxSVGFileDC(wxString f, int Width, int Height);
|
||||||
|
wxSVGFileDC(wxString f, int Width, int Height, float dpi);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxSVGFileDC();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Does nothing
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
As wxDC: Copy from a source DC to this DC, specifying the destination
|
||||||
|
coordinates, size of area to copy, source DC, source coordinates,
|
||||||
|
logical function, whether to use a bitmap mask, and mask source position.
|
||||||
|
*/
|
||||||
|
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width,
|
||||||
|
wxCoord height, wxSVGFileDC* source,
|
||||||
|
wxCoord xsrc, wxCoord ysrc,
|
||||||
|
int logicalFunc = wxCOPY,
|
||||||
|
bool useMask = FALSE,
|
||||||
|
wxCoord xsrcMask = -1,
|
||||||
|
wxCoord ysrcMask = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds the specified point to the bounding box which can be retrieved with
|
||||||
|
wxDC::MinX, wxDC::MaxX and
|
||||||
|
wxDC::MinY, wxDC::MaxY functions.
|
||||||
|
*/
|
||||||
|
void CalcBoundingBox(wxCoord x, wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This makes no sense in wxSVGFileDC and does nothing
|
||||||
|
*/
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Not Implemented
|
||||||
|
*/
|
||||||
|
void CrossHair(wxCoord x, wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Not Implemented
|
||||||
|
*/
|
||||||
|
void DestroyClippingRegion();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert device X coordinate to logical coordinate, using the current
|
||||||
|
mapping mode.
|
||||||
|
*/
|
||||||
|
wxCoord DeviceToLogicalX(wxCoord x);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert device X coordinate to relative logical coordinate, using the current
|
||||||
|
mapping mode but ignoring the x axis orientation.
|
||||||
|
Use this function for converting a width, for example.
|
||||||
|
*/
|
||||||
|
wxCoord DeviceToLogicalXRel(wxCoord x);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts device Y coordinate to logical coordinate, using the current
|
||||||
|
mapping mode.
|
||||||
|
*/
|
||||||
|
wxCoord DeviceToLogicalY(wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert device Y coordinate to relative logical coordinate, using the current
|
||||||
|
mapping mode but ignoring the y axis orientation.
|
||||||
|
Use this function for converting a height, for example.
|
||||||
|
*/
|
||||||
|
wxCoord DeviceToLogicalYRel(wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws an arc of a circle, centred on (@e xc, yc), with starting point (@e x1,
|
||||||
|
y1)
|
||||||
|
and ending at (@e x2, y2). The current pen is used for the outline
|
||||||
|
and the current brush for filling the shape.
|
||||||
|
|
||||||
|
The arc is drawn in an anticlockwise direction from the start point to the end
|
||||||
|
point.
|
||||||
|
*/
|
||||||
|
void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
|
||||||
|
wxCoord xc, wxCoord yc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draw a bitmap on the device context at the specified point. If @e transparent
|
||||||
|
is @true and the bitmap has
|
||||||
|
a transparency mask, the bitmap will be drawn transparently.
|
||||||
|
|
||||||
|
When drawing a mono-bitmap, the current text foreground colour will be used to
|
||||||
|
draw the foreground
|
||||||
|
of the bitmap (all bits set to 1), and the current text background colour to
|
||||||
|
draw the background
|
||||||
|
(all bits set to 0). See also wxDC::SetTextForeground,
|
||||||
|
wxDC::SetTextBackground and wxMemoryDC.
|
||||||
|
*/
|
||||||
|
void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y,
|
||||||
|
bool transparent);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Draws a check mark inside the given rectangle.
|
||||||
|
*/
|
||||||
|
void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width,
|
||||||
|
wxCoord height);
|
||||||
|
void DrawCheckMark(const wxRect & rect);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Draws a circle with the given centre and radius.
|
||||||
|
|
||||||
|
@sa wxDC::DrawEllipse
|
||||||
|
*/
|
||||||
|
void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
|
||||||
|
void DrawCircle(const wxPoint& pt, wxCoord radius);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Draws an ellipse contained in the rectangle specified either with the given top
|
||||||
|
left corner and the given size or directly. The current pen is used for the
|
||||||
|
outline and the current brush for filling the shape.
|
||||||
|
|
||||||
|
@sa wxDC::DrawCircle
|
||||||
|
*/
|
||||||
|
void DrawEllipse(wxCoord x, wxCoord y, wxCoord width,
|
||||||
|
wxCoord height);
|
||||||
|
void DrawEllipse(const wxPoint& pt, const wxSize& size);
|
||||||
|
void DrawEllipse(const wxRect& rect);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws an arc of an ellipse. The current pen is used for drawing the arc and
|
||||||
|
the current brush is used for drawing the pie.
|
||||||
|
|
||||||
|
@e x and @e y specify the x and y coordinates of the upper-left corner of the
|
||||||
|
rectangle that contains
|
||||||
|
the ellipse.
|
||||||
|
|
||||||
|
@e width and @e height specify the width and height of the rectangle that
|
||||||
|
contains
|
||||||
|
the ellipse.
|
||||||
|
|
||||||
|
@e start and @e end specify the start and end of the arc relative to the
|
||||||
|
three-o'clock
|
||||||
|
position from the center of the rectangle. Angles are specified
|
||||||
|
in degrees (360 is a complete circle). Positive values mean
|
||||||
|
counter-clockwise motion. If @e start is equal to @e end, a
|
||||||
|
complete ellipse will be drawn.
|
||||||
|
*/
|
||||||
|
void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord width,
|
||||||
|
wxCoord height,
|
||||||
|
double start,
|
||||||
|
double end);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draw an icon on the display (does nothing if the device context is PostScript).
|
||||||
|
This can be the simplest way of drawing bitmaps on a window.
|
||||||
|
*/
|
||||||
|
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a line from the first point to the second. The current pen is used
|
||||||
|
for drawing the line.
|
||||||
|
*/
|
||||||
|
void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Draws lines using an array of @e points of size @e n, or list of
|
||||||
|
pointers to points, adding the optional offset coordinate. The current
|
||||||
|
pen is used for drawing the lines. The programmer is responsible for
|
||||||
|
deleting the list of points.
|
||||||
|
*/
|
||||||
|
void DrawLines(int n, wxPoint points[], wxCoord xoffset = 0,
|
||||||
|
wxCoord yoffset = 0);
|
||||||
|
void DrawLines(wxList * points, wxCoord xoffset = 0,
|
||||||
|
wxCoord yoffset = 0);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a point using the current pen.
|
||||||
|
*/
|
||||||
|
void DrawPoint(wxCoord x, wxCoord y);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Draws a filled polygon using an array of @e points of size @e n,
|
||||||
|
or list of pointers to points, adding the optional offset coordinate.
|
||||||
|
|
||||||
|
The last argument specifies the fill rule: @b wxODDEVEN_RULE (the
|
||||||
|
default) or @b wxWINDING_RULE.
|
||||||
|
|
||||||
|
The current pen is used for drawing the outline, and the current brush
|
||||||
|
for filling the shape. Using a transparent brush suppresses filling.
|
||||||
|
The programmer is responsible for deleting the list of points.
|
||||||
|
|
||||||
|
Note that wxWindows automatically closes the first and last points.
|
||||||
|
*/
|
||||||
|
void DrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0,
|
||||||
|
wxCoord yoffset = 0,
|
||||||
|
int fill_style = wxODDEVEN_RULE);
|
||||||
|
void DrawPolygon(wxList * points, wxCoord xoffset = 0,
|
||||||
|
wxCoord yoffset = 0,
|
||||||
|
int fill_style = wxODDEVEN_RULE);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a rectangle with the given top left corner, and with the given
|
||||||
|
size. The current pen is used for the outline and the current brush
|
||||||
|
for filling the shape.
|
||||||
|
*/
|
||||||
|
void DrawRectangle(wxCoord x, wxCoord y, wxCoord width,
|
||||||
|
wxCoord height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws the text rotated by @e angle degrees.
|
||||||
|
|
||||||
|
The wxMSW wxDC and wxSVGFileDC rotate the text around slightly different
|
||||||
|
points, depending on the size of the font
|
||||||
|
*/
|
||||||
|
void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
|
||||||
|
double angle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a rectangle with the given top left corner, and with the given
|
||||||
|
size. The corners are quarter-circles using the given radius. The
|
||||||
|
current pen is used for the outline and the current brush for filling
|
||||||
|
the shape.
|
||||||
|
|
||||||
|
If @e radius is positive, the value is assumed to be the
|
||||||
|
radius of the rounded corner. If @e radius is negative,
|
||||||
|
the absolute value is assumed to be the @e proportion of the smallest
|
||||||
|
dimension of the rectangle. This means that the corner can be
|
||||||
|
a sensible size relative to the size of the rectangle, and also avoids
|
||||||
|
the strange effects X produces when the corners are too big for
|
||||||
|
the rectangle.
|
||||||
|
*/
|
||||||
|
void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width,
|
||||||
|
wxCoord height,
|
||||||
|
double radius = 20);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Draws a three-point spline using the current pen.
|
||||||
|
*/
|
||||||
|
void DrawSpline(wxList * points);
|
||||||
|
void DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2,
|
||||||
|
wxCoord y2,
|
||||||
|
wxCoord x3,
|
||||||
|
wxCoord y3);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws a text string at the specified point, using the current text font,
|
||||||
|
and the current text foreground and background colours.
|
||||||
|
|
||||||
|
The coordinates refer to the top-left corner of the rectangle bounding
|
||||||
|
the string. See GetTextExtent() for how
|
||||||
|
to get the dimensions of a text string, which can be used to position the
|
||||||
|
text more precisely.
|
||||||
|
*/
|
||||||
|
void DrawText(const wxString& text, wxCoord x, wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Does nothing
|
||||||
|
*/
|
||||||
|
void EndDoc();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Does nothing
|
||||||
|
*/
|
||||||
|
void EndDrawing();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Does nothing
|
||||||
|
*/
|
||||||
|
void EndPage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Not implemented
|
||||||
|
*/
|
||||||
|
void FloodFill(wxCoord x, wxCoord y, const wxColour& colour,
|
||||||
|
int style=wxFLOOD_SURFACE);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Gets the brush used for painting the background (see
|
||||||
|
wxSVGFileDC::SetBackground).
|
||||||
|
*/
|
||||||
|
wxBrush GetBackground();
|
||||||
|
const wxBrush GetBackground();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current background mode: @c wxSOLID or @c wxTRANSPARENT.
|
||||||
|
|
||||||
|
@sa wxDC::SetBackgroundMode
|
||||||
|
*/
|
||||||
|
int GetBackgroundMode();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Gets the current brush (see wxSVGFileDC::SetBrush).
|
||||||
|
*/
|
||||||
|
wxBrush GetBrush();
|
||||||
|
const wxBrush GetBrush();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the character height of the currently set font.
|
||||||
|
*/
|
||||||
|
wxCoord GetCharHeight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the average character width of the currently set font.
|
||||||
|
*/
|
||||||
|
wxCoord GetCharWidth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Not implemented
|
||||||
|
*/
|
||||||
|
void GetClippingBox(wxCoord x, wxCoord y, wxCoord width,
|
||||||
|
wxCoord height);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Gets the current font (see wxSVGFileDC::SetFont).
|
||||||
|
*/
|
||||||
|
wxFont GetFont();
|
||||||
|
const wxFont GetFont();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the current logical function (see wxSVGFileDC::SetLogicalFunction).
|
||||||
|
*/
|
||||||
|
int GetLogicalFunction();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the @e mapping mode for the device context (see wxSVGFileDC::SetMapMode).
|
||||||
|
*/
|
||||||
|
int GetMapMode();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Gets the current pen (see wxSVGFileDC::SetPen).
|
||||||
|
*/
|
||||||
|
wxPen GetPen();
|
||||||
|
const wxPen GetPen();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Not implemented
|
||||||
|
*/
|
||||||
|
bool GetPixel(wxCoord x, wxCoord y, wxColour * colour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
For a Windows printer device context, this gets the horizontal and vertical
|
||||||
|
resolution.
|
||||||
|
*/
|
||||||
|
void GetSize(wxCoord * width, wxCoord * height);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Gets the current text background colour (see wxSVGFileDC::SetTextBackground).
|
||||||
|
*/
|
||||||
|
wxColour GetTextBackground();
|
||||||
|
const wxColour GetTextBackground();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the dimensions of the string using the currently selected font.
|
||||||
|
@e string is the text string to measure, @e w and @e h are
|
||||||
|
the total width and height respectively, @e descent is the
|
||||||
|
dimension from the baseline of the font to the bottom of the
|
||||||
|
descender, and @e externalLeading is any extra vertical space added
|
||||||
|
to the font by the font designer (usually is zero).
|
||||||
|
|
||||||
|
The optional parameter @e font specifies an alternative
|
||||||
|
to the currently selected font: but note that this does not
|
||||||
|
yet work under Windows, so you need to set a font for
|
||||||
|
the device context first.
|
||||||
|
|
||||||
|
See also wxFont, SetFont().
|
||||||
|
*/
|
||||||
|
void GetTextExtent(const wxString& string, wxCoord * w,
|
||||||
|
wxCoord * h,
|
||||||
|
wxCoord * descent = @NULL,
|
||||||
|
wxCoord * externalLeading = @NULL,
|
||||||
|
wxFont * font = @NULL);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Gets the current text foreground colour (see wxSVGFileDC::SetTextForeground).
|
||||||
|
*/
|
||||||
|
wxColour GetTextForeground();
|
||||||
|
const wxColour GetTextForeground();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the current user scale factor (set by wxDC::SetUserScale).
|
||||||
|
*/
|
||||||
|
void GetUserScale(double x, double y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts logical X coordinate to device coordinate, using the current
|
||||||
|
mapping mode.
|
||||||
|
*/
|
||||||
|
wxCoord LogicalToDeviceX(wxCoord x);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts logical X coordinate to relative device coordinate, using the current
|
||||||
|
mapping mode but ignoring the x axis orientation.
|
||||||
|
Use this for converting a width, for example.
|
||||||
|
*/
|
||||||
|
wxCoord LogicalToDeviceXRel(wxCoord x);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts logical Y coordinate to device coordinate, using the current
|
||||||
|
mapping mode.
|
||||||
|
*/
|
||||||
|
wxCoord LogicalToDeviceY(wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts logical Y coordinate to relative device coordinate, using the current
|
||||||
|
mapping mode but ignoring the y axis orientation.
|
||||||
|
Use this for converting a height, for example.
|
||||||
|
*/
|
||||||
|
wxCoord LogicalToDeviceYRel(wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the maximum horizontal extent used in drawing commands so far.
|
||||||
|
*/
|
||||||
|
#define wxCoord MaxX() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the maximum vertical extent used in drawing commands so far.
|
||||||
|
*/
|
||||||
|
#define wxCoord MaxY() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the minimum horizontal extent used in drawing commands so far.
|
||||||
|
*/
|
||||||
|
#define wxCoord MinX() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the minimum vertical extent used in drawing commands so far.
|
||||||
|
*/
|
||||||
|
#define wxCoord MinY() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the DC is ok to use; False values arise from being unable to
|
||||||
|
write the file
|
||||||
|
*/
|
||||||
|
#define bool Ok() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resets the bounding box: after a call to this function, the bounding box
|
||||||
|
doesn't contain anything.
|
||||||
|
|
||||||
|
@sa wxDC::CalcBoundingBox
|
||||||
|
*/
|
||||||
|
void ResetBoundingBox();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the x and y axis orientation (i.e., the direction from lowest to
|
||||||
|
highest values on the axis). The default orientation is the natural
|
||||||
|
orientation, e.g. x axis from left to right and y axis from bottom up.
|
||||||
|
|
||||||
|
@param xLeftRight
|
||||||
|
True to set the x axis orientation to the natural
|
||||||
|
left to right orientation, @false to invert it.
|
||||||
|
|
||||||
|
@param yBottomUp
|
||||||
|
True to set the y axis orientation to the natural
|
||||||
|
bottom up orientation, @false to invert it.
|
||||||
|
*/
|
||||||
|
void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current background brush for the DC.
|
||||||
|
*/
|
||||||
|
void SetBackground(const wxBrush& brush);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@e mode may be one of wxSOLID and wxTRANSPARENT. This setting determines
|
||||||
|
whether text will be drawn with a background colour or not.
|
||||||
|
*/
|
||||||
|
void SetBackgroundMode(int mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current brush for the DC.
|
||||||
|
|
||||||
|
If the argument is wxNullBrush, the current brush is selected out of the device
|
||||||
|
context, and the original brush restored, allowing the current brush to
|
||||||
|
be destroyed safely.
|
||||||
|
|
||||||
|
See also wxBrush.
|
||||||
|
|
||||||
|
See also wxMemoryDC for the interpretation of colours
|
||||||
|
when drawing into a monochrome bitmap.
|
||||||
|
*/
|
||||||
|
void SetBrush(const wxBrush& brush);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Not implemented
|
||||||
|
*/
|
||||||
|
void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width,
|
||||||
|
wxCoord height);
|
||||||
|
void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
|
||||||
|
void SetClippingRegion(const wxRect& rect);
|
||||||
|
void SetClippingRegion(const wxRegion& region);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the device origin (i.e., the origin in pixels after scaling has been
|
||||||
|
applied).
|
||||||
|
|
||||||
|
This function may be useful in Windows printing
|
||||||
|
operations for placing a graphic on a page.
|
||||||
|
*/
|
||||||
|
void SetDeviceOrigin(wxCoord x, wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current font for the DC. It must be a valid font, in particular you
|
||||||
|
should not pass @c wxNullFont to this method.
|
||||||
|
|
||||||
|
See also wxFont.
|
||||||
|
*/
|
||||||
|
void SetFont(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Only wxCOPY is avalaible; trying to set one of the othe values will fail
|
||||||
|
*/
|
||||||
|
void SetLogicalFunction(int function);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The @e mapping mode of the device context defines the unit of
|
||||||
|
measurement used to convert logical units to device units. Note that
|
||||||
|
in X, text drawing isn't handled consistently with the mapping mode; a
|
||||||
|
font is always specified in point size. However, setting the @e user scale (see
|
||||||
|
wxSVGFileDC::SetUserScale) scales the text appropriately. In
|
||||||
|
Windows, scaleable TrueType fonts are always used; in X, results depend
|
||||||
|
on availability of fonts, but usually a reasonable match is found.
|
||||||
|
|
||||||
|
Note that the coordinate origin should ideally be selectable, but for
|
||||||
|
now is always at the top left of the screen/printer.
|
||||||
|
|
||||||
|
Drawing to a Windows printer device context under UNIX
|
||||||
|
uses the current mapping mode, but mapping mode is currently ignored for
|
||||||
|
PostScript output.
|
||||||
|
|
||||||
|
The mapping mode can be one of the following:
|
||||||
|
|
||||||
|
wxMM_TWIPS
|
||||||
|
|
||||||
|
|
||||||
|
Each logical unit is 1/20 of a point, or 1/1440 of
|
||||||
|
an inch.
|
||||||
|
|
||||||
|
wxMM_POINTS
|
||||||
|
|
||||||
|
|
||||||
|
Each logical unit is a point, or 1/72 of an inch.
|
||||||
|
|
||||||
|
wxMM_METRIC
|
||||||
|
|
||||||
|
|
||||||
|
Each logical unit is 1 mm.
|
||||||
|
|
||||||
|
wxMM_LOMETRIC
|
||||||
|
|
||||||
|
|
||||||
|
Each logical unit is 1/10 of a mm.
|
||||||
|
|
||||||
|
wxMM_TEXT
|
||||||
|
|
||||||
|
|
||||||
|
Each logical unit is 1 pixel.
|
||||||
|
*/
|
||||||
|
void SetMapMode(int int);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Not implemented
|
||||||
|
*/
|
||||||
|
void SetPalette(const wxPalette& palette);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current pen for the DC.
|
||||||
|
|
||||||
|
If the argument is wxNullPen, the current pen is selected out of the device
|
||||||
|
context, and the original pen restored.
|
||||||
|
|
||||||
|
See also wxMemoryDC for the interpretation of colours
|
||||||
|
when drawing into a monochrome bitmap.
|
||||||
|
*/
|
||||||
|
void SetPen(const wxPen& pen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current text background colour for the DC.
|
||||||
|
*/
|
||||||
|
void SetTextBackground(const wxColour& colour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current text foreground colour for the DC.
|
||||||
|
|
||||||
|
See also wxMemoryDC for the interpretation of colours
|
||||||
|
when drawing into a monochrome bitmap.
|
||||||
|
*/
|
||||||
|
void SetTextForeground(const wxColour& colour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the user scaling factor, useful for applications which require
|
||||||
|
'zooming'.
|
||||||
|
*/
|
||||||
|
void SetUserScale(double xScale, double yScale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Does nothing
|
||||||
|
*/
|
||||||
|
bool StartDoc(const wxString& message);
|
||||||
|
};
|
||||||
337
interface/dde.h
Normal file
337
interface/dde.h
Normal file
@@ -0,0 +1,337 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dde.h
|
||||||
|
// Purpose: documentation for wxDDEConnection class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDDEConnection
|
||||||
|
@wxheader{dde.h}
|
||||||
|
|
||||||
|
A wxDDEConnection object represents the connection between a client and a
|
||||||
|
server. It can be created by making a connection using a
|
||||||
|
wxDDEClient object, or by the acceptance of a connection by a
|
||||||
|
wxDDEServer object. The bulk of a DDE (Dynamic Data Exchange)
|
||||||
|
conversation is controlled by
|
||||||
|
calling members in a @b wxDDEConnection object or by overriding its
|
||||||
|
members.
|
||||||
|
|
||||||
|
An application should normally derive a new connection class from
|
||||||
|
wxDDEConnection, in order to override the communication event handlers
|
||||||
|
to do something interesting.
|
||||||
|
|
||||||
|
This DDE-based implementation is available on Windows only,
|
||||||
|
but a platform-independent, socket-based version
|
||||||
|
of this API is available using wxTCPConnection.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDDEClient, wxDDEServer, @ref overview_ipcoverview "Interprocess
|
||||||
|
communications overview"
|
||||||
|
*/
|
||||||
|
class wxDDEConnection : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructs a connection object. If no user-defined connection object is
|
||||||
|
to be derived from wxDDEConnection, then the constructor should not be
|
||||||
|
called directly, since the default connection object will be provided on
|
||||||
|
requesting (or accepting) a connection. However, if the user defines his
|
||||||
|
or her own derived connection object, the wxDDEServer::OnAcceptConnection
|
||||||
|
and/or wxDDEClient::OnMakeConnection members should be replaced by
|
||||||
|
functions which construct the new connection object. If the arguments of
|
||||||
|
the wxDDEConnection constructor are void, then a default buffer is
|
||||||
|
associated with the connection. Otherwise, the programmer must provide a
|
||||||
|
a buffer and size of the buffer for the connection object to use in
|
||||||
|
transactions.
|
||||||
|
*/
|
||||||
|
wxDDEConnection();
|
||||||
|
wxDDEConnection(void* buffer, size_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Called by the server application to advise the client of a change in
|
||||||
|
the data associated with the given item. Causes the client
|
||||||
|
connection's OnAdvise()
|
||||||
|
member to be called. Returns @true if successful.
|
||||||
|
*/
|
||||||
|
bool Advise(const wxString& item, const void* data, size_t size,
|
||||||
|
wxIPCFormat format = wxIPC_PRIVATE);
|
||||||
|
bool Advise(const wxString& item, const char* data);
|
||||||
|
bool Advise(const wxString& item, const wchar_t* data);
|
||||||
|
bool Advise(const wxString& item, const wxString data);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called by the client or server application to disconnect from the other
|
||||||
|
program; it causes the OnDisconnect() message
|
||||||
|
to be sent to the corresponding connection object in the other
|
||||||
|
program. The default behaviour of @b OnDisconnect is to delete the
|
||||||
|
connection, but the calling application must explicitly delete its
|
||||||
|
side of the connection having called @b Disconnect. Returns @true if
|
||||||
|
successful.
|
||||||
|
*/
|
||||||
|
bool Disconnect();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Called by the client application to execute a command on the server. Can
|
||||||
|
also be used to transfer arbitrary data to the server (similar
|
||||||
|
to Poke() in that respect). Causes the
|
||||||
|
server connection's OnExecute() member to be
|
||||||
|
called. Returns @true if successful.
|
||||||
|
*/
|
||||||
|
bool Execute(const void* data, size_t size,
|
||||||
|
wxIPCFormat format = wxIPC_PRIVATE);
|
||||||
|
bool Execute(const char* data);
|
||||||
|
bool Execute(const wchar_t* data);
|
||||||
|
bool Execute(const wxString data);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Message sent to the client application when the server notifies it of a
|
||||||
|
change in the data associated with the given item.
|
||||||
|
*/
|
||||||
|
virtual bool OnAdvise(const wxString& topic,
|
||||||
|
const wxString& item,
|
||||||
|
const void* data,
|
||||||
|
size_t size,
|
||||||
|
wxIPCFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Message sent to the client or server application when the other
|
||||||
|
application notifies it to delete the connection. Default behaviour is
|
||||||
|
to delete the connection object.
|
||||||
|
*/
|
||||||
|
virtual bool OnDisconnect();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Message sent to the server application when the client notifies it to
|
||||||
|
execute the given data. Note that there is no item associated with
|
||||||
|
this message.
|
||||||
|
*/
|
||||||
|
virtual bool OnExecute(const wxString& topic, const void* data,
|
||||||
|
size_t size,
|
||||||
|
wxIPCFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Message sent to the server application when the client notifies it to
|
||||||
|
accept the given data.
|
||||||
|
*/
|
||||||
|
virtual bool OnPoke(const wxString& topic, const wxString& item,
|
||||||
|
const void* data,
|
||||||
|
size_t size,
|
||||||
|
wxIPCFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Message sent to the server application when the client
|
||||||
|
calls Request(). The server
|
||||||
|
should respond by returning a character string from @b OnRequest,
|
||||||
|
or @NULL to indicate no data.
|
||||||
|
*/
|
||||||
|
virtual const void* OnRequest(const wxString& topic,
|
||||||
|
const wxString& item,
|
||||||
|
size_t * size,
|
||||||
|
wxIPCFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Message sent to the server application by the client, when the client
|
||||||
|
wishes to start an 'advise loop' for the given topic and item. The
|
||||||
|
server can refuse to participate by returning @false.
|
||||||
|
*/
|
||||||
|
virtual bool OnStartAdvise(const wxString& topic,
|
||||||
|
const wxString& item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Message sent to the server application by the client, when the client
|
||||||
|
wishes to stop an 'advise loop' for the given topic and item. The
|
||||||
|
server can refuse to stop the advise loop by returning @false, although
|
||||||
|
this doesn't have much meaning in practice.
|
||||||
|
*/
|
||||||
|
virtual bool OnStopAdvise(const wxString& topic,
|
||||||
|
const wxString& item);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Called by the client application to poke data into the server. Can be
|
||||||
|
used to transfer arbitrary data to the server. Causes the server
|
||||||
|
connection's OnPoke() member
|
||||||
|
to be called. Returns @true if successful.
|
||||||
|
*/
|
||||||
|
bool Poke(const wxString& item, const void* data, size_t size,
|
||||||
|
wxIPCFormat format = wxIPC_PRIVATE);
|
||||||
|
bool Poke(const wxString& item, const char* data);
|
||||||
|
bool Poke(const wxString& item, const wchar_t* data);
|
||||||
|
bool Poke(const wxString& item, const wxString data);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called by the client application to request data from the server. Causes
|
||||||
|
the server connection's OnRequest() member to be called. Returns a
|
||||||
|
character string (actually a pointer to the connection's buffer) if
|
||||||
|
successful, @NULL otherwise.
|
||||||
|
*/
|
||||||
|
const void* Request(const wxString& item, size_t * size,
|
||||||
|
wxIPCFormat format = wxIPC_TEXT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called by the client application to ask if an advise loop can be started
|
||||||
|
with the server. Causes the server connection's OnStartAdvise()
|
||||||
|
member to be called. Returns @true if the server okays it, @false
|
||||||
|
otherwise.
|
||||||
|
*/
|
||||||
|
bool StartAdvise(const wxString& item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called by the client application to ask if an advise loop can be
|
||||||
|
stopped. Causes the server connection's OnStopAdvise() member
|
||||||
|
to be called. Returns @true if the server okays it, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool StopAdvise(const wxString& item);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDDEClient
|
||||||
|
@wxheader{dde.h}
|
||||||
|
|
||||||
|
A wxDDEClient object represents the client part of a client-server DDE
|
||||||
|
(Dynamic Data Exchange) conversation.
|
||||||
|
|
||||||
|
To create a client which can communicate with a suitable server,
|
||||||
|
you need to derive a class from wxDDEConnection and another from wxDDEClient.
|
||||||
|
The custom wxDDEConnection class will intercept communications in
|
||||||
|
a 'conversation' with a server, and the custom wxDDEServer is required
|
||||||
|
so that a user-overridden wxDDEClient::OnMakeConnection member can return
|
||||||
|
a wxDDEConnection of the required class, when a connection is made.
|
||||||
|
|
||||||
|
This DDE-based implementation is
|
||||||
|
available on Windows only, but a platform-independent, socket-based version
|
||||||
|
of this API is available using wxTCPClient.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDDEServer, wxDDEConnection, @ref overview_ipcoverview "Interprocess
|
||||||
|
communications overview"
|
||||||
|
*/
|
||||||
|
class wxDDEClient : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructs a client object.
|
||||||
|
*/
|
||||||
|
wxDDEClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tries to make a connection with a server specified by the host
|
||||||
|
(machine name under UNIX, ignored under Windows), service name (must
|
||||||
|
contain an integer port number under UNIX), and topic string. If the
|
||||||
|
server allows a connection, a wxDDEConnection object will be returned.
|
||||||
|
The type of wxDDEConnection returned can be altered by overriding
|
||||||
|
the OnMakeConnection() member to return your own
|
||||||
|
derived connection object.
|
||||||
|
*/
|
||||||
|
wxConnectionBase * MakeConnection(const wxString& host,
|
||||||
|
const wxString& service,
|
||||||
|
const wxString& topic);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The type of wxDDEConnection returned from a MakeConnection() call can
|
||||||
|
be altered by deriving the @b OnMakeConnection member to return your
|
||||||
|
own derived connection object. By default, a wxDDEConnection
|
||||||
|
object is returned.
|
||||||
|
|
||||||
|
The advantage of deriving your own connection class is that it will
|
||||||
|
enable you to intercept messages initiated by the server, such
|
||||||
|
as wxDDEConnection::OnAdvise. You may also want to
|
||||||
|
store application-specific data in instances of the new class.
|
||||||
|
*/
|
||||||
|
wxConnectionBase * OnMakeConnection();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this is a valid host name, @false otherwise. This always
|
||||||
|
returns @true under MS Windows.
|
||||||
|
*/
|
||||||
|
bool ValidHost(const wxString& host);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDDEServer
|
||||||
|
@wxheader{dde.h}
|
||||||
|
|
||||||
|
A wxDDEServer object represents the server part of a client-server DDE
|
||||||
|
(Dynamic Data Exchange) conversation.
|
||||||
|
|
||||||
|
This DDE-based implementation is
|
||||||
|
available on Windows only, but a platform-independent, socket-based version
|
||||||
|
of this API is available using wxTCPServer.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDDEClient, wxDDEConnection, @ref overview_ipcoverview "IPC overview"
|
||||||
|
*/
|
||||||
|
class wxDDEServer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructs a server object.
|
||||||
|
*/
|
||||||
|
wxDDEServer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Registers the server using the given service name. Under UNIX, the
|
||||||
|
string must contain an integer id which is used as an Internet port
|
||||||
|
number. @false is returned if the call failed (for example, the port
|
||||||
|
number is already in use).
|
||||||
|
*/
|
||||||
|
bool Create(const wxString& service);
|
||||||
|
|
||||||
|
/**
|
||||||
|
When a client calls @b MakeConnection, the server receives the
|
||||||
|
message and this member is called. The application should derive a
|
||||||
|
member to intercept this message and return a connection object of
|
||||||
|
either the standard wxDDEConnection type, or of a user-derived type. If the
|
||||||
|
topic is "STDIO'', the application may wish to refuse the connection.
|
||||||
|
Under UNIX, when a server is created the OnAcceptConnection message is
|
||||||
|
always sent for standard input and output, but in the context of DDE
|
||||||
|
messages it doesn't make a lot of sense.
|
||||||
|
*/
|
||||||
|
virtual wxConnectionBase * OnAcceptConnection(const wxString& topic);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called when wxWidgets exits, to clean up the DDE system. This no longer needs
|
||||||
|
to be
|
||||||
|
called by the application.
|
||||||
|
|
||||||
|
See also wxDDEInitialize.
|
||||||
|
*/
|
||||||
|
void wxDDECleanUp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initializes the DDE system. May be called multiple times without harm.
|
||||||
|
|
||||||
|
This no longer needs to be called by the application: it will be called
|
||||||
|
by wxWidgets if necessary.
|
||||||
|
|
||||||
|
See also wxDDEServer, wxDDEClient, wxDDEConnection,
|
||||||
|
wxDDECleanUp.
|
||||||
|
*/
|
||||||
|
void wxDDEInitialize();
|
||||||
|
|
||||||
164
interface/debug.h
Normal file
164
interface/debug.h
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: debug.h
|
||||||
|
// Purpose: documentation for global functions
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
Will always generate an assert error if this code is reached (in debug mode).
|
||||||
|
|
||||||
|
See also: wxFAIL_MSG
|
||||||
|
*/
|
||||||
|
#define wxFAIL() /* implementation is private */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called whenever one of debugging macros fails (i.e. condition
|
||||||
|
is @false in an assertion). It is only defined in the debug mode, in release
|
||||||
|
builds the wxCHECK failures don't result in anything.
|
||||||
|
|
||||||
|
To override the default behaviour in the debug builds which is to show the user
|
||||||
|
a dialog asking whether he wants to abort the program, continue or continue
|
||||||
|
ignoring any subsequent assert failures, you may override
|
||||||
|
wxApp::OnAssertFailure which is called by this function if
|
||||||
|
the global application object exists.
|
||||||
|
*/
|
||||||
|
void wxOnAssert(const char * fileName, int lineNumber,
|
||||||
|
const char * func,
|
||||||
|
const char * cond,
|
||||||
|
const char * msg = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
In debug mode (when @c __WXDEBUG__ is defined) this function generates a
|
||||||
|
debugger exception meaning that the control is passed to the debugger if one is
|
||||||
|
attached to the process. Otherwise the program just terminates abnormally.
|
||||||
|
|
||||||
|
In release mode this function does nothing.
|
||||||
|
*/
|
||||||
|
void wxTrap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Will always generate an assert error with specified message if this code is
|
||||||
|
reached (in debug mode).
|
||||||
|
|
||||||
|
This macro is useful for marking unreachable" code areas, for example
|
||||||
|
it may be used in the "default:" branch of a switch statement if all possible
|
||||||
|
cases are processed above.
|
||||||
|
|
||||||
|
@sa wxFAIL
|
||||||
|
*/
|
||||||
|
#define wxFAIL_MSG(msg) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Checks that the condition is @true, returns with the given return value if not
|
||||||
|
(FAILs in debug mode).
|
||||||
|
This check is done even in release mode.
|
||||||
|
*/
|
||||||
|
#define wxCHECK(condition, retValue) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro results in a
|
||||||
|
@ref overview_wxcompiletimeassert "compile time assertion failure" if the size
|
||||||
|
of the given type @e type is less than @e size bits.
|
||||||
|
|
||||||
|
You may use it like this, for example:
|
||||||
|
@code
|
||||||
|
// we rely on the int being able to hold values up to 2^32
|
||||||
|
wxASSERT_MIN_BITSIZE(int, 32);
|
||||||
|
|
||||||
|
// can't work with the platforms using UTF-8 for wchar_t
|
||||||
|
wxASSERT_MIN_BITSIZE(wchar_t, 16);
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
#define wxASSERT_MIN_BITSIZE(type, size) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assert macro with message. An error message will be generated if the condition
|
||||||
|
is @false.
|
||||||
|
|
||||||
|
@sa wxASSERT, wxCOMPILE_TIME_ASSERT
|
||||||
|
*/
|
||||||
|
#define wxASSERT_MSG(condition, msg) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is the same as wxCHECK2, but
|
||||||
|
wxFAIL_MSG with the specified @e msg is called
|
||||||
|
instead of wxFAIL() if the @e condition is @false.
|
||||||
|
*/
|
||||||
|
#define wxCHECK2(condition, operation, msg) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assert macro. An error message will be generated if the condition is @false in
|
||||||
|
debug mode, but nothing will be done in the release build.
|
||||||
|
|
||||||
|
Please note that the condition in wxASSERT() should have no side effects
|
||||||
|
because it will not be executed in release mode at all.
|
||||||
|
|
||||||
|
@sa wxASSERT_MSG, wxCOMPILE_TIME_ASSERT
|
||||||
|
*/
|
||||||
|
#define wxASSERT(condition) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Checks that the condition is @true, and returns if not (FAILs with given error
|
||||||
|
message in debug mode). This check is done even in release mode.
|
||||||
|
|
||||||
|
This macro should be used in void functions instead of
|
||||||
|
wxCHECK_MSG.
|
||||||
|
*/
|
||||||
|
#define wxCHECK_RET(condition, msg) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Checks that the condition is @true and wxFAIL and execute
|
||||||
|
@e operation if it is not. This is a generalisation of
|
||||||
|
wxCHECK and may be used when something else than just
|
||||||
|
returning from the function must be done when the @e condition is @false.
|
||||||
|
|
||||||
|
This check is done even in release mode.
|
||||||
|
*/
|
||||||
|
#define wxCHECK2(condition, operation) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro is identical to wxCOMPILE_TIME_ASSERT2
|
||||||
|
except that it allows you to specify a unique @e name for the struct
|
||||||
|
internally defined by this macro to avoid getting the compilation errors
|
||||||
|
described above.
|
||||||
|
*/
|
||||||
|
#define wxCOMPILE_TIME_ASSERT(condition, msg, name) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Checks that the condition is @true, returns with the given return value if not
|
||||||
|
(FAILs in debug mode).
|
||||||
|
This check is done even in release mode.
|
||||||
|
|
||||||
|
This macro may be only used in non-void functions, see also
|
||||||
|
wxCHECK_RET.
|
||||||
|
*/
|
||||||
|
#define wxCHECK_MSG(condition, retValue, msg) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Using @c wxCOMPILE_TIME_ASSERT results in a compilation error if the
|
||||||
|
specified @e condition is @false. The compiler error message should include
|
||||||
|
the @e msg identifier - please note that it must be a valid C++ identifier
|
||||||
|
and not a string unlike in the other cases.
|
||||||
|
|
||||||
|
This macro is mostly useful for testing the expressions involving the
|
||||||
|
@c sizeof operator as they can't be tested by the preprocessor but it is
|
||||||
|
sometimes desirable to test them at the compile time.
|
||||||
|
|
||||||
|
Note that this macro internally declares a struct whose name it tries to make
|
||||||
|
unique by using the @c __LINE__ in it but it may still not work if you
|
||||||
|
use it on the same line in two different source files. In this case you may
|
||||||
|
either change the line in which either of them appears on or use the
|
||||||
|
wxCOMPILE_TIME_ASSERT2 macro.
|
||||||
|
|
||||||
|
Also note that Microsoft Visual C++ has a bug which results in compiler errors
|
||||||
|
if you use this macro with 'Program Database For Edit And Continue'
|
||||||
|
(@c /ZI) option, so you shouldn't use it ('Program Database'
|
||||||
|
(@c /Zi) is ok though) for the code making use of this macro.
|
||||||
|
|
||||||
|
@sa wxASSERT_MSG, wxASSERT_MIN_BITSIZE
|
||||||
|
*/
|
||||||
|
#define wxCOMPILE_TIME_ASSERT(condition, msg) /* implementation is private */
|
||||||
|
|
||||||
331
interface/debugrpt.h
Normal file
331
interface/debugrpt.h
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: debugrpt.h
|
||||||
|
// Purpose: documentation for wxDebugReportPreview class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDebugReportPreview
|
||||||
|
@wxheader{debugrpt.h}
|
||||||
|
|
||||||
|
This class presents the debug report to the user and allows him to veto report
|
||||||
|
entirely or remove some parts of it. Although not mandatory, using this class
|
||||||
|
is strongly recommended as data included in the debug report might contain
|
||||||
|
sensitive private information and the user should be notified about it as well
|
||||||
|
as having a possibility to examine the data which had been gathered to check
|
||||||
|
whether this is effectively the case and discard the debug report if it is.
|
||||||
|
|
||||||
|
wxDebugReportPreview is an abstract base class, currently the only concrete
|
||||||
|
class deriving from it is
|
||||||
|
wxDebugReportPreviewStd.
|
||||||
|
|
||||||
|
@library{wxqa}
|
||||||
|
@category{debugging}
|
||||||
|
*/
|
||||||
|
class wxDebugReportPreview
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Trivial default constructor.
|
||||||
|
*/
|
||||||
|
wxDebugReportPreview();
|
||||||
|
|
||||||
|
/**
|
||||||
|
dtor is trivial as well but should be virtual for a base class
|
||||||
|
*/
|
||||||
|
~wxDebugReportPreview();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Present the report to the user and allow him to modify it by removing some or
|
||||||
|
all of the files and, potentially, adding some notes. Return @true if the
|
||||||
|
report should be processed or @false if the user chose to cancel report
|
||||||
|
generation or removed all files from it.
|
||||||
|
*/
|
||||||
|
bool Show(wxDebugReport& dbgrpt);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDebugReportCompress
|
||||||
|
@wxheader{debugrpt.h}
|
||||||
|
|
||||||
|
wxDebugReportCompress is a wxDebugReport which
|
||||||
|
compresses all the files in this debug report into a single .ZIP file in its
|
||||||
|
@c @e Process() function.
|
||||||
|
|
||||||
|
@library{wxqa}
|
||||||
|
@category{debugging}
|
||||||
|
*/
|
||||||
|
class wxDebugReportCompress : public wxDebugReport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Default constructor does nothing special.
|
||||||
|
*/
|
||||||
|
wxDebugReportCompress();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the full path of the compressed file (empty if creation failed).
|
||||||
|
*/
|
||||||
|
const wxString GetCompressedFileName();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDebugReport
|
||||||
|
@wxheader{debugrpt.h}
|
||||||
|
|
||||||
|
wxDebugReport is used to generate a debug report, containing information about
|
||||||
|
the program current state. It is usually used from
|
||||||
|
wxApp::OnFatalException as shown in the
|
||||||
|
sample.
|
||||||
|
|
||||||
|
A wxDebugReport object contains one or more files. A few of them can be created
|
||||||
|
by the
|
||||||
|
class itself but more can be created from the outside and then added to the
|
||||||
|
report. Also note that several virtual functions may be overridden to further
|
||||||
|
customize the class behaviour.
|
||||||
|
|
||||||
|
Once a report is fully assembled, it can simply be left in the temporary
|
||||||
|
directory so that the user can email it to the developers (in which case you
|
||||||
|
should still use wxDebugReportCompress to
|
||||||
|
compress it in a single file) or uploaded to a Web server using
|
||||||
|
wxDebugReportUpload (setting up the Web server
|
||||||
|
to accept uploads is your responsibility, of course). Other handlers, for
|
||||||
|
example for
|
||||||
|
automatically emailing the report, can be defined as well but are not currently
|
||||||
|
included in wxWidgets.
|
||||||
|
|
||||||
|
@library{wxqa}
|
||||||
|
@category{debugging}
|
||||||
|
*/
|
||||||
|
class wxDebugReport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
The constructor creates a temporary directory where the files that will
|
||||||
|
be included in the report are created. Use
|
||||||
|
IsOk() to check for errors.
|
||||||
|
*/
|
||||||
|
wxDebugReport();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The destructor normally destroys the temporary directory created in the
|
||||||
|
constructor
|
||||||
|
with all the files it contains. Call Reset() to
|
||||||
|
prevent this from happening.
|
||||||
|
*/
|
||||||
|
~wxDebugReport();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds all available information to the report. Currently this includes a
|
||||||
|
text (XML) file describing the process context and, under Win32, a minidump
|
||||||
|
file.
|
||||||
|
*/
|
||||||
|
void AddAll(Context context = Context_Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Add an XML file containing the current or exception context and the
|
||||||
|
stack trace.
|
||||||
|
*/
|
||||||
|
bool AddContext(Context ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The same as @ref addcontext() AddContext(Context_Current).
|
||||||
|
*/
|
||||||
|
bool AddCurrentContext();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The same as @ref adddump() AddDump(Context_Current).
|
||||||
|
*/
|
||||||
|
bool AddCurrentDump();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds the minidump file to the debug report.
|
||||||
|
|
||||||
|
Minidumps are only available under recent Win32 versions (@c dbghlp32.dll
|
||||||
|
can be installed under older systems to make minidumps available).
|
||||||
|
*/
|
||||||
|
bool AddDump(Context ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The same as @ref addcontext() AddContext(Context_Exception).
|
||||||
|
*/
|
||||||
|
bool AddExceptionContext();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The same as @ref adddump() AddDump(Context_Exception).
|
||||||
|
*/
|
||||||
|
bool AddExceptionDump();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Add another file to the report. If @e filename is an absolute path, it is
|
||||||
|
copied to a file in the debug report directory with the same name. Otherwise
|
||||||
|
the file should already exist in this directory
|
||||||
|
|
||||||
|
@e description only exists to be displayed to the user in the report summary
|
||||||
|
shown by wxDebugReportPreview.
|
||||||
|
*/
|
||||||
|
void AddFile(const wxString& filename,
|
||||||
|
const wxString& description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is a convenient wrapper around AddFile(). It
|
||||||
|
creates the file with the given @e name and writes @e text to it, then
|
||||||
|
adds the file to the report. The @e filename shouldn't contain the path.
|
||||||
|
|
||||||
|
Returns @true if file could be added successfully, @false if an IO error
|
||||||
|
occurred.
|
||||||
|
*/
|
||||||
|
bool AddText(const wxString& filename, const wxString& text,
|
||||||
|
const wxString& description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function may be overridden to add arbitrary custom context to the XML
|
||||||
|
context file created by AddContext(). By
|
||||||
|
default, it does nothing.
|
||||||
|
*/
|
||||||
|
void DoAddCustomContext(wxXmlNode * nodeRoot);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function may be overridden to modify the contents of the exception tag in
|
||||||
|
the XML context file.
|
||||||
|
*/
|
||||||
|
bool DoAddExceptionInfo(wxXmlNode* nodeContext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function may be overridden to modify the contents of the modules tag in
|
||||||
|
the XML context file.
|
||||||
|
*/
|
||||||
|
bool DoAddLoadedModules(wxXmlNode* nodeModules);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function may be overridden to modify the contents of the system tag in
|
||||||
|
the XML context file.
|
||||||
|
*/
|
||||||
|
bool DoAddSystemInfo(wxXmlNode* nodeSystemInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the name of the temporary directory used for the files in this report.
|
||||||
|
|
||||||
|
This method should be used to construct the full name of the files which you
|
||||||
|
wish to add to the report using AddFile().
|
||||||
|
*/
|
||||||
|
const wxString GetDirectory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves the name (relative to
|
||||||
|
wxDebugReport::GetDirectory) and the description of the
|
||||||
|
file with the given index. If @e n is greater than or equal to the number of
|
||||||
|
filse, @false is returned.
|
||||||
|
*/
|
||||||
|
bool GetFile(size_t n, wxString* name, wxString* desc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the current number files in this report.
|
||||||
|
*/
|
||||||
|
size_t GetFilesCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the name used as a base name for various files, by default
|
||||||
|
wxApp::GetAppName is used.
|
||||||
|
*/
|
||||||
|
wxString GetReportName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the object was successfully initialized. If this method
|
||||||
|
returns
|
||||||
|
@false the report can't be used.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Processes this report: the base class simply notifies the user that the
|
||||||
|
report has been generated. This is usually not enough -- instead you
|
||||||
|
should override this method to do something more useful to you.
|
||||||
|
*/
|
||||||
|
bool Process();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the file from report: this is used by
|
||||||
|
wxDebugReportPreview to allow the user to
|
||||||
|
remove files potentially containing private information from the report.
|
||||||
|
*/
|
||||||
|
void RemoveFile(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resets the directory name we use. The object can't be used any more after
|
||||||
|
this as it becomes uninitialized and invalid.
|
||||||
|
*/
|
||||||
|
void Reset();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDebugReportPreviewStd
|
||||||
|
@wxheader{debugrpt.h}
|
||||||
|
|
||||||
|
wxDebugReportPreviewStd is a standard debug report preview window. It displays
|
||||||
|
a GUIdialog allowing the user to examine the contents of a debug report, remove
|
||||||
|
files from and add notes to it.
|
||||||
|
|
||||||
|
@library{wxqa}
|
||||||
|
@category{debugging}
|
||||||
|
*/
|
||||||
|
class wxDebugReportPreviewStd : public wxDebugReportPreview
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Trivial default constructor.
|
||||||
|
*/
|
||||||
|
wxDebugReportPreviewStd();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Show the dialog, see
|
||||||
|
wxDebugReportPreview::Show for more
|
||||||
|
information.
|
||||||
|
*/
|
||||||
|
bool Show(wxDebugReport& dbgrpt);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDebugReportUpload
|
||||||
|
@wxheader{debugrpt.h}
|
||||||
|
|
||||||
|
This class is used to upload a compressed file using HTTP POST request. As this
|
||||||
|
class derives from wxDebugReportCompress, before upload the report is
|
||||||
|
compressed in a single .ZIP file.
|
||||||
|
|
||||||
|
@library{wxqa}
|
||||||
|
@category{debugging}
|
||||||
|
*/
|
||||||
|
class wxDebugReportUpload : public wxDebugReportCompress
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
This class will upload the compressed file created by its base class to an HTML
|
||||||
|
multipart/form-data form at the specified address. The @e url is the upload
|
||||||
|
page address, @e input is the name of the @c "type=file" control on
|
||||||
|
the form used for the file name and @e action is the value of the form
|
||||||
|
action field. The report is uploaded using @c @e curl program which
|
||||||
|
should be available, the @e curl parameter may be used to specify the full
|
||||||
|
path to it.
|
||||||
|
*/
|
||||||
|
wxDebugReportUpload(const wxString& url, const wxString& input,
|
||||||
|
const wxString& action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
This function may be overridden in a derived class to show the output from
|
||||||
|
curl: this may be an HTML page or anything else that the server returned.
|
||||||
|
Value returned by this function becomes the return value of
|
||||||
|
wxDebugReport::Process.
|
||||||
|
*/
|
||||||
|
bool OnServerReply();
|
||||||
|
};
|
||||||
149
interface/defs.h
Normal file
149
interface/defs.h
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: defs.h
|
||||||
|
// Purpose: documentation for global functions
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
These macros will swap the bytes of the @e value variable from little
|
||||||
|
endian to big endian or vice versa unconditionally, i.e. independently of the
|
||||||
|
current platform.
|
||||||
|
*/
|
||||||
|
wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value);
|
||||||
|
wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value);
|
||||||
|
wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value);
|
||||||
|
wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
This macro will swap the bytes of the @e value variable from little
|
||||||
|
endian to big endian or vice versa if the program is compiled on a
|
||||||
|
little-endian architecture (such as Intel PCs). If the program has
|
||||||
|
been compiled on a big-endian architecture, the value will be unchanged.
|
||||||
|
|
||||||
|
Use these macros to read data from and write data to a file that stores
|
||||||
|
data in big-endian format.
|
||||||
|
*/
|
||||||
|
wxInt32 wxINT32_SWAP_ON_LE(wxInt32 value);
|
||||||
|
wxUint32 wxUINT32_SWAP_ON_LE(wxUint32 value);
|
||||||
|
wxInt16 wxINT16_SWAP_ON_LE(wxInt16 value);
|
||||||
|
wxUint16 wxUINT16_SWAP_ON_LE(wxUint16 value);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro is similar to wxDEPRECATED but can be used
|
||||||
|
to not only declare the function @e func as deprecated but to also provide
|
||||||
|
its (inline) implementation @e body.
|
||||||
|
|
||||||
|
It can be used as following:
|
||||||
|
|
||||||
|
@code
|
||||||
|
class wxFoo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// OldMethod() is deprecated, use NewMethod() instead
|
||||||
|
void NewMethod();
|
||||||
|
wxDEPRECATED_INLINE( void OldMethod(), NewMethod() );
|
||||||
|
};
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
#define wxDEPRECATED_INLINE(func, body) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
@c wxEXPLICIT is a macro which expands to the C++ @c explicit keyword if
|
||||||
|
the compiler supports it or nothing otherwise. Thus, it can be used even in the
|
||||||
|
code which might have to be compiled with an old compiler without support for
|
||||||
|
this language feature but still take advantage of it when it is available.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
GNU C++ compiler gives a warning for any class whose destructor is private
|
||||||
|
unless it has a friend. This warning may sometimes be useful but it doesn't
|
||||||
|
make sense for reference counted class which always delete themselves (hence
|
||||||
|
destructor should be private) but don't necessarily have any friends, so this
|
||||||
|
macro is provided to disable the warning in such case. The @e name parameter
|
||||||
|
should be the name of the class but is only used to construct a unique friend
|
||||||
|
class name internally. Example of using the macro:
|
||||||
|
@code
|
||||||
|
class RefCounted
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RefCounted() { m_nRef = 1; }
|
||||||
|
void IncRef() { m_nRef++ ; }
|
||||||
|
void DecRef() { if ( !--m_nRef ) delete this; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
~RefCounted() { }
|
||||||
|
|
||||||
|
wxSUPPRESS_GCC_PRIVATE_DTOR(RefCounted)
|
||||||
|
};
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Notice that there should be no semicolon after this macro.
|
||||||
|
*/
|
||||||
|
#define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) /* implementation is private */
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
This macro will swap the bytes of the @e value variable from little
|
||||||
|
endian to big endian or vice versa if the program is compiled on a
|
||||||
|
big-endian architecture (such as Sun work stations). If the program has
|
||||||
|
been compiled on a little-endian architecture, the value will be unchanged.
|
||||||
|
|
||||||
|
Use these macros to read data from and write data to a file that stores
|
||||||
|
data in little-endian (for example Intel i386) format.
|
||||||
|
*/
|
||||||
|
wxInt32 wxINT32_SWAP_ON_BE(wxInt32 value);
|
||||||
|
wxUint32 wxUINT32_SWAP_ON_BE(wxUint32 value);
|
||||||
|
wxInt16 wxINT16_SWAP_ON_BE(wxInt16 value);
|
||||||
|
wxUint16 wxUINT16_SWAP_ON_BE(wxUint16 value);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro can be used around a function declaration to generate warnings
|
||||||
|
indicating that this function is deprecated (i.e. obsolete and planned to be
|
||||||
|
removed in the future) when it is used. Only Visual C++ 7 and higher and g++
|
||||||
|
compilers currently support this functionality.
|
||||||
|
|
||||||
|
Example of use:
|
||||||
|
|
||||||
|
@code
|
||||||
|
// old function, use wxString version instead
|
||||||
|
wxDEPRECATED( void wxGetSomething(char *buf, size_t len) );
|
||||||
|
|
||||||
|
// ...
|
||||||
|
wxString wxGetSomething();
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro is the same as the standard C99 @c va_copy for the compilers
|
||||||
|
which support it or its replacement for those that don't. It must be used to
|
||||||
|
preserve the value of a @c va_list object if you need to use it after
|
||||||
|
passing it to another function because it can be modified by the latter.
|
||||||
|
|
||||||
|
As with @c va_start, each call to @c wxVaCopy must have a matching
|
||||||
|
@c va_end.
|
||||||
|
*/
|
||||||
|
void wxVaCopy(va_list argptrDst, va_list argptrSrc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is a special version of wxDEPRECATED macro which
|
||||||
|
only does something when the deprecated function is used from the code outside
|
||||||
|
wxWidgets itself but doesn't generate warnings when it is used from wxWidgets.
|
||||||
|
It is used with the virtual functions which are called by the library itself --
|
||||||
|
even if such function is deprecated the library still has to call it to ensure
|
||||||
|
that the existing code overriding it continues to work, but the use of this
|
||||||
|
macro ensures that a deprecation warning will be generated if this function is
|
||||||
|
used from the user code or, in case of Visual C++, even when it is simply
|
||||||
|
overridden.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
559
interface/dialog.h
Normal file
559
interface/dialog.h
Normal file
@@ -0,0 +1,559 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dialog.h
|
||||||
|
// Purpose: documentation for wxDialog class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDialog
|
||||||
|
@wxheader{dialog.h}
|
||||||
|
|
||||||
|
A dialog box is a window with a title bar and sometimes a system menu, which
|
||||||
|
can be moved around the screen. It can contain controls and other windows and
|
||||||
|
is often used to allow the user to make some choice or to answer a question.
|
||||||
|
|
||||||
|
Dialogs can be made scrollable, automatically: please see @ref
|
||||||
|
overview_autoscrollingdialogs "Automatic scrolling dialogs" for further details.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxCAPTION}:
|
||||||
|
Puts a caption on the dialog box.
|
||||||
|
@style{wxDEFAULT_DIALOG_STYLE}:
|
||||||
|
Equivalent to a combination of wxCAPTION, wxCLOSE_BOX and
|
||||||
|
wxSYSTEM_MENU (the last one is not used under Unix)
|
||||||
|
@style{wxRESIZE_BORDER}:
|
||||||
|
Display a resizeable frame around the window.
|
||||||
|
@style{wxSYSTEM_MENU}:
|
||||||
|
Display a system menu.
|
||||||
|
@style{wxCLOSE_BOX}:
|
||||||
|
Displays a close box on the frame.
|
||||||
|
@style{wxMAXIMIZE_BOX}:
|
||||||
|
Displays a maximize box on the dialog.
|
||||||
|
@style{wxMINIMIZE_BOX}:
|
||||||
|
Displays a minimize box on the dialog.
|
||||||
|
@style{wxTHICK_FRAME}:
|
||||||
|
Display a thick frame around the window.
|
||||||
|
@style{wxSTAY_ON_TOP}:
|
||||||
|
The dialog stays on top of all other windows.
|
||||||
|
@style{wxNO_3D}:
|
||||||
|
Under Windows, specifies that the child controls should not have 3D
|
||||||
|
borders unless specified in the control.
|
||||||
|
@style{wxDIALOG_NO_PARENT}:
|
||||||
|
By default, a dialog created with a @NULL parent window will be
|
||||||
|
given the application's top level window as parent. Use this style
|
||||||
|
to prevent this from happening and create an orphan dialog. This is
|
||||||
|
not recommended for modal dialogs.
|
||||||
|
@style{wxDIALOG_EX_CONTEXTHELP}:
|
||||||
|
Under Windows, puts a query button on the caption. When pressed,
|
||||||
|
Windows will go into a context-sensitive help mode and wxWidgets
|
||||||
|
will send a wxEVT_HELP event if the user clicked on an application
|
||||||
|
window. Note that this is an extended style and must be set by
|
||||||
|
calling SetExtraStyle before Create is called (two-step
|
||||||
|
construction).
|
||||||
|
@style{wxDIALOG_EX_METAL}:
|
||||||
|
On Mac OS X, frames with this style will be shown with a metallic
|
||||||
|
look. This is an extra style.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{cmndlg}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdialogoverview "wxDialog overview", wxFrame, @ref
|
||||||
|
overview_validatoroverview "Validator overview"
|
||||||
|
*/
|
||||||
|
class wxDialog : public wxTopLevelWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Can be @NULL, a frame or another dialog box.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
An identifier for the dialog. A value of -1 is taken to mean a default.
|
||||||
|
|
||||||
|
@param title
|
||||||
|
The title of the dialog.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
The dialog position. The value wxDefaultPosition indicates a default position, chosen by
|
||||||
|
either the windowing system or wxWidgets, depending on platform.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
The dialog size. The value wxDefaultSize indicates a default size, chosen by
|
||||||
|
either the windowing system or wxWidgets, depending on platform.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style. See wxDialog.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Used to associate a name with the window,
|
||||||
|
allowing the application user to set Motif resource values for
|
||||||
|
individual dialog boxes.
|
||||||
|
|
||||||
|
@sa Create()
|
||||||
|
*/
|
||||||
|
wxDialog();
|
||||||
|
wxDialog(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_DIALOG_STYLE,
|
||||||
|
const wxString& name = "dialogBox");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor. Deletes any child windows before deleting the physical window.
|
||||||
|
*/
|
||||||
|
~wxDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds an identifier to be regarded as a main button for the non-scrolling area
|
||||||
|
of a dialog.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
void AddMainButtonId(wxWindowID id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this dialog can and should perform layout adaptation using
|
||||||
|
DoLayoutAdaptation(), usually if
|
||||||
|
the dialog is too large to fit on the display.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
bool CanDoLayoutAdapation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Centres the dialog box on the display.
|
||||||
|
|
||||||
|
@param direction
|
||||||
|
May be wxHORIZONTAL, wxVERTICAL or wxBOTH.
|
||||||
|
*/
|
||||||
|
void Centre(int direction = wxBOTH);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Used for two-step dialog box construction. See wxDialog()
|
||||||
|
for details.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_DIALOG_STYLE,
|
||||||
|
const wxString& name = "dialogBox");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a sizer with standard buttons. @e flags is a bit list
|
||||||
|
of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE,
|
||||||
|
wxHELP, wxNO_DEFAULT.
|
||||||
|
|
||||||
|
The sizer lays out the buttons in a manner appropriate to the platform.
|
||||||
|
|
||||||
|
This function uses CreateStdDialogButtonSizer()
|
||||||
|
internally for most platforms but doesn't create the sizer at all for the
|
||||||
|
platforms with hardware buttons (such as smartphones) for which it sets up the
|
||||||
|
hardware buttons appropriately and returns @NULL, so don't forget to test that
|
||||||
|
the return value is valid before using it.
|
||||||
|
*/
|
||||||
|
wxSizer* CreateButtonSizer(long flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a sizer with standard buttons using
|
||||||
|
CreateButtonSizer() separated from the rest
|
||||||
|
of the dialog contents by a horizontal wxStaticLine.
|
||||||
|
|
||||||
|
Please notice that just like CreateButtonSizer() this function may return @c
|
||||||
|
@NULL
|
||||||
|
if no buttons were created.
|
||||||
|
*/
|
||||||
|
wxSizer* CreateSeparatedButtonSizer(long flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a wxStdDialogButtonSizer with standard buttons. @e flags is a bit list
|
||||||
|
of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE,
|
||||||
|
wxHELP, wxNO_DEFAULT.
|
||||||
|
|
||||||
|
The sizer lays out the buttons in a manner appropriate to the platform.
|
||||||
|
*/
|
||||||
|
wxStdDialogButtonSizer* CreateStdDialogButtonSizer(long flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Performs layout adaptation, usually if the dialog is too large to fit on the
|
||||||
|
display.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
bool DoLayoutAdapation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called when the titlebar OK button is pressed (PocketPC only).
|
||||||
|
A command event for the identifier returned by GetAffirmativeId is sent by
|
||||||
|
default. You can override this function. If the function returns @false,
|
||||||
|
wxWidgets
|
||||||
|
will call Close() for the dialog.
|
||||||
|
*/
|
||||||
|
#define virtual bool DoOK() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
A static function enabling or disabling layout adaptation for all dialogs.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
static void EnableLayoutAdaptation(bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Ends a modal dialog, passing a value to be returned from the ShowModal()
|
||||||
|
invocation.
|
||||||
|
|
||||||
|
@param retCode
|
||||||
|
The value that should be returned by ShowModal.
|
||||||
|
|
||||||
|
@sa ShowModal(), GetReturnCode(), SetReturnCode()
|
||||||
|
*/
|
||||||
|
void EndModal(int retCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the identifier of the button which works like standard OK button in this
|
||||||
|
dialog.
|
||||||
|
|
||||||
|
@sa SetAffirmativeId()
|
||||||
|
*/
|
||||||
|
int GetAffirmativeId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override this to return a window containing the main content of the dialog.
|
||||||
|
This is
|
||||||
|
particularly useful when the dialog implements pages, such as
|
||||||
|
wxPropertySheetDialog,
|
||||||
|
and allows the @ref overview_wxdialogoverview "layout adaptation code" to know
|
||||||
|
that only the pages need to be made scrollable.
|
||||||
|
*/
|
||||||
|
wxWindow* GetContentWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the identifier of the button to map presses of @c ESC
|
||||||
|
button to.
|
||||||
|
|
||||||
|
@sa SetEscapeId()
|
||||||
|
*/
|
||||||
|
int GetEscapeId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the dialog has been adapted, usually by making it scrollable
|
||||||
|
to work with a small display.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
bool GetLayoutAdaptationDone();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets a value representing the aggressiveness of search for buttons and sizers
|
||||||
|
to be in the non-scrolling part of a layout-adapted dialog.
|
||||||
|
Zero switches off adaptation, and 3 allows search for standard buttons anywhere
|
||||||
|
in the dialog.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
int GetLayoutAdaptationLevel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the adaptation mode, overriding the global adaptation flag.
|
||||||
|
|
||||||
|
See also SetLayoutAdaptationMode() and @ref overview_autoscrollingdialogs
|
||||||
|
"Automatic scrolling dialogs".
|
||||||
|
*/
|
||||||
|
wxDialogLayoutAdaptationMode GetLayoutAdaptationMode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
A static function getting the current layout adapter object.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
static wxDialogLayoutAdapter* GetLayoutAdapter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns an array of identifiers to be regarded as the main buttons for the
|
||||||
|
non-scrolling area of a dialog.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
wxArrayInt GetMainButtonIds();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the return code for this window.
|
||||||
|
|
||||||
|
@remarks A return code is normally associated with a modal dialog, where
|
||||||
|
ShowModal() returns a code to the application.
|
||||||
|
|
||||||
|
@sa SetReturnCode(), ShowModal(), EndModal()
|
||||||
|
*/
|
||||||
|
int GetReturnCode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
On PocketPC, a dialog is automatically provided with an empty toolbar.
|
||||||
|
GetToolBar
|
||||||
|
allows you to access the toolbar and add tools to it. Removing tools and adding
|
||||||
|
arbitrary controls are not currently supported.
|
||||||
|
|
||||||
|
This function is not available on any other platform.
|
||||||
|
*/
|
||||||
|
wxToolBar* GetToolBar();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Iconizes or restores the dialog. Windows only.
|
||||||
|
|
||||||
|
@param iconize
|
||||||
|
If @true, iconizes the dialog box; if @false, shows and restores it.
|
||||||
|
|
||||||
|
@remarks Note that in Windows, iconization has no effect since dialog
|
||||||
|
boxes cannot be iconized. However, applications may
|
||||||
|
need to explicitly restore dialog boxes under Motif
|
||||||
|
which have user-iconizable frames, and under Windows
|
||||||
|
calling Iconize(@false) will bring the window to the
|
||||||
|
front, as does Show(@true).
|
||||||
|
*/
|
||||||
|
void Iconize(bool iconize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the dialog box is iconized. Windows only.
|
||||||
|
|
||||||
|
@remarks Always returns @false under Windows since dialogs cannot be
|
||||||
|
iconized.
|
||||||
|
*/
|
||||||
|
bool IsIconized();
|
||||||
|
|
||||||
|
/**
|
||||||
|
A static function returning @true if layout adaptation is enabled for all
|
||||||
|
dialogs.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
static bool IsLayoutAdaptationEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if @e id is in the array of identifiers to be regarded as the
|
||||||
|
main buttons for the non-scrolling area of a dialog.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
bool IsMainButton(wxWindowID& id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the dialog box is modal, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool IsModal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The default handler for wxEVT_SYS_COLOUR_CHANGED.
|
||||||
|
|
||||||
|
@param event
|
||||||
|
The colour change event.
|
||||||
|
|
||||||
|
@remarks Changes the dialog's colour to conform to the current settings
|
||||||
|
(Windows only). Add an event table entry for your
|
||||||
|
dialog class if you wish the behaviour to be
|
||||||
|
different (such as keeping a user-defined background
|
||||||
|
colour). If you do override this function, call
|
||||||
|
wxEvent::Skip to propagate the notification to child
|
||||||
|
windows and controls.
|
||||||
|
|
||||||
|
@sa wxSysColourChangedEvent
|
||||||
|
*/
|
||||||
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the identifier to be used as OK button. When the button with this
|
||||||
|
identifier is pressed, the dialog calls wxWindow::Validate
|
||||||
|
and wxWindow::TransferDataFromWindow
|
||||||
|
and, if they both return @true, closes the dialog with @c wxID_OK return
|
||||||
|
code.
|
||||||
|
|
||||||
|
Also, when the user presses a hardware OK button on the devices having one or
|
||||||
|
the special OK button in the PocketPC title bar, an event with this id is
|
||||||
|
generated.
|
||||||
|
|
||||||
|
By default, the affirmative id is wxID_OK.
|
||||||
|
|
||||||
|
@sa GetAffirmativeId(), SetEscapeId()
|
||||||
|
*/
|
||||||
|
void SetAffirmativeId(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the identifier of the button which should work like the standard
|
||||||
|
@c CANCEL button in this dialog. When the button with this id is
|
||||||
|
clicked, the dialog is closed. Also, when the user presses @c ESC
|
||||||
|
key in the dialog or closes the dialog using the close button in the title bar,
|
||||||
|
this is mapped to the click of the button with the specified id.
|
||||||
|
|
||||||
|
By default, the escape id is the special value @c wxID_ANY meaning that
|
||||||
|
@c wxID_CANCEL button is used if it's present in the dialog and
|
||||||
|
otherwise the button with GetAffirmativeId()
|
||||||
|
is used. Another special value for @e id is @c wxID_NONE meaning that
|
||||||
|
@c ESC presses should be ignored. If any other value is given, it
|
||||||
|
is interpreted as the id of the button to map the escape key to.
|
||||||
|
*/
|
||||||
|
void SetEscapeId(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the icon for this dialog.
|
||||||
|
|
||||||
|
@param icon
|
||||||
|
The icon to associate with this dialog.
|
||||||
|
*/
|
||||||
|
void SetIcon(const wxIcon& icon);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the icons for this dialog.
|
||||||
|
|
||||||
|
@param icons
|
||||||
|
The icons to associate with this dialog.
|
||||||
|
*/
|
||||||
|
void SetIcons(const wxIconBundle& icons);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Marks the dialog as having been adapted, usually by making it scrollable to
|
||||||
|
work with a small display.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
void SetLayoutAdaptationDone(bool done);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the aggressiveness of search for buttons and sizers to be in the
|
||||||
|
non-scrolling part of a layout-adapted dialog.
|
||||||
|
Zero switches off adaptation, and 3 allows search for standard buttons anywhere
|
||||||
|
in the dialog.
|
||||||
|
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
void SetLayoutAdaptationLevel(int level);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the adaptation mode, overriding the global adaptation flag. @e mode may be
|
||||||
|
one of the following values:
|
||||||
|
See also @ref overview_autoscrollingdialogs "Automatic scrolling dialogs" for
|
||||||
|
more on layout adaptation.
|
||||||
|
*/
|
||||||
|
void SetLayoutAdaptationMode(wxDialogLayoutAdaptationMode mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
A static function for setting the current layout adapter object, returning the
|
||||||
|
old adapter. If you call this, you should
|
||||||
|
delete the old adapter object.
|
||||||
|
|
||||||
|
See also wxDialogLayoutAdapter and @ref overview_autoscrollingdialogs
|
||||||
|
"Automatic scrolling dialogs".
|
||||||
|
*/
|
||||||
|
static wxDialogLayoutAdapter* SetLayoutAdapter(wxDialogLayoutAdapter* adapter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@b NB: This function is deprecated and doesn't work for all ports, just use
|
||||||
|
ShowModal() to show a modal dialog instead.
|
||||||
|
|
||||||
|
Allows the programmer to specify whether the dialog box is modal (Show() blocks
|
||||||
|
control
|
||||||
|
until the dialog is hidden) or modeless (control returns immediately).
|
||||||
|
|
||||||
|
@param flag
|
||||||
|
If @true, the dialog will be modal, otherwise it will be modeless.
|
||||||
|
*/
|
||||||
|
void SetModal(bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the return code for this window.
|
||||||
|
|
||||||
|
@param retCode
|
||||||
|
The integer return code, usually a control identifier.
|
||||||
|
|
||||||
|
@remarks A return code is normally associated with a modal dialog, where
|
||||||
|
ShowModal() returns a code to the
|
||||||
|
application. The function EndModal() calls
|
||||||
|
SetReturnCode.
|
||||||
|
|
||||||
|
@sa GetReturnCode(), ShowModal(), EndModal()
|
||||||
|
*/
|
||||||
|
void SetReturnCode(int retCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Hides or shows the dialog.
|
||||||
|
|
||||||
|
@param show
|
||||||
|
If @true, the dialog box is shown and brought to the front;
|
||||||
|
otherwise the box is hidden. If @false and the dialog is
|
||||||
|
modal, control is returned to the calling program.
|
||||||
|
|
||||||
|
@remarks The preferred way of dismissing a modal dialog is to use
|
||||||
|
EndModal().
|
||||||
|
*/
|
||||||
|
bool Show(bool show);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows a modal dialog. Program flow does not return until the dialog has been
|
||||||
|
dismissed with
|
||||||
|
EndModal().
|
||||||
|
|
||||||
|
@returns The return value is the value set with SetReturnCode().
|
||||||
|
*/
|
||||||
|
int ShowModal();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDialogLayoutAdapter
|
||||||
|
@wxheader{dialog.h}
|
||||||
|
|
||||||
|
This abstract class is the base for classes that help wxWidgets peform run-time
|
||||||
|
layout adaptation of dialogs. Principally,
|
||||||
|
this is to cater for small displays by making part of the dialog scroll, but
|
||||||
|
the application developer may find other
|
||||||
|
uses for layout adaption.
|
||||||
|
|
||||||
|
By default, there is one instance of wxStandardDialogLayoutAdapter
|
||||||
|
which can perform adaptation for most custom dialogs and dialogs with book
|
||||||
|
controls
|
||||||
|
such as wxPropertySheetDialog.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_autoscrollingdialogs "Automatic scrolling dialogs"
|
||||||
|
*/
|
||||||
|
class wxDialogLayoutAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Default constructor.
|
||||||
|
*/
|
||||||
|
wxDialogLayoutAdapter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override this to returns @true if adaptation can and should be done.
|
||||||
|
*/
|
||||||
|
bool CanDoLayoutAdaptation(wxDialog* dialog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override this to perform layout adaptation, such as making parts of the dialog
|
||||||
|
scroll and resizing the dialog to fit the display.
|
||||||
|
Normally this function will be called just before the dialog is shown.
|
||||||
|
*/
|
||||||
|
bool DoLayoutAdaptation(wxDialog* dialog);
|
||||||
|
};
|
||||||
209
interface/dialup.h
Normal file
209
interface/dialup.h
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dialup.h
|
||||||
|
// Purpose: documentation for wxDialUpManager class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDialUpManager
|
||||||
|
@wxheader{dialup.h}
|
||||||
|
|
||||||
|
This class encapsulates functions dealing with verifying the connection status
|
||||||
|
of the workstation (connected to the Internet via a direct connection,
|
||||||
|
connected through a modem or not connected at all) and to establish this
|
||||||
|
connection if possible/required (i.e. in the case of the modem).
|
||||||
|
|
||||||
|
The program may also wish to be notified about the change in the connection
|
||||||
|
status (for example, to perform some action when the user connects to the
|
||||||
|
network the next time or, on the contrary, to stop receiving data from the net
|
||||||
|
when the user hangs up the modem). For this, you need to use one of the event
|
||||||
|
macros described below.
|
||||||
|
|
||||||
|
This class is different from other wxWidgets classes in that there is at most
|
||||||
|
one instance of this class in the program accessed via
|
||||||
|
wxDialUpManager::Create and you can't
|
||||||
|
create the objects of this class directly.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{net}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_sampledialup "dialup sample", wxDialUpEvent
|
||||||
|
*/
|
||||||
|
class wxDialUpManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxDialUpManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Cancel dialing the number initiated with Dial()
|
||||||
|
with async parameter equal to @true.
|
||||||
|
|
||||||
|
Note that this won't result in DISCONNECTED event being sent.
|
||||||
|
|
||||||
|
@sa IsDialing()
|
||||||
|
*/
|
||||||
|
bool CancelDialing();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function should create and return the object of the platform-specific
|
||||||
|
class derived from wxDialUpManager. You should delete the pointer when you are
|
||||||
|
done with it.
|
||||||
|
*/
|
||||||
|
wxDialUpManager* Create();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Dial the given ISP, use @e username and @e password to authenticate.
|
||||||
|
|
||||||
|
The parameters are only used under Windows currently, for Unix you should use
|
||||||
|
SetConnectCommand() to customize this
|
||||||
|
functions behaviour.
|
||||||
|
|
||||||
|
If no @e nameOfISP is given, the function will select the default one
|
||||||
|
(proposing the user to choose among all connections defined on this machine)
|
||||||
|
and if no username and/or password are given, the function will try to do
|
||||||
|
without them, but will ask the user if really needed.
|
||||||
|
|
||||||
|
If @e async parameter is @false, the function waits until the end of dialing
|
||||||
|
and returns @true upon successful completion.
|
||||||
|
|
||||||
|
If @e async is @true, the function only initiates the connection and
|
||||||
|
returns immediately - the result is reported via events (an event is sent
|
||||||
|
anyhow, but if dialing failed it will be a DISCONNECTED one).
|
||||||
|
*/
|
||||||
|
bool Dial(const wxString& nameOfISP = wxEmptyString,
|
||||||
|
const wxString& username = wxEmptyString,
|
||||||
|
const wxString& password = wxEmptyString,
|
||||||
|
bool async = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Disable automatic check for connection status change - notice that the
|
||||||
|
@c wxEVT_DIALUP_XXX events won't be sent any more neither.
|
||||||
|
*/
|
||||||
|
void DisableAutoCheckOnlineStatus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enable automatic checks for the connection status and sending of
|
||||||
|
@c wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval
|
||||||
|
parameter is only for Unix where we do the check manually and specifies how
|
||||||
|
often should we repeat the check (each minute by default). Under Windows, the
|
||||||
|
notification about the change of connection status is sent by the system and so
|
||||||
|
we don't do any polling and this parameter is ignored.
|
||||||
|
|
||||||
|
Returns @false if couldn't set up automatic check for online status.
|
||||||
|
*/
|
||||||
|
bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is only implemented under Windows.
|
||||||
|
|
||||||
|
Fills the array with the names of all possible values for the first
|
||||||
|
parameter to Dial() on this machine and returns
|
||||||
|
their number (may be 0).
|
||||||
|
*/
|
||||||
|
size_t GetISPNames(wxArrayString& names);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Hang up the currently active dial up connection.
|
||||||
|
*/
|
||||||
|
bool HangUp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the computer has a permanent network connection (i.e. is
|
||||||
|
on a LAN) and so there is no need to use Dial() function to go online.
|
||||||
|
|
||||||
|
@b NB: this functions tries to guess the result and it is not always
|
||||||
|
guaranteed to be correct, so it is better to ask user for
|
||||||
|
confirmation or give him a possibility to override it.
|
||||||
|
*/
|
||||||
|
bool IsAlwaysOnline();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if (async) dialing is in progress.
|
||||||
|
|
||||||
|
@sa Dial()
|
||||||
|
*/
|
||||||
|
bool IsDialing();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the dialup manager was initialized correctly. If this
|
||||||
|
function returns @false, no other functions will work neither, so it is a
|
||||||
|
good idea to call this function and check its result before calling any other
|
||||||
|
wxDialUpManager methods
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the computer is connected to the network: under Windows,
|
||||||
|
this just means that a RAS connection exists, under Unix we check that
|
||||||
|
the "well-known host" (as specified by
|
||||||
|
wxDialUpManager::SetWellKnownHost) is reachable.
|
||||||
|
*/
|
||||||
|
bool IsOnline();
|
||||||
|
|
||||||
|
/**
|
||||||
|
, @b const wxString&@e commandHangup = wxT("/usr/bin/poff"))
|
||||||
|
|
||||||
|
This method is for Unix only.
|
||||||
|
|
||||||
|
Sets the commands to start up the network and to hang up again.
|
||||||
|
*/
|
||||||
|
void SetConnectCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sometimes the built-in logic for determining the online status may fail,
|
||||||
|
so, in general, the user should be allowed to override it. This function
|
||||||
|
allows to forcefully set the online status - whatever our internal
|
||||||
|
algorithm may think about it.
|
||||||
|
|
||||||
|
@sa IsOnline()
|
||||||
|
*/
|
||||||
|
void SetOnlineStatus(bool isOnline = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method is for Unix only.
|
||||||
|
|
||||||
|
Under Unix, the value of well-known host is used to check whether we're
|
||||||
|
connected to the internet. It is unused under Windows, but this function
|
||||||
|
is always safe to call. The default value is @c www.yahoo.com:80.
|
||||||
|
*/
|
||||||
|
void SetWellKnownHost(const wxString& hostname, int portno = 80);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDialUpEvent
|
||||||
|
@wxheader{dialup.h}
|
||||||
|
|
||||||
|
This is the event class for the dialup events sent by
|
||||||
|
wxDialUpManager.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{events}
|
||||||
|
*/
|
||||||
|
class wxDialUpEvent : public wxEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor is only used by wxDialUpManager.
|
||||||
|
*/
|
||||||
|
wxDialUpEvent(bool isConnected, bool isOwnEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Is this a @c CONNECTED or @c DISCONNECTED event? In other words, does it
|
||||||
|
notify about transition from offline to online state or vice versa?
|
||||||
|
*/
|
||||||
|
bool IsConnectedEvent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Does this event come from wxDialUpManager::Dial() or from some extrenal
|
||||||
|
process (i.e. does it result from our own attempt to establish the
|
||||||
|
connection)?
|
||||||
|
*/
|
||||||
|
bool IsOwnEvent();
|
||||||
|
};
|
||||||
268
interface/dir.h
Normal file
268
interface/dir.h
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dir.h
|
||||||
|
// Purpose: documentation for wxDirTraverser class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDirTraverser
|
||||||
|
@wxheader{dir.h}
|
||||||
|
|
||||||
|
wxDirTraverser is an abstract interface which must be implemented by objects
|
||||||
|
passed to wxDir::Traverse function.
|
||||||
|
|
||||||
|
Example of use (this works almost like wxDir::GetAllFiles):
|
||||||
|
|
||||||
|
@code
|
||||||
|
class wxDirTraverserSimple : public wxDirTraverser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDirTraverserSimple(wxArrayString& files) : m_files(files) { }
|
||||||
|
|
||||||
|
virtual wxDirTraverseResult OnFile(const wxString& filename)
|
||||||
|
{
|
||||||
|
m_files.Add(filename);
|
||||||
|
return wxDIR_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname))
|
||||||
|
{
|
||||||
|
return wxDIR_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxArrayString& m_files;
|
||||||
|
};
|
||||||
|
|
||||||
|
// get the names of all files in the array
|
||||||
|
wxArrayString files;
|
||||||
|
wxDirTraverserSimple traverser(files);
|
||||||
|
|
||||||
|
wxDir dir(dirname);
|
||||||
|
dir.Traverse(traverser);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{file}
|
||||||
|
*/
|
||||||
|
class wxDirTraverser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
This function is called for each directory. It may return @c wxSIR_STOP
|
||||||
|
to abort traversing completely, @c wxDIR_IGNORE to skip this directory but
|
||||||
|
continue with others or @c wxDIR_CONTINUE to enumerate all files and
|
||||||
|
subdirectories in this directory.
|
||||||
|
|
||||||
|
This is a pure virtual function and must be implemented in the derived class.
|
||||||
|
*/
|
||||||
|
virtual wxDirTraverseResult OnDir(const wxString& dirname);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called for each file. It may return @c wxDIR_STOP to abort
|
||||||
|
traversing (for example, if the file being searched is found) or
|
||||||
|
@c wxDIR_CONTINUE to proceed.
|
||||||
|
|
||||||
|
This is a pure virtual function and must be implemented in the derived class.
|
||||||
|
*/
|
||||||
|
virtual wxDirTraverseResult OnFile(const wxString& filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is called for each directory which we failed to open for
|
||||||
|
enumerating. It may return @c wxSIR_STOP to abort traversing completely,
|
||||||
|
@c wxDIR_IGNORE to skip this directory but continue with others or
|
||||||
|
@c wxDIR_CONTINUE to retry opening this directory once again.
|
||||||
|
|
||||||
|
The base class version always returns @c wxDIR_IGNORE.
|
||||||
|
*/
|
||||||
|
virtual wxDirTraverseResult OnOpenError(const wxString& openerrorname);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDir
|
||||||
|
@wxheader{dir.h}
|
||||||
|
|
||||||
|
wxDir is a portable equivalent of Unix open/read/closedir functions which
|
||||||
|
allow enumerating of the files in a directory. wxDir allows to enumerate files
|
||||||
|
as well as directories.
|
||||||
|
|
||||||
|
wxDir also provides a flexible way to enumerate files recursively using
|
||||||
|
wxDir::Traverse or a simpler
|
||||||
|
wxDir::GetAllFiles function.
|
||||||
|
|
||||||
|
Example of use:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxDir dir(wxGetCwd());
|
||||||
|
|
||||||
|
if ( !dir.IsOpened() )
|
||||||
|
{
|
||||||
|
// deal with the error here - wxDir would already log an error message
|
||||||
|
// explaining the exact reason of the failure
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
puts("Enumerating object files in current directory:");
|
||||||
|
|
||||||
|
wxString filename;
|
||||||
|
|
||||||
|
bool cont = dir.GetFirst(, filespec, flags);
|
||||||
|
while ( cont )
|
||||||
|
{
|
||||||
|
printf("%s\n", filename.c_str());
|
||||||
|
|
||||||
|
cont = dir.GetNext();
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{file}
|
||||||
|
*/
|
||||||
|
class wxDir
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Opens the directory for enumeration, use IsOpened()
|
||||||
|
to test for errors.
|
||||||
|
*/
|
||||||
|
wxDir();
|
||||||
|
wxDir(const wxString& dir);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor cleans up the associated resources. It is not virtual and so this
|
||||||
|
class is not meant to be used polymorphically.
|
||||||
|
*/
|
||||||
|
~wxDir();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Test for existence of a directory with the given name
|
||||||
|
*/
|
||||||
|
static bool Exists(const wxString& dir);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function returns the path of the first file matching the given @e filespec
|
||||||
|
or an empty string if there are no files matching it.
|
||||||
|
|
||||||
|
The @e flags parameter may or may not include @c wxDIR_FILES, the
|
||||||
|
function always behaves as if it were specified. By default, @e flags
|
||||||
|
includes @c wxDIR_DIRS and so the function recurses into the subdirectories
|
||||||
|
but if this flag is not specified, the function restricts the search only to
|
||||||
|
the directory @e dirname itself.
|
||||||
|
|
||||||
|
See also: Traverse()
|
||||||
|
*/
|
||||||
|
static wxString FindFirst(const wxString& dirname,
|
||||||
|
const wxString& filespec,
|
||||||
|
int flags = wxDIR_DEFAULT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function appends the names of all the files under directory @e dirname
|
||||||
|
to the array @e files (note that its old content is preserved). Only files
|
||||||
|
matching the @e filespec are taken, with empty spec matching all the files.
|
||||||
|
|
||||||
|
The @e flags parameter should always include @c wxDIR_FILES or the array
|
||||||
|
would be unchanged and should include @c wxDIR_DIRS flag to recurse into
|
||||||
|
subdirectories (both flags are included in the value by default).
|
||||||
|
|
||||||
|
See also: Traverse()
|
||||||
|
*/
|
||||||
|
static size_t GetAllFiles(const wxString& dirname,
|
||||||
|
wxArrayString * files,
|
||||||
|
const wxString& filespec = wxEmptyString,
|
||||||
|
int flags = wxDIR_DEFAULT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Start enumerating all files matching @e filespec (or all files if it is
|
||||||
|
empty) and @e flags, return @true on success.
|
||||||
|
*/
|
||||||
|
bool GetFirst(wxString* filename,
|
||||||
|
const wxString& filespec = wxEmptyString,
|
||||||
|
int flags = wxDIR_DEFAULT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the name of the directory itself. The returned string does not have the
|
||||||
|
trailing path separator (slash or backslash).
|
||||||
|
*/
|
||||||
|
wxString GetName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Continue enumerating files which satisfy the criteria specified by the last
|
||||||
|
call to GetFirst().
|
||||||
|
*/
|
||||||
|
bool GetNext(wxString* filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the size (in bytes) of all files recursively found in @c dir or
|
||||||
|
@c wxInvalidSize in case of error.
|
||||||
|
|
||||||
|
In case it happens that while traversing folders a file's size can not be read,
|
||||||
|
that file is added to the @c filesSkipped array, if not @NULL, and then
|
||||||
|
skipped.
|
||||||
|
This usually happens with some special folders which are locked by the
|
||||||
|
operating system
|
||||||
|
or by another process. Remember that when @c filesSkipped-GetCount() is not
|
||||||
|
zero,
|
||||||
|
then the returned value is not 100% accurate and, if the skipped files were
|
||||||
|
big, it could be
|
||||||
|
far from real size of the directory.
|
||||||
|
|
||||||
|
See also: wxFileName::GetHumanReadableSize,
|
||||||
|
wxGetDiskSpace
|
||||||
|
*/
|
||||||
|
static wxULongLong GetTotalSize(const wxString& dir,
|
||||||
|
wxArrayString* filesSkipped = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the directory contains any files matching the given
|
||||||
|
@e filespec. If @e filespec is empty, look for any files at all. In any
|
||||||
|
case, even hidden files are taken into account.
|
||||||
|
*/
|
||||||
|
bool HasFiles(const wxString& filespec = wxEmptyString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the directory contains any subdirectories (if a non
|
||||||
|
empty @e filespec is given, only check for directories matching it).
|
||||||
|
The hidden subdirectories are taken into account as well.
|
||||||
|
*/
|
||||||
|
bool HasSubDirs(const wxString& dirspec = wxEmptyString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the directory was successfully opened by a previous call to
|
||||||
|
Open().
|
||||||
|
*/
|
||||||
|
bool IsOpened();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Open the directory for enumerating, returns @true on success
|
||||||
|
or @false if an error occurred.
|
||||||
|
*/
|
||||||
|
bool Open(const wxString& dir);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enumerate all files and directories under the given directory recursively
|
||||||
|
calling the element of the provided wxDirTraverser
|
||||||
|
object for each of them.
|
||||||
|
|
||||||
|
More precisely, the function will really recurse into subdirectories if
|
||||||
|
@e flags contains @c wxDIR_DIRS flag. It will ignore the files (but
|
||||||
|
still possibly recurse into subdirectories) if @c wxDIR_FILES flag is
|
||||||
|
given.
|
||||||
|
|
||||||
|
For each found directory, @ref wxDirTraverser::ondir sink.OnDir is called
|
||||||
|
and @ref wxDirTraverser::onfile sink.OnFile is called for every file.
|
||||||
|
Depending on the return value, the enumeration may continue or stop.
|
||||||
|
|
||||||
|
The function returns the total number of files found or @c (size_t)-1 on
|
||||||
|
error.
|
||||||
|
|
||||||
|
See also: GetAllFiles()
|
||||||
|
*/
|
||||||
|
size_t Traverse(wxDirTraverser& sink,
|
||||||
|
const wxString& filespec = wxEmptyString,
|
||||||
|
int flags = wxDIR_DEFAULT);
|
||||||
|
};
|
||||||
184
interface/dirctrl.h
Normal file
184
interface/dirctrl.h
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dirctrl.h
|
||||||
|
// Purpose: documentation for wxGenericDirCtrl class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxGenericDirCtrl
|
||||||
|
@wxheader{dirctrl.h}
|
||||||
|
|
||||||
|
This control can be used to place a directory listing (with optional files) on
|
||||||
|
an arbitrary window.
|
||||||
|
|
||||||
|
The control contains a wxTreeCtrl window representing the directory
|
||||||
|
hierarchy, and optionally, a wxChoice window containing a list of filters.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{ctrl}
|
||||||
|
@appearance{genericdirctrl.png}
|
||||||
|
*/
|
||||||
|
class wxGenericDirCtrl : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Main constructor.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Window identifier.
|
||||||
|
|
||||||
|
@param dir
|
||||||
|
Initial folder.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Size.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. Please see wxGenericDirCtrl for a list of possible styles.
|
||||||
|
|
||||||
|
@param filter
|
||||||
|
A filter string, using the same syntax as that for wxFileDialog. This may be
|
||||||
|
empty if filters
|
||||||
|
are not being used.
|
||||||
|
|
||||||
|
Example: "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"
|
||||||
|
|
||||||
|
@param defaultFilter
|
||||||
|
The zero-indexed default filter setting.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The window name.
|
||||||
|
*/
|
||||||
|
wxGenericDirCtrl();
|
||||||
|
wxGenericDirCtrl(wxWindow* parent, const wxWindowID id = -1,
|
||||||
|
const wxString& dir = wxDirDialogDefaultFolderStr,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDIRCTRL_3D_INTERNAL|wxBORDER_SUNKEN,
|
||||||
|
const wxString& filter = wxEmptyString,
|
||||||
|
int defaultFilter = 0,
|
||||||
|
const wxString& name = wxTreeCtrlNameStr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxGenericDirCtrl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Collapse the given path.
|
||||||
|
*/
|
||||||
|
bool CollapsePath(const wxString& path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Collapses the entire tree.
|
||||||
|
*/
|
||||||
|
void CollapseTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create function for two-step construction. See wxGenericDirCtrl() for details.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, const wxWindowID id = -1,
|
||||||
|
const wxString& dir = wxDirDialogDefaultFolderStr,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDIRCTRL_3D_INTERNAL|wxBORDER_SUNKEN,
|
||||||
|
const wxString& filter = wxEmptyString,
|
||||||
|
int defaultFilter = 0,
|
||||||
|
const wxString& name = wxTreeCtrlNameStr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tries to expand as much of the given path as possible, so that the filename or
|
||||||
|
directory is visible in the tree control.
|
||||||
|
*/
|
||||||
|
bool ExpandPath(const wxString& path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the default path.
|
||||||
|
*/
|
||||||
|
wxString GetDefaultPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets selected filename path only (else empty string).
|
||||||
|
|
||||||
|
This function doesn't count a directory as a selection.
|
||||||
|
*/
|
||||||
|
wxString GetFilePath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the filter string.
|
||||||
|
*/
|
||||||
|
wxString GetFilter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current filter index (zero-based).
|
||||||
|
*/
|
||||||
|
int GetFilterIndex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the filter list control (if present).
|
||||||
|
*/
|
||||||
|
wxDirFilterListCtrl* GetFilterListCtrl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the currently-selected directory or filename.
|
||||||
|
*/
|
||||||
|
wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the root id for the tree control.
|
||||||
|
*/
|
||||||
|
wxTreeItemId GetRootId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the tree control.
|
||||||
|
*/
|
||||||
|
wxTreeCtrl* GetTreeCtrl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initializes variables.
|
||||||
|
*/
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Collapse and expand the tree, thus re-creating it from scratch.
|
||||||
|
May be used to update the displayed directory content.
|
||||||
|
*/
|
||||||
|
void ReCreateTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the default path.
|
||||||
|
*/
|
||||||
|
void SetDefaultPath(const wxString& path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the filter string.
|
||||||
|
*/
|
||||||
|
void SetFilter(const wxString& filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current filter index (zero-based).
|
||||||
|
*/
|
||||||
|
void SetFilterIndex(int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current path.
|
||||||
|
*/
|
||||||
|
void SetPath(const wxString& path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param show
|
||||||
|
If @true, hidden folders and files will be displayed by the
|
||||||
|
control. If @false, they will not be displayed.
|
||||||
|
*/
|
||||||
|
void ShowHidden(bool show);
|
||||||
|
};
|
||||||
128
interface/dirdlg.h
Normal file
128
interface/dirdlg.h
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dirdlg.h
|
||||||
|
// Purpose: documentation for wxDirDialog class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDirDialog
|
||||||
|
@wxheader{dirdlg.h}
|
||||||
|
|
||||||
|
This class represents the directory chooser dialog.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxDD_DEFAULT_STYLE}:
|
||||||
|
Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and
|
||||||
|
wxRESIZE_BORDER (the last one is not used under wxWinCE).
|
||||||
|
@style{wxDD_DIR_MUST_EXIST}:
|
||||||
|
The dialog will allow the user to choose only an existing folder.
|
||||||
|
When this style is not given, a "Create new directory" button is
|
||||||
|
added to the dialog (on Windows) or some other way is provided to
|
||||||
|
the user to type the name of a new folder.
|
||||||
|
@style{wxDD_CHANGE_DIR}:
|
||||||
|
Change the current working directory to the directory chosen by the
|
||||||
|
user.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{cmndlg}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdirdialogoverview "wxDirDialog overview", wxFileDialog
|
||||||
|
*/
|
||||||
|
class wxDirDialog : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Use ShowModal() to show
|
||||||
|
the dialog.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window.
|
||||||
|
|
||||||
|
@param message
|
||||||
|
Message to show on the dialog.
|
||||||
|
|
||||||
|
@param defaultPath
|
||||||
|
The default path, or the empty string.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The dialog style. See wxDirDialog
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Dialog position. Ignored under Windows.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Dialog size. Ignored under Windows.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The dialog name, not used.
|
||||||
|
*/
|
||||||
|
wxDirDialog(wxWindow* parent,
|
||||||
|
const wxString& message = "Choose a directory",
|
||||||
|
const wxString& defaultPath = "",
|
||||||
|
long style = wxDD_DEFAULT_STYLE,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
const wxString& name = "wxDirCtrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxDirDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the message that will be displayed on the dialog.
|
||||||
|
*/
|
||||||
|
wxString GetMessage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the default or user-selected path.
|
||||||
|
*/
|
||||||
|
wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the message that will be displayed on the dialog.
|
||||||
|
*/
|
||||||
|
void SetMessage(const wxString& message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the default path.
|
||||||
|
*/
|
||||||
|
void SetPath(const wxString& path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL
|
||||||
|
otherwise.
|
||||||
|
*/
|
||||||
|
int ShowModal();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pops up a directory selector dialog. The arguments have the same meaning as
|
||||||
|
those of wxDirDialog::wxDirDialog(). The message is displayed at the top,
|
||||||
|
and the default_path, if specified, is set as the initial selection.
|
||||||
|
|
||||||
|
The application must check for an empty return value (if the user pressed
|
||||||
|
Cancel). For example:
|
||||||
|
@code
|
||||||
|
const wxString& dir = wxDirSelector("Choose a folder");
|
||||||
|
if ( !dir.empty() )
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
|
||||||
|
const wxString& default_path = "",
|
||||||
|
long style = 0,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
wxWindow * parent = @NULL);
|
||||||
|
|
||||||
126
interface/display.h
Normal file
126
interface/display.h
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: display.h
|
||||||
|
// Purpose: documentation for wxDisplay class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDisplay
|
||||||
|
@wxheader{display.h}
|
||||||
|
|
||||||
|
Determines the sizes and locations of displays connected to the system.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxClientDisplayRect, wxDisplaySize, wxDisplaySizeMM
|
||||||
|
*/
|
||||||
|
class wxDisplay
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor, setting up a wxDisplay instance with the specified display.
|
||||||
|
|
||||||
|
@param index
|
||||||
|
The index of the display to use. This must be non-negative
|
||||||
|
and lower than the value returned by GetCount().
|
||||||
|
*/
|
||||||
|
wxDisplay(unsigned index = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxDisplay();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Changes the video mode of this display to the mode specified
|
||||||
|
in the mode parameter.
|
||||||
|
|
||||||
|
If wxDefaultVideoMode is passed in as the mode parameter,
|
||||||
|
the defined behaviour is that wxDisplay will reset the video
|
||||||
|
mode to the default mode used by the display. On Windows,
|
||||||
|
the behavior is normal. However, there are differences on other
|
||||||
|
platforms. On Unix variations using X11 extensions it should
|
||||||
|
behave as defined, but some irregularities may occur.
|
||||||
|
|
||||||
|
On wxMac passing in wxDefaultVideoMode as the mode
|
||||||
|
parameter does nothing. This happens because carbon
|
||||||
|
no longer has access to DMUseScreenPrefs, an undocumented
|
||||||
|
function that changed the video mode to the system
|
||||||
|
default by using the system's 'scrn' resource.
|
||||||
|
*/
|
||||||
|
bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the client area of the display. The client area is the part of the
|
||||||
|
display available for the normal (non full screen) windows, usually it is the
|
||||||
|
same as GetGeometry() but it could be less if
|
||||||
|
there is a taskbar (or equivalent) on this display.
|
||||||
|
*/
|
||||||
|
wxRect GetClientArea();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of connected displays.
|
||||||
|
*/
|
||||||
|
static unsigned GetCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current video mode that this display is in.
|
||||||
|
*/
|
||||||
|
wxVideoMode GetCurrentMode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the bit depth of the display whose index was passed to the constructor.
|
||||||
|
*/
|
||||||
|
int GetDepth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the index of the display on which the given point lies. Returns
|
||||||
|
@c wxNOT_FOUND if the point is not on any connected display.
|
||||||
|
|
||||||
|
@param pt
|
||||||
|
The point to locate.
|
||||||
|
*/
|
||||||
|
static int GetFromPoint(const wxPoint& pt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the index of the display on which the given window lies.
|
||||||
|
|
||||||
|
If the window is on more than one display it gets the display that overlaps the
|
||||||
|
window the most.
|
||||||
|
|
||||||
|
Returns @c wxNOT_FOUND if the window is not on any connected display.
|
||||||
|
|
||||||
|
@param win
|
||||||
|
The window to locate.
|
||||||
|
*/
|
||||||
|
static int GetFromWindow(const wxWindow* win);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the bounding rectangle of the display whose index was passed to the
|
||||||
|
constructor.
|
||||||
|
*/
|
||||||
|
wxRect GetGeometry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Fills and returns an array with all the video modes that
|
||||||
|
are supported by this display, or video modes that are
|
||||||
|
supported by this display and match the mode parameter
|
||||||
|
(if mode is not wxDefaultVideoMode).
|
||||||
|
*/
|
||||||
|
wxArrayVideoModes GetModes(const wxVideoMode& mode = wxDefaultVideoMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the display's name. A name is not available on all platforms.
|
||||||
|
*/
|
||||||
|
wxString GetName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the display is the primary display. The primary display is the
|
||||||
|
one whose index is 0.
|
||||||
|
*/
|
||||||
|
bool IsPrimary();
|
||||||
|
};
|
||||||
356
interface/dnd.h
Normal file
356
interface/dnd.h
Normal file
@@ -0,0 +1,356 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dnd.h
|
||||||
|
// Purpose: documentation for wxTextDropTarget class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxTextDropTarget
|
||||||
|
@wxheader{dnd.h}
|
||||||
|
|
||||||
|
A predefined drop target for dealing with text data.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Drag and drop overview", wxDropSource,
|
||||||
|
wxDropTarget, wxFileDropTarget
|
||||||
|
*/
|
||||||
|
class wxTextDropTarget : public wxDropTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxTextDropTarget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
See wxDropTarget::OnDrop. This function is implemented
|
||||||
|
appropriately for text, and calls OnDropText().
|
||||||
|
*/
|
||||||
|
virtual bool OnDrop(long x, long y, const void data, size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override this function to receive dropped text.
|
||||||
|
|
||||||
|
@param x
|
||||||
|
The x coordinate of the mouse.
|
||||||
|
|
||||||
|
@param y
|
||||||
|
The y coordinate of the mouse.
|
||||||
|
|
||||||
|
@param data
|
||||||
|
The data being dropped: a wxString.
|
||||||
|
*/
|
||||||
|
virtual bool OnDropText(wxCoord x, wxCoord y,
|
||||||
|
const wxString& data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDropTarget
|
||||||
|
@wxheader{dnd.h}
|
||||||
|
|
||||||
|
This class represents a target for a drag and drop operation. A wxDataObject
|
||||||
|
can be associated with it and by default, this object will be filled with the
|
||||||
|
data from the
|
||||||
|
drag source, if the data formats supported by the data object match the drag
|
||||||
|
source data
|
||||||
|
format.
|
||||||
|
|
||||||
|
There are various virtual handler functions defined in this class which may be
|
||||||
|
overridden
|
||||||
|
to give visual feedback or react in a more fine-tuned way, e.g. by not
|
||||||
|
accepting data on
|
||||||
|
the whole window area, but only a small portion of it. The normal sequence of
|
||||||
|
calls is
|
||||||
|
wxDropTarget::OnEnter, possibly many times wxDropTarget::OnDragOver,
|
||||||
|
wxDropTarget::OnDrop and finally wxDropTarget::OnData.
|
||||||
|
|
||||||
|
See @ref overview_wxdndoverview "Drag and drop overview" and @ref
|
||||||
|
overview_wxdataobjectoverview "wxDataObject overview"
|
||||||
|
for more information.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDropSource, wxTextDropTarget, wxFileDropTarget, wxDataFormat, wxDataObject
|
||||||
|
*/
|
||||||
|
class wxDropTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. @e data is the data to be associated with the drop target.
|
||||||
|
*/
|
||||||
|
wxDropTarget(wxDataObject* data = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor. Deletes the associated data object, if any.
|
||||||
|
*/
|
||||||
|
~wxDropTarget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method may only be called from within OnData().
|
||||||
|
By default, this method copies the data from the drop source to the
|
||||||
|
wxDataObject associated with this drop target,
|
||||||
|
calling its wxDataObject::SetData method.
|
||||||
|
*/
|
||||||
|
virtual void GetData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called after OnDrop() returns @true. By default this
|
||||||
|
will usually GetData() and will return the suggested
|
||||||
|
default value @e def.
|
||||||
|
*/
|
||||||
|
virtual wxDragResult OnData(wxCoord x, wxCoord y,
|
||||||
|
wxDragResult def);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called when the mouse is being dragged over the drop target. By default,
|
||||||
|
this calls functions return the suggested return value @e def.
|
||||||
|
|
||||||
|
@param x
|
||||||
|
The x coordinate of the mouse.
|
||||||
|
|
||||||
|
@param y
|
||||||
|
The y coordinate of the mouse.
|
||||||
|
|
||||||
|
@param def
|
||||||
|
Suggested value for return value. Determined by SHIFT or CONTROL key states.
|
||||||
|
|
||||||
|
@returns Returns the desired operation or wxDragNone. This is used for
|
||||||
|
optical feedback from the side of the drop source,
|
||||||
|
typically in form of changing the icon.
|
||||||
|
*/
|
||||||
|
virtual wxDragResult OnDragOver(wxCoord x, wxCoord y,
|
||||||
|
wxDragResult def);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called when the user drops a data object on the target. Return @false to veto
|
||||||
|
the operation.
|
||||||
|
|
||||||
|
@param x
|
||||||
|
The x coordinate of the mouse.
|
||||||
|
|
||||||
|
@param y
|
||||||
|
The y coordinate of the mouse.
|
||||||
|
|
||||||
|
@returns Return @true to accept the data, @false to veto the operation.
|
||||||
|
*/
|
||||||
|
virtual bool OnDrop(wxCoord x, wxCoord y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called when the mouse enters the drop target. By default, this calls
|
||||||
|
OnDragOver().
|
||||||
|
|
||||||
|
@param x
|
||||||
|
The x coordinate of the mouse.
|
||||||
|
|
||||||
|
@param y
|
||||||
|
The y coordinate of the mouse.
|
||||||
|
|
||||||
|
@param def
|
||||||
|
Suggested default for return value. Determined by SHIFT or CONTROL key states.
|
||||||
|
|
||||||
|
@returns Returns the desired operation or wxDragNone. This is used for
|
||||||
|
optical feedback from the side of the drop source,
|
||||||
|
typically in form of changing the icon.
|
||||||
|
*/
|
||||||
|
virtual wxDragResult OnEnter(wxCoord x, wxCoord y,
|
||||||
|
wxDragResult def);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called when the mouse leaves the drop target.
|
||||||
|
*/
|
||||||
|
virtual void OnLeave();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the data wxDataObject associated with the
|
||||||
|
drop target and deletes any previously associated data object.
|
||||||
|
*/
|
||||||
|
void SetDataObject(wxDataObject* data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDropSource
|
||||||
|
@wxheader{dnd.h}
|
||||||
|
|
||||||
|
This class represents a source for a drag and drop operation.
|
||||||
|
|
||||||
|
See @ref overview_wxdndoverview "Drag and drop overview" and @ref
|
||||||
|
overview_wxdataobjectoverview "wxDataObject overview"
|
||||||
|
for more information.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDropTarget, wxTextDropTarget, wxFileDropTarget
|
||||||
|
*/
|
||||||
|
class wxDropSource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The constructors for wxDataObject.
|
||||||
|
|
||||||
|
If you use the constructor without @e data parameter you must call
|
||||||
|
SetData() later.
|
||||||
|
|
||||||
|
Note that the exact type of @e iconCopy and subsequent parameters differs
|
||||||
|
between wxMSW and wxGTK: these are cursors under Windows but icons for GTK.
|
||||||
|
You should use the macro wxDROP_ICON in portable
|
||||||
|
programs instead of directly using either of these types.
|
||||||
|
|
||||||
|
@param win
|
||||||
|
The window which initiates the drag and drop operation.
|
||||||
|
|
||||||
|
@param iconCopy
|
||||||
|
The icon or cursor used for feedback for copy operation.
|
||||||
|
|
||||||
|
@param iconMove
|
||||||
|
The icon or cursor used for feedback for move operation.
|
||||||
|
|
||||||
|
@param iconNone
|
||||||
|
The icon or cursor used for feedback when operation can't be done.
|
||||||
|
*/
|
||||||
|
wxDropSource(wxWindow* win = @NULL,
|
||||||
|
const wxIconOrCursor& iconCopy = wxNullIconOrCursor,
|
||||||
|
const wxIconOrCursor& iconMove = wxNullIconOrCursor,
|
||||||
|
const wxIconOrCursor& iconNone = wxNullIconOrCursor);
|
||||||
|
wxDropSource(wxDataObject& data, wxWindow* win = @NULL,
|
||||||
|
const wxIconOrCursor& iconCopy = wxNullIconOrCursor,
|
||||||
|
const wxIconOrCursor& iconMove = wxNullIconOrCursor,
|
||||||
|
const wxIconOrCursor& iconNone = wxNullIconOrCursor);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
*/
|
||||||
|
~wxDropSource();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Do it (call this in response to a mouse button press, for example). This starts
|
||||||
|
the drag-and-drop operation which will terminate when the user releases the
|
||||||
|
mouse.
|
||||||
|
|
||||||
|
@param flags
|
||||||
|
If wxDrag_AllowMove is included in the flags, data may
|
||||||
|
be moved and not only copied (default). If wxDrag_DefaultMove is
|
||||||
|
specified (which includes the previous flag), this is even the default
|
||||||
|
operation
|
||||||
|
|
||||||
|
@returns Returns the operation requested by the user, may be wxDragCopy,
|
||||||
|
wxDragMove, wxDragLink, wxDragCancel or wxDragNone if
|
||||||
|
an error occurred.
|
||||||
|
*/
|
||||||
|
virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the wxDataObject object that has been assigned previously.
|
||||||
|
*/
|
||||||
|
wxDataObject * GetDataObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Overridable: you may give some custom UI feedback during the drag and drop
|
||||||
|
operation
|
||||||
|
in this function. It is called on each mouse move, so your implementation must
|
||||||
|
not be too
|
||||||
|
slow.
|
||||||
|
|
||||||
|
@param effect
|
||||||
|
The effect to implement. One of wxDragCopy, wxDragMove, wxDragLink and
|
||||||
|
wxDragNone.
|
||||||
|
|
||||||
|
@param scrolling
|
||||||
|
@true if the window is scrolling. MSW only.
|
||||||
|
|
||||||
|
@returns Return @false if you want default feedback, or @true if you
|
||||||
|
implement your own feedback. The return values is
|
||||||
|
ignored under GTK.
|
||||||
|
*/
|
||||||
|
virtual bool GiveFeedback(wxDragResult effect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the icon to use for a certain drag result.
|
||||||
|
|
||||||
|
@param res
|
||||||
|
The drag result to set the icon for.
|
||||||
|
|
||||||
|
@param cursor
|
||||||
|
The ion to show when this drag result occurs.
|
||||||
|
*/
|
||||||
|
void SetCursor(wxDragResult res, const wxCursor& cursor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the data wxDataObject associated with the
|
||||||
|
drop source. This will not delete any previously associated data.
|
||||||
|
*/
|
||||||
|
void SetData(wxDataObject& data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileDropTarget
|
||||||
|
@wxheader{dnd.h}
|
||||||
|
|
||||||
|
This is a @ref overview_wxdroptarget "drop target" which accepts files (dragged
|
||||||
|
from File Manager or Explorer).
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{dnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxdndoverview "Drag and drop overview", wxDropSource,
|
||||||
|
wxDropTarget, wxTextDropTarget
|
||||||
|
*/
|
||||||
|
class wxFileDropTarget : public wxDropTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxFileDropTarget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
See wxDropTarget::OnDrop. This function is implemented
|
||||||
|
appropriately for files, and calls OnDropFiles().
|
||||||
|
*/
|
||||||
|
virtual bool OnDrop(long x, long y, const void data, size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override this function to receive dropped files.
|
||||||
|
|
||||||
|
@param x
|
||||||
|
The x coordinate of the mouse.
|
||||||
|
|
||||||
|
@param y
|
||||||
|
The y coordinate of the mouse.
|
||||||
|
|
||||||
|
@param filenames
|
||||||
|
An array of filenames.
|
||||||
|
*/
|
||||||
|
virtual bool OnDropFiles(wxCoord x, wxCoord y,
|
||||||
|
const wxArrayString& filenames);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro creates either a cursor (MSW) or an icon (elsewhere) with the given
|
||||||
|
name. Under MSW, the cursor is loaded from the resource file and the icon is
|
||||||
|
loaded from XPM file under other platforms.
|
||||||
|
|
||||||
|
This macro should be used with
|
||||||
|
@ref wxDropSource::wxdropsource "wxDropSource constructor".
|
||||||
|
*/
|
||||||
|
#define wxIconOrCursor wxDROP_ICON(const char * name) /* implementation is private */
|
||||||
|
|
||||||
154
interface/docmdi.h
Normal file
154
interface/docmdi.h
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: docmdi.h
|
||||||
|
// Purpose: documentation for wxDocMDIParentFrame class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDocMDIParentFrame
|
||||||
|
@wxheader{docmdi.h}
|
||||||
|
|
||||||
|
The wxDocMDIParentFrame class provides a default top-level frame for
|
||||||
|
applications using the document/view framework. This class can only be used for
|
||||||
|
MDI parent frames.
|
||||||
|
|
||||||
|
It cooperates with the wxView, wxDocument,
|
||||||
|
wxDocManager and wxDocTemplates classes.
|
||||||
|
|
||||||
|
See the example application in @c samples/docview.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_docviewoverview "Document/view overview", wxMDIParentFrame
|
||||||
|
*/
|
||||||
|
class wxDocMDIParentFrame : public wxMDIParentFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxDocMDIParentFrame();
|
||||||
|
wxDocMDIParentFrame(wxDocManager* manager, wxFrame * parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
|
const wxString& name = "frame");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxDocMDIParentFrame();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the window.
|
||||||
|
*/
|
||||||
|
bool Create(wxDocManager* manager, wxFrame * parent,
|
||||||
|
wxWindowID id, const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
|
const wxString& name = "frame");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Deletes all views and documents. If no user input cancelled the
|
||||||
|
operation, the frame will be destroyed and the application will exit.
|
||||||
|
|
||||||
|
Since understanding how document/view clean-up takes place can be difficult,
|
||||||
|
the implementation of this function is shown below.
|
||||||
|
*/
|
||||||
|
void OnCloseWindow(wxCloseEvent& event);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDocMDIChildFrame
|
||||||
|
@wxheader{docmdi.h}
|
||||||
|
|
||||||
|
The wxDocMDIChildFrame class provides a default frame for displaying documents
|
||||||
|
on separate windows. This class can only be used for MDI child frames.
|
||||||
|
|
||||||
|
The class is part of the document/view framework supported by wxWidgets,
|
||||||
|
and cooperates with the wxView, wxDocument,
|
||||||
|
wxDocManager and wxDocTemplate classes.
|
||||||
|
|
||||||
|
See the example application in @c samples/docview.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_docviewoverview "Document/view overview", wxMDIChildFrame
|
||||||
|
*/
|
||||||
|
class wxDocMDIChildFrame : public wxMDIChildFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxDocMDIChildFrame(wxDocument* doc, wxView* view,
|
||||||
|
wxFrame* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
|
const wxString& name = "frame");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxDocMDIChildFrame();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the document associated with this frame.
|
||||||
|
*/
|
||||||
|
wxDocument* GetDocument();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the view associated with this frame.
|
||||||
|
*/
|
||||||
|
wxView* GetView();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the currently active view to be the frame's view. You may need
|
||||||
|
to override (but still call) this function in order to set the keyboard
|
||||||
|
focus for your subwindow.
|
||||||
|
*/
|
||||||
|
void OnActivate(wxActivateEvent event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Closes and deletes the current view and document.
|
||||||
|
*/
|
||||||
|
void OnCloseWindow(wxCloseEvent& event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the document for this frame.
|
||||||
|
*/
|
||||||
|
void SetDocument(wxDocument * doc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the view for this frame.
|
||||||
|
*/
|
||||||
|
void SetView(wxView * view);
|
||||||
|
|
||||||
|
/**
|
||||||
|
wxDocument* m_childDocument
|
||||||
|
|
||||||
|
The document associated with the frame.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
wxView* m_childView
|
||||||
|
|
||||||
|
The view associated with the frame.
|
||||||
|
*/
|
||||||
|
};
|
||||||
1536
interface/docview.h
Normal file
1536
interface/docview.h
Normal file
File diff suppressed because it is too large
Load Diff
218
interface/dragimag.h
Normal file
218
interface/dragimag.h
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dragimag.h
|
||||||
|
// Purpose: documentation for wxDragImage class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDragImage
|
||||||
|
@wxheader{dragimag.h}
|
||||||
|
|
||||||
|
This class is used when you wish to drag an object on the screen,
|
||||||
|
and a simple cursor is not enough.
|
||||||
|
|
||||||
|
On Windows, the Win32 API is used to achieve smooth dragging. On other
|
||||||
|
platforms,
|
||||||
|
wxGenericDragImage is used. Applications may also prefer to use
|
||||||
|
wxGenericDragImage on Windows, too.
|
||||||
|
|
||||||
|
@b wxPython note: wxPython uses wxGenericDragImage on all platforms, but
|
||||||
|
uses the wxDragImage name.
|
||||||
|
|
||||||
|
To use this class, when you wish to start dragging an image, create a
|
||||||
|
wxDragImage
|
||||||
|
object and store it somewhere you can access it as the drag progresses.
|
||||||
|
Call BeginDrag to start, and EndDrag to stop the drag. To move the image,
|
||||||
|
initially call Show and then Move. If you wish to update the screen contents
|
||||||
|
during the drag (for example, highlight an item as in the dragimag sample),
|
||||||
|
first call Hide,
|
||||||
|
update the screen, call Move, and then call Show.
|
||||||
|
|
||||||
|
You can drag within one window, or you can use full-screen dragging
|
||||||
|
either across the whole screen, or just restricted to one area
|
||||||
|
of the screen to save resources. If you want the user to drag between
|
||||||
|
two windows, then you will need to use full-screen dragging.
|
||||||
|
|
||||||
|
If you wish to draw the image yourself, use wxGenericDragImage and
|
||||||
|
override wxDragImage::DoDrawImage and
|
||||||
|
wxDragImage::GetImageRect.
|
||||||
|
|
||||||
|
Please see @c samples/dragimag for an example.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
*/
|
||||||
|
class wxDragImage : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
Constructs a drag image an optional cursor. This constructor is only available
|
||||||
|
for
|
||||||
|
wxGenericDragImage, and can be used when the application
|
||||||
|
supplies DoDrawImage() and GetImageRect().
|
||||||
|
|
||||||
|
@param image
|
||||||
|
Icon or bitmap to be used as the drag image. The bitmap can
|
||||||
|
have a mask.
|
||||||
|
|
||||||
|
@param text
|
||||||
|
Text used to construct a drag image.
|
||||||
|
|
||||||
|
@param cursor
|
||||||
|
Optional cursor to combine with the image.
|
||||||
|
|
||||||
|
@param hotspot
|
||||||
|
This parameter is deprecated.
|
||||||
|
|
||||||
|
@param treeCtrl
|
||||||
|
Tree control for constructing a tree drag image.
|
||||||
|
|
||||||
|
@param listCtrl
|
||||||
|
List control for constructing a list drag image.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Tree or list control item id.
|
||||||
|
*/
|
||||||
|
wxDragImage();
|
||||||
|
wxDragImage(const wxBitmap& image,
|
||||||
|
const wxCursor& cursor = wxNullCursor);
|
||||||
|
wxDragImage(const wxIcon& image,
|
||||||
|
const wxCursor& cursor = wxNullCursor);
|
||||||
|
wxDragImage(const wxString& text,
|
||||||
|
const wxCursor& cursor = wxNullCursor);
|
||||||
|
wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
|
||||||
|
wxDragImage(const wxListCtrl& treeCtrl, long id);
|
||||||
|
wxDragImage(const wxCursor& cursor = wxNullCursor);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Start dragging the image, using the first window to capture the mouse and the
|
||||||
|
second
|
||||||
|
to specify the bounding area. This form is equivalent to using the first form,
|
||||||
|
but more convenient than working out the bounding rectangle explicitly.
|
||||||
|
|
||||||
|
You need to then call Show()
|
||||||
|
and Move() to show the image on the screen.
|
||||||
|
|
||||||
|
Call EndDrag() when the drag has finished.
|
||||||
|
|
||||||
|
Note that this call automatically calls CaptureMouse.
|
||||||
|
|
||||||
|
@param hotspot
|
||||||
|
The location of the drag position relative to the upper-left corner
|
||||||
|
of the image.
|
||||||
|
|
||||||
|
@param window
|
||||||
|
The window that captures the mouse, and within which the dragging
|
||||||
|
is limited unless fullScreen is @true.
|
||||||
|
|
||||||
|
@param boundingWindow
|
||||||
|
In the second form of the function, specifies the
|
||||||
|
area within which the drag occurs.
|
||||||
|
|
||||||
|
@param fullScreen
|
||||||
|
If @true, specifies that the drag will be visible over the full
|
||||||
|
screen, or over as much of the screen as is specified by rect. Note that the
|
||||||
|
mouse will
|
||||||
|
still be captured in window.
|
||||||
|
|
||||||
|
@param rect
|
||||||
|
If non-@NULL, specifies the rectangle (in screen coordinates) that
|
||||||
|
bounds the dragging operation. Specifying this can make the operation more
|
||||||
|
efficient
|
||||||
|
by cutting down on the area under consideration, and it can also make a visual
|
||||||
|
difference
|
||||||
|
since the drag is clipped to this area.
|
||||||
|
*/
|
||||||
|
bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
|
||||||
|
bool fullScreen = @false,
|
||||||
|
wxRect* rect = @NULL);
|
||||||
|
bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
|
||||||
|
wxWindow* boundingWindow);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draws the image on the device context with top-left corner at the given
|
||||||
|
position.
|
||||||
|
|
||||||
|
This function is only available with wxGenericDragImage, to allow applications
|
||||||
|
to
|
||||||
|
draw their own image instead of using an actual bitmap. If you override this
|
||||||
|
function,
|
||||||
|
you must also override GetImageRect().
|
||||||
|
*/
|
||||||
|
virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Call this when the drag has finished.
|
||||||
|
|
||||||
|
Note that this call automatically calls ReleaseMouse.
|
||||||
|
*/
|
||||||
|
bool EndDrag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the rectangle enclosing the image, assuming that the image is drawn
|
||||||
|
with its
|
||||||
|
top-left corner at the given point.
|
||||||
|
|
||||||
|
This function is available in wxGenericDragImage only, and may be overridden
|
||||||
|
(together with
|
||||||
|
wxDragImage::DoDrawImage) to provide a virtual drawing capability.
|
||||||
|
*/
|
||||||
|
virtual wxRect GetImageRect(const wxPoint& pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Hides the image. You may wish to call this before updating the window
|
||||||
|
contents (perhaps highlighting an item). Then call Move()
|
||||||
|
and Show().
|
||||||
|
*/
|
||||||
|
bool Hide();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Call this to move the image to a new position. The image will only be shown if
|
||||||
|
Show() has been called previously (for example
|
||||||
|
at the start of the drag).
|
||||||
|
|
||||||
|
@e pt is the position in client coordinates (relative to the window specified
|
||||||
|
in BeginDrag).
|
||||||
|
|
||||||
|
You can move the image either when the image is hidden or shown, but in general
|
||||||
|
dragging
|
||||||
|
will be smoother if you move the image when it is shown.
|
||||||
|
*/
|
||||||
|
bool Move(const wxPoint& pt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the image. Call this at least once when dragging.
|
||||||
|
*/
|
||||||
|
bool Show();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override this if you wish to draw the window contents to the backing bitmap
|
||||||
|
yourself. This can be desirable if you wish to avoid flicker by not having to
|
||||||
|
redraw the updated window itself just before dragging, which can cause a
|
||||||
|
flicker just
|
||||||
|
as the drag starts. Instead, paint the drag image's backing bitmap to show the
|
||||||
|
appropriate
|
||||||
|
graphic @e minus the objects to be dragged, and leave the window itself to be
|
||||||
|
updated
|
||||||
|
by the drag image. This can provide eerily smooth, flicker-free drag behaviour.
|
||||||
|
|
||||||
|
The default implementation copies the window contents to the backing bitmap. A
|
||||||
|
new
|
||||||
|
implementation will normally copy information from another source, such as from
|
||||||
|
its
|
||||||
|
own backing bitmap if it has one, or directly from internal data structures.
|
||||||
|
|
||||||
|
This function is available in wxGenericDragImage only.
|
||||||
|
*/
|
||||||
|
bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
|
||||||
|
const wxRect& sourceRect,
|
||||||
|
const wxRect& destRect);
|
||||||
|
};
|
||||||
658
interface/dynarray.h
Normal file
658
interface/dynarray.h
Normal file
@@ -0,0 +1,658 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dynarray.h
|
||||||
|
// Purpose: documentation for wxArray<T> class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxArrayT
|
||||||
|
@wxheader{dynarray.h}
|
||||||
|
|
||||||
|
This section describes the so called @e dynamic arrays. This is a C
|
||||||
|
array-like type safe data structure i.e. the member access time is constant
|
||||||
|
(and not
|
||||||
|
linear according to the number of container elements as for linked lists).
|
||||||
|
However, these
|
||||||
|
arrays are dynamic in the sense that they will automatically allocate more
|
||||||
|
memory if there is not enough of it for adding a new element. They also perform
|
||||||
|
range checking on the index values but in debug mode only, so please be sure to
|
||||||
|
compile your application in debug mode to use it (see @ref
|
||||||
|
overview_debuggingoverview "debugging overview" for
|
||||||
|
details). So, unlike the arrays in some other
|
||||||
|
languages, attempt to access an element beyond the arrays bound doesn't
|
||||||
|
automatically expand the array but provokes an assertion failure instead in
|
||||||
|
debug build and does nothing (except possibly crashing your program) in the
|
||||||
|
release build.
|
||||||
|
|
||||||
|
The array classes were designed to be reasonably efficient, both in terms of
|
||||||
|
run-time speed and memory consumption and the executable size. The speed of
|
||||||
|
array item access is, of course, constant (independent of the number of
|
||||||
|
elements)
|
||||||
|
making them much more efficient than linked lists (wxList).
|
||||||
|
Adding items to the arrays is also implemented in more or less constant time -
|
||||||
|
but the price is preallocating the memory in advance. In the @ref
|
||||||
|
wxArray::memorymanagement "memory management" section
|
||||||
|
you may find some useful hints about optimizing wxArray memory usage. As for
|
||||||
|
executable size, all
|
||||||
|
wxArray functions are inline, so they do not take @e any space at all.
|
||||||
|
|
||||||
|
wxWidgets has three different kinds of array. All of them derive from
|
||||||
|
wxBaseArray class which works with untyped data and can not be used directly.
|
||||||
|
The standard macros WX_DEFINE_ARRAY(), WX_DEFINE_SORTED_ARRAY() and
|
||||||
|
WX_DEFINE_OBJARRAY() are used to define a new class deriving from it. The
|
||||||
|
classes declared will be called in this documentation wxArray, wxSortedArray and
|
||||||
|
wxObjArray but you should keep in mind that no classes with such names actually
|
||||||
|
exist, each time you use one of WX_DEFINE_XXXARRAY macro you define a class
|
||||||
|
with a new name. In fact, these names are "template" names and each usage of one
|
||||||
|
of the macros mentioned above creates a template specialization for the given
|
||||||
|
element type.
|
||||||
|
|
||||||
|
wxArray is suitable for storing integer types and pointers which it does not
|
||||||
|
treat as objects in any way, i.e. the element pointed to by the pointer is not
|
||||||
|
deleted when the element is removed from the array. It should be noted that
|
||||||
|
all of wxArray's functions are inline, so it costs strictly nothing to define as
|
||||||
|
many array types as you want (either in terms of the executable size or the
|
||||||
|
speed) as long as at least one of them is defined and this is always the case
|
||||||
|
because wxArrays are used by wxWidgets internally. This class has one serious
|
||||||
|
limitation: it can only be used for storing integral types (bool, char, short,
|
||||||
|
int, long and their unsigned variants) or pointers (of any kind). An attempt
|
||||||
|
to use with objects of sizeof() greater than sizeof(long) will provoke a
|
||||||
|
runtime assertion failure, however declaring a wxArray of floats will not (on
|
||||||
|
the machines where sizeof(float) = sizeof(long)), yet it will @b not work,
|
||||||
|
please use wxObjArray for storing floats and doubles.
|
||||||
|
|
||||||
|
wxSortedArray is a wxArray variant which should be used when searching in the
|
||||||
|
array is a frequently used operation. It requires you to define an additional
|
||||||
|
function for comparing two elements of the array element type and always stores
|
||||||
|
its items in the sorted order (according to this function). Thus, it is
|
||||||
|
wxArray::Index function execution time is O(log(N)) instead of
|
||||||
|
O(N) for the usual arrays but the wxArray::Add method is
|
||||||
|
slower: it is O(log(N)) instead of constant time (neglecting time spent in
|
||||||
|
memory allocation routine). However, in a usual situation elements are added to
|
||||||
|
an array much less often than searched inside it, so wxSortedArray may lead to
|
||||||
|
huge performance improvements compared to wxArray. Finally, it should be
|
||||||
|
noticed that, as wxArray, wxSortedArray can be only used for storing integral
|
||||||
|
types or pointers.
|
||||||
|
|
||||||
|
wxObjArray class treats its elements like "objects". It may delete them when
|
||||||
|
they are removed from the array (invoking the correct destructor) and copies
|
||||||
|
them using the objects copy constructor. In order to implement this behaviour
|
||||||
|
the definition of the wxObjArray arrays is split in two parts: first, you should
|
||||||
|
declare the new wxObjArray class using WX_DECLARE_OBJARRAY() macro and then
|
||||||
|
you must include the file defining the implementation of template type:
|
||||||
|
wx/arrimpl.cpp and define the array class with WX_DEFINE_OBJARRAY() macro
|
||||||
|
from a point where the full (as opposed to 'forward') declaration of the array
|
||||||
|
elements class is in scope. As it probably sounds very complicated here is an
|
||||||
|
example:
|
||||||
|
|
||||||
|
@code
|
||||||
|
#include wx/dynarray.h
|
||||||
|
|
||||||
|
// we must forward declare the array because it is used inside the class
|
||||||
|
// declaration
|
||||||
|
class MyDirectory;
|
||||||
|
class MyFile;
|
||||||
|
|
||||||
|
// this defines two new types: ArrayOfDirectories and ArrayOfFiles which can be
|
||||||
|
// now used as shown below
|
||||||
|
WX_DECLARE_OBJARRAY(MyDirectory, ArrayOfDirectories);
|
||||||
|
WX_DECLARE_OBJARRAY(MyFile, ArrayOfFiles);
|
||||||
|
|
||||||
|
class MyDirectory
|
||||||
|
{
|
||||||
|
...
|
||||||
|
ArrayOfDirectories m_subdirectories; // all subdirectories
|
||||||
|
ArrayOfFiles m_files; // all files in this directory
|
||||||
|
};
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
// now that we have MyDirectory declaration in scope we may finish the
|
||||||
|
// definition of ArrayOfDirectories -- note that this expands into some C++
|
||||||
|
// code and so should only be compiled once (i.e., don't put this in the
|
||||||
|
// header, but into a source file or you will get linking errors)
|
||||||
|
#include wx/arrimpl.cpp // this is a magic incantation which must be done!
|
||||||
|
WX_DEFINE_OBJARRAY(ArrayOfDirectories);
|
||||||
|
|
||||||
|
// that's all!
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
It is not as elegant as writing
|
||||||
|
|
||||||
|
@code
|
||||||
|
typedef std::vectorMyDirectory ArrayOfDirectories;
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
but is not that complicated and allows the code to be compiled with any, however
|
||||||
|
dumb, C++ compiler in the world.
|
||||||
|
|
||||||
|
Remember to include wx/arrimpl.cpp just before each WX_DEFINE_OBJARRAY
|
||||||
|
ocurrence in your code, even if you have several in the same file.
|
||||||
|
|
||||||
|
Things are much simpler for wxArray and wxSortedArray however: it is enough
|
||||||
|
just to write
|
||||||
|
|
||||||
|
@code
|
||||||
|
WX_DEFINE_ARRAY_INT(int, ArrayOfInts);
|
||||||
|
WX_DEFINE_SORTED_ARRAY_INT(int, ArrayOfSortedInts);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
i.e. there is only one @c DEFINE macro and no need for separate
|
||||||
|
@c DECLARE one. For the arrays of the primitive types, the macros
|
||||||
|
@c WX_DEFINE_ARRAY_CHAR/SHORT/INT/SIZE_T/LONG/DOUBLE should be used
|
||||||
|
depending on the sizeof of the values (notice that storing values of smaller
|
||||||
|
type, e.g. shorts, in an array of larger one, e.g. @c ARRAY_INT, does
|
||||||
|
not work on all architectures!).
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxcontaineroverview "Container classes overview", wxListT,
|
||||||
|
wxVectorT
|
||||||
|
*/
|
||||||
|
class wxArray<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Appends the given number of @e copies of the @e item to the array
|
||||||
|
consisting of the elements of type @e T.
|
||||||
|
|
||||||
|
The first version is used with wxArray. The second is used with wxSortedArray,
|
||||||
|
returning the index where @e item is stored. The third and the
|
||||||
|
fourth ones are used with wxObjArray. There is an important difference between
|
||||||
|
them: if you give a pointer to the array, it will take ownership of it, i.e.
|
||||||
|
will delete it when the item is deleted from the array. If you give a reference
|
||||||
|
to the array, however, the array will make a copy of the item and will not take
|
||||||
|
ownership of the original item. Once again, it only makes sense for wxObjArrays
|
||||||
|
because the other array types never take ownership of their elements. Also note
|
||||||
|
that you cannot append more than one pointer as reusing it would lead to
|
||||||
|
deleting it twice (or more) and hence to a crash.
|
||||||
|
|
||||||
|
You may also use WX_APPEND_ARRAY macro to append all
|
||||||
|
elements of one array to another one but it is more efficient to use
|
||||||
|
@e copies parameter and modify the elements in place later if you plan to
|
||||||
|
append a lot of items.
|
||||||
|
*/
|
||||||
|
void Add(T item, size_t copies = 1);
|
||||||
|
size_t Add(T item);
|
||||||
|
void Add(T * item);
|
||||||
|
void Add(T & item, size_t copies = 1);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Inserts the given @e item into the array in the specified @e index
|
||||||
|
position.
|
||||||
|
|
||||||
|
Be aware that you will set out the order of the array if you give a wrong
|
||||||
|
position.
|
||||||
|
|
||||||
|
This function is useful in conjunction with
|
||||||
|
wxArray::IndexForInsert for a common operation
|
||||||
|
of "insert only if not found".
|
||||||
|
*/
|
||||||
|
void AddAt(T item, size_t index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
wxArray::Add
|
||||||
|
|
||||||
|
wxArray::AddAt
|
||||||
|
|
||||||
|
wxArray::Insert
|
||||||
|
|
||||||
|
wxArray::SetCount
|
||||||
|
|
||||||
|
WX_APPEND_ARRAY
|
||||||
|
|
||||||
|
WX_PREPEND_ARRAY
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Preallocates memory for a given number of array elements. It is worth calling
|
||||||
|
when the number of items which are going to be added to the array is known in
|
||||||
|
advance because it will save unneeded memory reallocation. If the array already
|
||||||
|
has enough memory for the given number of items, nothing happens. In any case,
|
||||||
|
the existing contents of the array is not modified.
|
||||||
|
*/
|
||||||
|
void Alloc(size_t count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function does the same as wxArray::Empty and additionally
|
||||||
|
frees the memory allocated to the array.
|
||||||
|
*/
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Array classes are 100% C++ objects and as such they have the appropriate copy
|
||||||
|
constructors and assignment operators. Copying wxArray just copies the elements
|
||||||
|
but copying wxObjArray copies the arrays items. However, for memory-efficiency
|
||||||
|
sake, neither of these classes has virtual destructor. It is not very important
|
||||||
|
for wxArray which has trivial destructor anyhow, but it does mean that you
|
||||||
|
should avoid deleting wxObjArray through a wxBaseArray pointer (as you would
|
||||||
|
never use wxBaseArray anyhow it shouldn't be a problem) and that you should not
|
||||||
|
derive your own classes from the array classes.
|
||||||
|
|
||||||
|
@ref wxArray::ctordef "wxArray default constructor"
|
||||||
|
|
||||||
|
@ref wxArray::ctorcopy "wxArray copy constructors and assignment operators"
|
||||||
|
|
||||||
|
@ref wxArray::dtor ~wxArray
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
(T first, T second)@e compareFunction)
|
||||||
|
|
||||||
|
There is no default constructor for wxSortedArray classes - you must initialize
|
||||||
|
it
|
||||||
|
with a function to use for item comparison. It is a function which is passed
|
||||||
|
two arguments of type @e T where @e T is the array element type and which
|
||||||
|
should return a negative, zero or positive value according to whether the first
|
||||||
|
element passed to it is less than, equal to or greater than the second one.
|
||||||
|
*/
|
||||||
|
wxArray();
|
||||||
|
wxObjArray();
|
||||||
|
wxSortedArray();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the element from the array, but, unlike,
|
||||||
|
wxArray::Remove doesn't delete it. The function returns the
|
||||||
|
pointer to the removed element.
|
||||||
|
*/
|
||||||
|
T * Detach(size_t index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Empties the array. For wxObjArray classes, this destroys all of the array
|
||||||
|
elements. For wxArray and wxSortedArray this does nothing except marking the
|
||||||
|
array of being empty - this function does not free the allocated memory, use
|
||||||
|
wxArray::Clear for this.
|
||||||
|
*/
|
||||||
|
void Empty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the number of items in the array.
|
||||||
|
*/
|
||||||
|
size_t GetCount();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The first version of the function is for wxArray and wxObjArray, the second is
|
||||||
|
for wxSortedArray only.
|
||||||
|
|
||||||
|
Searches the element in the array, starting from either beginning or the end
|
||||||
|
depending on the value of @e searchFromEnd parameter. @c wxNOT_FOUND is
|
||||||
|
returned if the element is not found, otherwise the index of the element is
|
||||||
|
returned.
|
||||||
|
|
||||||
|
Linear search is used for the wxArray and wxObjArray classes but binary search
|
||||||
|
in the sorted array is used for wxSortedArray (this is why searchFromEnd
|
||||||
|
parameter doesn't make sense for it).
|
||||||
|
|
||||||
|
@b NB: even for wxObjArray classes, the operator==() of the elements in the
|
||||||
|
array is @b not used by this function. It searches exactly the given
|
||||||
|
element in the array and so will only succeed if this element had been
|
||||||
|
previously added to the array, but fail even if another, identical, element is
|
||||||
|
in the array.
|
||||||
|
*/
|
||||||
|
int Index(T& item, bool searchFromEnd = @false);
|
||||||
|
int Index(T& item);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Search for a place to insert @e item into the sorted array (binary search).
|
||||||
|
The index returned is just before the first existing item that is greater or
|
||||||
|
equal
|
||||||
|
(according to the compare function) to the given @e item.
|
||||||
|
|
||||||
|
You have to do extra work to know if the @e item already exists in array.
|
||||||
|
|
||||||
|
This function is useful in conjunction with
|
||||||
|
wxArray::AddAt for a common operation
|
||||||
|
of "insert only if not found".
|
||||||
|
*/
|
||||||
|
size_t IndexForInsert(T item);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Insert the given number of @e copies of the @e item into the array before
|
||||||
|
the existing item @e n - thus, @e Insert(something, 0u) will insert an
|
||||||
|
item in such way that it will become the first array element.
|
||||||
|
|
||||||
|
wxSortedArray doesn't have this function because inserting in wrong place
|
||||||
|
would break its sorted condition.
|
||||||
|
|
||||||
|
Please see wxArray::Add for explanation of the differences
|
||||||
|
between the overloaded versions of this function.
|
||||||
|
*/
|
||||||
|
void Insert(T item, size_t n, size_t copies = 1);
|
||||||
|
void Insert(T * item, size_t n);
|
||||||
|
void Insert(T & item, size_t n, size_t copies = 1);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the array is empty, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool IsEmpty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the item at the given position in the array. If @e index is out of
|
||||||
|
bounds, an assert failure is raised in the debug builds but nothing special is
|
||||||
|
done in the release build.
|
||||||
|
|
||||||
|
The returned value is of type "reference to the array element type" for all of
|
||||||
|
the array classes.
|
||||||
|
*/
|
||||||
|
T Item(size_t index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the last element in the array, i.e. is the same as Item(GetCount() - 1).
|
||||||
|
An assert failure is raised in the debug mode if the array is empty.
|
||||||
|
|
||||||
|
The returned value is of type "reference to the array element type" for all of
|
||||||
|
the array classes.
|
||||||
|
*/
|
||||||
|
T Last();
|
||||||
|
|
||||||
|
/**
|
||||||
|
To use an array you must first define the array class. This is done with the
|
||||||
|
help of the macros in this section. The class of array elements must be (at
|
||||||
|
least) forward declared for WX_DEFINE_ARRAY, WX_DEFINE_SORTED_ARRAY and
|
||||||
|
WX_DECLARE_OBJARRAY macros and must be fully declared before you use
|
||||||
|
WX_DEFINE_OBJARRAY macro.
|
||||||
|
|
||||||
|
WX_DEFINE_ARRAY
|
||||||
|
|
||||||
|
WX_DEFINE_EXPORTED_ARRAY
|
||||||
|
|
||||||
|
WX_DEFINE_USER_EXPORTED_ARRAY
|
||||||
|
|
||||||
|
WX_DEFINE_SORTED_ARRAY
|
||||||
|
|
||||||
|
WX_DEFINE_SORTED_EXPORTED_ARRAY
|
||||||
|
|
||||||
|
WX_DEFINE_SORTED_USER_EXPORTED_ARRAY
|
||||||
|
|
||||||
|
WX_DECLARE_EXPORTED_OBJARRAY
|
||||||
|
|
||||||
|
WX_DECLARE_USER_EXPORTED_OBJARRAY
|
||||||
|
|
||||||
|
WX_DEFINE_OBJARRAY
|
||||||
|
|
||||||
|
WX_DEFINE_EXPORTED_OBJARRAY
|
||||||
|
|
||||||
|
WX_DEFINE_USER_EXPORTED_OBJARRAY
|
||||||
|
|
||||||
|
To slightly complicate the matters even further, the operator - defined by
|
||||||
|
default for the array iterators by these macros only makes sense if the array
|
||||||
|
element type is not a pointer itself and, although it still works, this
|
||||||
|
provokes warnings from some compilers and to avoid them you should use the
|
||||||
|
@c _PTR versions of the macros above. For example, to define an array of
|
||||||
|
pointers to @c double you should use:
|
||||||
|
Note that the above macros are generally only useful for
|
||||||
|
wxObject types. There are separate macros for declaring an array of a simple
|
||||||
|
type,
|
||||||
|
such as an int.
|
||||||
|
|
||||||
|
The following simple types are supported:
|
||||||
|
|
||||||
|
int
|
||||||
|
|
||||||
|
long
|
||||||
|
|
||||||
|
size_t
|
||||||
|
|
||||||
|
double
|
||||||
|
|
||||||
|
To create an array of a simple type, simply append the type you want in CAPS to
|
||||||
|
the array definition.
|
||||||
|
|
||||||
|
For example, for an integer array, you'd use one of the following variants:
|
||||||
|
|
||||||
|
WX_DEFINE_ARRAY_INT
|
||||||
|
|
||||||
|
WX_DEFINE_EXPORTED_ARRAY_INT
|
||||||
|
|
||||||
|
WX_DEFINE_USER_EXPORTED_ARRAY_INT
|
||||||
|
|
||||||
|
WX_DEFINE_SORTED_ARRAY_INT
|
||||||
|
|
||||||
|
WX_DEFINE_SORTED_EXPORTED_ARRAY_INT
|
||||||
|
|
||||||
|
WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_INT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Automatic array memory management is quite trivial: the array starts by
|
||||||
|
preallocating some minimal amount of memory (defined by
|
||||||
|
WX_ARRAY_DEFAULT_INITIAL_SIZE) and when further new items exhaust already
|
||||||
|
allocated memory it reallocates it adding 50% of the currently allocated
|
||||||
|
amount, but no more than some maximal number which is defined by
|
||||||
|
ARRAY_MAXSIZE_INCREMENT constant. Of course, this may lead to some memory
|
||||||
|
being wasted (ARRAY_MAXSIZE_INCREMENT in the worst case, i.e. 4Kb in the
|
||||||
|
current implementation), so the wxArray::Shrink function is
|
||||||
|
provided to deallocate the extra memory. The wxArray::Alloc
|
||||||
|
function can also be quite useful if you know in advance how many items you are
|
||||||
|
going to put in the array and will prevent the array code from reallocating the
|
||||||
|
memory more times than needed.
|
||||||
|
|
||||||
|
wxArray::Alloc
|
||||||
|
|
||||||
|
wxArray::Shrink
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Functions in this section return the total number of array elements and allow to
|
||||||
|
retrieve them - possibly using just the C array indexing [] operator which
|
||||||
|
does exactly the same as wxArray::Item method.
|
||||||
|
|
||||||
|
wxArray::GetCount
|
||||||
|
|
||||||
|
wxArray::IsEmpty
|
||||||
|
|
||||||
|
wxArray::Item
|
||||||
|
|
||||||
|
wxArray::Last
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes an element from the array by value: the first item of the
|
||||||
|
array equal to @e item is removed, an assert failure will result from an
|
||||||
|
attempt to remove an item which doesn't exist in the array.
|
||||||
|
|
||||||
|
When an element is removed from wxObjArray it is deleted by the array - use
|
||||||
|
Detach if you don't want this to happen. On the
|
||||||
|
other hand, when an object is removed from a wxArray nothing happens - you
|
||||||
|
should delete it manually if required:
|
||||||
|
See also WX_CLEAR_ARRAY macro which deletes all
|
||||||
|
elements of a wxArray (supposed to contain pointers).
|
||||||
|
*/
|
||||||
|
Remove(T item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes @e count elements starting at @e index from the array. When an
|
||||||
|
element is removed from wxObjArray it is deleted by the array - use
|
||||||
|
Detach if you don't want this to happen. On
|
||||||
|
the other hand, when an object is removed from a wxArray nothing happens -
|
||||||
|
you should delete it manually if required:
|
||||||
|
See also WX_CLEAR_ARRAY macro which deletes all
|
||||||
|
elements of a wxArray (supposed to contain pointers).
|
||||||
|
*/
|
||||||
|
RemoveAt(size_t index, size_t count = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
WX_CLEAR_ARRAY
|
||||||
|
|
||||||
|
wxArray::Empty
|
||||||
|
|
||||||
|
wxArray::Clear
|
||||||
|
|
||||||
|
wxArray::RemoveAt
|
||||||
|
|
||||||
|
wxArray::Remove
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
wxArray::Index
|
||||||
|
|
||||||
|
wxArray::IndexForInsert
|
||||||
|
|
||||||
|
wxArray::Sort
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
This function ensures that the number of array elements is at least
|
||||||
|
@e count. If the array has already @e count or more items, nothing is
|
||||||
|
done. Otherwise, @c count - GetCount() elements are added and initialized to
|
||||||
|
the value @e defval.
|
||||||
|
|
||||||
|
@sa wxArray::GetCount
|
||||||
|
*/
|
||||||
|
void SetCount(size_t count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Frees all memory unused by the array. If the program knows that no new items
|
||||||
|
will be added to the array it may call Shrink() to reduce its memory usage.
|
||||||
|
However, if a new item is added to the array, some extra memory will be
|
||||||
|
allocated again.
|
||||||
|
*/
|
||||||
|
void Shrink();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The notation CMPFUNCT should be read as if we had the following declaration:
|
||||||
|
where @e T is the type of the array elements. I.e. it is a function returning
|
||||||
|
@e int which is passed two arguments of type @e T *.
|
||||||
|
|
||||||
|
Sorts the array using the specified compare function: this function should
|
||||||
|
return a negative, zero or positive value according to whether the first element
|
||||||
|
passed to it is less than, equal to or greater than the second one.
|
||||||
|
|
||||||
|
wxSortedArray doesn't have this function because it is always sorted.
|
||||||
|
*/
|
||||||
|
void Sort(CMPFUNC<T> compareFunction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro may be used to append all elements of the @e other array to the
|
||||||
|
@e array. The two arrays must be of the same type.
|
||||||
|
*/
|
||||||
|
#define void WX_APPEND_ARRAY(wxArray& array, wxArray& other) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro may be used to delete all elements of the array before emptying it.
|
||||||
|
It can not be used with wxObjArrays - but they will delete their elements anyhow
|
||||||
|
when you call Empty().
|
||||||
|
*/
|
||||||
|
#define void WX_CLEAR_ARRAY(wxArray& array) /* implementation is private */
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
This macro declares a new object array class named @e name and containing
|
||||||
|
the elements of type @e T. The second form is used when compiling wxWidgets as
|
||||||
|
a DLL under Windows and array needs to be visible outside the DLL. The third is
|
||||||
|
needed for exporting an array from a user DLL.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
You must use WX_DEFINE_OBJARRAY macro to define
|
||||||
|
the array class - otherwise you would get link errors.
|
||||||
|
*/
|
||||||
|
WX_DECLARE_OBJARRAY(T, name);
|
||||||
|
WX_DECLARE_EXPORTED_OBJARRAY(T, name);
|
||||||
|
WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
This macro defines a new array class named @e name and containing the
|
||||||
|
elements of type @e T. The second form is used when compiling wxWidgets as
|
||||||
|
a DLL under Windows and array needs to be visible outside the DLL. The third is
|
||||||
|
needed for exporting an array from a user DLL.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
Note that wxWidgets predefines the following standard array classes: @b
|
||||||
|
wxArrayInt,
|
||||||
|
@b wxArrayLong, @b wxArrayShort, @b wxArrayDouble, @b wxArrayPtrVoid.
|
||||||
|
*/
|
||||||
|
WX_DEFINE_ARRAY(T, name);
|
||||||
|
WX_DEFINE_EXPORTED_ARRAY(T, name);
|
||||||
|
WX_DEFINE_USER_EXPORTED_ARRAY(T, name, exportspec);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
This macro defines the methods of the array class @e name not defined by the
|
||||||
|
WX_DECLARE_OBJARRAY macro. You must include the
|
||||||
|
file wx/arrimpl.cpp before using this macro and you must have the full
|
||||||
|
declaration of the class of array elements in scope! If you forget to do the
|
||||||
|
first, the error will be caught by the compiler, but, unfortunately, many
|
||||||
|
compilers will not give any warnings if you forget to do the second - but the
|
||||||
|
objects of the class will not be copied correctly and their real destructor will
|
||||||
|
not be called. The latter two forms are merely aliases of the first to satisfy
|
||||||
|
some people's sense of symmetry when using the exported declarations.
|
||||||
|
|
||||||
|
Example of usage:
|
||||||
|
*/
|
||||||
|
WX_DEFINE_OBJARRAY(name);
|
||||||
|
WX_DEFINE_EXPORTED_OBJARRAY(name);
|
||||||
|
WX_DEFINE_USER_EXPORTED_OBJARRAY(name);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
This macro defines a new sorted array class named @e name and containing
|
||||||
|
the elements of type @e T. The second form is used when compiling wxWidgets as
|
||||||
|
a DLL under Windows and array needs to be visible outside the DLL. The third is
|
||||||
|
needed for exporting an array from a user DLL.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
You will have to initialize the objects of this class by passing a comparison
|
||||||
|
function to the array object constructor like this:
|
||||||
|
*/
|
||||||
|
WX_DEFINE_SORTED_ARRAY(T, name);
|
||||||
|
WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name);
|
||||||
|
WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro may be used to prepend all elements of the @e other array to the
|
||||||
|
@e array. The two arrays must be of the same type.
|
||||||
|
*/
|
||||||
|
#define void WX_PREPEND_ARRAY(wxArray& array, wxArray& other) /* implementation is private */
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The copy constructors and assignment operators perform a shallow array copy
|
||||||
|
(i.e. they don't copy the objects pointed to even if the source array contains
|
||||||
|
the items of pointer type) for wxArray and wxSortedArray and a deep copy (i.e.
|
||||||
|
the array element are copied too) for wxObjArray.
|
||||||
|
*/
|
||||||
|
wxArray(const wxArray& array);
|
||||||
|
wxSortedArray(const wxSortedArray& array);
|
||||||
|
wxObjArray(const wxObjArray& array);
|
||||||
|
wxArray operator=(const wxArray& array);
|
||||||
|
wxSortedArray operator=(const wxSortedArray& array);
|
||||||
|
wxObjArray operator=(const wxObjArray& array);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The wxObjArray destructor deletes all the items owned by the array. This is not
|
||||||
|
done by wxArray and wxSortedArray versions - you may use
|
||||||
|
WX_CLEAR_ARRAY macro for this.
|
||||||
|
*/
|
||||||
|
~wxArray();
|
||||||
|
~wxSortedArray();
|
||||||
|
~wxObjArray();
|
||||||
|
//@}
|
||||||
|
};
|
||||||
415
interface/dynlib.h
Normal file
415
interface/dynlib.h
Normal file
@@ -0,0 +1,415 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dynlib.h
|
||||||
|
// Purpose: documentation for wxDynamicLibraryDetails class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDynamicLibraryDetails
|
||||||
|
@wxheader{dynlib.h}
|
||||||
|
|
||||||
|
This class is used for the objects returned by
|
||||||
|
wxDynamicLibrary::ListLoaded method and
|
||||||
|
contains the information about a single module loaded into the address space of
|
||||||
|
the current process. A module in this context may be either a dynamic library
|
||||||
|
or the main program itself.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
*/
|
||||||
|
class wxDynamicLibraryDetails
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Retrieves the load address and the size of this module.
|
||||||
|
|
||||||
|
@param addr
|
||||||
|
the pointer to the location to return load address in, may be
|
||||||
|
@NULL
|
||||||
|
|
||||||
|
@param len
|
||||||
|
pointer to the location to return the size of this module in
|
||||||
|
memory in, may be @NULL
|
||||||
|
|
||||||
|
@returns @true if the load address and module size were retrieved, @false
|
||||||
|
if this information is not available.
|
||||||
|
*/
|
||||||
|
bool GetAddress(void ** addr, size_t len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the base name of this module, e.g. @c kernel32.dll or
|
||||||
|
@c libc-2.3.2.so.
|
||||||
|
*/
|
||||||
|
wxString GetName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the full path of this module if available, e.g.
|
||||||
|
@c c:\windows\system32\kernel32.dll or
|
||||||
|
@c /lib/libc-2.3.2.so.
|
||||||
|
*/
|
||||||
|
wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the version of this module, e.g. @c 5.2.3790.0 or
|
||||||
|
@c 2.3.2. The returned string is empty if the version information is not
|
||||||
|
available.
|
||||||
|
*/
|
||||||
|
wxString GetVersion();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDllLoader
|
||||||
|
@wxheader{dynlib.h}
|
||||||
|
|
||||||
|
@b Deprecation note: This class is deprecated since version 2.4 and is
|
||||||
|
not compiled in by default in version 2.6 and will be removed in 2.8. Please
|
||||||
|
use wxDynamicLibrary instead.
|
||||||
|
|
||||||
|
wxDllLoader is a class providing an interface similar to Unix's @c dlopen(). It
|
||||||
|
is used by the wxLibrary framework and manages the actual
|
||||||
|
loading of shared libraries and the resolving of symbols in them. There are no
|
||||||
|
instances of this class, it simply serves as a namespace for its static member
|
||||||
|
functions.
|
||||||
|
|
||||||
|
Please note that class wxDynamicLibrary provides
|
||||||
|
alternative, friendlier interface to wxDllLoader.
|
||||||
|
|
||||||
|
The terms @e DLL and @e shared library/object will both be used in the
|
||||||
|
documentation to refer to the same thing: a @c .dll file under Windows or
|
||||||
|
@c .so or @c .sl one under Unix.
|
||||||
|
|
||||||
|
Example of using this class to dynamically load the @c strlen() function:
|
||||||
|
|
||||||
|
@code
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
static const wxChar *LIB_NAME = _T("kernel32");
|
||||||
|
static const wxChar *FUNC_NAME = _T("lstrlenA");
|
||||||
|
#elif defined(__UNIX__)
|
||||||
|
static const wxChar *LIB_NAME = _T("/lib/libc-2.0.7.so");
|
||||||
|
static const wxChar *FUNC_NAME = _T("strlen");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxDllType dllHandle = wxDllLoader::LoadLibrary(LIB_NAME);
|
||||||
|
if ( !dllHandle )
|
||||||
|
{
|
||||||
|
... error ...
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
typedef int (*strlenType)(char *);
|
||||||
|
strlenType pfnStrlen = (strlenType)wxDllLoader::GetSymbol(dllHandle,
|
||||||
|
FUNC_NAME);
|
||||||
|
if ( !pfnStrlen )
|
||||||
|
{
|
||||||
|
... error ...
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( pfnStrlen("foo") != 3 )
|
||||||
|
{
|
||||||
|
... error ...
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
... ok! ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDllLoader::UnloadLibrary(dllHandle);
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{appmanagement}
|
||||||
|
*/
|
||||||
|
class wxDllLoader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Returns the string containing the usual extension for shared libraries for the
|
||||||
|
given systems (including the leading dot if not empty).
|
||||||
|
|
||||||
|
For example, this function will return @c ".dll" under Windows or (usually)
|
||||||
|
@c ".so" under Unix.
|
||||||
|
*/
|
||||||
|
static wxString GetDllExt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function returns a valid handle for the main program itself. Notice that
|
||||||
|
the @NULL return value is valid for some systems (i.e. doesn't mean that
|
||||||
|
the function failed).
|
||||||
|
|
||||||
|
@b NB: This function is Unix specific. It will always fail under Windows
|
||||||
|
or OS/2.
|
||||||
|
*/
|
||||||
|
wxDllType GetProgramHandle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function resolves a symbol in a loaded DLL, such as a variable or
|
||||||
|
function name.
|
||||||
|
|
||||||
|
Returned value will be @NULL if the symbol was not found in the DLL or if
|
||||||
|
an error occurred.
|
||||||
|
|
||||||
|
@param dllHandle
|
||||||
|
Valid handle previously returned by
|
||||||
|
LoadLibrary
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Name of the symbol.
|
||||||
|
*/
|
||||||
|
void * GetSymbol(wxDllType dllHandle, const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function loads a shared library into memory, with @e libname being the
|
||||||
|
name of the library: it may be either the full name including path and
|
||||||
|
(platform-dependent) extension, just the basename (no path and no extension)
|
||||||
|
or a basename with extension. In the last two cases, the library will be
|
||||||
|
searched in all standard locations.
|
||||||
|
|
||||||
|
Returns a handle to the loaded DLL. Use @e success parameter to test if it
|
||||||
|
is valid. If the handle is valid, the library must be unloaded later with
|
||||||
|
UnloadLibrary().
|
||||||
|
|
||||||
|
@param libname
|
||||||
|
Name of the shared object to load.
|
||||||
|
|
||||||
|
@param success
|
||||||
|
May point to a bool variable which will be set to @true or
|
||||||
|
@false; may also be @NULL.
|
||||||
|
*/
|
||||||
|
wxDllType LoadLibrary(const wxString & libname,
|
||||||
|
bool* success = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function unloads the shared library. The handle @e dllhandle must have
|
||||||
|
been returned by LoadLibrary() previously.
|
||||||
|
*/
|
||||||
|
void UnloadLibrary(wxDllType dllhandle);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDynamicLibrary
|
||||||
|
@wxheader{dynlib.h}
|
||||||
|
|
||||||
|
wxDynamicLibrary is a class representing dynamically loadable library
|
||||||
|
(Windows DLL, shared library under Unix etc.). Just create an object of
|
||||||
|
this class to load a library and don't worry about unloading it -- it will be
|
||||||
|
done in the objects destructor automatically.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDynamicLibrary::CanonicalizePluginName
|
||||||
|
*/
|
||||||
|
class wxDynamicLibrary
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor. Second form calls Load().
|
||||||
|
*/
|
||||||
|
wxDynamicLibrary();
|
||||||
|
wxDynamicLibrary(const wxString& name,
|
||||||
|
int flags = wxDL_DEFAULT);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the platform-specific full name for the library called @e name. E.g.
|
||||||
|
it adds a @c ".dll" extension under Windows and @c "lib" prefix and
|
||||||
|
@c ".so", @c ".sl" or maybe @c ".dylib" extension under Unix.
|
||||||
|
|
||||||
|
The possible values for @e cat are:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
wxDL_LIBRARY
|
||||||
|
|
||||||
|
|
||||||
|
normal library
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
wxDL_MODULE
|
||||||
|
|
||||||
|
|
||||||
|
a loadable module or plugin
|
||||||
|
|
||||||
|
|
||||||
|
@sa CanonicalizePluginName()
|
||||||
|
*/
|
||||||
|
static wxString CanonicalizeName(const wxString& name,
|
||||||
|
wxDynamicLibraryCategory cat = wxDL_LIBRARY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function does the same thing as
|
||||||
|
CanonicalizeName() but for wxWidgets
|
||||||
|
plugins. The only difference is that compiler and version information are added
|
||||||
|
to the name to ensure that the plugin which is going to be loaded will be
|
||||||
|
compatible with the main program.
|
||||||
|
|
||||||
|
The possible values for @e cat are:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
wxDL_PLUGIN_GUI
|
||||||
|
|
||||||
|
|
||||||
|
plugin which uses GUI classes (default)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
wxDL_PLUGIN_BASE
|
||||||
|
|
||||||
|
|
||||||
|
plugin which only uses wxBase
|
||||||
|
*/
|
||||||
|
static wxString CanonicalizePluginName(const wxString& name,
|
||||||
|
wxPluginCategory cat = wxDL_PLUGIN_GUI);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Detaches this object from its library handle, i.e. the object will not unload
|
||||||
|
the library any longer in its destructor but it is now the callers
|
||||||
|
responsibility to do this using Unload().
|
||||||
|
*/
|
||||||
|
wxDllType Detach();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return a valid handle for the main program itself or @NULL if symbols
|
||||||
|
from the main program can't be loaded on this platform.
|
||||||
|
*/
|
||||||
|
static wxDllType GetProgramHandle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns pointer to symbol @e name in the library or @NULL if the library
|
||||||
|
contains no such symbol.
|
||||||
|
|
||||||
|
@sa wxDYNLIB_FUNCTION
|
||||||
|
*/
|
||||||
|
void * GetSymbol(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is available only under Windows as it is only useful when
|
||||||
|
dynamically loading symbols from standard Windows DLLs. Such functions have
|
||||||
|
either @c 'A' (in ANSI build) or @c 'W' (in Unicode, or wide
|
||||||
|
character build) suffix if they take string parameters. Using this function you
|
||||||
|
can use just the base name of the function and the correct suffix is appende
|
||||||
|
automatically depending on the current build. Otherwise, this method is
|
||||||
|
identical to GetSymbol().
|
||||||
|
*/
|
||||||
|
void * GetSymbolAorW(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the symbol with the given @e name is present in the dynamic
|
||||||
|
library, @false otherwise. Unlike GetSymbol(),
|
||||||
|
this function doesn't log an error message if the symbol is not found.
|
||||||
|
|
||||||
|
This function is new since wxWidgets version 2.5.4
|
||||||
|
*/
|
||||||
|
bool HasSymbol(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the library was successfully loaded, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool IsLoaded();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This static method returns an array containing the details
|
||||||
|
of all modules loaded into the address space of the current project, the array
|
||||||
|
elements are object of @c wxDynamicLibraryDetails class. The array will
|
||||||
|
be empty if an error occurred.
|
||||||
|
|
||||||
|
This method is currently implemented only under Win32 and Linux and is useful
|
||||||
|
mostly for diagnostics purposes.
|
||||||
|
*/
|
||||||
|
static wxDynamicLibraryDetailsArray ListLoaded();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads DLL with the given @e name into memory. The @e flags argument can
|
||||||
|
be a combination of the following bits:
|
||||||
|
|
||||||
|
wxDL_LAZY
|
||||||
|
|
||||||
|
|
||||||
|
equivalent of RTLD_LAZY under Unix, ignored elsewhere
|
||||||
|
|
||||||
|
wxDL_NOW
|
||||||
|
|
||||||
|
|
||||||
|
equivalent of RTLD_NOW under Unix, ignored elsewhere
|
||||||
|
|
||||||
|
wxDL_GLOBAL
|
||||||
|
|
||||||
|
|
||||||
|
equivalent of RTLD_GLOBAL under Unix, ignored elsewhere
|
||||||
|
|
||||||
|
wxDL_VERBATIM
|
||||||
|
|
||||||
|
|
||||||
|
don't try to append the appropriate extension to
|
||||||
|
the library name (this is done by default).
|
||||||
|
|
||||||
|
wxDL_DEFAULT
|
||||||
|
|
||||||
|
|
||||||
|
default flags, same as wxDL_NOW currently
|
||||||
|
|
||||||
|
wxDL_QUIET
|
||||||
|
|
||||||
|
|
||||||
|
don't log an error message if the library couldn't be
|
||||||
|
loaded.
|
||||||
|
|
||||||
|
Returns @true if the library was successfully loaded, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool Load(const wxString& name, int flags = wxDL_DEFAULT);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Unloads the library from memory. wxDynamicLibrary object automatically calls
|
||||||
|
this method from its destructor if it had been successfully loaded.
|
||||||
|
|
||||||
|
The second version is only used if you need to keep the library in memory
|
||||||
|
during a longer period of time than the scope of the wxDynamicLibrary object.
|
||||||
|
In this case you may call Detach() and store
|
||||||
|
the handle somewhere and call this static method later to unload it.
|
||||||
|
*/
|
||||||
|
void Unload();
|
||||||
|
static void Unload(wxDllType handle);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
When loading a function from a DLL you always have to cast the returned
|
||||||
|
@c void * pointer to the correct type and, even more annoyingly, you have to
|
||||||
|
repeat this type twice if you want to declare and define a function pointer all
|
||||||
|
in one line
|
||||||
|
|
||||||
|
This macro makes this slightly less painful by allowing you to specify the
|
||||||
|
type only once, as the first parameter, and creating a variable of this type
|
||||||
|
named after the function but with @c pfn prefix and initialized with the
|
||||||
|
function @e name from the wxDynamicLibrary
|
||||||
|
@e dynlib.
|
||||||
|
|
||||||
|
@param type
|
||||||
|
the type of the function
|
||||||
|
|
||||||
|
@param name
|
||||||
|
the name of the function to load, not a string (without quotes,
|
||||||
|
it is quoted automatically by the macro)
|
||||||
|
|
||||||
|
@param dynlib
|
||||||
|
the library to load the function from
|
||||||
|
*/
|
||||||
|
#define wxDYNLIB_FUNCTION(type, name, dynlib) /* implementation is private */
|
||||||
|
|
||||||
95
interface/editlbox.h
Normal file
95
interface/editlbox.h
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: editlbox.h
|
||||||
|
// Purpose: documentation for wxEditableListBox class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxEditableListBox
|
||||||
|
@wxheader{editlbox.h}
|
||||||
|
|
||||||
|
An editable listbox is composite control that lets the
|
||||||
|
user easily enter, delete and reorder a list of strings.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxEL_ALLOW_NEW}:
|
||||||
|
Allows the user to enter new strings.
|
||||||
|
@style{wxEL_ALLOW_EDIT}:
|
||||||
|
Allows the user to edit existing strings.
|
||||||
|
@style{wxEL_ALLOW_DELETE}:
|
||||||
|
Allows the user to delete existing strings.
|
||||||
|
@style{wxEL_NO_REORDER}:
|
||||||
|
Does not allow the user to reorder the strings.
|
||||||
|
@style{wxEL_DEFAULT_STYLE}:
|
||||||
|
wxEL_ALLOW_NEW|wxEL_ALLOW_EDIT|wxEL_ALLOW_DELETE
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxadv}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxListBox
|
||||||
|
*/
|
||||||
|
class wxEditableListBox : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating and showing a list box.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window. Must not be @NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
Window identifier. The value wxID_ANY indicates a default value.
|
||||||
|
|
||||||
|
@param label
|
||||||
|
The text shown just before the list control.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Window position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Window size. If wxDefaultSize is specified then the window is sized
|
||||||
|
appropriately.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
Window style. See wxEditableListBox.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Window name.
|
||||||
|
|
||||||
|
@sa Create()
|
||||||
|
*/
|
||||||
|
wxEditableListBox();
|
||||||
|
wxEditableListBox(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxEL_DEFAULT_STYLE,
|
||||||
|
const wxString& name = "editableListBox");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor, destroying the list box.
|
||||||
|
*/
|
||||||
|
~wxEditableListBox();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the editable listbox for two-step construction. See wxEditableListBox()
|
||||||
|
for further details.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxEL_DEFAULT_STYLE,
|
||||||
|
const wxString& name = "editableListBox");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Replaces current contents with given strings.
|
||||||
|
*/
|
||||||
|
void SetStrings(const wxArrayString& strings);
|
||||||
|
};
|
||||||
129
interface/encconv.h
Normal file
129
interface/encconv.h
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: encconv.h
|
||||||
|
// Purpose: documentation for wxEncodingConverter class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxEncodingConverter
|
||||||
|
@wxheader{encconv.h}
|
||||||
|
|
||||||
|
This class is capable of converting strings between two
|
||||||
|
8-bit encodings/charsets. It can also convert from/to Unicode (but only
|
||||||
|
if you compiled wxWidgets with wxUSE_WCHAR_T set to 1). Only a limited subset
|
||||||
|
of encodings is supported by wxEncodingConverter:
|
||||||
|
@c wxFONTENCODING_ISO8859_1..15, @c wxFONTENCODING_CP1250..1257 and
|
||||||
|
@c wxFONTENCODING_KOI8.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{misc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFontMapper, wxMBConv, @ref overview_nonenglishoverview "Writing non-English
|
||||||
|
applications"
|
||||||
|
*/
|
||||||
|
class wxEncodingConverter : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxEncodingConverter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return @true if (any text in) multibyte encoding @e encIn can be converted to
|
||||||
|
another one (@e encOut) losslessly.
|
||||||
|
|
||||||
|
Do not call this method with @c wxFONTENCODING_UNICODE as either
|
||||||
|
parameter, it doesn't make sense (always works in one sense and always depends
|
||||||
|
on the text to convert in the other).
|
||||||
|
*/
|
||||||
|
static bool CanConvert(wxFontEncoding encIn,
|
||||||
|
wxFontEncoding encOut);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Convert wxString and return new wxString object.
|
||||||
|
*/
|
||||||
|
bool Convert(const char* input, char* output);
|
||||||
|
bool Convert(const wchar_t* input, wchar_t* output);
|
||||||
|
bool Convert(const char* input, wchar_t* output);
|
||||||
|
bool Convert(const wchar_t* input, char* output);
|
||||||
|
bool Convert(char* str);
|
||||||
|
bool Convert(wchar_t* str);
|
||||||
|
wxString Convert(const wxString& input);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Similar to
|
||||||
|
GetPlatformEquivalents(),
|
||||||
|
but this one will return ALL
|
||||||
|
equivalent encodings, regardless of the platform, and including itself.
|
||||||
|
|
||||||
|
This platform's encodings are before others in the array. And again, if @e enc
|
||||||
|
is in the array,
|
||||||
|
it is the very first item in it.
|
||||||
|
*/
|
||||||
|
static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return equivalents for given font that are used
|
||||||
|
under given platform. Supported platforms:
|
||||||
|
|
||||||
|
wxPLATFORM_UNIX
|
||||||
|
wxPLATFORM_WINDOWS
|
||||||
|
wxPLATFORM_OS2
|
||||||
|
wxPLATFORM_MAC
|
||||||
|
wxPLATFORM_CURRENT
|
||||||
|
|
||||||
|
wxPLATFORM_CURRENT means the platform this binary was compiled for.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
Equivalence is defined in terms of convertibility:
|
||||||
|
two encodings are equivalent if you can convert text between
|
||||||
|
then without losing information (it may - and will - happen
|
||||||
|
that you lose special chars like quotation marks or em-dashes
|
||||||
|
but you shouldn't lose any diacritics and language-specific
|
||||||
|
characters when converting between equivalent encodings).
|
||||||
|
|
||||||
|
Remember that this function does @b NOT check for presence of
|
||||||
|
fonts in system. It only tells you what are most suitable
|
||||||
|
encodings. (It usually returns only one encoding.)
|
||||||
|
*/
|
||||||
|
static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc,
|
||||||
|
int platform = wxPLATFORM_CURRENT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize conversion. Both output or input encoding may
|
||||||
|
be wxFONTENCODING_UNICODE, but only if wxUSE_ENCODING is set to 1.
|
||||||
|
All subsequent calls to Convert()
|
||||||
|
will interpret its argument
|
||||||
|
as a string in @e input_enc encoding and will output string in
|
||||||
|
@e output_enc encoding.
|
||||||
|
You must call this method before calling Convert. You may call
|
||||||
|
it more than once in order to switch to another conversion.
|
||||||
|
@e Method affects behaviour of Convert() in case input character
|
||||||
|
cannot be converted because it does not exist in output encoding:
|
||||||
|
|
||||||
|
@b wxCONVERT_STRICT
|
||||||
|
|
||||||
|
|
||||||
|
follow behaviour of GNU Recode -
|
||||||
|
just copy unconvertible characters to output and don't change them
|
||||||
|
(its integer value will stay the same)
|
||||||
|
|
||||||
|
@b wxCONVERT_SUBSTITUTE
|
||||||
|
|
||||||
|
|
||||||
|
try some (lossy) substitutions
|
||||||
|
- e.g. replace unconvertible latin capitals with acute by ordinary
|
||||||
|
capitals, replace en-dash or em-dash by '-' etc.
|
||||||
|
|
||||||
|
Both modes guarantee that output string will have same length
|
||||||
|
as input string.
|
||||||
|
*/
|
||||||
|
bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc,
|
||||||
|
int method = wxCONVERT_STRICT);
|
||||||
|
};
|
||||||
2857
interface/event.h
Normal file
2857
interface/event.h
Normal file
File diff suppressed because it is too large
Load Diff
160
interface/fdrepdlg.h
Normal file
160
interface/fdrepdlg.h
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fdrepdlg.h
|
||||||
|
// Purpose: documentation for wxFindDialogEvent class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFindDialogEvent
|
||||||
|
@wxheader{fdrepdlg.h}
|
||||||
|
|
||||||
|
wxFindReplaceDialog events
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{events}
|
||||||
|
*/
|
||||||
|
class wxFindDialogEvent : public wxCommandEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constuctor used by wxWidgets only.
|
||||||
|
*/
|
||||||
|
wxFindDialogEvent(wxEventType commandType = wxEVT_@NULL,
|
||||||
|
int id = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the pointer to the dialog which generated this event.
|
||||||
|
*/
|
||||||
|
wxFindReplaceDialog* GetDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the string to find (never empty).
|
||||||
|
*/
|
||||||
|
wxString GetFindString();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the currently selected flags: this is the combination of @c wxFR_DOWN,
|
||||||
|
@c wxFR_WHOLEWORD and @c wxFR_MATCHCASE flags.
|
||||||
|
*/
|
||||||
|
int GetFlags();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the string to replace the search string with (only for replace and
|
||||||
|
replace all events).
|
||||||
|
*/
|
||||||
|
const wxString GetReplaceString();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFindReplaceData
|
||||||
|
@wxheader{fdrepdlg.h}
|
||||||
|
|
||||||
|
wxFindReplaceData holds the data for
|
||||||
|
wxFindReplaceDialog. It is used to initialize
|
||||||
|
the dialog with the default values and will keep the last values from the
|
||||||
|
dialog when it is closed. It is also updated each time a
|
||||||
|
wxFindDialogEvent is generated so instead of
|
||||||
|
using the wxFindDialogEvent methods you can also directly query this object.
|
||||||
|
|
||||||
|
Note that all @c SetXXX() methods may only be called before showing the
|
||||||
|
dialog and calling them has no effect later.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
*/
|
||||||
|
class wxFindReplaceData : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constuctor initializes the flags to default value (0).
|
||||||
|
*/
|
||||||
|
wxFindReplaceData(wxUint32 flags = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the string to find.
|
||||||
|
*/
|
||||||
|
const wxString GetFindString();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the combination of @c wxFindReplaceFlags values.
|
||||||
|
*/
|
||||||
|
int GetFlags();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the replacement string.
|
||||||
|
*/
|
||||||
|
const wxString GetReplaceString();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the string to find (used as initial value by the dialog).
|
||||||
|
*/
|
||||||
|
void SetFindString(const wxString& str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the flags to use to initialize the controls of the dialog.
|
||||||
|
*/
|
||||||
|
void SetFlags(wxUint32 flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the replacement string (used as initial value by the dialog).
|
||||||
|
*/
|
||||||
|
void SetReplaceString(const wxString& str);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFindReplaceDialog
|
||||||
|
@wxheader{fdrepdlg.h}
|
||||||
|
|
||||||
|
wxFindReplaceDialog is a standard modeless dialog which is used to allow the
|
||||||
|
user to search for some text (and possibly replace it with something else).
|
||||||
|
The actual searching is supposed to be done in the owner window which is the
|
||||||
|
parent of this dialog. Note that it means that unlike for the other standard
|
||||||
|
dialogs this one @b must have a parent window. Also note that there is no
|
||||||
|
way to use this dialog in a modal way; it is always, by design and
|
||||||
|
implementation, modeless.
|
||||||
|
|
||||||
|
Please see the dialogs sample for an example of using it.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{cmndlg}
|
||||||
|
*/
|
||||||
|
class wxFindReplaceDialog : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
After using default constructor Create()
|
||||||
|
must be called.
|
||||||
|
|
||||||
|
The @e parent and @e data parameters must be non-@NULL.
|
||||||
|
*/
|
||||||
|
wxFindReplaceDialog();
|
||||||
|
wxFindReplaceDialog(wxWindow * parent,
|
||||||
|
wxFindReplaceData* data,
|
||||||
|
const wxString& title,
|
||||||
|
int style = 0);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxFindReplaceDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the dialog; use wxWindow::Show to show it on screen.
|
||||||
|
|
||||||
|
The @e parent and @e data parameters must be non-@NULL.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxFindReplaceData* data,
|
||||||
|
const wxString& title, int style = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the wxFindReplaceData object used by this
|
||||||
|
dialog.
|
||||||
|
*/
|
||||||
|
const wxFindReplaceData* GetData();
|
||||||
|
};
|
||||||
206
interface/ffile.h
Normal file
206
interface/ffile.h
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: ffile.h
|
||||||
|
// Purpose: documentation for wxFFile class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFFile
|
||||||
|
@wxheader{ffile.h}
|
||||||
|
|
||||||
|
wxFFile implements buffered file I/O. This is a very small class designed to
|
||||||
|
minimize the overhead of using it - in fact, there is hardly any overhead at
|
||||||
|
all, but using it brings you automatic error checking and hides differences
|
||||||
|
between platforms and compilers. It wraps inside it a @c FILE * handle used
|
||||||
|
by standard C IO library (also known as @c stdio).
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{file}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFFile::IsOpened
|
||||||
|
*/
|
||||||
|
class wxFFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Opens a file with the given file pointer, which has already been opened.
|
||||||
|
|
||||||
|
@param filename
|
||||||
|
The filename.
|
||||||
|
|
||||||
|
@param mode
|
||||||
|
The mode in which to open the file using standard C strings.
|
||||||
|
Note that you should use "b" flag if you use binary files under Windows
|
||||||
|
or the results might be unexpected due to automatic newline conversion done
|
||||||
|
for the text files.
|
||||||
|
|
||||||
|
@param fp
|
||||||
|
An existing file descriptor, such as stderr.
|
||||||
|
*/
|
||||||
|
wxFFile();
|
||||||
|
wxFFile(const wxString& filename, const wxString& mode = "r");
|
||||||
|
wxFFile(FILE* fp);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor will close the file.
|
||||||
|
|
||||||
|
NB: it is not virtual so you should @e not derive from wxFFile!
|
||||||
|
*/
|
||||||
|
~wxFFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Attaches an existing file pointer to the wxFFile object.
|
||||||
|
|
||||||
|
The descriptor should be already opened and it will be closed by wxFFile
|
||||||
|
object.
|
||||||
|
*/
|
||||||
|
void Attach(FILE* fp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Closes the file and returns @true on success.
|
||||||
|
*/
|
||||||
|
bool Close();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get back a file pointer from wxFFile object -- the caller is responsible for
|
||||||
|
closing the file if this
|
||||||
|
descriptor is opened. IsOpened() will return @false after call to Detach().
|
||||||
|
*/
|
||||||
|
void Detach();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the an attempt has been made to read @e past
|
||||||
|
the end of the file.
|
||||||
|
|
||||||
|
Note that the behaviour of the file descriptor based class
|
||||||
|
wxFile is different as wxFile::Eof
|
||||||
|
will return @true here as soon as the last byte of the file has been
|
||||||
|
read.
|
||||||
|
|
||||||
|
Also note that this method may only be called for opened files and may crash if
|
||||||
|
the file is not opened.
|
||||||
|
|
||||||
|
@sa IsOpened()
|
||||||
|
*/
|
||||||
|
#define bool Eof() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if an error has occurred on this file, similar to the standard
|
||||||
|
@c ferror() function.
|
||||||
|
|
||||||
|
Please note that this method may only be called for opened files and may crash
|
||||||
|
if the file is not opened.
|
||||||
|
|
||||||
|
@sa IsOpened()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Flushes the file and returns @true on success.
|
||||||
|
*/
|
||||||
|
bool Flush();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the type of the file. Possible return values are:
|
||||||
|
*/
|
||||||
|
wxFileKind GetKind();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the file is opened. Most of the methods of this class may
|
||||||
|
only
|
||||||
|
be used for an opened file.
|
||||||
|
*/
|
||||||
|
bool IsOpened();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the length of the file.
|
||||||
|
*/
|
||||||
|
wxFileOffset Length();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Opens the file, returning @true if successful.
|
||||||
|
|
||||||
|
@param filename
|
||||||
|
The filename.
|
||||||
|
|
||||||
|
@param mode
|
||||||
|
The mode in which to open the file.
|
||||||
|
*/
|
||||||
|
bool Open(const wxString& filename, const wxString& mode = "r");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads the specified number of bytes into a buffer, returning the actual number
|
||||||
|
read.
|
||||||
|
|
||||||
|
@param buffer
|
||||||
|
A buffer to receive the data.
|
||||||
|
|
||||||
|
@param count
|
||||||
|
The number of bytes to read.
|
||||||
|
|
||||||
|
@returns The number of bytes read.
|
||||||
|
*/
|
||||||
|
size_t Read(void* buffer, size_t count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
Reads the entire contents of the file into a string.
|
||||||
|
|
||||||
|
@param str
|
||||||
|
String to read data into.
|
||||||
|
|
||||||
|
@param conv
|
||||||
|
Conversion object to use in Unicode build; by default supposes
|
||||||
|
that file contents is encoded in UTF-8.
|
||||||
|
|
||||||
|
@returns @true if file was read successfully, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool ReadAll(wxString * str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Seeks to the specified position and returns @true on success.
|
||||||
|
|
||||||
|
@param ofs
|
||||||
|
Offset to seek to.
|
||||||
|
|
||||||
|
@param mode
|
||||||
|
One of wxFromStart, wxFromEnd, wxFromCurrent.
|
||||||
|
*/
|
||||||
|
bool Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Moves the file pointer to the specified number of bytes before the end of the
|
||||||
|
file
|
||||||
|
and returns @true on success.
|
||||||
|
|
||||||
|
@param ofs
|
||||||
|
Number of bytes before the end of the file.
|
||||||
|
*/
|
||||||
|
bool SeekEnd(wxFileOffset ofs = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current position.
|
||||||
|
*/
|
||||||
|
wxFileOffset Tell();
|
||||||
|
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
Writes the contents of the string to the file, returns @true on success.
|
||||||
|
|
||||||
|
The second argument is only meaningful in Unicode build of wxWidgets when
|
||||||
|
@e conv is used to convert @e s to multibyte representation.
|
||||||
|
*/
|
||||||
|
bool Write(const wxString& s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the file pointer associated with the file.
|
||||||
|
*/
|
||||||
|
#define FILE * fp() /* implementation is private */
|
||||||
|
};
|
||||||
336
interface/file.h
Normal file
336
interface/file.h
Normal file
@@ -0,0 +1,336 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: file.h
|
||||||
|
// Purpose: documentation for wxTempFile class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxTempFile
|
||||||
|
@wxheader{file.h}
|
||||||
|
|
||||||
|
wxTempFile provides a relatively safe way to replace the contents of the
|
||||||
|
existing file. The name is explained by the fact that it may be also used as
|
||||||
|
just a temporary file if you don't replace the old file contents.
|
||||||
|
|
||||||
|
Usually, when a program replaces the contents of some file it first opens it for
|
||||||
|
writing, thus losing all of the old data and then starts recreating it. This
|
||||||
|
approach is not very safe because during the regeneration of the file bad things
|
||||||
|
may happen: the program may find that there is an internal error preventing it
|
||||||
|
from completing file generation, the user may interrupt it (especially if file
|
||||||
|
generation takes long time) and, finally, any other external interrupts (power
|
||||||
|
supply failure or a disk error) will leave you without either the original file
|
||||||
|
or the new one.
|
||||||
|
|
||||||
|
wxTempFile addresses this problem by creating a temporary file which is meant to
|
||||||
|
replace the original file - but only after it is fully written. So, if the user
|
||||||
|
interrupts the program during the file generation, the old file won't be lost.
|
||||||
|
Also, if the program discovers itself that it doesn't want to replace the old
|
||||||
|
file there is no problem - in fact, wxTempFile will @b not replace the old
|
||||||
|
file by default, you should explicitly call wxTempFile::Commit
|
||||||
|
to do it. Calling wxTempFile::Discard explicitly discards any
|
||||||
|
modifications: it closes and deletes the temporary file and leaves the original
|
||||||
|
file unchanged. If you don't call neither of Commit() and Discard(), the
|
||||||
|
destructor will call Discard() automatically.
|
||||||
|
|
||||||
|
To summarize: if you want to replace another file, create an instance of
|
||||||
|
wxTempFile passing the name of the file to be replaced to the constructor (you
|
||||||
|
may also use default constructor and pass the file name to
|
||||||
|
wxTempFile::Open). Then you can wxTempFile::write
|
||||||
|
to wxTempFile using wxFile-like functions and later call
|
||||||
|
Commit() to replace the old file (and close this one) or call Discard() to
|
||||||
|
cancel
|
||||||
|
the modifications.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{file}
|
||||||
|
*/
|
||||||
|
class wxTempFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Associates wxTempFile with the file to be replaced and opens it. You should use
|
||||||
|
IsOpened() to verify if the constructor succeeded.
|
||||||
|
*/
|
||||||
|
wxTempFile(const wxString& strName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor calls Discard() if temporary file
|
||||||
|
is still opened.
|
||||||
|
*/
|
||||||
|
~wxTempFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Validate changes: deletes the old file of name m_strName and renames the new
|
||||||
|
file to the old name. Returns @true if both actions succeeded. If @false is
|
||||||
|
returned it may unfortunately mean two quite different things: either that
|
||||||
|
either the old file couldn't be deleted or that the new file couldn't be renamed
|
||||||
|
to the old name.
|
||||||
|
*/
|
||||||
|
bool Commit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Discard changes: the old file contents is not changed, temporary file is
|
||||||
|
deleted.
|
||||||
|
*/
|
||||||
|
void Discard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the file was successfully opened.
|
||||||
|
*/
|
||||||
|
bool IsOpened();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the length of the file.
|
||||||
|
*/
|
||||||
|
wxFileOffset Length();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Open the temporary file, returns @true on success, @false if an error
|
||||||
|
occurred.
|
||||||
|
|
||||||
|
@e strName is the name of file to be replaced. The temporary file is always
|
||||||
|
created in the directory where @e strName is. In particular, if
|
||||||
|
@e strName doesn't include the path, it is created in the current directory
|
||||||
|
and the program should have write access to it for the function to succeed.
|
||||||
|
*/
|
||||||
|
bool Open(const wxString& strName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Seeks to the specified position.
|
||||||
|
*/
|
||||||
|
wxFileOffset Seek(wxFileOffset ofs,
|
||||||
|
wxSeekMode mode = wxFromStart);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current position or wxInvalidOffset if file is not opened or if
|
||||||
|
another
|
||||||
|
error occurred.
|
||||||
|
*/
|
||||||
|
wxFileOffset Tell();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Write to the file, return @true on success, @false on failure.
|
||||||
|
|
||||||
|
The second argument is only meaningful in Unicode build of wxWidgets when
|
||||||
|
@e conv is used to convert @e str to multibyte representation.
|
||||||
|
*/
|
||||||
|
bool Write(const wxString& str,
|
||||||
|
const wxMBConv& conv = wxConvUTF8);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFile
|
||||||
|
@wxheader{file.h}
|
||||||
|
|
||||||
|
A wxFile performs raw file I/O. This is a very small class designed to
|
||||||
|
minimize the overhead of using it - in fact, there is hardly any overhead at
|
||||||
|
all, but using it brings you automatic error checking and hides differences
|
||||||
|
between platforms and compilers. wxFile also automatically closes the file in
|
||||||
|
its destructor making it unnecessary to worry about forgetting to do it.
|
||||||
|
wxFile is a wrapper around @c file descriptor. - see also
|
||||||
|
wxFFile for a wrapper around @c FILE structure.
|
||||||
|
|
||||||
|
@c wxFileOffset is used by the wxFile functions which require offsets as
|
||||||
|
parameter or return them. If the platform supports it, wxFileOffset is a typedef
|
||||||
|
for a native 64 bit integer, otherwise a 32 bit integer is used for
|
||||||
|
wxFileOffset.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{file}
|
||||||
|
*/
|
||||||
|
class wxFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Associates the file with the given file descriptor, which has already been
|
||||||
|
opened.
|
||||||
|
|
||||||
|
@param filename
|
||||||
|
The filename.
|
||||||
|
|
||||||
|
@param mode
|
||||||
|
The mode in which to open the file. May be one of read(), write() and
|
||||||
|
wxFile::read_write.
|
||||||
|
|
||||||
|
@param fd
|
||||||
|
An existing file descriptor (see Attach() for the list of predefined
|
||||||
|
descriptors)
|
||||||
|
*/
|
||||||
|
wxFile();
|
||||||
|
wxFile(const wxString& filename,
|
||||||
|
wxFile::OpenMode mode = wxFile::read);
|
||||||
|
wxFile(int fd);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor will close the file.
|
||||||
|
|
||||||
|
@b NB: it is not virtual so you should not use wxFile polymorphically.
|
||||||
|
*/
|
||||||
|
~wxFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function verifies if we may access the given file in specified mode. Only
|
||||||
|
values of read() or write() really make sense here.
|
||||||
|
*/
|
||||||
|
static bool Access(const wxString& name, OpenMode mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Attaches an existing file descriptor to the wxFile object. Example of predefined
|
||||||
|
file descriptors are 0, 1 and 2 which correspond to stdin, stdout and stderr
|
||||||
|
(and
|
||||||
|
have symbolic names of @b wxFile::fd_stdin, @b wxFile::fd_stdout and @b
|
||||||
|
wxFile::fd_stderr).
|
||||||
|
|
||||||
|
The descriptor should be already opened and it will be closed by wxFile
|
||||||
|
object.
|
||||||
|
*/
|
||||||
|
void Attach(int fd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Closes the file.
|
||||||
|
*/
|
||||||
|
void Close();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a file for writing. If the file already exists, setting @b overwrite to
|
||||||
|
@true
|
||||||
|
will ensure it is overwritten.
|
||||||
|
*/
|
||||||
|
bool Create(const wxString& filename, bool overwrite = @false,
|
||||||
|
int access = wxS_DEFAULT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get back a file descriptor from wxFile object - the caller is responsible for
|
||||||
|
closing the file if this
|
||||||
|
descriptor is opened. IsOpened() will return @false after call to Detach().
|
||||||
|
*/
|
||||||
|
void Detach();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the end of the file has been reached.
|
||||||
|
|
||||||
|
Note that the behaviour of the file pointer based class
|
||||||
|
wxFFile is different as wxFFile::Eof
|
||||||
|
will return @true here only if an attempt has been made to read
|
||||||
|
@e past the last byte of the file, while wxFile::Eof() will return @true
|
||||||
|
even before such attempt is made if the file pointer is at the last position
|
||||||
|
in the file.
|
||||||
|
|
||||||
|
Note also that this function doesn't work on unseekable file descriptors
|
||||||
|
(examples include pipes, terminals and sockets under Unix) and an attempt to
|
||||||
|
use it will result in an error message in such case. So, to read the entire
|
||||||
|
file into memory, you should write a loop which uses
|
||||||
|
Read() repeatedly and tests its return condition instead
|
||||||
|
of using Eof() as this will not work for special files under Unix.
|
||||||
|
*/
|
||||||
|
#define bool Eof() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the given name specifies an existing regular file (not a
|
||||||
|
directory or a link)
|
||||||
|
*/
|
||||||
|
static bool Exists(const wxString& filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Flushes the file descriptor.
|
||||||
|
|
||||||
|
Note that Flush() is not implemented on some Windows compilers
|
||||||
|
due to a missing fsync function, which reduces the usefulness of this function
|
||||||
|
(it can still be called but it will do nothing on unsupported compilers).
|
||||||
|
*/
|
||||||
|
bool Flush();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the type of the file. Possible return values are:
|
||||||
|
*/
|
||||||
|
wxFileKind GetKind();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the file has been opened.
|
||||||
|
*/
|
||||||
|
bool IsOpened();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the length of the file.
|
||||||
|
*/
|
||||||
|
wxFileOffset Length();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Opens the file, returning @true if successful.
|
||||||
|
|
||||||
|
@param filename
|
||||||
|
The filename.
|
||||||
|
|
||||||
|
@param mode
|
||||||
|
The mode in which to open the file. May be one of read(), write() and
|
||||||
|
wxFile::read_write.
|
||||||
|
*/
|
||||||
|
bool Open(const wxString& filename,
|
||||||
|
wxFile::OpenMode mode = wxFile::read);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
if there was an error.
|
||||||
|
*/
|
||||||
|
size_t Read(void* buffer, size_t count);
|
||||||
|
Parameters Return value
|
||||||
|
The number of bytes read, or the symbol wxInvalidOffset();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Seeks to the specified position.
|
||||||
|
|
||||||
|
@param ofs
|
||||||
|
Offset to seek to.
|
||||||
|
|
||||||
|
@param mode
|
||||||
|
One of wxFromStart, wxFromEnd, wxFromCurrent.
|
||||||
|
|
||||||
|
@returns The actual offset position achieved, or wxInvalidOffset on
|
||||||
|
failure.
|
||||||
|
*/
|
||||||
|
wxFileOffset Seek(wxFileOffset ofs,
|
||||||
|
wxSeekMode mode = wxFromStart);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Moves the file pointer to the specified number of bytes relative to the end of
|
||||||
|
the file. For example, @c SeekEnd(-5) would position the pointer 5
|
||||||
|
bytes before the end.
|
||||||
|
|
||||||
|
@param ofs
|
||||||
|
Number of bytes before the end of the file.
|
||||||
|
|
||||||
|
@returns The actual offset position achieved, or wxInvalidOffset on
|
||||||
|
failure.
|
||||||
|
*/
|
||||||
|
wxFileOffset SeekEnd(wxFileOffset ofs = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current position or wxInvalidOffset if file is not opened or if
|
||||||
|
another
|
||||||
|
error occurred.
|
||||||
|
*/
|
||||||
|
wxFileOffset Tell();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes the contents of the string to the file, returns @true on success.
|
||||||
|
|
||||||
|
The second argument is only meaningful in Unicode build of wxWidgets when
|
||||||
|
@e conv is used to convert @e s to multibyte representation.
|
||||||
|
|
||||||
|
Note that this method only works with @c NUL-terminated strings, if you want
|
||||||
|
to write data with embedded @c NULs to the file you should use the other
|
||||||
|
@ref write() "Write() overload".
|
||||||
|
*/
|
||||||
|
bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the file descriptor associated with the file.
|
||||||
|
*/
|
||||||
|
#define int fd() /* implementation is private */
|
||||||
|
};
|
||||||
92
interface/fileconf.h
Normal file
92
interface/fileconf.h
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fileconf.h
|
||||||
|
// Purpose: documentation for wxFileConfig class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileConfig
|
||||||
|
@wxheader{fileconf.h}
|
||||||
|
|
||||||
|
wxFileConfig implements wxConfigBase interface for
|
||||||
|
storing and retrieving configuration information using plain text files. 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
|
||||||
|
@c [group] indicating the start of each group.
|
||||||
|
|
||||||
|
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
|
||||||
|
Windows.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFileConfig::Save
|
||||||
|
*/
|
||||||
|
class wxFileConfig : public wxConfigBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
Read the config data from the specified stream instead of the associated file,
|
||||||
|
as usual.
|
||||||
|
|
||||||
|
@sa Save()
|
||||||
|
*/
|
||||||
|
wxFileConfig(wxInputStream& is);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the full path to the file which would be used by wxFileConfig as global,
|
||||||
|
system-wide, file if it were constructed with @e basename as "global
|
||||||
|
filename'' parameter in the constructor. Notice that this function cannot be
|
||||||
|
used if @e basename is already a full path name.
|
||||||
|
*/
|
||||||
|
static wxFileName GetGlobalFile(const wxString& basename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the full path to the file which would be used by wxFileConfig as local,
|
||||||
|
user-specific, file if it were constructed with @e basename as "local
|
||||||
|
filename'' parameter in the constructor.
|
||||||
|
|
||||||
|
@e style has the same meaning as in @ref wxConfigBase::ctor constructor
|
||||||
|
and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is
|
||||||
|
examined by this function.
|
||||||
|
|
||||||
|
Notice that this function cannot be used if @e basename is already a full
|
||||||
|
path name.
|
||||||
|
*/
|
||||||
|
static wxFileName GetLocalFile(const wxString& basename,
|
||||||
|
int style = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
)
|
||||||
|
|
||||||
|
Saves all config data to the given stream, returns @true if data was saved
|
||||||
|
successfully or @false on error.
|
||||||
|
|
||||||
|
Note the interaction of this function with the internal "dirty flag'': the
|
||||||
|
data is saved unconditionally, i.e. even if the object is not dirty. However
|
||||||
|
after saving it successfully, the dirty flag is reset so no changes will be
|
||||||
|
written back to the file this object is associated with until you change its
|
||||||
|
contents again.
|
||||||
|
|
||||||
|
@sa wxConfigBase::Flush
|
||||||
|
*/
|
||||||
|
bool Save(wxOutputStream& os);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Allows to set the mode to be used for the config file creation. For example, to
|
||||||
|
create a config file which is not readable by other users (useful if it stores
|
||||||
|
some sensitive information, such as passwords), you could use
|
||||||
|
@c SetUmask(0077).
|
||||||
|
|
||||||
|
This function doesn't do anything on non-Unix platforms.
|
||||||
|
|
||||||
|
@sa wxCHANGE_UMASK
|
||||||
|
*/
|
||||||
|
void SetUmask(int mode);
|
||||||
|
};
|
||||||
223
interface/filectrl.h
Normal file
223
interface/filectrl.h
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: filectrl.h
|
||||||
|
// Purpose: documentation for wxFileCtrl class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileCtrl
|
||||||
|
@wxheader{filectrl.h}
|
||||||
|
|
||||||
|
This control allows the user to select a file. two implemetations exist, one
|
||||||
|
for Gtk and another generic one for anything other than Gtk.
|
||||||
|
It is only available if @c wxUSE_FILECTRL is set to 1.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxFC_DEFAULT_STYLE}:
|
||||||
|
The default style: wxFC_OPEN
|
||||||
|
@style{wxFC_OPEN}:
|
||||||
|
Creates an file control suitable for opening files. Cannot be
|
||||||
|
combined with wxFC_SAVE.
|
||||||
|
@style{wxFC_SAVE}:
|
||||||
|
Creates an file control suitable for saving files. Cannot be
|
||||||
|
combined with wxFC_OPEN.
|
||||||
|
@style{wxFC_MULTIPLE}:
|
||||||
|
For open control only, Allows selecting multiple files. Cannot be
|
||||||
|
combined with wxFC_SAVE
|
||||||
|
@style{wxFC_NOSHOWHIDDEN}:
|
||||||
|
Hides the "Show Hidden Files" checkbox (Generic only)
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxGenericDirCtrl
|
||||||
|
*/
|
||||||
|
class wxFileCtrl : public wxWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
@param parent
|
||||||
|
Parent window, must not be non-@NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The identifier for the control.
|
||||||
|
|
||||||
|
@param defaultDirectory
|
||||||
|
The initial directory shown in the control. Must be
|
||||||
|
a valid path to a directory or the empty string.
|
||||||
|
In case it is the empty string, the current working directory is used.
|
||||||
|
|
||||||
|
@param defaultFilename
|
||||||
|
The default filename, or the empty string.
|
||||||
|
|
||||||
|
@param wildcard
|
||||||
|
A wildcard specifying which files can be selected,
|
||||||
|
such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style, see wxFC_* flags.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Initial position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Initial size.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Control name.
|
||||||
|
|
||||||
|
@returns @true if the control was successfully created or @false if
|
||||||
|
creation failed.
|
||||||
|
*/
|
||||||
|
wxFileCtrl();
|
||||||
|
wxFileCtrl(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxString& defaultDirectory = wxEmptyString,
|
||||||
|
const wxString& defaultFilename = wxEmptyString,
|
||||||
|
const wxPoint& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
|
long style = wxFC_DEFAULT_STYLE,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
const wxString& name = "filectrl");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create function for two-step construction. See wxFileCtrl() for details.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxString& defaultDirectory = wxEmptyString,
|
||||||
|
const wxString& defaultFilename = wxEmptyString,
|
||||||
|
const wxPoint& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
|
long style = wxFC_DEFAULT_STYLE,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
const wxString& name = "filectrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current directory of the file control (i.e. the directory shown by
|
||||||
|
it).
|
||||||
|
*/
|
||||||
|
wxString GetDirectory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the currently selected filename.
|
||||||
|
For the controls having the @c wxFC_MULTIPLE style, use GetFilenames()
|
||||||
|
instead
|
||||||
|
*/
|
||||||
|
wxString GetFilename();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Fills the array @e filenames with the filenames only of selected items. This
|
||||||
|
function should only be used with the controls having the @c wxFC_MULTIPLE
|
||||||
|
style,
|
||||||
|
use GetFilename() for the others.
|
||||||
|
|
||||||
|
@remarks filenames is emptied first.
|
||||||
|
*/
|
||||||
|
void GetFilenames(wxArrayString& filenames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the zero-based index of the currently selected filter.
|
||||||
|
*/
|
||||||
|
int GetFilterIndex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the full path (directory and filename) of the currently selected file.
|
||||||
|
For the controls having the @c wxFC_MULTIPLE style, use GetPaths()
|
||||||
|
instead
|
||||||
|
*/
|
||||||
|
wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Fills the array @e paths with the full paths of the files chosen. This
|
||||||
|
function should be used with the controls having the @c wxFC_MULTIPLE style,
|
||||||
|
use GetPath() otherwise.
|
||||||
|
|
||||||
|
@remarks paths is emptied first.
|
||||||
|
*/
|
||||||
|
void GetPaths(wxArrayString& paths);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current wildcard.
|
||||||
|
*/
|
||||||
|
wxString GetWildcard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets(changes) the current directory displayed in the control.
|
||||||
|
|
||||||
|
@returns Returns @true on success, @false otherwise.
|
||||||
|
*/
|
||||||
|
bool SetDirectory(const wxString& directory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Selects a certain file.
|
||||||
|
|
||||||
|
@returns Returns @true on success, @false otherwise
|
||||||
|
*/
|
||||||
|
bool SetFilename(const wxString& filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current filter index, starting from zero.
|
||||||
|
*/
|
||||||
|
void SetFilterIndex(int filterIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the wildcard, which can contain multiple file types, for example:
|
||||||
|
|
||||||
|
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
|
||||||
|
*/
|
||||||
|
void SetWildcard(const wxString& wildCard);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets whether hidden files and folders are shown or not.
|
||||||
|
*/
|
||||||
|
void ShowHidden(const bool show);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileCtrlEvent
|
||||||
|
@wxheader{filectrl.h}
|
||||||
|
|
||||||
|
A file control event holds information about events associated with
|
||||||
|
wxFileCtrl objects.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
*/
|
||||||
|
class wxFileCtrlEvent : public wxCommandEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxFileCtrlEvent(wxEventType type, wxObject evtObject, int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current directory.
|
||||||
|
In case of a @b EVT_FILECTRL_FOLDERCHANGED, this method returns the new
|
||||||
|
directory.
|
||||||
|
*/
|
||||||
|
wxString GetDirectory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the file selected(assuming it is only one file).
|
||||||
|
*/
|
||||||
|
wxString GetFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the files selected.
|
||||||
|
In case of a @b EVT_FILECTRL_SELECTIONCHANGED, this method returns the
|
||||||
|
files selected after the event.
|
||||||
|
*/
|
||||||
|
wxArrayString GetFiles();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the files changed by this event.
|
||||||
|
*/
|
||||||
|
wxFileCtrlEvent::SetFiles(const wxArrayString files);
|
||||||
|
};
|
||||||
265
interface/filedlg.h
Normal file
265
interface/filedlg.h
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: filedlg.h
|
||||||
|
// Purpose: documentation for wxFileDialog class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileDialog
|
||||||
|
@wxheader{filedlg.h}
|
||||||
|
|
||||||
|
This class represents the file chooser dialog.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxFD_DEFAULT_STYLE}:
|
||||||
|
Equivalent to wxFD_OPEN.
|
||||||
|
@style{wxFD_OPEN}:
|
||||||
|
This is an open dialog; usually this means that the default
|
||||||
|
button's label of the dialog is "Open". Cannot be combined with
|
||||||
|
wxFD_SAVE.
|
||||||
|
@style{wxFD_SAVE}:
|
||||||
|
This is a save dialog; usually this means that the default button's
|
||||||
|
label of the dialog is "Save". Cannot be combined with wxFD_OPEN.
|
||||||
|
@style{wxFD_OVERWRITE_PROMPT}:
|
||||||
|
For save dialog only: prompt for a confirmation if a file will be
|
||||||
|
overwritten.
|
||||||
|
@style{wxFD_FILE_MUST_EXIST}:
|
||||||
|
For open dialog only: the user may only select files that actually
|
||||||
|
exist.
|
||||||
|
@style{wxFD_MULTIPLE}:
|
||||||
|
For open dialog only: allows selecting multiple files.
|
||||||
|
@style{wxFD_CHANGE_DIR}:
|
||||||
|
Change the current working directory to the directory where the
|
||||||
|
file(s) chosen by the user are.
|
||||||
|
@style{wxFD_PREVIEW}:
|
||||||
|
Show the preview of the selected files (currently only supported by
|
||||||
|
wxGTK using GTK+ 2.4 or later).
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{cmndlg}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxfiledialogoverview "wxFileDialog overview", wxFileSelector
|
||||||
|
*/
|
||||||
|
class wxFileDialog : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. Use ShowModal() to show the dialog.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Parent window.
|
||||||
|
|
||||||
|
@param message
|
||||||
|
Message to show on the dialog.
|
||||||
|
|
||||||
|
@param defaultDir
|
||||||
|
The default directory, or the empty string.
|
||||||
|
|
||||||
|
@param defaultFile
|
||||||
|
The default filename, or the empty string.
|
||||||
|
|
||||||
|
@param wildcard
|
||||||
|
A wildcard, such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
|
||||||
|
|
||||||
|
Note that the native Motif dialog has some limitations with respect to
|
||||||
|
wildcards; see the Remarks section above.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
A dialog style. See wxFD_* styles for more info.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Dialog position. Not implemented.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Dialog size. Not implemented.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Dialog name. Not implemented.
|
||||||
|
*/
|
||||||
|
wxFileDialog(wxWindow* parent,
|
||||||
|
const wxString& message = "Choose a file",
|
||||||
|
const wxString& defaultDir = "",
|
||||||
|
const wxString& defaultFile = "",
|
||||||
|
const wxString& wildcard = ".",
|
||||||
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = "filedlg");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
*/
|
||||||
|
~wxFileDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the default directory.
|
||||||
|
*/
|
||||||
|
wxString GetDirectory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
If functions
|
||||||
|
SetExtraControlCreator()
|
||||||
|
and ShowModal() were called,
|
||||||
|
returns the extra window. Otherwise returns @NULL.
|
||||||
|
*/
|
||||||
|
wxWindow* GetExtraControl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the default filename.
|
||||||
|
*/
|
||||||
|
wxString GetFilename();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Fills the array @e filenames with the names of the files chosen. This
|
||||||
|
function should only be used with the dialogs which have @c wxFD_MULTIPLE style,
|
||||||
|
use GetFilename() for the others.
|
||||||
|
|
||||||
|
Note that under Windows, if the user selects shortcuts, the filenames
|
||||||
|
include paths, since the application cannot determine the full path
|
||||||
|
of each referenced file by appending the directory containing the shortcuts
|
||||||
|
to the filename.
|
||||||
|
*/
|
||||||
|
void GetFilenames(wxArrayString& filenames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the index into the list of filters supplied, optionally, in the
|
||||||
|
wildcard parameter.
|
||||||
|
Before the dialog is shown, this is the index which will be used when the
|
||||||
|
dialog is first displayed.
|
||||||
|
After the dialog is shown, this is the index selected by the user.
|
||||||
|
*/
|
||||||
|
int GetFilterIndex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the message that will be displayed on the dialog.
|
||||||
|
*/
|
||||||
|
wxString GetMessage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the full path (directory and filename) of the selected file.
|
||||||
|
*/
|
||||||
|
wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Fills the array @e paths with the full paths of the files chosen. This
|
||||||
|
function should only be used with the dialogs which have @c wxFD_MULTIPLE style,
|
||||||
|
use GetPath() for the others.
|
||||||
|
*/
|
||||||
|
void GetPaths(wxArrayString& paths);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the file dialog wildcard.
|
||||||
|
*/
|
||||||
|
wxString GetWildcard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the default directory.
|
||||||
|
*/
|
||||||
|
void SetDirectory(const wxString& directory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Customize file dialog by adding extra window, which is typically placed
|
||||||
|
below the list of files and above the buttons.
|
||||||
|
|
||||||
|
SetExtraControlCreator can be called only once, before calling
|
||||||
|
ShowModal().
|
||||||
|
The @c creator function should take pointer to parent window (file dialog)
|
||||||
|
and should return a window allocated with operator new.
|
||||||
|
|
||||||
|
Supported platforms: wxGTK, wxUniv.
|
||||||
|
*/
|
||||||
|
bool SetExtraControlCreator(t_extraControlCreator creator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the default filename.
|
||||||
|
*/
|
||||||
|
void SetFilename(const wxString& setfilename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the default filter index, starting from zero.
|
||||||
|
*/
|
||||||
|
void SetFilterIndex(int filterIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the message that will be displayed on the dialog.
|
||||||
|
*/
|
||||||
|
void SetMessage(const wxString& message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the path (the combined directory and filename that will be returned when
|
||||||
|
the dialog is dismissed).
|
||||||
|
*/
|
||||||
|
void SetPath(const wxString& path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the wildcard, which can contain multiple file types, for example:
|
||||||
|
|
||||||
|
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
|
||||||
|
|
||||||
|
Note that the native Motif dialog has some limitations with respect to
|
||||||
|
wildcards; see the Remarks section above.
|
||||||
|
*/
|
||||||
|
void SetWildcard(const wxString& wildCard);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL
|
||||||
|
otherwise.
|
||||||
|
*/
|
||||||
|
int ShowModal();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pops up a file selector box. In Windows, this is the common file selector
|
||||||
|
dialog. In X, this is a file selector box with the same functionality.
|
||||||
|
The path and filename are distinct elements of a full file pathname.
|
||||||
|
If path is empty, the current directory will be used. If filename is empty,
|
||||||
|
no default filename will be supplied. The wildcard determines what files
|
||||||
|
are displayed in the file selector, and file extension supplies a type
|
||||||
|
extension for the required filename. Flags may be a combination of wxFD_OPEN,
|
||||||
|
wxFD_SAVE, wxFD_OVERWRITE_PROMPT or wxFD_FILE_MUST_EXIST. Note that
|
||||||
|
wxFD_MULTIPLE
|
||||||
|
can only be used with wxFileDialog and not here as this
|
||||||
|
function only returns a single file name.
|
||||||
|
|
||||||
|
Both the Unix and Windows versions implement a wildcard filter. Typing a
|
||||||
|
filename containing wildcards (*, ?) in the filename text item, and
|
||||||
|
clicking on Ok, will result in only those files matching the pattern being
|
||||||
|
displayed.
|
||||||
|
|
||||||
|
The wildcard may be a specification for multiple types of file
|
||||||
|
with a description for each, such as:
|
||||||
|
@code
|
||||||
|
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The application must check for an empty return value (the user pressed
|
||||||
|
Cancel). For example:
|
||||||
|
@code
|
||||||
|
wxString filename = wxFileSelector("Choose a file to open");
|
||||||
|
if ( !filename.empty() )
|
||||||
|
{
|
||||||
|
// work with the file
|
||||||
|
...
|
||||||
|
}
|
||||||
|
//else: cancelled by user
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
wxString wxFileSelector(const wxString& message,
|
||||||
|
const wxString& default_path = "",
|
||||||
|
const wxString& default_filename = "",
|
||||||
|
const wxString& default_extension = "",
|
||||||
|
const wxString& wildcard = ".",
|
||||||
|
int flags = 0,
|
||||||
|
wxWindow * parent = @NULL,
|
||||||
|
int x = -1,
|
||||||
|
int y = -1);
|
||||||
|
|
||||||
371
interface/filefn.h
Normal file
371
interface/filefn.h
Normal file
@@ -0,0 +1,371 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: filefn.h
|
||||||
|
// Purpose: documentation for wxPathList class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxPathList
|
||||||
|
@wxheader{filefn.h}
|
||||||
|
|
||||||
|
The path list is a convenient way of storing a number of directories, and
|
||||||
|
when presented with a filename without a directory, searching for an existing
|
||||||
|
file
|
||||||
|
in those directories.
|
||||||
|
|
||||||
|
Be sure to look also at wxStandardPaths if you only
|
||||||
|
want to search files in some standard paths.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{file}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxArrayString, wxStandardPaths, wxFileName
|
||||||
|
*/
|
||||||
|
class wxPathList : public wxArrayString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructs the object calling the Add() function.
|
||||||
|
*/
|
||||||
|
wxPathList();
|
||||||
|
wxPathList(const wxArrayString& arr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
The first form adds the given directory to the path list, if the path is not
|
||||||
|
already in the list.
|
||||||
|
If the path cannot be normalized for some reason, it returns @false.
|
||||||
|
|
||||||
|
The second form just calls the first form on all elements of the given array.
|
||||||
|
|
||||||
|
The @e path is always considered a directory but no existence checks will be
|
||||||
|
done on it
|
||||||
|
(because if it doesn't exist, it could be created later and thus result a valid
|
||||||
|
path when
|
||||||
|
FindValidPath() is called).
|
||||||
|
|
||||||
|
@b Note: if the given path is relative, it won't be made absolute before adding
|
||||||
|
it
|
||||||
|
(this is why FindValidPath() may return relative paths).
|
||||||
|
*/
|
||||||
|
bool Add(const wxString& path);
|
||||||
|
void Add(const wxArrayString& arr);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Finds the value of the given environment variable, and adds all paths
|
||||||
|
to the path list. Useful for finding files in the @c PATH variable, for
|
||||||
|
example.
|
||||||
|
*/
|
||||||
|
void AddEnvList(const wxString& env_variable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Given a full filename (with path), calls Add() with the path
|
||||||
|
of the file.
|
||||||
|
*/
|
||||||
|
bool EnsureFileAccessible(const wxString& filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Like FindValidPath() but this function always
|
||||||
|
returns an absolute path (eventually prepending the current working directory
|
||||||
|
to the value returned wxPathList::FindValidPath) or an
|
||||||
|
empty string.
|
||||||
|
*/
|
||||||
|
wxString FindAbsoluteValidPath(const wxString& file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Searches the given file in all paths stored in this class.
|
||||||
|
The first path which concatenated to the given string points to an existing
|
||||||
|
file (see @ref wxFile::exists wxFileExists) is returned.
|
||||||
|
|
||||||
|
If the file wasn't found in any of the stored paths, an empty string is
|
||||||
|
returned.
|
||||||
|
|
||||||
|
The given string must be a file name, eventually with a path prefix (if the path
|
||||||
|
prefix is absolute, only its name will be searched); i.e. it must not end with
|
||||||
|
a directory separator (see wxFileName::GetPathSeparator)
|
||||||
|
otherwise an assertion will fail.
|
||||||
|
|
||||||
|
The returned path may be relative to the current working directory.
|
||||||
|
Note in fact that wxPathList can be used to store both relative and absolute
|
||||||
|
paths so that
|
||||||
|
if you Added() relative paths, then the current working directory
|
||||||
|
(see wxGetCwd and wxSetWorkingDirectory)
|
||||||
|
may affect the value returned by this function!
|
||||||
|
*/
|
||||||
|
wxString FindValidPath(const wxString& file);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function returns the total number of bytes and number of free bytes on
|
||||||
|
the disk containing the directory @e path (it should exist). Both
|
||||||
|
@e total and @e free parameters may be @NULL if the corresponding
|
||||||
|
information is not needed.
|
||||||
|
*/
|
||||||
|
bool wxGetDiskSpace(const wxString& path,
|
||||||
|
wxLongLong total = @NULL,
|
||||||
|
wxLongLong free = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the Windows directory under Windows; on other platforms returns the
|
||||||
|
empty string.
|
||||||
|
*/
|
||||||
|
wxString wxGetOSDirectory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Parses the @e wildCard, returning the number of filters.
|
||||||
|
Returns 0 if none or if there's a problem.
|
||||||
|
The arrays will contain an equal number of items found before the error.
|
||||||
|
On platforms where native dialogs handle only one filter per entry,
|
||||||
|
entries in arrays are automatically adjusted.
|
||||||
|
@e wildCard is in the form:
|
||||||
|
|
||||||
|
@code
|
||||||
|
"All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
int wxParseCommonDialogsFilter(const wxString& wildCard,
|
||||||
|
wxArrayString& descriptions,
|
||||||
|
wxArrayString& filters);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function is deprecated, use wxFileName instead.
|
||||||
|
|
||||||
|
Converts a Unix to a DOS filename by replacing forward
|
||||||
|
slashes with backslashes.
|
||||||
|
*/
|
||||||
|
void wxUnix2DosFilename(wxChar * s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if @e dirname exists and is a directory.
|
||||||
|
*/
|
||||||
|
bool wxDirExists(const wxString& dirname);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@b NB: This function is obsolete, please use
|
||||||
|
wxFileName::SplitPath instead.
|
||||||
|
|
||||||
|
This function splits a full file name into components: the path (including
|
||||||
|
possible disk/drive
|
||||||
|
specification under Windows), the base name and the extension. Any of the
|
||||||
|
output parameters
|
||||||
|
(@e path, @e name or @e ext) may be @NULL if you are not interested in the value
|
||||||
|
of
|
||||||
|
a particular component.
|
||||||
|
|
||||||
|
wxSplitPath() will correctly handle filenames with both DOS and Unix path
|
||||||
|
separators under
|
||||||
|
Windows, however it will not consider backslashes as path separators under Unix
|
||||||
|
(where backslash
|
||||||
|
is a valid character in a filename).
|
||||||
|
|
||||||
|
On entry, @e fullname should be non-@NULL (it may be empty though).
|
||||||
|
|
||||||
|
On return, @e path contains the file path (without the trailing separator), @e
|
||||||
|
name
|
||||||
|
contains the file name and @e ext contains the file extension without leading
|
||||||
|
dot. All
|
||||||
|
three of them may be empty if the corresponding component is. The old contents
|
||||||
|
of the
|
||||||
|
strings pointed to by these parameters will be overwritten in any case (if the
|
||||||
|
pointers
|
||||||
|
are not @NULL).
|
||||||
|
*/
|
||||||
|
void wxSplitPath(const wxString& fullname, wxString * path,
|
||||||
|
wxString * name,
|
||||||
|
wxString * ext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Under Unix this macro changes the current process umask to the given value,
|
||||||
|
unless it is equal to -1 in which case nothing is done, and restores it to
|
||||||
|
the original value on scope exit. It works by declaring a variable which sets
|
||||||
|
umask to @e mask in its constructor and restores it in its destructor.
|
||||||
|
|
||||||
|
Under other platforms this macro expands to nothing.
|
||||||
|
*/
|
||||||
|
#define wxCHANGE_UMASK(int mask) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns time of last modification of given file.
|
||||||
|
|
||||||
|
The function returns @c (time_t)-1 if an error occurred (e.g. file not
|
||||||
|
found).
|
||||||
|
*/
|
||||||
|
time_t wxFileModificationTime(const wxString& filename);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
@b NB: This function is obsolete, please use
|
||||||
|
wxFileName::SplitPath instead.
|
||||||
|
|
||||||
|
Returns the filename for a full path. The second form returns a pointer to
|
||||||
|
temporary storage that should not be deallocated.
|
||||||
|
*/
|
||||||
|
wxString wxFileNameFromPath(const wxString& path);
|
||||||
|
char * wxFileNameFromPath(char * path);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Renames @e file1 to @e file2, returning @true if successful.
|
||||||
|
|
||||||
|
If @e overwrite parameter is @true (default), the destination file is
|
||||||
|
overwritten if it exists, but if @e overwrite is @false, the functions fails
|
||||||
|
in this case.
|
||||||
|
*/
|
||||||
|
bool wxRenameFile(const wxString& file1, const wxString& file2,
|
||||||
|
bool overwrite = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copies @e file1 to @e file2, returning @true if successful. If
|
||||||
|
@e overwrite parameter is @true (default), the destination file is overwritten
|
||||||
|
if it exists, but if @e overwrite is @false, the functions fails in this
|
||||||
|
case.
|
||||||
|
|
||||||
|
This function supports resources forks under Mac OS.
|
||||||
|
*/
|
||||||
|
bool wxCopyFile(const wxString& file1, const wxString& file2,
|
||||||
|
bool overwrite = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the file exists and is a plain file.
|
||||||
|
*/
|
||||||
|
bool wxFileExists(const wxString& filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the @e pattern matches the @e text; if @e dot_special is @true,
|
||||||
|
filenames beginning with a dot are not matched
|
||||||
|
with wildcard characters. See wxIsWild.
|
||||||
|
*/
|
||||||
|
bool wxMatchWild(const wxString& pattern, const wxString& text,
|
||||||
|
bool dot_special);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@b NB: This function is deprecated: use wxGetCwd instead.
|
||||||
|
|
||||||
|
Copies the current working directory into the buffer if supplied, or
|
||||||
|
copies the working directory into new storage (which you must delete
|
||||||
|
yourself) if the buffer is @NULL.
|
||||||
|
|
||||||
|
@e sz is the size of the buffer if supplied.
|
||||||
|
*/
|
||||||
|
wxString wxGetWorkingDirectory(char * buf=@NULL, int sz=1000);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the directory part of the filename.
|
||||||
|
*/
|
||||||
|
wxString wxPathOnly(const wxString& path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the pattern contains wildcards. See wxMatchWild.
|
||||||
|
*/
|
||||||
|
bool wxIsWild(const wxString& pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a string containing the current (or working) directory.
|
||||||
|
*/
|
||||||
|
wxString wxGetCwd();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts a DOS to a Unix filename by replacing backslashes with forward
|
||||||
|
slashes.
|
||||||
|
*/
|
||||||
|
void wxDos2UnixFilename(wxChar * s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Concatenates @e file1 and @e file2 to @e file3, returning
|
||||||
|
@true if successful.
|
||||||
|
*/
|
||||||
|
bool wxConcatFiles(const wxString& file1, const wxString& file2,
|
||||||
|
const wxString& file3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes @e file, returning @true if successful.
|
||||||
|
*/
|
||||||
|
bool wxRemoveFile(const wxString& file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current working directory, returning @true if the operation succeeded.
|
||||||
|
Under MS Windows, the current drive is also changed if @e dir contains a drive
|
||||||
|
specification.
|
||||||
|
*/
|
||||||
|
bool wxSetWorkingDirectory(const wxString& dir);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Makes the directory @e dir, returning @true if successful.
|
||||||
|
|
||||||
|
@e perm is the access mask for the directory for the systems on which it is
|
||||||
|
supported (Unix) and doesn't have any effect on the other ones.
|
||||||
|
*/
|
||||||
|
bool wxMkdir(const wxString& dir, int perm = 0777);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the argument is an absolute filename, i.e. with a slash
|
||||||
|
or drive name at the beginning.
|
||||||
|
*/
|
||||||
|
bool wxIsAbsolutePath(const wxString& filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the next file that matches the path passed to wxFindFirstFile.
|
||||||
|
|
||||||
|
See wxFindFirstFile for an example.
|
||||||
|
*/
|
||||||
|
wxString wxFindNextFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function does directory searching; returns the first file
|
||||||
|
that matches the path @e spec, or the empty string. Use wxFindNextFile to
|
||||||
|
get the next matching file. Neither will report the current directory "." or the
|
||||||
|
parent directory "..".
|
||||||
|
*/
|
||||||
|
wxString wxFindFirstFile(const wxString& spec, int flags = 0);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns the type of an open file. Possible return values are:
|
||||||
|
@code
|
||||||
|
enum wxFileKind
|
||||||
|
{
|
||||||
|
wxFILE_KIND_UNKNOWN,
|
||||||
|
wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets
|
||||||
|
wxFILE_KIND_TERMINAL, // a tty
|
||||||
|
wxFILE_KIND_PIPE // a pipe
|
||||||
|
};
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
wxFileKind wxGetFileKind(int fd);
|
||||||
|
wxFileKind wxGetFileKind(FILE * fp);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
@b NB: These functions are obsolete, please use
|
||||||
|
wxFileName::CreateTempFileName
|
||||||
|
instead.
|
||||||
|
*/
|
||||||
|
char * wxGetTempFileName(const wxString& prefix, char * buf=@NULL);
|
||||||
|
bool wxGetTempFileName(const wxString& prefix, wxString& buf);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the directory @e dir, returning @true if successful. Does not work under
|
||||||
|
VMS.
|
||||||
|
|
||||||
|
The @e flags parameter is reserved for future use.
|
||||||
|
|
||||||
|
Please notice that there is also a wxRmDir() function which simply wraps the
|
||||||
|
standard POSIX rmdir() function and so return an integer error code instead of
|
||||||
|
a boolean value (but otherwise is currently identical to wxRmdir), don't
|
||||||
|
confuse these two functions.
|
||||||
|
*/
|
||||||
|
bool wxRmdir(const wxString& dir, int flags=0);
|
||||||
|
|
||||||
987
interface/filename.h
Normal file
987
interface/filename.h
Normal file
@@ -0,0 +1,987 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: filename.h
|
||||||
|
// Purpose: documentation for wxFileName class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileName
|
||||||
|
@wxheader{filename.h}
|
||||||
|
|
||||||
|
wxFileName encapsulates a file name. This class serves two purposes: first, it
|
||||||
|
provides the functions to split the file names into components and to recombine
|
||||||
|
these components in the full file name which can then be passed to the OS file
|
||||||
|
functions (and @ref overview_filefunctions "wxWidgets functions" wrapping them).
|
||||||
|
Second, it includes the functions for working with the files itself. Note that
|
||||||
|
to change the file data you should use wxFile class instead.
|
||||||
|
wxFileName provides functions for working with the file attributes.
|
||||||
|
|
||||||
|
When working with directory names (i.e. without filename and extension)
|
||||||
|
make sure not to misuse the file name part of this class with the last
|
||||||
|
directory. Instead initialize the wxFileName instance like this:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxFileName dirname( "C:\mydir", "" );
|
||||||
|
MyMethod( dirname.GetPath() );
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The same can be done using the static method wxFileName::DirName:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxFileName dirname = wxFileName::DirName( "C:\mydir" );
|
||||||
|
MyMethod( dirname.GetPath() );
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Accordingly, methods dealing with directories or directory names
|
||||||
|
like wxFileName::IsDirReadable use
|
||||||
|
wxFileName::GetPath whereas methods dealing
|
||||||
|
with file names like wxFileName::IsFileReadable
|
||||||
|
use wxFileName::GetFullPath.
|
||||||
|
|
||||||
|
If it is not known wether a string contains a directory name or
|
||||||
|
a complete file name (such as when interpreting user input) you need to use
|
||||||
|
the static function wxFileName::DirExists
|
||||||
|
(or its identical variants wxDir::Exists and
|
||||||
|
wxDirExists) and construct the wxFileName
|
||||||
|
instance accordingly. This will only work if the directory actually exists,
|
||||||
|
of course:
|
||||||
|
|
||||||
|
@code
|
||||||
|
wxString user_input;
|
||||||
|
// get input from user
|
||||||
|
|
||||||
|
wxFileName fname;
|
||||||
|
if (wxDirExists(user_input))
|
||||||
|
fname.AssignDir( user_input );
|
||||||
|
else
|
||||||
|
fname.Assign( user_input );
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{file}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFileName::GetCwd
|
||||||
|
*/
|
||||||
|
class wxFileName
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor from a volume name, a directory name, base file name and extension.
|
||||||
|
*/
|
||||||
|
wxFileName();
|
||||||
|
wxFileName(const wxFileName& filename);
|
||||||
|
wxFileName(const wxString& fullpath,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
wxFileName(const wxString& path, const wxString& name,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
wxFileName(const wxString& path, const wxString& name,
|
||||||
|
const wxString& ext,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
wxFileName(const wxString& volume, const wxString& path,
|
||||||
|
const wxString& name,
|
||||||
|
const wxString& ext,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Appends a directory component to the path. This component should contain a
|
||||||
|
single directory name level, i.e. not contain any path or volume separators nor
|
||||||
|
should it be empty, otherwise the function does nothing (and generates an
|
||||||
|
assert failure in debug build).
|
||||||
|
*/
|
||||||
|
void AppendDir(const wxString& dir);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Creates the file name from various combinations of data.
|
||||||
|
*/
|
||||||
|
void Assign(const wxFileName& filepath);
|
||||||
|
void Assign(const wxString& fullpath,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
void Assign(const wxString& volume, const wxString& path,
|
||||||
|
const wxString& name,
|
||||||
|
const wxString& ext,
|
||||||
|
bool hasExt,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
void Assign(const wxString& volume, const wxString& path,
|
||||||
|
const wxString& name,
|
||||||
|
const wxString& ext,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
void Assign(const wxString& path, const wxString& name,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
void Assign(const wxString& path, const wxString& name,
|
||||||
|
const wxString& ext,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Makes this object refer to the current working directory on the specified
|
||||||
|
volume (or current volume if @e volume is empty).
|
||||||
|
|
||||||
|
@sa GetCwd()
|
||||||
|
*/
|
||||||
|
static void AssignCwd(const wxString& volume = wxEmptyString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets this file name object to the given directory name. The name and extension
|
||||||
|
will be empty.
|
||||||
|
*/
|
||||||
|
void AssignDir(const wxString& dir,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets this file name object to the home directory.
|
||||||
|
*/
|
||||||
|
void AssignHomeDir();
|
||||||
|
|
||||||
|
/**
|
||||||
|
The function calls CreateTempFileName() to
|
||||||
|
create a temporary file and sets this object to the name of the file. If a
|
||||||
|
temporary file couldn't be created, the object is put into the
|
||||||
|
@ref isok() invalid state.
|
||||||
|
*/
|
||||||
|
void AssignTempFileName(const wxString& prefix,
|
||||||
|
wxFile * fileTemp = @NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reset all components to default, uninitialized state.
|
||||||
|
*/
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the extension from the file name resulting in a
|
||||||
|
file name with no trailing dot.
|
||||||
|
|
||||||
|
@sa SetExt(), SetEmptyExt()
|
||||||
|
*/
|
||||||
|
void SetClearExt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a temporary file name starting with the given @e prefix. If
|
||||||
|
the @e prefix is an absolute path, the temporary file is created in this
|
||||||
|
directory, otherwise it is created in the default system directory for the
|
||||||
|
temporary files or in the current directory.
|
||||||
|
|
||||||
|
If the function succeeds, the temporary file is actually created. If
|
||||||
|
@e fileTemp is not @NULL, this file will be opened using the name of
|
||||||
|
the temporary file. When possible, this is done in an atomic way ensuring that
|
||||||
|
no race condition occurs between the temporary file name generation and opening
|
||||||
|
it which could often lead to security compromise on the multiuser systems.
|
||||||
|
If @e fileTemp is @NULL, the file is only created, but not opened.
|
||||||
|
|
||||||
|
Under Unix, the temporary file will have read and write permissions for the
|
||||||
|
owner only to minimize the security problems.
|
||||||
|
|
||||||
|
@param prefix
|
||||||
|
Prefix to use for the temporary file name construction
|
||||||
|
|
||||||
|
@param fileTemp
|
||||||
|
The file to open or @NULL to just get the name
|
||||||
|
|
||||||
|
@returns The full temporary file name or an empty string on error.
|
||||||
|
*/
|
||||||
|
static wxString CreateTempFileName(const wxString& prefix,
|
||||||
|
wxFile * fileTemp = @NULL);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if the directory with this name exists.
|
||||||
|
*/
|
||||||
|
bool DirExists();
|
||||||
|
static bool DirExists(const wxString& dir);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the object corresponding to the directory with the given name.
|
||||||
|
The @e dir parameter may have trailing path separator or not.
|
||||||
|
*/
|
||||||
|
static wxFileName DirName(const wxString& dir,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
These functions allow to examine and modify the individual directories of the
|
||||||
|
path:
|
||||||
|
|
||||||
|
AppendDir()
|
||||||
|
|
||||||
|
InsertDir()
|
||||||
|
|
||||||
|
GetDirCount()
|
||||||
|
PrependDir()
|
||||||
|
|
||||||
|
RemoveDir()
|
||||||
|
|
||||||
|
RemoveLastDir()
|
||||||
|
|
||||||
|
To change the components of the file name individually you can use the
|
||||||
|
following functions:
|
||||||
|
|
||||||
|
GetExt()
|
||||||
|
|
||||||
|
GetName()
|
||||||
|
|
||||||
|
GetVolume()
|
||||||
|
|
||||||
|
HasExt()
|
||||||
|
|
||||||
|
HasName()
|
||||||
|
|
||||||
|
HasVolume()
|
||||||
|
|
||||||
|
SetExt()
|
||||||
|
|
||||||
|
ClearExt()
|
||||||
|
|
||||||
|
SetEmptyExt()
|
||||||
|
|
||||||
|
SetName()
|
||||||
|
|
||||||
|
SetVolume()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
You can initialize a wxFileName instance using one of the following functions:
|
||||||
|
|
||||||
|
@ref wxfilename() "wxFileName constructors"
|
||||||
|
|
||||||
|
Assign()
|
||||||
|
|
||||||
|
AssignCwd()
|
||||||
|
|
||||||
|
AssignDir()
|
||||||
|
|
||||||
|
AssignHomeDir()
|
||||||
|
|
||||||
|
@ref assigntempfilename() AssignHomeTempFileName
|
||||||
|
|
||||||
|
DirName()
|
||||||
|
|
||||||
|
FileName()
|
||||||
|
|
||||||
|
@ref operatorassign() "operator ="
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
wxFileName currently supports the file names in the Unix, DOS/Windows, Mac OS
|
||||||
|
and VMS formats. Although these formats are quite different, wxFileName tries
|
||||||
|
to treat them all in the same generic way. It supposes that all file names
|
||||||
|
consist of the following parts: the volume (also known as drive under Windows
|
||||||
|
or device under VMS), the path which is a sequence of directory names separated
|
||||||
|
by the @ref getpathseparators() "path separators" and the full
|
||||||
|
filename itself which, in turn, is composed from the base file name and the
|
||||||
|
extension. All of the individual components of the file name may be empty and,
|
||||||
|
for example, the volume name is always empty under Unix, but if they are all
|
||||||
|
empty simultaneously, the filename object is considered to be in an invalid
|
||||||
|
state and IsOk() returns @false for it.
|
||||||
|
|
||||||
|
File names can be case-sensitive or not, the function
|
||||||
|
IsCaseSensitive() allows to determine this.
|
||||||
|
|
||||||
|
The rules for determining whether the file name is absolute or relative also
|
||||||
|
depend on the file name format and the only portable way to answer this
|
||||||
|
question is to use IsAbsolute() or
|
||||||
|
IsRelative() method. Note that on Windows, "X:"
|
||||||
|
refers to the current working directory on drive X. Therefore, a wxFileName
|
||||||
|
instance constructed from for example "X:dir/file.ext" treats the portion
|
||||||
|
beyond drive separator as being relative to that directory.
|
||||||
|
|
||||||
|
To ensure that the filename is absolute, you may use
|
||||||
|
MakeAbsolute(). There is also an inverse
|
||||||
|
function MakeRelativeTo() which undoes
|
||||||
|
what @ref normalize() Normalize(wxPATH_NORM_DOTS) does.
|
||||||
|
|
||||||
|
Other functions returning information about the file format provided by this
|
||||||
|
class are GetVolumeSeparator(),
|
||||||
|
IsPathSeparator().
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Before doing other tests, you should use IsOk() to
|
||||||
|
verify that the filename is well defined. If it is,
|
||||||
|
FileExists() can be used to test whether a file
|
||||||
|
with such name exists and DirExists() can be used
|
||||||
|
to test for directory existence.
|
||||||
|
|
||||||
|
File names should be compared using SameAs() method
|
||||||
|
or @ref operatorequal() "operator ==".
|
||||||
|
|
||||||
|
For testing basic access modes, you can use:
|
||||||
|
|
||||||
|
IsDirWritable()
|
||||||
|
|
||||||
|
IsDirReadable()
|
||||||
|
|
||||||
|
IsFileWritable()
|
||||||
|
|
||||||
|
IsFileReadable()
|
||||||
|
|
||||||
|
IsFileExecutable()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if the file with this name exists.
|
||||||
|
|
||||||
|
@sa DirExists()
|
||||||
|
*/
|
||||||
|
bool FileExists();
|
||||||
|
static bool FileExists(const wxString& file);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the file name object corresponding to the given @e file. This
|
||||||
|
function exists mainly for symmetry with DirName().
|
||||||
|
*/
|
||||||
|
static wxFileName FileName(const wxString& file,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves the value of the current working directory on the specified volume. If
|
||||||
|
the volume is empty, the program's current working directory is returned for the
|
||||||
|
current volume.
|
||||||
|
|
||||||
|
@returns The string containing the current working directory or an empty
|
||||||
|
string on error.
|
||||||
|
|
||||||
|
@sa AssignCwd()
|
||||||
|
*/
|
||||||
|
static wxString GetCwd(const wxString& volume = "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of directories in the file name.
|
||||||
|
*/
|
||||||
|
size_t GetDirCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the directories in string array form.
|
||||||
|
*/
|
||||||
|
const wxArrayString GetDirs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the file name extension.
|
||||||
|
*/
|
||||||
|
wxString GetExt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the characters that can't be used in filenames and directory names for
|
||||||
|
the specified format.
|
||||||
|
*/
|
||||||
|
static wxString GetForbiddenChars(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the canonical path format for this platform.
|
||||||
|
*/
|
||||||
|
static wxPathFormat GetFormat(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the full name (including extension but excluding directories).
|
||||||
|
*/
|
||||||
|
wxString GetFullName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the full path with name and extension.
|
||||||
|
*/
|
||||||
|
wxString GetFullPath(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the home directory.
|
||||||
|
*/
|
||||||
|
static wxString GetHomeDir();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns the size of this file (first form) or the given number of bytes (second
|
||||||
|
form)
|
||||||
|
in a human-readable form.
|
||||||
|
|
||||||
|
If the size could not be retrieved the @c failmsg string is returned (first
|
||||||
|
form).
|
||||||
|
If @c bytes is @c wxInvalidSize or zero, then @c nullsize is returned (second
|
||||||
|
form).
|
||||||
|
|
||||||
|
In case of success, the returned string is a floating-point number with @c
|
||||||
|
precision decimal digits
|
||||||
|
followed by the size unit (B, kB, MB, GB, TB: respectively bytes, kilobytes,
|
||||||
|
megabytes, gigabytes, terabytes).
|
||||||
|
*/
|
||||||
|
wxString GetHumanReadableSize(const wxString& failmsg = "Not available",
|
||||||
|
int precision = 1);
|
||||||
|
static wxString GetHumanReadableSize(const wxULongLong& bytes,
|
||||||
|
const wxString& nullsize = "Not available",
|
||||||
|
int precision = 1);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the long form of the path (returns identity on non-Windows platforms)
|
||||||
|
*/
|
||||||
|
wxString GetLongPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the last time the file was last modified.
|
||||||
|
*/
|
||||||
|
wxDateTime GetModificationTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the name part of the filename (without extension).
|
||||||
|
|
||||||
|
@sa GetFullName()
|
||||||
|
*/
|
||||||
|
wxString GetName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the path part of the filename (without the name or extension). The
|
||||||
|
possible flags values are:
|
||||||
|
|
||||||
|
|
||||||
|
@b wxPATH_GET_VOLUME
|
||||||
|
|
||||||
|
|
||||||
|
Return the path with the volume (does
|
||||||
|
nothing for the filename formats without volumes), otherwise the path without
|
||||||
|
volume part is returned.
|
||||||
|
|
||||||
|
@b wxPATH_GET_SEPARATOR
|
||||||
|
|
||||||
|
|
||||||
|
Return the path with the trailing
|
||||||
|
separator, if this flag is not given there will be no separator at the end of
|
||||||
|
the path.
|
||||||
|
*/
|
||||||
|
wxString GetPath(int flags = wxPATH_GET_VOLUME,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the usually used path separator for this format. For all formats but
|
||||||
|
@c wxPATH_DOS there is only one path separator anyhow, but for DOS there
|
||||||
|
are two of them and the native one, i.e. the backslash is returned by this
|
||||||
|
method.
|
||||||
|
|
||||||
|
@sa GetPathSeparators()
|
||||||
|
*/
|
||||||
|
static wxChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string containing all the path separators for this format. For all
|
||||||
|
formats but @c wxPATH_DOS this string contains only one character but for
|
||||||
|
DOS and Windows both @c '/' and @c '\' may be used as
|
||||||
|
separators.
|
||||||
|
|
||||||
|
@sa GetPathSeparator()
|
||||||
|
*/
|
||||||
|
static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string of characters which may terminate the path part. This is the
|
||||||
|
same as GetPathSeparators() except for VMS
|
||||||
|
path format where ] is used at the end of the path part.
|
||||||
|
*/
|
||||||
|
static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the path with the trailing separator, useful for appending the name to
|
||||||
|
the given path.
|
||||||
|
|
||||||
|
This is the same as calling GetPath()
|
||||||
|
@c (wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format).
|
||||||
|
*/
|
||||||
|
wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the short form of the path (returns identity on non-Windows platforms).
|
||||||
|
*/
|
||||||
|
wxString GetShortPath();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns the size of this file (first form) or the size of the given file
|
||||||
|
(second form).
|
||||||
|
If the file does not exist or its size could not be read (because e.g. the file
|
||||||
|
is locked
|
||||||
|
by another process) the returned value is @c wxInvalidSize.
|
||||||
|
*/
|
||||||
|
wxULongLong GetSize();
|
||||||
|
static wxULongLong GetSize(const wxString& filename);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the directory used for temporary files.
|
||||||
|
*/
|
||||||
|
static wxString GetTempDir();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the last access, last modification and creation times. The last access
|
||||||
|
time is updated whenever the file is read or written (or executed in the case
|
||||||
|
of Windows), last modification time is only changed when the file is written
|
||||||
|
to. Finally, the creation time is indeed the time when the file was created
|
||||||
|
under Windows and the inode change time under Unix (as it is impossible to
|
||||||
|
retrieve the real file creation time there anyhow) which can also be changed
|
||||||
|
by many operations after the file creation.
|
||||||
|
|
||||||
|
If no filename or extension is specified in this instance of wxFileName
|
||||||
|
(and therefore IsDir() returns @true) then
|
||||||
|
this function will return the directory times of the path specified by
|
||||||
|
GetPath(), otherwise the file times of the
|
||||||
|
file specified by GetFullPath().
|
||||||
|
|
||||||
|
Any of the pointers may be @NULL if the corresponding time is not
|
||||||
|
needed.
|
||||||
|
|
||||||
|
@returns @true on success, @false if we failed to retrieve the times.
|
||||||
|
*/
|
||||||
|
bool GetTimes(wxDateTime* dtAccess, wxDateTime* dtMod,
|
||||||
|
wxDateTime* dtCreate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string containing the volume for this file name, empty if it
|
||||||
|
doesn't have one or if the file system doesn't support volumes at all (for
|
||||||
|
example, Unix).
|
||||||
|
*/
|
||||||
|
wxString GetVolume();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the string separating the volume from the path for this format.
|
||||||
|
*/
|
||||||
|
static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if an extension is present.
|
||||||
|
*/
|
||||||
|
bool HasExt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if a name is present.
|
||||||
|
*/
|
||||||
|
bool HasName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if a volume specifier is present.
|
||||||
|
*/
|
||||||
|
bool HasVolume();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Inserts a directory component before the zero-based position in the directory
|
||||||
|
list. Please see AppendDir() for important notes.
|
||||||
|
*/
|
||||||
|
void InsertDir(size_t before, const wxString& dir);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this filename is absolute.
|
||||||
|
*/
|
||||||
|
bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the file names of this type are case-sensitive.
|
||||||
|
*/
|
||||||
|
static bool IsCaseSensitive(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this object represents a directory, @false otherwise
|
||||||
|
(i.e. if it is a file). Note that this method doesn't test whether the
|
||||||
|
directory or file really exists, you should use
|
||||||
|
DirExists() or
|
||||||
|
FileExists() for this.
|
||||||
|
*/
|
||||||
|
bool IsDir();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if the directory component of this instance (or given @e dir)
|
||||||
|
is an existing directory and this process has read permissions on it.
|
||||||
|
Read permissions on a directory mean that you can list the directory contents
|
||||||
|
but it
|
||||||
|
doesn't imply that you have read permissions on the files contained.
|
||||||
|
*/
|
||||||
|
bool IsDirReadable();
|
||||||
|
static bool IsDirReadable(const wxString& dir);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if the directory component of this instance (or given @e dir)
|
||||||
|
is an existing directory and this process has write permissions on it.
|
||||||
|
Write permissions on a directory mean that you can create new files in the
|
||||||
|
directory.
|
||||||
|
*/
|
||||||
|
bool IsDirWritable();
|
||||||
|
static bool IsDirWritable(const wxString& dir);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if a file with this name exists and if this process has execute
|
||||||
|
permissions on it.
|
||||||
|
*/
|
||||||
|
bool IsFileExecutable();
|
||||||
|
static bool IsFileExecutable(const wxString& file);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if a file with this name exists and if this process has read
|
||||||
|
permissions on it.
|
||||||
|
*/
|
||||||
|
bool IsFileReadable();
|
||||||
|
static bool IsFileReadable(const wxString& file);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if a file with this name exists and if this process has write
|
||||||
|
permissions on it.
|
||||||
|
*/
|
||||||
|
bool IsFileWritable();
|
||||||
|
static bool IsFileWritable(const wxString& file);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the filename is valid, @false if it is not
|
||||||
|
initialized yet. The assignment functions and
|
||||||
|
Clear() may reset the object to the uninitialized,
|
||||||
|
invalid state (the former only do it on failure).
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the char is a path separator for this format.
|
||||||
|
*/
|
||||||
|
static bool IsPathSeparator(wxChar ch,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this filename is not absolute.
|
||||||
|
*/
|
||||||
|
bool IsRelative(wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
On Mac OS, gets the common type and creator for the given extension.
|
||||||
|
*/
|
||||||
|
static bool MacFindDefaultTypeAndCreator(const wxString& ext,
|
||||||
|
wxUint32* type,
|
||||||
|
wxUint32* creator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
On Mac OS, registers application defined extensions and their default type and
|
||||||
|
creator.
|
||||||
|
*/
|
||||||
|
static void MacRegisterDefaultTypeAndCreator(const wxString& ext,
|
||||||
|
wxUint32 type,
|
||||||
|
wxUint32 creator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
On Mac OS, looks up the appropriate type and creator from the registration and
|
||||||
|
then sets it.
|
||||||
|
*/
|
||||||
|
bool MacSetDefaultTypeAndCreator();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Make the file name absolute. This is a shortcut for
|
||||||
|
@c wxFileName::Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE |
|
||||||
|
wxPATH_NORM_TILDE, cwd, format).
|
||||||
|
|
||||||
|
@sa MakeRelativeTo(), Normalize(), IsAbsolute()
|
||||||
|
*/
|
||||||
|
bool MakeAbsolute(const wxString& cwd = wxEmptyString,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function tries to put this file name in a form relative to
|
||||||
|
|
||||||
|
@param pathBase.
|
||||||
|
In other words, it returns the file name which should be used to access this
|
||||||
|
file if the current directory were pathBase.
|
||||||
|
|
||||||
|
pathBase
|
||||||
|
the directory to use as root, current directory is used by
|
||||||
|
default
|
||||||
|
|
||||||
|
@param format
|
||||||
|
the file name format, native by default
|
||||||
|
|
||||||
|
@returns @true if the file name has been changed, @false if we failed to do
|
||||||
|
anything with it (currently this only happens if the
|
||||||
|
file name is on a volume different from the volume
|
||||||
|
specified by pathBase).
|
||||||
|
|
||||||
|
@sa Normalize()
|
||||||
|
*/
|
||||||
|
bool MakeRelativeTo(const wxString& pathBase = wxEmptyString,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
@param dir
|
||||||
|
the directory to create
|
||||||
|
|
||||||
|
@param parm
|
||||||
|
the permissions for the newly created directory
|
||||||
|
|
||||||
|
@param flags
|
||||||
|
if the flags contain wxPATH_MKDIR_FULL flag,
|
||||||
|
try to create each directory in the path and also don't return an error
|
||||||
|
if the target directory already exists.
|
||||||
|
|
||||||
|
@returns Returns @true if the directory was successfully created, @false
|
||||||
|
otherwise.
|
||||||
|
*/
|
||||||
|
bool Mkdir(int perm = 0777, int flags = 0);
|
||||||
|
static bool Mkdir(const wxString& dir, int perm = 0777,
|
||||||
|
int flags = 0);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Normalize the path. With the default flags value, the path will be
|
||||||
|
made absolute, without any ".." and "." and all environment
|
||||||
|
variables will be expanded in it.
|
||||||
|
|
||||||
|
@param flags
|
||||||
|
The kind of normalization to do with the file name. It can be
|
||||||
|
any or-combination of the following constants:
|
||||||
|
|
||||||
|
wxPATH_NORM_ENV_VARS
|
||||||
|
|
||||||
|
|
||||||
|
replace env vars with their values
|
||||||
|
|
||||||
|
wxPATH_NORM_DOTS
|
||||||
|
|
||||||
|
|
||||||
|
squeeze all .. and . when possible; if there are too many .. and thus they
|
||||||
|
cannot be all removed, @false will be returned
|
||||||
|
|
||||||
|
wxPATH_NORM_CASE
|
||||||
|
|
||||||
|
|
||||||
|
if filesystem is case insensitive, transform to lower case
|
||||||
|
|
||||||
|
wxPATH_NORM_ABSOLUTE
|
||||||
|
|
||||||
|
|
||||||
|
make the path absolute prepending cwd
|
||||||
|
|
||||||
|
wxPATH_NORM_LONG
|
||||||
|
|
||||||
|
|
||||||
|
make the path the long form
|
||||||
|
|
||||||
|
wxPATH_NORM_SHORTCUT
|
||||||
|
|
||||||
|
|
||||||
|
resolve if it is a shortcut (Windows only)
|
||||||
|
|
||||||
|
wxPATH_NORM_TILDE
|
||||||
|
|
||||||
|
|
||||||
|
replace ~ and ~user (Unix only)
|
||||||
|
|
||||||
|
wxPATH_NORM_ALL
|
||||||
|
|
||||||
|
|
||||||
|
all of previous flags except wxPATH_NORM_CASE
|
||||||
|
|
||||||
|
@param cwd
|
||||||
|
If not empty, this directory will be used instead of current
|
||||||
|
working directory in normalization (see wxPATH_NORM_ABSOLUTE).
|
||||||
|
|
||||||
|
@param format
|
||||||
|
The file name format to use when processing the paths, native by default.
|
||||||
|
|
||||||
|
@returns @true if normalization was successfully or @false otherwise.
|
||||||
|
*/
|
||||||
|
bool Normalize(int flags = wxPATH_NORM_ALL,
|
||||||
|
const wxString& cwd = wxEmptyString,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
These methods allow to work with the file creation, access and modification
|
||||||
|
times. Note that not all filesystems under all platforms implement these times
|
||||||
|
in the same way. For example, the access time under Windows has a resolution of
|
||||||
|
one day (so it is really the access date and not time). The access time may be
|
||||||
|
updated when the file is executed or not depending on the platform.
|
||||||
|
|
||||||
|
GetModificationTime()
|
||||||
|
|
||||||
|
GetTimes()
|
||||||
|
|
||||||
|
SetTimes()
|
||||||
|
|
||||||
|
Touch()
|
||||||
|
|
||||||
|
Other file system operations functions are:
|
||||||
|
|
||||||
|
Mkdir()
|
||||||
|
|
||||||
|
Rmdir()
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prepends a directory to the file path. Please see
|
||||||
|
AppendDir() for important notes.
|
||||||
|
*/
|
||||||
|
void PrependDir(const wxString& dir);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes the specified directory component from the path.
|
||||||
|
|
||||||
|
@sa GetDirCount()
|
||||||
|
*/
|
||||||
|
void RemoveDir(size_t pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes last directory component from the path.
|
||||||
|
*/
|
||||||
|
void RemoveLastDir();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Deletes the specified directory from the file system.
|
||||||
|
*/
|
||||||
|
bool Rmdir();
|
||||||
|
static bool Rmdir(const wxString& dir);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Compares the filename using the rules of this platform.
|
||||||
|
*/
|
||||||
|
bool SameAs(const wxFileName& filepath,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Changes the current working directory.
|
||||||
|
*/
|
||||||
|
bool SetCwd();
|
||||||
|
static bool SetCwd(const wxString& cwd);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the extension of the file name to be an empty extension.
|
||||||
|
This is different from having no extension at all as the file
|
||||||
|
name will have a trailing dot after a call to this method.
|
||||||
|
|
||||||
|
@sa SetExt(), ClearExt()
|
||||||
|
*/
|
||||||
|
void SetEmptyExt();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the extension of the file name. Setting an empty string
|
||||||
|
as the extension will remove the extension resulting in a file
|
||||||
|
name without a trailing dot, unlike a call to
|
||||||
|
SetEmptyExt().
|
||||||
|
|
||||||
|
@sa SetEmptyExt(), ClearExt()
|
||||||
|
*/
|
||||||
|
void SetExt(const wxString& ext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The full name is the file name and extension (but without the path).
|
||||||
|
*/
|
||||||
|
void SetFullName(const wxString& fullname);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the name part (without extension).
|
||||||
|
|
||||||
|
@sa SetFullName()
|
||||||
|
*/
|
||||||
|
void SetName(const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the file creation and last access/modification times (any of the pointers
|
||||||
|
may be @NULL).
|
||||||
|
*/
|
||||||
|
bool SetTimes(const wxDateTime* dtAccess,
|
||||||
|
const wxDateTime* dtMod,
|
||||||
|
const wxDateTime* dtCreate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the volume specifier.
|
||||||
|
*/
|
||||||
|
void SetVolume(const wxString& volume);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
This function splits a full file name into components: the volume (with the
|
||||||
|
first version) path (including the volume in the second version), the base name
|
||||||
|
and the extension. Any of the output parameters (@e volume, @e path,
|
||||||
|
@e name or @e ext) may be @NULL if you are not interested in the
|
||||||
|
value of a particular component. Also, @e fullpath may be empty on entry.
|
||||||
|
|
||||||
|
On return, @e path contains the file path (without the trailing separator),
|
||||||
|
@e name contains the file name and @e ext contains the file extension
|
||||||
|
without leading dot. All three of them may be empty if the corresponding
|
||||||
|
component is. The old contents of the strings pointed to by these parameters
|
||||||
|
will be overwritten in any case (if the pointers are not @NULL).
|
||||||
|
|
||||||
|
Note that for a filename "foo.'' the extension is present, as indicated by the
|
||||||
|
trailing dot, but empty. If you need to cope with such cases, you should use
|
||||||
|
@e hasExt instead of relying on testing whether @e ext is empty or not.
|
||||||
|
*/
|
||||||
|
static void SplitPath(const wxString& fullpath, wxString* volume,
|
||||||
|
wxString* path,
|
||||||
|
wxString* name,
|
||||||
|
wxString* ext,
|
||||||
|
bool hasExt = @NULL,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
static void SplitPath(const wxString& fullpath,
|
||||||
|
wxString* volume,
|
||||||
|
wxString* path,
|
||||||
|
wxString* name,
|
||||||
|
wxString* ext,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
static void SplitPath(const wxString& fullpath,
|
||||||
|
wxString* path,
|
||||||
|
wxString* name,
|
||||||
|
wxString* ext,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Splits the given @e fullpath into the volume part (which may be empty) and
|
||||||
|
the pure path part, not containing any volume.
|
||||||
|
|
||||||
|
@sa SplitPath()
|
||||||
|
*/
|
||||||
|
static void SplitVolume(const wxString& fullpath,
|
||||||
|
wxString* volume,
|
||||||
|
wxString* path,
|
||||||
|
wxPathFormat format = wxPATH_NATIVE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the access and modification times to the current moment.
|
||||||
|
*/
|
||||||
|
bool Touch();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if the filenames are different. The string @e filenames
|
||||||
|
is interpreted as a path in the native filename format.
|
||||||
|
*/
|
||||||
|
bool operator operator!=(const wxFileName& filename);
|
||||||
|
bool operator operator!=(const wxString& filename);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Assigns the new value to this filename object.
|
||||||
|
*/
|
||||||
|
wxFileName& operator operator=(const wxFileName& filename);
|
||||||
|
wxFileName& operator operator=(const wxString& filename);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns @true if the filenames are equal. The string @e filenames is
|
||||||
|
interpreted as a path in the native filename format.
|
||||||
|
*/
|
||||||
|
bool operator operator==(const wxFileName& filename);
|
||||||
|
bool operator operator==(const wxString& filename);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
294
interface/filepicker.h
Normal file
294
interface/filepicker.h
Normal file
@@ -0,0 +1,294 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: filepicker.h
|
||||||
|
// Purpose: documentation for wxFilePickerCtrl class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFilePickerCtrl
|
||||||
|
@wxheader{filepicker.h}
|
||||||
|
|
||||||
|
This control allows the user to select a file. The generic implementation is
|
||||||
|
a button which brings up a wxFileDialog when clicked. Native implementation
|
||||||
|
may differ but this is usually a (small) widget which give access to the
|
||||||
|
file-chooser
|
||||||
|
dialog.
|
||||||
|
It is only available if @c wxUSE_FILEPICKERCTRL is set to 1 (the default).
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxFLP_DEFAULT_STYLE}:
|
||||||
|
The default style: includes wxFLP_OPEN | wxFLP_FILE_MUST_EXIST and,
|
||||||
|
under wxMSW only, wxFLP_USE_TEXTCTRL.
|
||||||
|
@style{wxFLP_USE_TEXTCTRL}:
|
||||||
|
Creates a text control to the left of the picker button which is
|
||||||
|
completely managed by the wxFilePickerCtrl and which can be used by
|
||||||
|
the user to specify a path (see SetPath). The text control is
|
||||||
|
automatically synchronized with button's value. Use functions
|
||||||
|
defined in wxPickerBase to modify the text control.
|
||||||
|
@style{wxFLP_OPEN}:
|
||||||
|
Creates a picker which allows the user to select a file to open.
|
||||||
|
@style{wxFLP_SAVE}:
|
||||||
|
Creates a picker which allows the user to select a file to save.
|
||||||
|
@style{wxFLP_OVERWRITE_PROMPT}:
|
||||||
|
Can be combined with wxFLP_SAVE only: ask confirmation to the user
|
||||||
|
before selecting a file.
|
||||||
|
@style{wxFLP_FILE_MUST_EXIST}:
|
||||||
|
Can be combined with wxFLP_OPEN only: the selected file must be an
|
||||||
|
existing file.
|
||||||
|
@style{wxFLP_CHANGE_DIR}:
|
||||||
|
Change current working directory on each user file selection change.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{miscpickers}
|
||||||
|
@appearance{filepickerctrl.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFileDialog, wxFileDirPickerEvent
|
||||||
|
*/
|
||||||
|
class wxFilePickerCtrl : public wxPickerBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Initializes the object and calls Create() with
|
||||||
|
all the parameters.
|
||||||
|
*/
|
||||||
|
wxFilePickerCtrl(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxString& path = wxEmptyString,
|
||||||
|
const wxString& message = "Select a file",
|
||||||
|
const wxString& wildcard = ".",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxFLP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "filepickerctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param parent
|
||||||
|
Parent window, must not be non-@NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The identifier for the control.
|
||||||
|
|
||||||
|
@param path
|
||||||
|
The initial file shown in the control. Must be a valid path to a file or the
|
||||||
|
empty string.
|
||||||
|
|
||||||
|
@param message
|
||||||
|
The message shown to the user in the wxFileDialog shown by the control.
|
||||||
|
|
||||||
|
@param wildcard
|
||||||
|
A wildcard which defines user-selectable files (use the same syntax as for
|
||||||
|
wxFileDialog's wildcards).
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Initial position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Initial size.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style, see wxFLP_* flags.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Validator which can be used for additional date checks.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Control name.
|
||||||
|
|
||||||
|
@returns @true if the control was successfully created or @false if
|
||||||
|
creation failed.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxString& path = wxEmptyString,
|
||||||
|
const wxString& message = "Select a file",
|
||||||
|
const wxString& wildcard = ".",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxFLP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "filepickerctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Similar to GetPath() but returns the path of
|
||||||
|
the currently selected file as a wxFileName object.
|
||||||
|
*/
|
||||||
|
wxFileName GetFileName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the absolute path of the currently selected file.
|
||||||
|
*/
|
||||||
|
wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method does the same thing as SetPath() but
|
||||||
|
takes a wxFileName object instead of a string.
|
||||||
|
*/
|
||||||
|
void SetFileName(const wxFileName & filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the absolute path of the currently selected file. This must be a valid
|
||||||
|
file if
|
||||||
|
the @c wxFLP_FILE_MUST_EXIST style was given.
|
||||||
|
*/
|
||||||
|
void SetPath(const wxString & filename);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxDirPickerCtrl
|
||||||
|
@wxheader{filepicker.h}
|
||||||
|
|
||||||
|
This control allows the user to select a directory. The generic implementation
|
||||||
|
is
|
||||||
|
a button which brings up a wxDirDialog when clicked. Native implementation
|
||||||
|
may differ but this is usually a (small) widget which give access to the
|
||||||
|
dir-chooser
|
||||||
|
dialog.
|
||||||
|
It is only available if @c wxUSE_DIRPICKERCTRL is set to 1 (the default).
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxDIRP_DEFAULT_STYLE}:
|
||||||
|
The default style: includes wxDIRP_DIR_MUST_EXIST and, under wxMSW
|
||||||
|
only, wxDIRP_USE_TEXTCTRL.
|
||||||
|
@style{wxDIRP_USE_TEXTCTRL}:
|
||||||
|
Creates a text control to the left of the picker button which is
|
||||||
|
completely managed by the wxDirPickerCtrl and which can be used by
|
||||||
|
the user to specify a path (see SetPath). The text control is
|
||||||
|
automatically synchronized with button's value. Use functions
|
||||||
|
defined in wxPickerBase to modify the text control.
|
||||||
|
@style{wxDIRP_DIR_MUST_EXIST}:
|
||||||
|
Creates a picker which allows to select only existing directories.
|
||||||
|
wxGTK control always adds this flag internally as it does not
|
||||||
|
support its absence.
|
||||||
|
@style{wxDIRP_CHANGE_DIR}:
|
||||||
|
Change current working directory on each user directory selection
|
||||||
|
change.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{miscpickers}
|
||||||
|
@appearance{dirpickerctrl.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxDirDialog, wxFileDirPickerEvent
|
||||||
|
*/
|
||||||
|
class wxDirPickerCtrl : public wxPickerBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Initializes the object and calls Create() with
|
||||||
|
all the parameters.
|
||||||
|
*/
|
||||||
|
wxDirPickerCtrl(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxString& path = wxEmptyString,
|
||||||
|
const wxString& message = "Select a folder",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDIRP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "dirpickerctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param parent
|
||||||
|
Parent window, must not be non-@NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The identifier for the control.
|
||||||
|
|
||||||
|
@param path
|
||||||
|
The initial directory shown in the control. Must be a valid path to a directory
|
||||||
|
or the empty string.
|
||||||
|
|
||||||
|
@param message
|
||||||
|
The message shown to the user in the wxDirDialog shown by the control.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Initial position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Initial size.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style, see wxDIRP_* flags.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Validator which can be used for additional date checks.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Control name.
|
||||||
|
|
||||||
|
@returns @true if the control was successfully created or @false if
|
||||||
|
creation failed.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxString& path = wxEmptyString,
|
||||||
|
const wxString& message = "Select a folder",
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDIRP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "dirpickerctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the absolute path of the currently selected directory as a wxFileName
|
||||||
|
object.
|
||||||
|
This function is equivalent to GetPath()
|
||||||
|
*/
|
||||||
|
wxFileName GetDirName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the absolute path of the currently selected directory.
|
||||||
|
*/
|
||||||
|
wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Just like SetPath() but this function takes a
|
||||||
|
wxFileName object.
|
||||||
|
*/
|
||||||
|
void SetDirName(const wxFileName & dirname);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the absolute path of (the default converter uses current locale's
|
||||||
|
charset)the currently selected directory. This must be a valid directory if
|
||||||
|
@c wxDIRP_DIR_MUST_EXIST style was given.
|
||||||
|
*/
|
||||||
|
void SetPath(const wxString & dirname);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileDirPickerEvent
|
||||||
|
@wxheader{filepicker.h}
|
||||||
|
|
||||||
|
This event class is used for the events generated by
|
||||||
|
wxFilePickerCtrl and by wxDirPickerCtrl.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxfilepickerctrl
|
||||||
|
*/
|
||||||
|
class wxFileDirPickerEvent : public wxCommandEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
The constructor is not normally used by the user code.
|
||||||
|
*/
|
||||||
|
wxFileDirPickerEvent(wxEventType type, wxObject * generator,
|
||||||
|
int id,
|
||||||
|
const wxString path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieve the absolute path of the file/directory the user has just selected.
|
||||||
|
*/
|
||||||
|
wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the absolute path of the file/directory associated with the event.
|
||||||
|
*/
|
||||||
|
void SetPath(const wxString & path);
|
||||||
|
};
|
||||||
341
interface/filesys.h
Normal file
341
interface/filesys.h
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: filesys.h
|
||||||
|
// Purpose: documentation for wxFileSystem class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileSystem
|
||||||
|
@wxheader{filesys.h}
|
||||||
|
|
||||||
|
This class provides an interface for opening files on different
|
||||||
|
file systems. It can handle absolute and/or local filenames.
|
||||||
|
It uses a system of handlers to
|
||||||
|
provide access to user-defined virtual file systems.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{vfs}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFileSystemHandler, wxFSFile, Overview
|
||||||
|
*/
|
||||||
|
class wxFileSystem : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxFileSystem();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This static function adds new handler into the list of
|
||||||
|
handlers which provide access to virtual FS.
|
||||||
|
Note that if two handlers for the same protocol are added, the last one added
|
||||||
|
takes precedence.
|
||||||
|
*/
|
||||||
|
static void AddHandler(wxFileSystemHandler handler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the current location. @e location parameter passed to
|
||||||
|
OpenFile() is relative to this path.
|
||||||
|
|
||||||
|
@b Caution! Unless @e is_dir is @true the @e location parameter
|
||||||
|
is not the directory name but the name of the file in this directory. All these
|
||||||
|
commands change the path to "dir/subdir/":
|
||||||
|
|
||||||
|
@param location
|
||||||
|
the new location. Its meaning depends on the value of is_dir
|
||||||
|
|
||||||
|
@param is_dir
|
||||||
|
if @true location is new directory. If @false (default)
|
||||||
|
location is file in the new directory.
|
||||||
|
*/
|
||||||
|
void ChangePathTo(const wxString& location, bool is_dir = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts filename into URL.
|
||||||
|
|
||||||
|
@sa URLToFileName(), wxFileName
|
||||||
|
*/
|
||||||
|
static wxString FileNameToURL(wxFileName filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Looks for the file with the given name @e file in a colon or semi-colon
|
||||||
|
(depending on the current platform) separated list of directories in
|
||||||
|
@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
|
||||||
|
@e str.
|
||||||
|
|
||||||
|
@param str
|
||||||
|
Receives the full path of the file, must not be @NULL
|
||||||
|
|
||||||
|
@param path
|
||||||
|
wxPATH_SEP-separated list of directories
|
||||||
|
|
||||||
|
@param file
|
||||||
|
the name of the file to look for
|
||||||
|
*/
|
||||||
|
bool FindFileInPath(wxString str, const wxString& path,
|
||||||
|
const wxString& file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Works like wxFindFirstFile. Returns name of the first
|
||||||
|
filename (within filesystem's current path) that matches @e wildcard. @e flags
|
||||||
|
may be one of
|
||||||
|
wxFILE (only files), wxDIR (only directories) or 0 (both).
|
||||||
|
*/
|
||||||
|
wxString FindFirst(const wxString& wildcard, int flags = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the next filename that matches parameters passed to FindFirst().
|
||||||
|
*/
|
||||||
|
wxString FindNext();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns actual path (set by wxFileSystem::ChangePathTo).
|
||||||
|
*/
|
||||||
|
wxString GetPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
This static function returns @true if there is a registered handler which can
|
||||||
|
open the given
|
||||||
|
location.
|
||||||
|
*/
|
||||||
|
static bool HasHandlerForPath(const wxString & location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Opens the file and returns a pointer to a wxFSFile object
|
||||||
|
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
|
||||||
|
absolute path. Note that the user is responsible for deleting the returned
|
||||||
|
wxFSFile.
|
||||||
|
|
||||||
|
@e flags can be one or more of the following bit values ored together:
|
||||||
|
A stream opened with just the default @e wxFS_READ flag may
|
||||||
|
or may not be seekable depending on the underlying source.
|
||||||
|
Passing @e wxFS_READ | wxFS_SEEKABLE for @e flags will
|
||||||
|
back a stream that is not natively seekable with memory or a file
|
||||||
|
and return a stream that is always seekable.
|
||||||
|
*/
|
||||||
|
wxFSFile* OpenFile(const wxString& location,
|
||||||
|
int flags = wxFS_READ);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts URL into a well-formed filename. The URL must use the @c file
|
||||||
|
protocol.
|
||||||
|
*/
|
||||||
|
static wxFileName URLToFileName(const wxString& url);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFSFile
|
||||||
|
@wxheader{filesys.h}
|
||||||
|
|
||||||
|
This class represents a single file opened by wxFileSystem.
|
||||||
|
It provides more information than wxWindow's input stream
|
||||||
|
(stream, filename, mime type, anchor).
|
||||||
|
|
||||||
|
@b Note: Any pointer returned by a method of wxFSFile is valid
|
||||||
|
only as long as the wxFSFile object exists. For example a call to GetStream()
|
||||||
|
doesn't @e create the stream but only returns the pointer to it. In
|
||||||
|
other words after 10 calls to GetStream() you will have obtained ten identical
|
||||||
|
pointers.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{vfs}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFileSystemHandler, wxFileSystem, Overview
|
||||||
|
*/
|
||||||
|
class wxFSFile : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor. You probably won't use it. See Notes for details.
|
||||||
|
|
||||||
|
@param stream
|
||||||
|
The input stream that will be used to access data
|
||||||
|
|
||||||
|
@param location
|
||||||
|
The full location (aka filename) of the file
|
||||||
|
|
||||||
|
@param mimetype
|
||||||
|
MIME type of this file. It may be left empty, in which
|
||||||
|
case the type will be determined from file's extension (location must
|
||||||
|
not be empty in this case).
|
||||||
|
|
||||||
|
@param anchor
|
||||||
|
Anchor. See GetAnchor() for details.
|
||||||
|
*/
|
||||||
|
wxFSFile(wxInputStream stream, const wxString& loc,
|
||||||
|
const wxString& mimetype,
|
||||||
|
const wxString& anchor, wxDateTime modif);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Detaches the stream from the wxFSFile object. That is, the
|
||||||
|
stream obtained with @c GetStream() will continue its existance
|
||||||
|
after the wxFSFile object is deleted. You will have to delete
|
||||||
|
the stream yourself.
|
||||||
|
*/
|
||||||
|
void DetachStream();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns anchor (if present). The term of @b anchor can be easily
|
||||||
|
explained using few examples:
|
||||||
|
Usually an anchor is presented only if the MIME type is 'text/html'.
|
||||||
|
But it may have some meaning with other files;
|
||||||
|
for example myanim.avi#200 may refer to position in animation
|
||||||
|
or reality.wrl#MyView may refer to a predefined view in VRML.
|
||||||
|
*/
|
||||||
|
const wxString GetAnchor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns full location of the file, including path and protocol.
|
||||||
|
Examples :
|
||||||
|
*/
|
||||||
|
const wxString GetLocation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the MIME type of the content of this file. It is either
|
||||||
|
extension-based (see wxMimeTypesManager) or extracted from
|
||||||
|
HTTP protocol Content-Type header.
|
||||||
|
*/
|
||||||
|
const wxString GetMimeType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns time when this file was modified.
|
||||||
|
*/
|
||||||
|
wxDateTime GetModificationTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns pointer to the stream. 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
|
||||||
|
this by default. wxHtml uses local cache to work around
|
||||||
|
this and to speed up the connection).
|
||||||
|
*/
|
||||||
|
wxInputStream* GetStream();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFileSystemHandler
|
||||||
|
@wxheader{filesys.h}
|
||||||
|
|
||||||
|
Classes derived from wxFileSystemHandler are used
|
||||||
|
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
|
||||||
|
are constructed.
|
||||||
|
|
||||||
|
Also consult @ref overview_fs "list of available handlers".
|
||||||
|
|
||||||
|
@b wxPerl note: In wxPerl, you need to derive your file system handler class
|
||||||
|
from Wx::PlFileSystemHandler.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{vfs}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFileSystem, wxFSFile, Overview
|
||||||
|
*/
|
||||||
|
class wxFileSystemHandler : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxFileSystemHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the handler is able to open this file. This function doesn't
|
||||||
|
check whether the file exists or not, it only checks if it knows the protocol.
|
||||||
|
Example:
|
||||||
|
Must be overridden in derived handlers.
|
||||||
|
*/
|
||||||
|
virtual bool CanOpen(const wxString& location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Works like wxFindFirstFile. Returns name of the first
|
||||||
|
filename (within filesystem's current path) that matches @e wildcard. @e flags
|
||||||
|
may be one of
|
||||||
|
wxFILE (only files), wxDIR (only directories) or 0 (both).
|
||||||
|
|
||||||
|
This method is only called if CanOpen() returns @true.
|
||||||
|
*/
|
||||||
|
virtual wxString FindFirst(const wxString& wildcard,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns next filename that matches parameters passed to wxFileSystem::FindFirst.
|
||||||
|
|
||||||
|
This method is only called if CanOpen() returns @true and FindFirst
|
||||||
|
returned a non-empty string.
|
||||||
|
*/
|
||||||
|
virtual wxString FindNext();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the anchor if present in the location.
|
||||||
|
See @ref wxFSFile::getanchor wxFSFile for details.
|
||||||
|
|
||||||
|
Example: GetAnchor("index.htm#chapter2") == "chapter2"
|
||||||
|
|
||||||
|
@b Note: the anchor is NOT part of the left location.
|
||||||
|
*/
|
||||||
|
wxString GetAnchor(const wxString& location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the left location string extracted from @e location.
|
||||||
|
|
||||||
|
Example: GetLeftLocation("file:myzipfile.zip#zip:index.htm") ==
|
||||||
|
"file:myzipfile.zip"
|
||||||
|
*/
|
||||||
|
wxString GetLeftLocation(const wxString& location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the MIME type based on @b extension of @e location. (While
|
||||||
|
wxFSFile::GetMimeType
|
||||||
|
returns real MIME type - either extension-based or queried from HTTP.)
|
||||||
|
|
||||||
|
Example : GetMimeTypeFromExt("index.htm") == "text/html"
|
||||||
|
*/
|
||||||
|
wxString GetMimeTypeFromExt(const wxString& location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the protocol string extracted from @e location.
|
||||||
|
|
||||||
|
Example: GetProtocol("file:myzipfile.zip#zip:index.htm") == "zip"
|
||||||
|
*/
|
||||||
|
wxString GetProtocol(const wxString& location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the right location string extracted from @e location.
|
||||||
|
|
||||||
|
Example : GetRightLocation("file:myzipfile.zip#zip:index.htm") == "index.htm"
|
||||||
|
*/
|
||||||
|
wxString GetRightLocation(const wxString& location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Opens the file and returns wxFSFile pointer or @NULL if failed.
|
||||||
|
|
||||||
|
Must be overridden in derived handlers.
|
||||||
|
|
||||||
|
@param fs
|
||||||
|
Parent FS (the FS from that OpenFile was called). See ZIP handler
|
||||||
|
for details of how to use it.
|
||||||
|
|
||||||
|
@param location
|
||||||
|
The absolute location of file.
|
||||||
|
*/
|
||||||
|
virtual wxFSFile* OpenFile(wxFileSystem& fs,
|
||||||
|
const wxString& location);
|
||||||
|
};
|
||||||
516
interface/font.h
Normal file
516
interface/font.h
Normal file
@@ -0,0 +1,516 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: font.h
|
||||||
|
// Purpose: documentation for wxFont class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFont
|
||||||
|
@wxheader{font.h}
|
||||||
|
|
||||||
|
A font is an object which determines the appearance of text. Fonts are
|
||||||
|
used for drawing text to a device context, and setting the appearance of
|
||||||
|
a window's text.
|
||||||
|
|
||||||
|
This class uses @ref overview_trefcount "reference counting and copy-on-write"
|
||||||
|
internally so that assignments between two instances of this class are very
|
||||||
|
cheap. You can therefore use actual objects instead of pointers without
|
||||||
|
efficiency problems. If an instance of this class is changed it will create
|
||||||
|
its own data internally so that other instances, which previously shared the
|
||||||
|
data using the reference counting, are not affected.
|
||||||
|
|
||||||
|
You can retrieve the current system font settings with wxSystemSettings.
|
||||||
|
|
||||||
|
wxSystemSettings
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{gdi}
|
||||||
|
|
||||||
|
@stdobjects
|
||||||
|
Objects:
|
||||||
|
wxNullFont
|
||||||
|
Pointers:
|
||||||
|
wxNORMAL_FONT
|
||||||
|
|
||||||
|
wxSMALL_FONT
|
||||||
|
|
||||||
|
wxITALIC_FONT
|
||||||
|
|
||||||
|
wxSWISS_FONT
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxfontoverview "wxFont overview", wxDC::SetFont, wxDC::DrawText,
|
||||||
|
wxDC::GetTextExtent, wxFontDialog, wxSystemSettings
|
||||||
|
*/
|
||||||
|
class wxFont : public wxGDIObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Creates a font object with the specified attributes.
|
||||||
|
|
||||||
|
@param pointSize
|
||||||
|
Size in points.
|
||||||
|
|
||||||
|
@param pixelSize
|
||||||
|
Size in pixels: this is directly supported only under MSW
|
||||||
|
currently where this constructor can be used directly, under other platforms a
|
||||||
|
font with the closest size to the given one is found using binary search and
|
||||||
|
the static New method must be used.
|
||||||
|
|
||||||
|
@param family
|
||||||
|
Font family, a generic way of referring to fonts without specifying actual
|
||||||
|
facename. One of:
|
||||||
|
|
||||||
|
|
||||||
|
wxFONTFAMILY_DEFAULT
|
||||||
|
|
||||||
|
|
||||||
|
Chooses a default font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_DECORATIVE
|
||||||
|
|
||||||
|
|
||||||
|
A decorative font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_ROMAN
|
||||||
|
|
||||||
|
|
||||||
|
A formal, serif font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_SCRIPT
|
||||||
|
|
||||||
|
|
||||||
|
A handwriting font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_SWISS
|
||||||
|
|
||||||
|
|
||||||
|
A sans-serif font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_MODERN
|
||||||
|
|
||||||
|
|
||||||
|
A fixed pitch font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_TELETYPE
|
||||||
|
|
||||||
|
|
||||||
|
A teletype font.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
One of wxFONTSTYLE_NORMAL, wxFONTSTYLE_SLANT and wxFONTSTYLE_ITALIC.
|
||||||
|
|
||||||
|
@param weight
|
||||||
|
Font weight, sometimes also referred to as font boldness. One of:
|
||||||
|
|
||||||
|
|
||||||
|
wxFONTWEIGHT_NORMAL
|
||||||
|
|
||||||
|
|
||||||
|
Normal font.
|
||||||
|
|
||||||
|
wxFONTWEIGHT_LIGHT
|
||||||
|
|
||||||
|
|
||||||
|
Light font.
|
||||||
|
|
||||||
|
wxFONTWEIGHT_BOLD
|
||||||
|
|
||||||
|
|
||||||
|
Bold font.
|
||||||
|
|
||||||
|
@param underline
|
||||||
|
The value can be @true or @false. At present this has an effect on Windows and
|
||||||
|
Motif 2.x only.
|
||||||
|
|
||||||
|
@param faceName
|
||||||
|
An optional string specifying the actual typeface to be used. If it is an empty
|
||||||
|
string,
|
||||||
|
a default typeface will be chosen based on the family.
|
||||||
|
|
||||||
|
@param encoding
|
||||||
|
An encoding which may be one of
|
||||||
|
|
||||||
|
wxFONTENCODING_SYSTEM
|
||||||
|
|
||||||
|
|
||||||
|
Default system encoding.
|
||||||
|
|
||||||
|
wxFONTENCODING_DEFAULT
|
||||||
|
|
||||||
|
|
||||||
|
Default application encoding: this
|
||||||
|
is the encoding set by calls to
|
||||||
|
SetDefaultEncoding and which may be set to,
|
||||||
|
say, KOI8 to create all fonts by default with KOI8 encoding. Initially, the
|
||||||
|
default application encoding is the same as default system encoding.
|
||||||
|
|
||||||
|
wxFONTENCODING_ISO8859_1...15
|
||||||
|
|
||||||
|
|
||||||
|
ISO8859 encodings.
|
||||||
|
|
||||||
|
wxFONTENCODING_KOI8
|
||||||
|
|
||||||
|
|
||||||
|
The standard Russian encoding for Internet.
|
||||||
|
|
||||||
|
wxFONTENCODING_CP1250...1252
|
||||||
|
|
||||||
|
|
||||||
|
Windows encodings similar to ISO8859 (but not identical).
|
||||||
|
|
||||||
|
If the specified encoding isn't available, no font is created
|
||||||
|
(see also font encoding overview).
|
||||||
|
|
||||||
|
@remarks If the desired font does not exist, the closest match will be
|
||||||
|
chosen. Under Windows, only scalable TrueType fonts
|
||||||
|
are used.
|
||||||
|
*/
|
||||||
|
wxFont();
|
||||||
|
wxFont(const wxFont& font);
|
||||||
|
wxFont(int pointSize, wxFontFamily family, int style,
|
||||||
|
wxFontWeight weight,
|
||||||
|
const bool underline = @false,
|
||||||
|
const wxString& faceName = "",
|
||||||
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||||
|
wxFont(const wxSize& pixelSize, wxFontFamily family,
|
||||||
|
int style, wxFontWeight weight,
|
||||||
|
const bool underline = @false,
|
||||||
|
const wxString& faceName = "",
|
||||||
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor.
|
||||||
|
See @ref overview_refcountdestruct "reference-counted object destruction" for
|
||||||
|
more info.
|
||||||
|
|
||||||
|
@remarks Although all remaining fonts are deleted when the application
|
||||||
|
exits, the application should try to clean up all
|
||||||
|
fonts itself. This is because wxWidgets cannot know
|
||||||
|
if a pointer to the font object is stored in an
|
||||||
|
application data structure, and there is a risk of
|
||||||
|
double deletion.
|
||||||
|
*/
|
||||||
|
~wxFont();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current application's default encoding.
|
||||||
|
|
||||||
|
@sa @ref overview_wxfontencodingoverview "Font encoding overview",
|
||||||
|
SetDefaultEncoding()
|
||||||
|
*/
|
||||||
|
static wxFontEncoding GetDefaultEncoding();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the typeface name associated with the font, or the empty string if
|
||||||
|
there is no
|
||||||
|
typeface information.
|
||||||
|
|
||||||
|
@sa SetFaceName()
|
||||||
|
*/
|
||||||
|
wxString GetFaceName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the font family. See SetFamily() for a list of valid
|
||||||
|
family identifiers.
|
||||||
|
|
||||||
|
@sa SetFamily()
|
||||||
|
*/
|
||||||
|
wxFontFamily GetFamily();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the platform-dependent string completely describing this font.
|
||||||
|
Returned string is always non-empty.
|
||||||
|
Note that the returned string is not meant to be shown or edited by the user: a
|
||||||
|
typical
|
||||||
|
use of this function is for serializing in string-form a wxFont object.
|
||||||
|
|
||||||
|
@sa SetNativeFontInfo(),GetNativeFontInfoUserDesc()
|
||||||
|
*/
|
||||||
|
wxString GetNativeFontInfoDesc();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a user-friendly string for this font object. Returned string is always
|
||||||
|
non-empty.
|
||||||
|
Some examples of the formats of returned strings (which are platform-dependent)
|
||||||
|
are in SetNativeFontInfoUserDesc().
|
||||||
|
|
||||||
|
@sa GetNativeFontInfoDesc()
|
||||||
|
*/
|
||||||
|
wxString GetNativeFontInfoUserDesc();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the point size.
|
||||||
|
|
||||||
|
@sa SetPointSize()
|
||||||
|
*/
|
||||||
|
int GetPointSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the font style. See wxFont() for a list of valid
|
||||||
|
styles.
|
||||||
|
|
||||||
|
@sa SetStyle()
|
||||||
|
*/
|
||||||
|
int GetStyle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the font is underlined, @false otherwise.
|
||||||
|
|
||||||
|
@sa SetUnderlined()
|
||||||
|
*/
|
||||||
|
bool GetUnderlined();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the font weight. See wxFont() for a list of valid
|
||||||
|
weight identifiers.
|
||||||
|
|
||||||
|
@sa SetWeight()
|
||||||
|
*/
|
||||||
|
wxFontWeight GetWeight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the font is a fixed width (or monospaced) font,
|
||||||
|
@false if it is a proportional one or font is invalid.
|
||||||
|
*/
|
||||||
|
bool IsFixedWidth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this object is a valid font, @false otherwise.
|
||||||
|
*/
|
||||||
|
#define bool IsOk() /* implementation is private */
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
These functions take the same parameters as @ref ctor() wxFont
|
||||||
|
constructor and return a new font object allocated on the heap.
|
||||||
|
|
||||||
|
Using @c New() is currently the only way to directly create a font with
|
||||||
|
the given size in pixels on platforms other than wxMSW.
|
||||||
|
*/
|
||||||
|
static wxFont * New(int pointSize, wxFontFamily family,
|
||||||
|
int style,
|
||||||
|
wxFontWeight weight,
|
||||||
|
const bool underline = @false,
|
||||||
|
const wxString& faceName = "",
|
||||||
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||||
|
static wxFont * New(int pointSize, wxFontFamily family,
|
||||||
|
int flags = wxFONTFLAG_DEFAULT,
|
||||||
|
const wxString& faceName = "",
|
||||||
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||||
|
static wxFont * New(const wxSize& pixelSize,
|
||||||
|
wxFontFamily family,
|
||||||
|
int style,
|
||||||
|
wxFontWeight weight,
|
||||||
|
const bool underline = @false,
|
||||||
|
const wxString& faceName = "",
|
||||||
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||||
|
static wxFont * New(const wxSize& pixelSize,
|
||||||
|
wxFontFamily family,
|
||||||
|
int flags = wxFONTFLAG_DEFAULT,
|
||||||
|
const wxString& faceName = "",
|
||||||
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the default font encoding.
|
||||||
|
|
||||||
|
@sa @ref overview_wxfontencodingoverview "Font encoding overview",
|
||||||
|
GetDefaultEncoding()
|
||||||
|
*/
|
||||||
|
static void SetDefaultEncoding(wxFontEncoding encoding);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the facename for the font.
|
||||||
|
Returns @true if the given face name exists; @false otherwise.
|
||||||
|
|
||||||
|
@param faceName
|
||||||
|
A valid facename, which should be on the end-user's system.
|
||||||
|
|
||||||
|
@remarks To avoid portability problems, don't rely on a specific face,
|
||||||
|
but specify the font family instead or as well. A
|
||||||
|
suitable font will be found on the end-user's system.
|
||||||
|
If both the family and the facename are specified,
|
||||||
|
wxWidgets will first search for the specific face,
|
||||||
|
and then for a font belonging to the same family.
|
||||||
|
|
||||||
|
@sa GetFaceName(), SetFamily()
|
||||||
|
*/
|
||||||
|
bool SetFaceName(const wxString& faceName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font family.
|
||||||
|
|
||||||
|
@param family
|
||||||
|
One of:
|
||||||
|
|
||||||
|
|
||||||
|
wxFONTFAMILY_DEFAULT
|
||||||
|
|
||||||
|
|
||||||
|
Chooses a default font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_DECORATIVE
|
||||||
|
|
||||||
|
|
||||||
|
A decorative font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_ROMAN
|
||||||
|
|
||||||
|
|
||||||
|
A formal, serif font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_SCRIPT
|
||||||
|
|
||||||
|
|
||||||
|
A handwriting font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_SWISS
|
||||||
|
|
||||||
|
|
||||||
|
A sans-serif font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_MODERN
|
||||||
|
|
||||||
|
|
||||||
|
A fixed pitch font.
|
||||||
|
|
||||||
|
wxFONTFAMILY_TELETYPE
|
||||||
|
|
||||||
|
|
||||||
|
A teletype font.
|
||||||
|
|
||||||
|
@sa GetFamily(), SetFaceName()
|
||||||
|
*/
|
||||||
|
void SetFamily(wxFontFamily family);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the font corresponding to the given native font description string and
|
||||||
|
returns @true if
|
||||||
|
the creation was successful.
|
||||||
|
which must have been previously returned by
|
||||||
|
GetNativeFontInfoDesc(). If the string is
|
||||||
|
invalid, font is unchanged. This function is typically used for de-serializing
|
||||||
|
a wxFont
|
||||||
|
object previously saved in a string-form.
|
||||||
|
|
||||||
|
@sa SetNativeFontInfoUserDesc()
|
||||||
|
*/
|
||||||
|
bool SetNativeFontInfo(const wxString& info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates the font corresponding to the given native font description string and
|
||||||
|
returns @true if
|
||||||
|
the creation was successful.
|
||||||
|
Unlike SetNativeFontInfo(), this function accepts
|
||||||
|
strings which are user-friendly.
|
||||||
|
Examples of accepted string formats are:
|
||||||
|
|
||||||
|
|
||||||
|
Generic syntax
|
||||||
|
|
||||||
|
|
||||||
|
Example
|
||||||
|
|
||||||
|
on @b wxGTK2: @c [FACE-NAME] [bold] [oblique|italic] [POINTSIZE]
|
||||||
|
|
||||||
|
|
||||||
|
Monospace bold 10
|
||||||
|
|
||||||
|
on @b wxMSW: @c [light|bold] [italic] [FACE-NAME] [POINTSIZE] [ENCODING]
|
||||||
|
|
||||||
|
|
||||||
|
Tahoma 10 WINDOWS-1252
|
||||||
|
|
||||||
|
on @b wxMac: FIXME
|
||||||
|
|
||||||
|
|
||||||
|
FIXME
|
||||||
|
|
||||||
|
For more detailed information about the allowed syntaxes you can look at the
|
||||||
|
documentation of the native API used for font-rendering (e.g. pango_font_description_from_string).
|
||||||
|
|
||||||
|
@sa SetNativeFontInfo()
|
||||||
|
*/
|
||||||
|
bool SetNativeFontInfoUserDesc(const wxString& info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the point size.
|
||||||
|
|
||||||
|
@param pointSize
|
||||||
|
Size in points.
|
||||||
|
|
||||||
|
@sa GetPointSize()
|
||||||
|
*/
|
||||||
|
void SetPointSize(int pointSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font style.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
One of wxFONTSTYLE_NORMAL, wxFONTSTYLE_SLANT and wxFONTSTYLE_ITALIC.
|
||||||
|
|
||||||
|
@sa GetStyle()
|
||||||
|
*/
|
||||||
|
void SetStyle(int style);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets underlining.
|
||||||
|
|
||||||
|
@param underlining
|
||||||
|
@true to underline, @false otherwise.
|
||||||
|
|
||||||
|
@sa GetUnderlined()
|
||||||
|
*/
|
||||||
|
void SetUnderlined(const bool underlined);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the font weight.
|
||||||
|
|
||||||
|
@param weight
|
||||||
|
One of:
|
||||||
|
|
||||||
|
|
||||||
|
wxFONTWEIGHT_NORMAL
|
||||||
|
|
||||||
|
|
||||||
|
Normal font.
|
||||||
|
|
||||||
|
wxFONTWEIGHT_LIGHT
|
||||||
|
|
||||||
|
|
||||||
|
Light font.
|
||||||
|
|
||||||
|
wxFONTWEIGHT_BOLD
|
||||||
|
|
||||||
|
|
||||||
|
Bold font.
|
||||||
|
|
||||||
|
@sa GetWeight()
|
||||||
|
*/
|
||||||
|
void SetWeight(wxFontWeight weight);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Inequality operator.
|
||||||
|
See @ref overview_refcountequality "reference-counted object comparison" for
|
||||||
|
more info.
|
||||||
|
*/
|
||||||
|
bool operator !=(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Assignment operator, using @ref overview_trefcount "reference counting".
|
||||||
|
*/
|
||||||
|
wxFont operator =(const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Equality operator.
|
||||||
|
See @ref overview_refcountequality "reference-counted object comparison" for
|
||||||
|
more info.
|
||||||
|
*/
|
||||||
|
bool operator ==(const wxFont& font);
|
||||||
|
};
|
||||||
89
interface/fontdlg.h
Normal file
89
interface/fontdlg.h
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fontdlg.h
|
||||||
|
// Purpose: documentation for wxFontDialog class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFontDialog
|
||||||
|
@wxheader{fontdlg.h}
|
||||||
|
|
||||||
|
This class represents the font chooser dialog.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{cmndlg}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
Overview, wxFontData, wxGetFontFromUser
|
||||||
|
*/
|
||||||
|
class wxFontDialog : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor. Pass a parent window, and optionally the
|
||||||
|
@ref overview_wxfontdata "font data" object to be used to initialize the dialog
|
||||||
|
controls. If the default constructor is used,
|
||||||
|
Create() must be called before the dialog can be
|
||||||
|
shown.
|
||||||
|
*/
|
||||||
|
wxFontDialog();
|
||||||
|
wxFontDialog(wxWindow* parent);
|
||||||
|
wxFontDialog(wxWindow* parent, const wxFontData& data);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Creates the dialog if it the wxFontDialog object had been initialized using the
|
||||||
|
default constructor. Returns @true on success and @false if an error
|
||||||
|
occurred.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent);
|
||||||
|
bool Create(wxWindow* parent, const wxFontData& data);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Returns the @ref overview_wxfontdata "font data" associated with the font
|
||||||
|
dialog.
|
||||||
|
*/
|
||||||
|
const wxFontData GetFontData();
|
||||||
|
wxFontData GetFontData();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the dialog, returning @c wxID_OK if the user pressed Ok, and
|
||||||
|
@c wxID_CANCEL otherwise.
|
||||||
|
|
||||||
|
If the user cancels the dialog (ShowModal returns @c wxID_CANCEL), no font
|
||||||
|
will be created. If the user presses OK, a new wxFont will be created and
|
||||||
|
stored in the font dialog's wxFontData structure.
|
||||||
|
*/
|
||||||
|
int ShowModal();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// Global functions/macros
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
Shows the font selection dialog and returns the font selected by user or
|
||||||
|
invalid font (use @ref wxFont::isok wxFont:IsOk to test whether a font
|
||||||
|
is valid) if the dialog was cancelled.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
The parent window for the font selection dialog
|
||||||
|
|
||||||
|
@param fontInit
|
||||||
|
If given, this will be the font initially selected in the dialog.
|
||||||
|
|
||||||
|
@param caption
|
||||||
|
If given, this will be used for the dialog caption.
|
||||||
|
*/
|
||||||
|
wxFont wxGetFontFromUser(wxWindow * parent,
|
||||||
|
const wxFont& fontInit,
|
||||||
|
const wxString& caption = wxEmptyString);
|
||||||
|
|
||||||
86
interface/fontenum.h
Normal file
86
interface/fontenum.h
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fontenum.h
|
||||||
|
// Purpose: documentation for wxFontEnumerator class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFontEnumerator
|
||||||
|
@wxheader{fontenum.h}
|
||||||
|
|
||||||
|
wxFontEnumerator enumerates either all available fonts on the system or only
|
||||||
|
the ones with given attributes - either only fixed-width (suited for use in
|
||||||
|
programs such as terminal emulators and the like) or the fonts available in
|
||||||
|
the given encoding.
|
||||||
|
|
||||||
|
To do this, you just have to call one of EnumerateXXX() functions - either
|
||||||
|
wxFontEnumerator::EnumerateFacenames or
|
||||||
|
wxFontEnumerator::EnumerateEncodings and the
|
||||||
|
corresponding callback (wxFontEnumerator::OnFacename or
|
||||||
|
wxFontEnumerator::OnFontEncoding) will be called
|
||||||
|
repeatedly until either all fonts satisfying the specified criteria are
|
||||||
|
exhausted or the callback returns @false.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
@ref overview_wxfontencodingoverview "Font encoding overview", @ref
|
||||||
|
overview_samplefont "Font sample", wxFont, wxFontMapper
|
||||||
|
*/
|
||||||
|
class wxFontEnumerator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Call OnFontEncoding() for each
|
||||||
|
encoding supported by the given font - or for each encoding supported by at
|
||||||
|
least some font if @e font is not specified.
|
||||||
|
*/
|
||||||
|
virtual bool EnumerateEncodings(const wxString& font = "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Call OnFacename() for each font which
|
||||||
|
supports given encoding (only if it is not wxFONTENCODING_SYSTEM) and is of
|
||||||
|
fixed width (if @e fixedWidthOnly is @true).
|
||||||
|
|
||||||
|
Calling this function with default arguments will result in enumerating all
|
||||||
|
fonts available on the system.
|
||||||
|
*/
|
||||||
|
virtual bool EnumerateFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
|
||||||
|
bool fixedWidthOnly = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return array of strings containing all encodings found by
|
||||||
|
EnumerateEncodings().
|
||||||
|
*/
|
||||||
|
static wxArrayString GetEncodings(const wxString& facename = "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return array of strings containing all facenames found by
|
||||||
|
EnumerateFacenames().
|
||||||
|
*/
|
||||||
|
static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
|
||||||
|
bool fixedWidthOnly = @false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if the given string is valid face name, i.e. it's the face name
|
||||||
|
of an installed
|
||||||
|
font and it can safely be used with wxFont::SetFaceName.
|
||||||
|
*/
|
||||||
|
static bool IsValidFacename(const wxString & facename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called by EnumerateFacenames() for
|
||||||
|
each match. Return @true to continue enumeration or @false to stop it.
|
||||||
|
*/
|
||||||
|
virtual bool OnFacename(const wxString& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called by EnumerateEncodings() for
|
||||||
|
each match. Return @true to continue enumeration or @false to stop it.
|
||||||
|
*/
|
||||||
|
virtual bool OnFontEncoding(const wxString& font,
|
||||||
|
const wxString& encoding);
|
||||||
|
};
|
||||||
179
interface/fontmap.h
Normal file
179
interface/fontmap.h
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fontmap.h
|
||||||
|
// Purpose: documentation for wxFontMapper class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFontMapper
|
||||||
|
@wxheader{fontmap.h}
|
||||||
|
|
||||||
|
wxFontMapper manages user-definable correspondence between logical font
|
||||||
|
names and the fonts present on the machine.
|
||||||
|
|
||||||
|
The default implementations of all functions will ask the user if they are
|
||||||
|
not capable of finding the answer themselves and store the answer in a
|
||||||
|
config file (configurable via SetConfigXXX functions). This behaviour may
|
||||||
|
be disabled by giving the value of @false to "interactive" parameter.
|
||||||
|
|
||||||
|
However, the functions will always consult the config file to allow the
|
||||||
|
user-defined values override the default logic and there is no way to
|
||||||
|
disable this - which shouldn't be ever needed because if "interactive" was
|
||||||
|
never @true, the config file is never created anyhow.
|
||||||
|
|
||||||
|
In case everything else fails (i.e. there is no record in config file
|
||||||
|
and "interactive" is @false or user denied to choose any replacement),
|
||||||
|
the class queries wxEncodingConverter
|
||||||
|
for "equivalent" encodings (e.g. iso8859-2 and cp1250) and tries them.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{misc}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxEncodingConverter, @ref overview_nonenglishoverview "Writing non-English
|
||||||
|
applications"
|
||||||
|
*/
|
||||||
|
class wxFontMapper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Default ctor.
|
||||||
|
*/
|
||||||
|
wxFontMapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Virtual dtor for a base class.
|
||||||
|
*/
|
||||||
|
~wxFontMapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the encoding for the given charset (in the form of RFC 2046) or
|
||||||
|
@c wxFONTENCODING_SYSTEM if couldn't decode it.
|
||||||
|
|
||||||
|
Be careful when using this function with @e interactive set to @true
|
||||||
|
(default value) as the function then may show a dialog box to the user which
|
||||||
|
may lead to unexpected reentrancies and may also take a significantly longer
|
||||||
|
time than a simple function call. For these reasons, it is almost always a bad
|
||||||
|
idea to call this function from the event handlers for repeatedly generated
|
||||||
|
events such as @c EVT_PAINT.
|
||||||
|
*/
|
||||||
|
wxFontEncoding CharsetToEncoding(const wxString& charset,
|
||||||
|
bool interactive = @true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the current font mapper object. If there is no current object, creates
|
||||||
|
one.
|
||||||
|
|
||||||
|
@sa Set()
|
||||||
|
*/
|
||||||
|
#define static wxFontMapper * Get() /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the array of all possible names for the given encoding. The array is
|
||||||
|
@NULL-terminated. IF it isn't empty, the first name in it is the canonical
|
||||||
|
encoding name, i.e. the same string as returned by
|
||||||
|
GetEncodingName().
|
||||||
|
*/
|
||||||
|
static const wxChar** GetAllEncodingNames(wxFontEncoding encoding);
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Find an alternative for the given encoding (which is supposed to not be
|
||||||
|
available on this system). If successful, return @true and fill info
|
||||||
|
structure with the parameters required to create the font, otherwise
|
||||||
|
return @false.
|
||||||
|
|
||||||
|
The first form is for wxWidgets' internal use while the second one
|
||||||
|
is better suitable for general use -- it returns wxFontEncoding which
|
||||||
|
can consequently be passed to wxFont constructor.
|
||||||
|
*/
|
||||||
|
bool GetAltForEncoding(wxFontEncoding encoding,
|
||||||
|
wxNativeEncodingInfo* info,
|
||||||
|
const wxString& facename = wxEmptyString,
|
||||||
|
bool interactive = @true);
|
||||||
|
bool GetAltForEncoding(wxFontEncoding encoding,
|
||||||
|
wxFontEncoding* alt_encoding,
|
||||||
|
const wxString& facename = wxEmptyString,
|
||||||
|
bool interactive = @true);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the @e n-th supported encoding. Together with
|
||||||
|
GetSupportedEncodingsCount()
|
||||||
|
this method may be used to get all supported encodings.
|
||||||
|
*/
|
||||||
|
static wxFontEncoding GetEncoding(size_t n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return user-readable string describing the given encoding.
|
||||||
|
*/
|
||||||
|
static wxString GetEncodingDescription(wxFontEncoding encoding);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the encoding corresponding to the given internal name. This function is
|
||||||
|
the inverse of GetEncodingName() and is
|
||||||
|
intentionally less general than
|
||||||
|
CharsetToEncoding(), i.e. it doesn't
|
||||||
|
try to make any guesses nor ever asks the user. It is meant just as a way of
|
||||||
|
restoring objects previously serialized using
|
||||||
|
GetEncodingName().
|
||||||
|
*/
|
||||||
|
static wxFontEncoding GetEncodingFromName(const wxString& encoding);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return internal string identifier for the encoding (see also
|
||||||
|
wxFontMapper::GetEncodingDescription)
|
||||||
|
|
||||||
|
@sa GetEncodingFromName()
|
||||||
|
*/
|
||||||
|
static wxString GetEncodingName(wxFontEncoding encoding);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of the font encodings supported by this class. Together with
|
||||||
|
GetEncoding() this method may be used to get
|
||||||
|
all supported encodings.
|
||||||
|
*/
|
||||||
|
static size_t GetSupportedEncodingsCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check whether given encoding is available in given face or not.
|
||||||
|
If no facename is given, find @e any font in this encoding.
|
||||||
|
*/
|
||||||
|
bool IsEncodingAvailable(wxFontEncoding encoding,
|
||||||
|
const wxString& facename = wxEmptyString);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the current font mapper object and return previous one (may be @NULL).
|
||||||
|
This method is only useful if you want to plug-in an alternative font mapper
|
||||||
|
into wxWidgets.
|
||||||
|
|
||||||
|
@sa Get()
|
||||||
|
*/
|
||||||
|
#define static wxFontMapper * Set(wxFontMapper * mapper) /* implementation is private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the config object to use (may be @NULL to use default).
|
||||||
|
|
||||||
|
By default, the global one (from wxConfigBase::Get() will be used)
|
||||||
|
and the default root path for the config settings is the string returned by
|
||||||
|
GetDefaultConfigPath().
|
||||||
|
*/
|
||||||
|
void SetConfig(wxConfigBase* config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the root config path to use (should be an absolute path).
|
||||||
|
*/
|
||||||
|
void SetConfigPath(const wxString& prefix);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The parent window for modal dialogs.
|
||||||
|
*/
|
||||||
|
void SetDialogParent(wxWindow* parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
The title for the dialogs (note that default is quite reasonable).
|
||||||
|
*/
|
||||||
|
void SetDialogTitle(const wxString& title);
|
||||||
|
};
|
||||||
160
interface/fontpicker.h
Normal file
160
interface/fontpicker.h
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fontpicker.h
|
||||||
|
// Purpose: documentation for wxFontPickerCtrl class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFontPickerCtrl
|
||||||
|
@wxheader{fontpicker.h}
|
||||||
|
|
||||||
|
This control allows the user to select a font. The generic implementation is
|
||||||
|
a button which brings up a wxFontDialog when clicked. Native implementation
|
||||||
|
may differ but this is usually a (small) widget which give access to the
|
||||||
|
font-chooser
|
||||||
|
dialog.
|
||||||
|
It is only available if @c wxUSE_FONTPICKERCTRL is set to 1 (the default).
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxFNTP_DEFAULT_STYLE}:
|
||||||
|
The default style: wxFNTP_FONTDESC_AS_LABEL |
|
||||||
|
wxFNTP_USEFONT_FOR_LABEL.
|
||||||
|
@style{wxFNTP_USE_TEXTCTRL}:
|
||||||
|
Creates a text control to the left of the picker button which is
|
||||||
|
completely managed by the wxFontPickerCtrl and which can be used by
|
||||||
|
the user to specify a font (see SetSelectedFont). The text control
|
||||||
|
is automatically synchronized with button's value. Use functions
|
||||||
|
defined in wxPickerBase to modify the text control.
|
||||||
|
@style{wxFNTP_FONTDESC_AS_LABEL}:
|
||||||
|
Keeps the label of the button updated with the fontface name and
|
||||||
|
the font size. E.g. choosing "Times New Roman bold, italic with
|
||||||
|
size 10" from the fontdialog, will update the label (overwriting
|
||||||
|
any previous label) with the "Times New Roman, 10" text.
|
||||||
|
@style{wxFNTP_USEFONT_FOR_LABEL}:
|
||||||
|
Uses the currently selected font to draw the label of the button.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{miscpickers}
|
||||||
|
@appearance{fontpickerctrl.png}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFontDialog, wxFontPickerEvent
|
||||||
|
*/
|
||||||
|
class wxFontPickerCtrl : public wxPickerBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Initializes the object and calls Create() with
|
||||||
|
all the parameters.
|
||||||
|
*/
|
||||||
|
wxFontPickerCtrl(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxFont& font = wxNullFont,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxFNTP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "fontpickerctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param parent
|
||||||
|
Parent window, must not be non-@NULL.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The identifier for the control.
|
||||||
|
|
||||||
|
@param font
|
||||||
|
The initial font shown in the control. If wxNullFont
|
||||||
|
is given, the default font is used.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
Initial position.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
Initial size.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style, see wxFNTP_* flags.
|
||||||
|
|
||||||
|
@param validator
|
||||||
|
Validator which can be used for additional date checks.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
Control name.
|
||||||
|
|
||||||
|
@returns @true if the control was successfully created or @false if
|
||||||
|
creation failed.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow * parent, wxWindowID id,
|
||||||
|
const wxFont& font = wxNullFont,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxFNTP_DEFAULT_STYLE,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = "fontpickerctrl");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the maximum point size value allowed for the user-chosen font.
|
||||||
|
*/
|
||||||
|
unsigned int GetMaxPointSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the currently selected font.
|
||||||
|
Note that this function is completely different from wxWindow::GetFont.
|
||||||
|
*/
|
||||||
|
wxFont GetSelectedFont();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the maximum point size value allowed for the user-chosen font.
|
||||||
|
The default value is 100. Note that big fonts can require a lot of memory and
|
||||||
|
CPU time
|
||||||
|
both for creation and for rendering; thus, specially because the user has the
|
||||||
|
option to specify
|
||||||
|
the fontsize through a text control (see wxFNTP_USE_TEXTCTRL), it's a good idea
|
||||||
|
to put a limit
|
||||||
|
to the maximum font size when huge fonts do not make much sense.
|
||||||
|
*/
|
||||||
|
void GetMaxPointSize(unsigned int max);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the currently selected font.
|
||||||
|
Note that this function is completely different from wxWindow::SetFont.
|
||||||
|
*/
|
||||||
|
void SetSelectedFont(const wxFont & font);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFontPickerEvent
|
||||||
|
@wxheader{fontpicker.h}
|
||||||
|
|
||||||
|
This event class is used for the events generated by
|
||||||
|
wxFontPickerCtrl.
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxFontPickerCtrl
|
||||||
|
*/
|
||||||
|
class wxFontPickerEvent : public wxCommandEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
The constructor is not normally used by the user code.
|
||||||
|
*/
|
||||||
|
wxFontPickerEvent(wxObject * generator, int id,
|
||||||
|
const wxFont& font);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieve the font the user has just selected.
|
||||||
|
*/
|
||||||
|
wxFont GetFont();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the font associated with the event.
|
||||||
|
*/
|
||||||
|
void SetFont(const wxFont & f);
|
||||||
|
};
|
||||||
399
interface/frame.h
Normal file
399
interface/frame.h
Normal file
@@ -0,0 +1,399 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: frame.h
|
||||||
|
// Purpose: documentation for wxFrame class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxFrame
|
||||||
|
@wxheader{frame.h}
|
||||||
|
|
||||||
|
A frame is a window whose size and position can (usually) be changed by the
|
||||||
|
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
|
||||||
|
a frame or dialog.
|
||||||
|
|
||||||
|
A frame that has a status bar and toolbar created via the
|
||||||
|
CreateStatusBar/CreateToolBar functions manages these windows, and adjusts the
|
||||||
|
value returned by GetClientSize to reflect the remaining size available to
|
||||||
|
application windows.
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxDEFAULT_FRAME_STYLE}:
|
||||||
|
Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER |
|
||||||
|
wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN.
|
||||||
|
@style{wxICONIZE}:
|
||||||
|
Display the frame iconized (minimized). Windows only.
|
||||||
|
@style{wxCAPTION}:
|
||||||
|
Puts a caption on the frame.
|
||||||
|
@style{wxMINIMIZE}:
|
||||||
|
Identical to wxICONIZE. Windows only.
|
||||||
|
@style{wxMINIMIZE_BOX}:
|
||||||
|
Displays a minimize box on the frame.
|
||||||
|
@style{wxMAXIMIZE}:
|
||||||
|
Displays the frame maximized. Windows only.
|
||||||
|
@style{wxMAXIMIZE_BOX}:
|
||||||
|
Displays a maximize box on the frame.
|
||||||
|
@style{wxCLOSE_BOX}:
|
||||||
|
Displays a close box on the frame.
|
||||||
|
@style{wxSTAY_ON_TOP}:
|
||||||
|
Stay on top of all other windows, see also wxFRAME_FLOAT_ON_PARENT.
|
||||||
|
@style{wxSYSTEM_MENU}:
|
||||||
|
Displays a system menu.
|
||||||
|
@style{wxRESIZE_BORDER}:
|
||||||
|
Displays a resizeable border around the window.
|
||||||
|
@style{wxFRAME_TOOL_WINDOW}:
|
||||||
|
Causes a frame with a small titlebar to be created; the frame does
|
||||||
|
not appear in the taskbar under Windows or GTK+.
|
||||||
|
@style{wxFRAME_NO_TASKBAR}:
|
||||||
|
Creates an otherwise normal frame but it does not appear in the
|
||||||
|
taskbar under Windows or GTK+ (note that it will minimize to the
|
||||||
|
desktop window under Windows which may seem strange to the users
|
||||||
|
and thus it might be better to use this style only without
|
||||||
|
wxMINIMIZE_BOX style). In wxGTK, the flag is respected only if GTK+
|
||||||
|
is at least version 2.2 and the window manager supports
|
||||||
|
_NET_WM_STATE_SKIP_TASKBAR hint. Has no effect under other
|
||||||
|
platforms.
|
||||||
|
@style{wxFRAME_FLOAT_ON_PARENT}:
|
||||||
|
The frame will always be on top of its parent (unlike
|
||||||
|
wxSTAY_ON_TOP). A frame created with this style must have a
|
||||||
|
non-@NULL parent.
|
||||||
|
@style{wxFRAME_EX_CONTEXTHELP}:
|
||||||
|
Under Windows, puts a query button on the caption. When pressed,
|
||||||
|
Windows will go into a context-sensitive help mode and wxWidgets
|
||||||
|
will send a wxEVT_HELP event if the user clicked on an application
|
||||||
|
window. Note that this is an extended style and must be set by
|
||||||
|
calling SetExtraStyle before Create is called (two-step
|
||||||
|
construction). You cannot use this style together with
|
||||||
|
wxMAXIMIZE_BOX or wxMINIMIZE_BOX, so you should use
|
||||||
|
wxDEFAULT_FRAME_STYLE ~ (wxMINIMIZE_BOX | wxMAXIMIZE_BOX) for the
|
||||||
|
frames having this style (the dialogs don't have a minimize or a
|
||||||
|
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}:
|
||||||
|
On Mac OS X, frames with this style will be shown with a metallic
|
||||||
|
look. This is an extra style.
|
||||||
|
@endStyleTable
|
||||||
|
|
||||||
|
@library{wxcore}
|
||||||
|
@category{managedwnd}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxMDIParentFrame, wxMDIChildFrame, wxMiniFrame, wxDialog
|
||||||
|
*/
|
||||||
|
class wxFrame : public wxTopLevelWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Constructor, creating the window.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
The window parent. This may be @NULL. If it is non-@NULL, the frame will
|
||||||
|
always be displayed on top of the parent window on Windows.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The window identifier. It may take a value of -1 to indicate a default value.
|
||||||
|
|
||||||
|
@param title
|
||||||
|
The caption to be displayed on the frame's title bar.
|
||||||
|
|
||||||
|
@param pos
|
||||||
|
The window position. The value wxDefaultPosition indicates a default position, chosen by
|
||||||
|
either the windowing system or wxWidgets, depending on platform.
|
||||||
|
|
||||||
|
@param size
|
||||||
|
The window size. The value wxDefaultSize indicates a default size, chosen by
|
||||||
|
either the windowing system or wxWidgets, depending on platform.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style. See wxFrame.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The name of the window. This parameter is used to associate a name with the
|
||||||
|
item,
|
||||||
|
allowing the application user to set Motif resource values for
|
||||||
|
individual windows.
|
||||||
|
|
||||||
|
@remarks For Motif, MWM (the Motif Window Manager) should be running for
|
||||||
|
any window styles to work (otherwise all styles take
|
||||||
|
effect).
|
||||||
|
|
||||||
|
@sa Create()
|
||||||
|
*/
|
||||||
|
wxFrame();
|
||||||
|
wxFrame(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
|
const wxString& name = "frame");
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor. Destroys all child windows and menu bar if present.
|
||||||
|
*/
|
||||||
|
~wxFrame();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Centres the frame on the display.
|
||||||
|
|
||||||
|
@param direction
|
||||||
|
The parameter may be wxHORIZONTAL, wxVERTICAL or wxBOTH.
|
||||||
|
*/
|
||||||
|
void Centre(int direction = wxBOTH);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Used in two-step frame construction. See wxFrame()
|
||||||
|
for further details.
|
||||||
|
*/
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
|
const wxString& name = "frame");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a status bar at the bottom of the frame.
|
||||||
|
|
||||||
|
@param number
|
||||||
|
The number of fields to create. Specify a
|
||||||
|
value greater than 1 to create a multi-field status bar.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The status bar style. See wxStatusBar for a list
|
||||||
|
of valid styles.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The status bar window identifier. If -1, an identifier will be chosen by
|
||||||
|
wxWidgets.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The status bar window name.
|
||||||
|
|
||||||
|
@returns A pointer to the status bar if it was created successfully, @NULL
|
||||||
|
otherwise.
|
||||||
|
|
||||||
|
@remarks The width of the status bar is the whole width of the frame
|
||||||
|
(adjusted automatically when resizing), and the
|
||||||
|
height and text size are chosen by the host windowing
|
||||||
|
system.
|
||||||
|
|
||||||
|
@sa SetStatusText(), OnCreateStatusBar(), GetStatusBar()
|
||||||
|
*/
|
||||||
|
virtual wxStatusBar* CreateStatusBar(int number = 1,
|
||||||
|
long style = 0,
|
||||||
|
wxWindowID id = -1,
|
||||||
|
const wxString& name = "statusBar");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a toolbar at the top or left of the frame.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The toolbar style. See wxToolBar for a list
|
||||||
|
of valid styles.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The toolbar window identifier. If -1, an identifier will be chosen by
|
||||||
|
wxWidgets.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The toolbar window name.
|
||||||
|
|
||||||
|
@returns A pointer to the toolbar if it was created successfully, @NULL
|
||||||
|
otherwise.
|
||||||
|
|
||||||
|
@remarks By default, the toolbar is an instance of wxToolBar (which is
|
||||||
|
defined to be a suitable toolbar class on each
|
||||||
|
platform, such as wxToolBar95). To use a different
|
||||||
|
class, override OnCreateToolBar().
|
||||||
|
|
||||||
|
@sa CreateStatusBar(), OnCreateToolBar(), SetToolBar(),
|
||||||
|
GetToolBar()
|
||||||
|
*/
|
||||||
|
virtual wxToolBar* CreateToolBar(long style = wxBORDER_NONE | wxTB_HORIZONTAL,
|
||||||
|
wxWindowID id = -1,
|
||||||
|
const wxString& name = "toolBar");
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the origin of the frame client area (in client coordinates). It may be
|
||||||
|
different from (0, 0) if the frame has a toolbar.
|
||||||
|
*/
|
||||||
|
wxPoint GetClientAreaOrigin();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the menubar currently associated with the frame (if any).
|
||||||
|
|
||||||
|
@sa SetMenuBar(), wxMenuBar, wxMenu
|
||||||
|
*/
|
||||||
|
wxMenuBar* GetMenuBar();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the status bar currently associated with the frame (if
|
||||||
|
any).
|
||||||
|
|
||||||
|
@sa CreateStatusBar(), wxStatusBar
|
||||||
|
*/
|
||||||
|
wxStatusBar* GetStatusBar();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the status bar pane used to display menu and toolbar help.
|
||||||
|
|
||||||
|
@sa SetStatusBarPane()
|
||||||
|
*/
|
||||||
|
int GetStatusBarPane();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a pointer to the toolbar currently associated with the frame (if any).
|
||||||
|
|
||||||
|
@sa CreateToolBar(), wxToolBar, SetToolBar()
|
||||||
|
*/
|
||||||
|
wxToolBar* GetToolBar();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Virtual function called when a status bar is requested by CreateStatusBar().
|
||||||
|
|
||||||
|
@param number
|
||||||
|
The number of fields to create.
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The window style. See wxStatusBar for a list
|
||||||
|
of valid styles.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The window identifier. If -1, an identifier will be chosen by
|
||||||
|
wxWidgets.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The window name.
|
||||||
|
|
||||||
|
@returns A status bar object.
|
||||||
|
|
||||||
|
@remarks An application can override this function to return a different
|
||||||
|
kind of status bar. The default implementation
|
||||||
|
returns an instance of wxStatusBar.
|
||||||
|
|
||||||
|
@sa CreateStatusBar(), wxStatusBar.
|
||||||
|
*/
|
||||||
|
virtual wxStatusBar* OnCreateStatusBar(int number, long style,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Virtual function called when a toolbar is requested by CreateToolBar().
|
||||||
|
|
||||||
|
@param style
|
||||||
|
The toolbar style. See wxToolBar for a list
|
||||||
|
of valid styles.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The toolbar window identifier. If -1, an identifier will be chosen by
|
||||||
|
wxWidgets.
|
||||||
|
|
||||||
|
@param name
|
||||||
|
The toolbar window name.
|
||||||
|
|
||||||
|
@returns A toolbar object.
|
||||||
|
|
||||||
|
@remarks An application can override this function to return a different
|
||||||
|
kind of toolbar. The default implementation returns
|
||||||
|
an instance of wxToolBar.
|
||||||
|
|
||||||
|
@sa CreateToolBar(), wxToolBar.
|
||||||
|
*/
|
||||||
|
virtual wxToolBar* OnCreateToolBar(long style, wxWindowID id,
|
||||||
|
const wxString& name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Simulate a menu command.
|
||||||
|
|
||||||
|
@param id
|
||||||
|
The identifier for a menu item.
|
||||||
|
*/
|
||||||
|
void ProcessCommand(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function sends a dummy @ref overview_wxsizeevent "size event" to the frame
|
||||||
|
forcing it to reevaluate its children positions. It is sometimes useful to call
|
||||||
|
this function after adding or deleting a children after the frame creation or
|
||||||
|
if a child size changes.
|
||||||
|
|
||||||
|
Note that if the frame is using either sizers or constraints for the children
|
||||||
|
layout, it is enough to call wxWindow::Layout directly and
|
||||||
|
this function should not be used in this case.
|
||||||
|
*/
|
||||||
|
void SendSizeEvent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tells the frame to show the given menu bar.
|
||||||
|
|
||||||
|
@param menuBar
|
||||||
|
The menu bar to associate with the frame.
|
||||||
|
|
||||||
|
@remarks If the frame is destroyed, the menu bar and its menus will be
|
||||||
|
destroyed also, so do not delete the menu bar
|
||||||
|
explicitly (except by resetting the frame's menu bar
|
||||||
|
to another frame or @NULL).
|
||||||
|
|
||||||
|
@sa GetMenuBar(), wxMenuBar, wxMenu.
|
||||||
|
*/
|
||||||
|
void SetMenuBar(wxMenuBar* menuBar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Associates a status bar with the frame.
|
||||||
|
|
||||||
|
@sa CreateStatusBar(), wxStatusBar, GetStatusBar()
|
||||||
|
*/
|
||||||
|
void SetStatusBar(wxStatusBar* statusBar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the status bar pane used to display menu and toolbar help.
|
||||||
|
Using -1 disables help display.
|
||||||
|
*/
|
||||||
|
void SetStatusBarPane(int n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the status bar text and redraws the status bar.
|
||||||
|
|
||||||
|
@param text
|
||||||
|
The text for the status field.
|
||||||
|
|
||||||
|
@param number
|
||||||
|
The status field (starting from zero).
|
||||||
|
|
||||||
|
@remarks Use an empty string to clear the status bar.
|
||||||
|
|
||||||
|
@sa CreateStatusBar(), wxStatusBar
|
||||||
|
*/
|
||||||
|
virtual void SetStatusText(const wxString& text, int number = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the widths of the fields in the status bar.
|
||||||
|
|
||||||
|
@param n
|
||||||
|
The number of fields in the status bar. It must be the
|
||||||
|
same used in CreateStatusBar.
|
||||||
|
|
||||||
|
@param widths
|
||||||
|
Must contain an array of n integers, each of which is a status field width
|
||||||
|
in pixels. A value of -1 indicates that the field is variable width; at least
|
||||||
|
one
|
||||||
|
field must be -1. You should delete this array after calling SetStatusWidths.
|
||||||
|
|
||||||
|
@remarks The widths of the variable fields are calculated from the total
|
||||||
|
width of all fields, minus the sum of widths of the
|
||||||
|
non-variable fields, divided by the number of
|
||||||
|
variable fields.
|
||||||
|
*/
|
||||||
|
virtual void SetStatusWidths(int n, int * widths);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Associates a toolbar with the frame.
|
||||||
|
*/
|
||||||
|
void SetToolBar(wxToolBar* toolBar);
|
||||||
|
};
|
||||||
119
interface/fs_mem.h
Normal file
119
interface/fs_mem.h
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fs_mem.h
|
||||||
|
// Purpose: documentation for wxMemoryFSHandler class
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxMemoryFSHandler
|
||||||
|
@wxheader{fs_mem.h}
|
||||||
|
|
||||||
|
This wxFileSystem handler can store arbitrary
|
||||||
|
data in memory stream and make them accessible via URL. 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 "memory:", e.g. "memory:myfile.html".
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
@code
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "logo.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void MyFrame::OnAbout(wxCommandEvent&)
|
||||||
|
{
|
||||||
|
wxBusyCursor bcur;
|
||||||
|
wxFileSystem::AddHandler(new wxMemoryFSHandler);
|
||||||
|
wxMemoryFSHandler::AddFile("logo.pcx", wxBITMAP(logo), wxBITMAP_TYPE_PCX);
|
||||||
|
wxMemoryFSHandler::AddFile("about.htm",
|
||||||
|
"htmlbodyAbout: "
|
||||||
|
"img src=\"memory:logo.pcx\"/body/html");
|
||||||
|
|
||||||
|
wxDialog dlg(this, -1, wxString(_("About")));
|
||||||
|
wxBoxSizer *topsizer;
|
||||||
|
wxHtmlWindow *html;
|
||||||
|
topsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
html = new wxHtmlWindow(, -1, wxDefaultPosition,
|
||||||
|
wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
|
||||||
|
html-SetBorders(0);
|
||||||
|
html-LoadPage("memory:about.htm");
|
||||||
|
html-SetSize(html-GetInternalRepresentation()-GetWidth(),
|
||||||
|
html-GetInternalRepresentation()-GetHeight());
|
||||||
|
topsizer-Add(html, 1, wxALL, 10);
|
||||||
|
topsizer-Add(new wxStaticLine(, -1), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||||
|
topsizer-Add(new wxButton(, wxID_OK, "Ok"),
|
||||||
|
0, wxALL | wxALIGN_RIGHT, 15);
|
||||||
|
dlg.SetAutoLayout(@true);
|
||||||
|
dlg.SetSizer(topsizer);
|
||||||
|
topsizer-Fit();
|
||||||
|
dlg.Centre();
|
||||||
|
dlg.ShowModal();
|
||||||
|
|
||||||
|
wxMemoryFSHandler::RemoveFile("logo.pcx");
|
||||||
|
wxMemoryFSHandler::RemoveFile("about.htm");
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{FIXME}
|
||||||
|
|
||||||
|
@seealso
|
||||||
|
wxMemoryFSHandler::AddFileWithMimeType
|
||||||
|
*/
|
||||||
|
class wxMemoryFSHandler : public wxFileSystemHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
*/
|
||||||
|
wxMemoryFSHandler();
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Add file to list of files stored in memory. Stored
|
||||||
|
data (bitmap, text or raw data)
|
||||||
|
will be copied into private memory stream and available under
|
||||||
|
name "memory:" + @e filename.
|
||||||
|
|
||||||
|
The @e type argument is one of @c wxBITMAP_TYPE_XXX constants.
|
||||||
|
Note that you must use a @e type value (aka image format)
|
||||||
|
that wxWidgets can save (e.g. JPG, PNG, see wxImage
|
||||||
|
documentation)!
|
||||||
|
|
||||||
|
@sa AddFileWithMimeType()
|
||||||
|
*/
|
||||||
|
static void AddFile(const wxString& filename, wxImage& image,
|
||||||
|
long type);
|
||||||
|
static void AddFile(const wxString& filename,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
long type);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Like AddFile(), but lets you explicitly
|
||||||
|
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 function is new since wxWidgets version 2.8.5
|
||||||
|
|
||||||
|
@sa AddFile()
|
||||||
|
*/
|
||||||
|
static void AddFileWithMimeType(const wxString& filename,
|
||||||
|
const wxString& textdata,
|
||||||
|
const wxString& mimetype);
|
||||||
|
static void AddFileWithMimeType(const wxString& filename,
|
||||||
|
const void* binarydata,
|
||||||
|
size_t size,
|
||||||
|
const wxString& mimetype);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Remove file from memory FS and free occupied memory.
|
||||||
|
*/
|
||||||
|
static void RemoveFile(const wxString& filename);
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user