Author: mordante
Date: Sun Apr 26 12:23:25 2009
New Revision: 35233

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35233&view=rev
Log:
Add some layout exceptions.

These exceptions have been described in the algorithm and the scrollbar
container throws the exception when needed. The codepath doing so hasn't been
implemented yet.

Added:
    trunk/src/gui/auxiliary/layout_exception.hpp   (with props)
Modified:
    trunk/src/gui/widgets/scrollbar_container.cpp
    trunk/src/gui/widgets/window.cpp

Added: trunk/src/gui/auxiliary/layout_exception.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/auxiliary/layout_exception.hpp?rev=35233&view=auto
==============================================================================
--- trunk/src/gui/auxiliary/layout_exception.hpp (added)
+++ trunk/src/gui/auxiliary/layout_exception.hpp Sun Apr 26 12:23:25 2009
@@ -1,0 +1,43 @@
+/* $Id$ */
+/*
+   Copyright (C) 2009 by Mark de Wever <[email protected]>
+   Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 2
+   or at your option any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY.
+
+   See the COPYING file for more details.
+*/
+
+#ifndef GUI_AUXILIRY_LAYOUT_EXCEPTION_HPP_INCLUDED
+#define GUI_AUXILIRY_LAYOUT_EXCEPTION_HPP_INCLUDED
+
+namespace gui2 {
+
+/**
+ * Exception thrown when the width has been modified during resizing.
+ *
+ * @see layout_algorihm for more information.
+ */
+struct tlayout_exception_width_modified {};
+
+/**
+ * Exception thrown when the width resizing has failed.
+ *
+ * @see layout_algorihm for more information.
+ */
+struct tlayout_exception_width_resize_failed {};
+
+/**
+ * Exception thrown when the height resizing has failed.
+ *
+ * @see layout_algorihm for more information.
+ */
+struct tlayout_exception_height_resize_failed {};
+
+} // namespace gui2
+
+#endif

Propchange: trunk/src/gui/auxiliary/layout_exception.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/src/gui/auxiliary/layout_exception.hpp
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Modified: trunk/src/gui/widgets/scrollbar_container.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.cpp?rev=35233&r1=35232&r2=35233&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.cpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.cpp Sun Apr 26 12:23:25 2009
@@ -18,6 +18,7 @@
 
 #include "foreach.hpp"
 #include "gui/auxiliary/log.hpp"
+#include "gui/auxiliary/layout_exception.hpp"
 #include "gui/widgets/button.hpp"
 #include "gui/widgets/scrollbar.hpp"
 #include "gui/widgets/spacer.hpp"
@@ -208,7 +209,7 @@
        set_layout_size(size);
 
        if(unhide) {
-               /** @todo Throw a width change exception. */
+               throw tlayout_exception_width_modified();
        }
 }
 

Modified: trunk/src/gui/widgets/window.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window.cpp?rev=35233&r1=35232&r2=35233&view=diff
==============================================================================
--- trunk/src/gui/widgets/window.cpp (original)
+++ trunk/src/gui/widgets/window.cpp Sun Apr 26 12:23:25 2009
@@ -1126,17 +1126,19 @@
  *         - Throw a layout height doesn't fit exception.
  * - End layout loop.
  *
- * - Catch width modified exception:
+ * - Catch @ref gui2::tlayout_exception_width_modified "width modified":
  *   - Goto relayout.
  *
- * - Catch layout width doesn't fit exception:
+ * - Catch
+ *   @ref gui2::tlayout_exception_width_resize_failed "width resize failed":
  *   - If the window has a horizontal scrollbar which isn't shown but can be
  *     shown.
  *     - Show the scrollbar.
  *     - goto relayout.
  *   - Else show a layout failure message.
  *
- * - Catch layout height doesn't fit exception:
+ * - Catch
+ *   @ref gui2::tlayout_exception_height_resize_failed "height resize failed":
  *   - If the window has a vertical scrollbar which isn't shown but can be
  *     shown:
  *     - Show the scrollbar.


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to