|
nux-1.14.0
|
A vertical grid layout. More...
#include <Nux/GridVLayout.h>
Public Member Functions | |
| GridVLayout (NUX_FILE_LINE_PROTO) | |
| virtual long | ComputeLayout2 () |
| virtual void | GetCompositeList (std::list< Area * > *ViewList) |
| void | EnablePartialVisibility (bool partial_visibility) |
| Control the visibility of elements on the bottom edge. | |
| void | SetChildrenSize (int width, int height) |
| Set the size of the grid element. | |
| Size | GetChildrenSize () const |
| Get the size of the grid element. | |
| void | ForceChildrenSize (bool force) |
| Force the grid elements size. | |
| int | GetNumColumn () const |
| Get the number of columns in the grid. | |
| int | GetNumRow () const |
| Get the number of rows in the grid. | |
| void | SetWidthMatchContent (bool match_content) |
| Make the grid width match the size of its content. | |
| bool | GetWidthMatchContent () const |
| Return True if the grid width match the size of its content. | |
| virtual void | ProcessDraw (GraphicsEngine &GfxContext, bool force_draw) |
| Draw Element. | |
Protected Member Functions | |
| int | GetChildPos (Area *child) |
| Area * | GetChildAtPosition (int pos) |
| virtual Area * | KeyNavIteration (KeyNavDirection direction) |
A vertical grid layout.
Fills the grid from top to bottom and going right.
Definition at line 34 of file GridVLayout.h.
| void nux::GridVLayout::EnablePartialVisibility | ( | bool | partial_visibility | ) |
Control the visibility of elements on the bottom edge.
Controls how the layout places the elements at its bottom edge.
| partial_visibility | If True, the layout will position elements at its bottom edge even if they are partially visible. |
Definition at line 101 of file GridVLayout.cpp.
{
_partial_visibility = partial_visibility;
}
| void nux::GridVLayout::ForceChildrenSize | ( | bool | force | ) |
Force the grid elements size.
Force the grid elements size to be the one provided by SetChildrenSize.
Definition at line 116 of file GridVLayout.cpp.
{
_force_children_size = force;
}
| Size nux::GridVLayout::GetChildrenSize | ( | ) | const |
Get the size of the grid element.
Definition at line 111 of file GridVLayout.cpp.
{
return _children_size;
}
| void nux::GridVLayout::ProcessDraw | ( | GraphicsEngine & | GfxContext, |
| bool | force_draw | ||
| ) | [virtual] |
Draw Element.
Draw all elements inside the layout. If force_draw is true then the system requests that all objects redraw themselves completely.
| force_draw | |
| TraverseInfo | |
| ProcessEventInfo |
Reimplemented from nux::Layout.
Definition at line 297 of file GridVLayout.cpp.
References nux::Area::GetAbsoluteGeometry(), nux::Area::GetGeometry(), nux::Area::GetToplevel(), nux::GraphicsEngine::PopModelViewMatrix(), nux::Layout::ProcessDraw(), and nux::GraphicsEngine::PushModelViewMatrix().
{
std::list<Area *> elements;
std::list<Area *>::iterator it = _layout_element_list.begin ();
GfxContext.PushModelViewMatrix (Get2DMatrix ());
for (it = _layout_element_list.begin (); it != _layout_element_list.end (); ++it)
{
if ((*it)->IsVisible ())
elements.push_back (*it);
}
it = elements.begin ();
Geometry base = GetGeometry ();
Geometry parent_geometry = GetAbsoluteGeometry ();
Geometry visibility_geometry = parent_geometry;
if (GetToplevel ())
{
parent_geometry = GetToplevel ()->GetAbsoluteGeometry ();
}
visibility_geometry = parent_geometry.Intersect (GetAbsoluteGeometry ());
GfxContext.PushClippingRectangle (base);
for (int i = 0; i < _num_column; i++)
{
for (int j = 0; j < _num_row; j++)
{
if (it == elements.end ())
break;
Geometry intersection = base.Intersect ((*it)->GetGeometry ());
// Test if the element is inside the Grid before rendering.
if (!visibility_geometry.IsNull ())
{
int X = base.x + m_h_out_margin + i * (_children_size.width + m_h_in_margin);
int Y = base.y + m_v_out_margin + j * (_children_size.height + m_v_in_margin);
GfxContext.PushClippingRectangle (Geometry (X, Y, _children_size.width, _children_size.height));
if ((*it)->IsView ())
{
View *ic = static_cast<View *>(*it);
ic->ProcessDraw (GfxContext, force_draw);
}
else if ((*it)->IsLayout ())
{
Layout *layout = static_cast<Layout *>(*it);
layout->ProcessDraw (GfxContext, force_draw);
}
GfxContext.PopClippingRectangle ();
}
it++;
}
}
GfxContext.PopClippingRectangle ();
GfxContext.PopModelViewMatrix ();
_queued_draw = false;
}
| void nux::GridVLayout::SetChildrenSize | ( | int | width, |
| int | height | ||
| ) |
Set the size of the grid element.
Set the size of the grid element.
| width | Width of elements. |
| height | Height of elements. |
Definition at line 106 of file GridVLayout.cpp.
{
_children_size = Size (width, height);
}
| void nux::GridVLayout::SetWidthMatchContent | ( | bool | match_content | ) |
Make the grid width match the size of its content.
| match_content | If True, force the width 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; |
Definition at line 131 of file GridVLayout.cpp.
{
_width_match_content = match_content;
}