/usr/include/Nux-4.0/Nux/GridHLayout.h is in libnux-4.0-dev 4.0.8+16.04.20160209-0ubuntu2.
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | /*
* Copyright 2010 Inalogic® Inc.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License, as
* published by the Free Software Foundation; either version 2.1 or 3.0
* of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the applicable version of the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of both the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Authored by: Jay Taoko <jaytaoko@inalogic.com>
*
*/
#ifndef GRIDHLAYOUT_H
#define GRIDHLAYOUT_H
#include "Layout.h"
namespace nux
{
//! An horizontal grid layout.
/*!
Fills the grid from left to right and going down.
*/
class GridHLayout: public Layout
{
// The grid layout goes through the child elements and assign them a size and position.
// 0 1 2 3 4 5
// 6 7 8 9 10 11
// 12 13 .. .. .. ..
// This is a left to right fill, going down.
NUX_DECLARE_OBJECT_TYPE(GridHLayout, Layout);
public:
enum FillingOrder
{
FILL_HORIZONTAL,
FILL_VERTICAL
};
GridHLayout(NUX_FILE_LINE_PROTO);
~GridHLayout();
virtual void GetCompositeList(std::list<Area *> *ViewList);
//! Control the visibility of elements on the bottom edge.
/*!
Controls how the layout places the elements at its bottom edge.
@param partial_visibility If True, the layout will position elements at its bottom edge
even if they are partially visible.
*/
void EnablePartialVisibility(bool partial_visibility);
//! Set the size of the grid element.
/*!
Set the size of the grid element.
@param width Width of elements.
@param height Height of elements.
*/
void SetChildrenSize(int width, int height);
//! Get the size of the grid element.
/*!
@return Size of the grid elements.
*/
Size GetChildrenSize() const;
//! Force the grid elements size.
/*!
Force the grid elements size to be the one provided by SetChildrenSize.
*/
void ForceChildrenSize(bool force);
//! Get the number of columns in the grid.
int GetNumColumn() const;
//! Get the number of rows in the grid.
int GetNumRow() const;
//! Make the grid width match the size of its content.
/*!
@param match_content If True, force the height of the layout to match the height of the content. This can also be achieve
if the stretch factor of this layout is set to 0;
*/
void MatchContentSize(bool match_content);
//! Return True if the grid width match the size of its content.
bool IsMatchingContentSize() const;
//! Draw Element
/*!
Draw all elements inside the layout.
If force_draw is true then the system requests that all objects redraw themselves completely.
@param force_draw
@param TraverseInfo
@param ProcessEventInfo
@return The state of the Process Event.
*/
virtual void ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw);
void SetSpaceBetweenChildren(int horizontal_space, int vertical_space);
void SetFillingOrder(FillingOrder order);
FillingOrder GetFillingOrder() const;
protected:
long ComputeLayoutRowOrder();
long ComputeLayoutColumnOrder();
virtual long ComputeContentSize();
int GetChildPos(Area *child);
Area* GetChildAtPosition(int pos);
Area* KeyNavIterationRowOrder(KeyNavDirection direction);
Area* KeyNavIterationColumnOrder(KeyNavDirection direction);
virtual Area* KeyNavIteration(KeyNavDirection direction);
FillingOrder filling_order_;
int m_v_in_margin;
int m_h_in_margin;
private:
Size _children_size;
bool _dynamic_column;
bool _force_children_size;
bool _partial_visibility;
bool match_content_size_; //!< If True, for the height of the layout to match the height of the content.
int _num_row;
int _num_column;
// //! Compute the how elements are spread inside the layout
// /*!
// @param remaining_width Size that remains after subtracting elements width, inner and outer margins from the content width.
// @param offset_space The space at the left of all elements.
// @param element_margin The margin between elements.
// */
// void ComputeStacking(int remaining_width, int &offset_space, int &element_margin);
};
}
#endif // GRIDHLAYOUT_H
|