<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>File drag &amp; drop concept</title>
		<link>http://www.allegro.cc/forums/view/614921</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 25 Dec 2014 01:34:25 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, I&#39;ve been working on adding drag and drop to a display. After 3 days, I finally got allegro compiled to test. Currently, I am please at the progress, but I would like to change things a bit. Right now the drop copies files to a static string array and any new drops will overwrite the last. I would like to instead append to end some sort of dynamic list.</p><p>This is what I have now for an event. Technically it is a display event as you drop the files onto the display.
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">typedef</span> <span class="k1">struct</span> ALLEGRO_DROPFILE_EVENT
<span class="k2">{</span>
  _AL_EVENT_HEADER<span class="k2">(</span><span class="k1">struct</span> <a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a><span class="k2">)</span>
  <span class="k1">int32_t</span> x<span class="k2">;</span>
  <span class="k1">int32_t</span> y<span class="k2">;</span>
  <span class="k1">int32_t</span> count<span class="k2">;</span>
  <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span><span class="k3">*</span>filenames<span class="k2">;</span>
<span class="k2">}</span> ALLEGRO_DROPFILE_EVENT<span class="k2">;</span>
</pre></div></div><p>

</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#ifndef __al_included_allegro5_dropfile_h</span>
<span class="number">  2</span><span class="p">#define __al_included_allegro5_dropfile_h</span>
<span class="number">  3</span>
<span class="number">  4</span><span class="p">#ifdef __cplusplus</span>
<span class="number">  5</span><span class="k1">extern</span> <span class="s">"C"</span> <span class="k2">{</span>
<span class="number">  6</span><span class="p">#endif</span>
<span class="number">  7</span>
<span class="number">  8</span>AL_FUNC<span class="k2">(</span><span class="k1">bool</span>, al_install_drag_drop, <span class="k2">(</span><a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a> <span class="k3">*</span>display<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  9</span>AL_FUNC<span class="k2">(</span><span class="k1">void</span>, al_uninstall_drag_drop, <span class="k2">(</span><span class="k1">void</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 10</span>
<span class="number"> 11</span><span class="p">#ifdef __cplusplus</span>
<span class="number"> 12</span>   <span class="k2">}</span>
<span class="number"> 13</span><span class="p">#endif</span>
<span class="number"> 14</span>
<span class="number"> 15</span><span class="p">#endif</span>
</div></div><p>

</p><div class="source-code snippet"><div class="inner"><pre>  <span class="k1">bool</span> processEvent<span class="k2">(</span><a href="http://www.allegro.cc/manual/ALLEGRO_EVENT"><span class="a">ALLEGRO_EVENT</span></a> <span class="k3">&amp;</span>event<span class="k2">)</span>
  <span class="k2">{</span>
    <span class="k1">switch</span> <span class="k2">(</span>event.type<span class="k2">)</span>
    <span class="k2">{</span>
    <span class="k1">case</span> ALLEGRO_EVENT_DROP_FILES:
    <span class="k2">{</span>
      <span class="k1">int32_t</span> count <span class="k3">=</span> event.drop.count<span class="k2">;</span>
      <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span><span class="k3">*</span>files <span class="k3">=</span> event.drop.filenames<span class="k2">;</span>

    <span class="k2">}</span> <span class="k1">break</span><span class="k2">;</span>

...
</pre></div></div><p>


Thoughts? Suggestions?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (DanielH)</author>
		<pubDate>Wed, 24 Dec 2014 10:46:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Needs to be more generic. Drag and drop just about anything. And needs Mac and Linux support before considered seriously.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Wed, 24 Dec 2014 11:20:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yea, what Trent said.  That was my first thought, too.</p><p>The API should allow for any content type (or just supported content types) to be dropped, not just files.</p><p>Is allegro dev on GitHub?  Where&#39;s the main development activity?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Wed, 24 Dec 2014 16:55:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/614921/1008520#target">Mark Oates</a> said:</div><div class="quote"><p>Is allegro dev on GitHub? Where&#39;s the main development activity?</p></div></div><p>there&#39;s a github mirror, but main repo is on sourceforge.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 24 Dec 2014 17:53:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>DanielH is on fire.  Rock on.</p><p>I see no need to go through the trouble of creating a dynamic list, if there&#39;s going to be a proper event.  Users would handle such events as they see fit, right?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Gideon Weems)</author>
		<pubDate>Wed, 24 Dec 2014 19:24:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I did a simple search and how to add drag drop to a program was using WM_DROPFILES message. So, that&#39;s what I focused on.</p><p>Adding support for data is similar to clipboard access. Will have to look into that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (DanielH)</author>
		<pubDate>Thu, 25 Dec 2014 01:34:25 +0000</pubDate>
	</item>
</rss>
