nux-1.14.0
|
Public Member Functions | |
Layout (NUX_FILE_LINE_PROTO) | |
virtual void | AddLayout (Layout *, unsigned int stretchFactor=1, MinorDimensionPosition=eAbove, MinorDimensionSize extend=eFull, float percentage=100.0f, LayoutPosition=NUX_LAYOUT_END) |
virtual void | AddView (Area *baseobject, unsigned int stretchFactor=1, MinorDimensionPosition positioning=eAbove, MinorDimensionSize extend=eFull, float percentage=100.0f, LayoutPosition index=NUX_LAYOUT_END) |
Add an object to the layout. | |
virtual void | AddSpace (unsigned int width, unsigned int stretchFactor=0, LayoutPosition index=NUX_LAYOUT_END) |
virtual void | Clear () |
virtual unsigned int | GetMaxStretchFactor () |
unsigned int | GetMinStretchFactor () |
unsigned int | GetNumStretchFactor (unsigned int sf) |
int | GetContentWidth () const |
int | GetContentHeight () const |
int | GetHorizontalInternalMargin () const |
int | GetHorizontalExternalMargin () const |
void | SetHorizontalInternalMargin (int m) |
void | SetHorizontalExternalMargin (int m) |
int | GetVerticalInternalMargin () const |
int | GetVerticalExternalMargin () const |
void | SetVerticalInternalMargin (int m) |
void | SetVerticalExternalMargin (int m) |
virtual void | GetCompositeList (std::list< Area * > *ViewList) |
virtual void | Draw () |
void | DoneRedraw () |
bool | SearchInAllSubNodes (Area *bo) |
bool | SearchInFirstSubNodes (Area *bo) |
virtual long | ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) |
Area * | FindAreaUnderMouse (const Point &mouse_position, NuxEventType event_type) |
virtual void | ProcessDraw (GraphicsEngine &GfxContext, bool force_draw) |
Draw Element. | |
virtual void | QueueDraw () |
Mark all element in the layout as dirty. | |
bool | IsQueuedForDraw () |
Return true if a draw has been scheduled for this layout. | |
virtual void | SetContentDistribution (LayoutContentDistribution stacking_order) |
Define how elements are spread out inside the layout. | |
virtual LayoutContentDistribution | GetContentDistribution () |
virtual bool | FindWidget (Area *WidgetObject) const |
virtual bool | IsEmpty () const |
virtual void | RemoveChildObject (Area *) |
virtual void | RequestBottomUpLayoutComputation (Area *bo_initiator) |
Request a Layout recompute after a change of size. | |
std::list< Area * > & | GetChildren () |
virtual void | ChildViewQueuedDraw (View *view) |
virtual void | ChildLayoutQueuedDraw (Layout *layout) |
virtual void | ChildLayoutChildQueuedDraw (Area *area) |
virtual void | DoSetFocused (bool focused) |
virtual bool | DoGetFocused () |
virtual bool | DoCanFocus () |
virtual void | DoActivateFocus () |
bool | HasFocusableEntries () |
long | ProcessFocusEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) |
void | SetFocusControl (bool focus_control) |
bool | HasFocusControl () |
Public Attributes | |
sigc::signal< void, Layout * > | OnQueueDraw |
Signal emitted when a layout is scheduled for a draw. | |
sigc::signal< void, Area * > | OnChildQueueDraw |
sigc::signal< void, Layout *, Area * > | ViewAdded |
sigc::signal< void, Layout *, Area * > | ViewRemoved |
bool | _has_focus_control |
bool | _ignore_focus |
Protected Member Functions | |
Area * | GetFocusedChild () |
virtual long | DoFocusPrev (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) |
virtual long | DoFocusNext (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) |
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 bool | FocusFirstChild () |
virtual bool | FocusLastChild () |
virtual bool | FocusNextChild (Area *child) |
virtual bool | FocusPreviousChild (Area *child) |
void | OnChildFocusChanged (Area *child) |
virtual bool | AcceptKeyNavFocus () |
long | SendEventToArea (Area *area, IEvent &ievent, long TraverseInfo, long ProcessEventInfo) |
Protected Attributes | |
std::map< Area *, sigc::connection > | _connection_map |
bool | _queued_draw |
Size | m_ContentSize |
int | m_contentWidth |
int | m_contentHeight |
int | m_fittingWidth |
int | m_fittingHeight |
int | m_h_in_margin |
int | m_h_out_margin |
int | m_v_in_margin |
int | m_v_out_margin |
std::list< Area * > | _layout_element_list |
NString | m_name |
LayoutContentDistribution | m_ContentStacking |
void nux::Layout::AddView | ( | Area * | bo, |
unsigned int | stretchFactor = 1 , |
||
MinorDimensionPosition | minor_position = eAbove , |
||
MinorDimensionSize | minor_size = eFull , |
||
float | percentage = 100.0f , |
||
LayoutPosition | index = NUX_LAYOUT_END |
||
) | [virtual] |
Add an object to the layout.
Add an object to the layout. A baseobject minor dimension with respect to a layout object is the dimension opposite to the layout flow. A baseobject major dimension with respect to a layout object is the dimension aligned with the layout flow. A layout object minor dimension is the dimension opposite to the layout flow. A layout object major dimension is the dimension aligned with the layout flow.
Add an object to the layout. The added object get its size and position managed by the layout. When a baseobject is added with a stretches factor equal to 0, its major dimension assumes its minimum value. For instance, if the layout is a vertical layout and the added object has a stretch factor equal 0, then during the layout, the added object height will be set to its minimum value using ApplyMinHeight().
The positioning parameter controls how the layout will place the object within itself. A vertical layout object controls the horizontal positioning of its children baseobject, While an horizontal layout object controls the vertical positioning of its children baseobject.
The extend parameter controls how much size the baseobject minor dimension gets from the layout minor dimension. See MinorDimensionSize.
/param baseobject The object that is being added. /param stretchFactor This value controls how the layout object share space between its children baseobject. /param positioning Controls how the layout position the object. /param extend Controls the object minor dimension size. /param percentage Controls the object minor dimension size in percentage of the layout minor dimension size. /param index Controls the object position in the layout.
Add an object to the layout. A baseobject minor dimension with respect to a layout object is the dimension opposite to the layout flow. A baseobject major dimension with respect to a layout object is the dimension aligned with the layout flow. A layout object minor dimension is the dimension opposite to the layout flow. A layout object major dimension is the dimension aligned with the layout flow.
Add an object to the layout. The added object get its size and position managed by the layout. When a baseobject is added with a stretches factor equal to 0, its major dimension assumes its minimum value. For instance, if the layout is a vertical layout and the added object has a stretch factor equal 0, then during the layout, the added object height will be set to its minimum value using ApplyMinHeight().
The minor_position parameter controls how the layout will place the object within itself. A vertical layout object controls the horizontal positioning of its children baseobjects, While an horizontal layout object controls the vertical positioning of its children baseobjects.
The minor_size parameter controls how much size the baseobject minor dimension gets from the layout minor dimension. See MinorDimensionSize.
/param baseobject The object that is being added. /param stretchFactor This value controls how the layout object share space between its children baseobject. /param minor_position Controls how the layout position the object. /param minor_size Controls the object minor dimension size. /param percentage Controls the object minor dimension size in percentage of the layout minor dimension size. /param index Controls the object position in the layout children.
Reimplemented in nux::SpaceLayout.
Definition at line 236 of file Layout.cpp.
References nux::Area::SetParentObject().
Referenced by nux::LayeredLayout::AddLayer(), and nux::TableCtrl::TableCtrl().
{ nuxAssertMsg (bo != 0, TEXT ("[Layout::AddView] Invalid parameter.") ); NUX_RETURN_IF_TRUE (bo == 0); Area *parent = bo->GetParentObject(); nuxAssertMsg (parent == 0, TEXT ("[Layout::AddView] Trying to add an object that already has a parent.") ); NUX_RETURN_IF_TRUE (parent != 0); nuxAssertMsg (index >= 0, TEXT ("[Layout::AddView] Invalid index position. Adding at the beginning of the list..") ); bo->SetStretchFactor (stretchFactor); bo->SetPositioning (minor_position); bo->SetExtend (minor_size); if (percentage < 1.0f) { bo->SetPercentage (1.0f); } else if (percentage > 100.0f) { bo->SetPercentage (100.0f); } else { bo->SetPercentage (percentage); } bo->SetParentObject (this); if (bo->IsView ()) static_cast<View *> (bo)->OnQueueDraw.connect (sigc::mem_fun (this, &Layout::ChildViewQueuedDraw)); //if (HasFocusControl () && HasFocusableEntries () == false) //{ //bo->SetFocused (true); //ChildFocusChanged (this, bo); //} if (index < 0) index = NUX_LAYOUT_BEGIN; if (index == NUX_LAYOUT_END || index >= _layout_element_list.size()) { _layout_element_list.push_back (bo); } else { #if defined(NUX_OS_WINDOWS) && !defined(NUX_VISUAL_STUDIO_2010) std::list<Area *>::iterator pos = _layout_element_list.begin(); #else auto pos = _layout_element_list.begin(); #endif int idx = index; while (pos != _layout_element_list.end() && idx > 0) { idx--; pos++; } _layout_element_list.insert(pos, bo); } _connection_map[bo] = bo->ChildFocusChanged.connect (sigc::mem_fun (this, &Layout::OnChildFocusChanged)); ViewAdded.emit (this, bo); //--->> Removed because it cause problem with The splitter widget: ComputeLayout2(); }
Area * nux::Layout::FindAreaUnderMouse | ( | const Point & | mouse_position, |
NuxEventType | event_type | ||
) | [virtual] |
Return the area under the mouse pointer.
Reimplemented from nux::Area.
Reimplemented in nux::LayeredLayout.
Definition at line 752 of file Layout.cpp.
References nux::Area::FindAreaUnderMouse(), and nux::Area::TestMousePointerInclusionFilterMouseWheel().
Referenced by nux::View::FindAreaUnderMouse(), nux::TabView::FindAreaUnderMouse(), nux::FloatingWindow::FindAreaUnderMouse(), nux::BaseWindow::FindAreaUnderMouse(), and TilesView::FindAreaUnderMouse().
{ bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type); if(mouse_inside == false) return NULL; std::list<Area *>::iterator it; for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++) { if ((*it)->IsVisible() && (*it)->IsSensitive()) { Area* hit_view = NUX_STATIC_CAST(Area*, (*it)->FindAreaUnderMouse(mouse_position, event_type)); if(hit_view) return hit_view; } } return NULL; }
bool nux::Layout::IsQueuedForDraw | ( | ) |
Return true if a draw has been scheduled for this layout.
Definition at line 838 of file Layout.cpp.
{
return _queued_draw;
}
void nux::Layout::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 in nux::GridHLayout, nux::GridVLayout, and nux::LayeredLayout.
Definition at line 773 of file Layout.cpp.
References nux::Area::GetGeometry(), nux::InputArea::OnDraw(), nux::GraphicsEngine::PopModelViewMatrix(), ProcessDraw(), and nux::GraphicsEngine::PushModelViewMatrix().
Referenced by ProcessDraw(), nux::GridVLayout::ProcessDraw(), and nux::GridHLayout::ProcessDraw().
{ std::list<Area *>::iterator it; GfxContext.PushModelViewMatrix (Get2DMatrix ()); GfxContext.PushClippingRectangle (GetGeometry ()); for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++) { if (!(*it)->IsVisible ()) continue; if ((*it)->IsView ()) { View *ic = NUX_STATIC_CAST (View*, (*it)); ic->ProcessDraw (GfxContext, force_draw); } else if ((*it)->IsLayout ()) { Layout *layout = NUX_STATIC_CAST (Layout*, (*it)); layout->ProcessDraw (GfxContext, force_draw); } // InputArea should be tested last else if ((*it)->IsInputArea ()) { InputArea *input_area = NUX_STATIC_CAST (InputArea*, (*it)); input_area->OnDraw (GfxContext, force_draw); } } GfxContext.PopClippingRectangle (); GfxContext.PopModelViewMatrix (); //GfxContext.PopClipOffset (); _queued_draw = false; }
void nux::Layout::QueueDraw | ( | ) | [virtual] |
Mark all element in the layout as dirty.
Mark all element in the layout as dirty. This will also mark all sub elements as dirty. InputArea element are not marked as dirty (they don't have the flags). Emits the signal OnQueueDraw.
Definition at line 810 of file Layout.cpp.
References OnQueueDraw, QueueDraw(), and nux::View::QueueDraw().
Referenced by nux::LayeredLayout::AddLayer(), nux::WindowThread::ComputeElementLayout(), nux::View::QueueDraw(), QueueDraw(), nux::LayeredLayout::SetActiveLayerN(), nux::LayeredLayout::SetPaintAll(), and nux::LayeredLayout::UpdateLayer().
{ if (_queued_draw) { // A draw has already been scheduled. return; } std::list<Area *>::iterator it; for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++) { if ((*it)->IsView ()) { View *ic = NUX_STATIC_CAST (View *, (*it)); ic->QueueDraw (); } else if ((*it)->IsLayout ()) { Layout *layout = NUX_STATIC_CAST (Layout *, (*it)); layout->QueueDraw (); } } _queued_draw = true; OnQueueDraw.emit (this); }
void nux::Layout::SetContentDistribution | ( | LayoutContentDistribution | stacking_order | ) | [virtual] |
Define how elements are spread out inside the layout.
Typically, a layout stacks it elements from left to right (HLayout) or top to bottom (VLayout). When the elements don't uses all the space that is available, the content stacking policy allows alternatives ways to position the elements. This does not affect the elements size, only their position inside the layout.
stacking_order |
Definition at line 843 of file Layout.cpp.
Referenced by nux::TableCtrl::TableCtrl().
{ m_ContentStacking = stacking; }