<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>new GUI library for Allegro.</title>
		<link>http://www.allegro.cc/forums/view/586615</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 27 Jul 2006 06:12:19 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi all.</p><p>I am announcing a new allegro GUI project in C++ with working title &quot;ALGUI&quot;. The purpose of this library is:</p><p>1) to be able to write application GUIs (game tools, etc).<br />2) to be able to write game GUIs.</p><p>The library has the following features:</p><ul><li><p>pass-by-name semantics for object construction; no longer you need to write or remember many different constructors for an object.</p></li><li><p>support for left-handed mouse.</p></li><li><p>a global thread-safe event queue; events can be sent to the main queue from any worker thread.</p></li><li><p>an object-oriented event system; each event is an object.</p></li><li><p>reference-counted wrappers around primitives: bitmap, font, string, cursor.</p></li><li><p>queued mouse and keyboard input; allegro callbacks are hooked and mouse/keyboard input is placed in an internal buffer so as that they are not lost.</p></li><li><p>properties; no longer you need to remember get and set functions.</p></li><li><p>signals and slots</p></li><li><p>a simple widget styling mechanism based on allegro config routines.</p></li><li><p>customizable screen updating mechanisms: by default, the library provides a double buffered mechanism for apps/games and a direct one used for full screen games.</p></li><li><p>widget reflection; I will make a GUI Form designer that will use the reflection info to interface with widget libraries.</p></li><li><p>model-based architecture; most widgets are views. Models include: command, value, range, vector, list, set, tree, table, document. Models have an STL interface where expected.</p></li><li><p>easiest drag-n-drop between widgets (not with other apps though).</p></li><li><p>support for truetype fonts through the alfont library.</p></li><li><p>thread support through the pthreads library.</p></li><li><p>variant and typesafe variable argument lists.</p></li><li><p>weak and shared ptrs.</p></li><li><p>automatic widget layout.</p></li></ul><p>

The list of widgets includes:</p><ul><li><p>line</p></li><li><p>panel</p></li><li><p>push button</p></li><li><p>toggle button</p></li><li><p>check box</p></li><li><p>radio button</p></li><li><p>button frame</p></li><li><p>scroll bar</p></li><li><p>progress bar</p></li><li><p>text box</p></li><li><p>combo box</p></li><li><p>spin box</p></li><li><p>text view</p></li><li><p>list view</p></li><li><p>tree view</p></li><li><p>table view</p></li><li><p>icon view</p></li><li><p>window</p></li><li><p>dialog</p></li><li><p>message box</p></li><li><p>tab pane</p></li><li><p>tab page</p></li><li><p>menu</p></li><li><p>menu item</p></li><li><p>app screen</p></li><li><p>toolbar</p></li><li><p>tool push button</p></li><li><p>tool toggle button</p></li><li><p>tool radio button</p></li></ul><p>

The attached file contains the source code, the documentation for all the features mentioned above, and a small style file.<br />Except the widgets, that is :-) (but now that the core is done, adding widgets should be easy).</p><p>I aim for the easiest style of programming possible with C++. GUI apps will be something like this:</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="p">#include "algui.hpp"</span></td></tr><tr><td class="number">2</td><td>&#160;</td></tr><tr><td class="number">3</td><td><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">4</td><td>    <span class="c">//init allegro and stuff</span></td></tr><tr><td class="number">5</td><td>    <a href="http://www.allegro.cc/manual/allegro_init" target="_blank"><span class="a">allegro_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td>    <a href="http://www.allegro.cc/manual/install_keyboard" target="_blank"><span class="a">install_keyboard</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">7</td><td>    <a href="http://www.allegro.cc/manual/install_mouse" target="_blank"><span class="a">install_mouse</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">8</td><td>    <a href="http://www.allegro.cc/manual/install_timer" target="_blank"><span class="a">install_timer</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">9</td><td>    <a href="http://www.allegro.cc/manual/set_color_depth" target="_blank"><span class="a">set_color_depth</span></a><span class="k2">(</span><span class="n">32</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">10</td><td>    <a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_AUTODETECT, <span class="n">1024</span>, <span class="n">768</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">11</td><td>    <a href="http://www.allegro.cc/manual/show_mouse" target="_blank"><span class="a">show_mouse</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">12</td><td>&#160;</td></tr><tr><td class="number">13</td><td>    <span class="c">//load resources</span></td></tr><tr><td class="number">14</td><td>    <a href="http://www.allegro.cc/manual/DATAFILE" target="_blank"><span class="a">DATAFILE</span></a> <span class="k3">*</span>res <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_datafile" target="_blank"><span class="a">load_datafile</span></a><span class="k2">(</span><span class="s">"myapp.dat"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">15</td><td>&#160;</td></tr><tr><td class="number">16</td><td>    <span class="c">//the application's models</span></td></tr><tr><td class="number">17</td><td>    Command newCommand<span class="k2">(</span>command <span class="k3">=</span> slot<span class="k2">(</span>newProc<span class="k2">)</span>, enabled <span class="k3">=</span> <span class="k1">true</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">18</td><td>    Command openCommand<span class="k2">(</span>command <span class="k3">=</span> slot<span class="k2">(</span>openProc<span class="k2">)</span>, enabled <span class="k3">=</span> <span class="k1">true</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">19</td><td>    Command saveCommand<span class="k2">(</span>command <span class="k3">=</span> slot<span class="k2">(</span>saveProc<span class="k2">)</span>, enabled <span class="k3">=</span> <span class="k1">false</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td>    Value<span class="k3">&lt;</span>int&gt; intData<span class="k2">(</span>value <span class="k3">=</span> <span class="n">5</span>, modified <span class="k3">=</span> slot<span class="k2">(</span>intDataModifiedProc<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">21</td><td>    Vector<span class="k3">&lt;</span>float&gt; floatData<span class="k2">(</span>size <span class="k3">=</span> <span class="n">10</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">22</td><td>    Tree<span class="k3">&lt;</span>String&gt; stringData<span class="k2">;</span></td></tr><tr><td class="number">23</td><td>    ...</td></tr><tr><td class="number">24</td><td>&#160;</td></tr><tr><td class="number">25</td><td>    <span class="c">//the gui tree</span></td></tr><tr><td class="number">26</td><td>    SharedPtr<span class="k3">&lt;</span>Screen&gt; guiScreen <span class="k3">=</span> <span class="k1">new</span> Screen<span class="k2">(</span>width <span class="k3">=</span> <a href="http://www.allegro.cc/manual/SCREEN_W" target="_blank"><span class="a">SCREEN_W</span></a>, height <span class="k3">=</span> <a href="http://www.allegro.cc/manual/SCREEN_H" target="_blank"><span class="a">SCREEN_H</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">27</td><td>    Menu <span class="k3">*</span>mainMenu <span class="k3">=</span> <span class="k1">new</span> Menu<span class="k2">(</span>parent <span class="k3">=</span> guiScreen<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">28</td><td>    MenuItem <span class="k3">*</span>fileMenuItem <span class="k3">=</span> <span class="k1">new</span> MenuItem<span class="k2">(</span>parent <span class="k3">=</span> mainMenu, text <span class="k3">=</span> <span class="s">"&amp;File"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">29</td><td>    ToolBar <span class="k3">*</span>mainToolBar <span class="k3">=</span> <span class="k1">new</span> ToolBar<span class="k2">(</span>parent <span class="k3">=</span> guiScreen, text <span class="k3">=</span> <span class="s">"Main"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">30</td><td>    ToolButton <span class="k3">*</span>newButton <span class="k3">=</span> <span class="k1">new</span> ToolButton<span class="k2">(</span>parent <span class="k3">=</span> mainToolBar, bitmap <span class="k3">=</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span><span class="k2">)</span>res<span class="k2">[</span>NEW_BITMAP<span class="k2">]</span>.dat, command <span class="k3">=</span> newCommand<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">31</td><td>    ...</td></tr><tr><td class="number">32</td><td>&#160;</td></tr><tr><td class="number">33</td><td>    <span class="c">//apply style</span></td></tr><tr><td class="number">34</td><td>    Style style1<span class="k2">(</span><span class="s">"default.algui"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">35</td><td>    guiScreen-&gt;setStyle<span class="k2">(</span>style1<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">36</td><td>&#160;</td></tr><tr><td class="number">37</td><td>    <span class="c">//open screen</span></td></tr><tr><td class="number">38</td><td>    guiScreen-&gt;activate<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">39</td><td>&#160;</td></tr><tr><td class="number">40</td><td>    <span class="c">//event loop</span></td></tr><tr><td class="number">41</td><td>    <span class="k1">while</span> <span class="k2">(</span>loopFlag<span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">42</td><td>        yield_timeslice<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">43</td><td>        updateGUI<span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">44</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">45</td><td>&#160;</td></tr><tr><td class="number">46</td><td>    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">47</td><td><span class="k2">}</span></td></tr><tr><td class="number">48</td><td><a href="http://www.allegro.cc/manual/END_OF_MAIN" target="_blank"><span class="a">END_OF_MAIN</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr></tbody></table></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sat, 22 Jul 2006 18:58:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That pass-by-name stuff looks like it pollutes the global namespace quite a bit...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Sat, 22 Jul 2006 19:41:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
The list of widgets includes: ...
</p></div></div><p>
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
The attached file contains the source code, the documentation for all the features mentioned above, and a small style file.<br /> Except the widgets, that is :-)
</p></div></div><p>

Don&#39;t those two statements conflict a little? The gui includes all those widgets, yet they arn&#39;t in the file, or even coded?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 22 Jul 2006 19:41:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Looks very impressive! It&#39;s almost like Qt for Allegro! <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /> I have been looking for a good GUI to use (gave up making one myself <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />) so maybe I&#39;ll try this.
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Don&#39;t those two statements conflict a little? The gui includes all those widgets, yet they arn&#39;t in the file, or even coded?
</p></div></div><p>
Not really... he said it includes all of the about except for the Widgets. He finished the core (most likely the hardest part), so now I he just has to code the widgets.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonny Cook)</author>
		<pubDate>Sat, 22 Jul 2006 19:41:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Wish I had more time and will to code at home or I would code the widgets. Too bad NAS and AWE died but now that I&#39;ve been doing quite a bit of C++ coding I think a good C++ GUI is a better idea.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Sun, 23 Jul 2006 03:54:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">CGamesPlay said:</div><div class="quote"><p>

That pass-by-name stuff looks like it pollutes the global namespace quite a bit...
</p></div></div><p>

A pass-by-name parameter is a global variable declared in the namespace algui::arguments. </p><div class="quote_container"><div class="title">Thomas Fjellstrom said:</div><div class="quote"><p>

Don&#39;t those two statements conflict a little? The gui includes all those widgets, yet they arn&#39;t in the file, or even coded?
</p></div></div><p>

</p><div class="quote_container"><div class="title">Jonny Cook said:</div><div class="quote"><p>

Not really... he said it includes all of the about except for the Widgets. He finished the core (most likely the hardest part), so now I he just has to code the widgets.
</p></div></div><p>

Indeed, the core is probably the hardest part. You&#39;ve got to design the interfaces and all the silly stuff that later stuff will depend on. You&#39;ve got to be careful.</p><div class="quote_container"><div class="title">Jonny Cook said:</div><div class="quote"><p>

Looks very impressive! It&#39;s almost like Qt for Allegro! <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /> I have been looking for a good GUI to use (gave up making one myself <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />) so maybe I&#39;ll try this.
</p></div></div><p>

We all have done so. The allegro.cc forum is filled with topics about GUI and allegro.</p><div class="quote_container"><div class="title">Steve Terry said:</div><div class="quote"><p>

Wish I had more time and will to code at home or I would code the widgets. Too bad NAS and AWE died but now that I&#39;ve been doing quite a bit of C++ coding I think a good C++ GUI is a better idea.
</p></div></div><p>

Hi Steve! This is what I wanted AWE to be, to be honest...but as you can see, it is very difficult, on the verge of being impossible, to do all this stuff in C.</p><p>I will start coding widgets as soon as it is possible and when I have the time (an 8-hour programming job does not leave you with much room). The next release will hopefully contain many small widgets and a web site; I have also got to finish the models part (list, tree, table), so don&#39;t expect anything in the very near future.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sun, 23 Jul 2006 13:00:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I thought we had all agreed that the ALGUI name was reserved for whichever gui is adopted as the official add-on in Allegro 5</p><p>Personally I see less need to start a new one than to finish some of the existing ones, and provide the necessary RAD tools to use them effectively.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Wed, 26 Jul 2006 18:00:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
A pass-by-name parameter is a global variable declared in the namespace algui::arguments.
</p></div></div><p>I&#39;m going to assume that your example is missing the using declaration and also that algui.hpp doesn&#39;t have it, because otherwise it is pretty worthless to be using the namespace <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Wed, 26 Jul 2006 22:28:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Not really... he said it includes all of the about except for the Widgets.
</p></div></div><p>Right, I quoted that too, but up above that he stated that it INCLUDES a large list of widgets. The two statements conflict.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 27 Jul 2006 06:12:19 +0000</pubDate>
	</item>
</rss>
