[root]
WxWidgetsExtensions Library
Overview
Extended dialog class
-
wxExtDialog class eases
creating and adding controls
-
adaptions to work with a MFC main window (under MSW,
requires small modifications to wxWidgets library)
-
simple support for dialog zoom
-
simplification of control-change notification
New message box class
-
wxMessageExtDialog has support
for arbitrary named buttons
-
support for automatic line-wrap and use of scrollbars in
case of long message texts
-
optional HTML mode: it is possible to display HTML messages
Type-safe printf() replacement
-
wxMessageFormatter/wxFormat/wxFormatMessage provide
type-safe string formatting similar to printf
-
unlike with the C++ stream operator "<<", the format
string must not be split up into pieces
-
parameters are added with the "%" operator to wxMessageFormatter, alternatively, the
overloaded function
wxFormatMessage() can be used
-
format string refers to parameters with "%N" or "%{N}"
(with N being the N-th parameter added) - this makes it
possible to reorder parameters in the output, which may be
useful when translating the format string to other
languages
-
"%+" may be used to refer to the "next" parameter
Helper functions
-
convertAsciiToHtml() to escape
HTML control characters
-
formatDate() /parseDate() to correctly output and parse
dates in the current locale
-
load (e.g. PNG) images from memory or Windows resource file
Validators with immediate status output
-
wxTextCtrlStatusValidator
gives immediate feedback of validity of entered text via
wxStatusMessageTarget (which output a status message into a
wxTextCtrl)
-
has support for "Undefined" (unspecified) values
-
specializations:
-
wxNumberValidator (allows
specification of a range of valid values (int, long or
double))
-
wxDateTimeValidator
(format according to current locale, currently date
only)
-
wxStringValidator (a
maximum length for the entered string can be specified)
Text/slider control pair validators
-
allow mutual update if one of both associated controls
(wxTextCtrl or wxSlider) is changed by users input
-
if entered text is valid: associated slider is updated
immediately; otherwise the user will get immediate feedback
via wxStatusMessageTarget (class is is derived from
wxNumberValidator/wxTextCtrlStatusValidator)
-
both required controls and both required validators can be
created with minimum effort by calling
wxExtDialog::addTextCtrlSliderPairWithLabel()
Image(DIB) filter managing class
-
wxFilteredDIB provides an
interface to filter a DIB image using ImageMagick filter
functions (the input and result image format is DIB)
-
automatic transformation of palette-based or 16-Bit color
DIBs to true color IM image if filtering is desired
-
for palette-based images, color adjustment is realized by
modifying the palette in-place, which is much faster than
modifying all pixels - the old palette is stored
automatically for a later undo or a new modification
-
image rotation must be 0, 90, 180 or 270 degree - if only
the rotation angle (or mirroring) has changed since last
filtering, rotation/mirroring will be made relative to the
last result (improves performance)
Type-safe access to entries in wxConfig
-
wxConfigEntry and wxConfigEntryManager allow typesafe
reading/writing of values from/to wxConfig
-
keys (access paths) and default values are centralized in
the wxConfigEntry objects and therefore duplication can be
avoided
-
allows writing all values at once (e.g. upon program
termination, or to give the user an overview of all
sections/keys and their (default) values
-
allows to reset to default values at once
-
specializations of wxConfigEntry class:
-
wxIntegerConfigEntry
(range of valid values can be specified)
-
wxStringConfigEntry
-
wxBooleanConfigEntry
Sample Application
WxExtLib comes with a sample application to demonstrate some of
the features of the library. Some
screenshots are available.
Compilation
To use WxExtLib in an existing wxWidgets application, it is
probably sufficient to add the files to the existing project-
or makefiles.
To compile the sample application, one of the provided
makefiles may be used. Most makefiles were generated by
'bdsgen', a makefile generator written by me using C++ as
input and implementation language, which is planned to be
published under an Open Source license in the future.
The sample program was tested under a Debian Linux (wxGTK,
wxMOTIF and wxX11 ports) and under Win9x/WinNT4/WinXP (wxMSW
port). Specifically, the following compiler/port combinations
were tested:
-
GCC 2.95.2 with wxGTK (using GTK 1.2.7), wxMOTIF and
wxX11/wxUniversal
-
Visual C++ 6 with wxMSW
-
DigitalMars C++ 8.40 with wxMSW
-
Borland C++ 5.5.1 with wxMSW
The following wxWidgets versions were used:
-
wxWidgets 2.4.1 (stable release)
-
wxWidgets 2.5.2 (development snapshot)
To compile with the makefiles, create a sub-directory like
'my-build', change into this directory and then run '(n)make -f
MAKEFILE ...'. Makefile-variables like 'WxWidgetsPrefix',
'WxWidgetsBuildPrefix', 'SourceDir' etc. must be set. Use the
'_checks' pseudo-target to run some tests on the provided paths
first. An example and additional notes are contained as
comments at the beginning of the makefiles.
Note: For compilation under Linux, the
makefiles currently assume the 'wx-config' program to be
located at '${WxWidgetsBuildPrefix}' (as is the case after
compiling wxWidgets from the sources).
To debug an executable compiled with debug-information with
GCC, point a debugger like 'ddd' to the executable; to debug
an executable compiled with debug-information with VC++,
simply open the executable with the Visual C++ IDE.
Problems
-
The layout mechanism in wxWidgets version 2.5.2
(development snapshot) is currently broken under some
ports.
-
Some ports (e.g. wxMSW) of wxWidgets version 2.5.2
(development snapshot) ignore the font set for the dialog.
This results in incorrect sizing when a dialog is scaled
(zoom factor other than 1.0), because the controls will
always use the default font size.
-
The height of the text/HTML control of a wxMessageExtDialog
(in text-mode) is one line only with the wxMSW and
wxX11/wxUniversal ports of wxWidgets version 2.5.2
(development snapshot).
-
The sizing logic for the wxGTK port currently assumes
GTK 1, and must be extended for GTK 2 control
sizes.
Sources and Download
-
individual files
-
tar package (includes makefiles)
Daniel Käps (kaeps at informatik.uni-leipzig.de) /
Jul 21, 2004 /
http://wwwstud.uni-leipzig.de/~mai95cfw/WxExtLib/index.html