windstille-devel
[Top][All Lists]
Advanced

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

[Windstille-devel] rev 381 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 381 - trunk/src
Date: Thu, 03 Jun 2004 00:57:35 +0200

Author: grumbel
Date: 2004-06-03 00:57:34 +0200 (Thu, 03 Jun 2004)
New Revision: 381

Modified:
   trunk/src/clanlib.i
   trunk/src/netpanzer.py
   trunk/src/supertux.py
   trunk/src/tilemap_layer.hxx
   trunk/src/window.cxx
Log:
- added generic dialog

Modified: trunk/src/clanlib.i
===================================================================
--- trunk/src/clanlib.i 2004-06-02 15:43:46 UTC (rev 380)
+++ trunk/src/clanlib.i 2004-06-02 22:57:34 UTC (rev 381)
@@ -1,5 +1,17 @@
 %include "std_string.i"
 
+class CL_Component
+{
+private:
+       ~CL_Component();
+public:
+       CL_Component(CL_Component* parent, CL_StyleManager* style = NULL);
+        void show(bool show = true);
+               bool is_visible(bool check_parents = true);
+       void set_size(int new_width, int new_height);
+       void set_position(int new_x, int new_y);
+};
+
 class CL_Size
 {
 public:
@@ -48,16 +60,6 @@
        unsigned int get_alpha();
 };
 
-class CL_Component
-{
-private:
-       ~CL_Component();
-public:
-       CL_Component(CL_Component* parent, CL_StyleManager* style = NULL);
-        void show(bool show = true);
-               bool is_visible(bool check_parents = true);
-};
-
 class CL_Window : public CL_Component
 {
 private:

Modified: trunk/src/netpanzer.py
===================================================================
--- trunk/src/netpanzer.py      2004-06-02 15:43:46 UTC (rev 380)
+++ trunk/src/netpanzer.py      2004-06-02 22:57:34 UTC (rev 381)
@@ -183,12 +183,6 @@
 def gui_level_load():
     load_dialog.run(netpanzer_load_level)
 
-def gui_toggle_minimap():
-    if minimap.is_visible():
-        minimap.show(False)
-    else:
-        minimap.show(True)        
-
 class Counter:
     counter = 0;
     
@@ -233,9 +227,17 @@
 undo_icon.disable()
 redo_icon.disable()
 
-# minimap_icon = Icon(CL_Rect(CL_Point(p.inc(48), 2), CL_Size(32, 32)),
-#                     make_sprite("../data/images/icons24/minimap.png"), "Some 
tooltip", button_panel);
-#minimap_icon.set_callback(gui_toggle_minimap)
+def gui_toggle_grid():
+    tilemap = workspace.get_map().get_metadata().data.get_tilemap()
+    tilemap.set_draw_grid(not(tilemap.get_draw_grid()))
+    if tilemap.get_draw_grid():
+        grid_icon.set_down()
+    else:
+        grid_icon.set_up()
+        
+grid_icon = Icon(CL_Rect(CL_Point(p.inc(48), 2), CL_Size(32, 32)),
+                 make_sprite("../data/images/icons24/grid.png"), "Some 
tooltip", button_panel);
+grid_icon.set_callback(gui_toggle_grid)
 
 layer_menu = Menu(CL_Point(32*11+2, 54), gui.get_component())
 

Modified: trunk/src/supertux.py
===================================================================
--- trunk/src/supertux.py       2004-06-02 15:43:46 UTC (rev 380)
+++ trunk/src/supertux.py       2004-06-02 22:57:34 UTC (rev 381)
@@ -383,9 +383,19 @@
 def gui_toggle_minimap():
     if minimap.is_visible():
         minimap.show(False)
+        minimap_icon.set_up()
     else:
-        minimap.show(True)        
+        minimap.show(True)
+        minimap_icon.set_down()
 
+def gui_toggle_grid():
+    tilemap = workspace.get_map().get_metadata().foreground;
+    tilemap.set_draw_grid(not(tilemap.get_draw_grid()))
+    if tilemap.get_draw_grid():
+        grid_icon.set_down()
+    else:
+        grid_icon.set_up()
+
 class Counter:
     counter = 0;
     
@@ -434,6 +444,10 @@
                     make_sprite("../data/images/icons24/minimap.png"), "Some 
tooltip", button_panel);
 minimap_icon.set_callback(gui_toggle_minimap)
 
+grid_icon = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(32, 32)),
+                 make_sprite("../data/images/icons24/grid.png"), "Some 
tooltip", button_panel);
+grid_icon.set_callback(gui_toggle_grid)
+
 foreground_icon  = Icon(CL_Rect(CL_Point(p.inc(48), 2), CL_Size(32, 32)),
                         make_sprite("../data/images/icons24/foreground.png"), 
"Some tooltip", button_panel);
 interactive_icon = Icon(CL_Rect(CL_Point(p.inc(32), 2), CL_Size(32, 32)),
@@ -627,10 +641,21 @@
 save_dialog.set_filename(config.datadir + "levels/")
 
 # Init the GUI, so that button state is in sync with internal state
+gui_toggle_minimap()
+gui_toggle_minimap()
 gui_show_interactive()
 gui_show_current()
 set_tilemap_paint_tool()
 
+myw = GenericDialog("Bla", gui.get_component())
+myw.add_int("Foo", 1000)
+myw.add_int("Bla")
+myw.add_string("Blu", "Foobar")
+myw.add_int("Boing")
+def foo(a, b, str, c):
+    print a, b, str, c
+myw.set_callback(foo)
+
 gui.run()
 
 flexlay.deinit()

Modified: trunk/src/tilemap_layer.hxx
===================================================================
--- trunk/src/tilemap_layer.hxx 2004-06-02 15:43:46 UTC (rev 380)
+++ trunk/src/tilemap_layer.hxx 2004-06-02 22:57:34 UTC (rev 381)
@@ -51,10 +51,8 @@
 
   Field<int>* get_field();
 
-  /** @param x position of the old map in the new resized one
-      @param y position of the old map in the new resized one
-      @param w height of the new map
-      @param h height of the new map */
+  /** @param pos position of the old map in the new resized one
+      @param size height of the new map */
   void resize(const CL_Size& size, const CL_Point& point);
 
   std::vector<int> get_data();

Modified: trunk/src/window.cxx
===================================================================
--- trunk/src/window.cxx        2004-06-02 15:43:46 UTC (rev 380)
+++ trunk/src/window.cxx        2004-06-02 22:57:34 UTC (rev 381)
@@ -57,6 +57,7 @@
   void draw();
   void do_maximize();
   void do_close();
+  void on_resize(int, int);
 };
 
 Window::Window(const CL_Rect& rect, const std::string& title, CL_Component* 
parent)
@@ -83,6 +84,8 @@
   impl->parent  = this;
   impl->is_maximized = false;
 
+  impl->slots.push_back(sig_resize().connect(impl.get(),      
&WindowImpl::on_resize));
+
   impl->slots.push_back(sig_paint().connect(impl.get(),      
&WindowImpl::draw));
   impl->slots.push_back(impl->maximize->sig_clicked().connect(impl.get(), 
&WindowImpl::do_maximize));
   impl->slots.push_back(impl->close->sig_clicked().connect(impl.get(), 
&WindowImpl::do_close));
@@ -94,6 +97,19 @@
 }
 
 void
+WindowImpl::on_resize(int, int)
+{
+  titlebar->set_position(CL_Rect(CL_Point(3+16,3), 
CL_Size(parent->get_width()-6-18-18-18, 12+3)));
+  close->set_position(3, 3);
+  minimize->set_position(parent->get_width()-3-18-18, 3);
+  maximize->set_position(parent->get_width()-3-18, 3);
+  CL_Rect rect = parent->get_position();
+  client_area->set_position(CL_Rect(CL_Point(4, 3+12+7), 
+                                   CL_Size(rect.get_width()-10,
+                                           rect.get_height()-28)));
+}
+
+void
 WindowImpl::draw()
 {
   CL_Color highlight(255, 255, 255);





reply via email to

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