Xathrya Sabertooth |
Posted: 20 May 2013 03:07 AM PDT After learning some wxWidgets basic, lets open new article for discussing a simple application. In this article we will cover a basic in creating a wxWidget frame and show how to display an icon. Next we will create a simple example demonstrating usage of an event. Finally, we will see, how widgets communicate in wxWidgets applications. A simple applicationFirst we create the very basic wxWidgets program. /** filename: simple.h **/ #include <wx/wx.h> class Simple : public wxFrame }; /** filename: simple.cpp **/ #include "simple.h" Simple::Simple(const wxString& title) /** filename: main.h **/ class MyApp : public wxApp /** filename: main.cpp **/ IMPLEMENT_APP(MyApp) bool MyApp::OnInit() return true; a | ||||||||
Getting Started with wxWidgets Posted: 20 May 2013 03:02 AM PDT People who are completely new to wxWidgets would normally follow the steps illustrated below. In this article we will set our environment for developing a wxWidget application. Installing wxWidgets and Setting up IDEWhen developing application using wxWidget, we can choose whether use helping from IDE or not. For an overview of IDEs that have been reported to work with wxWidgets, you can see the list of IDEs on wxWidgets site. We won’t cover installation of any IDE in this section, but I would recommend you to install one. Your main guide for compiling wxWidgets should be the installation instructions : Look in <code-base-dir>/docs/. On Windows<to be continued> On LinuxGetting StartedBefore getting started, make sure you have installed all necessary build tools, including g++ and autotools. You will also need gtk+ library. It is recommended to use at least GTK+ 2.2.3, and some features are only available when using more recent version, like GTK+ 2.8. Building and InstallationDownload the wxWidget source archive from http://www.wxwidgets.org/downloads/. The latest development is recommended, and when writing this article, the latest version is version 2.9.4. You will need to call configure to configure the compilation setting. It is also recommended to enable unicode support for wxWidgets. ./configure --enable-unicode However, if you want to compile wxWidgets on a 64-bit version of Linux in such a way that the library can be linked to both statically and dynamically, then you want to add the -fPIC flag to the configure call. That is done in the following way: ./configure --enable-unicode CFLAGS="-fPIC" CXXFLAGS="-fPIC" The options you pass to configure at this point will determine what build you get.
A list of all possible options can be seen using ./configure –help command. If it stops saying it can’t find a package, install it (with -dev packages if any) and run configure again. When it is done without errors, you are ready to build. When the build is done, and if no error occured, you can now install it. You also need root privileges to install it. make make install Enter your password as needed. wxWidgets will be installed in /usr/local/ On some systems it is also necesary to run sudo ldconfig at this point. Compile an ApplicationThe tool wx-config allows you to quickly build wxWidgets apps g++ `wx-config --cppflags` `wx-config --libs` widgetTest.cpp wx-config –cppflags returns flags necessary to compilation, wx-config –libs returns flags necessary to linking. This little example has a single file so both are used at the same time but in a bigger project compiling and linking will most likely be two different steps. (How to use g++ is beyond the scope of this document) For more information, see article Wx-Config. On Mac OS<to be continued> |
You are subscribed to email updates from Xathrya Sabertooth To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
Tidak ada komentar:
Posting Komentar