source: 2013/30/MiskaK/MW2(My Warfare 2)/Paranneltu Jypeli/GameObjects/ILayout.cs @ 4507

Revision 4507, 3.8 KB checked in by anlakane, 6 years ago (diff)

Talletus.

Line 
1#region MIT License
2/*
3 * Copyright (c) 2009-2012 University of Jyväskylä, Department of Mathematical
4 * Information Technology.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24#endregion
25
26/*
27 * Authors: Tomi Karppinen, Tero Jäntti
28 */
29
30using System.Collections.Generic;
31using System.ComponentModel;
32
33namespace Jypeli
34{
35    /// <summary>
36    /// Olion koon asettaminen asettelijan sisällä.
37    /// </summary>
38    public enum Sizing
39    {
40        /// <summary>
41        /// Olio ei kasva suuremmaksi kuin sen <c>PreferredSize</c>.
42        /// </summary>
43        FixedSize,
44
45        /// <summary>
46        /// Olio käyttää kaiken vapaana olevan tilan ja kutistuu, jos tilaa ei ole tarpeeksi.
47        /// </summary>
48        Expanding
49    }
50
51
52    public class HorizontalSpacer : GameObject
53    {
54        public HorizontalSpacer()
55            : base(1, 1)
56        {
57            Color = Color.Transparent;
58            HorizontalSizing = Sizing.Expanding;
59            VerticalSizing = Sizing.FixedSize;
60        }
61    }
62
63    public class VerticalSpacer : GameObject
64    {
65        public VerticalSpacer()
66            : base(1, 1)
67        {
68            Color = Color.Transparent;
69            HorizontalSizing = Sizing.FixedSize;
70            VerticalSizing = Sizing.Expanding;
71        }
72    }
73
74
75    /// <summary>
76    /// Rajapinta asettelijalle. Asettelija asettelee widgetin
77    /// lapsioliot siten, että ne mahtuvat widgetin sisälle. Asettelija
78    /// muuttaa lapsiolioiden kokoa sekä paikkaa. Asettelussa käytetään
79    /// hyväksi lapsiolioiden ominaisuuksia <c>PreferredSize</c>,
80    /// <c>HorizontalSizing</c> sekä <c>VerticalSizing</c>.
81    /// </summary>
82    [EditorBrowsable(EditorBrowsableState.Never)]
83    public interface ILayout
84    {
85        GameObject Parent { get; set; }
86
87        Sizing HorizontalSizing { get; }
88        Sizing VerticalSizing { get; }
89
90        Vector PreferredSize { get; }
91
92        /// <summary>
93        /// Yläreunaan jäävä tyhjä tila.
94        /// </summary>
95        double TopPadding { get; set; }
96
97        /// <summary>
98        /// Alareunaan jäävä tyhjä tila.
99        /// </summary>
100        double BottomPadding { get; set; }
101
102        /// <summary>
103        /// Vasempaan reunaan jäävä tyhjä tila.
104        /// </summary>
105        double LeftPadding { get; set; }
106
107        /// <summary>
108        /// Oikeaan reunaan jäävä tyhjä tila.
109        /// </summary>
110        double RightPadding { get; set; }
111
112        [EditorBrowsable(EditorBrowsableState.Never)]
113        void UpdateSizeHints(IList<GameObject> objects);
114
115        [EditorBrowsable(EditorBrowsableState.Never)]
116        void Update(IList<GameObject> objects, Vector maximumSize);
117    }
118}
Note: See TracBrowser for help on using the repository browser.