PixelLightAPI  .
LayoutHints.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: LayoutHints.h                                  *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLGUI_LAYOUTHINTS_H__
00024 #define __PLGUI_LAYOUTHINTS_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Base/Event/Event.h>
00032 #include <PLMath/Vector2i.h>
00033 #include "PLGui/Gui/Data/SizeHint.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Forward declarations                                  ]
00038 //[-------------------------------------------------------]
00039 namespace PLMath {
00040     class Vector2i;
00041 }
00042 
00043 
00044 //[-------------------------------------------------------]
00045 //[ Namespace                                             ]
00046 //[-------------------------------------------------------]
00047 namespace PLGui {
00048 
00049 
00050 //[-------------------------------------------------------]
00051 //[ Classes                                               ]
00052 //[-------------------------------------------------------]
00053 /**
00054 *  @brief
00055 *    Layout information for a widget
00056 *
00057 *  @note
00058 *    - Margin defines how much empty space (pixel) should be around an element
00059 *    - Padding defines the how much empty space (pixel) should be within the borders of a container
00060 *    - Spacing defines the how much empty space (pixel) should be between elements by default
00061 */
00062 class LayoutHints {
00063 
00064 
00065     //[-------------------------------------------------------]
00066     //[ Public events                                         ]
00067     //[-------------------------------------------------------]
00068     public:
00069         PLCore::Event<> EventUpdate;    /**< Layout hints have been changed */
00070 
00071 
00072     //[-------------------------------------------------------]
00073     //[ Public functions                                      ]
00074     //[-------------------------------------------------------]
00075     public:
00076         /**
00077         *  @brief
00078         *    Constructor
00079         */
00080         PLGUI_API LayoutHints();
00081 
00082         /**
00083         *  @brief
00084         *    Destructor
00085         */
00086         PLGUI_API ~LayoutHints();
00087 
00088         /**
00089         *  @brief
00090         *    Get desired size (X)
00091         *
00092         *  @return
00093         *    Size hint
00094         */
00095         PLGUI_API const SizeHint &GetSizeX() const;
00096 
00097         /**
00098         *  @brief
00099         *    Set desired size (X)
00100         *
00101         *  @param[in] cSize
00102         *    Size hint
00103         */
00104         PLGUI_API void SetSizeX(const SizeHint &cSize);
00105 
00106         /**
00107         *  @brief
00108         *    Get desired size (Y)
00109         *
00110         *  @return
00111         *    Size hint
00112         */
00113         PLGUI_API const SizeHint &GetSizeY() const;
00114 
00115         /**
00116         *  @brief
00117         *    Set desired size (Y)
00118         *
00119         *  @param[in] cSize
00120         *    Size hint
00121         */
00122         PLGUI_API void SetSizeY(const SizeHint &cSize);
00123 
00124         /**
00125         *  @brief
00126         *    Get minimum size (X)
00127         *
00128         *  @return
00129         *    Size hint
00130         */
00131         PLGUI_API const SizeHint &GetMinSizeX() const;
00132 
00133         /**
00134         *  @brief
00135         *    Set minimum size (X)
00136         *
00137         *  @param[in] cSize
00138         *    Size hint
00139         */
00140         PLGUI_API void SetMinSizeX(const SizeHint &cSize);
00141 
00142         /**
00143         *  @brief
00144         *    Get minimum size (Y)
00145         *
00146         *  @return
00147         *    Size hint
00148         */
00149         PLGUI_API const SizeHint &GetMinSizeY() const;
00150 
00151         /**
00152         *  @brief
00153         *    Set minimum size (Y)
00154         *
00155         *  @param[in] cSize
00156         *    Size hint
00157         */
00158         PLGUI_API void SetMinSizeY(const SizeHint &cSize);
00159 
00160         /**
00161         *  @brief
00162         *    Get maximum size (X)
00163         *
00164         *  @return
00165         *    Size hint
00166         */
00167         PLGUI_API const SizeHint &GetMaxSizeX() const;
00168 
00169         /**
00170         *  @brief
00171         *    Set maximum size (X)
00172         *
00173         *  @param[in] cSize
00174         *    Size hint
00175         */
00176         PLGUI_API void SetMaxSizeX(const SizeHint &cSize);
00177 
00178         /**
00179         *  @brief
00180         *    Get maximum size (Y)
00181         *
00182         *  @return
00183         *    Size hint
00184         */
00185         PLGUI_API const SizeHint &GetMaxSizeY() const;
00186 
00187         /**
00188         *  @brief
00189         *    Set maximum size (Y)
00190         *
00191         *  @param[in] cSize
00192         *    Size hint
00193         */
00194         PLGUI_API void SetMaxSizeY(const SizeHint &cSize);
00195 
00196         /**
00197         *  @brief
00198         *    Get margin (left)
00199         *
00200         *  @return
00201         *    Size hint
00202         */
00203         PLGUI_API const SizeHint &GetMarginLeft() const;
00204 
00205         /**
00206         *  @brief
00207         *    Set margin (left)
00208         *
00209         *  @param[in] cSize
00210         *    Size hint
00211         */
00212         PLGUI_API void SetMarginLeft(const SizeHint &cSize);
00213 
00214         /**
00215         *  @brief
00216         *    Get margin (right)
00217         *
00218         *  @return
00219         *    Size hint
00220         */
00221         PLGUI_API const SizeHint &GetMarginRight() const;
00222 
00223         /**
00224         *  @brief
00225         *    Set margin (right)
00226         *
00227         *  @param[in] cSize
00228         *    Size hint
00229         */
00230         PLGUI_API void SetMarginRight(const SizeHint &cSize);
00231 
00232         /**
00233         *  @brief
00234         *    Get margin (top)
00235         *
00236         *  @return
00237         *    Size hint
00238         */
00239         PLGUI_API const SizeHint &GetMarginTop() const;
00240 
00241         /**
00242         *  @brief
00243         *    Set margin (top)
00244         *
00245         *  @param[in] cSize
00246         *    Size hint
00247         */
00248         PLGUI_API void SetMarginTop(const SizeHint &cSize);
00249 
00250         /**
00251         *  @brief
00252         *    Get margin (bottom)
00253         *
00254         *  @return
00255         *    Size hint
00256         */
00257         PLGUI_API const SizeHint &GetMarginBottom() const;
00258 
00259         /**
00260         *  @brief
00261         *    Set margin (bottom)
00262         *
00263         *  @param[in] cSize
00264         *    Size hint
00265         */
00266         PLGUI_API void SetMarginBottom(const SizeHint &cSize);
00267 
00268         /**
00269         *  @brief
00270         *    Set margin (all)
00271         *
00272         *  @param[in] cSize
00273         *    Size hint
00274         *
00275         *  @remarks
00276         *    This function sets all margins (left, right, top and bottom) to the same value
00277         */
00278         PLGUI_API void SetMargin(const SizeHint &cSize);
00279 
00280         /**
00281         *  @brief
00282         *    Get padding (left)
00283         *
00284         *  @return
00285         *    Size hint
00286         */
00287         PLGUI_API const SizeHint &GetPaddingLeft() const;
00288 
00289         /**
00290         *  @brief
00291         *    Set padding (left)
00292         *
00293         *  @param[in] cSize
00294         *    Size hint
00295         */
00296         PLGUI_API void SetPaddingLeft(const SizeHint &cSize);
00297 
00298         /**
00299         *  @brief
00300         *    Get padding (right)
00301         *
00302         *  @return
00303         *    Size hint
00304         */
00305         PLGUI_API const SizeHint &GetPaddingRight() const;
00306 
00307         /**
00308         *  @brief
00309         *    Set padding (right)
00310         *
00311         *  @param[in] cSize
00312         *    Size hint
00313         */
00314         PLGUI_API void SetPaddingRight(const SizeHint &cSize);
00315 
00316         /**
00317         *  @brief
00318         *    Get padding (top)
00319         *
00320         *  @return
00321         *    Size hint
00322         */
00323         PLGUI_API const SizeHint &GetPaddingTop() const;
00324 
00325         /**
00326         *  @brief
00327         *    Set padding (top)
00328         *
00329         *  @param[in] cSize
00330         *    Size hint
00331         */
00332         PLGUI_API void SetPaddingTop(const SizeHint &cSize);
00333 
00334         /**
00335         *  @brief
00336         *    Get padding (bottom)
00337         *
00338         *  @return
00339         *    Size hint
00340         */
00341         PLGUI_API const SizeHint &GetPaddingBottom() const;
00342 
00343         /**
00344         *  @brief
00345         *    Set padding (bottom)
00346         *
00347         *  @param[in] cSize
00348         *    Size hint
00349         */
00350         PLGUI_API void SetPaddingBottom(const SizeHint &cSize);
00351 
00352         /**
00353         *  @brief
00354         *    Set padding (all)
00355         *
00356         *  @param[in] cSize
00357         *    Size hint
00358         *
00359         *  @remarks
00360         *    This function sets all paddings (left, right, top and bottom) to the same value
00361         */
00362         PLGUI_API void SetPadding(const SizeHint &cSize);
00363 
00364         /**
00365         *  @brief
00366         *    Get alignment of child elements (horizontal)
00367         *
00368         *  @return
00369         *    Alignment
00370         */
00371         PLGUI_API EAlign GetAlign() const;
00372 
00373         /**
00374         *  @brief
00375         *    Set alignment of child elements (horizontal)
00376         *
00377         *  @param[in] nAlign
00378         *    Alignment
00379         */
00380         PLGUI_API void SetAlign(EAlign nAlign);
00381 
00382         /**
00383         *  @brief
00384         *    Get alignment of child elements (vertical)
00385         *
00386         *  @return
00387         *    Alignment
00388         */
00389         PLGUI_API EVAlign GetVAlign() const;
00390 
00391         /**
00392         *  @brief
00393         *    Set alignment of child elements (vertical)
00394         *
00395         *  @param[in] nAlign
00396         *    Alignment
00397         */
00398         PLGUI_API void SetVAlign(EVAlign nAlign);
00399 
00400         /**
00401         *  @brief
00402         *    Get spacing between child elements
00403         *
00404         *  @return
00405         *    Spacing
00406         */
00407         PLGUI_API PLCore::uint32 GetSpacing() const;
00408 
00409         /**
00410         *  @brief
00411         *    Set spacing between child elements
00412         *
00413         *  @param[in] nSpacing
00414         *    Spacing, default is 10 pixel
00415         */
00416         PLGUI_API void SetSpacing(PLCore::uint32 nSpacing);
00417 
00418 
00419     //[-------------------------------------------------------]
00420     //[ Protected functions                                   ]
00421     //[-------------------------------------------------------]
00422     protected:
00423         /**
00424         *  @brief
00425         *    Update layout hints
00426         */
00427         PLGUI_API void Update();
00428 
00429 
00430     //[-------------------------------------------------------]
00431     //[ Protected data                                        ]
00432     //[-------------------------------------------------------]
00433     protected:
00434         // Size
00435         SizeHint        m_cSizeX;           /**< Desired size (X) */
00436         SizeHint        m_cSizeY;           /**< Desired size (Y) */
00437         SizeHint        m_cMinSizeX;        /**< Minimum size (X) */
00438         SizeHint        m_cMinSizeY;        /**< Minimum size (Y) */
00439         SizeHint        m_cMaxSizeX;        /**< Maximum size (X) */
00440         SizeHint        m_cMaxSizeY;        /**< Maximum size (Y) */
00441         SizeHint        m_cMarginLeft;      /**< Margin (left) */
00442         SizeHint        m_cMarginRight;     /**< Margin (right) */
00443         SizeHint        m_cMarginTop;       /**< Margin (top) */
00444         SizeHint        m_cMarginBottom;    /**< Margin (bottom) */
00445         SizeHint        m_cPaddingLeft;     /**< Padding (left) */
00446         SizeHint        m_cPaddingRight;    /**< Padding (right) */
00447         SizeHint        m_cPaddingTop;      /**< Padding (top) */
00448         SizeHint        m_cPaddingBottom;   /**< Padding (bottom) */
00449         EAlign          m_nAlign;           /**< Horizontal alignment of child elements */
00450         EVAlign         m_nVAlign;          /**< Vertical alignment of child elements */
00451         PLCore::uint32  m_nSpacing;         /**< Spacing between child elements */
00452 
00453 
00454 };
00455 
00456 
00457 //[-------------------------------------------------------]
00458 //[ Namespace                                             ]
00459 //[-------------------------------------------------------]
00460 } // PLGui
00461 
00462 
00463 #endif // __PLGUI_LAYOUTHINTS_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:56
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported