Move canvas::AlignmentFlag to separate file.

Mapping in a separate file allows easier exposing of
values and string representation to Nasal.
This commit is contained in:
Thomas Geymayer 2014-08-03 16:39:26 +02:00
parent f448898531
commit d1f5d92a7b
3 changed files with 47 additions and 19 deletions

View File

@ -0,0 +1,43 @@
///@file
/// Enumeration of layout alignment flags.
//
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#ifndef ALIGN_ENUM_MAPPING
# error "Only include with ALIGN_ENUM_MAPPING defined!"
#endif
ALIGN_ENUM_MAPPING(AlignFill, 0, Use all available space)
ALIGN_ENUM_MAPPING(AlignLeft, 0x01, Align with left edge)
ALIGN_ENUM_MAPPING(AlignRight, 0x02, Align with right edge)
ALIGN_ENUM_MAPPING(AlignHCenter, 0x04, Center horizontally in available space)
ALIGN_ENUM_MAPPING(AlignTop, 0x20, Align with top edge)
ALIGN_ENUM_MAPPING(AlignBottom, 0x40, Align with bottom edge)
ALIGN_ENUM_MAPPING(AlignVCenter, 0x80, Center vertically in available space)
ALIGN_ENUM_MAPPING( AlignCenter,
AlignVCenter | AlignHCenter,
Center both vertically and horizontally )
ALIGN_ENUM_MAPPING( AlignHorizontal_Mask,
AlignLeft | AlignRight | AlignHCenter,
Mask of all horizontal alignment flags )
ALIGN_ENUM_MAPPING( AlignVertical_Mask,
AlignTop | AlignBottom | AlignVCenter,
Mask of all vertical alignment flags )

View File

@ -1,6 +1,7 @@
include (SimGearComponent)
set(HEADERS
AlignFlag_values.hxx
BoxLayout.hxx
Layout.hxx
LayoutItem.hxx

View File

@ -89,25 +89,9 @@ namespace canvas
*/
enum AlignmentFlag
{
AlignFill = 0, //!< Use all available space
AlignLeft = 0x01, //!< Align with left edge
AlignRight = 0x02, //!< Align with right edge
AlignHCenter = 0x04, //!< Center horizontally in available space
AlignTop = 0x20, //!< Align with top edge
AlignBottom = 0x40, //!< Align with bottom edge
AlignVCenter = 0x80, //!< Center vertically in available space
AlignCenter = AlignVCenter //!< Center both vertically and horizontally
| AlignHCenter,
AlignHorizontal_Mask = AlignLeft
| AlignRight
| AlignHCenter,
AlignVertical_Mask = AlignTop
| AlignBottom
| AlignVCenter
#define ALIGN_ENUM_MAPPING(key, val, comment) key = val, /*!< comment */
# include "AlignFlag_values.hxx"
#undef ALIGN_ENUM_MAPPING
};
/**