nux-1.16.0
|
Classes | |
class | LayoutProperties |
Public Member Functions | |
Area (NUX_FILE_LINE_DECL) | |
int | GetBaseX () const |
int | GetBaseY () const |
int | GetBaseWidth () const |
int | GetBaseHeight () const |
void | SetBaseX (int x) |
void | SetBaseY (int y) |
void | SetBaseXY (int x, int y) |
void | SetBaseWidth (int w) |
void | SetBaseHeight (int h) |
void | SetBaseSize (int w, int h) |
Set the size of the object. | |
void | SetMinimumSize (int w, int h) |
void | SetMaximumSize (int w, int h) |
void | SetMinMaxSize (int w, int h) |
void | SetMinimumWidth (int w) |
void | SetMaximumWidth (int w) |
void | SetMinimumHeight (int h) |
void | SetMaximumHeight (int h) |
int | GetMinimumWidth () const |
int | GetMaximumWidth () const |
int | GetMinimumHeight () const |
int | GetMaximumHeight () const |
void | ApplyMinWidth () |
void | ApplyMinHeight () |
void | ApplyMaxWidth () |
void | ApplyMaxHeight () |
Size | GetMinimumSize () const |
Size | GetMaximumSize () const |
Geometry const & | GetGeometry () const |
Get the geometry of the object. | |
void | SetGeometry (int x, int y, int w, int h) |
Set the geometry of the object. | |
void | SetGeometry (const Geometry &geo) |
Set the geometry of the object. | |
void | IncreaseSize (int x, int y) |
void | SetBaseString (const TCHAR *Caption) |
const NString & | GetBaseString () const |
Area * | GetToplevel () |
Return the Top level parent of this area. | |
Area * | GetTopLevelViewWindow () |
Return the Top level BaseWindow of this area. | |
bool | HasTopLevelParent () |
Return true is this area has a top level parent. | |
bool | IsChildOf (Area *parent) |
Return true is area is a child of the given parent in the widget tree. | |
bool | TestMousePointerInclusion (const Point &mouse_position, NuxEventType event_type) |
bool | TestMousePointerInclusionFilterMouseWheel (const Point &mouse_position, NuxEventType event) |
virtual long | ComputeChildLayout () |
virtual void | PositionChildLayout (float offsetX, float offsetY) |
virtual long | ComputeLayout2 () |
virtual void | ComputePosition2 (float offsetX, float offsetY) |
virtual bool | IsArea () const |
virtual bool | IsInputArea () const |
virtual bool | IsView () const |
virtual bool | IsLayout () const |
virtual bool | IsSpaceLayout () const |
virtual bool | IsViewWindow () const |
void | SetLayoutProperties (LayoutProperties *properties) |
Set the layout properties for this area. | |
LayoutProperties * | GetLayoutProperties () |
Get the layout properties for this area. | |
Area * | GetParentObject () const |
void | SetVisible (bool visible) |
Set visibility of the area. | |
bool | IsVisible () |
Get the visibility of the area. | |
void | SetSensitive (bool sensitive) |
Set sensitivity of the area. | |
bool | IsSensitive () |
Get whether the area is sensitive. | |
virtual bool | DoGetFocused () |
virtual void | DoSetFocused (bool focused) |
virtual bool | DoCanFocus () |
virtual void | DoActivateFocus () |
void | QueueRelayout () |
Queue a relayout. | |
virtual unsigned int | GetStretchFactor () |
virtual void | SetStretchFactor (unsigned int sf) |
virtual MinorDimensionPosition | GetPositioning () |
virtual void | SetPositioning (MinorDimensionPosition p) |
virtual MinorDimensionSize | GetExtend () |
virtual void | SetExtend (MinorDimensionSize ext) |
virtual float | GetPercentage () |
virtual void | SetPercentage (float f) |
virtual bool | IsLayoutDone () |
virtual void | SetLayoutDone (bool b) |
void | Set2DMatrix (const Matrix4 &mat) |
void | Set2DTranslation (float tx, float ty, float tz) |
Matrix4 | Get2DMatrix () const |
Matrix4 | Get3DMatrix () const |
bool | Is3DArea () const |
virtual Geometry | GetAbsoluteGeometry () const |
Return the position of this object with regard to its top left corner of the physical window. | |
int | GetAbsoluteX () const |
Return the area absolute x coordinate. | |
int | GetAbsoluteY () const |
Return the area absolute y coordinate. | |
int | GetAbsoluteWidth () const |
Return the area absolute width. | |
int | GetAbsoluteHeight () const |
Return the area absolute height. | |
virtual Geometry | GetRootGeometry () const |
Return the position of this object with regard to its top level parent (the main layout or a BaseWindow). | |
int | GetRootX () const |
Return the area root x coordinate. | |
int | GetRootY () const |
Return the area root y coordinate. | |
int | GetRootWidth () const |
Return the area root width. | |
int | GetRootHeight () const |
Return the area root height. | |
virtual void | SetParentObject (Area *) |
virtual void | UnParentObject () |
Un-parent and area. | |
virtual Area * | FindAreaUnderMouse (const Point &mouse_position, NuxEventType event_type) |
virtual Area * | FindKeyFocusArea (unsigned int key_symbol, unsigned long x11_key_code, unsigned long special_keys_state) |
void | SetPathToKeyFocusArea () |
void | ResetDownwardPathToKeyFocusArea () |
void | ResetUpwardPathToKeyFocusArea () |
virtual bool | InspectKeyEvent (unsigned int eventType, unsigned int keysym, const char *character) |
Return True if the the area knows what to do with the key event. | |
virtual bool | AcceptKeyNavFocus () |
virtual Area * | KeyNavIteration (KeyNavDirection direction) |
bool | HasKeyFocus () const |
void | SetReconfigureParentLayoutOnGeometryChange (bool reconfigure_parent_layout) |
Set to True to initiate a layout reconfiguration when the geometry of this widget changes. | |
bool | ReconfigureParentLayoutOnGeometryChange () |
Return True if the the parent layouts of this area should be reconfigured on geometry changed. | |
void | SetAcceptKeyboardEvent (bool accept_key_event) |
Enable keyboard event processing. | |
bool | AcceptKeyboardEvent () const |
Return true if the Area is interested in keyboard events. | |
void | SetAcceptMouseWheelEvent (bool accept_mouse_wheel_event) |
Enable mouse wheel event processing. | |
bool | AcceptMouseWheelEvent () const |
Return true if the area is accepts mouse wheel events. | |
Public Attributes | |
sigc::signal< void, Area * > | FocusActivated |
sigc::signal< void, Area * > | FocusChanged |
sigc::signal< void, Area * > | ChildFocusChanged |
sigc::signal< void, Area * > | OnKeyNavChangeReconfigure |
sigc::signal< void, Area * > | OnKeyNavFocusChange |
sigc::signal< void, Area * > | OnKeyNavFocusActivate |
sigc::signal< void, int, int, int, int > | OnResize |
Signal emitted when an area is resized. | |
sigc::signal< void, Area *, bool > | OnVisibleChanged |
sigc::signal< void, Area *, bool > | OnSensitiveChanged |
sigc::signal< void, Area *, Geometry & > | OnGeometryChanged |
Protected Member Functions | |
virtual void | GeometryChangePending () |
virtual void | GeometryChanged () |
virtual void | RequestBottomUpLayoutComputation (Area *bo_initiator) |
Request a Layout recompute after a change of size. | |
void | InnerGetAbsoluteGeometry (Geometry &geometry) |
Return the absolute geometry starting with a relative geometry passed as argument. | |
void | InnerGetRootGeometry (Geometry &geometry) |
Return the absolute geometry starting with a relative geometry passed as argument. | |
Protected Attributes | |
bool | _is_focused |
bool | _on_geometry_changeg_reconfigure_parent_layout |
bool | has_key_focus_ |
Area * | next_object_to_key_focus_area_ |
Friends | |
class | Layout |
class | View |
class | WindowThread |
class | HSplitter |
class | VSplitter |
class | WindowCompositor |
bool nux::Area::AcceptKeyboardEvent | ( | ) | const |
bool nux::Area::AcceptMouseWheelEvent | ( | ) | const |
Return true if the area is accepts mouse wheel events.
Definition at line 883 of file Area.cpp.
Referenced by nux::VSplitter::FindAreaUnderMouse(), nux::VScrollBar::FindAreaUnderMouse(), nux::View::FindAreaUnderMouse(), nux::MenuPage::FindAreaUnderMouse(), nux::HSplitter::FindAreaUnderMouse(), nux::HScrollBar::FindAreaUnderMouse(), nux::FloatingWindow::FindAreaUnderMouse(), nux::ComboBoxSimple::FindAreaUnderMouse(), nux::BaseWindow::FindAreaUnderMouse(), and TilesView::FindAreaUnderMouse().
{
return _accept_mouse_wheel_event;
}
Area * nux::Area::FindAreaUnderMouse | ( | const Point & | mouse_position, |
NuxEventType | event_type | ||
) | [virtual] |
Return the area under the mouse pointer.
Reimplemented in TilesView, nux::BaseWindow, nux::ComboBoxSimple, nux::FloatingWindow, nux::HScrollBar, nux::HSplitter, nux::InputArea, nux::LayeredLayout, nux::Layout, nux::Matrix4Editor, nux::MenuPage, nux::ScrollView, nux::TabView, nux::TextEntry, nux::View, nux::VScrollBar, and nux::VSplitter.
Definition at line 928 of file Area.cpp.
Referenced by nux::VSplitter::FindAreaUnderMouse(), nux::Layout::FindAreaUnderMouse(), nux::LayeredLayout::FindAreaUnderMouse(), and nux::HSplitter::FindAreaUnderMouse().
{
return NULL;
}
Geometry nux::Area::GetAbsoluteGeometry | ( | ) | const [virtual] |
Return the position of this object with regard to its top left corner of the physical window.
Return the position of the Area inside the physical window. For the main layout set in WindowThread, The following functions are equivalent:
Reimplemented in nux::MenuPage.
Definition at line 698 of file Area.cpp.
References InnerGetAbsoluteGeometry().
Referenced by GetAbsoluteHeight(), GetAbsoluteWidth(), GetAbsoluteX(), GetAbsoluteY(), nux::GridVLayout::ProcessDraw(), nux::GridHLayout::ProcessDraw(), TestMousePointerInclusion(), and TestMousePointerInclusionFilterMouseWheel().
{ if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || Type().IsDerivedFromType(MenuPage::StaticObjectType) || (this == GetWindowThread()->GetMainLayout())) { // Do not apply the _2D_xform matrix to a BaseWindow or the main layout return _geometry; } else { nux::Geometry geo = _geometry; MatrixXFormGeometry (_2d_xform, geo); Area *parent = GetParentObject (); if (parent) parent->InnerGetAbsoluteGeometry (geo); return geo; } }
int nux::Area::GetAbsoluteHeight | ( | ) | const |
Return the area absolute height.
As long as _2d_xform contains only translations, the absolute height is the same as value returned by GetBaseHeight ();
Definition at line 735 of file Area.cpp.
References GetAbsoluteGeometry().
{ return GetAbsoluteGeometry ().height; }
int nux::Area::GetAbsoluteWidth | ( | ) | const |
Return the area absolute width.
As long as _2d_xform contains only translations, the absolute width is the same as value returned by GetBaseWidth ();
Definition at line 730 of file Area.cpp.
References GetAbsoluteGeometry().
{ return GetAbsoluteGeometry ().width; }
Geometry const & nux::Area::GetGeometry | ( | ) | const |
Get the geometry of the object.
Definition at line 346 of file Area.cpp.
Referenced by nux::TableCtrl::DrawContent(), nux::TableCtrl::DrawHeader(), nux::MenuPage::GetAbsoluteGeometry(), nux::MenuPage::GetRootGeometry(), nux::FloatingWindow::LayoutWindowElements(), nux::BaseWindow::LayoutWindowElements(), nux::BaseWindow::NotifyConfigurationChange(), nux::Layout::ProcessDraw(), nux::LayeredLayout::ProcessDraw(), nux::GridVLayout::ProcessDraw(), nux::GridHLayout::ProcessDraw(), nux::MenuPage::SetGeometry(), nux::BaseWindow::SetLayout(), nux::MenuPage::StartMenu(), and nux::WindowCompositor::ValidateMouseInsideTooltipArea().
{
return _geometry;
}
Area::LayoutProperties * nux::Area::GetLayoutProperties | ( | ) |
Get the layout properties for this area.
Retrieves the LayoutProperties sub-class with this area. See SetLayoutProperties
Definition at line 544 of file Area.cpp.
Referenced by nux::LayeredLayout::RemoveLayer(), and nux::LayeredLayout::UpdateLayer().
{
return _layout_properties;
}
Geometry nux::Area::GetRootGeometry | ( | ) | const [virtual] |
Return the position of this object with regard to its top level parent (the main layout or a BaseWindow).
Return the position of the Area inside the physical window. For the main layout set in WindowThread or for a BaseWindow, GetRootGeometry () is equivalent to GetGeometry ().
Reimplemented in nux::MenuPage.
Definition at line 752 of file Area.cpp.
References InnerGetRootGeometry().
Referenced by GetRootHeight(), GetRootWidth(), GetRootX(), and GetRootY().
{ nux::Geometry geo = _geometry; MatrixXFormGeometry (_2d_xform, geo); if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == GetWindowThread()->GetMainLayout())) { return geo; } else { Area *parent = GetParentObject (); if (parent) parent->InnerGetRootGeometry (geo); return geo; } }
int nux::Area::GetRootHeight | ( | ) | const |
Return the area root height.
As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth ();
Definition at line 786 of file Area.cpp.
References GetRootGeometry().
{ return GetRootGeometry ().height; }
int nux::Area::GetRootWidth | ( | ) | const |
Return the area root width.
As long as _2d_xform contains only translations, the root width is the same as value returned by GetBaseWidth ();
Definition at line 781 of file Area.cpp.
References GetRootGeometry().
{ return GetRootGeometry ().width; }
Area * nux::Area::GetToplevel | ( | ) |
Return the Top level parent of this area.
The top Level parent is either a BaseWindow or the main layout.
Definition at line 791 of file Area.cpp.
References GetToplevel().
Referenced by GetToplevel(), GetTopLevelViewWindow(), HasTopLevelParent(), nux::GridVLayout::ProcessDraw(), and nux::GridHLayout::ProcessDraw().
{ if (Type ().IsDerivedFromType (BaseWindow::StaticObjectType) || (this == GetWindowThread ()->GetMainLayout ())) { return this; } Area* parent = GetParentObject (); if (!parent) //we didn't find a way to salvation! { return 0; } return parent->GetToplevel (); }
Area * nux::Area::GetTopLevelViewWindow | ( | ) |
Return the Top level BaseWindow of this area.
Definition at line 806 of file Area.cpp.
References GetToplevel().
{ Area* area = GetToplevel (); if (area && area->IsViewWindow ()) return area; return NULL; }
bool nux::Area::HasTopLevelParent | ( | ) |
Return true is this area has a top level parent.
Definition at line 816 of file Area.cpp.
References GetToplevel().
{ if (GetToplevel ()) { return true; } return false; }
bool nux::Area::IsChildOf | ( | Area * | parent | ) |
Return true is area is a child of the given parent in the widget tree.
parent | Area to test if it is a parent of this area. |
Definition at line 825 of file Area.cpp.
References IsChildOf().
Referenced by IsChildOf().
{ if (this == parent) return true; if (!parent || !_parent_area) return false; return _parent_area->IsChildOf(parent); }
bool nux::Area::IsSensitive | ( | ) |
Get whether the area is sensitive.
Gets whether the area is sensitive to input events
Definition at line 574 of file Area.cpp.
Referenced by nux::LayeredLayout::FindAreaUnderMouse().
{
return _sensitive;
}
bool nux::Area::IsVisible | ( | ) |
Get the visibility of the area.
Gets whether the area is visible to the user and will be visible to the user. Default is true.
Definition at line 559 of file Area.cpp.
Referenced by nux::LayeredLayout::FindAreaUnderMouse(), and nux::LayeredLayout::ProcessDraw().
{
return _visible;
}
void nux::Area::QueueRelayout | ( | ) |
Queue a relayout.
Queues a relayout before the next paint cycle. This is safe to call multiple times within a cycle.
Definition at line 863 of file Area.cpp.
References nux::WindowThread::QueueObjectLayout().
{
nux::GetWindowThread ()->QueueObjectLayout (this);
}
bool nux::Area::ReconfigureParentLayoutOnGeometryChange | ( | ) |
Return True if the the parent layouts of this area should be reconfigured on geometry changed.
Definition at line 412 of file Area.cpp.
References _on_geometry_changeg_reconfigure_parent_layout.
{ return _on_geometry_changeg_reconfigure_parent_layout; }
void nux::Area::SetAcceptKeyboardEvent | ( | bool | accept_key_event | ) |
void nux::Area::SetAcceptMouseWheelEvent | ( | bool | accept_mouse_wheel_event | ) |
void nux::Area::SetGeometry | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Set the geometry of the object.
Set the width, height, and x, y position of the object on the screen.
x | Horizontal position. |
y | Vertical position. |
w | Width. |
h | Height. |
Definition at line 324 of file Area.cpp.
Referenced by nux::FloatingWindow::LayoutWindowElements(), nux::WindowThread::ReconfigureLayout(), SetBaseSize(), SetGeometry(), nux::WindowThread::SetLayout(), nux::BaseWindow::SetLayout(), and nux::TableCtrl::TableCtrl().
{ h = nux::Clamp<int> (h, _min_size.height, _max_size.height); w = nux::Clamp<int> (w, _min_size.width, _max_size.width); nux::Geometry geometry(x, y, w, h); if (_geometry == geometry) return; GeometryChangePending(); _geometry = geometry; ReconfigureParentLayout(); GeometryChanged(); OnGeometryChanged.emit(this, _geometry); }
void nux::Area::SetGeometry | ( | const Geometry & | geo | ) |
Set the geometry of the object.
This is an overloaded member function, provided for convenience. It behaves essentially like SetGeometry(int x, int y, int w, int h).
geo | Geometry object. |
Reimplemented in nux::BaseWindow, nux::MenuPage, nux::MouseAreaCtrl, nux::ScrollView, nux::StaticTextBox, nux::TableCtrl, and nux::View.
Definition at line 341 of file Area.cpp.
References SetGeometry().
{ SetGeometry (geo.x, geo.y, geo.width, geo.height); }
void nux::Area::SetLayoutProperties | ( | LayoutProperties * | properties | ) |
Set the layout properties for this area.
Allows the Layout managing this area to store the properties specifc to this area. Layouts should create a sub-class of LayoutProperties. The LayoutProperties of an area will be deleted upon destruction.
properties | the LayoutProperties sub-class associated with this area. Can be NULL to unset. |
Definition at line 536 of file Area.cpp.
Referenced by nux::LayeredLayout::AddLayer(), and nux::LayeredLayout::RemoveLayer().
{ if (_layout_properties) delete _layout_properties; _layout_properties = properties; }
void nux::Area::SetParentObject | ( | Area * | bo | ) | [virtual] |
SetParentObject/UnParentObject are protected API. it is not meant to be used directly by users. Users add widgets to layouts and layout have to be attached to a composition for objects to be rendered. Setting a parent to and child widget does not mean that when the parent is rendered, the child is also rendered. For instance, setting a button the be the child of a check-box means absolutely nothing is terms of rendering. A widget with a parent cannot be added to a added to a layout for rendering. The widget has to be un-parented first. A layout with a parent cannot be added to a widget or another layout for rendering. The layout has to be un-parented first. In essence only View and Layouts should be calling SetParentObject/UnParentObject.
Definition at line 272 of file Area.cpp.
References nux::Object::Reference().
Referenced by nux::Layout::AddView(), nux::View::SetLayout(), and nux::ScrollView::SetVScrollBar().
{ if (bo == 0) { nuxAssertMsg (0, TEXT ("[Area::SetParentObject] Invalid parent obejct.") ); return; } if (_parent_area) { nuxAssertMsg (0, TEXT ("[Area::SetParentObject] Object already has a parent. You must UnParent the object before you can parenting again.") ); return; } _parent_area = bo; Reference(); }
void nux::Area::SetReconfigureParentLayoutOnGeometryChange | ( | bool | reconfigure_parent_layout | ) |
Set to True to initiate a layout reconfiguration when the geometry of this widget changes.
When the geometry of an area changes, the new geometry can be recursively propagated to all its parent so a layout reconfiguration is initiated.
reconfigure_parent_layout | Set it to True to reconfigure this area parent layouts. |
Definition at line 407 of file Area.cpp.
References _on_geometry_changeg_reconfigure_parent_layout.
Referenced by nux::ScrollView::SetVScrollBar().
{ _on_geometry_changeg_reconfigure_parent_layout = reconfigure_parent_layout; }
void nux::Area::SetSensitive | ( | bool | sensitive | ) |
void nux::Area::SetVisible | ( | bool | visible | ) |
bool nux::Area::TestMousePointerInclusion | ( | const Point & | mouse_position, |
NuxEventType | event_type | ||
) |
Test if a point is inside the area.
p | A 2D point. |
event_type | The type of mouse event (a parameter of FindAreaUnderMouse). |
Definition at line 888 of file Area.cpp.
References GetAbsoluteGeometry().
Referenced by nux::VScrollBar::FindAreaUnderMouse(), nux::TabView::FindAreaUnderMouse(), nux::InputArea::FindAreaUnderMouse(), nux::HScrollBar::FindAreaUnderMouse(), nux::FloatingWindow::FindAreaUnderMouse(), and nux::ComboBoxSimple::FindAreaUnderMouse().
{ bool mouse_pointer_inside_area = false; if (Type().IsDerivedFromType(MenuPage::StaticObjectType)) { // A MenuPage geometry is already in absolute coordinates. mouse_pointer_inside_area = _geometry.IsInside(mouse_position); } else { mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position); } if ((event_type == NUX_MOUSE_WHEEL) && mouse_pointer_inside_area) { if (_accept_mouse_wheel_event == false) return NULL; } return mouse_pointer_inside_area; }
bool nux::Area::TestMousePointerInclusionFilterMouseWheel | ( | const Point & | mouse_position, |
NuxEventType | event | ||
) |
Test if a point is inside the area and if the area accepts mouse wheel events.
p | A 2D point. |
event_type | The type of mouse event (a parameter of FindAreaUnderMouse). |
filter_mouse_wheel_event | If the event type is NUX_MOUSE_WHEEL and the mouse is over this area and this area does not accept mouse wheel events, then return false. |
Definition at line 911 of file Area.cpp.
References GetAbsoluteGeometry().
Referenced by nux::VSplitter::FindAreaUnderMouse(), nux::VScrollBar::FindAreaUnderMouse(), nux::View::FindAreaUnderMouse(), nux::TabView::FindAreaUnderMouse(), nux::ScrollView::FindAreaUnderMouse(), nux::MenuPage::FindAreaUnderMouse(), nux::Layout::FindAreaUnderMouse(), nux::LayeredLayout::FindAreaUnderMouse(), nux::HSplitter::FindAreaUnderMouse(), nux::HScrollBar::FindAreaUnderMouse(), nux::FloatingWindow::FindAreaUnderMouse(), nux::ComboBoxSimple::FindAreaUnderMouse(), nux::BaseWindow::FindAreaUnderMouse(), and TilesView::FindAreaUnderMouse().
{ bool mouse_pointer_inside_area = false; if (Type().IsDerivedFromType(MenuPage::StaticObjectType)) { // A MenuPage geometry is already in absolute coordinates. mouse_pointer_inside_area = _geometry.IsInside(mouse_position); } else { mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position); } return mouse_pointer_inside_area; }
void nux::Area::UnParentObject | ( | ) | [virtual] |
Un-parent and area.
For un-parented areas the following functions are equivalent:
Definition at line 290 of file Area.cpp.
References nux::Object::UnReference().
Referenced by nux::View::SetLayout().
{ if (_parent_area) { _parent_area = 0; UnReference(); } }
bool nux::Area::_on_geometry_changeg_reconfigure_parent_layout [protected] |
Definition at line 560 of file Area.h.
Referenced by ReconfigureParentLayoutOnGeometryChange(), and SetReconfigureParentLayoutOnGeometryChange().
sigc::signal<void, Area*> nux::Area::OnKeyNavChangeReconfigure |