<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dalton Filho &#187; C++</title>
	<atom:link href="http://www.daltonfilho.com/category/programming/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.daltonfilho.com</link>
	<description></description>
	<lastBuildDate>Sun, 13 Sep 2009 03:41:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>wxMatisse update #1</title>
		<link>http://www.daltonfilho.com/2008/06/08/wxmatisse-update-1/</link>
		<comments>http://www.daltonfilho.com/2008/06/08/wxmatisse-update-1/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 20:16:26 +0000</pubDate>
		<dc:creator>Dalton Filho</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[wxMatisse]]></category>

		<guid isPermaLink="false">http://www.daltonfilho.com/2008/06/08/wxmatisse-update-1/</guid>
		<description><![CDATA[wxMatisse is finally set up on <a href="https://wxmatisse.dev.java.net/">java.net</a>. Right now only 4 widgets, one top level window and one layout manager is supported. You are more than invited to collaborate! Growing the project is really easy with its current architecture. The next milestone is supporting the maximum number of widgets using null layout on a JFrame.
<p style="text-align: center"><a href="https://wxmatisse.dev.java.net/files/documents/8976/99540/translation_process.png" title="wxMatisse translation process"><img src="http://www.daltonfilho.com/wp-content/uploads/2008/06/translation_process_small.png" alt="wxMatisse translation process" /></a></p>]]></description>
			<content:encoded><![CDATA[<p>wxMatisse is finally set up on <a href="https://wxmatisse.dev.java.net/">java.net</a>. Right now only 4 widgets, one top level window and one layout manager is supported. You are more than invited to collaborate! Growing the project is really easy with its current architecture. The next milestone is supporting the maximum number of widgets using null layout on a JFrame.</p>
<p style="text-align: center"><a href="https://wxmatisse.dev.java.net/files/documents/8976/99540/translation_process.png" title="wxMatisse translation process"><img src="http://www.daltonfilho.com/wp-content/uploads/2008/06/translation_process_small.png" alt="wxMatisse translation process" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.daltonfilho.com/2008/06/08/wxmatisse-update-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing wxMatisse</title>
		<link>http://www.daltonfilho.com/2008/05/25/introducing-wxmatisse/</link>
		<comments>http://www.daltonfilho.com/2008/05/25/introducing-wxmatisse/#comments</comments>
		<pubDate>Sun, 25 May 2008 23:00:39 +0000</pubDate>
		<dc:creator>Dalton Filho</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Matisse]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[wxWidgets]]></category>

		<guid isPermaLink="false">http://www.daltonfilho.com/2008/05/25/introducing-wxmatisse/</guid>
		<description><![CDATA[Towards the end of a <a href="http://www.daltonfilho.com/2008/02/23/wxwidgets-on-windows-using-netbeans-60-with-mingw-msys/" target="_blank">previous post</a> I've exposed my thought of a wxWidgets plugin for NetBeans, more specifically, a plugin for C++ wxWidgets. If you have followed the tutorial through, you've probably realized how difficult it is to set up wxWidgets to be used on Windows using NetBeans. Even after the environment is completely configured, you still lack the power of tools like Matisse to prototype your frames. For now, a simple tool will address this problem: it's called wxMatisse. wxMatisse is a tool that uses windows created by Matisse to create equivalent windows in C++ wxWidgets. ]]></description>
			<content:encoded><![CDATA[<p>Towards the end of a <a href="http://www.daltonfilho.com/2008/02/23/wxwidgets-on-windows-using-netbeans-60-with-mingw-msys/" target="_blank">previous post</a> I&#8217;ve exposed my thought of a wxWidgets plugin for NetBeans, more specifically, a plugin for C++ wxWidgets. If you have followed the tutorial through, you&#8217;ve probably realized how difficult it is to set up wxWidgets to be used on Windows using NetBeans. Even after the environment is completely configured, you still lack the power of tools like Matisse to prototype your frames. For now, a simple tool will address this problem: it&#8217;s called wxMatisse. wxMatisse is a tool that uses windows created by Matisse to create equivalent windows in C++ wxWidgets. The use case is simple: on a window created by Matisse, you select a context menu: &#8220;Create wxWidgets window&#8230;&#8221;. You then decide if you want to use event tables or <code>Connect()</code>, and if you want to use separate header and cpp files, for example. It&#8217;s basically a Swing to wxWidgets translator, but it does not translate Swing code; instead, it reads the windows&#8217; properties and child members to create the wxWidgets equivalent. The samples below demonstrate the pre-alpha capabilities of the translator:</p>
<p><strong>Window created by Matisse (Java)<br />
</strong></p>
<p><img src="http://www.daltonfilho.com/wp-content/uploads/2008/05/matisse.png" alt="Window created by Matisse" /></p>
<p><strong>Window created by wxMatisse (C++)<br />
</strong></p>
<p><img src="http://www.daltonfilho.com/wp-content/uploads/2008/05/wxmatisse.png" alt="wxmatisse.png" /></p>
<p><strong>Code created by Matisse</strong></p>
<pre name="code" class="java">
public class MatisseTest extends javax.swing.JFrame {    

/** Creates new form MatisseTest */
public MatisseTest() {
    initComponents();
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
    button2 = new javax.swing.JButton();
    button1 = new javax.swing.JButton();
    panel1 = new javax.swing.JPanel();
    button3 = new javax.swing.JButton();
    panel2 = new javax.swing.JPanel();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    getContentPane().setLayout(null);
    button2.setLabel("Right button");
    getContentPane().add(button2);
    button2.setBounds(210, 310, 130, 30);
    button1.setLabel("Left button");
    getContentPane().add(button1);
    button1.setBounds(50, 310, 130, 30);
    panel1.setBackground(new java.awt.Color(204, 102, 255));
    panel1.setLayout(null);
    button3.setLabel("North button");
    panel1.add(button3);
    button3.setBounds(20, 20, 250, 60);
    panel2.setBackground(new java.awt.Color(255, 255, 0));
    panel2.setLayout(null);
    panel1.add(panel2);
    panel2.setBounds(20, 100, 250, 130);
    getContentPane().add(panel1);
    panel1.setBounds(50, 40, 290, 250);

    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width-410)/2, (screenSize.height-403)/2, 410, 403);
}//GEN-END:initComponents

// Variables declaration - do not modify//GEN-BEGIN:variables

    private javax.swing.JButton button1;
    private javax.swing.JButton button2;
    private javax.swing.JButton button3;
    private javax.swing.JPanel panel1;
    private javax.swing.JPanel panel2;

// End of variables declaration//GEN-END:variables

}</pre>
<p><strong>Code created by wxMatisse</strong></p>
<pre name="code" class="cpp">
// File created by wxMatisse

#ifndef _MATISSETEST_H
#define _MATISSETEST_H

#include &lt;wx/frame.h&gt;
#include &lt;wx/button.h&gt;
#include &lt;wx/panel.h&gt;

class MatisseTest : public wxFrame { 

public:

	MatisseTest(const wxString &amp;title);

private:

	wxPanel *wxpanel2;

	wxPanel *wxpanel1;

	wxButton *wxbutton1;

	wxButton *wxbutton2;

	wxButton *wxbutton3;

	void initComponents();

	enum {
		WXBUTTON1 = wxID_HIGHEST + 1,
		WXBUTTON2,
		WXBUTTON3,
		WXPANEL1,
		WXPANEL2
	};

};

#endif 	 /* _MATISSETEST_H */</pre>
<pre name="code" class="cpp">
// File created by wxMatisse

#include "matisse.h"

MatisseTest::MatisseTest(const wxString &amp;title) : wxFrame((wxFrame*) NULL, wxID_ANY, title) {
	initComponents();
}

void MatisseTest::initComponents() {
	wxbutton1 = new wxButton(this, WXBUTTON1, _T("Right button"), wxPoint(210, 310), wxSize(130, 30));
	wxbutton2 = new wxButton(this, WXBUTTON2, _T("Left button"), wxPoint(50, 310), wxSize(130, 30));
	wxpanel1 = new wxPanel(this, WXPANEL1, wxPoint(50, 40), wxSize(290, 250));
	wxpanel1-&gt;SetBackgroundColour(wxColour(204, 102, 255));
	wxbutton3 = new wxButton(wxpanel1, WXBUTTON3, _T("North button"), wxPoint(20, 20), wxSize(250, 60));
	wxpanel2 = new wxPanel(wxpanel1, WXPANEL2, wxPoint(20, 100), wxSize(250, 130));
	wxpanel2-&gt;SetBackgroundColour(wxColour(255, 255, 0));
}</pre>
<p>There are still many things to do until I release version 0.1, of course. For now, only null layout is supported. Support for other layout managers will be added in the future. The goal is to be able to translate all windows created by Matisse as long as they use the supported layout managers. As expected, there will be no support for widgets that wxWidgets offers for an operating system exclusively. Unlike Matisse, you will have total freedom to modify the generated code, as there is no coming back from it. The windows that wxMatisse translates need not be created by Matisse: as this translator uses the properties of the window rather than code, it does not rely on any code convention.  As long as the code compiles and runs, the code can be a complete mess that wxMatisse will still work. wxMatisse will be useful for migration projects where code needs to be translated from Java to C++. I will open the wxMatisse project on <a href="http://java.net/" target="_blank">java.net</a> as soon as the project support all the basic widgets in null layout. If you want to collaborate, or if you know anything about NetBeans programming and want to give a hand, you&#8217;re more than welcome to join the project!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daltonfilho.com/2008/05/25/introducing-wxmatisse/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>wxWidgets on Windows using NetBeans 6.0 with MinGW + MSYS</title>
		<link>http://www.daltonfilho.com/2008/02/23/wxwidgets-on-windows-using-netbeans-60-with-mingw-msys/</link>
		<comments>http://www.daltonfilho.com/2008/02/23/wxwidgets-on-windows-using-netbeans-60-with-mingw-msys/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 01:35:09 +0000</pubDate>
		<dc:creator>Dalton Filho</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[MinGW]]></category>
		<category><![CDATA[MSYS]]></category>
		<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[wxWidgets]]></category>

		<guid isPermaLink="false">http://www.daltonfilho.com/2008/02/23/wxwidgets-on-windows-using-netbeans-60-with-mingw-msys/</guid>
		<description><![CDATA[Setting up a wxWidgets project on Windows using NetBeans 6.0 is quite harder than doing the same on Linux, but if you want to be able to use the powerful features of NetBeans instead of smaller IDEs like wxDev-cpp, here is a quick guide to setup your environment.]]></description>
			<content:encoded><![CDATA[<p>Setting up a wxWidgets project on Windows using NetBeans 6.0 is quite harder than doing the same on Linux, but if you want to be able to use the powerful features of NetBeans instead of smaller IDEs like wxDev-cpp, here is a quick guide to setup your environment. The first thing you will need is to setup MinGW and MSYS to compile wxWidgets:</p>
<ol>
<li>Download and install <a href="http://www.mingw.org/download.shtml" title="MinGW download">MinGW</a> if you don&#8217;t already have it. Add MinGW&#8217;s <code>bin</code> subdirectory to your <code>PATH</code> environment variable. Note that if you use Vista, you <em>must</em> override GCC&#8217;s utilities with their corresponding <a href="http://sourceforge.net/project/showfiles.php?group_id=2435&amp;package_id=82723">Vista builds</a>;</li>
<li>Download and install MSYS &#8211; you will need it to compile wxWidgets. Add its bin subdirectory to <code>PATH</code> as you did with MinGW;</li>
<li>Open the MSYS console and navigate to the directory where you extracted wxWidgets (or where the installation put the files from wxWidgets);</li>
<li>Create a directory for your build (<code>mkdir build-static-debug</code>) and navigate to it. You may want to use other names;</li>
<li>Run configure with your preferred options, which may include
<ul>
<li><code>--enable-debug</code> &#8211; enable debugging info</li>
<li><code>--enable-optimise</code> &#8211; create optimised code</li>
<li><code>--disable-shared</code> &#8211; create static libraries (use this unless you want to distribute wxWidgets dlls with your application)</li>
<li><code>--enable-unicode</code> &#8211; compile wxWidgets with unicode support</li>
</ul>
<p>When you are done choosing, enter the configure command. In my build, I used <code>../configure --enable-debug --disable-shared --enable-unicode</code>. After configure is done, it will output the basic options of your build</li>
<li>Run <code>make</code> to build wxWidgets. As this may take quite a while, you may consider doing 100 push-ups to burn the calories of that burrito you&#8217;ve just eaten while following this guide;</li>
<li>Remove object files with <code>rm *.o</code> (you&#8217;re not going to need them);</li>
<li>Run <code>make install</code> to install wxWidgets;</li>
</ol>
<p>This is it for compiling wxWidgets. Now you need to setup a C/C++ project on NetBeans to use what you&#8217;ve just compiled:</p>
<ol>
<li>First of all, make sure NetBeans recognizes your MinGW + MSYS setup. Go to <code>Tools --&gt; Options</code>, then select <code>C/C++</code>. Check if MinGW and MSYS bin subdirectories are listed on the current path list. Add them if they aren&#8217;t. <code>make</code> should be found inside MSYS while <code>gcc</code>, <code>g++</code> and <code>gdb</code> should be found inside MinGW;</li>
<li>Now that NetBeans recognizes your MinGW + MSYS setup, it&#8217;s time to create a new wxWidgets project. Go to <code>File --&gt; New Project...</code> and select <code>C/C++ application</code>;</li>
<li>With your project open, enter the project properties dialog;</li>
<li>Select <code>C/C++ --&gt; C++ Compiler --&gt; General options</code>;</li>
<li>Open the MSYS console and navigate to the directory where you&#8217;ve made your wxWidgets build (e.g. <code>build-static-debug</code>) and enter <code>wx-config --cxxflags.</code><code> wx-config</code> will output the compiler flags for your project. On my machine <code>wx-config --cxxflags</code> outputs <span align="left"> <code><font color="#0000ff"> -I/c/wxWidgets-2.8.7/msw-debug/lib/wx/include/msw-uni<br />
code-debug-static-2.8 -I/c/wxWidgets-2.8.7/include -I/c/wxWidgets-2.8.7/contrib/include</font> <font color="#339966">-D__WXDEBUG__ -D__WXMSW__ -mthreads</font></code></span>. Remember to leave this console open;</li>
<li>Add all directories <font color="#0000ff">preppended with <code>-I</code></font> from <code>wx-config</code> output to the include directories of your project;</li>
<li>Select <code>Command line</code> and put the <font color="#339966">remaining flags</font> from <code>wx-config</code> there;</li>
<li>Now select <code>Linker --&gt; General options</code>;</li>
<li>Back on the MSYS console, type <code>wx-config --libs</code>. <code>wx-config</code> will output the linker flags for your project. On my machine <code>wx-config --libs</code> outputs <code><font color="#0000ff">-L/c/wxWidgets-2.8.7/msw-debug/lib</font>  <font color="#008000">-mthreads  -Wl,--subsystem,windows -mwindows </font><font color="#008000">/c/wxWidgets-2.8.7/msw-debug/lib/libwx_mswud_richtext-2.8.a /c/wxWidgets-2.8.7/msw-debug/lib/libwx_mswud_aui-2.8.a /c/wxWidgets-2.8.7/msw-debug/lib/libwx_mswud_xrc-2.8.a /c/wxWidgets-2.8.7/msw-debug/lib/libwx_mswud_qa-2.8.a /c/wxWidgets-2.8.7/msw-debug/lib/libwx_mswud_html-2.8.a /c/wxWidgets-2.8.7/msw-debug/lib/libwx_mswud_adv-2.8.a /c/wxWidgets-2.8.7/msw-debug/lib/libwx_mswud_core-2.8.a /c/wxWidgets-2.8.7/msw-debug/lib/libwx_baseud_xml-2.8.a /c/wxWidgets-2.8.7/msw-debug/lib/libwx_baseud_net-2.8.a /c/wxWidgets-2.8.7/msw-debug/lib/libwx_baseud-2.8.a </font><font color="#008000">-lwxregexud-2.8 -lwxexpatd-2.8 -lwxtiffd-2.8 -lwxjpegd-2.8 -lwxpngd-2.8 -lwxzlibd-2.8 -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi3</font></code>;</li>
<li>Add the directory <font color="#0000ff">preppended with <code>-L</code></font> to the <code>Additional library directories</code> inside <code>General options</code> and click OK to close this dialog;</li>
<li>Now select <code>Linker --&gt; Libraries --&gt; Add option... --&gt; Other option...;</code></li>
<li>Back on the MSYS console, copy the <font color="#008000">remaining linker flags</font>;</li>
<li>Paste the <font color="#008000">remaining flags</font> from <code>wx-config --libs</code> on your notepad and <strong>replace all occurrences of /c/ by C\:/</strong> (this letter may vary depending on where you installed wxWidgets), then paste the result on that field. Remember: replacing /c/ by C\:/ is utterly necessary if you don&#8217;t want to see ugly linker errors!;</li>
<li>Create a <a href="http://www.wxwidgets.org/docs/tutorials/hworld2.txt">simple wx program</a> and build it;</li>
</ol>
<p>That&#8217;s a lot of work for a first application, but for your next applications all you will have to do is to repeat the compiler and linker options. Now you can use your favorite IDE to make wxWidgets applications on Windows.</p>
<p>PS: A wxWidgets plugin for NetBeans (wxMatisse?) would be great.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daltonfilho.com/2008/02/23/wxwidgets-on-windows-using-netbeans-60-with-mingw-msys/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
