Разработка кроссплатформенных модульных приложений на C++ с библиотекой wxWidgets

Введение

Уже долгое время не пишу статьи о разработке, хотя сам процесс написания мне очень нравится и позволяет привести мысли в порядок. И все от того, что все это время был занят разработкой довольно интересного проекта.

Но вот, есть возможность сейчас рассказать о наработках, которые появились за последнее время. Надеюсь, кому-то этот текст сильно упростит жизнь и даст толчок к покорению новых вершин.

В этот раз речь пойдет о создании кроссплатформенных приложений с плагинами на C++ с использованием библиотеки wxWidgets. Рассматриваться будут операционные системы Windows, Linux и OS X, как наиболее популярные.

Как обычно, первая часть будет обзорной, для того, чтобы снизить порог входа для читателей. Кому-то информация из первой части покажется очевидной (особенно то, что касается инструментария), но, все же, я считаю ее необходимой, ибо для новичков информация из первой части позволит с минимальными усилиями организовать процесс разработки.
Continue reading…

wxWidgets App With Plugins (Windows/Linux/Mac) – Sample Source Code

I can see that there is still a lot of topics at wxWidgets forums related to usage of shared libs or plugins with wxWidgets apps on different platform.

For Windows it’s not hard to implement such app but on Linux and OS X this may be quite tricky (especially when you are not planning to use installer for your app and create the app which will work on different machines without need to recompile it).

So, specially for those, who still has problems with implementation of plugins for wxWidgets apps, I created the sample which compiles and runs on all 3 platforms, has 2 types of plugins (with and without GUI), creates the relocatable application where all plugins and other libs search for dependencies using relative paths which means that you don’t need to rebuild the app on different machines to make it work.

You can find the complete source code at GitHub: Modular wxWidgets Application with Plugins

The project is under development since I’m writing an article about this in parallel, so you are welcome to follow the project at GitHub and try the new versions.


Features which I plan to add in nearest updates:

  • Embedding of wxWidgets libs into OS X Bundle
  • Embedding of wxWidgets libs into application’s distro for Linux
  • Document/View: Support of different file formats using plugins
  • Communication between plugins

So, stay tuned, start watching the project at GitHub!

wxToolBox is Now Open-Source!

I’ve just published the source code of wxToolBox component and a couple of sample apps at GitHub: https://github.com/T-Rex/wxToolBox
There is a working minimal sample and `Sample IDE` app with source code, Skin Editor does not compile with new version of wxPropertyGrid and I’m not currently interested in updating the source code. The working binary version for Windows can be downloaded from this page (also attached to this post): http://wxtoolbox.wxwidgets.info/docs/index.html

The source code is free for commercial and non-commercial use (component and demo apps).
However if anybody still wants to buy me a beer or smth, you can make a kind of `donation` through ShareIt: http://tinyurl.com/kywtdj6

SkinEditor

wxtoolbox-skins

wxToolBoxSkinEditor Binary for Windows

Microsoft Kinect Helper Library and Sample for wxWidgets

Microsoft released their Kinect SDK several days ago.
So, for those wxWidgets developers who are interested in development of Kinect-powered applications, I created a small wxWidgets-based helper library and sample application which will allow to start using Kinect SDK.

wxKinectHelper project is hosted at Google Code.

For now only basic functionality is available:

  • Retreiving the list of installed Kinect devices
  • Retrieving the IDs of devices
  • Starting/Stopping of frame grabbing
  • Grabbing depth images

If you are willing to help with implementation of new features then just let me know. I will appreciate any help in improvement of current functionality.

PS: To test the application and library you need to have Kinect device for sure.

wxJSON 1.1.0 Released

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition – December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.

The wxJSON library is a complete implementation of the JSON data-interchange format. All JSON specifications are implemented in this library plus some extensions in the writer and in the parser class.

Today wxJSON 1.1.0 was announced. This release is compatible with both wxWidgets 2.8 and 2.9. It is also compatible with wxWidgets SVN HEAD. Now JSON reader and writer only process UTF-8 encoded text as a stream.
Also added a new wxJSONValue’s member function to get values and fixed the bugs in wxJSONValue::IsSameAs()

wxRuby. Оно даже работает!

Вдохновленнный читаемой нынче книгой My Job Went to India: 52 Ways to Save Your Job решил покорять новые горизонты. Наткнулся несколько дней назад на вводную статью о wxRuby и сегодня решил попробовать. Оказывается это не так страшно.
Continue reading…

Дааа! Ribbon Bar для wxWidgets не за горами!

Надо же,в wxBlog такое рассказывают. Оказывается Google Summer of Code для wxWidgets принес много полезного в этом году. Обещают поддержку нотификаций об изменениях файловой системы – wxFSWatcher, а также (внимание!) Ribbon для wxWidgets – wxRibbonBar. А еще…. апгрейды всевозможные для wxAUI (жду не дождусь collapsible panes и tabbed docking).

Все это будет в svn trunk и не факт что появится в ветке 2.8. Так что “кто куды, а мы к зайцам” (с), пойду качать svn trunk. Там кстати еще много чего полезного появилось. Если вы пользуетесь стабильной версией 2.8, рекомендую хотя бы попробовать trunk.

Еще вскользь упомянули, что потихоньку развивается wxSymbian и wxQNX. Порт для Symbian мне кажется очень перспективным, да.

Cross-Platform Way of Obtaining MAC Address of Your Machine

In one of my current projects I had to implement client-server communication and protection by MAC address when client machine can’t connect to server if its MAC address is not allowed, regardless of network or broadband connection. But what was a surprise that wxWidgets does not have API which allows obtaining MAC address in cross-platform way. So, I decided to write a small class which allows obtainig MAC address for Windows, Linux, Mac OS and Windows Mobile. Here it is:
Continue reading…

Taking Screenshots with wxWidgets under Mac OS is Really Tricky.

Taking screenshots is a very common task and it was a must for one of my current projects. What was a surprise when I understood that my favourite toolkit can’t do that in cross-platform manner.

It is official bug that wxScreenDC does not work properly under Mac OS and you can’t use Blit() message for copying screen onto wxMemoryDC.

After digging the Internet I found a kind of solution which used OpenGL and created wxWidgets-based class which takes screenshots also under Mac OS. It was really hard task for me because I haven’t used neither Carbon nor Cocoa before. However everything works now and I’m happy.

Here it is:
Continue reading…

AxTk: An Accessibility Toolkit for wxWidgets

http://code.google.com/p/axtk/

What is AxTk?

AxTk (pronounced Ay Ex Tee Kay) is an open source, C++ add-on for wxWidgets that helps developers create highly accessible, talking applications for users with impaired vision. It may also be useful for other impairments that benefit from a simplified user interface.

AxTk features a new menu-based system that is easy to learn and use, in addition to providing adaptation for some existing GUI controls and dialogs. The developer can choose whether to use the menu system, or to adapt an existing application UI, or use a combination of methods.

AxTk is cross-platform (tested so far on Windows XP, Linux and Mac OS X 10.5), and includes text-to-speech classes with the ability to drive SAPI 5, Apple Speech Synthesis Manager, eSpeak, and Cepstral. Other speech engines can be driven by writing additional handlers.

Note that AxTk is a work in progress and the API is subject to change.
Continue reading…