<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>A question for Steve Terry, Miran, Spellcaster and other GUI people!</title>
		<link>http://www.allegro.cc/forums/view/275507</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 03 Jul 2003 21:11:50 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Hi there,</p><p>Since you three have some experience of modifying the Allegro GUI I was wondering how you would go about designing a new GUI system? One that&#39;s more flexible and skinnable..</p><p>Thought I&#39;d better get some ideas before I jump in at the deep end!</p><p><img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Mon, 16 Jun 2003 23:24:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just download their GUI&#39;s and look at the source code. I haven&#39;t tried out all tree of them but I know that MASKinG comes with docs explaining the interface in great detail. Copy &amp; paste!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Mon, 16 Jun 2003 23:47:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I was thinking more of listening to their ideas <i>after</i> they have done their libs. Most of us realise the mistakes we&#39;ve made in design after we&#39;ve done something!</p><p>But, you do have a good point there amarillion.. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Mon, 16 Jun 2003 23:51:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Try to do write a program using Java SWING. Although it is highly critisized for being very slow, I think it has a very nice, neat structure. For example, the way events are handled or the way data is separated from widgets.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Tue, 17 Jun 2003 01:09:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Can you explain more please? <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Tue, 17 Jun 2003 01:32:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, let&#39;s startr simple: You should use an OO approach. I&#39;ll use C++, you can of course use C aswell (but using C++ in the examples will make the examples more readable).</p><p>The first think you should realize is that every widget (UI Element) should be eable to draw itself, and to deal with any events itself.</p><p>This leads to the point, that sombody or something needs to tell the widgets that an event has happened. Let&#39;s call this thing the EventManager.</p><p>What the EventManger does is quite simple. Every time he is called (Let&#39;s assume there is an EventMessagner::update() method, or something like this) it checks where the mouse is. It then tries to find the widget at this position (if any).<br />Usually, you&#39;ll check if teh mouse has moved at all first, then if the mouse is still within the widget it has been in before.<br />Once the widget the mouse is in is found, you generate an according event (mouseMoved, mouseOut, mouseEnter, mouseDrag, etc).<br />If the mouse button status has changed, you signal this is well (mouseButtonPressed, mouseButtonReleased).</p><p>These methods might create repaint events which are stored in the EventManagers queue. So, after doing it&#39;s normal stuff, it will work on this list as well. And calling the update method of the widgets in question.</p><p>In order to make painting easy, every widget should only get a sub bitmap of the bitmap everything is drawn on. So, you can always assume that (0,0) is the upper left corner of the widget whichs paint() method is called.</p><p>Depending on your intention, you might want to use something similar to a graphics context, to store the bitmap to work on, the current font, foreground and background colors, etc.</p><p>Another key point is that your widgets should be containers. This means they should be able to contain other widgets.</p><p>So, if you have a textbox, a button and a pop-up menu you should be able to code a combo box simply by combining these elements. <br />A spinner would be a textfield an two buttons (up/down).</p><p>Once you have a simple widget, and the EventManager writing the widget itself is pretty simple.</p><p>In theory, your widget class could look 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="k1">class</span> Widget <span class="k2">{</span></td></tr><tr><td class="number">2</td><td>    vector<span class="k3">&lt;</span>Widget<span class="k3">*</span><span class="k3">&gt;</span> childs<span class="k2">;</span></td></tr><tr><td class="number">3</td><td>    Widget<span class="k3">*</span>         parent<span class="k2">;</span></td></tr><tr><td class="number">4</td><td>&#160;</td></tr><tr><td class="number">5</td><td>    <span class="k1">int</span>             state<span class="k2">;</span></td></tr><tr><td class="number">6</td><td>    Rect            bounds<span class="k2">;</span></td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td>protected:</td></tr><tr><td class="number">9</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> handleMouseEvent<span class="k2">(</span>MouseEvent e<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">10</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> handleKeyboardEvent<span class="k2">(</span>KeyboardEvent e<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">11</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> handleJoystickEvent<span class="k2">(</span>JoystickEvent e<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="k1">virtual</span> <span class="k1">void</span> repaintChilds<span class="k2">(</span>GraphicsContext <span class="k3">*</span>g<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> repaintSelf<span class="k2">(</span>GraphicsContext <span class="k3">*</span>g<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>public:</td></tr><tr><td class="number">17</td><td>    Widget<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">18</td><td>    <span class="k1">virtual</span> ~Widget<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">19</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> repaint<span class="k2">(</span>GraphicsContext <span class="k3">*</span>g<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td>    <span class="k1">virtual</span> <span class="k1">int</span>  getState<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">21</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> setState<span class="k2">(</span><span class="k1">int</span> state<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">22</td><td>&#160;</td></tr><tr><td class="number">23</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> setLocation<span class="k2">(</span>Point <span class="k3">*</span>p<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">24</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> setLocation<span class="k2">(</span><span class="k1">int</span> x, <span class="k1">int</span> y<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">25</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> setBounds<span class="k2">(</span>Rectangle <span class="k3">*</span><a href="http://www.allegro.cc/manual/rect" target="_blank"><span class="a">rect</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">26</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> setBounds<span class="k2">(</span><span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">int</span> w, <span class="k1">int</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">27</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> setSize<span class="k2">(</span><span class="k1">int</span> w, <span class="k1">int</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">28</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> setSize<span class="k2">(</span>Dimension <span class="k3">*</span>size<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">29</td><td>&#160;</td></tr><tr><td class="number">30</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> setVisible<span class="k2">(</span><span class="k1">bool</span> visible<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">31</td><td>    <span class="k1">virtual</span> <span class="k1">bool</span> isVisible<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">32</td><td>&#160;</td></tr><tr><td class="number">33</td><td>    <span class="k1">virtual</span> <span class="k1">int</span>  add<span class="k2">(</span>Widget<span class="k3">*</span> child<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">34</td><td>    <span class="k1">virtual</span> Widget <span class="k3">*</span>getChildAt<span class="k2">(</span><span class="k1">int</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_470.html" target="_blank">index</a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">35</td><td>    <span class="k1">virtual</span> <span class="k1">int</span>   getChildCount<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">36</td><td>    <span class="k1">virtual</span> Widget <span class="k3">*</span>getWidgetAtLocation<span class="k2">(</span><span class="k1">int</span> x, <span class="k1">int</span> y<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">37</td><td>&#160;</td></tr><tr><td class="number">38</td><td><span class="k2">}</span><span class="k2">;</span></td></tr></tbody></table></div></div><p>

The getWidgetAtLocation() checks if one of the child widgets is at the given position. If so, it calls the getWidgetAtLocation() of the corresponding child widget. If there&#39;s no child at this position, it returns the this pointer.</p><p>So, your EventManager class can call the getWidgetAtLocation() method to get the widget under the mouse (Some complex widgets, say a combobox, might not call the child class, but simply always return this).</p><p>And yes, this is of course simplified. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />Hope it helps anyway...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Tue, 17 Jun 2003 02:27:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well I did write some docs for my lib and went over a few of the subsystems in depth.  I can safely say I&#39;ve made many mistakes while making my GUI, but there is really no right or wrong way, just a matter of preference.  For instance at one point I had a texture field for all of my skins so you could have one texture used for multiple things, later out of preference I changed it so that each object has a different texture name, this cut down the number of config lines in the config files, but in some instances caused skins to bloat a bit because two textures may look identical, but require different names.  If you really want to know how to make the allegro GUI more flexible download my source and look at some of the things I did, also looking at the docs and the &quot;making procedures&quot; section should explain some of the subsystems I had to create to handle stuff.  The most important subsystem I had to create so far was the memory manager, without that I would be extremely limited in how flexible I could make the GUI, with it however there is almost no limit.  In fact all of the subsystems I use for my GUI are completely portable to any other GUI and are not tied into NAS GUI at all.  Of course you are free to extend any part of my GUI as you wish.  I&#39;m looking for someone who is willing to extend it to allow for multiple overlapping dialogs and menus.  After that all I have to do is finish off the few remaining procs and it&#39;ll be nearly complete.  <br />Here&#39;s a simple example of how my GUI works:
</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="c">//Draws a bitmap onto a dialog box</span></td></tr><tr><td class="number">2</td><td><span class="k1">int</span> nas_bitmap_proc<span class="k2">(</span><span class="k1">int</span> msg, <a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> <span class="k3">*</span>d, <span class="k1">int</span> c<span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">3</td><td>  <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>wnd<span class="k2">;</span> <span class="c">//window bitmap</span></td></tr><tr><td class="number">4</td><td>        <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>b <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>d-&gt;dp<span class="k2">;</span> <span class="c">//bitmap image</span></td></tr><tr><td class="number">5</td><td>  <span class="k1">int</span> x, y<span class="k2">;</span></td></tr><tr><td class="number">6</td><td>        <span class="c">//Returns relative coordinates since we are not drawing to the screen, we have to get the relative coordinates of the procedure in relation to the main dialog window</span></td></tr><tr><td class="number">7</td><td>  get_rel_coords<span class="k2">(</span>d, <span class="k3">&amp;</span>x, <span class="k3">&amp;</span>y<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">8</td><td>     <span class="k1">if</span> <span class="k2">(</span>msg <span class="k3">=</span><span class="k3">=</span> MSG_DRAW<span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">9</td><td>    wnd <span class="k3">=</span> get_window<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// Get the window bitmap</span></td></tr><tr><td class="number">10</td><td>                <span class="c">// Smart updating, only the bitmap portion of the screen will be updated</span></td></tr><tr><td class="number">11</td><td>    invalidate_rect<span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> x, d <span class="k3">-</span><span class="k3">&gt;</span> y, d <span class="k3">-</span><span class="k3">&gt;</span> w, d <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">12</td><td>                <span class="c">// Draw our bitmap using any one of the four drawing modes</span></td></tr><tr><td class="number">13</td><td>    <span class="k1">switch</span><span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> d1<span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">14</td><td>      <span class="k1">case</span> NAS_BITMAP_BLIT:</td></tr><tr><td class="number">15</td><td>              <a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>b, wnd, <span class="n">0</span>, <span class="n">0</span>, x, y, d <span class="k3">-</span><span class="k3">&gt;</span> w, d <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td>      <span class="k1">break</span><span class="k2">;</span> </td></tr><tr><td class="number">17</td><td>      <span class="k1">case</span> NAS_BITMAP_MASKED_BLIT:</td></tr><tr><td class="number">18</td><td>        <a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a><span class="k2">(</span>b, wnd, <span class="n">0</span>, <span class="n">0</span>, x, y, d <span class="k3">-</span><span class="k3">&gt;</span> w, d <span class="k3">-</span><span class="k3">&gt;</span>h<span class="k2">)</span><span class="k2">;</span> </td></tr><tr><td class="number">19</td><td>      <span class="k1">break</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td>      <span class="k1">case</span> NAS_BITMAP_STRETCH_BLIT:</td></tr><tr><td class="number">21</td><td>        <a href="http://www.allegro.cc/manual/stretch_blit" target="_blank"><span class="a">stretch_blit</span></a><span class="k2">(</span>b, wnd, <span class="n">0</span>, <span class="n">0</span>, b <span class="k3">-</span><span class="k3">&gt;</span> w, b <span class="k3">-</span><span class="k3">&gt;</span> h, x, y, d <span class="k3">-</span><span class="k3">&gt;</span> w, d <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">22</td><td>      <span class="k1">break</span><span class="k2">;</span></td></tr><tr><td class="number">23</td><td>      <span class="k1">case</span> NAS_BITMAP_MASKED_STRETCH_BLIT:</td></tr><tr><td class="number">24</td><td>        <a href="http://www.allegro.cc/manual/masked_stretch_blit" target="_blank"><span class="a">masked_stretch_blit</span></a><span class="k2">(</span>b, wnd, <span class="n">0</span>, <span class="n">0</span>, b <span class="k3">-</span><span class="k3">&gt;</span> w, b <span class="k3">-</span><span class="k3">&gt;</span> h, x, y, d <span class="k3">-</span><span class="k3">&gt;</span> w, d <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">25</td><td>      <span class="k1">break</span><span class="k2">;</span></td></tr><tr><td class="number">26</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">27</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">28</td><td>     <span class="k1">return</span> D_O_K<span class="k2">;</span></td></tr><tr><td class="number">29</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>

Simple no?  We don&#39;t even have to worry about handling the mouse as hiding it and such because that is handled by the dirty rectangle system.  <br />Here&#39;s one using the memory manager:
</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="c">// Displays a progress bar</span></td></tr><tr><td class="number">2</td><td><span class="k1">int</span> nas_progress_proc<span class="k2">(</span><span class="k1">int</span> msg, <a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> <span class="k3">*</span>d, <span class="k1">int</span> c<span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">3</td><td>  <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>wnd<span class="k2">;</span></td></tr><tr><td class="number">4</td><td>  <span class="k1">int</span> <span class="k3">*</span>state<span class="k2">;</span></td></tr><tr><td class="number">5</td><td>  <span class="k1">int</span> ret <span class="k3">=</span> D_O_K<span class="k2">;</span></td></tr><tr><td class="number">6</td><td>  <span class="k1">int</span> x1, y1, col<span class="k2">;</span></td></tr><tr><td class="number">7</td><td>  <span class="k1">int</span> <span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span><span class="k1">int</span> d2value<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">8</td><td>  <span class="k1">int</span> newpos<span class="k2">;</span></td></tr><tr><td class="number">9</td><td>  <span class="k1">int</span> texty <span class="k3">=</span> <span class="k2">(</span><span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> h  <span class="k3">-</span> progressbar.tpadding <span class="k3">-</span> progressbar.epadding<span class="k2">)</span> <span class="k3">&gt;</span><span class="k3">&gt;</span> <span class="n">1</span><span class="k2">)</span> <span class="k3">-</span> <span class="k2">(</span>nasfont_text_height<span class="k2">(</span>AL_font, NASFONT_NORMAL<span class="k2">)</span> <span class="k3">&gt;</span><span class="k3">&gt;</span> <span class="n">1</span><span class="k2">)</span> <span class="k3">+</span> progressbar.tpadding<span class="k2">;</span></td></tr><tr><td class="number">10</td><td>  <span class="k1">int</span> width <span class="k3">=</span> d <span class="k3">-</span><span class="k3">&gt;</span> w <span class="k3">*</span> <span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> d2<span class="k3">/</span><span class="k2">(</span><span class="k1">float</span><span class="k2">)</span>d <span class="k3">-</span><span class="k3">&gt;</span> d1<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">11</td><td>  <span class="k1">int</span> x, y, w, h, cl, cr, ct, cb<span class="k2">;</span></td></tr><tr><td class="number">12</td><td>  <span class="k1">if</span> <span class="k2">(</span>width <span class="k3">&gt;</span> d <span class="k3">-</span><span class="k3">&gt;</span> w<span class="k2">)</span></td></tr><tr><td class="number">13</td><td>    width <span class="k3">=</span> d <span class="k3">-</span><span class="k3">&gt;</span> w<span class="k2">;</span></td></tr><tr><td class="number">14</td><td>  <span class="k1">if</span> <span class="k2">(</span>width <span class="k3">&lt;</span> <span class="n">0</span><span class="k2">)</span></td></tr><tr><td class="number">15</td><td>    width <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td>  get_rel_coords<span class="k2">(</span>d, <span class="k3">&amp;</span>x1, <span class="k3">&amp;</span>y1<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">17</td><td>        <span class="c">// Retrieve our state variable from memory (returns NULL at first since it doesn't exist)</span></td></tr><tr><td class="number">18</td><td>  state <span class="k3">=</span> get_mem<span class="k2">(</span>d, MEM_STATES<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">19</td><td>  <span class="k1">switch</span><span class="k2">(</span>msg<span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">20</td><td>    <span class="k1">case</span> MSG_START:</td></tr><tr><td class="number">21</td><td>      <span class="c">// Two states: </span></td></tr><tr><td class="number">22</td><td>      <span class="c">// State[0] - set to mouse state</span></td></tr><tr><td class="number">23</td><td>      <span class="c">// State[1] - set to last clicked position </span></td></tr><tr><td class="number">24</td><td>                        <span class="c">// Create our state memory segment to hold two integers.</span></td></tr><tr><td class="number">25</td><td>      state <span class="k3">=</span> <span class="k2">(</span><span class="k1">int</span> <span class="k3">*</span><span class="k2">)</span>create_mem<span class="k2">(</span>d, MEM_STATES, <span class="k2">(</span><span class="k1">int</span> <span class="k3">*</span><span class="k2">)</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_81.html" target="_blank">calloc</a><span class="k2">(</span>MEM_STATES, <span class="k1">sizeof</span><span class="k2">(</span><span class="k1">int</span><span class="k2">)</span> <span class="k3">*</span> <span class="n">2</span><span class="k2">)</span>, MEM_ALLOCATED<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">26</td><td>    <span class="k1">break</span><span class="k2">;</span></td></tr><tr><td class="number">27</td><td>    <span class="k1">case</span> MSG_DRAW:</td></tr><tr><td class="number">28</td><td>                        <span class="c">// Get our window again</span></td></tr><tr><td class="number">29</td><td>      wnd <span class="k3">=</span> get_window<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">30</td><td>                        <span class="c">// Update the DRS system</span></td></tr><tr><td class="number">31</td><td>      invalidate_rect<span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> x, d <span class="k3">-</span><span class="k3">&gt;</span> y, d <span class="k3">-</span><span class="k3">&gt;</span> w, d <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">32</td><td>                        <span class="c">// Draw the progress box</span></td></tr><tr><td class="number">33</td><td>      drawskinnedrect<span class="k2">(</span>wnd, <span class="k3">&amp;</span>progressbar.box<span class="k2">[</span><span class="n">0</span><span class="k2">]</span>, x1, y1, x1 <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> w, y1 <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">34</td><td>      drawskinnedrect<span class="k2">(</span>wnd, <span class="k3">&amp;</span>progressbar.box<span class="k2">[</span><span class="n">1</span><span class="k2">]</span>, x1, y1, x1 <span class="k3">+</span> width, y1 <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">35</td><td>      <span class="k1">if</span><span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> dp<span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">36</td><td>        <span class="k1">if</span><span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> flags <span class="k3">&amp;</span> D_DISABLED<span class="k2">)</span></td></tr><tr><td class="number">37</td><td>          col <span class="k3">=</span> <span class="n">2</span><span class="k2">;</span></td></tr><tr><td class="number">38</td><td>        <span class="k1">else</span></td></tr><tr><td class="number">39</td><td>          col <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">40</td><td>        <span class="k1">if</span><span class="k2">(</span>wnd <span class="k3">-</span><span class="k3">&gt;</span> clip<span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">41</td><td>          cl <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> cl<span class="k2">;</span></td></tr><tr><td class="number">42</td><td>          cr <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> cr<span class="k2">;</span></td></tr><tr><td class="number">43</td><td>          ct <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> ct<span class="k2">;</span></td></tr><tr><td class="number">44</td><td>          cb <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> cb<span class="k2">;</span></td></tr><tr><td class="number">45</td><td>        <span class="k2">}</span></td></tr><tr><td class="number">46</td><td>        <span class="k1">else</span><span class="k2">{</span></td></tr><tr><td class="number">47</td><td>          cl <span class="k3">=</span> ct <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">48</td><td>          cr <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> w<span class="k2">;</span></td></tr><tr><td class="number">49</td><td>          cb <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">;</span></td></tr><tr><td class="number">50</td><td>        <span class="k2">}</span></td></tr><tr><td class="number">51</td><td>        x <span class="k3">=</span> x1 <span class="k3">+</span> progressbar.lpadding<span class="k2">;</span></td></tr><tr><td class="number">52</td><td>        y <span class="k3">=</span> y1 <span class="k3">+</span> progressbar.tpadding<span class="k2">;</span></td></tr><tr><td class="number">53</td><td>        w <span class="k3">=</span> MIN<span class="k2">(</span>x1 <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> w <span class="k3">-</span> progressbar.rpadding, x1 <span class="k3">+</span> width <span class="k3">-</span> progressbar.spacing<span class="k2">)</span> <span class="k3">-</span> <span class="n">1</span><span class="k2">;</span></td></tr><tr><td class="number">54</td><td>        h  <span class="k3">=</span> y1 <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> h <span class="k3">-</span> progressbar.epadding <span class="k3">-</span> <span class="n">1</span><span class="k2">;</span></td></tr><tr><td class="number">55</td><td>        set_clip<span class="k2">(</span>wnd, x, y, w, h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">56</td><td>        nasfont_textout_shadow<span class="k2">(</span>wnd, AL_font, d <span class="k3">-</span><span class="k3">&gt;</span> dp, x1 <span class="k3">+</span> <span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> w <span class="k3">&gt;</span><span class="k3">&gt;</span> <span class="n">1</span><span class="k2">)</span>, y1 <span class="k3">+</span> texty, progressbar.textcol<span class="k2">[</span>col<span class="k2">]</span>, NASFONT_CENTERED<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">57</td><td>        set_clip<span class="k2">(</span>wnd, cl, ct, cr, cb<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">58</td><td>        </td></tr><tr><td class="number">59</td><td>        <span class="k1">if</span><span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> flags <span class="k3">&amp;</span> D_DISABLED<span class="k2">)</span></td></tr><tr><td class="number">60</td><td>          col <span class="k3">=</span> <span class="n">2</span><span class="k2">;</span></td></tr><tr><td class="number">61</td><td>        <span class="k1">else</span></td></tr><tr><td class="number">62</td><td>          col <span class="k3">=</span> <span class="n">1</span><span class="k2">;</span></td></tr><tr><td class="number">63</td><td>        <span class="k1">if</span><span class="k2">(</span>wnd <span class="k3">-</span><span class="k3">&gt;</span> clip<span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">64</td><td>          cl <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> cl<span class="k2">;</span></td></tr><tr><td class="number">65</td><td>          cr <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> cr<span class="k2">;</span></td></tr><tr><td class="number">66</td><td>          ct <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> ct<span class="k2">;</span></td></tr><tr><td class="number">67</td><td>          cb <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> cb<span class="k2">;</span></td></tr><tr><td class="number">68</td><td>        <span class="k2">}</span></td></tr><tr><td class="number">69</td><td>        <span class="k1">else</span><span class="k2">{</span></td></tr><tr><td class="number">70</td><td>          cl <span class="k3">=</span> ct <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">71</td><td>          cr <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> w<span class="k2">;</span></td></tr><tr><td class="number">72</td><td>          cb <span class="k3">=</span> wnd <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">;</span></td></tr><tr><td class="number">73</td><td>        <span class="k2">}</span></td></tr><tr><td class="number">74</td><td>        x <span class="k3">=</span> x1 <span class="k3">+</span> width <span class="k3">-</span> progressbar.spacing<span class="k2">;</span></td></tr><tr><td class="number">75</td><td>        y <span class="k3">=</span> y1 <span class="k3">+</span> progressbar.tpadding<span class="k2">;</span></td></tr><tr><td class="number">76</td><td>        w <span class="k3">=</span> x1 <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> w <span class="k3">-</span> progressbar.rpadding <span class="k3">-</span> <span class="n">1</span><span class="k2">;</span></td></tr><tr><td class="number">77</td><td>        h  <span class="k3">=</span> y1 <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> h <span class="k3">-</span> progressbar.epadding <span class="k3">-</span> <span class="n">1</span><span class="k2">;</span></td></tr><tr><td class="number">78</td><td>        set_clip<span class="k2">(</span>wnd, x, y, w, h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">79</td><td>        nasfont_textout_shadow<span class="k2">(</span>wnd, AL_font, d <span class="k3">-</span><span class="k3">&gt;</span> dp, x1 <span class="k3">+</span> <span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> w <span class="k3">&gt;</span><span class="k3">&gt;</span> <span class="n">1</span><span class="k2">)</span>, y1 <span class="k3">+</span> texty, progressbar.textcol<span class="k2">[</span>col<span class="k2">]</span>, NASFONT_CENTERED<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">80</td><td>        set_clip<span class="k2">(</span>wnd, cl, ct, cr, cb<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">81</td><td>      <span class="k2">}</span></td></tr><tr><td class="number">82</td><td>    <span class="k1">break</span><span class="k2">;</span>  </td></tr><tr><td class="number">83</td><td>    <span class="k1">case</span> MSG_LPRESS:</td></tr><tr><td class="number">84</td><td>      <span class="k1">if</span><span class="k2">(</span><span class="k3">!</span><span class="k2">(</span>state<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> <span class="k3">&amp;</span> BUTTON_FOCUS<span class="k2">)</span><span class="k2">)</span></td></tr><tr><td class="number">85</td><td>        state<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> ^<span class="k3">=</span> BUTTON_FOCUS<span class="k2">;</span></td></tr><tr><td class="number">86</td><td>     <span class="k1">break</span><span class="k2">;</span></td></tr><tr><td class="number">87</td><td>    <span class="k1">case</span> MSG_LRELEASE:</td></tr><tr><td class="number">88</td><td>      <span class="k1">if</span><span class="k2">(</span>state<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> <span class="k3">&amp;</span> BUTTON_FOCUS<span class="k2">)</span></td></tr><tr><td class="number">89</td><td>        state<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> ^<span class="k3">=</span> BUTTON_FOCUS<span class="k2">;</span></td></tr><tr><td class="number">90</td><td>    <span class="k1">break</span><span class="k2">;</span></td></tr><tr><td class="number">91</td><td>    <span class="k1">case</span> MSG_IDLE:</td></tr><tr><td class="number">92</td><td>      <span class="k1">if</span><span class="k2">(</span><span class="k3">!</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_b" target="_blank"><span class="a">mouse_b</span></a> <span class="k3">&amp;</span> <span class="n">1</span><span class="k2">)</span> <span class="k3">&amp;</span><span class="k3">&amp;</span> <span class="k2">(</span>state<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> <span class="k3">&amp;</span> BUTTON_FOCUS<span class="k2">)</span> <span class="k3">&amp;</span><span class="k3">&amp;</span> <span class="k3">!</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_x" target="_blank"><span class="a">mouse_x</span></a> <span class="k3">&gt;</span><span class="k3">=</span> d <span class="k3">-</span><span class="k3">&gt;</span> x <span class="k3">&amp;</span><span class="k3">&amp;</span> <a href="http://www.allegro.cc/manual/mouse_x" target="_blank"><span class="a">mouse_x</span></a> <span class="k3">&lt;</span> d <span class="k3">-</span><span class="k3">&gt;</span> x <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> w <span class="k3">&amp;</span><span class="k3">&amp;</span> <a href="http://www.allegro.cc/manual/mouse_y" target="_blank"><span class="a">mouse_y</span></a> <span class="k3">&gt;</span><span class="k3">=</span> d <span class="k3">-</span><span class="k3">&gt;</span> y <span class="k3">&amp;</span><span class="k3">&amp;</span> <a href="http://www.allegro.cc/manual/mouse_y" target="_blank"><span class="a">mouse_y</span></a> <span class="k3">&lt;</span> d <span class="k3">-</span><span class="k3">&gt;</span> y <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> h<span class="k2">)</span><span class="k2">)</span></td></tr><tr><td class="number">93</td><td>        state<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> ^<span class="k3">=</span> BUTTON_FOCUS<span class="k2">;</span></td></tr><tr><td class="number">94</td><td>      <span class="k1">if</span><span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> dp2 <span class="k3">&amp;</span><span class="k3">&amp;</span> <span class="k2">(</span>state<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> <span class="k3">&amp;</span> BUTTON_FOCUS<span class="k2">)</span><span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">95</td><td>        newpos <span class="k3">=</span> d <span class="k3">-</span><span class="k3">&gt;</span> d1<span class="k3">*</span><span class="k2">(</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_x" target="_blank"><span class="a">mouse_x</span></a> <span class="k3">-</span> d <span class="k3">-</span><span class="k3">&gt;</span> x<span class="k2">)</span><span class="k3">/</span><span class="k2">(</span><span class="k1">float</span><span class="k2">)</span>d <span class="k3">-</span><span class="k3">&gt;</span> w<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">96</td><td>        <span class="k1">if</span><span class="k2">(</span>state<span class="k2">[</span><span class="n">1</span><span class="k2">]</span> <span class="k3">!</span><span class="k3">=</span> newpos <span class="k3">&amp;</span><span class="k3">&amp;</span> newpos <span class="k3">&gt;</span><span class="k3">=</span> <span class="n">0</span> <span class="k3">&amp;</span><span class="k3">&amp;</span> newpos <span class="k3">&lt;</span><span class="k3">=</span> d <span class="k3">-</span><span class="k3">&gt;</span> x <span class="k3">+</span> d <span class="k3">-</span><span class="k3">&gt;</span> w<span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">97</td><td>          proc <span class="k3">=</span> d <span class="k3">-</span><span class="k3">&gt;</span> dp2<span class="k2">;</span></td></tr><tr><td class="number">98</td><td>          ret <span class="k3">|</span><span class="k3">=</span> <span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span>newpos<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">99</td><td>          nas_object_message<span class="k2">(</span>d, MSG_DRAW, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">100</td><td>          state<span class="k2">[</span><span class="n">1</span><span class="k2">]</span> <span class="k3">=</span> d <span class="k3">-</span><span class="k3">&gt;</span> d1<span class="k3">*</span><span class="k2">(</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_x" target="_blank"><span class="a">mouse_x</span></a> <span class="k3">-</span> d <span class="k3">-</span><span class="k3">&gt;</span> x<span class="k2">)</span><span class="k3">/</span><span class="k2">(</span><span class="k1">float</span><span class="k2">)</span>d <span class="k3">-</span><span class="k3">&gt;</span> w<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">101</td><td>        <span class="k2">}</span></td></tr><tr><td class="number">102</td><td>        </td></tr><tr><td class="number">103</td><td>      <span class="k2">}</span></td></tr><tr><td class="number">104</td><td>      <span class="k1">if</span><span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> dp3 <span class="k3">&amp;</span><span class="k3">&amp;</span> <span class="k3">!</span><span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> flags <span class="k3">&amp;</span> D_DISABLED<span class="k2">)</span><span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">105</td><td>        proc <span class="k3">=</span> d <span class="k3">-</span><span class="k3">&gt;</span> dp3<span class="k2">;</span></td></tr><tr><td class="number">106</td><td>        ret <span class="k3">|</span><span class="k3">=</span> <span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span>d <span class="k3">-</span><span class="k3">&gt;</span> d2<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">107</td><td>      <span class="k2">}</span></td></tr><tr><td class="number">108</td><td>    <span class="k1">break</span><span class="k2">;</span></td></tr><tr><td class="number">109</td><td>    <span class="k1">case</span> MSG_END:</td></tr><tr><td class="number">110</td><td>                        <span class="c">// Destroy the memory segment</span></td></tr><tr><td class="number">111</td><td>      destroy_mem<span class="k2">(</span>d, MEM_STATES<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">112</td><td>    <span class="k1">break</span><span class="k2">;</span></td></tr><tr><td class="number">113</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">114</td><td>  <span class="k1">return</span> ret<span class="k2">;</span></td></tr><tr><td class="number">115</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>
This code is entirely non-blocking as well since it uses no while loops.  This is because the memory manager allows me to store a little bit of extra information per procedure like the states variable.  This allows me to retirive the last mouse clicked position and some other useful information like a status flag telling me that it has been clicked, or the mouse was held down outside of the procedure, etc.  Because of this system I can store any type of data and retrieve it per procedure as needed.. pretty nifty right;D
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Tue, 17 Jun 2003 02:31:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So pretty much the same way as Allegro handles it then?</p><p>Is this really how all modern GUI&#39;s handle things?</p><p>EDIT: Saw Steve&#39;s post after this reply. Thanks Steve that looks very useful. I&#39;m still not clear on why you need a memory manager though? Can you explain it to me a bit more? (sorry I&#39;m a newbie on GUI stuff!)</p><p>Cheers!<br />Rich
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Tue, 17 Jun 2003 02:45:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Qt and Swing both use a signals/slots mechanism, AFAIK - someone explained this in another thread.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Tue, 17 Jun 2003 02:47:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
I wrote a GUI (remember that ugly horror? <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />). If I were going to write an Allegro GUI, I&#39;d probably ape the crap out of Win32 since it&#39;s all I know. Are any of the Allegro GUI&#39;s at a good useable state? I keep forgetting; there&#39;s too many <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Tue, 17 Jun 2003 03:15:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The memory manager is not really needed as you could store teh extra information in any one of the free dp* fields, this however would clutter up the GUI since you&#39;d have to create structures or something to hold multiple types of data in one pointer.  This manager allows flexibility without using any dp* fields.  In fact I could rewrite the DIALOG structure to not have any dp fields at all and just call helper functions to set callbacks, etc. because those procs could retirieve that information from the memory banks.  It just makes the API a lot prettier <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /><br />It&#39;s also a very simple manager, three basic commands, create, get, destroy...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Tue, 17 Jun 2003 03:20:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Signal / Slot is also calles Listener and/or Subscriber.<br />It works like this: You&#39;re telling the Widget what events you&#39;re interested in, and pass an instance of yourself. Whenever the event occurs, you will be called.</p><p>Edit:
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>So pretty much the same way as Allegro handles it then?</p></div></div><p>
Um no.<br />Allegro has no concept of containers. There&#39;s no z-order as well. Allegro does not abstract the graphics context. And allegro is blocking.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Tue, 17 Jun 2003 03:32:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>My GUI lacks z-ordering but as soon as I impliment multiple dialogs that will be there.  So far I&#39;ve managed to abstract the graphics context and made non-blocking procedures, not so sure about containers or how I could do that...</p><p>[edit]<br />Richard.. if it makes more sense I need the memory manager to &quot;remember&quot; stuff outside of the procedure.  If I made it a local variable then the procedure would &quot;forget&quot; what it was set to each time it returned.  This way I can have separate unique variables for each procedure.  It also comes in handy for the dialogs because get_window uses the memory manager to get the window bitmap from the main dialog procedure.  Sorta like shared memory, all the procedures under that dialog have access to the main dialog&#39;s nas_dialog_proc window.<br />[/edit]
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Tue, 17 Jun 2003 03:50:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Attaching on to spellcaster&#39;s post:</p><p>Note the distinction between Events and Signals.  Events are from the event manager to the widgets (e.g. &quot;repaint yourself&quot;, &quot;the user pushed the left mouse button&quot;).  Signals are from the widget to the application (e.g. &quot;hey, I got clicked, time for you to do something useful&quot;).</p><p>This is the terminology used by GTK.  Other toolkits [should] have the same separation, if under different names.  Otherwise, you end up with a mess like the Allegro GUI.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Tue, 17 Jun 2003 06:50:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve noticed several people (including myself) are working on their own GUIs instead of using a pre-existing GUI. Is this because they feel more comfortable using a GUI they completely understand rather than an off-the-shelf GUI, or do they simply find Allegro&#39;s GUI to be a bit limited, or do they want to have complete control of it and customise it any way they want? I chose to write my own GUI in my own games for a mixture of these three reasons.</p><p>AE.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Andrei Ellman)</author>
		<pubDate>Tue, 17 Jun 2003 21:39:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>not only is allegro&#39;s gui limiting. but its down-right ugly.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (IronBob)</author>
		<pubDate>Tue, 17 Jun 2003 21:43:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Which reminds me, an Allegro theme for my GUI would be neat for those who want some nastalgia.  Hmm completely black and white buttons and dialogs... fun fun;D
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Tue, 17 Jun 2003 23:44:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
You should call it GEM though, because that&#39;s what Allegro is supposed to look like, afaik. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Tue, 17 Jun 2003 23:46:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, while working on your own GUI is a lot of work I think it&#39;s something that I may have to do at some point. However I really should look at the GUI Libs people have done using Allegro and see if I can adapt them.. (Those that are open source of course).</p><p>So that&#39;s why I was interested to seeing the different design approaches GUI&#39;s use. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>EDIT: GEM (or Graphical Enviroment Manager) was part of the GUI system used on the Atari ST. Pretty soon it looked horribly dated, but that black and white style looks quite retro and attractive recently! <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 18 Jun 2003 00:12:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I would just like to add that I based my GUI on a library called DeGUI which was basically a C++ wrapper for the Allegro GUI (that was in the times of Allegro 3.12). The author of DeGUI abandoned it  and I picked up on it improving it and adding extra functionality (support for skins etc.) While it&#39;s still incomplete and a bit on the buggy side, it does support more or less everything spellcaster said up there except for that z sorting thingy which I don&#39;t even know what it is. Or if it is what I think it might be then I have that too to some extent.</p><p>Anyway, while working on the lib I discovered it&#39;s NOT a good idea to make a GUI based on the Allegro GUI code. You will be much better off writing it completely from scratch using spellcaster&#39;s code as a starting point. If you decide to make your own GUI I suggest you study a good C++ book very carefully before you start. I was almost a complete newbie in C++ a year ago and that shows in my code. Since then I learned <b>a lot</b> and a while ago I was even tempted to rewrite my lib from scratch too but then I realized it would be too much work for too little benefit and I just quit. I am planning to make major improvements to the lib in the summer though (summer starts in july here)...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Wed, 18 Jun 2003 00:39:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hmmm.. The problem here is that I don&#39;t know C++ (I did try to learn). I know C++ would be a better choice for doing a GUI, but for some reason I just don&#39;t like it.</p><p>I have done some tinkering with the Allegro GUI routines for the interface in Stylepaint. But I find some aspects of it very restricitng.</p><p>Oh, I thought that LexGui was based around simply adding skin support to the Allegro GUI. Or have I done Lenny an injustice? <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 18 Jun 2003 00:45:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, LexGUI is just an extension of the default Allegro GUI (as far as I can see all the widgets are &quot;derived&quot; from the default ones and they only &quot;overload&quot; the MSG_DRAW message)...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Wed, 18 Jun 2003 00:52:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve used a lot of Java Swing and only a very brief peppering of Win32 code, but I do know that I love Java Swing.  Looking at spellcaster&#39;s code that&#39;s a really good way to do it, so listen to spellcaster <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />.  Signal / slots is awesome, although I&#39;ve never heard that term except on this fourm.  I thought the Java Swing followed MVC (Model-View-Controller).  But its event system is subscription based and I love it.  I like those concepts so much that I followed them very greatly when I designed my GNE library.</p><p>I think GUIs is the the best or very close to the best example case for object-oriented programming and one of the best cases for mutli-threaded programming.  GUIs are very suited for a lot of really cool programming concepts that I like <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gillius)</author>
		<pubDate>Wed, 18 Jun 2003 00:52:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Lenny, apparantly I&#39;ve got to listen to you.. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>Using plain C how would you do a GUI system? Or would you simply modify allegro&#39;s? (That question is for everyone else too..)</p><p><img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 18 Jun 2003 01:03:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As I already said, I don&#39;t suggest just modifying the Allegro GUI. You&#39;ll get results sooner that way but in the long run you&#39;ll regret it. If you do want to go down that road then why don&#39;t you modify LexGUI instead? Spellcaster obviously stopped working on it a long time ago...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Wed, 18 Jun 2003 01:10:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Unfortunately I think you are right Miran. It&#39;s just making a GUI from scratch when you&#39;ve not made one before seems rather daunting..:-/
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 18 Jun 2003 01:31:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">IronBob said:</div><div class="quote"><p>not only is allegro&#39;s gui limiting. but its down-right ugly.</p></div></div><p>

You&#39;re free to change the drawing routine to anything you like.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Yeah, LexGUI is just an extension of the default Allegro GUI (as far as I can see all the widgets are &quot;derived&quot; from the default ones and they only &quot;overload&quot; the MSG_DRAW message)...</p></div></div><p>

Yup. I tried to reuse most of the code. But some of the functionality is not changeable easily (without duplicating most of the code, and then changing small parts of it) so this project died ... more or less.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>I&#39;ve used a lot of Java Swing and only a very brief peppering of Win32 code, but I do know that I love Java Swing. </p></div></div><p>

AT my last job, my main job was designing Java widget sets. Some of them where close to Swing, some others were not that close to swing and employing some other (strange) libs like HAVI.<br />I also did a lot of work with swing.</p><p>And yes, I think the swing design is neat.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Using plain C how would you do a GUI system? Or would you simply modify allegro&#39;s? (That question is for everyone else too..)</p></div></div><p>

Allegro&#39;s main drawback is the missing container hierarchy. It&#39;s theone that will you bite sooner or later in the gluteus maximus.</p><p>So, I&#39;d start from scratch.<br />And if I had to do it in C, I&#39;d simulate C++ by giving each struct a VTABLE, and accessing functions only via that table.</p><p>But that&#39;s not very clever way (IMO), since you#re doing work others have done already for you (the g++ team) and chances are good that they did do a better job <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />So, I&#39;d suggest that you use C++ instead.</p><p>While you can do everything C++ can do with C, doing it with C will normally be more easy <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />Also, if you know how to pull these kind of stunts in C, you can code C++ already... and if you don&#39;t know how to do these stunts, explaining it wil take longer than migrating from C to C++.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Wed, 18 Jun 2003 01:47:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>You&#39;re free to change the drawing routine to anything you like.</p></div></div><p>

if i plan to ever use the allegro gui i most likely will.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (IronBob)</author>
		<pubDate>Wed, 18 Jun 2003 01:53:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>And the fun thing is: it&#39;s quite easy to do <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />With a few lines of code, the gui will really look nice (or let&#39;s say: way nicer)</p><p>In combination with DLG, the gui can cut your delevopment time (so use it for tools, but avoid it for games - or at least use it with care <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Wed, 18 Jun 2003 01:56:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s frustrating when you know your skills can&#39;t match your vision for a program. <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /> Is a vtable a list of function pointers?</p><p>Too much I don&#39;t know.. Oh well, probably still going to try anyway! <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 18 Jun 2003 02:00:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Learn C++.<br />Will look good in your CV, and it&#39;s always fun to learn something new <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Wed, 18 Jun 2003 02:16:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Richard casts &quot;BAH!&quot; spell on Spellcaster for +4 damage.</p><p>Spellcaster casts &quot;newbie&quot; on Richard for +8 confusion.</p><p>Confused Richard says:<br />&quot;Don&#39;t want to learn no yucking C++ <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" />&quot;</p><p>Richard goes to bed!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 18 Jun 2003 02:23:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Um.. Pauls mailed me some pretty good texts on OO in C, I&#39;m quite sure he can mail them to you as well.</p><p>But I still think it would be better to have a look at C++.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Wed, 18 Jun 2003 02:28:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Go to [url <a href="http://www.bruceeckel.com/">http://www.bruceeckel.com/</a>] and order/download some books. I especially recommend Thinking in C++ (both volumes)...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Wed, 18 Jun 2003 02:31:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>But Spellcaster&#39;s LexGUI is just an extension of the Allegro GUI, nothing more, mine was based off of LexGUI but took it a step further by adding DRS support, mouse extensions, font extensions, non-blocking procedures, etc.  The Allegro GUI way of doing things isn&#39;t neccessarily bad, though it has bugs (i.e. Double clicking is horribly implimented and fails in most cases, try holding the mouse button down and quicky pressing again.. that should NOT be a double click <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />)  </p><p>[edit]<br />May I ask how it would be possible to allow for container functionality using my GUI, I never thought about containers or knew about them until this thread popped up.  I could just call another proc from within a proc like teh allegro GUI does, but you&#39;d have to have special handlign of overlapping portions, etc.<br />[/edit]
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Wed, 18 Jun 2003 02:40:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>At first, you&#39;d have to implement something like a relative coordinate system.</p><p>Then you&#39;ll need functions to translate between the systems, and also functions to clip rects (imagine the case when a child is partly outside its parent container).</p><p>Then you need to ensure that no widget can draw outside it&#39;s visible area. If everything worked in step one and two, this should not be that problematic.</p><p>I had a look at the changes needed and decided that it&#39;s not worth the effort.</p><p>If I ever start something similar again, I would start from scratch.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Wed, 18 Jun 2003 03:03:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah I know what you mean, at least dialog boxes are separate containers in my GUI, nothing can draw outside of them because they are separate bitmaps.  The relative system I have going though is kind of a hack, the structure takes absolute coordinates, i.e. dialog.x is 100, button1.x is 120, and teh button appears 20 pixels inside of teh dialog box, however when a proc goes to draw itself it must translate it&#39;s position relative to the dilaog box position since it&#39;s drawing to it&#39;s bitmap surface.  This surface can be clipped to inside of it&#39;s borders as well so that when you resize the sides overlap it&#39;s contents.  Maybe what we need is a simple base system to base GUI&#39;s off of, something that allows for flexibility than the allegro GUI, and to build off of that.  Either way though, I&#39;ve come too far with my GUI to back down... I&#39;ll see how far I can take this thing before I can absolutely go no further <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Wed, 18 Jun 2003 04:17:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Sounds like everyone&#39;s pretty much agreed that rather than adapting the existing allegro GUI I should write a new one..</p><p>Curses! <br />You Fiends! Do you know how long that will take me ?! <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /> hehe..</p><p><img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 18 Jun 2003 23:49:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>depends what you want.<br />If you really want a full fledged gui, yep, writing a new one would be the way to go.</p><p>You should start by listing all widgets / features you want. Depending on this list it migh be possible to use allegro&#39;s GUI functions as a framework.</p><p>If you take a look at &quot;Plastic Animation Paper&quot; for example, or at some other programs like the old spaint from crack dot com... something like this could be done easily using allegro as backbone.</p><p>It&#39;s always a question of what you need <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Thu, 19 Jun 2003 01:52:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just for teh curious and for Richard, I copied and pasted much of my programs nas_do_dialog and nas_update_player from teh allegro source, but since it&#39;s already separated from Allegro it should be easier to customize to your own needs.  Which means I need to start rewriting sections of it myself, but at least I have it set up so I can do so.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Thu, 19 Jun 2003 05:09:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s difficult to write a good GUI. Not that the main functionalities are difficult to implement, but there are a lot of things involved:</p><p>1) events should be queued. It&#39;s frustrating to click buttons but the GUI ignores them because it did something else than polling events at that time.</p><p>2) geometry management. A hot subject. If you look at commercial stuff, you will see lots of code for it. But, in a good gui, the programmer shall not position widgets at absolute positions.</p><p>3) skinning. Ok, that&#39;s fairly easy. But it involves careful planning of what resources each widget needs.</p><p>4) the Allegro does not have a paint origin: every coordinate passed in a drawing function is relative to 0, 0. But widgets need to draw into themselves, using their topleft corner as 0, 0. </p><p>5) drag-n-drop. Sooner or later, you will need widgets to talk between themselves and negotiate data transfers.</p><p>6) clipboard. Nuff-said. What GUI program is useful without a clipboard ?</p><p>7) Basic widgets like buttons are very easy to implement. But the most interesting widgets take big amounts of effort to get it right: trees, toolbars, grids, tables, etc. And you need to have toolbars in a modern gui. Have you ever wondered why Allegro carefully avoids more complex widgets ?</p><p>8) file associations. File dialogs need to know this as well as the icons for each registered file type.</p><p>9) text output. Allegro routines can&#39;t draw partial strings, and you need to make some hacking in order to properly display text.</p><p>10) a good GUI needs truetype fonts. Allegro does not have true type fonts. Although Alfont is an excellent library, it does not have routines for drawing underlined &quot;&amp;&quot; characters. More hacking here.</p><p>11) the event model: how to raise windows when their controls are clicked. Windows knows when a window is toplevel, and it is raised automatically by the system when a child is clicked. But that is not valid in your gui, since you want to make a general purpose gui lib. So you have to come up with a system where events are bubbled up or propagated down...but its one has its own problems.</p><p>12) keyboard management: keyboard shortcuts, hot keys, etc. When pressing alt, Allegro gives you a number from 1 to 26 for each English letter. But that does not tell you what the character was, so good luck with implementing hot keys (not that it can&#39;t be done, though).</p><p>13) there is a long list of complementary classes that you need to code in order to make a gui. Take trees for example: widgets are trees, and tree items within a tree view are also trees. So, you need a template class that implements trees. You also need smart pointers and reference counting for managing resources (skin objects shared by widgets, for example). You also need to make your own string class that manages Allegro unicode strings. And don&#39;t forget those template classes for signals with 0, 1, 2 or more parameters.</p><p>14) how about an IDE ? it is really boring to write guis by hand. But then your classes would need reflection, i.e. to have the ability to manage widgets without knowing the class: just by using a predefined interface. IDEs are written that way. But good reflection can take ages to write, for each widget class.</p><p>15) you would also need a mouse cursor factory, since you can&#39;t have one bitmap for all video modes. That means routines for remapping bitmaps from one color depth to another, taking care of the mask pixel values (blit does not do that, does it ?). You should also code a routine that draws bitmaps disabled, i.e. with raised or sunken outline.</p><p>16) you need to make a smart architecture about the application&#39;s actions, since many elements will call the same action. For example, the save menu command shall be disabled when the document is already saved; but the toolbar save icon should also be disabled in such a case. These two must be linked somehow, otherwise the programmer will have to explicitely disable all related resources.</p><p>I&#39;ve done more than 50 tries to write a good gui. I&#39;ve written a Window system (Mx-Windows, if you are interested), but after finding how region clipping works, the rest was easy. But a gui toolkit..., that&#39;s a completely different thing. I&#39;ve bitten myself too many times, thinking I&#39;ve got a great design, then started adding virtual functions all over the place, only to come up with a mess, which I delete afterwards.</p><p>And since a GUI can be so large, either be prepared for a long development time, or get your friends to help you.</p><p>(Or we could just assemble a team of coders: I could write the basic functionality (from group feedback, of course), the most basic classes, then each one of the group, including me, we would implement one or two widgets. For example, if we had 10 programmers, we could easily have 50 widgets in two weeks time: each programmer would make 5 widgets in two weeks.)</p><p>I think a proper fully-fledged GUI is the most difficult thing to write. That&#39;s why so few toolkits got it right: Qt, Swing, Photon (maybe there are other good things out there, I don&#39;t know all). But the fact is that most gui libs are limited or flawed.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sat, 21 Jun 2003 05:14:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Thanks for that post. I&#39;m going to give your comments added value since you wrote mx-windows. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>If you&#39;ve wrote many GUI attempts, then have you decided which design works best of all? Or is there no such thing?</p><p>I can see how a GUI is going to be a lot of work. It&#39;s unfortunate as the Allegro GUI just isn&#39;t good enough for me. I&#39;m also not sure about adapting any existing GUI library after some of the earlier suggestions in this thread to start from scratch..</p><p>Hmmm...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Sat, 21 Jun 2003 16:21:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>mx-windows just plain rocks. I started writing a themeable widget set onto of (a slightly modified/extended) mx-windows, and since mx-windows can do shaped windows, you get shaped themed windows <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /></p><p>really nice if you ask me.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 21 Jun 2003 16:23:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If you&#39;ve wrote many GUI attempts, then have you decided which design works best of all? Or is there no such thing?
</p></div></div><p>

I can&#39;t really say which approach works best. When writting a small library like MxWindows, it is quite easy to stay focused. But a full gui library, I don&#39;t know...If I knew, I would have made one, wouldn&#39;t I ? <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I can see how a GUI is going to be a lot of work.
</p></div></div><p>

This is solvable: we need cooperation.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
It&#39;s unfortunate as the Allegro GUI just isn&#39;t good enough for me.
</p></div></div><p>

And for me, also. I imagine for many others, as well.</p><p>So, guys, Richard, Thomas, Steve Terry, Miran, Spellcaster, I have a question for you: why don&#39;t we join forces and produce the Allegro&#39;s ultimate GUI ? we can have a short period discussing the main issues, then each one of us can take the responsibility for producing a number of widgets. Since widgets are independent of each other, each one of us can take his/her own time and do as good as job as needed. I can make the framework classes for you to get started with!!!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sat, 21 Jun 2003 21:20:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This would be awesome. For tools and stuff. But Could it be usefull as a generic gui for in game stuff? Maybe config and what not.. Yo know? if the framework is good enough this could seriously rock.</p><p>also, Hopefully this&#39;ll work. But some widgets will take longer than others <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 21 Jun 2003 21:40:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m up for it though I think something like this has been attempted before without much success.. a lot of discussion but after that it just died.  I know we need cooperation and determination with team effort to even get this thing off the ground and that&#39;s if everyone else you mentioned agrees with your statement.  We need to decide on how the individual components will be divided up and who will take which tasks etc as well as the language we&#39;re going to base this on.. I&#39;m for C since I&#39;m adept with it and it&#39;s the language allegro is based on.  If you go C++ that&#39;s fine but it will lose all possiblility of being integrated into allegro if it&#39;s good enough doing away with the hideous GUI forever <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Sat, 21 Jun 2003 22:05:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I see a couple of problems. First one would be the C vs C++ discussion.</p><p>If you ask me, we should go for c++.<br />I doubt the allegro gui will still be part of allegro for v5, anyway.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Sun, 22 Jun 2003 00:32:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Even though, I prefer C, C++ probably is a better option. IMO.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 22 Jun 2003 00:33:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If we use C, we have to implement all the OO stuff ourselfs, so why not use the OO mechanism C++ provides already?</p><p>Virtual functions and polymorphism is what makes GUI development easy. Without it, you&#39;ll run into problems sooner or later.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Sun, 22 Jun 2003 01:43:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think you are all positive to the idea of making a gui for Allegro. That&#39;s a good start. Of course, there is going to be a lot of disagreements, but we can solve them the democratic way: by voting. The minority would have to accept the majority&#39;s decision. Of course, any thesis should be backed up by the proper arguments, shouldn&#39;t it ?</p><p>So, let me present you with my opinion on the programming language: I think C++ is the way to go, for the following reasons:</p><p>1) Allegro 5 will not have an intergrated gui.</p><p>2) A proper gui lib would be twice as large as Allegro itself. I don&#39;t think the main library should be that fat.</p><p>3) C++ offers object oriented mechanisms, like encapsulation and polymorphism and inheritance. These features will have to be emulated in plain C, which is a tedious task.</p><p>So, for me, the proper language is C++. </p><p>Do we agree on C++ ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sun, 22 Jun 2003 03:01:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>.. Agreed
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Sun, 22 Jun 2003 04:51:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Not agreed <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /></p><p>My reasoning is as follows.</p><p>It is not possible to use a C++ library in a C program, but a C++ API can be wrapped around a C library.</p><p>C is easier to optimise and debug, IMO</p><p>My lib is in C, and works fine.</p><p>OK, that isn&#39;t all exactly objective reasoning, but the first point is hard to argue with.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Sun, 22 Jun 2003 06:57:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>It is not possible to use a C++ library in a C program, but a C++ API can be wrapped around a C library.</p></div></div><p>

Some of Allegro 5&#39;s internals are C++, and it will be useable with C. You can link to non-overloaded static C++ functions from C, AFAIK.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sun, 22 Jun 2003 07:43:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>aigh ok, can it be agreed upon then to have some parts of the GUI in C++ as long as there is NO overloading for C backwards compatibility if it must be done so less work is needed.  I&#39;m cool with that idea, but yes we must not limit the audience by using strict C++ code because many will be turned away.  I mean that IS the main reason I&#39;m attempting my lib in pure C and it&#39;s come a long ways... yet I still have a long way to go.  Maybe if someone helps me work on my GUI subsystem aka nas.c, gets relative systems going and some way to do menus/multiple dialogs it&#39;d be good to go.  I have an excellent mouse system (at least I think so), I have the font system down with both points accomplished (the &amp;&amp; system with TTF and partial strings... I clip mine but I think you mean the ... thing which I have yet to hack out), the skin system could use some help, but it works.  But again it&#39;s probably best to start over since rewriting the subsytem will probably mean I&#39;d have to propegate though all my other functions and apply any needed changes.. which definately takes time. <br />Hmm the next thing we need to decide on is... what the dialog container, are we gong with a structure like the <b>cough</b> allegro GUI or maybe a linked list structure, I&#39;m not sure exactly what windows or Xwindows does... maybe a win_main() type callback?  Just suggestions.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Sun, 22 Jun 2003 10:45:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Signals and slots is where its at <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /> no WndProc, no callbacks, just signals and slots. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 22 Jun 2003 11:08:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">MattSmith said:</div><div class="quote"><p>
It is not possible to use a C++ library in a C program
</p></div></div><p>
Another possible way of doing this is to turn the library into a COM object. This is probably overkill and X-G&#39;s method may be sufficient, but this is how DirectX works. When I was at Criterion, our game engine (not Renderware, Dive - the one they use internally) was built entirely out of COM objects. We wrote the objects in C++, but they could easily be used by a C program simply because they were COM objects. The downside is that COM only exists natively on Windows (AFAIK), but at Criterion, we managed to create a working multi-platform implementation of COM (at the time I left, we were getting it to work on the Dreamcast). Even with Windows&#39;s native COM, it would require quite a bit to get a working COM engine up and running.</p><p>Another suggestion for the GUI is to write it in C++, but use a C++ to C translator so the end-user can build a C version of the library if they&#39;re using C. I know that such programs exist. In fact, the first ever C++ &#39;compiler&#39; was really just a C++ to C translator that passed the output to a C compiler.</p><p>I&#39;m writing a GUI as part of Chickens which is being written in C. The GUI is the only part of the code where I think writing it in C++ would have been a lot better. Writing the rest of the game in C feels fine to me.</p><p>AE.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Andrei Ellman)</author>
		<pubDate>Sun, 22 Jun 2003 13:51:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
You know, both C and C++ are compiled down to machine code by the time you link them anyway - the only problem lies in name mangling, and extern &quot;C&quot; { } will take care of that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sun, 22 Jun 2003 14:00:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>One thing I&#39;ll have to note, In the game I&#39;ll probably die before it gets done, will use the game engine for the gui.. all scripted and such. Don&#39;t know how possible it&#39;ll be to use a premade lib for the handling.. probably impossible. Or at the very least improbable.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 22 Jun 2003 14:13:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, personally I prefer C++, but if I am a minority, I am willing to accept C as the language of choice. From what I see, C++ looks scary to some people. C is no problem for me.</p><p>If we use C, I propose that we do a clever system with classes like the following:</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="k1">struct</span> OBJECT<span class="k2">;</span></td></tr><tr><td class="number">2</td><td>&#160;</td></tr><tr><td class="number">3</td><td><span class="c">//property descriptor</span></td></tr><tr><td class="number">4</td><td><span class="k1">typedef</span> <span class="k1">struct</span> PROPERTY <span class="k2">{</span></td></tr><tr><td class="number">5</td><td>    <span class="k1">int</span> id<span class="k2">;</span></td></tr><tr><td class="number">6</td><td>    <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>name<span class="k2">;</span></td></tr><tr><td class="number">7</td><td>    <span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>set<span class="k2">)</span><span class="k2">(</span><span class="k1">struct</span> OBJECT <span class="k3">*</span>object, <span class="k1">const</span> <span class="k1">void</span> <span class="k3">*</span>value<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">8</td><td>    <span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>get<span class="k2">)</span><span class="k2">(</span><span class="k1">struct</span> <span class="k1">const</span> OBJECT <span class="k3">*</span>object, <span class="k1">void</span> <span class="k3">*</span>value<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">9</td><td><span class="k2">}</span> PROPERTY<span class="k2">;</span></td></tr><tr><td class="number">10</td><td>&#160;</td></tr><tr><td class="number">11</td><td><span class="c">//object vtable</span></td></tr><tr><td class="number">12</td><td><span class="k1">typedef</span> <span class="k1">struct</span> VTABLE <span class="k2">{</span></td></tr><tr><td class="number">13</td><td>    <span class="k1">void</span> <span class="k3">*</span><span class="k2">(</span><span class="k3">*</span>get_instance<span class="k2">)</span><span class="k2">(</span><span class="k1">struct</span> OBJECT <span class="k3">*</span>obj, <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>name<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td><span class="k2">}</span> VTABLE<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">//an object's class</span></td></tr><tr><td class="number">17</td><td><span class="k1">typedef</span> <span class="k1">struct</span> CLASS <span class="k2">{</span></td></tr><tr><td class="number">18</td><td>    <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>name<span class="k2">;</span></td></tr><tr><td class="number">19</td><td>    <span class="k1">int</span> size<span class="k2">;</span></td></tr><tr><td class="number">20</td><td>    CLASS <span class="k3">*</span>super<span class="k2">;</span></td></tr><tr><td class="number">21</td><td>    <span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>constructor<span class="k2">)</span><span class="k2">(</span><span class="k1">struct</span> OBJECT <span class="k3">*</span>obj<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">22</td><td>    <span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>destructor<span class="k2">)</span><span class="k2">(</span><span class="k1">struct</span> OBJECT <span class="k3">*</span>obj<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">23</td><td>    VTABLE <span class="k3">*</span>vtable<span class="k2">;</span></td></tr><tr><td class="number">24</td><td>    PROPERTY <span class="k3">*</span>properties<span class="k2">;</span></td></tr><tr><td class="number">25</td><td><span class="k2">}</span> CLASS<span class="k2">;</span></td></tr><tr><td class="number">26</td><td>&#160;</td></tr><tr><td class="number">27</td><td><span class="c">//the object struct</span></td></tr><tr><td class="number">28</td><td><span class="k1">typedef</span> <span class="k1">struct</span> OBJECT <span class="k2">{</span></td></tr><tr><td class="number">29</td><td>    CLASS <span class="k3">*</span>rclass<span class="k2">;</span>     <span class="c">//run time class</span></td></tr><tr><td class="number">30</td><td><span class="k2">}</span> OBJECT<span class="k2">;</span></td></tr><tr><td class="number">31</td><td>&#160;</td></tr><tr><td class="number">32</td><td><span class="c">//function that creates an object</span></td></tr><tr><td class="number">33</td><td>OBJECT <span class="k3">*</span>create_object<span class="k2">(</span>CLASS <span class="k3">*</span>cl, ...<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">34</td><td>&#160;</td></tr><tr><td class="number">35</td><td><span class="c">//function that destroys an object</span></td></tr><tr><td class="number">36</td><td><span class="k1">void</span> destroy_object<span class="k2">(</span>OBJECT <span class="k3">*</span>obj<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">37</td><td>&#160;</td></tr><tr><td class="number">38</td><td><span class="c">//function that sets an object's properties</span></td></tr><tr><td class="number">39</td><td><span class="k1">void</span> set_object_properties<span class="k2">(</span>OBJECT <span class="k3">*</span>obj, ...<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">40</td><td>&#160;</td></tr><tr><td class="number">41</td><td><span class="c">//function that retrieves an object's properties</span></td></tr><tr><td class="number">42</td><td><span class="k1">void</span> get_object_properties<span class="k2">(</span>OBJECT <span class="k3">*</span>obj, ...<span class="k2">)</span><span class="k2">;</span></td></tr></tbody></table></div></div><p>

So, classes can be declared 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="c">//widget struct</span></td></tr><tr><td class="number">2</td><td><span class="k1">typedef</span> <span class="k1">struct</span> WIDGET <span class="k2">{</span></td></tr><tr><td class="number">3</td><td>    OBJECT object<span class="k2">;</span></td></tr><tr><td class="number">4</td><td>    <span class="k1">int</span> x, y, w, h<span class="k2">;</span></td></tr><tr><td class="number">5</td><td><span class="k2">}</span> WIDGET<span class="k2">;</span></td></tr><tr><td class="number">6</td><td>&#160;</td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td><span class="c">//widget constructor</span></td></tr><tr><td class="number">9</td><td><span class="k1">void</span> widget_constructor<span class="k2">(</span>OBJECT <span class="k3">*</span>obj<span class="k2">)</span></td></tr><tr><td class="number">10</td><td><span class="k2">{</span></td></tr><tr><td class="number">11</td><td>    WIDGET <span class="k3">*</span>wgt <span class="k3">=</span> <span class="k2">(</span>WIDGET <span class="k3">*</span><span class="k2">)</span>obj<span class="k2">;</span></td></tr><tr><td class="number">12</td><td>    wgt-&gt;x <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td>    wgt-&gt;y <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>    wgt-&gt;w <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">15</td><td>    wgt-&gt;h <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td><span class="k2">}</span></td></tr><tr><td class="number">17</td><td>&#160;</td></tr><tr><td class="number">18</td><td>&#160;</td></tr><tr><td class="number">19</td><td><span class="c">//widget destructor</span></td></tr><tr><td class="number">20</td><td><span class="k1">void</span> widget_destructor<span class="k2">(</span>OBJECT <span class="k3">*</span>obj<span class="k2">)</span></td></tr><tr><td class="number">21</td><td><span class="k2">{</span></td></tr><tr><td class="number">22</td><td>    <span class="c">//TODO: remove from parent, destroy children</span></td></tr><tr><td class="number">23</td><td><span class="k2">}</span></td></tr><tr><td class="number">24</td><td>&#160;</td></tr><tr><td class="number">25</td><td>&#160;</td></tr><tr><td class="number">26</td><td><span class="c">//widget vtable</span></td></tr><tr><td class="number">27</td><td><span class="k1">typedef</span> <span class="k1">struct</span> WIDGET_VTABLE <span class="k2">{</span></td></tr><tr><td class="number">28</td><td>    VTABLE object_vtable<span class="k2">;</span></td></tr><tr><td class="number">29</td><td>    <span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>set_geometry<span class="k2">)</span><span class="k2">(</span>WIDGET <span class="k3">*</span>wgt, <span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">int</span> w, <span class="k1">int</span> h<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">30</td><td><span class="k2">}</span> WIDGET_VTABLE<span class="k2">;</span></td></tr><tr><td class="number">31</td><td>&#160;</td></tr><tr><td class="number">32</td><td>&#160;</td></tr><tr><td class="number">33</td><td><span class="c">//sets the widget's x property</span></td></tr><tr><td class="number">34</td><td><span class="k1">void</span> widget_set_x<span class="k2">(</span>OBJECT <span class="k3">*</span>obj, <span class="k1">const</span> <span class="k1">void</span> <span class="k3">*</span>value<span class="k2">)</span></td></tr><tr><td class="number">35</td><td><span class="k2">{</span></td></tr><tr><td class="number">36</td><td>    WIDGET <span class="k3">*</span>wgt <span class="k3">=</span> <span class="k2">(</span>WIDGET <span class="k3">*</span><span class="k2">)</span>obj<span class="k2">;</span></td></tr><tr><td class="number">37</td><td>    wgt-&gt;x <span class="k3">=</span> <span class="k3">*</span><span class="k2">(</span><span class="k1">const</span> <span class="k1">int</span> <span class="k3">*</span><span class="k2">)</span>value<span class="k2">;</span></td></tr><tr><td class="number">38</td><td><span class="k2">}</span></td></tr><tr><td class="number">39</td><td>&#160;</td></tr><tr><td class="number">40</td><td>&#160;</td></tr><tr><td class="number">41</td><td><span class="c">//gets the widget's x property</span></td></tr><tr><td class="number">42</td><td><span class="k1">void</span> widget_get_x<span class="k2">(</span><span class="k1">const</span> OBJECT <span class="k3">*</span>obj, <span class="k1">void</span> <span class="k3">*</span>value<span class="k2">)</span></td></tr><tr><td class="number">43</td><td><span class="k2">{</span></td></tr><tr><td class="number">44</td><td>    <span class="k1">const</span> WIDGET <span class="k3">*</span>wgt <span class="k3">=</span> <span class="k2">(</span><span class="k1">const</span> WIDGET <span class="k3">*</span><span class="k2">)</span>obj<span class="k2">;</span></td></tr><tr><td class="number">45</td><td>    <span class="k3">*</span><span class="k2">(</span><span class="k1">int</span> <span class="k3">*</span><span class="k2">)</span>value <span class="k3">=</span> wgt-&gt;x<span class="k2">;</span></td></tr><tr><td class="number">46</td><td><span class="k2">}</span></td></tr><tr><td class="number">47</td><td>&#160;</td></tr><tr><td class="number">48</td><td>&#160;</td></tr><tr><td class="number">49</td><td><span class="c">//widget properties</span></td></tr><tr><td class="number">50</td><td>PROPERTY widget_properties<span class="k2">[</span><span class="k2">]</span> <span class="k3">=</span> <span class="k2">{</span></td></tr><tr><td class="number">51</td><td>    <span class="k2">{</span> PROP_X, <span class="s">"x"</span>, widget_set_x, widget_get_x <span class="k2">}</span>,</td></tr><tr><td class="number">52</td><td>    <span class="k2">{</span> PROP_Y, <span class="s">"y"</span>, widget_set_y, widget_get_y <span class="k2">}</span>,</td></tr><tr><td class="number">53</td><td>    <span class="k2">{</span> PROP_W, <span class="s">"w"</span>, widget_set_w, widget_get_w <span class="k2">}</span>,</td></tr><tr><td class="number">54</td><td>    <span class="k2">{</span> PROP_H, <span class="s">"h"</span>, widget_set_h, widget_get_h <span class="k2">}</span>,</td></tr><tr><td class="number">55</td><td>    <span class="k2">{</span> <span class="n">0</span> <span class="k2">}</span></td></tr><tr><td class="number">56</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">57</td><td>&#160;</td></tr><tr><td class="number">58</td><td>&#160;</td></tr><tr><td class="number">59</td><td><span class="c">//widget class</span></td></tr><tr><td class="number">60</td><td>CLASS widget_class <span class="k3">=</span> <span class="k2">{</span></td></tr><tr><td class="number">61</td><td>    <span class="s">"Widget"</span>,         <span class="c">//this class is named "Widget"</span></td></tr><tr><td class="number">62</td><td>    <span class="k1">sizeof</span><span class="k2">(</span>WIDGET<span class="k2">)</span>,   <span class="c">//size of struct</span></td></tr><tr><td class="number">63</td><td>    NULL,             <span class="c">//base class</span></td></tr><tr><td class="number">64</td><td>    widget_constructor, <span class="c">//constructor</span></td></tr><tr><td class="number">65</td><td>    widget_destructor,  <span class="c">//destructor</span></td></tr><tr><td class="number">66</td><td>    widget_vtable,      <span class="c">//widget vtable</span></td></tr><tr><td class="number">67</td><td>    widget_properties  <span class="c">//properties</span></td></tr><tr><td class="number">68</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">69</td><td>&#160;</td></tr><tr><td class="number">70</td><td><span class="c">//usage</span></td></tr><tr><td class="number">71</td><td>OBJECT <span class="k3">*</span>wgt1 <span class="k3">=</span> create_object<span class="k2">(</span><span class="k3">&amp;</span>widget_class, </td></tr><tr><td class="number">72</td><td>    PROP_X, <span class="n">10</span>,</td></tr><tr><td class="number">73</td><td>    PROP_Y, <span class="n">20</span>,</td></tr><tr><td class="number">74</td><td>    PROP_W, <span class="n">100</span>,</td></tr><tr><td class="number">75</td><td>    PROP_H, <span class="n">500</span>,</td></tr><tr><td class="number">76</td><td>    NULL<span class="k2">)</span><span class="k2">;</span></td></tr></tbody></table></div></div><p>


In a few words, this is a C interface for doing object-oriented programming, while at the same time allowing COM-style functionality, run-time object identification, single inheritance, and run-time property management for IDEs.</p><p>Inheritance works by embedding the super class instance as the first member of the object. Example:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">typedef</span> <span class="k1">struct</span> BUTTON <span class="k2">{</span>
    WIDGET widget<span class="k2">;</span>
    <span class="k1">char</span> <span class="k3">*</span>text<span class="k2">;</span>
<span class="k2">}</span> BUTTON<span class="k2">;</span>
</pre></div></div><p>

In the above example, OBJECT *, WIDGET * and BUTTON * all point to the same object.</p><p>We could also generalize the signals &amp; slots/callbacks/object events/whatever in the following way:</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="c">//a slot</span></td></tr><tr><td class="number">2</td><td><span class="k1">typedef</span> <span class="k1">struct</span> SLOT <span class="k2">{</span></td></tr><tr><td class="number">3</td><td>    NODE node<span class="k2">;</span></td></tr><tr><td class="number">4</td><td>    OBJECT <span class="k3">*</span>object<span class="k2">;</span></td></tr><tr><td class="number">5</td><td>    <span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span><span class="k1">struct</span> OBJECT <span class="k3">*</span>obj<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td><span class="k2">}</span> SLOT<span class="k2">;</span></td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td><span class="c">//a signal</span></td></tr><tr><td class="number">9</td><td><span class="k1">typedef</span> <span class="k1">struct</span> SIGNAL <span class="k2">{</span></td></tr><tr><td class="number">10</td><td>    LIST slots<span class="k2">;</span></td></tr><tr><td class="number">11</td><td><span class="k2">}</span> SIGNAL<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">//emits a signal</span></td></tr><tr><td class="number">14</td><td><span class="k1">void</span> emit_signal<span class="k2">(</span>SIGNAL <span class="k3">*</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_724.html" target="_blank">signal</a><span class="k2">)</span></td></tr><tr><td class="number">15</td><td><span class="k2">{</span></td></tr><tr><td class="number">16</td><td>    <span class="k1">for</span><span class="k2">(</span>SLOT <span class="k3">*</span>slot <span class="k3">=</span> <span class="k2">(</span>SLOT <span class="k3">*</span><span class="k2">)</span>signal-&gt;slots.first<span class="k2">;</span> slot<span class="k2">;</span> slot <span class="k3">=</span> <span class="k2">(</span>SLOT <span class="k3">*</span><span class="k2">)</span>slot-&gt;node.next<span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">17</td><td>        slot-&gt;proc<span class="k2">(</span>slot-&gt;object<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">18</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">19</td><td><span class="k2">}</span></td></tr><tr><td class="number">20</td><td>&#160;</td></tr><tr><td class="number">21</td><td><span class="c">//connects a slot to a signal</span></td></tr><tr><td class="number">22</td><td><span class="k1">void</span> connect_slot<span class="k2">(</span>SIGNAL <span class="k3">*</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_724.html" target="_blank">signal</a>, OBJECT <span class="k3">*</span>obj, <span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span>OBJECT <span class="k3">*</span>obj<span class="k2">)</span><span class="k2">)</span></td></tr><tr><td class="number">23</td><td><span class="k2">{</span></td></tr><tr><td class="number">24</td><td>    SLOT <span class="k3">*</span>slot <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_81.html" target="_blank">calloc</a><span class="k2">(</span><span class="n">1</span>, <span class="k1">sizeof</span><span class="k2">(</span>SLOT<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">25</td><td>    slot-&gt;object <span class="k3">=</span> obj<span class="k2">;</span></td></tr><tr><td class="number">26</td><td>    slot-&gt;proc <span class="k3">=</span> proc<span class="k2">;</span></td></tr><tr><td class="number">27</td><td>    append_node<span class="k2">(</span><span class="k3">&amp;</span>signal-&gt;slots, <span class="k3">&amp;</span>slot-&gt;node<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">28</td><td><span class="k2">}</span></td></tr><tr><td class="number">29</td><td>&#160;</td></tr><tr><td class="number">30</td><td><span class="c">//a button with a signal</span></td></tr><tr><td class="number">31</td><td><span class="k1">typedef</span> <span class="k1">struct</span> BUTTON <span class="k2">{</span></td></tr><tr><td class="number">32</td><td>    WIDGET widget<span class="k2">;</span></td></tr><tr><td class="number">33</td><td>    <span class="k1">char</span> <span class="k3">*</span>text<span class="k2">;</span></td></tr><tr><td class="number">34</td><td>    SIGNAL click<span class="k2">;</span></td></tr><tr><td class="number">35</td><td><span class="k2">}</span> BUTTON<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">//a dialog</span></td></tr><tr><td class="number">38</td><td><span class="k1">typedef</span> <span class="k1">struct</span> <a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> <span class="k2">{</span></td></tr><tr><td class="number">39</td><td>    WIDGET widget<span class="k2">;</span></td></tr><tr><td class="number">40</td><td>    BUTTON <span class="k3">*</span>okButton<span class="k2">;</span></td></tr><tr><td class="number">41</td><td><span class="k2">}</span> <a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a><span class="k2">;</span></td></tr><tr><td class="number">42</td><td>&#160;</td></tr><tr><td class="number">43</td><td><span class="c">//called when the dialog is accepted</span></td></tr><tr><td class="number">44</td><td><span class="k1">void</span> dialog_accept<span class="k2">(</span>OBJECT <span class="k3">*</span>obj<span class="k2">)</span></td></tr><tr><td class="number">45</td><td><span class="k2">{</span></td></tr><tr><td class="number">46</td><td>    <a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> <span class="k3">*</span>dlg <span class="k3">=</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> <span class="k3">*</span><span class="k2">)</span>obj<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>&#160;</td></tr><tr><td class="number">49</td><td><span class="c">//dialog constructor</span></td></tr><tr><td class="number">50</td><td><span class="k1">void</span> dialog_constructor<span class="k2">(</span>OBJECT <span class="k3">*</span>obj<span class="k2">)</span></td></tr><tr><td class="number">51</td><td><span class="k2">{</span></td></tr><tr><td class="number">52</td><td>    <a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> <span class="k3">*</span>dlg <span class="k3">=</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/DIALOG" target="_blank"><span class="a">DIALOG</span></a> <span class="k3">*</span><span class="k2">)</span>obj<span class="k2">;</span></td></tr><tr><td class="number">53</td><td>    dlg-&gt;okButton <span class="k3">=</span> <span class="k2">(</span>BUTTON <span class="k3">*</span><span class="k2">)</span>create_object<span class="k2">(</span><span class="k3">&amp;</span>button_class, </td></tr><tr><td class="number">54</td><td>        ID_TEXT, <span class="s">"Ok"</span>,</td></tr><tr><td class="number">55</td><td>        NULL<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">56</td><td>    connect_slot<span class="k2">(</span><span class="k3">&amp;</span>dlg-&gt;okButton-&gt;click, obj, dialog_accept<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">57</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>

By the way, we we also need a generalized linked list module, as it is obvious from the above example.</p><p>P.S.: if you like the above style of programming, let me know. I can finish the module today.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sun, 22 Jun 2003 15:45:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Argh, you&#39;ve just depressed me Axilmar! You&#39;re far far beyond me in your programming skills. <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" /><br />I don&#39;t think I&#39;ll be much use for this project.. Which is disappointing to me.</p><p><img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /></p><p>EDIT: I think it&#39;s the way you use C to do C++ things. I just can&#39;t seem to get my head around C++ concepts. Even concepts in C like pointers get me confused.. <img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" /></p><p>Any chance you can explain what&#39;s happening in your code examples?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Sun, 22 Jun 2003 17:06:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>RP: You&#39;ve got to be kidding me, you&#39;re totally capable of that <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> In the least, you&#39;ve got an amazing design/artistic sense.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 22 Jun 2003 17:26:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m not that sure if choosing the C approach will result in any postive results for us.<br />If we go for our own OO implementation, I&#39;d try to add some more features, like the possibility to query for interfaces, etc.</p><p>Using aggregation to implement inheritance on that level is not a very good idea, as well.</p><p>Ok, after all this nay-saying I should try to come up with some positive suggestions as well, I guess <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>What about using a hashtable to store methods and attributes? We could even have different tables for private / protected / public members if needed.</p><p>But this is just an idea, not sure if it would be practical... </p><p>BTW, I still say we should stick with C++.<br />I see no point in doing a C API.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Sun, 22 Jun 2003 17:37:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Unfortunately I&#39;m not kidding... <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" /></p><p>What&#39;s aggregation and what&#39;s a hash table?<br />I don&#39;t have a take on whether it&#39;s C or C++, I&#39;ll leave that to the people who know more about all this than me! <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Sun, 22 Jun 2003 17:54:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Aggregation, in OO, is what&#39;s some times call &quot;has a&quot; relation - when a class contains another object. The alternative is Inheritance - &quot;is a&quot;.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sun, 22 Jun 2003 17:55:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Richard:</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Argh, you&#39;ve just depressed me Axilmar! You&#39;re far far beyond me in your programming skills. <br />I don&#39;t think I&#39;ll be much use for this project.. Which is disappointing to me
</p></div></div><p>

Please, don&#39;t be depressed. Of course each one of us has different skills, according to our experience. If you think you are not at the same level, it&#39;s a good chance for you to learn while giving something back to the community. We are all going to learn many things through cooperation.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Any chance you can explain what&#39;s happening in your code examples?
</p></div></div><p>

It&#39;s easy: a CLASS struct has all information that describes a class. This information is used to create OBJECT structs, i.e. structs that inherit from OBJECT. The CLASS struct is filled by you, the programmer with proper information. The rest is done by the framework which has 4 main functions: </p><p>1) a function for creating an object : &#39;create_object&#39;<br />2) a function for destroying an object : &#39;destroy_object&#39;<br />3) a function for retrieving the properties of an object: &#39;get_object_properties&#39;<br />4) a function for setting the properties of an object: &#39;set_object_properties&#39;</p><p>Since the framework knows which properties each object has, it searches the class table to find a property (search is done by the property id), then calls either &#39;set&#39; or &#39;get&#39; of the found PROPERTY struct.</p><p>Spellcaster:</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I&#39;m not that sure if choosing the C approach will result in any postive results for us.<br />If we go for our own OO implementation, I&#39;d try to add some more features, like the possibility to query for interfaces, etc
</p></div></div><p>

I don&#39;t like the C approach either, but a good GUI needs many hands. So, if it is difficult to find C++ coders in here, maybe we should do it in C. For me, a primary concern is to get it over as quickly as possible, because a good gui for Allegro is long overdue (some years!!!).</p><p>The VTABLE struct has a method &#39;get_instance&#39; that is used to query the object for interfaces.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sun, 22 Jun 2003 17:57:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
If anyone cares, I&#39;m a C++ coder. Not that I&#39;m any good. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sun, 22 Jun 2003 17:58:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, here is a zip file that contains the object-oriented C framework I talked earlier and an example.</p><p>If we choose C, I suggest we use this or a similar framework, in order to make our lifes easier...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sun, 22 Jun 2003 18:20:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As said, I coded quite few java widgets sets at work. It&#39;s not that difficult once you have basic framework.</p><p>Starting from java.awt.Container it&#39;s normally a 8 week job to create a basic widget set with all widgets needed for your normal digital tv needs.<br />This includes pushbuttons, checkboxes, radiobuttons, thumbwheels, inputwidgets for num and alphanum, formatted text input, textoutput, icons, scrollbar, scrollpanes, splitter windows, tabbed windows, lists, trees and focus management.</p><p>We normally did this in a 4week, 2 persons routine (using your normal 8h workdays).</p><p>I don&#39;t think writing a widget set / gui lib is that much of a problem if one decides first what he wants.</p><p>The problem with GUIs for game development is normally that the &quot;what people want&quot; part is the most problematic point.</p><p>IMO, throwing code around right now, is a pretty bad idea.<br />If we want to start creating a GUI, what we should do first is collecting a list of wanted features / requirements.</p><p>Then we should start grouping them, both inheritance and priority wise. Once this is done, we&#39;ll be able to get an image of what we need as a framework. </p><p>I think most of us (reading this thread) have already a pretty good view of what they want. I also think our views are prety different. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />Since I&#39;m used to java widget sets (and prefer this way of coding to win32 style), I tend to go into the direction and recrating this environment.</p><p>Others might prefer the win style.</p><p>So, i&#39;t important that we get a better idea of what we want, before we start thinking about &quot;how we implement it&quot;.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Sun, 22 Jun 2003 18:46:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Again, I know this is skipping ahead ... but today I wrote (entirely unrelated to this) another entity system I realized in the end was very similar to how GUI systems group their widgets. A .tar.gz is attached - have a look if you want.</p><p>No, I&#39;m not trying to hijack the thread. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sun, 22 Jun 2003 18:49:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
X-G!! I could swear at you!!</p><p>You say you can&#39;t do work on your version of Chaos and then you show me some code that I can&#39;t even understand!</p><p>Grrr...</p><p><img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>On-topic I think that people need to decide C/C++ before they do any coding.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Sun, 22 Jun 2003 18:55:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
That work wasn&#39;t for my Chaos clone. If you didn&#39;t know, it&#39;s listed as Inactive/Abandoned on my page (see sig).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sun, 22 Jun 2003 19:44:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, here is a list of widgets that I would like to have:</p><p>1) button<br />2) check box<br />3) radio button<br />4) button frame<br />5) scroll bar<br />6) slider<br />7) separator<br />8) label<br />9) image<br />10) raised panel<br />11) sunken panel<br />12) menu bar<br />13) menu item<br />14) popup menu<br />15) window<br />16) toolbar<br />17) tool button<br />18) tree<br />19) list<br />20) text box<br />21) text editor<br />22) html viewer<br />23) splitter<br />24) spin box<br />25) combo box<br />26) table<br />27) common dialogs<br />28) bitmap button<br />29) message box</p><p>Hmmm...it certainly does not seem as a 2 month job to me, especially if the underlying window and drawing system is not there. On top of it, I would like a programming style as simple as possible: just creating one widget within the other, set a few properties, a few callbacks, and that&#39;s it basically. </p><p>I am thinking towards applications for Allegro, and not necessarily games.</p><p>Bah, now that I think it, it is too much work, especially for the summer...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sun, 22 Jun 2003 20:54:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Okay, I&#39;m going to be critical a bit - see this as positive feedback, because I&#39;m interested in seeing a good GUI lib too, and communication is what makes things better. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>10) raised panel<br />11) sunken panel</p></div></div><p>

Same widget, different options to change drawing style.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>20) text box<br />21) text editor</p></div></div><p>

Same widget - one can do multi-line, the other can&#39;t. Might as well be a flag. One can subclass if one wants, say, richtext features.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>25) combo box</p></div></div><p>

Aggregation of button/label, but still a widget in its own ...</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>27) common dialogs</p></div></div><p>

Aggregation of window and buttons - doesn&#39;t deserve its own widget, should just be a static function that creates a preset common window.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>28) bitmap button</p></div></div><p>

Add bitmap support to the regular button instead.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>29) message box</p></div></div><p>

See #27.</p><p>Also, I would like to add something like an icon pane (like your desktop, for instance) and a scrollable canvas space.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sun, 22 Jun 2003 21:01:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What&#39;s a &quot;button border&quot;?</p><p>Labels and buttons share most of the layout code (position of text and image in relation to another and the area they occupy).</p><p>Toolbars are just a container with a lot of buttons, but I agree we should have some utilities to allow a quick creation of them.</p><p>I see no difference between a menu and a pop-up menu. Your normal menu is just a pop-up menu which is shown at agiven position below your menu bar.</p><p>Ok, so let&#39;s group this list a little.
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td>Static:</td></tr><tr><td class="number">2</td><td><span class="k3">*</span> labels. Can display both text <span class="k1">and</span><span class="k3">/</span> <span class="k1">or</span> images</td></tr><tr><td class="number">3</td><td>&#160;</td></tr><tr><td class="number">4</td><td>Buttons:</td></tr><tr><td class="number">5</td><td><span class="k3">*</span> Pushbutton</td></tr><tr><td class="number">6</td><td><span class="k3">*</span> togglebutton</td></tr><tr><td class="number">7</td><td><span class="k3">*</span> checkbox</td></tr><tr><td class="number">8</td><td><span class="k3">*</span> Radiobutton <span class="k2">(</span><span class="k1">and</span> group<span class="k2">)</span></td></tr><tr><td class="number">9</td><td>&#160;</td></tr><tr><td class="number">10</td><td>Menus</td></tr><tr><td class="number">11</td><td><span class="k3">*</span> Menu Bar</td></tr><tr><td class="number">12</td><td><span class="k3">*</span> Menu</td></tr><tr><td class="number">13</td><td>&#160;</td></tr><tr><td class="number">14</td><td>Bounded Range Widgets</td></tr><tr><td class="number">15</td><td><span class="k3">*</span> sliders</td></tr><tr><td class="number">16</td><td><span class="k3">*</span> scrollbars</td></tr><tr><td class="number">17</td><td><span class="k3">*</span> Spinner</td></tr><tr><td class="number">18</td><td>&#160;</td></tr><tr><td class="number">19</td><td>Input Widgets</td></tr><tr><td class="number">20</td><td><span class="k3">*</span> textfield</td></tr><tr><td class="number">21</td><td><span class="k3">*</span> formatted input field</td></tr><tr><td class="number">22</td><td>&#160;</td></tr><tr><td class="number">23</td><td>Single Selection Widgets</td></tr><tr><td class="number">24</td><td><span class="k3">*</span> Combobox</td></tr><tr><td class="number">25</td><td><span class="k3">*</span> Thumbwheel</td></tr><tr><td class="number">26</td><td><span class="k3">*</span> Color Selector</td></tr><tr><td class="number">27</td><td>&#160;</td></tr><tr><td class="number">28</td><td>Multi Selection Widgets</td></tr><tr><td class="number">29</td><td><span class="k3">*</span> List</td></tr><tr><td class="number">30</td><td><span class="k3">*</span> Tree</td></tr><tr><td class="number">31</td><td><span class="k3">*</span> Table</td></tr><tr><td class="number">32</td><td>&#160;</td></tr><tr><td class="number">33</td><td>Container</td></tr><tr><td class="number">34</td><td><span class="k3">*</span> Panels</td></tr><tr><td class="number">35</td><td><span class="k3">*</span> Splitter Panes</td></tr><tr><td class="number">36</td><td><span class="k3">*</span> Frames</td></tr><tr><td class="number">37</td><td><span class="k3">*</span> Scrollpanes</td></tr><tr><td class="number">38</td><td><span class="k3">*</span> tabbed panes</td></tr><tr><td class="number">39</td><td>&#160;</td></tr><tr><td class="number">40</td><td>Dialogs </td></tr><tr><td class="number">41</td><td><span class="k3">*</span> File IO</td></tr><tr><td class="number">42</td><td><span class="k3">*</span> Messageboxes</td></tr><tr><td class="number">43</td><td><span class="k3">*</span> Inputboxes</td></tr><tr><td class="number">44</td><td><span class="k3">*</span> Color chooser</td></tr></tbody></table></div></div><p>

I removed the window and html viewer. Reason to remove the window was that a window makes no sense ATM, since it would be equivalent to a Panel at the moment (Since allegro doesn&#39;t allow us to spawn new windows).<br />So, what we really need is a frame (a window with a border and title).</p><p>The html viewer is too much to chew, IMO.</p><p>If you have the label, the push button is almost done as well. Once the push button is done, the others will follow, since labels and all buttons have just a few minor differences.</p><p>Most containers are pretty simple as well, since they are mainly aggregations of existing widgets.</p><p>The most complex widget in that list is the table (or grid) followed by the tree.</p><p>The other widgets are more or less pretty simply, since they only extend existing widgets, add new functionality by grouping widgets or simply because they have a simple structure....</p><p>So, besides the table and tree, the foundation, the event, drawing and layout/resize code is the largest problem.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Sun, 22 Jun 2003 21:48:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
I feel no distinction should be made between togglebuttons and regular buttons - &quot;togglable&quot; should be a flag. They both share the same behaviour, and I don&#39;t feel such a small change warrants a widget of its own.</p><p>I&#39;m not sure what you mean with &quot;formatted input field&quot; - if you mean richtext, then yes, it should be its own. If you just mean &quot;format masked&quot;, then it should probably be a part of the textbox.</p><p>What would the different between a Panel and a Frame be?</p><p>And, as mentioned, the dialogs might as well not be widgets of their own ... a file list might very well be though (a list or iconview that automatically populates by reading from filesystem).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sun, 22 Jun 2003 21:52:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>First of all, sorry for being late in this discussion. A project like this is a good idea and I would love to work on it. I&#39;ve been working on my lib for a long long time now and I put a lot of hours in it so it will be kind of hard to just drop it. But then again after reading axilmar&#39;s post I realized what a crappy piece of <span class="cuss"><span><span class="cuss"><span>shit</span></span></span></span> it really is so I guess it wouldn&#39;t be that hard after all...</p><p>About the language: C++ is the way to go. Personally I don&#39;t see any reason why we should try to make a pure C library that could be integrated in Allegro or something. And doing a standalone GUI lib in C makes no sense to me...</p><p>About the features: Allegro is a game programming library. Making an add-on library for Allegro that is not focused on making games is pointless and we should take that into consideration. But making a GUI for a game is quite different than making a GUI for a tool. First of all the library must be completely skinnable which is not as easy as it may seem at first. Secondly the lib must support things like animated widgets and mouse cursors, transparency, non-rectangular widgets, etc. Also the GUI must work with various different screen update methods. Most GUIs (mine included) use a dirty rectangle system based on memory double buffering while most games will want to use page flipping or triple buffering. Also OpenGL for 3D games must be supported natively...</p><p>About the last little argument on widgets: There are two extreme positions one can take in making a widget set. Either you can make just a few very general widgets each with countless flags and properties or you can make a separate widget for every little difference in functionallity. Naturally when using OOP one should lean more to the second aproach although in some cases this could be open to discussion...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Sun, 22 Jun 2003 23:03:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
One has to be pragmatical though ... having one class for InsetBevelFrame and one for OutsetBevelFrame is ridiculous - it&#39;s unnecessary, counter-intuitive, and blocks fast switching between styles if it ever becomes actual.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sun, 22 Jun 2003 23:23:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Umm.. if people <i>do</i> want to make this library then they better agree now to use C or C++ and whether it&#39;s going to be a general GUI library or designed for games.</p><p>It may be that people won&#39;t be able to agree on these issues. Maybe we will have two different GUI libraries?</p><p><img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Sun, 22 Jun 2003 23:29:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
I don&#39;t think a C library would be impossible. Maybe make one first, then port to the other? Starting with C++ would probably be good then ...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Sun, 22 Jun 2003 23:42:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> I feel no distinction should be made between togglebuttons and regular buttons - &quot;togglable&quot; should be a flag. They both share the same behaviour, and I don&#39;t feel such a small change warrants a widget of its own.</p></div></div><p>

That&#39;s fine for me. I just thought that using the toggle button as the base for radio buttons and checkboxes might be a good idea. </p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> I&#39;m not sure what you mean with &quot;formatted input field&quot; - if you mean richtext, then yes, it should be its own. If you just mean &quot;format masked&quot;, then it should probably be a part of the textbox.</p></div></div><p>

Not sure here. A formated input field allows you to pass an input mask, say &quot;###.###.###.###&quot; for an IP address, and similar things. The non-special chars (the dots in this example&quot; will not be part of entered text, but will be displayed statically within it.<br />I could agree on that a single-line-text-input (phew) and the formated text input should be the same, but since you also said already that you want multi-line text and single line text to be the same widget...</p><p>Also, using different widgets doesn&#39;t require you to duplicate code. Good class hierarchy and / or using utility classes allows you to reuse the code.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
What would the different between a Panel and a Frame be?
</p></div></div><p>
A panel is mainly a rectangular area. It&#39;s more or less the most primitive widget there is.</p><p>A frame would have all the nice things title bars, resizing controls, etc.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
 And, as mentioned, the dialogs might as well not be widgets of their own ... 
</p></div></div><p>
While they might be no widgets, common dialogs are still something we&#39;re going to need.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> About the features: Allegro is a game programming library. Making an add-on library for Allegro that is not focused on making games is pointless and we should take that into consideration. 
</p></div></div><p>
I disagree here. Allegro is more than just a game coding lib. It&#39;s a multimedia lib. The main reasons there are not many tools using it, is the lack of a gui <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> First of all the library must be completely skinnable which is not as easy as it may seem at first.</p></div></div><p>
True.</p><p>This is another part of the list we should start:<br />General requirements.</p><p>One problem I have with your list is transparency (as long as it refers to more than the magic-pink trans), since it&#39;s not well supported by allegro.</p><p>Regarding the screen update: I assume it will render to any context you provide, and use dirty rect system internally as well.</p><p>So, you could tell all your base widgets (say a list of buttons, on the bottom, a map in the center right and a floating window) to update itself. <br />They will redraw them self (according to input they got, and a list of dirty rects you may have passed to them) and add the changed areas to a dirty rect list.<br />You can then simply blit the context, or use the list to blit only the dirty areas.</p><p>Again, this is just my view of it, once again pretty close to the way java is doing this stuff.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Also OpenGL for 3D games must be supported natively...</p></div></div><p>
In this case, I&#39;d say you should team-up with Korval, who should have something like this ready already <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> (sorry, couldn&#39;t resist)</p><p>Regarding the upcoming lang discussion again:<br />I think we can do the general planning now without thinking too much about the lang.<br />Once we know what we want, it will be more easy to find the best way to do it <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Mon, 23 Jun 2003 00:21:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I agree with spellcaster here as well, we should just generalize out what we need and get some simple structured outlines going, after that we&#39;ll get a better idea on what language we should do the GUI in.  Unfortunately for me though I&#39;m moving in a month and do not know how much free time I may have after that, let alone the amount of free time I have at the moment since I&#39;m busy transfering jobs, traveling, filling out apps, etc.  I like the slots and sockets approach, callbacks have issues and cause extra code that could be done with a simple pointer from one widget to another.  It&#39;s a brilliant concept (I read up on it a bit <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />), and doesn&#39;t look like it&#39;ll be that hard to do in either language, though most of what I&#39;ve read about explicity mentioned OOP as the requirement.  This is an excellent discussion and I think we&#39;ve all learned much from it, now if we can all band together with our differences aside and actually make something that works and looks promising.  I know it&#39;ll definately take longer than a year to complete this, but it&#39;ll take determination and team effort.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Mon, 23 Jun 2003 04:02:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Spellcaster, I agree with you. Although my widget list was a bit long, it was just a list of requirements. I disagree with you about the Window though: you need resizable widgets with a caption that can be moved around with the mouse. When I talked about Windows, I meant &#39;window frames&#39;: caption, icon, close button, minimize button, maximize button, etc. If that&#39;s what you meant, then we are on the same track.</p><p>The following quote is the most important one heard in this discussion:</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Allegro is more than just a game coding lib. It&#39;s a multimedia lib. The main reasons there are not many tools using it, is the lack of a gui.
</p></div></div><p>

If Allegro is to take off, it needs a decent GUI library. Every game development environment is accompanied with a suite of tools that ease game development. Without the tools, a developer has to go through the path of making the tools first. That&#39;s a big &#39;no&#39; for most of us, because what we want is to make games, not tools. We get easily bored, and that&#39;s why there are so many abandoned projects. The usual counter-argument is that &#39;there is no one size-fits-all&#39;, and that&#39;s true. But, if every developer has to develop his/her own tools, why should he/she create a gui lib first ? at least the gui should be &#39;standard&#39;, in the sense that it is available right from the start.</p><p>As for the game gui, I disagree: how many games need a combo box, for example ? most games need a simple menu-driven with input boxes and buttons gui, not a gui toolkit. If one plans to make gui-driven games, like a strategy game, that means that most probably he/she does not need 60 FPS and the game can hapilly live within the space of gui toolkit.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Mon, 23 Jun 2003 13:34:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
There&#39;s another issue, though: Should such a GUI library really use Allegro, or is it better to write tools in GUI systems intended for more general use, such as Qt, GTK+ or wxWindows? Is an Allegro GUI as we know it now just a weak &quot;emulation&quot; of a proper GUI that can never be as good as a &quot;proper&quot; system?</p><p>As for game GUI&#39;s: Netcrux requires a fairly complex GUI system, including combo boxes and lists (for the configuration menus), and it needs a fairly high FPS - not necessarily at the time one uses the GUI, but still. Also, have a look at games like Neverwinter Nights - fairly sophisticated GUI, high frame rates.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Mon, 23 Jun 2003 13:48:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>I disagree with you about the Window though: you need resizable widgets with a caption that can be moved around with the mouse.</p></div></div><p>
Um, yep. But a window has neither a border nor a title. At least not in the common GUI terminolgy.<br />Think win32, motif, xlib: every widget is a &quot;window&quot;.<br />In X, you need a window manager to provide the frame (caption and resizing) for top-level windows, in win32 you can specify that you want to add a frame, and in Swing Windows and Frames are different classes.</p><p>If speaking in patterns, the frame &quot;decorates&quot; the window, allowing to resize, move, etc. whatever is in it&#39;s content area.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Should such a GUI library really use Allegro, or is it better to write tools in GUI systems intended for more general use, such as Qt, GTK+ or wxWindows?</p></div></div><p>
Should one really code games with allegro, or is it better to use OpenGL / DirectX or SLD / ClanLib?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Mon, 23 Jun 2003 14:14:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Um, yep. But a window has neither a border nor a title. At least not in the common GUI terminolgy.
</p></div></div><p>

Well, anyway, I meant a frame. The essence is not in  nitpicking, is it ? Let&#39;s make a gui library, guys!!!</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
or is it better to write tools in GUI systems intended for more general use, such as Qt, GTK+ or wxWindows?
</p></div></div><p>

WxWindows is not very C++ style because it uses message maps to map methods to messages. That&#39;s the primary reason I dislike it.</p><p>I don&#39;t know GTK.</p><p>Qt is fine, but on Windows you need a commercial licence to use anything beyond version 2.1. So either the tool must be limited to 2.1 capabilities or someone must have a Qt 3.1 licence.</p><p>Furthermore, there is a need for an intergration layer with Allegro. I don&#39;t remember by heart, but  Qt widgets don&#39;t give access to the window handle. Even if they did, the intergration layer would be specific to each window system: different code for win32 ,for X, etc. I am assuming here that the tool would use Allegro somehow to draw stuff within a window, manage bitmaps, etc.</p><p>One of the advantages of Allegro is that it is multiplatform: the same code compiles under Windows, Linux, Mac, BeOS and a lot of other platforms. Having a thin gui library which exploits this multiplatform capability would be a great asset. Writing Allegro tools using allegro would be great, since there would be no intergration problems.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
not necessarily at the time one uses the GUI, but still. Also, have a look at games like Neverwinter Nights - fairly sophisticated GUI, high frame rates.
</p></div></div><p>

Sorry, I haven&#39;t played Neverwinter Nights. Would you care to explain what complex GUI interaction it has while the game is running ? </p><p>Anyway, the problem of the update method can be easily solved: each widget should have one or more flags that tell how the widget is changed. Is it resized ? is it dirty ? etc. Now, when it is time to update the screen, the widget tree is updated using the above-mentioned flags, and then drawn onto the game buffer bitmap. In applications, widgets are drawn only when they need to directly to the screen. In games, the programmer shall have the capability to install a back buffer, i.e. a bitmap to use while drawing the widgets.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Mon, 23 Jun 2003 16:48:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
I see spellcaster missed my point. I was just asking if I was the only one who felt a bit uncomfortable at the thought of a GUI running inside a graphical window, which does not support normal interaction with outside windows (think drag and drop) and generally has a completely different look and feel than the rest (and in some cases, reacts much more slowly - Allegro&#39;s mouse is, for instance, much slower than the Windows one on my computer)?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Could you care to explain what complex GUI interaction it has while the game is running ?</p></div></div><p>

Lists, text input, drag-n-drop, IIRC there were checkboxes and combo boxes, popup menus.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Mon, 23 Jun 2003 18:57:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m kinda confused about the slots and sockets approach though, wouldn&#39;t you still need callbacks for specific function calls, whereas slots and sockets are excellent for tieing two or more widgets together?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Mon, 23 Jun 2003 19:17:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Yes, you would. Signals and slots are just for connecting widget actions togther - such as what should happen when something is clicked, etc. The alternative is overriding a function - things like onPaint() fall into this category, because they&#39;re not really something signals and slots are supposed to be used for.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Mon, 23 Jun 2003 19:23:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> I see spellcaster missed my point.</p></div></div><p>
I&#39;m quite good in point missing <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
 I was just asking if I was the only one who felt a bit uncomfortable at the thought of a GUI running inside a graphical window, which does not support normal interaction with outside windows (think drag and drop) </p></div></div><p>
You can support d&amp;d nicely while running within an allegro window. All you ahve to do is to add some win32 calls.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>and generally has a completely different look and feel than the rest (and in some cases, reacts much more slowly - Allegro&#39;s mouse is, for instance, much slower than the Windows one on my computer)?</p></div></div><p>
The mouse problem should not be there in windowed modes, and I&#39;ve reported the problem with the mouse almost one year ago.</p><p>Regarding the look: &quot;hip&quot; applications (video/audio apps in particular) seem to use a pretty non standard gui anyway.</p><p>And still, Music Maker, Bryce, Poser, Painter, eJay, etc. sell well. <br />It all depends on the market. And if you&#39;re going to use the allegro gui for a project, chances are  good that you&#39;ll target gamers, or &quot;geeks&quot; of some kind or another.</p><p>Regarding Signals and Slots: Um, they are nice, but I must admit that I&#39;d prefer regiserable callbacks and function overloading.<br />(Um, yes, once again I try to milk my java knowledge <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />)</p><p>I just think calling a registering function is pretty simple.<br />You want to get notified as soon as a window is moved? Register your function at the eventSource, and wait until you get called.</p><p>Implementation could be either function pointers in C++, interface pointers or functors in c++.</p><p>The main reason I don&#39;t like  Signal/Slot is that it requires you to do some extra parsing.<br />I&#39;m not that fond of MessageMaps, because it&#39;s pretty hard to alter them dynamically.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Mon, 23 Jun 2003 19:44:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Regarding the look: &quot;hip&quot; applications (video/audio apps in particular) seem to use a pretty non standard gui anyway.</p></div></div><p>

Yes, and I&#39;m equally annoyed at them. &gt;:E
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Mon, 23 Jun 2003 20:17:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Then you should not partake in this discussion here <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>If you want a native GUI interface, use the native API of your platform. You don&#39;t have much choice there.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Mon, 23 Jun 2003 20:19:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
It all depends, really. I&#39;m all for having a GUI - some games need it - but I&#39;m just wondering whether its feasible to have one to use for tools in these days, when we have more &quot;standardized&quot; GUI systems - such that didn&#39;t really exist in the days of the Atari ST and DOS.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Mon, 23 Jun 2003 21:13:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I was just asking if I was the only one who felt a bit uncomfortable at the thought of a GUI running inside a graphical window, which does not support normal interaction with outside windows (think drag and drop)
</p></div></div><p>

Drag-n-drop from other windows is different for any window system anyway. In this case, we would need custom code for each O/S.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
and generally has a completely different look and feel than the rest 
</p></div></div><p>

Well, on my Windows box alone I have various apps with completely different look and feel:<br />1) normal Win32 apps from Microsoft which are the original look and feel.<br />2) Qt based apps that have a slightly different look and feel. I can tell which apps are written with Qt anyway.<br />3) GTK based apps with an entirely different look and feel; for example DevC++.<br />4) Java apps with with an entirely different look and feel; for example PVCS, JDeveloper, PowerDesigner (at work).<br />5) All the media player programs that are skinnable. Way different interface.</p><p>So, the unified look and feel is kind of a myth. But this is no problem, as long as an app has menus, scroll bars, list boxes, text boxes and other things that are similar ideas. So, I don&#39;t think anyone would complain that our lib would look slightly different.</p><p>Don&#39;t forget that we can make it skinnable. The MASkinG library has done a pretty good job in skinning.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Mon, 23 Jun 2003 21:19:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
I agree with Axilmar on the last point. If everyone loved the look of windows then everyone would use it. With skinnable themes you can at least cater for different personal tastes.</p><p>I hope people here follow up on their intention to start a GUI library!</p><p>It would certainly benefit most Allegro users anyway.. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 25 Jun 2003 00:11:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m well on my way with my own library though it&#39;s limited due to using the same allegro dialog constructs as with most of the other GUI&#39;s.  This most has excited me into realizing I need to ditch the underlying allegro structures and go with something a little bit different.  Miran, Spellcaster, and I have had a great deal of experience with skinning so that won&#39;t be a problem there.  So far I&#39;ve managed to mimic the look anyway of MacOS, Windows, XWindows, and BeOS with a single dialog procedure, it&#39;s based on what is there and what is not there in the skin.  For example BeOS has header text background (the thing behind the text that conforms to it&#39;s width), and no minimize icon.  In the skin config file you tell it to draw the close icon to the left of the text, and the maximize icon to the right of the text, not the dialog header.  Because the minimize icon doesn&#39;t exist (loaded as NULL) then a double click to the header will minimize the dialog.  It requires one heck of a lot of code, but it&#39;s doable.  In fact a lot of stuff for the headers is completely optional:</p><p>Main header bitmap (goes behind text, fits entire doalog top) Required<br />Text background bitmap (goes behind text, conforms to text) Optional<br />Minimize Icon: Optional<br />Minimize Disabled Icon: (these are for when the dialog is not selected (greyed out)) Optional<br />Maximize Icon: Required<br />Maximize Disabled: Optional<br />Exit Icon: Required<br />Exit Disabled: Optional<br />Rollup Icon: Optional (as well as disabled icon)<br />UnRollup Icon: Optional (as well as disabled icon)<br />Sticky Icon: Optional (ditto)<br />UnSticky Icon: Optional (ditto)<br />Help Icon: Optional<br />Help Disabled Icon: Optional<br />Header Panel: Optional (used to go in front of text, single bitmap)<br />Application Icon: Optional</p><p>That&#39;s 20 separate elements to draw just a skinned header, but rarely will every element exist in one datafile, and you have to keep in mind that most of these elements can be left, right, or center aligned.  I also have plans for a mask element as well to poke through the header and show the background.</p><p>To do something like winamp with our GUI we could also have a procedure that acts like the dialog but is one single bitmap, dragging can be done anywhere another widget doesn&#39;t exist, and buttons, etc, can be replaced my icons instead giving the look and feel of a winamp-type application.  </p><p>I think Axilmar gave a pretty decent framework example go off of, but I really haven&#39;t had the time to look over it in detail.  But I think we have enough to get started with.  As well any of my subprocedures i.e. mouse and text can be ported to this new library easily... very easily.  I use nothing GUI specific in them and are in fact separate libs already.  The text routines need some help though, I&#39;m just not satisfied with how I handle them yet...</p><p>Here&#39;s what we&#39;ve agreed on so far:<br />Skins<br />Slots and Sockets<br />C/C++ (I don&#39;t think it matters anymore as long as it works under both API&#39;s)<br />I would like to see different update methods as Miran pointed out but it&#39;s gonna be tricky to pull off.  We may either have a set_gui_update_method or a way to pass a backbuffer and screenbuffer into our routines, maybe a combination of both...</p><p>I would hate to see my GUI die as well which is why I would hate to give up working on it even if my efforts are kind of vain, but I&#39;ll also give my best effots towards this lib as well if it gets off the ground.  Again lots of discussion which is good, but little in teh ways of everyone getting together on this and making a working framework or teaming off to work on separate components.  I think that&#39;s something we should do anyway, break off and work on base components (i.e. mouse, text, main routine runner, and anything else that&#39;s needed) once we get a decent idea on where to go with this GUI.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Wed, 25 Jun 2003 21:00:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hey Steve, I already have my Widget class ready that provides the following:</p><p>1) buffered and non-buffered drawing<br />2) focus management<br />3) geometry management<br />4) opaque and non-opaque widgets<br />5) misc widget properties like enabled, visible, etc.<br />6) accelerator table support<br />7) Widget trees (of course).</p><p>It&#39;s quite a clean interface. I have already made all the big decisions about the design, but I am always open to suggestions.</p><p>Tomorrow I am gonna do the Event class which reads mouse, keyboard and timer events from an internal queue.</p><p>It&#39;s C++ of course. Are you interested ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Wed, 25 Jun 2003 22:13:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Can we get to see this code? I&#39;d be very interested in having a look at it.</p><p>I&#39;m all for a new GUI, by the way - and I much prefer C++ over anything else for it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Wed, 25 Jun 2003 22:26:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d love to give some support for this lib, my C++ skills are a bit rusty though, but I understand class concepts, etc.  Maybe after this week I can begin to do some work, I think I&#39;ll have most of my moving issues sorted out by then <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /></p><p>1)Drawing straight to screen, or buffered? not sure here what you mean.  Fast GUI&#39;s use a DRS system, which is a form of buffered drawing.<br />2)Ok, gotcha there<br />3)Not sure what geometry management is.. like non-rectangular widgets?<br />4)I think that&#39;s up to the skin for opaqueness<br />5)Like the allegro GUI you need some flags like D_SELECTED, D_HIDDEN, etc.<br />6)What does this do?<br />7)Trees are good, I&#39;m assuming you mean child widgets where the child widget is relative to the parent widget at location 0 0.  I pondered this as well, like nested widgets.</p><p>But yeah, I&#39;m interested and would look over it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Wed, 25 Jun 2003 22:32:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
6) Keyboard shortcuts.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Wed, 25 Jun 2003 22:33:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, here is the source code (attached to the message). The suppied zip also has html help starting from the &#39;index.html&#39; file in the docs directory, as well as a Test class derived from Widget for testing purposes.</p><p>Steve, here are your answers:</p><p>1) widgets use the &#39;screen&#39; pointer to draw themselves, but in bufferred mode the screen pointer points to the buffer.</p><p>2) Geometry management: Each parent widget is responsible for maintaining the layout of its children, or resize itself according to its children. My Widget class has lots of methods to support this mechanism and to minimize redrawing for avoiding flickering.</p><p>4)It is not enough for the skin to define such a property. The widget redraw mechanism must support redrawing of overlapped widgets before drawing a non-opaque widget. Non-opaqueness is also useful in labels, check boxes, radio buttons and other non-rectangular widgets that use their parent as background.</p><p>6) Each widget can register itself to be called when the relevant accelerator key is called.</p><p>7) Of course. Child widgets have a x, y relative to the parent. This parent-relative x, y is translated to the screen-relative x, y once widgets are on the screen. All other operations are done using the widget&#39;s screen coordinates, though. For example, the Test class draws the widget by using its x1(), y1(), x2(), y2() coordinate methods.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Thu, 26 Jun 2003 19:55:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I can&#39;t compile the source though, or is it even ready to compile, I get an error that list cannot be found on #include &lt;list&gt;<br />I&#39;m compiling with this:<br />D:\unzipped\algui[1]&gt;g++ -c -I./include src/widget.cpp<br />and a bunch of syntax errors follow.  </p><p>Anyway algui sounds appropriate for a name... but any other suggestions <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> or maybe a codename ... that&#39;d be cool.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Thu, 26 Jun 2003 20:33:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Um... ok, if we start to throw code around before we even have started to design this thing, then I&#39;m out.</p><p>If you take a look around here, and count the number of unfinished/abandoned gui libs you&#39;ll see why starting another one without a good design first is not going to work.</p><p>Esp. the base classes need more thought. Reason for this is simple: Once you have the base classes coded, and add some classes on top, it&#39;s hard to change the design again (&quot;since we already have working classes&quot;).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Thu, 26 Jun 2003 21:23:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>spellcaster, have you also realized that the previous &quot;projects&quot; for new guis or other larg projects never got off the ground because noone actually started? I tihnk this is a good thing, show some code, and debate, at least then theres &quot;something&quot;.. instead of a bunch of hot air.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 26 Jun 2003 21:26:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I can&#39;t compile the source though
</p></div></div><p>

Its the STL&#39;s &#39;list&#39;. It compiles ok under MSVC++...</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Um... ok, if we start to throw code around before we even have started to design this thing, then I&#39;m out
</p></div></div><p>

I will not claim to be &quot;the&quot; authority when it comes to guis, but I have given a lot of thought into the subject. I think that my Widget class is a very good start, and with a very good design.</p><p>Of course, I posted the code out as a basis for discussion, rather than as the definitive start. Since time is money though, I am gonna continue building on it. I am open to suggestions, and I would be very happy if I have some.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Thu, 26 Jun 2003 22:00:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s my point. So it won&#39;t be a team project, but we&#39;ll all start doing our own thing. Again.</p><p>Regarding your design, my major problem is that BITMAPs are not hidden. Another point is the way common gfx operation are perfromed directly.</p><p>But, as you said, time is money, and you have spend a lot of time thinking on this matter already. </p><p>I&#39;ll be glad to use your GUI lib as soon as it&#39;s finished.</p><p>Don&#39;t get me wrong folks, but exactly this is why group projects die very youg here all the time. A single developer might be able to jump start a project. He might even be able to finish it, even if he doesn&#39;t have a design (besides the idea in his head), but for a team project, this just doesn&#39;t work.</p><p>Like I said before, we all have spent quite a few time thinking about this topic. We all have worked with guis and developed our own enhancements, add-on or own systems.</p><p>But if we just say &quot;here&#39;s my code. take a look, discuss it, but I&#39;ll do my stuff anyway&quot; we&#39;ll end up with one gui lib per person. </p><p>If this is what you want, ok <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Fri, 27 Jun 2003 01:20:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Spell: Why don&#39;t you post some detailed ideas here so other people can see how you would approach this library?</p><p>I think people are rushing ahead too, but in fairness to axilmar, he has been most productive so far. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>Why doesn&#39;t everyone discuss how they would design the GUI? Then we can have a discussion and (hopefully) reach an agreed design...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Fri, 27 Jun 2003 02:18:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
my major problem is that BITMAPs are not hidden.Another point is the way common gfx operation are perfromed directly.
</p></div></div><p>

Sorry, but I don&#39;t understand what you mean. If you mean that drawing should be abstracted, like Windows drawing on a device context, my opinion is that it should not, for the following reasons:</p><p>1) All allegro drawing must be encapsulated within a class. Too much work.</p><p>2) Too many indirection layers. Drawing a simple line will call the virtual method of the class, which in turn will add the widget&#39;s screen position to the line&#39;s coordinates, then use Allegro to draw, which will redirect the call to the BITMAP&#39;s vtable, which in turn will use DirectX or GDI or xlib to draw...</p><p>I don&#39;t think Allegro should be hidden, because there is a lot of functionality that needs to be wrapped up and this is quite tricky since it is not easy to tell what one might need upfront. I am not for a generic GUI toolkit, since it is quite difficult to achieve.</p><p>As I stated earlier, I am open to suggestions. (But I don&#39;t see any). Therefore, I am gonna proceed on my own, and whoever wants to jump in, is welcomed.</p><p>I&#39;ve opened a sourceforge project. When I finish the event handling, I&#39;ll notify you of the link.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Fri, 27 Jun 2003 13:59:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As soon as you start blitting directly to a bitmap, you&#39;ll end in the same dead-end as allegro&#39;s direct screen blitting.</p><p>Assume you have a GraphicContext class. Assume this class has a blit method. With a minor chang in that blit method, you can add a dirty rectangle system to all applications using the gui.</p><p>What about text output? If you textout your strings directly to a bitmap, you&#39;re stuck with the text rendering system you&#39;re using. If you decide to use Allegro Fonts, this means no true type support without changing all widgets.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>1) All allegro drawing must be encapsulated within a class. Too much work.</p></div></div><p>
Doubt that. You need blit, textout, rect, rectfill and line.<br />If somebody needs more, he can just add them to the GC and all apps can use them.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>2) Too many indirection layers.</p></div></div><p>
Exactly one more than before.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>I don&#39;t think Allegro should be hidden, </p></div></div><p>
There&#39;s no need to hide allegro completly. But the whole idea is to give you a flexible way to access GUIs.</p><p>The system you&#39;re proposing is as limited as the current allegro gui. It just adds some fluffy classes arond basically the same functionality and adds containers.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>As I stated earlier, I am open to suggestions. </p></div></div><p>
Um , no you&#39;re not. YOu have started implementing already, this means that you have already a fixed plan in your mind. That&#39;s not a bad thing, but it makes planning pretty pointless, since you don&#39;t want to design a GUI, you want to implement one.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>(But I don&#39;t see any)</p></div></div><p>
In that case, you should actually try to read what&#39;s written here <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Therefore, I am gonna proceed on my own, and whoever wants to jump in, is welcomed.</p></div></div><p>

Hehee.. that&#39;s exactly what I said a couple of days ago. Who needs team projects anyway, heh.</p><p>I wish you good luck with your GUI.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Fri, 27 Jun 2003 14:41:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Spellcaster, was it you who emailed me about my gui? Sory, I&#39;ve just been having a rough time..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 27 Jun 2003 15:36:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Spellcaster, I will be straight with you: I don&#39;t like this nitpicking of my words. We are here to do a job, not to play &quot;who&#39;s the smartest&quot;. Anyway, for defending myself, I will also nitpick your talking:</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
 Assume you have a GraphicContext class. Assume this class has a blit method. With a minor chang in that blit method, you can add a dirty rectangle system to all applications using the gui.
</p></div></div><p>

There is no point in adding a dirty rectangle system in a GUI library. For the following reasons:</p><p>1) applications only need double-buffering, they don&#39;t need a dirty-rectangle system or any other system whatsoever. My Widget class uses double-buffering to blit to the screen only the portion that is updated. For example, if a small button is redrawn, the part of the screen that will be affected is only the part that is updated by the button. Overlapped and foreground widgets will be drawn to the buffer too, but clipped accordingly.</p><p>2) The dirty rectangle system is needed only for games that their screen does not change so often. This is valid only for a small amount of games, since most games will update the whole screen every frame. And the dirty rectangle system only fits with buffering and not with page flipping. Therefore, a dirty rectangle system is deemed unnecessary.</p><p>3) I don&#39;t like animated GUIs for applications. When using an app, I would like my menus to instantly pop up and not every time to go through some silly animation.</p><p>In the light of the above arguments, we can safely deduct that a GUI lib does not need a dirty rectangle system or any other drawing system. Remember, the library should be as thin as possible.</p><p>In case that you are so desperate and you need a dirty rectangle system whatsoever, you can always add the required functionality at the end of the &#39;redraw(x1, y1, x2, y2)&#39; method, at the line that the buffered content is blitted to the screen. This can be applied to any other system of drawing.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
 What about text output? If you textout your strings directly to a bitmap, you&#39;re stuck with the text rendering system you&#39;re using. If you decide to use Allegro Fonts, this means no true type support without changing all widgets
</p></div></div><p>

This is already solved. True type rendering will be done by using the excellent AllegroFont library. My library will have a Font base class with text measuring and drawing methods, an AFont class for using Allegro fonts and a TFont class for using AllegroFont fonts. Example:</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="c">//font base</span></td></tr><tr><td class="number">2</td><td><span class="k1">class</span> Font <span class="k2">{</span></td></tr><tr><td class="number">3</td><td>public:</td></tr><tr><td class="number">4</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> textOut<span class="k2">(</span><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>bmp, <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>text, <span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">int</span> color<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">5</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td>&#160;</td></tr><tr><td class="number">7</td><td><span class="c">//Allegro font</span></td></tr><tr><td class="number">8</td><td><span class="k1">class</span> AFont <span class="k2">{</span></td></tr><tr><td class="number">9</td><td>public:</td></tr><tr><td class="number">10</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> textOut<span class="k2">(</span><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>bmp, <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>text, <span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">int</span> color<span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">11</td><td>        textout<span class="k2">(</span>bmp, _font, text, <span class="k1">int</span> x, <span class="k1">int</span> y, color<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">12</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">13</td><td>private:</td></tr><tr><td class="number">14</td><td>    <a href="http://www.allegro.cc/manual/FONT" target="_blank"><span class="a">FONT</span></a> <span class="k3">*</span>_font<span class="k2">;</span></td></tr><tr><td class="number">15</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td>&#160;</td></tr><tr><td class="number">17</td><td>&#160;</td></tr><tr><td class="number">18</td><td><span class="c">//AllegroFont font</span></td></tr><tr><td class="number">19</td><td><span class="k1">class</span> TFont <span class="k2">{</span></td></tr><tr><td class="number">20</td><td>public:</td></tr><tr><td class="number">21</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> textOut<span class="k2">(</span><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>bmp, <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>text, <span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">int</span> color<span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">22</td><td>        alfont_textout<span class="k2">(</span>bmp, _font, text, <span class="k1">int</span> x, <span class="k1">int</span> y, color<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">23</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">24</td><td>private:</td></tr><tr><td class="number">25</td><td>    ALFONT_FONT <span class="k3">*</span>_font<span class="k2">;</span></td></tr><tr><td class="number">26</td><td><span class="k2">}</span><span class="k2">;</span></td></tr></tbody></table></div></div><p>

</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Doubt that. You need blit, textout, rect, rectfill and line.
</p></div></div><p>

Nope. You need gui textout, raised 3d rect, sunken 3d rect, 3d circle, 3d line, line drawing with patterns for drawing the focus lines in buttons/ check boxes/radio buttons/list items/tree items and other items, ghouraud shading for drawing beatiful window captions, stretch blit for filling the application&#39;s background with a bitmap (as if it was the desktop/root window of a window system), skin blit for drawing those skins with a border, frame drawing (sunken, raised, window, bevel, whatever)...</p><p>Not only you need more stuff, but these extra drawing functionality is done by combining the various Allegro calls. </p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If somebody needs more, he can just add them to the GC and all apps can use them.
</p></div></div><p>

And if you really thing about the applications, they may need even more drawing routines: drawing a tilemap, drawing a line with width more than one pixel, etc. These complex drawing routines will be very slow if they go through a &#39;graphics context&#39;. </p><p>So you can&#39;t really say to the programmer &quot;what ever new drawing stuff you need, you need to encapsulate it in a new GraphicsContext class&quot;. That&#39;s stupid, and the programmer will blame you all day for this stupid decision. Why not allow him/her to draw everything using straight Allegro calls, as if the widget was alone on the screen ? and then the GUI system will take care of the updating as needed.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Exactly one more than before
</p></div></div><p>

But there are already 5 to 6 layers out there. If you add one more, then it will be super slow. There is no need anyway to add another layer, as I have previously demonstrated.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
 The system you&#39;re proposing is as limited as the current allegro gui. It just adds some fluffy classes arond basically the same functionality and adds containers.
</p></div></div><p>

You are totally wrong. Can the Allegro gui do the following:</p><p>1) draw overlapped widgets when a widget is redrawn ?<br />2) automatically manage geometry of the GUI ?<br />3) have bufferred mode drawing ?<br />4) do an event loop ?<br />5) do modal dialogs without interrupting the main event loop ?<br />6) have hierarchical accelerators that are registered dynamically so as that dialogs can be incorporated into the main GUI itself and work the same ?<br />7) browse the whole GUI using tab/shift + cursor keys ?<br />8) allow ancestor widgets to repaint themselves differently if a descentant widget has the input focus ? (so as that the input focus part of the screen is always easy to track down)...</p><p>Not only that, but the Allegro&#39;s GUI does not have  toolbars, workspace, tree view and other very crucial widgets.</p><p>What am I saying ? the Allegro gui can&#39;t even allow the programmer to dynamically add widgets to a dialog!!!</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Um , no you&#39;re not. YOu have started implementing already, this means that you have already a fixed plan in your mind. That&#39;s not a bad thing, but it makes planning pretty pointless, since you don&#39;t want to design a GUI, you want to implement one.
</p></div></div><p>

Hey, make a suggestion that&#39;s worthy enough and I will incorporate it in my implementation. Or you can incorporate it, but I really doubt it they way this discussion is going.</p><p>&quot;some fluffy classes&quot;. This type of critism makes me very angry because it is unfair, and I don&#39;t see the reason why should I be insulted by you the way you do! You want to play smartass ? I don&#39;t, I just want a proper GUI for Allegro, that&#39;s all.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Hehee.. that&#39;s exactly what I said a couple of days ago. Who needs team projects anyway, heh.
</p></div></div><p>

Well, if you decide to jump on the train, or anybody else, it would be a team project. Your attitude is not very encouraging though.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I wish you good luck with your GUI.
</p></div></div><p>

Basically, you should say &quot;I am sorry, I have not really understood your design&quot;...By your comments, I can understand that you don&#39;t have absolutely no idea about the real GUI issues, since you only talk about drawing: geometry management (which is THE main problem), keyboard management and input focus, etc...the update method is a minor problem that can easily be solved in one place at the code (as I have said above).</p><p>P.S.: and a wide range of classes to cover all types of problems!!!</p><p>P.S.: I haven&#39;t made any design about the widget classes themselves. If any of you want to really help, you can do the design and coding of the classes from A to Z.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Fri, 27 Jun 2003 19:08:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Spellcaster, I will be straight with you: I don&#39;t like this nitpicking of my words. </p></div></div><p>

Hm.. the only thing you could interpreted as nitpicking was the frame/window discussion... and if you take at my post (the one before your post)  I had already explained the meaning of words... but, anyway... I always like a good argument <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>1) applications only need double-buffering,</p></div></div><p>
Um, why?<br />Don&#39;t you think there&#39;s a reason almost every gui there is has a dirty rect system?<br />And even if you think your applications don&#39;t need a DR system, why do you think it&#39;s bad? </p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
My Widget class uses double-buffering to blit to the screen only the portion that is updated</p></div></div><p>
Either you&#39;re saying &quot;I&#39;m blitting only the part I&#39;m blitting&quot; or you&#39;re saying &quot;I&#39;m only blitting the part that has changed&quot;.<br />The first one makes no sense, the second one is either a DR system or pretty inefficient.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
2) The dirty rectangle system is needed only for games that their screen does not change so often.</p></div></div><p>
Again, what you&#39;re doing here is to limit yourself for no particular reason.<br />If your game has a &quot;play area&quot; and &quot;status/ control&quot; area, only the game area needs to be repainted every frame.  No need to blit the complete GUI if only one button has changed.</p><p>Also, the DR system would allow you also to invalidate parts of the GUI. Assume that your game draws something over the gui (say for a tutorial, or a very special effect). </p><p>Well you can blit everything, but why should you?</p><p>And even if you don&#39;t like DR systems, why do you force everybody not to use them? </p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> 3) I don&#39;t like animated GUIs for applications. When using an app, I would like my menus to instantly pop up and not every time to go through some silly animation.
</p></div></div><p>
People have written what they&#39;d like to see in there gui of choice. Obviously stuff like animation is wanted. Obviously you don&#39;t care. <br />That&#39;s fine. As I said, do your own thing. That&#39;s ok and no problem at all. </p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
In the light of the above arguments, we can safely deduct that a GUI lib does not need a dirty rectangle system or any other drawing system. Remember, the library should be as thin as possible.</p></div></div><p>
You do realize that the whole idea of a group discussion is to get the idea of the group? <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />It&#39;s ok if you have a closed mind and a ficed feature set. But don&#39;t try to enforce it. First off all, it won&#39;t work, and secondly it&#39;s pretty pointless.</p><p>Regarding your idea of a Font doing text output... well, your choice. You&#39;re mixing here two different things though, but it&#39;s your GUI, so you&#39;re free to do what you want.</p><p>I could give you a couple of reasons why this is bad, and in what limits this will impose on you, but I&#39;m quite sure that you have considered this already and dismissed it as &quot;not needed&quot;.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> Nope. You need gui textout, raised 3d rect, sunken 3d rect, 3d circle, 3d line, line drawing with patterns for drawing the focus lines in buttons/ check boxes/radio buttons/list items/tree items and other items, ghouraud shading for drawing beatiful window captions, stretch blit for filling the application&#39;s background with a bitmap (as if it was the desktop/root window of a window system), skin blit for drawing those skins with a border, frame drawing (sunken, raised, window, bevel, whatever)...</p></div></div><p>

You do realize that this can be done  with the methods I listed a Context capable of holding a state?</p><p>Besides the goroud shading <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> But I&#39;d say that a simple gradient floodfill should do the trick as well. No need to add 3d routines to a standard title bar.</p><p>The idea is to maintain a small interface, not to bloat it. If you list these drawing routines, and then start to group them by category, and then take a look at the similarities and differences, you&#39;re one step closer to a design.</p><p>Just a small example: Your sunken/raisen stuff. You do realise that if you have a shadedRect() or something a sunken and raised border is painted by the same routine, just with different parameters?</p><p>And that a &quot;skin blit&quot; is just a blit?<br />Don&#39;t make things more complicated than they are... try to make your interface simple <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>But there are already 5 to 6 layers out there. If you add one more, then it will be super slow.</p></div></div><p>
No comment on that one. But I added it to my list of possible sigs <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>What am I saying ? the Allegro gui can&#39;t even allow the programmer to dynamically add widgets to a dialog!!!</p></div></div><p>
I won&#39;t quote Prachett here, but it&#39;s very tempting.</p><p>Regarding adding widgets to dialogs: Of course you can do this. Requires you some minor tweaking of your DIALOG struct, but it works fine. Same for most other stuff on your list. </p><p>And the remaining feature are just layout / container related <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Hey, make a suggestion that&#39;s worthy enough and I will incorporate it in my implementation. </p></div></div><p>
<img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />As I said, you can implement what ever you want. As you said it&#39;s your GUI. I don&#39;t want to convince you, it&#39;s your code, your lib, feel free to do what ever you want. <br />But you do realize that this thread was about collecting ideas for a new gui. Designed and implemented in a team effort? And &quot;Team&quot; and &quot;my gui&quot; don&#39;t mix well <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> Well, if you decide to jump on the train, or anybody else, it would be a team project. Your attitude is not very encouraging though.</p></div></div><p>
I see no point in jumping on your &quot;wagon&quot;. As you pointed out already, it&#39;s your GUI. You also seem to be very convinced of your design. Well, I&#39;m not. I&#39;ve also explained what&#39;s limiting your approach.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>By your comments, I can understand that you don&#39;t have absolutely no idea about the real GUI issues, since you only talk about drawing: geometry management (which is THE main problem), keyboard management and input focus, etc...the update method is a minor problem that can easily be solved in one place at the code (as I have said above).</p></div></div><p>
You do realize that thes points have been addressed already? You did read the posts in this thread, right?<br />YOu do also realize, that the updating problem is the most limiting factor in the current gui?</p><p>You do also realize, that the proposed event model, with the outline event flow will keep track of input focus?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> haven&#39;t made any design about the widget classes</p></div></div><p>
No need to point that out. It was pretty obvious already.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>If any of you want to really help</p></div></div><p>
You really think that thi is about your GUI, don&#39;t you?</p><p>But I agree, that after this discussion, the chances are pretty bad to get team effort towards an allegro gui on the way.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Fri, 27 Jun 2003 20:55:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
I&#39;d hate to think that one of my thread&#39;s started a flame war people..</p><p><img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Fri, 27 Jun 2003 22:55:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Hm.. the only thing you could interpreted as nitpicking was the frame/window discussion... </p></div></div><p>

Nope. You took every line that I wrote and replied to it. And the replies were not that good.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Um, why?<br />Don&#39;t you think there&#39;s a reason almost every gui there is has a dirty rect system?
</p></div></div><p>

Well, no real GUI has a dirty rectangle system: MS Windows, X-Windows, the Photon MicroGUI, the OpenWindows, the NEWS system all use regions. </p><p>MASKinG has dirty rectangles, because it implements animation on the desktop.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
And even if you think your applications don&#39;t need a DR system, why do you think it&#39;s bad? 
</p></div></div><p>

I did not say it is bad, I said it is unecessary. Let me repeat the reason:</p><p>Only the affected area is double-buffered. </p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Again, what you&#39;re doing here is to limit yourself for no particular reason.<br />If your game has a &quot;play area&quot; and &quot;status/ control&quot; area, only the game area needs to be repainted every frame. No need to blit the complete GUI if only one button has changed.
</p></div></div><p>

I am not limiting anything. Perhaps you have not understood my update system. Let me go through it, one more time:</p><p>A. there are two buffers at each given time: the screen, and a back buffer.</p><p>B. widgets draw on the back buffer; widgets behind them are redrawn and widgets above them are also redrawn on the back buffer; the end result is blitted on the screen.</p><p>C. Only the area affected by the redrawn widget is blitted to the screen.</p><p>So, if a button is updated, it will draw itself either directly to the screen, or to the back buffer. Then, the library will blit to the screen the affected area.</p><p>There are two cases here:</p><p>1. The button&#39;s state change is immediately drawn to the screen. This happens automatically when there is no back buffer.</p><p>2. The button&#39;s state change is immediately drawn to the buffer. This happens automatically when there is a back buffer.</p><p>Now, if there is a buffer that the game draws onto, you can:</p><p>1. Either draw the GUI directly to the screen, but have the special effect blitted from some other buffer.</p><p>2. Or draw the GUI on the widget back buffer, which will blit itself to the screen.</p><p>3. Or draw the GUI on the game buffer, using screen = game buffer, then blit the game buffer to the real screen.</p><p>I don&#39;t see any other case. So, I don&#39;t think there is a need for a dirty rectangle system.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
People have written what they&#39;d like to see in there gui of choice. Obviously stuff like animation is wanted. Obviously you don&#39;t care. <br />That&#39;s fine. As I said, do your own thing. That&#39;s ok and no problem at all
</p></div></div><p>

People have also stated that they need tools to write their games, and almost everyone has tried his own version of a tilemap editor, with no particular success, due to the lack of a good gui.</p><p>A GUI toolkit for writing Allegro tools is a priority over a GUI toolkit for games. How many games need special effects and combo boxes, for example ? </p><p>I think there is small minority that needs special FX in the GUI. And if you need it so badly, you can always animate widgets by the traditional way, i.e. change their state and geometry.</p><p>And even if you do want so much special effects, I have told you that it is the easiest thing to add a DRS system to my design. There is a method called &#39;redraw&#39; which draws either directly to the screen or to the back buffer. The last line calls &#39;blit&#39; to blit the back buffer to the screen. You can replace this call with a call to the DRS system.</p><p>The next version of my class will have it, so as that I prove to you that it is the easiest thing to do.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Besides the goroud shading  But I&#39;d say that a simple gradient floodfill should do the trick as well. No need to add 3d routines to a standard title bar
</p></div></div><p>

Yes, but how you can quicly draw a gradient floodfill ? Instead of making your own routine using Allegro, you can use &#39;quad3d&#39; and achieve the same result.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
The idea is to maintain a small interface, not to bloat it. If you list these drawing routines, and then start to group them by category, and then take a look at the similarities and differences, you&#39;re one step closer to a design.
</p></div></div><p>

But I am the one who doesn&#39;t want a &#39;GraphicsContext&#39; class for avoid the bloat!!!</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Just a small example: Your sunken/raisen stuff. You do realise that if you have a shadedRect() or something a sunken and raised border is painted by the same routine, just with different parameters?
</p></div></div><p>

Besides that, you don&#39;t have any other example.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
And that a &quot;skin blit&quot; is just a blit?<br />Don&#39;t make things more complicated than they are... try to make your interface simple 
</p></div></div><p>

It seems that you have not try skinning. Skin blit is not just a blit: it is a routine that creates 9 sub-bitmaps of the skin bitmap, uses the outer subbitmaps for the borders, and the inner one for the filling. Check out MASKinG. It&#39;s easy to talk when you don&#39;t know <span class="cuss"><span><span class="cuss"><span>shit</span></span></span></span>.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
No comment on that one. But I added it to my list of possible sigs 
</p></div></div><p>

Feel free to put it!!! and put my name next to it, but don&#39;t forget to put the rest of the text too...because it might look silly out of context, but I talked about COMBINATIONS of drawing calls and the ONE MORE LAYER that it will make it super slow.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
As I said, you can implement what ever you want. As you said it&#39;s your GUI. I don&#39;t want to convince you, it&#39;s your code, your lib, feel free to do what ever you want. <br />But you do realize that this thread was about collecting ideas for a new gui. Designed and implemented in a team effort? And &quot;Team&quot; and &quot;my gui&quot; don&#39;t mix well 
</p></div></div><p>

It&#39;s my gui because I designed it and wrote it so far. If you participate, it will be &#39;our gui&#39;. Simple, isn&#39;t it ?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
 see no point in jumping on your &quot;wagon&quot;. As you pointed out already, it&#39;s your GUI. You also seem to be very convinced of your design. Well, I&#39;m not. I&#39;ve also explained what&#39;s limiting your approach
</p></div></div><p>

Nope, you did not explain. You just said &quot;other systems use DRS, so yours should also do the same&quot; without justifying why.</p><p>As I said earlier, I am posting the code for demonstration reasons. I want people to look at it and say &quot;ok, here is a bright idea, for so and so reasons&quot;, or &quot;here is a silly idea, for so and so reasons&quot;. But I want arguments, no silly &#39;others do it this way, so we must do it that way&#39;...</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You do realize that thes points have been addressed already?
</p></div></div><p>

Geometry management ? were ? I am the only person that talks about it. I must be the only one then that gets irritated for having to specify each widget&#39;s geometry by hand!!!</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You did read the posts in this thread, right?
</p></div></div><p>

I don&#39;t want to be ironic. Let&#39;s keep the discussion in a good level.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You do also realize, that the proposed event model, with the outline event flow will keep track of input focus?
</p></div></div><p>

I did not see any post about &quot;event flow&quot; or &quot;input focus&quot;. I am not sure about what you mean, but I have already implemented it and it is indepentent of the event flow: you can change it by hand, if that is necessary.</p><p>You haven&#39;t realize a hidden trap in the focus management: that of toplevel windows coming forward when a control is clicked. In my widget class, when a widget gets the focus, all ancestor widgets are notified that a descentant of them got the focus. By this way, they can bring themselves forward and/or change their appearance, without ever knowing if they are toplevel or not.</p><p>This is quite a good design, don&#39;t you think ? I have never anywhere else someone talk about it, though.</p><p>&lt;quote&gt;<br />You really think that thi is about your GUI, don&#39;t you?</p><p>But I agree, that after this discussion, the chances are pretty bad to get team effort towards an allegro gui on the way.<br />&lt;quote&gt;</p><p>It&#39;s not about &#39;my gui&#39;, its about Allegro not having enough game tools or an easy way to write one.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Fri, 27 Jun 2003 23:01:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Aigh... somehow I knew this would happen.  But I agree this has become Alixmar&#39;s lib and not a team lib.  It&#39;s not a bad thing that we&#39;ve gotten a framework going, but because it kinda came out of nowhere there&#39;s going to be disagreements.  For all I knew MSWindows and X-Windows uses a dirty rectangle systerm, but what is regions?  I mean as long as you aren&#39;t using pure double buffering and you only redraw to the screen what has changed, then there&#39;s not much to worry about, both do the same thing.  The reason you don&#39;t use double buffering is because the speed of the GUI will be dependent on the system and the resolution being rendered at.  With a DRS system it&#39;s only noticeable if you are resizing or dragging a large dialog around at high resolutions or a large size.  I&#39;m not going to consider myself a GUI master or anything by far, I&#39;m still learning on what it takes to make a decent GUI, and yes mine doesn&#39;t have a lot of the features algui has.  But if we can&#39;t decide on how to work together, then yes, it&#39;ll just become alixmars project.  I think partially it&#39;s due to the fact that this discussion is taking place in a forum where realtime discussion can&#39;t take place.  I don&#39;t know, but it&#39;s nearly impossible to make everyone happy.  But seriously, without knowing your plans we can&#39;t be expected to know how your GUI works or how to add to it as a team, I fear that yet another GUI thread has come to a close <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" /><br />Oh and you keep wanting a &quot;quick&quot; GUI implimentation, I understand you don&#39;t want to be writing this lib forever, but there is nothing &quot;quick&quot; to writing a GUI, if you take shortcuts or don&#39;t weigh the different possibilities then it will fail.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Fri, 27 Jun 2003 23:17:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>You took every line that I wrote and replied to it. And the replies were not that good.</p></div></div><p>That&#39;s not <i>nitpicking</i> <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> People have also stated that they need tools to write their games, and almost everyone has tried his own version of a tilemap editor, with no particular success, due to the lack of a good gui.
</p></div></div><p>*cough*</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>It&#39;s my gui because I designed it and wrote it so far. If you participate, it will be &#39;our gui&#39;. Simple, isn&#39;t it?</p></div></div><p>Yes, but the idea isn&#39;t to help you with <i>your</i> GUI, it&#39;s to  get a design most people can agree and collaberate on.</p><p>Anyway, it looks like everyone&#39;s just going to write there own (which is about what happened last time this came up) so I guess we&#39;ll just see who can put their money where their mouth is. I was thinking of writing a GUI lib too, but since everyone praises Swing, maybe I&#39;ll wait until I&#39;ve gotten into Java before I begin with an inferior design (I was just going to (mostly) emulate Win32) ...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Fri, 27 Jun 2003 23:23:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Axilmar:</p><p>The problem I see is that you have presented a design within a few days of this thread being started and are now implementing it.</p><p>To me this suggests two possible reasons:</p><p>1) You are jumping into something without a proper design.<br />2) You have spent a lot of time previously on thinking about designs and are now implementing them.</p><p>I suspect you are going with reason number 2. Which in one way is really great as you can put your experience and knowledge to good use! <i>However</i>, this approach is in contrast to your earlier posts about debating the best design and having a democratic vote on these issues.</p><p>I think this is what is putting people off, you have not put up a proposal for debate. You put up a proposal and now are implementing it while the debate is still going on.</p><p>BTW: I didn&#39;t see Spellcaster&#39;s points as personal criticisms even if it seemed they bothered you. His debates with Korval were legendary on the board, but I never read the critiques he presented to Korval as personal (I&#39;m thinking of the original critique in those threads, not the reactions!).</p><p>I think your experience and knowledge is very useful for making a good GUI. However IMHO you need to let people have a say in the design and features else it truly will be only your library.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Sat, 28 Jun 2003 00:31:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What is a region, you ask ? a region is a table of rectangles that represent the visible portion of a window. All drawing operations are clipped within each rectangle of a region. Each time a window appears, disappears or resizes, the windows below get a new region.</p><p>In case you truly want to learn how regions work, have a look at MxWindows (which I wrote 3 years ago). </p><p>Basically, everything revolves around understanding how to &#39;subtract&#39; a rectangle from another rectangle. </p><p>Let&#39;s say we have two rectangles, A and B. The operation A - B can have the following results:</p><p>No rectangle if B totally overlaps A.<br />1 rectangle if B overlaps half of A.<br />2 rectangles if B overlaps one quarter of A.<br />3 rectangles if B overlaps some side of A partially.<br />4 rectangles if B overlaps part of A but it is completely inside of A.</p><p>So, after the subtraction, the result set of rectangles is kept in a table, called a REGION.</p><p>Professional window systems use regions to make Windowing possible. Regions were first used in Apple&#39;s Quickdraw, back in the 80s.</p><p>A clever Dirty Rectangle System will use the same algorithm for overlapping updatable portions. When using a DRS, there is only one region that is calculated as the programmer adds dirty rectangles to it.</p><p>I have done a dirty rectangle system in 1996, where I wrote a MsPacMan conversion for DOS in Turbo Pascal 6 (which got me the first prize in the PC Master magazine!!! after two months, the excellent Pc-Pac and Pc-MsPac came out, and then after few months MAME was a reality...).</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
But I agree this has become Alixmar&#39;s lib and not a team lib. It&#39;s not a bad thing that we&#39;ve gotten a framework going, but because it kinda came out of nowhere there&#39;s going to be disagreements.
</p></div></div><p>

Ok, forget my library (which is not a library at all, just a class). I am all ears.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
<b>cough</b>
</p></div></div><p>

Sorry mate. I understand that you did quite a big amount of work. But, for example, can I take your tilemap editor to Linux ? Nope...because its a win32 only app. </p><p>I hope you understand now that a decent GUI lib for Allegro is needed.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Yes, but the idea isn&#39;t to help you with your GUI, it&#39;s to get a design most people can agree and collaberate on
</p></div></div><p>

But that&#39;s what I said. But...what is better than to communicate ideas other than the source code itself ?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
The problem I see is that you have presented a design within a few days of this thread being started and are now implementing it<br />1) You are jumping into something without a proper design.<br />2) You have spent a lot of time previously on thinking about designs and are now implementing them.
</p></div></div><p>

Ooops. I didn&#39;t expect that people will think that I did not do a good design. As I have told before, I have made more than 50 tries to write a good gui. I have big experience with guis, and I know Win32, MFC, Qt, Swing, Photon, XLib and Motif/Lesstif. </p><p>Ok guys, as I said before, forget my library. I will personally use it as a testbed for new ideas. But...</p><p>Lets make a GUI, shall we ?</p><p>Sooner or later you will face the same problems as I did. And I can tell you, the drawing mechanism is the least of the problems. I can guarantee you that.</p><p>Ok, here are the requirements for now:</p><p>1) DRS (I hope Spell is happy now)<br />2) A graphics abstraction layer</p><p>Anything else ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sat, 28 Jun 2003 01:44:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I agree with axilmar that DRS is NOT the way to go. I started thinking about DRS when working on my gui, and I realized even that wouldn&#39;t be enough. You want regions. plain double buffering is just wrong, so don&#39;t think about it <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /> (waaaaayyyyyy to slow)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 28 Jun 2003 02:29:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok pardon my ignorance with DRS and regions, but we should all be open to ideas, and I have to give Axilimar credit if he did design or use all of those GUI&#39;s.  Unfortunatly for me anyway a lot of this terminology goes over my head at times because I&#39;ve never heard of it or implimented it myself.  I guess I&#39;d be more helpful for implimenting the stuff on top of the widget subsystem but I hope my discussion on how to impliment multiple theme types such as BeOS/Windows/Mac helped some.  Another thing was the font class you had implimented with alfont, a simple textout won&#39;t really do it since that has no way of doing the &amp;&amp; special character shortcut, text shadows (think beveled disabled text in windows), bold/italic/underline text, fixed width output, centered/right justified text, and maybe a way to justify it by clipping or adding the &quot;...&quot; at the end to make it fit.  A font GUI class should be able to support at least that.  I&#39;ve managed in my lib to bring it down to a single function that handles everything via a bitwise flags variable.  Another way would be a tagged text method where the format of the text is encoded within the text string that is sent in.  I&#39;ve had discussions on this implimentation myself and both methods have strong and weak ponts, the latter is better for a wordpad type application for example but would just call the first function within as new tags are read and set.  Also a way to support multiple fonts should be implimented though the best way to do so is soemthing I have yet to figure out as well.</p><p>Ok with that said and Axilmar&#39;s apology lets keep this going please <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />  My first complaint though is that allegro shouldn&#39;t be the place for really decent discussion, remember it&#39;s post, wait, reply, wait which is a bottleneck.  Is there some other way for realtime discussion and a way to post ideas/code snippets.  Maybe a channel should be opened on IRC such as #algui or something where we can all get some realtime discussion going.  </p><p>Also Axilmar remember that I&#39;m rusty on C++, I have nothing against using it, but don&#39;t make it pure C++ or we will limit those who do not wish to switch to C++ just to use a lib.  Also STL is broken on MingW so your &lt;list&gt; will need to be addressed, or is it just my install that&#39;s bad?</p><p>Anyway I&#39;m glad to see this kind of flexibility, I thought you were just going to move on with your own implimentation but I&#39;m glad things turned around for the best.  For now though I&#39;m going to read up on regions and how they fit in.  Also if you want some quick region code look to me or Miran, we&#39;ve both written code to split regions into non-overlapping regions/rectangles for our DRS implimentation.  I do mine slightly differently though keeping the rectangles as wide as possible for scan line optimization.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve Terry)</author>
		<pubDate>Sat, 28 Jun 2003 06:35:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s true that you can&#39;t do anything serious with this type of discussion. We need to chat online about it.</p><p>DRS is only good if you have 1 level of widgets, like the Allegro gui does. If you have widget trees, you need to search the widget tree to see what widget to redraw, clip widgets, etc.</p><p>DRS/Regions are slow if you have lots of small widgets (tool buttons, for example). And if you have non-opaque widgets, then it gets very complicated. In Windows, for example, windows need to use other APIs to implement translucent windows than the normal ones (under Windows, a translucent window forces windows under it to draw themselves on a back buffer, and then the system updates the screen by blitting from the back buffer).</p><p>Double-buffering is good if you update and blit only the affected area. If you draw all widgets each time a tiny button changes, then you are out of luck. If you think about it, A gui usually has small changes and only the foreground widgets change often. So double buffering is enough and covers all cases of widget types (non-opaque, translucent, non-rectangular, small widgets, etc).</p><p>PS: I did not apologize. I don&#39;t need to apologise to anyone, because I haven&#39;t said anything to apologise for. Another person (*cough* Spell <b>cough</b>) must apologise to me for calling my code &quot;some fluffy classes&quot; without even understanding what is going on.</p><p>My event system is ready. It has the following capabilities:<br />-sloppy and click focus type<br />-drag-n-drop<br />-the main event loop is never delayed, even for &quot;modal&quot; dialogs and menus<br />-left handed mouse optional<br />-multiple click counter (depends on the widget to accept less than 3 clicks; it is provided for all those cases that a triple/multiple click is needed).</p><p>If anyone cares to see it, I will post it here.</p><p>I am working on my DRS system. Right now it works, and it takes 10 lines of code. I did it just to confirm that it is possible. I have to optimize it further though.</p><p>PS2: the DRS system is ready.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sat, 28 Jun 2003 11:59:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
I would be VERY interested in seeing your system, axilmar. Just so you know. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>Oh, and I remembered some more examples where action and a GUI system is required at the same time - <i>MMORPG</i>s. Look at Asheron&#39;s Call, or Tibia, or any other recent MMORPG, and you&#39;ll see what I mean.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Sat, 28 Jun 2003 21:26:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Yes, I would also be interested in seeing this system.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Sun, 29 Jun 2003 13:01:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, here it is in the form of zipped source code(attached file which contains html help in the &#39;docs&#39; directory: file &#39;index.html&#39;).</p><p>The DRS is enabled: every half second the screen is updated. See method &#39;setUpdateCallback&#39;.</p><p>Press and hold the left button down over a widget and move it around with the mouse.</p><p>You can also change the video mode by using Alt+1, Alt+2, Alt+3 keys. You can exit the app by pressing Alt+X. All these are set using &#39;setAccelerator&#39; at the root widget.</p><p>There are many other thing to see:</p><p>1) drag-n-drop (search for the &#39;beginDragAndDrop&#39; call). Data query and exchange are done through the &#39;queryData&#39; and &#39;getData&#39; widget methods applied on the widget retrieved by the &#39;Widget::dragAndDropSourceWidget()&#39; method.</p><p>2) event handling: uncomment &#39;textout&#39; and &#39;textprintf&#39; in the event handling methods to see event output as it happens.</p><p>3) geometry management: some widgets are maximized and always follow the size of the parents, some widgets enforce a specific layout on their children.</p><p>4) event grabbing: when you press a button over a widget, it grabs events, then it moves itself around on &#39;processGrabbedEvent&#39; method. This allows for a widget to control the event flow without leaving the main event loop. My menus will be implemented like this.</p><p>5) focus management: press tab, tab+shift or the cursor keys to move the focus around. Widgets with the focus draw themselves with a thick black border. If you search the code, you will see that the focus goes to instances of the Test class that don&#39;t have children (method &#39;focusable()&#39;.</p><p>6) sloppy focus: uncomment the line &#39;Event::setFocusFollowsMouse&#39;.</p><p>7) timers: widget &#39;form1&#39; has a timer that is called every 1 second. This will allow blinking cursors, button repeaters, autoscrolling when the mouse arrives at widget edges etc.</p><p>8) left handed mouse: uncomment the line with the call to &#39;setLeftHandedMouse&#39;.</p><p>9) multiple clicks. The left button up handler prints the number of clicks. You can use &#39;Event::resetClicks()&#39; to restrict the amount of clicks to 2 in each widget.</p><p>If I ever finish this library (highly impropable, since no one is willing to lend a hand), it will not use DRS by default, it will use double buffering, since the purpose of this library is to build Allegro tools.</p><p>(Right now I am off to designing my widget classes. If a development team is made to make the ultimate allegro gui, I will be very happy to participate and give a hand. When this happens, I will abandon my gui.)</p><p>PS: This work is the culmination of 7 years experience with guis.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Sun, 29 Jun 2003 19:04:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
That&#39;s a lot of code! When did you start writing all this? It all looks very impressive, even if I can&#39;t understand what&#39;s going on! <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>However, you did confuse me with this:</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>If I ever finish this library (highly impropable, since no one is willing to lend a hand), it will not use DRS by default, it will use double buffering, since the purpose of this library is to build Allegro tools.</p><p>(Right now I am off to designing my widget classes. If a development team is made to make the ultimate allegro gui, I will be very happy to participate and give a hand. When this happens, I will abandon my gui.)
</p></div></div><p>

So you probably won&#39;t finish this library and if people offer to help you to make a new GUI you will abandon it anyway? Or did I misunderstand..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Tue, 01 Jul 2003 01:59:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I wrote it last week, Richard. As I have told earlier, I have done more than 50 tries to reach this state, so I was pretty sure of where to go. It&#39;s an amalgamation of various solutions I discovered on the go.</p><p>If people help me with this code, it will be finished. If people don&#39;t help me with this code, but they decide they will start from scratch, I will abandon mine and offer my workforce to the common cause.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Tue, 01 Jul 2003 13:42:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Do not plan to abandon yours and join the common cause.<br />Do take note of the comments, but do not react on them. Let them work their way into your mind, and come back to them in a week, without the anger your feel now. You can&#39;t properly assess all what&#39;s been said here, now. And if you abandon yours to join one that&#39;s starting up now, it will most probably die out after a week of starting frenzy.<br />You&#39;ll need a load of will to do that though. It&#39;s<br />so easy to get disenheartened by the bad comments,<br />or those seen as bad. Which is why you should cool<br />off, then come back to the archive.<br />But, do <b>not</b> abandon yours.</p><p>EDIT:<br />I&#39;ve downloaded the source and had a look:</p><p>Some comments on the source. Well, part of it (the event.h file and<br />the first half of widget.h).<br />I do realize you&#39;ve just begun, but anyway, here goes:</p><p>don&#39;t assume left/middle/right buttons: make the button the message<br />applies to an argument of the message, like you do for keys (eg, you don&#39;t<br />have EVENT_KEY_A_UP, etc).</p><p>EVENT_LEFT_DROP:<br />eh ? you&#39;re assuming semantics here. Leave that to another higher level<br />layer of your lib only.</p><p>I&#39;d suggest adding a type for your timestamps, not just int. It can prove<br />quite helpful down the road.</p><p>Also, add a type for geometry (eg, Maybe a vec2, which is two coords,<br />and Area, which is a couple of vec2s). This avoids passing 4 ints or<br />int*s to loads of routines and back.</p><p>Don&#39;t put everything and the rest in the event struct. It&#39;s supposed to<br />be akin to a virtual base class, in the ideal vision. X-Window, for one,<br />casts the rest of the event struct to a message specific struct, which<br />is not so pretty, but which conveys nicely the fact that the base event<br />is not dependant on whatever actual events you have. You can then add<br />events as you like without modifying the event struct.</p><p>I&#39;d remove the routines from the event struct, and move them into a new<br />class, say, EventModifier, or something similar: you&#39;d have a list of<br />them, which could filter the events as they&#39;re generated. You&#39;d have<br />things like &quot;LeftHandedMouseEventFilter&quot;, etc.</p><p>Have an EventQueue rather than statics in event to deal with the list.<br />This will help you have several possible policies for dealing with<br />those.</p><p>&gt;     Widget *root() const;</p><p>That should be static, I assume it&#39;s a typo.</p><p>Same for Widgets as for events, don&#39;t have too many statics, prefer a<br />manager instead, this yields more power to your API, due to possible<br />overriding.</p><p>Sometimes a pain, but, when it makes sense, add two versions of your<br />accessors, eg:</p><p>Widget *widgetAtXY(int,int);<br />const Widget *widgetAtXY(int,int) const;</p><p>    ///removes and destroys all children widgets<br />    void destroyChildren()<br />    {<br />        while (_last) delete _last;<br />    }</p><p>SIGSEGV</p><p>Good luck, and do not abandon it if you think it<br />could be a good thing to do for you and for others<br />to have.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (vpenquerch)</author>
		<pubDate>Tue, 01 Jul 2003 17:05:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Vincent, thanks for having a look at my code. Your comments are greatly appreciated.</p><p>Let me ask you a few questions and comment on your proposals.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
don&#39;t assume left/middle/right buttons: make the button the message<br />applies to an argument of the message, like you do for keys (eg, you don&#39;t<br />have EVENT_KEY_A_UP, etc).</p><p>EVENT_LEFT_DROP:<br />eh ? you&#39;re assuming semantics here. Leave that to another higher level<br />layer of your lib only.
</p></div></div><p>

In other words, replace </p><p>EVENT_LEFT_BUTTON_DOWN, EVENT_RIGHT_BUTTON_DOWN, EVENT_MIDDLE_BUTTON_DOWN, EVENT_LEFT_BUTTON_UP, EVENT_RIGHT_BUTTON_UP, EVENT_MIDDLE_BUTTON_UP </p><p>with</p><p>EVENT_BUTTON_DOWN, EVENT_BUTTON_UP </p><p>so as that the class itself can choose what to do e ?</p><p>Something like this:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">bool</span> buttonDown<span class="k2">(</span><span class="k1">const</span> Event <span class="k3">&amp;</span>event<span class="k2">)</span>
<span class="k2">{</span>
    <span class="k1">switch</span> <span class="k2">(</span>event.button<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span>
        <span class="k1">case</span> LeftButton:
            <span class="k3">&lt;</span>bla bla&gt;...
        <span class="k1">case</span> RightButton:
            <span class="k3">&lt;</span>bla bla&gt;...
        <span class="k1">case</span> MiddleButton:
            <span class="k3">&lt;</span>bla bla&gt;...
    <span class="k2">}</span>
<span class="k2">}</span>
</pre></div></div><p>

Right now, if the buttons are reversed, the rightButtonDown and rightButtonUp will be called if the left button is pressed.</p><p>What are the advantages of the implementation you are proposing ?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I&#39;d suggest adding a type for your timestamps, not just int. It can prove<br />quite helpful down the road.
</p></div></div><p>

I agree. How shall the type should be declared ? should it be global or part of the Event namespace ?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Also, add a type for geometry (eg, Maybe a vec2, which is two coords,<br />and Area, which is a couple of vec2s). This avoids passing 4 ints or<br />int*s to loads of routines and back
</p></div></div><p>

Ok, the Rect class will be put back. I was hoping that noone will notice this!!! I did it to save the library from one more class, but anyway it was a not so clever thought from the start. A Rect class is useful anyway.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Don&#39;t put everything and the rest in the event struct. It&#39;s supposed to<br />be akin to a virtual base class, in the ideal vision. X-Window, for one,<br />casts the rest of the event struct to a message specific struct, which<br />is not so pretty, but which conveys nicely the fact that the base event<br />is not dependant on whatever actual events you have. You can then add<br />events as you like without modifying the event struct
</p></div></div><p>

I wasn&#39;t planning for an event queue that custom events would go into. My definition of an event is either a mouse, a keyboard or a timer event. I.E. something coming from the hardware input devices only.</p><p>The way it is designed, it is impossible to do it, because the Event class is simply a place holder for the event data. If you check the Event internals, you will see that everything is in plain C; there is a reason for this: I don&#39;t want to mix event callbacks that might be called from interrupts with C++ (for example, I can&#39;t lock STL containers with LOCK_VARIABLE).</p><p>Another reason that I don&#39;t want Event to be a virtual base class is because if I did so, then the library would constantly allocate and deallocate Event-derived objects. Which means memory fragmentation. I don&#39;t think it is necessary to fragment the memory so much just to provide the programmer a feature to put his/her own events in the event queue.</p><p>In case you know from other libs (Qt for example) that custom events are useful in a multithreaded application, I have other solutions for thread communication (which would be a different library from a GUI anyway).</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Have an EventQueue rather than statics in event to deal with the list.<br />This will help you have several possible policies for dealing with<br />those.
</p></div></div><p>

I would like only one event queue. If there was an event queue class, the programmer would be misled that each time he/she wanted to make an event loop, he/she has to declare an EventQueue (assumingly with different contents). By not having an EventQueue class, it is implicitely understood that all events come from the same queue.</p><p>To tell you the truth, I don&#39;t really see an advantage in what you are proposing. Would you care to elaborate with a few examples ?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
&gt; Widget *root() const;</p><p>That should be static, I assume it&#39;s a typo.
</p></div></div><p>

No, not at all. The static method is:</p><div class="source-code snippet"><div class="inner"><pre>Widget <span class="k3">*</span>Widget::rootWidget<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

which returns the current root (or desktop) widget.</p><p>The plain &#39;root()&#39; method returns the Widget that is root of the widget tree that is called from, which might not be currently on the screen.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Same for Widgets as for events, don&#39;t have too many statics, prefer a<br />manager instead, this yields more power to your API, due to possible<br />overriding.
</p></div></div><p>

I tried that, but it did not look good enough to me. At one iteration of my design, I thought &quot;let&#39;s make nothing static&quot;. The result was that I had to declare lots of &quot;manager&quot; type classes that holded the state of a gui, without significant gain: after all, there is only one screen, one widget tree active at a time, one mouse, one event queue...and this is unlikely to change in the near future. (Even if two or more screens where present, that would mean a &quot;list&quot; of root widgets, but not more than one event queues, not more than one case of drag-n-drop, etc).</p><p>And then there is another problem : how to retrieve the current &#39;static&#39; information from inside the widget, without the widget knowing the &quot;manager&quot; variable that holds the current state. I would have to have statics, it can&#39;t be avoided. </p><p>So, instead of:</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="k1">class</span> GuiStateManager <span class="k2">{</span></td></tr><tr><td class="number">2</td><td>public:</td></tr><tr><td class="number">3</td><td>    Widget <span class="k3">*</span>rootWidget<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">4</td><td>&#160;</td></tr><tr><td class="number">5</td><td>    <span class="k1">static</span> GuiStateManager <span class="k3">*</span> currentGuiStateManager<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td><span class="k1">class</span> Button <span class="k2">{</span></td></tr><tr><td class="number">9</td><td>public:</td></tr><tr><td class="number">10</td><td>    <span class="k1">void</span> popupMenu<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">11</td><td>        currentGuiStateManager<span class="k2">(</span><span class="k2">)</span><span class="k3">-</span><span class="k3">&gt;</span>rootWidget<span class="k2">(</span><span class="k2">)</span><span class="k3">-</span><span class="k3">&gt;</span>add<span class="k2">(</span>popupMenu<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">12</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">13</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>&#160;</td></tr><tr><td class="number">15</td><td>main<span class="k2">(</span><span class="k2">)</span></td></tr><tr><td class="number">16</td><td><span class="k2">{</span></td></tr><tr><td class="number">17</td><td>    GuiStateManager gui1<span class="k2">;</span></td></tr><tr><td class="number">18</td><td>    EventQueue queue1<span class="k2">;</span></td></tr><tr><td class="number">19</td><td>    Event event<span class="k2">;</span></td></tr><tr><td class="number">20</td><td>&#160;</td></tr><tr><td class="number">21</td><td>    <span class="k1">while</span> <span class="k2">(</span>app_loop<span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">22</td><td>        <span class="k1">if</span> <span class="k2">(</span>queue1.get<span class="k2">(</span>event<span class="k2">)</span><span class="k2">)</span> event.dispatch<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">23</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">24</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>

I go for :</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="k1">class</span> Button <span class="k2">{</span></td></tr><tr><td class="number">2</td><td>public:</td></tr><tr><td class="number">3</td><td>    <span class="k1">void</span> popupMenu<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">4</td><td>        Widget::rootWidget<span class="k2">(</span><span class="k2">)</span><span class="k3">-</span><span class="k3">&gt;</span>add<span class="k2">(</span>popupMenu<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">5</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">6</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td>main<span class="k2">(</span><span class="k2">)</span></td></tr><tr><td class="number">9</td><td><span class="k2">{</span></td></tr><tr><td class="number">10</td><td>    Event event<span class="k2">;</span></td></tr><tr><td class="number">11</td><td>&#160;</td></tr><tr><td class="number">12</td><td>    <span class="k1">while</span> <span class="k2">(</span>app_loop<span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">13</td><td>        <span class="k1">if</span> <span class="k2">(</span>Event.get<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span> event.dispatch<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">15</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>

Which is much simpler and does the same job.</p><p>My line of thought is &quot;keep it simple&quot;, simple enough to satisfy 90% of the user requirements. There is fine balance between simplicity and bloatness. I don&#39;t want my library to cross that limit. In other words, I don&#39;t want to put features that would be useful only in 10% of the use cases!!! the other 90% will blame me for not having followed the easiest way to do the job...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Tue, 01 Jul 2003 19:54:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>About events and mouse buttons: yes, that&#39;s what I meant.</p><p>&gt; What are the advantages of the implementation you are proposing ?</p><p>Extensibility: when you decide to supprt a fourth button, you do<br />not have to add new event types; users who do not care which<br />button is pressed have their code still work; various things<br />like that.</p><p>&gt; I agree. How shall the type should be declared ? should it be global<br />&gt; or part of the Event namespace ?</p><p>Depends on whether you want it to be event specific or not. I&#39;d<br />put it as a global one (or add an algui namespace on top of the whole<br />thing).</p><p>&gt; My definition of an event is either a mouse, a keyboard or a timer event.<br />&gt; .E. something coming from the hardware input devices only.</p><p>You don&#39;t cater for, say, tilt information from tablets. Even if you<br />don&#39;t plan to add more, it&#39;s often wise to leave you some space to do,<br />if you change your mind.<br />Another example: joystick: they would probably send other messages.<br />Allegro currently solves the problem by generating fake keyboard events<br />to replace joystick movement - not pretty.</p><p>&gt; I can&#39;t lock STL containers with LOCK_VARIABLE</p><p>Interesting, I hadn&#39;t thought of that at all.<br />Could you keep a small core in C to do that, then have the C++ part that<br />checks for events do the conversion, since it would be out of interrupt<br />context ? That would solve the LOCK_VARIABLE problem while leaving you<br />able to use C++ fully.</p><p>&gt; Another reason that I don&#39;t want Event to be a virtual base class</p><p>It was only an image - but the memory problem you mention would apply<br />too. A possible way to fix this is to have a given event log size. Say,<br />64 KB. You allocate this much, and use it as a rotating buffer (there<br />is a word for it, but I can&#39;t remember it right now: everytime you add<br />an event, you use the memory after the last event you created, and when<br />you get to the end of the buffer, you start again at the beginning of<br />the memory block, erasing what was here already. If events here have<br />not been used yet, you can either erase them (events too old are just<br />discarded) or block any new events from being registered until these<br />old events are read.<br />That&#39;s just one of the possibilitiesa nyway.</p><p>&gt; In case you know from other libs (Qt for example)</p><p>Sorry, I don&#39;t. I&#39;m just talking out of common sense and experience<br />with other programs <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>&gt; I would like only one event queue.</p><p>My point was more with the ability to control how it behaves. It can<br />be a class and be a singleton, for isntance.</p><p>&gt; If there was an event queue class, the programmer would be misled<br />&gt; that each time he/she wanted to make an event loop, he/she has to<br />&gt; declare an EventQueue</p><p>No, that is user error, and an easy one (assuming it is documented).<br />Do not deny yourself the ability to use something useful on the fears<br />(often without grounds) that someone could maybe misuse it. If you<br />fear that, state it in the docs. Add a FAQ. Add a comment in the header.<br />Better, try to catch the error at compile time, or, if not possible,<br />at creation time.</p><p>&gt; To tell you the truth, I don&#39;t really see an advantage in what you<br />&gt; are proposing. Would you care to elaborate with a few examples ?</p><p>Here&#39;s one:</p><p>I want my event queue to transform all occurences of right click and<br />left click occuring at the same time (or narrowly) into a middle click,<br />like was often done when PC mice had only two buttons and Sun stations&#39;<br />ones had three (Ah, we had optical mice years ago, before MS decided<br />that yes, it was a good thing...)<br />Anyway.</p><p>I see your point in making the lib simple though. My comments would<br />aim to make it more powerful, but at a price of complexity. So feel free<br />to disregard.</p><p>Keep it up <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (vpenquerch)</author>
		<pubDate>Tue, 01 Jul 2003 20:26:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks Vincent, this is the type of discussion I expect on these boards.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Extensibility: when you decide to supprt a fourth button, you do<br />not have to add new event types; users who do not care which<br />button is pressed have their code still work; various things<br />like that.
</p></div></div><p>

Ok, proposition accepted.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Depends on whether you want it to be event specific or not. I&#39;d<br />put it as a global one (or add an algui namespace on top of the whole<br />thing).
</p></div></div><p>

In the end, maybe I put a namespace to the library. The time type would be a global type.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You don&#39;t cater for, say, tilt information from tablets. Even if you<br />don&#39;t plan to add more, it&#39;s often wise to leave you some space to do,<br />if you change your mind.
</p></div></div><p>

Maybe in the end I&#39;ll change the event internals, if it is requested by many. Right now, I don&#39;t think that anyone will care.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Another example: joystick: they would probably send other messages.<br />Allegro currently solves the problem by generating fake keyboard events<br />to replace joystick movement - not pretty
</p></div></div><p>

Joystick to move the mouse around ? I don&#39;t see a reason for this. There is no computer without a mouse these days. Again, this will be implemented only if requested by many users.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
It was only an image - but the memory problem you mention would apply<br />too. A possible way to fix this is to have a given event log size. Say,<br />64 KB. You allocate this much, and use it as a rotating buffer (there<br />is a word for it, but I can&#39;t remember it right now: everytime you add<br />an event, you use the memory after the last event you created, and when<br />you get to the end of the buffer, you start again at the beginning of<br />the memory block, erasing what was here already. If events here have<br />not been used yet, you can either erase them (events too old are just<br />discarded) or block any new events from being registered until these<br />old events are read.
</p></div></div><p>

Right now I am using a simple _EVENT struct to create a rotating buffer (struct _QUEUE). Very simple. If I add internal memory management on event allocation, I will make it very complex. I would like to avoid complexity.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Sorry, I don&#39;t. I&#39;m just talking out of common sense and experience<br />with other programs 
</p></div></div><p>

If I was to make a high level generic GUI toolkit, then I would definitely incorporate your proposals. Right now, I am thinking along the lines &quot;a simple GUI library&quot;. Since I am solo, I don&#39;t have the time and appetite to add more functionality. I hope you understand this.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I want my event queue to transform all occurences of right click and<br />left click occuring at the same time (or narrowly) into a middle click,<br />like was often done when PC mice had only two buttons and Sun stations&#39;<br />ones had three (Ah, we had optical mice years ago, before MS decided<br />that yes, it was a good thing...)
</p></div></div><p>

This can be easily done from inside the mouse_callback. Doesn&#39;t Allegro offer the capability to emulate a 3 button mouse anyway ?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I see your point in making the lib simple though. My comments would<br />aim to make it more powerful, but at a price of complexity. So feel free<br />to disregard.
</p></div></div><p>

Thank you. Really. A GUI lib is quite a complex thing, and I am alone. I have given much thought into many topics, but I can&#39;t handle it all alone. That&#39;s why I aim for simplicity and sacrifice a few complex functionalities.</p><p>Do you have any proposition for the widget set ? which widgets would you like to see ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Wed, 02 Jul 2003 14:59:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>&gt; Joystick to move the mouse around ? I don&#39;t see a reason for this.</p><p>No, this is just an example. The main point being,<br />if you ever need to add new messages, you want to<br />make this as easy and non intrusive as possible.</p><p>&gt; This can be easily done from inside the<br />&gt; mouse_callback. Doesn&#39;t Allegro offer the<br />&gt; capability to emulate a 3 button mouse anyway ?</p><p>Yes, but, once again, it&#39;s an example to show that<br />you can do many things if you design an extensible<br />base - you don&#39;t have to have a large base, just<br />one that can be built upon.<br />Virtual functions help. And especially modifier<br />objects which can be attached to something.<br />You don&#39;t have to add plenty of things to cater<br />for all needs, just the ability to possibly add<br />things to cater for this or that.<br />Just putting my point forward, I do understand<br />that you&#39;re aiming at another level, not as<br />complex as what I&#39;m describing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (vpenquerch)</author>
		<pubDate>Wed, 02 Jul 2003 15:18:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, that&#39;s my purpose. If something comes up, I will modify the library, but for now, &quot;keep it simple!!!&quot;...as simple as it gets!!!</p><p>Do you have a list of widgets that you would like to see implemented ?</p><p>EDIT:</p><p>Here is my list:</p><p>static widgets(widgets that don&#39;t respond to user input):<br />--------------<br />Label (for text)<br />Image (for bitmaps)<br />Separator (either horizontal or vertical)<br />Frame/Panel (either raised, sunken or flat)</p><p>buttons:<br />-------<br />PushButton<br />ToggleButton<br />CheckBox<br />RadioButton<br />ButtonFrame<br />ToolPushButton<br />ToolToggleButton<br />ToolCheckButton<br />ToolRadioButton</p><p>scrolling:<br />---------<br />Slider (horizontal or vertical)<br />ScrollBar (horizontal or vertical)</p><p>Menus:<br />------<br />MenuBar<br />PopupMenu<br />MenuBarItem<br />ActionMenuItem<br />CheckMenuItem<br />RadioMenuItem<br />SubmenuItem</p><p>Text editing:<br />-------------<br />TextBox (single line)<br />TextEditor (multi line)<br />SpinBox<br />ComboBox</p><p>views:<br />------<br />ListView (a.k.a. list box)<br />TreeView<br />TableView<br />HtmlView<br />IconView (for file dialogs)</p><p>Windowing:<br />----------<br />WindowFrame (caption, min/max buttons etc)<br />Dialog (A window frame that knows how to do a modal loop)</p><p>Framework:<br />----------<br />ToolBar (a window frame that positions its children according to selected docking)<br />Workspace (central widget for the main window)<br />MainWindow (a window frame that knows how to dock children toolbars)</p><p>Common dialogs:<br />---------------<br />MessageBox<br />FileDialog<br />PaletteDialog<br />FontDialog</p><p>Please note that widget names are not definitive: if someone proposes something better, it will be accepted. I tried to keep the names as close to the common terminology as possible.</p><p>The programming style would be very simple: just put one widget inside the either from parent to child, connect signals and slots and make an event loop. Example:</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 &lt;algui.h&gt;</span></td></tr><tr><td class="number">2</td><td>&#160;</td></tr><tr><td class="number">3</td><td>&#160;</td></tr><tr><td class="number">4</td><td><span class="c">//called to create a new document</span></td></tr><tr><td class="number">5</td><td><span class="k1">void</span> onNewDocument<span class="k2">(</span><span class="k2">)</span></td></tr><tr><td class="number">6</td><td><span class="k2">{</span></td></tr><tr><td class="number">7</td><td><span class="k2">}</span></td></tr><tr><td class="number">8</td><td>&#160;</td></tr><tr><td class="number">9</td><td>&#160;</td></tr><tr><td class="number">10</td><td><span class="c">//called to open a document</span></td></tr><tr><td class="number">11</td><td><span class="k1">void</span> onOpenDocument<span class="k2">(</span><span class="k2">)</span></td></tr><tr><td class="number">12</td><td><span class="k2">{</span></td></tr><tr><td class="number">13</td><td>    FileDialog dlg<span class="k2">;</span></td></tr><tr><td class="number">14</td><td>&#160;</td></tr><tr><td class="number">15</td><td>    dlg.setCaption<span class="k2">(</span><span class="s">"Open file"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td>    dlg.addFileType<span class="k2">(</span><span class="s">"exe"</span>, <span class="s">"Executable"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">17</td><td>    dlg.addFileType<span class="k2">(</span><span class="s">"lib"</span>, <span class="s">"Library"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">18</td><td>    dlg.addFileType<span class="k2">(</span><span class="s">"ico"</span>, <span class="s">"Icons"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">19</td><td>    <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>dlg.exec<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span> <span class="k1">return</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td>    <span class="k3">&lt;</span>bla bla <a href="http://www.delorie.com/djgpp/doc/libc/libc_600.html" target="_blank">open</a> file&gt;</td></tr><tr><td class="number">21</td><td><span class="k2">}</span></td></tr><tr><td class="number">22</td><td>&#160;</td></tr><tr><td class="number">23</td><td>&#160;</td></tr><tr><td class="number">24</td><td><span class="c">//main</span></td></tr><tr><td class="number">25</td><td><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span></td></tr><tr><td class="number">26</td><td><span class="k2">{</span></td></tr><tr><td class="number">27</td><td>    <span class="c">//install Allegro</span></td></tr><tr><td class="number">28</td><td>    <span class="k3">&lt;</span>bla bla bla&gt;</td></tr><tr><td class="number">29</td><td>&#160;</td></tr><tr><td class="number">30</td><td>    <span class="c">//load configuration</span></td></tr><tr><td class="number">31</td><td>    <span class="k3">&lt;</span>bla bla bla&gt;</td></tr><tr><td class="number">32</td><td>&#160;</td></tr><tr><td class="number">33</td><td>    <span class="c">//set video mode</span></td></tr><tr><td class="number">34</td><td>    <span class="k3">&lt;</span>bla bla bla&gt;</td></tr><tr><td class="number">35</td><td>&#160;</td></tr><tr><td class="number">36</td><td>    <span class="c">//load resources</span></td></tr><tr><td class="number">37</td><td>    <span class="k3">&lt;</span>bla bla bla&gt;</td></tr><tr><td class="number">38</td><td>&#160;</td></tr><tr><td class="number">39</td><td>    <span class="c">//create the main window</span></td></tr><tr><td class="number">40</td><td>    MainWindow <span class="k3">*</span>mainWindow <span class="k3">=</span> <span class="k1">new</span> MainWindow<span class="k2">(</span><a href="http://www.allegro.cc/manual/SCREEN_W" target="_blank"><span class="a">SCREEN_W</span></a>, <a href="http://www.allegro.cc/manual/SCREEN_H" target="_blank"><span class="a">SCREEN_H</span></a>, <span class="s">"My Application"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">41</td><td>&#160;</td></tr><tr><td class="number">42</td><td>    <span class="c">//create the menu bar</span></td></tr><tr><td class="number">43</td><td>    MenuBar <span class="k3">*</span>menuBar <span class="k3">=</span> <span class="k1">new</span> MenuBar<span class="k2">(</span>mainWindow<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">44</td><td>    MenuBarItem <span class="k3">*</span>fileItem <span class="k3">=</span> <span class="k1">new</span> MenuBarItem<span class="k2">(</span>menuBar, <span class="s">"&amp;File"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">45</td><td>    MenuBarItem <span class="k3">*</span>editItem <span class="k3">=</span> <span class="k1">new</span> MenuBarItem<span class="k2">(</span>menuBar, <span class="s">"&amp;Edit"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">46</td><td>    MenuBarItem <span class="k3">*</span>viewItem <span class="k3">=</span> <span class="k1">new</span> MenuBarItem<span class="k2">(</span>menuBar, <span class="s">"&amp;View"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">47</td><td>    MenuBarItem <span class="k3">*</span>optionsItem <span class="k3">=</span> <span class="k1">new</span> MenuBarItem<span class="k2">(</span>menuBar, <span class="s">"&amp;Options"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">48</td><td>&#160;</td></tr><tr><td class="number">49</td><td>    <span class="c">//create the file menu</span></td></tr><tr><td class="number">50</td><td>    PopupMenu <span class="k3">*</span>fileMenu <span class="k3">=</span> <span class="k1">new</span> PopupMenu<span class="k2">(</span>fileItem<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">51</td><td>    ActionMenuItem <span class="k3">*</span>newItem <span class="k3">=</span> <span class="k1">new</span> ActionMenuItem<span class="k2">(</span>fileMenu, <span class="s">"&amp;New"</span>, <span class="s">"Ctrl+N"</span>, <span class="k1">new</span> FunctionSlot<span class="k3">&lt;</span><span class="k3">&gt;</span><span class="k2">(</span>onNewDocument<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">52</td><td>    ActionMenuItem <span class="k3">*</span>openItem <span class="k3">=</span> <span class="k1">new</span> ActionMenuItem<span class="k2">(</span>fileMenu, <span class="s">"&amp;Open..."</span>, <span class="s">"Ctrl+O"</span>, <span class="k1">new</span> FunctionSlot<span class="k3">&lt;</span><span class="k3">&gt;</span><span class="k2">(</span>onOpenDocument<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">53</td><td>&#160;</td></tr><tr><td class="number">54</td><td>    <span class="k3">&lt;</span>bla bla create the <a href="http://www.allegro.cc/manual/rest" target="_blank"><span class="a">rest</span></a> of the menu items&gt;</td></tr><tr><td class="number">55</td><td>&#160;</td></tr><tr><td class="number">56</td><td>    <span class="c">//create the toolbar</span></td></tr><tr><td class="number">57</td><td>    ToolBar <span class="k3">*</span>standardToolBar <span class="k3">=</span> <span class="k1">new</span> ToolBar<span class="k2">(</span>mainWindow, <span class="s">"ToolBar"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">58</td><td>    ToolButton <span class="k3">*</span>newButton <span class="k3">=</span> <span class="k1">new</span> ToolButton<span class="k2">(</span>standardToolBar, <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>resources<span class="k2">[</span>DAT_NEW_BITMAP<span class="k2">]</span>.dat, <span class="k1">new</span> FunctionSlot<span class="k3">&lt;</span><span class="k3">&gt;</span><span class="k2">(</span>onNewDocument<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">59</td><td>&#160;</td></tr><tr><td class="number">60</td><td>    <span class="k3">&lt;</span>bla bla create the <a href="http://www.allegro.cc/manual/rest" target="_blank"><span class="a">rest</span></a> of the toolbars <span class="k1">and</span> toolbar items&gt;</td></tr><tr><td class="number">61</td><td>&#160;</td></tr><tr><td class="number">62</td><td>    <span class="c">//main loop</span></td></tr><tr><td class="number">63</td><td>    Event event<span class="k2">;</span></td></tr><tr><td class="number">64</td><td>    <span class="k1">while</span> <span class="k2">(</span>app_loop<span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">65</td><td>        <span class="k1">if</span> <span class="k2">(</span>event.get<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span> event.dispatch<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">66</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">67</td><td>&#160;</td></tr><tr><td class="number">68</td><td>    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">69</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Wed, 02 Jul 2003 15:44:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Not particularly.<br />Though you&#39;d better make your GUI independant of<br />the actual widgets - widgets use the GUI, so the<br />core can be coded without knowing the widgets.<br />After, you can add widgets, or maybe another lib<br />which adds widgets. So you can have a plethora of<br />widgets to choose from, without bloat. Of course,<br />some widgets will require other widgets (eg, a<br />button will require a label, which will in turn<br />require a base widget).<br />Do the widgets you like first, I&#39;d say <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (vpenquerch)</author>
		<pubDate>Wed, 02 Jul 2003 15:48:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Regarding labels: They do get userinput. One of the main features of a label is to provide a shortcut key for the widget it&#39;s associated to. So a label would react on the keypress by focusing / selecting the widget it&#39;s associated to.</p><p>I&#39;d also suggest to avoid a single root widget. If you&#39;re using c++ use a list (or any other container) as root. If you just have one root widget it doesn&#39;t hurt, and it allows you to have several widgets which don&#39;t have a common parent.</p><p>If you decide to stick with your single root widget solution, don&#39;t make it a global. Create a class and/or struct to contain your global information, so the complete state of the gui is inside a single object. This allows the user to use several instances of the gui.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Wed, 02 Jul 2003 16:38:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Not particularly.<br />Though you&#39;d better make your GUI independant of<br />the actual widgets
</p></div></div><p>

Do you mean to have two libraries ? one for the &#39;window system&#39; and one for the &#39;widgets&#39; ? I tried that also. I tried to make a widget set using MxWindows as the gui. It works, but the actual window system is a tiny fraction of the toolkit, so, for simplicity reasons, I thought they should be intergrated. Just &quot;#include &lt;algui.h&gt;&quot;, link with &quot;algui.lib.so.whatever&quot; and be done with it. </p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Regarding labels: They do get userinput. One of the main features of a label is to provide a shortcut key for the widget it&#39;s associated to. So a label would react on the keypress by focusing / selecting the widget it&#39;s associated to</p></div></div><p>

Gotcha. This will be provided. Widget categorization above was for just showing what I have in my mind.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I&#39;d also suggest to avoid a single root widget. If you&#39;re using c++ use a list (or any other container) as root. If you just have one root widget it doesn&#39;t hurt, and it allows you to have several widgets which don&#39;t have a common parent.</p><p>If you decide to stick with your single root widget solution, don&#39;t make it a global. Create a class and/or struct to contain your global information, so the complete state of the gui is inside a single object. This allows the user to use several instances of the gui
</p></div></div><p>

AlGui does have one &quot;root&quot; widget, i.e. only one root widget is currently on the screen. But widget trees can happily live off the screen, until they are added to a widget that is on-screen or be made &quot;root&quot; with a call to &#39;setRoot()&#39;.</p><p>Here is the code:</p><div class="source-code snippet"><div class="inner"><pre><span class="c">//returns the current "root" widget, i.e. the root widget that is on the screen</span>
<span class="k1">static</span> Widget <span class="k3">*</span>Widget::rootWidget<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>

<span class="c">//returns the root widget of this tree</span>
Widget <span class="k3">*</span>Widget::root<span class="k2">(</span><span class="k2">)</span> <span class="k1">const</span><span class="k2">;</span>

<span class="c">//sets the current root widget</span>
<span class="k1">bool</span> Widget::setRoot<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

If the user wants to make a multiscreen application, he/she can call &#39;setRoot&#39; to set a widget as the current root. He/she can construct multiple widget trees, each one with their own root (the local tree&#39;s root), and activate each widget tree by calling &#39;setRoot&#39;.</p><p>EDIT: </p><p>To all: do you find the above widget list adequate ? any other widget suggestions ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Wed, 02 Jul 2003 17:13:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I find the above widget list comprehensive.<br />It seems like you&#39;re going for a large set of<br />widgets, which encompass a wide array of functionalities (eg, an HTML renderer is not a<br />trivial thing to do). So it does not seem to fit<br />with your stated goal of &quot;a simple GUI for simple<br />uses&quot;.<br />That said, I can&#39;t think of other non specialized<br />widgets for you to add to the list.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (vpenquerch)</author>
		<pubDate>Thu, 03 Jul 2003 14:57:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> AlGui does have one &quot;root&quot; widget, i.e. only one root widget is currently on the screen. But widget trees can happily live off the screen, until they are added to a widget that is on-screen or be made &quot;root&quot; with a call to &#39;setRoot()&#39;.</p></div></div><p>

Assume you hae a game.<br />Assume you want to use some gui components for the game. <br />Assume the GUI should run with a lower priority than the renderer (say with 20fps instead of 60fps)<br />Assume you want to have several gui components on screen which are not connected (say a map width startegic control buttons / list, an area with messages, and one area with unit control buttons / infos).</p><p>The gui should be displayed on top of the game running at 60 fps, but it should render itself / react to events only with 20fps. </p><p>If you have several top level widgets, no problem. But how do you handle this with a single top level widget?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Thu, 03 Jul 2003 15:08:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
(eg, an HTML renderer is not a<br />trivial thing to do). So it does not seem to fit<br />with your stated goal of &quot;a simple GUI for simple<br />uses&quot;.
</p></div></div><p>

It will only display HTML 1.0 and only some basic tags. It is necessary if an application must show help files. I have already done some of the work in past projects.</p><p>Actually, it is not very difficult to make an HTML renderer. Basically, each HTML renderer widget is a giant &quot;list box&quot;. Each row of the list box can contain text, graphics, widgets, etc. You can fill this special &quot;list box&quot; from the HTML stream, as the stream is retrieved from the disk/network. Each row&#39;s size will be modified according to the size of the elements of the received data on the fly.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Assume you hae a game.<br />Assume you want to use some gui components for the game. <br />Assume the GUI should run with a lower priority than the renderer (say with 20fps instead of 60fps)<br />Assume you want to have several gui components on screen which are not connected (say a map width startegic control buttons / list, an area with messages, and one area with unit control buttons / infos).</p><p>The gui should be displayed on top of the game running at 60 fps, but it should render itself / react to events only with 20fps. </p><p>If you have several top level widgets, no problem. But how do you handle this with a single top level widget?
</p></div></div><p>

You make a root widget that is the container of all these unconnected widgets. This root widget will draw nothing, it will be positioned at the screen 0, 0 pixel and it will have the size of the screen; its children, the widgets you are interested in, will have a x, y position relative to the root equal their screen position, since their parent is at screen 0, 0.</p><p>In other words:
</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="k1">class</span> GameRootWidget <span class="k2">:</span> <span class="k1">public</span> Widget <span class="k2">{</span></td></tr><tr><td class="number">2</td><td>public:</td></tr><tr><td class="number">3</td><td>protected:</td></tr><tr><td class="number">4</td><td>    <span class="c">//draw nothing</span></td></tr><tr><td class="number">5</td><td>    <span class="k1">virtual</span> <span class="k1">void</span> paint<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">6</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">7</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">8</td><td>&#160;</td></tr><tr><td class="number">9</td><td>&#160;</td></tr><tr><td class="number">10</td><td><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span></td></tr><tr><td class="number">11</td><td><span class="k2">{</span></td></tr><tr><td class="number">12</td><td>    <span class="k3">&lt;</span>bla bla initialize Allegro&gt;</td></tr><tr><td class="number">13</td><td>&#160;</td></tr><tr><td class="number">14</td><td>    <span class="c">//make the root widgets</span></td></tr><tr><td class="number">15</td><td>    GameRootWidget <span class="k3">*</span>wgt <span class="k3">=</span> <span class="k1">new</span> GameRootWidget<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td>    wgt-&gt;setGeometry<span class="k2">(</span><span class="n">0</span>, <span class="n">0</span>, <a href="http://www.allegro.cc/manual/SCREEN_W" target="_blank"><span class="a">SCREEN_W</span></a>, <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">17</td><td>&#160;</td></tr><tr><td class="number">18</td><td>    <span class="c">//make the widgets you are interested in</span></td></tr><tr><td class="number">19</td><td>    Button <span class="k3">*</span>btn1 <span class="k3">=</span> <span class="k1">new</span> Button<span class="k2">(</span>root, <span class="n">0</span>, <span class="n">0</span>, <span class="n">32</span>, <span class="n">32</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td>    Button <span class="k3">*</span>btn2 <span class="k3">=</span> <span class="k1">new</span> Button<span class="k2">(</span>root, <span class="n">32</span>, <span class="n">0</span>, <span class="n">32</span>, <span class="n">32</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">21</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Thu, 03 Jul 2003 16:41:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>&gt; Actually, it is not very difficult to make an<br />&gt; HTML renderer.</p><p>It&#39;s hard to make a good one <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />If you&#39;re going for HTML 1.0, then it should be<br />OK, as you don&#39;t have tables. For the rest, you&#39;re<br />right that it&#39;s just mostly a collection of lines<br />with adjustable height, but there are lots of small<br />things, easy by themselves, but there are a lot of<br />them. Things like lists, blockquote spacing, etc.<br />You end up having a quite large &quot;state&quot; stack. At<br />least, I ended up that way.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (vpenquerch)</author>
		<pubDate>Thu, 03 Jul 2003 20:40:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
It&#39;s hard to make a good one 
</p></div></div><p>

It would be good to have one, though. For showing help files.</p><p>The stack can&#39;t be avoided.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Thu, 03 Jul 2003 21:11:50 +0000</pubDate>
	</item>
</rss>
