mail[Wesnoth-commits] r33243 - in /trunk: data/gui/default/window/ src/gui/dialogs/


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by koraq on March 01, 2009 - 17:24:
Author: mordante
Date: Sun Mar  1 17:24:42 2009
New Revision: 33243

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33243&view=rev
Log:
Add the preview pane for the campaign dialog.

The pane still needs quite a bit tuning and the extra layout phase looks
rather bad.

Modified:
    trunk/data/gui/default/window/campaign_dialog.cfg
    trunk/src/gui/dialogs/campaign_selection.cpp
    trunk/src/gui/dialogs/campaign_selection.hpp

Modified: trunk/data/gui/default/window/campaign_dialog.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/gui/default/window/campaign_dialog.cfg?rev=33243&r1=33242&r2=33243&view=diff
==============================================================================
--- trunk/data/gui/default/window/campaign_dialog.cfg (original)
+++ trunk/data/gui/default/window/campaign_dialog.cfg Sun Mar  1 17:24:42 2009
@@ -95,10 +95,46 @@
 
                                                                border = "all"
                                                                border_size = 
5
+                                                               
vertical_alignment = "top"
 
                                                                # FIXME show 
the addon pane.
-                                                               [spacer]
-                                                               [/spacer]
+                                                               [panel]
+                                                                       
definition = "default"
+                                                                       [grid]
+
+                                                                             
  [row]
+                                                                             
          grow_factor = 0
+
+                                                                             
          [column]
+
+                                                                             
                  [scroll_label]
+                                                                             
                          id = "description"
+                                                                             
                          definition = "default"
+                                                                             
                  [/scroll_label]
+
+                                                                             
          [/column]
+
+                                                                             
  [/row]
+
+                                                                             
  [row]
+                                                                             
          grow_factor = 1
+
+                                                                             
          [column]
+                                                                             
                  horizontal_alignment = "center"
+                                                                             
                  vertical_alignment = "top"
+
+                                                                             
                  [image]
+                                                                             
                          id = "image"
+                                                                             
                          definition = "default"
+                                                                             
                  [/image]
+
+                                                                             
          [/column]
+
+                                                                             
  [/row]
+
+                                                                       
[/grid]
+
+                                                               [/panel]
 
                                                        [/column]
 

Modified: trunk/src/gui/dialogs/campaign_selection.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/campaign_selection.cpp?rev=33243&r1=33242&r2=33243&view=diff
==============================================================================
--- trunk/src/gui/dialogs/campaign_selection.cpp (original)
+++ trunk/src/gui/dialogs/campaign_selection.cpp Sun Mar  1 17:24:42 2009
@@ -16,11 +16,39 @@
 
 #include "gui/dialogs/campaign_selection.hpp"
 
+#include "gui/dialogs/helper.hpp"
+#include "gui/widgets/image.hpp"
 #include "gui/widgets/listbox.hpp"
+#include "gui/widgets/scroll_label.hpp"
 #include "gui/widgets/settings.hpp"
 #include "gui/widgets/window.hpp"
 
 namespace gui2 {
+
+void tcampaign_selection::campaign_selected(twindow& window)
+{
+       tlistbox* list = dynamic_cast<tlistbox*>(
+                       window.find_widget("campaign_list", false));
+       VALIDATE(list, missing_widget("campaign_list"));
+
+       // Get the selected row
+       config::child_list::const_iterator itor = begin_
+                       + list->get_selected_row(); 
+
+       tscroll_label* scroll_label = dynamic_cast<tscroll_label*>(
+                       window.find_widget("description", false));
+       if(scroll_label) {
+               scroll_label->set_label((**itor)["description"]);
+       }
+
+       timage* image = dynamic_cast<timage*>(
+                       window.find_widget("image", false));
+       if(image) {
+               image->set_label((**itor)["image"]);
+       }
+
+       window.invalidate_layout();
+}
 
 twindow* tcampaign_selection::build_window(CVideo& video)
 {
@@ -33,6 +61,9 @@
                        window.find_widget("campaign_list", false));
        VALIDATE(list, missing_widget("campaign_list"));
 
+       list->set_callback_value_change(dialog_callback
+                       <tcampaign_selection, 
&tcampaign_selection::campaign_selected>);
+
        for(config::child_list::const_iterator itor = begin_;
                        itor != end_; ++itor) {
 
@@ -42,6 +73,7 @@
                list->add_row(item);
        }
 
+       campaign_selected(window);
 }
 
 void tcampaign_selection::post_show(twindow& window)

Modified: trunk/src/gui/dialogs/campaign_selection.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/campaign_selection.hpp?rev=33243&r1=33242&r2=33243&view=diff
==============================================================================
--- trunk/src/gui/dialogs/campaign_selection.hpp (original)
+++ trunk/src/gui/dialogs/campaign_selection.hpp Sun Mar  1 17:24:42 2009
@@ -37,6 +37,9 @@
 
        int get_choice() const { return choice_; }
 
+       /** Called when another campaign is selected. */
+       void campaign_selected(twindow& window);
+
 private:
 
        /** Inherited from tdialog. */




Related Messages


Powered by MHonArc, Updated Sun Mar 01 17:40:06 2009