windstille-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Windstille-devel] rev 365 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 365 - trunk/src
Date: Sat, 29 May 2004 21:29:13 +0200

Author: grumbel
Date: 2004-05-29 21:29:13 +0200 (Sat, 29 May 2004)
New Revision: 365

Added:
   trunk/src/tool_impl.hxx
Modified:
   trunk/src/editor.py
   trunk/src/flexlay.i
   trunk/src/icon.cxx
   trunk/src/icon.hxx
Log:
- made buttons toggleable

Modified: trunk/src/editor.py
===================================================================
--- trunk/src/editor.py 2004-05-29 19:16:53 UTC (rev 364)
+++ trunk/src/editor.py 2004-05-29 19:29:13 UTC (rev 365)
@@ -139,33 +139,33 @@
 
 def set_tilemap_paint_tool():
     workspace.set_tool(tilemap_paint_tool.to_tool())
-    paint.disable()
-    select.enable()
-    zoom.enable()
-    object.enable()
+    paint.set_down()
+    select.set_up()
+    zoom.set_up()
+    object.set_up()
 
 def set_tilemap_select_tool():
     workspace.set_tool(tilemap_select_tool.to_tool())
-    paint.enable()
-    select.disable()
-    zoom.enable()
-    object.enable()
+    paint.set_up()
+    select.set_down()
+    zoom.set_up()
+    object.set_up()
     
 def set_zoom_tool():
     workspace.set_tool(zoom_tool.to_tool())
-    paint.enable()
-    select.enable()
-    zoom.disable()
-    object.enable()
+    paint.set_up()
+    select.set_up()
+    zoom.set_down()
+    object.set_up()
     
 def set_objmap_select_tool():
     workspace.set_tool(objmap_select_tool.to_tool())
-    paint.enable()
-    select.enable()
-    zoom.enable()
-    object.disable()
+    paint.set_up()
+    select.set_up()
+    zoom.set_up()
+    object.set_down()
 
-toolbar = Panel(CL_Rect(CL_Point(0, 23+33), CL_Size(33, 256)), 
gui.get_component())
+toolbar = Panel(CL_Rect(CL_Point(0, 23+33), CL_Size(33, 32*4+2)), 
gui.get_component())
 
 paint  = Icon(CL_Point(2, 32*0+2), 
make_sprite("../data/images/tools/stock-tool-pencil-22.png"), "Some tooltip", 
toolbar);
 paint.set_callback(set_tilemap_paint_tool)

Modified: trunk/src/flexlay.i
===================================================================
--- trunk/src/flexlay.i 2004-05-29 19:16:53 UTC (rev 364)
+++ trunk/src/flexlay.i 2004-05-29 19:29:13 UTC (rev 365)
@@ -98,4 +98,5 @@
 %include "objmap_select_tool.hxx"
 %include "zoom_tool.hxx" 
 
+
 /* EOF */

Modified: trunk/src/icon.cxx
===================================================================
--- trunk/src/icon.cxx  2004-05-29 19:16:53 UTC (rev 364)
+++ trunk/src/icon.cxx  2004-05-29 19:29:13 UTC (rev 365)
@@ -36,6 +36,11 @@
   std::string tooltip;
   bool draw_tooltip;
   bool down;
+
+  /** Parameter to keep the button down all the time, aka togglebutton
+      like */
+  bool is_down;
+
   bool is_enabled;
   CL_Signal_v0 sig_on_click;
 
@@ -71,6 +76,7 @@
   impl->tooltip      = tooltip;
   impl->draw_tooltip = true;
   impl->down         = false;
+  impl->is_down      = false;
   impl->is_enabled   = true;
 
   impl->slots.push_back(sig_paint().connect(impl.get(), &IconImpl::draw));
@@ -93,16 +99,22 @@
 
   if (is_enabled)
     {
-      if (parent->has_mouse_over())
+      if (is_down)
         {
-          if (down)
-            Box::draw_button_down(rect);
+          Box::draw_button_down(rect);
+        }
+      else
+        {
+          if (parent->has_mouse_over())
+            {
+              if (down)
+                Box::draw_button_down(rect);
+              else
+                Box::draw_button_up(rect);
+            }
           else
-            Box::draw_button_up(rect);
+            Box::draw_button_neutral(rect);
         }
-      else
-        Box::draw_button_neutral(rect);
-
       sprite.set_alpha(1.0f);
     }
   else
@@ -156,4 +168,16 @@
   impl->is_enabled = true;
 }
 
+void
+Icon::set_up()
+{
+  impl->is_down = false;
+}
+
+void
+Icon::set_down()
+{
+  impl->is_down = true;
+}
+
 /* EOF */

Modified: trunk/src/icon.hxx
===================================================================
--- trunk/src/icon.hxx  2004-05-29 19:16:53 UTC (rev 364)
+++ trunk/src/icon.hxx  2004-05-29 19:29:13 UTC (rev 365)
@@ -37,6 +37,9 @@
 
   void disable();
   void enable();
+
+  void set_up();
+  void set_down();
   
   CL_Signal_v0& sig_clicked();
 

Added: trunk/src/tool_impl.hxx
===================================================================
--- trunk/src/tool_impl.hxx     2004-05-29 19:16:53 UTC (rev 364)
+++ trunk/src/tool_impl.hxx     2004-05-29 19:29:13 UTC (rev 365)
@@ -0,0 +1,43 @@
+//  $Id: tilemap_tool.hxx,v 1.1 2003/09/23 19:10:05 grumbel Exp $
+// 
+//  Flexlay - A Generic 2D Game Editor
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_TOOL_IMPL_HXX
+#define HEADER_TOOL_IMPL_HXX
+
+class CL_InputEvent;
+
+/** */
+class ToolImpl
+{
+protected:
+
+public:
+  ToolImpl() {}
+  virtual ~ToolImpl() {}
+
+  virtual void draw() {}
+
+  virtual void on_mouse_up  (const CL_InputEvent& event) {}
+  virtual void on_mouse_down(const CL_InputEvent& event) {}
+  virtual void on_mouse_move(const CL_InputEvent& event) {}
+};
+
+#endif
+
+/* EOF */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]