nux-1.14.0
|
An horizontal grid layout. More...
#include <Nux/GridHLayout.h>
Public Member Functions | |
GridHLayout (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 | SetHeightMatchContent (bool match_content) |
Make the grid width match the size of its content. | |
bool | GetHeightMatchContent () 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 long | DoFocusUp (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) |
virtual long | DoFocusDown (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) |
virtual long | DoFocusLeft (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) |
virtual long | DoFocusRight (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) |
virtual Area * | KeyNavIteration (KeyNavDirection direction) |
An horizontal grid layout.
Fills the grid from left to right and going down.
Definition at line 34 of file GridHLayout.h.
void nux::GridHLayout::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 210 of file GridHLayout.cpp.
{ _partial_visibility = partial_visibility; }
void nux::GridHLayout::ForceChildrenSize | ( | bool | force | ) |
Force the grid elements size.
Force the grid elements size to be the one provided by SetChildrenSize.
Definition at line 225 of file GridHLayout.cpp.
{ _force_children_size = force; }
Size nux::GridHLayout::GetChildrenSize | ( | ) | const |
Get the size of the grid element.
Definition at line 220 of file GridHLayout.cpp.
{
return _children_size;
}
void nux::GridHLayout::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 419 of file GridHLayout.cpp.
References nux::Area::GetAbsoluteGeometry(), nux::Area::GetGeometry(), nux::Area::GetToplevel(), nux::GraphicsEngine::PopModelViewMatrix(), nux::Layout::ProcessDraw(), and nux::GraphicsEngine::PushModelViewMatrix().
{ if (_layout_element_list.size() == 0) return; std::list<Area *> elements; std::list<Area *>::iterator it = _layout_element_list.begin (); GfxContext.PushModelViewMatrix(Get2DMatrix()); Geometry base = GetGeometry(); Geometry absolute_geometry = GetAbsoluteGeometry(); Geometry parent_geometry = absolute_geometry; Geometry visibility_geometry = absolute_geometry; if (GetToplevel()) { parent_geometry = GetToplevel()->GetAbsoluteGeometry(); } visibility_geometry = parent_geometry.Intersect(absolute_geometry); GfxContext.PushClippingRectangle(base); it = _layout_element_list.begin(); bool first = false; bool last = false; for (int j = 0; j < _num_row; j++) { for (int i = 0; i < _num_column; i++) { if (it == _layout_element_list.end()) break; if ((*it)->IsVisible() == false) { ++it; continue; } Geometry it_geo = (*it)->GetAbsoluteGeometry(); Geometry intersection = visibility_geometry.Intersect(it_geo); // Test if the element is inside the Grid before rendering. if (!intersection.IsNull()) { if (first == false) { first = true; // First invisible child. } 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(); } else { if (first) { // First invisible child. Exit! last = true; } } if (first && last) { // Early exit break; } it++; } if (first && last) break; } GfxContext.PopClippingRectangle (); GfxContext.PopModelViewMatrix (); _queued_draw = false; }
void nux::GridHLayout::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 215 of file GridHLayout.cpp.
{ _children_size = Size (width, height); }
void nux::GridHLayout::SetHeightMatchContent | ( | bool | match_content | ) |
Make the grid width match the size of its content.
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; |
Definition at line 240 of file GridHLayout.cpp.
{ _height_match_content = match_content; }