comparison mde/gui/widget/Ifaces.d @ 40:b28d7adc786b

Made GUI more robust to mutable data changes and improved much of GridLayoutWidget's code. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 08 May 2008 16:05:51 +0100
parents 5132301e9ed7
children b3a6ca4516b4
comparison
equal deleted inserted replaced
39:5132301e9ed7 40:b28d7adc786b
73 interface IWidget 73 interface IWidget
74 { 74 {
75 //BEGIN Load and save 75 //BEGIN Load and save
76 /** Called after creating widgets to adjust size & other mutable attributes from saved data. 76 /** Called after creating widgets to adjust size & other mutable attributes from saved data.
77 * 77 *
78 * As for setSize, setPosition should be called afterwards.
79 *
78 * Each widget should call adjust on each of its sub-widgets in turn with data, each time 80 * Each widget should call adjust on each of its sub-widgets in turn with data, each time
79 * replacing data by the return value of the call. It should then take its own mutable data 81 * replacing data by the return value of the call. It should then take its own mutable data
80 * from the beginning of the array and return the remainder of the array. 82 * from the beginning of the array and return the remainder of the array.
81 * 83 *
82 * Throws: on error, throw a MutableDataException. */ 84 * Adjust should handle errors gracefully by reverting to default values and not throwing.
85 * This is because the creation data and the user's mutable data may be stored separately and
86 * become out-of-sync during an update. */
83 int[] adjust (int[] data); 87 int[] adjust (int[] data);
84 88
85 /** Output data suitible for recreating the widget (data to be passed to this()). */ 89 /** Output data suitible for recreating the widget (data to be passed to this()).
90 *
91 * Creation data is data only changed when the gui is edited. */
86 int[] getCreationData (); 92 int[] getCreationData ();
87 93
88 /** Output data containing the widget's current adjustments (data to be passed to adjust()). 94 /** Output data containing the widget's current adjustments (data to be passed to adjust()).
95 *
96 * Mutable data is data which can be changed during normal gui use, such as the size of
97 * resizible widgets or current tab of a tab widget.
98 *
89 * Should be a concatenation of each sub-widget's mutable data and the widget's own. */ 99 * Should be a concatenation of each sub-widget's mutable data and the widget's own. */
90 int[] getMutableData (); 100 int[] getMutableData ();
91 //END Load and save 101 //END Load and save
92 102
93 //BEGIN Size and position 103 //BEGIN Size and position