LayoutView_t Class Reference

View object, which manages the display of a rectangular area in a window. More...

#include <UTLayoutView.h>

Inheritance diagram for LayoutView_t:
View_t Task_t LinkedListNode_t< View_t > Drawable_t BTreeNode_t< Task_t, Task_t * >

List of all members.

Public Member Functions

 LayoutView_t ()
virtual ~LayoutView_t ()
void AddChild (View_t *child, int grid_left, float left_min_spacing, int grid_top, float top_min_spacing, int grid_right, float right_min_spacing, int grid_bottom, float bottom_min_spacing, layout_h_align_mode_t h_align_mode=eLHAM_center, layout_v_align_mode_t v_align_mode=eLVAM_center)
virtual void AddChild (View_t *child)
virtual View_tRemoveChild (View_t *child)
void SetAbsoluteMinMaxSizeBehavior (float absolute_min_width, bool max_width_from_children, float absolute_max_width, float absolute_min_height, bool max_height_from_children, float absolute_max_height)
void SetDefaultRowWeight (float row_weight)
void SetDefaultColumnWeight (float column_weight)
void SetRowWeight (int row_index, float row_weight)
void SetColumnWeight (int column_index, float column_weight)
void RemoveRowWeight (int row_index)
void RemoveColumnWeight (int row_index)
row_column_set_token_t SetRowsUseSameMinHeight (int first_row_index,...)
row_column_set_token_t SetRowsUseSameMinHeight (const int *row_indices, int num_row_indices)
row_column_set_token_t SetColumnsUseSameMinWidth (int first_column_index,...)
row_column_set_token_t SetColumnsUseSameMinWidth (const int *column_indices, int num_column_indices)
void RemoveRowsUseSameMinHeight (int first_row_index,...)
void RemoveColumnsUseSameMinWidth (int first_column_index,...)
void RemoveRowsUseSameMinHeight (row_column_set_token_t token)
void RemoveColumnsUseSameMinWidth (row_column_set_token_t token)
int CountRows () const
float RowHeight (int index) const
float RowTop (int index) const
int CountColumns () const
float ColumnWidth (int index) const
float ColumnLeft (int index) const

Protected Member Functions

virtual void LBoundsChanged (const Rect_t &old_lbounds, const Rect_t &new_lbounds)
virtual void ChildMinMaxSizeChanged (View_t *child)

Detailed Description

Non-core library: UTgui

A view object which serves as a generic grid for the layout of child views. This is also a task, so messages can be sent to it asynchronously. When created, it will automatically add itself as a task in the application's message loop.

Definition at line 104 of file UTLayoutView.h.


Constructor & Destructor Documentation

LayoutView_t::LayoutView_t (  ) 

Layout view constructor. After construction, a view can be added to a window if it is the root view, or as a child of another view.

virtual LayoutView_t::~LayoutView_t (  )  [virtual]

Layout view destructor.


Member Function Documentation

void LayoutView_t::AddChild ( View_t child,
int  grid_left,
float  left_min_spacing,
int  grid_top,
float  top_min_spacing,
int  grid_right,
float  right_min_spacing,
int  grid_bottom,
float  bottom_min_spacing,
layout_h_align_mode_t  h_align_mode = eLHAM_center,
layout_v_align_mode_t  v_align_mode = eLVAM_center 
)

Adds a child view to the grid. The grid starts with a row index of zero on the left or top. A grid_right, or grid_bottom value of -1 indicates to extend to the maximum of the grid as dictated by all other views in other rows or columns.

Once the grid has been established, each row or column in the grid will be assigned the minimum width required for all views.

Grid rows and columns will be separated by the maximum required gap of views to the left and right of a row or column transition line. If the spacing is negative, it should be one of the constants representing common values that vary by platform. These constants are:

c_label_colon_control_h_spacing
c_ok_cancel_etc_h_spacing
c_controls_h_spacing
c_controls_wide_h_spacing
c_dialog_body_to_ok_cancel_etc_v_spacing
c_controls_v_spacing
c_controls_wide_v_spacing

Any additional available space will be allocated to rows and columns whose views accommodate expansion. By default, all rows and columns will receive additional space with an equal weight of 1.0. This behavior can be overridden using the SetRowWeight and SetColumnWeight functions.

Invoking this function triggers immediate reassessment of the layout. This is necessary to actually add the new child view to the view hierarchy. In order to avoid unnecessary changes in window size as minimum and maximum sizes fluctuate due to transition states, only minimum size considerations will be applied. Maximum size considerations will be applied asynchronously.

virtual void LayoutView_t::AddChild ( View_t child  )  [virtual]

Calling this function is not allowed. For Layout views, children must be added with a full grid specification.

virtual View_t* LayoutView_t::RemoveChild ( View_t child  )  [virtual]

Removes the child and queues an asynchronous relayout operation for the remaining children.

void LayoutView_t::SetAbsoluteMinMaxSizeBehavior ( float  absolute_min_width,
bool  max_width_from_children,
float  absolute_max_width,
float  absolute_min_height,
bool  max_height_from_children,
float  absolute_max_height 
)

Sets the absolute minimum and maximum size behavior. If an absolute minimum width is specified (greater than zero), then even if the layout of child views could fit in a smaller layout, the absolute minimum width is still used. If max_width_from_children is specified, then when the children have been laid out, a maximum width for the overall layout will be calculated using the child views' maximum widths. If ANY child view has an unbounded maximum width, then this layout view will have an unbounded maximum width as well, unless an absolute maximum width has been specified (greater than zero), in which case that absolute maximum will be applied. If absolute_max_width is less than a calculated minimum width, the calculated minimum will be used as a maximum and in debug build, an assertion failure will occur.
The same rules apply to height as described above for width. The defaults are no minimum or maximum, and no maximum from the view's children.
For the sake of consistency with View_t::SetMinMaxSize, if no maximum size is specified (unbounded) then the value should be -1.

void LayoutView_t::SetDefaultRowWeight ( float  row_weight  ) 

Sets the weight for rows which have not had a per-row weight specified using SetRowWeight. Unless otherwise specified, each row without an explicitly set weight will have a default weight of 1.0. Calling this function queues an asynchronous relayout operation.

void LayoutView_t::SetDefaultColumnWeight ( float  column_weight  ) 

Sets the weight for columns which have not had a per-column weight specified using SetColumnWeight. Unless otherwise specified, each column without an explicitly set weight will have a default weight of 1.0. Calling this function queues an asynchronous relayout operation.

void LayoutView_t::SetRowWeight ( int  row_index,
float  row_weight 
)

Sets the weight for the specified row for allocation of extra available space to rows. Unless otherwise specified, each row without an explicitly set weight will have a weight of 1.0. Calling this function queues an asynchronous relayout operation.

void LayoutView_t::SetColumnWeight ( int  column_index,
float  column_weight 
)

Sets the weight for the specified column for allocation of extra available space to columns. Unless otherwise specified, each column without an explicitly set weight will have a weight of 1.0. Calling this function queues an asynchronous relayout operation.

void LayoutView_t::RemoveRowWeight ( int  row_index  ) 

Removes a weight which had been explicitly set for the specified row using SetRowWeight. The row reverts to the default for unspecified rows, which is 1.0 unless SetDefaultRowWeight had been used to change it.

void LayoutView_t::RemoveColumnWeight ( int  row_index  ) 

Removes a weight which had been explicitly set for the specified column using SetColumnWeight. The column reverts to the default for unspecified columns, which is 1.0 unless SetDefaultColumnWeight had been used to change it.

row_column_set_token_t LayoutView_t::SetRowsUseSameMinHeight ( int  first_row_index,
  ... 
)

Sets the specified varargs list of rows to use the same minimum height before excess available space is distributed to the grid in the y domain. The varargs list ends with a row index of -1. The function returns a token which can be used to remove the same minimum height association that will have been created by this function.

row_column_set_token_t LayoutView_t::SetRowsUseSameMinHeight ( const int *  row_indices,
int  num_row_indices 
)

Sets the specified list of rows to use the same minimum height before excess available space is distributed to the grid in the y domain. The function returns a token which can be used to remove the same minimum height association that will have been created by this function.

row_column_set_token_t LayoutView_t::SetColumnsUseSameMinWidth ( int  first_column_index,
  ... 
)

Sets the specified varargs list of columns to use the same minimum width before excess available space is distributed to the grid in the x domain. The varargs list ends with a column index of -1. The function returns a token which can be used to remove the same minimum width association that will have been created by this function.

row_column_set_token_t LayoutView_t::SetColumnsUseSameMinWidth ( const int *  column_indices,
int  num_column_indices 
)

Sets the specified list of columns to use the same minimum width before excess available space is distributed to the grid in the x domain. The function returns a token which can be used to remove the same minimum width association that will have been created by this function.

void LayoutView_t::RemoveRowsUseSameMinHeight ( int  first_row_index,
  ... 
)

Removes a previously created set of rows which should use the same minimum height. This is similar to saving the token when the set was created and using the token to delete the set. The exact set must exist or an assertion failure will occur.

void LayoutView_t::RemoveColumnsUseSameMinWidth ( int  first_column_index,
  ... 
)

Removes a previously created set of columns which should use the same minimum width. This is similar to saving the token when the set was created and using the token to delete the set. The exact set must exist or an assertion failure will occur.

void LayoutView_t::RemoveRowsUseSameMinHeight ( row_column_set_token_t  token  ) 

Removes a previously created set of rows which should use the same minimum height.

void LayoutView_t::RemoveColumnsUseSameMinWidth ( row_column_set_token_t  token  ) 

Removes a previously created set of columns which should use the same minimum width.

int LayoutView_t::CountRows (  )  const [inline]

Returns the number of rows in the currently established layout.

float LayoutView_t::RowHeight ( int  index  )  const [inline]

Returns the current size of the row at the specified index.

float LayoutView_t::RowTop ( int  index  )  const [inline]

Returns the y coordinate of the top of the row at the specified index.

int LayoutView_t::CountColumns (  )  const [inline]

Returns the number of columns in the currently established layout.

float LayoutView_t::ColumnWidth ( int  index  )  const [inline]

Returns the current size of the column at the specified index.

float LayoutView_t::ColumnLeft ( int  index  )  const [inline]

Returns the x coordinate of the left edge of the column at the specified index.

virtual void LayoutView_t::LBoundsChanged ( const Rect_t old_lbounds,
const Rect_t new_lbounds 
) [protected, virtual]

Called when the view's lbounds has changed. This is due to the view having been resized. The upper left corner will always be at x=0, y=0.

Reimplemented from View_t.

virtual void LayoutView_t::ChildMinMaxSizeChanged ( View_t child  )  [protected, virtual]

Notification when a child view's min/max size has been changed. This will be called from within child->SetMinMaxSize. If a size change is needed and the parent view subclass does not reset the child's PFrame to comply with the new requirements, the child's PFrame will be resized to comply.


The documentation for this class was generated from the following file:

Generated on Tue Dec 14 22:35:06 2010 for UT library by  doxygen 1.6.1