wxWidgets Contributions

wxWidgets is a great portable GUI library. Here are some various wxWidgets Contributions

 

These contributions are published under wxWindows licence (based on L-GPL).

wxRectTracker

This is a tracker similar to the MFC CRectTracker. It is basically a selection rectangle with dragging capabilites, to set its size and position.

Documentation generated by Doxygen is provided.

Thus this class needs a little refactoring, it can be derivated easily, by example in another class wxLineTracker, which does the same thing, but with a line instead of a rectangle.

Download source zip

wxRectTracker is used in RPhoto and in wxCommander

wxConfigDialog

wxConfigDialog is a basic configuration system, for developer who does not want to spend much time in building configuration dialogs.
wxConfigDialog handles automatically :

  • save / restore of settings with wxConfig
  • build a default dialog with tabs, according to the wxConfig settings

Code example :

Download source zip

wxStringBase64

wxStr64 is a extension to wxString, to help using strings encoded in base64. It does not use the wxEncodingConverter style, because it was mainly developped to store data buffers which may contain the null char in wxString objects.

For instance, I use wxStringBase64 to store Exif data in wxString, which may contain null char. Storing these data in wxString avoid subclassing wxImage, what would be rather complicated.

Download source zip

Patches

Here are some “patches”. Note : it is not regular patch, but more code snippets to solve the problem. I will probably soon submit them as regular patches to wxWidgets.

wxGenericDirCtrl

Bug #866387 : wxGenericDirCtrl does not accept multiple wildcards

wxGenericDirCtrl did not accept multiple wildcards as in “Images (*.jpg;*.png;*.tif)”.

Replace the existing code in wxGenericDirCtrl::ExpandDir

This patch has been incorporated in wx2.6. If you use wx2.4 and do not want to recompile it, you can use wxFixedDirCtrl (and #define it) instead.

Bug # : display drive labels name in wxGenericDirCtrl on wxMSW

This is to display the drive label in the tree “(C:) WinXP” instead of only the drive letter “(C:)”.

Insert the following snippet after the switch(driveType) in wxGenericDirCtrl::SetupSections()

Bug # : option to have wildcard not case sensitive

Currently, wxGenericDirCtrl would not show IMG0001.JPG with the filter *.jpg .

wxJPEGHandler

If you load and save a jpeg file with the current JPEG handler, you will lose all additionnal informations like Exif, IPTC, comments…
A solution is to store these additionnal info in options (see wxImage::SetOption()). The options will be name “APP1” for Exif, “COM” for comments, and “APP2”..“APP15” for other info.Here are code snippets to solve this :

In wxJPEGHandler::LoadFile between jpeg_create_decompress and jpeg_read_header :

and after jpeg_destroy_decompress :

In wxJPEGHandler::SaveFile after jpeg_start_compress :

You will need wxStringBase64. To help integration, I made a new handler wxEJPGHandler. Juste put the two files, and register it in your application OnInit() :

Download source zip

wxImage

Bug # : Options not copied when copying o wxImage

When copying or creating a new image from another, the current implementation of wxImage does not copy the options strings. Thus, all options will be lost when rotating, getting a sub image, and so on.

As wxImage is very hard to subclass (because of m_refData), I prefer a simple helper class (included in wxEJPGHandler::wxImageOpt), to use in applications. I will provide a wxImage patch later.

To use it, define somewhere in your application

And before / after each image operation :

Header :

Code :

Bug # : Difficult access to wxImage options

These properties are in private scope (Grrr, use protected instead, to allow easy patch-subclassing !).
It is so impossible to know which options are defined.

Patch TODO : add GetOptions() which returns the wxList of keys.

Useful informations

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu