/usr/include/simgear/canvas/layout/NasalWidget.hxx is in libsimgear-dev 3.4.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | ///@file
/// Glue for GUI widgets implemented in Nasal space.
//
// 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 SG_CANVAS_NASAL_WIDGET_HXX_
#define SG_CANVAS_NASAL_WIDGET_HXX_
#include "LayoutItem.hxx"
#include <simgear/nasal/cppbind/from_nasal.hxx>
#include <simgear/nasal/cppbind/NasalHash.hxx>
#include <simgear/nasal/cppbind/NasalObject.hxx>
namespace simgear
{
namespace canvas
{
/**
* Base class/ghost to implement gui widgets in Nasal space.
*/
class NasalWidget:
public LayoutItem,
public nasal::Object
{
public:
typedef boost::function<void (nasal::Me, const SGRecti&)> SetGeometryFunc;
typedef boost::function<int (nasal::Me, int)> HeightForWidthFunc;
/**
*
* @param impl Initial implementation hash (nasal part of
* implementation)
*/
NasalWidget(naRef impl);
~NasalWidget();
virtual void onRemove();
void setSetGeometryFunc(const SetGeometryFunc& func);
void setHeightForWidthFunc(const HeightForWidthFunc& func);
void setMinimumHeightForWidthFunc(const HeightForWidthFunc& func);
/** Set size hint.
*
* Overrides default size hint. Set to (0, 0) to fall back to default size
* hint.
*/
void setSizeHint(const SGVec2i& s);
/** Set minimum size.
*
* Overrides default minimum size. Set to (0, 0) to fall back to default
* minimum size.
*/
void setMinimumSize(const SGVec2i& s);
/** Set maximum size.
*
* Overrides default maximum size hint. Set to LayoutItem::MAX_SIZE to
* fall back to default maximum size.
*/
void setMaximumSize(const SGVec2i& s);
void setLayoutSizeHint(const SGVec2i& s);
void setLayoutMinimumSize(const SGVec2i& s);
void setLayoutMaximumSize(const SGVec2i& s);
virtual bool hasHeightForWidth() const;
/**
* @param ns Namespace to register the class interface
*/
static void setupGhost(nasal::Hash& ns);
protected:
enum WidgetFlags
{
LAYOUT_DIRTY = LayoutItem::LAST_FLAG << 1,
LAST_FLAG = LAYOUT_DIRTY
};
SetGeometryFunc _set_geometry;
HeightForWidthFunc _height_for_width,
_min_height_for_width;
SGVec2i _layout_size_hint,
_layout_min_size,
_layout_max_size,
_user_size_hint,
_user_min_size,
_user_max_size;
int callHeightForWidthFunc( const HeightForWidthFunc& hfw,
int w ) const;
virtual SGVec2i sizeHintImpl() const;
virtual SGVec2i minimumSizeImpl() const;
virtual SGVec2i maximumSizeImpl() const;
virtual int heightForWidthImpl(int w) const;
virtual int minimumHeightForWidthImpl(int w) const;
virtual void contentsRectChanged(const SGRecti& rect);
virtual void visibilityChanged(bool visible);
};
typedef SGSharedPtr<NasalWidget> NasalWidgetRef;
} // namespace canvas
} // namespace simgear
#endif /* SG_CANVAS_NASAL_WIDGET_HXX_ */
|