nux-0.9.46

nux::TableCtrl Class Reference

#include <Nux/TableCtrl.h>

Inheritance diagram for nux::TableCtrl:
nux::ScrollView nux::View nux::InputArea nux::Area nux::InitiallyUnownedObject nux::Focusable nux::Object nux::Trackable nux::ListControl nux::TreeControl

Public Types

typedef void(TableCtrl::* ItemOperator )(TableItem *)

Public Member Functions

 TableCtrl (bool floating_column=true)
 Constructor.
virtual ~TableCtrl ()
virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
virtual void Draw (GraphicsEngine &GfxContext, bool force_draw)
virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw)
virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw)
void DrawTable (GraphicsEngine &GfxContext)
void DrawHeader (GraphicsEngine &GfxContext)
void DrawHeaderPreview (GraphicsEngine &GfxContext)
void OverlayDrawing (GraphicsEngine &GfxContext)
void addHeader (const TCHAR *name, bool fixed_width=false, int column_width=10)
void FormatTable ()
int FormatHeader ()
virtual void AddColumn (const TCHAR *column_name, bool fixed_width=false, int column_width=10)
 Add a column to the table.
void setTableItems (TableItem *item, bool isOpen=false)
void AddTableItem (TableItem *item)
 Add a table item as a child of the root node of the table controller.
void ResetTable ()
void TraverseItem (TableItem *item, bool open_only, ItemOperator)
void DeleteRowSizeHandler ()
void DeleteRowHeader ()
void OpBuildItemDepth (TableItem *item, int depth)
void OpAddItem (TableItem *item)
void OpCloseItem (TableItem *item)
void OpOpenItem (TableItem *item)
void OpHideItem (TableItem *item)
void OpShowItem (TableItem *item)
virtual void EnableRowResizing (bool b)
 EnableResizing the height of row headers.
virtual void EnableColumnResizing (bool b)
 EnableResizing the width of column headers.
virtual void ShowRowHeader (bool b)
 Show the row headers.
virtual void ShowColumnHeader (bool b)
 Show the column headers.
void ShowVerticalSeparationLine (bool b)
 Show the columns vertical separation lines.
void ShowHorizontalSeparationLine (bool b)
 Show the rows horizontal separation lines.
void ShowSeparationLine (bool bHor, bool bVert)
void ClickSelectRow ()
void ClickSelectColumn ()
void ClickSelectCell ()
virtual void PaintDecoration (GraphicsEngine &GfxContext, TableItem *item)
 Paint Decoration.
virtual void PaintRowDecoration (GraphicsEngine &GfxContext, TableItem *item, Color color)
 Paint Item row header decoration.
t_u32 PushItemBackground (GraphicsEngine &GfxContext, TableItem *item, bool MouseOver=false)
 Paint Item Background.
void PopItemBackground (GraphicsEngine &GfxContext, t_u32 NumBackground)
 Pop the item background pushed on the painter stack.
void EnableApplyItemBestHeight (bool b)
void SetMouseOverColor (Color color)
 Set ItemBackgroundColor when the mouse is over the Item.
Color GetMouseOverColor ()
 Return the user defined color used as background color when the mouse is over the item.
void EnableMouseOverColor (bool b)
 Enable the use of a user defined color when the mouse is over the item.
void SetRowColorOdd (Color color)
Color GetRowColorOdd () const
void SetRowColorEven (Color color)
Color GetRowColorEven () const
void SetRowColor (Color evencolor, Color oddcolor)
void SetHorizontalSeparationLineColor (Color color)
Color GetHorizontalSeparationLineColor () const
void SetVerticalSeparationLineColor (Color color)
Color GetVerticalSeparationLineColor () const
void SetSeparationLineColor (const Color &horcolor, const Color &vertcolor)
virtual bool CanBreakLayout ()
 Return true if this object can break the layout.
void SetFloatingColumn (bool b)
 set Floating column.
bool isFloatingColumn ()
 Return true if the columns are floating.
void FindItemUnderPointer (int x, int y, TableItem **ppItem, int &row, int &column)
 Get information about the item below the pointer.
void SetSelectionColor (const Color &color)
const Color GetSelectionColor ()
TableItemGetSelectedItem ()
t_u32 GetSelectedRow ()
t_u32 GetSelectedColumn ()
t_s32 GetNumColumn ()
 Get the number of column in the table.
t_s32 GetNumRow ()
 Get the number of row in the table.
void ResetItems ()
 reset Items flags.
const TableItemGetRootNode () const
TableItemGetRootNode ()
int GetNumRootChild () const
void EmptyTable ()
void HighlightItem (int row, int column)
virtual void OnMouseDoubleClick (int x, int y, unsigned long button_flags, unsigned long key_flags)
virtual void OnMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags)
void OnMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags)
void OnMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
void OnKeyboardFocus ()
void OnLostKeyboardFocus ()
void OnResizeHeaderMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags, t_u32 header_pos)
void OnResizeHeaderMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags, t_u32 header_pos)
void OnResizeHeaderMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags, t_u32 header_pos)
void OnResizeRowMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags, t_u32 header_pos)
void OnResizeRowMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags, t_u32 header_pos)

Data Fields

int m_ItemX
int m_ItemY
int m_OpenItemTotalHeight
sigc::signal< void, int, int > sigItemSelected
sigc::signal< void, const
TableItem & > 
sigItemChange
sigc::signal< void, TableCtrl
&, TableItem &, int, int > 
sigTableItemSelected
sigc::signal< void > sigLostFocus

Protected Types

enum  CELL_SELECT { CLICK_SELECT_CELL, CLICK_SELECT_COLUMN, CLICK_SELECT_ROW }

Protected Member Functions

void NeedRedraw ()
 Deprecated. Use QueueDraw.
virtual void SetGeometry (const Geometry &geo)
 Inherited from Area.
void ComputeNonFloatingColumn ()
void AdjustNonFloatingColumn ()
virtual void PreLayoutManagement ()
virtual long PostLayoutManagement (long LayoutResult)
virtual void PositionChildLayout (float offsetX, float offsetY)
virtual void ScrollLeft (float stepx, int mousedx)
virtual void ScrollRight (float stepx, int mousedx)
virtual void ScrollUp (float stepy, int mousedy)
virtual void ScrollDown (float stepy, int mousedy)

Protected Attributes

InputAream_TableArea
VLayoutm_VLayout
int m_tableNumRow
int m_tableNumColumn
int m_selectedRow
int m_selectedColumn
Geometry m_selectedGeometry
TableItemm_selectedTableItem
TableItemm_selectedMouseDownTableItem
TableItemm_TableItemHead
bool m_bEnableRowResizing
bool m_bEnableColumnResizing
bool m_bShowRowHeader
bool m_bShowColumnHeader
bool m_bShowVerticalSeparationLine
bool m_bShowHorizontalSeparationLine
bool m_bEnableItemBestHeight
std::vector< RowHeader * > m_row_header
std::vector< ColumnHeaderm_column_header
std::vector< ColumnHeaderm_column_header_preview
std::vector< sizehandler2 * > m_column_sizehandler
std::vector< sizehandler2 * > m_row_sizehandler
bool m_FloatingColumn
Color m_RowColorOdd
Color m_RowColorEven
Color m_SelectionColor
Color m_TableBottomColor
Color m_HorizontalSeparationLineColor
Color m_VerticalSeparationLineColor
Geometry m_PreviousGeometry
bool m_DrawBackgroundOnPreviousGeometry
CELL_SELECT m_ClickSelect
Point m_point0
Point m_point1

Friends

class ComboBoxComplex
class ComboBoxSimple

Member Typedef Documentation

typedef void(TableCtrl::* nux::TableCtrl::ItemOperator)(TableItem *)

Member Enumeration Documentation

enum nux::TableCtrl::CELL_SELECT [protected]
Enumerator:
CLICK_SELECT_CELL 
CLICK_SELECT_COLUMN 
CLICK_SELECT_ROW 

Constructor & Destructor Documentation

nux::TableCtrl::TableCtrl ( bool  floating_column = true)

Constructor.

Construct the TableCtrl class. The parameter floating_column columns can be resized past the size of the content view area.

Parameters:
floating_columnset the column as floating. Default is set to true
See also:
SetFloatingColumn()
isFloatingColumn()
virtual nux::TableCtrl::~TableCtrl ( ) [virtual]

Member Function Documentation

virtual void nux::TableCtrl::AddColumn ( const TCHAR column_name,
bool  fixed_width = false,
int  column_width = 10 
) [virtual]

Add a column to the table.

Add a column to the table.

Parameters:
titleThe title of the column.
fixed_widedTrue if the column should have a fixed width.
widthThe width of the column. This parameter is used if the width is not fixed.
void nux::TableCtrl::addHeader ( const TCHAR name,
bool  fixed_width = false,
int  column_width = 10 
)
void nux::TableCtrl::AddTableItem ( TableItem item)

Add a table item as a child of the root node of the table controller.

void nux::TableCtrl::AdjustNonFloatingColumn ( ) [protected]

This function member computes the size of the headers for a non-floating column table. Given the m_ViewWidth, the width of the view content area. AdjustNonFloatingColumn rescale the width of headers so they fit within the width of the view content area. The new width of each headers respect the its current scales compare to other headers. Fix-width columns remain unchanged.

virtual bool nux::TableCtrl::CanBreakLayout ( ) [inline, virtual]

Return true if this object can break the layout.

Reimplemented from nux::View.

References nux::ScrollView::IsSizeMatchContent().

void nux::TableCtrl::ClickSelectCell ( )
void nux::TableCtrl::ClickSelectColumn ( )
void nux::TableCtrl::ClickSelectRow ( )
void nux::TableCtrl::ComputeNonFloatingColumn ( ) [protected]

Distribute the width to headers equally, except for fix-width headers. ComputeNonFloatingColumn is called when a new column is added to the table.

void nux::TableCtrl::DeleteRowHeader ( )

Delete the row header. All elements are delete.

void nux::TableCtrl::DeleteRowSizeHandler ( )

Delete the row size handler. All elements are delete.

virtual void nux::TableCtrl::Draw ( GraphicsEngine GfxContext,
bool  force_draw 
) [virtual]

Reimplemented from nux::ScrollView.

virtual void nux::TableCtrl::DrawContent ( GraphicsEngine GfxContext,
bool  force_draw 
) [virtual]

Reimplemented from nux::ScrollView.

void nux::TableCtrl::DrawHeader ( GraphicsEngine GfxContext)
void nux::TableCtrl::DrawHeaderPreview ( GraphicsEngine GfxContext)
void nux::TableCtrl::DrawTable ( GraphicsEngine GfxContext)
void nux::TableCtrl::EmptyTable ( )

Delete all elements of the tabled below the root node.

void nux::TableCtrl::EnableApplyItemBestHeight ( bool  b)

Enable row to have a height fixed by the contained item.

virtual void nux::TableCtrl::EnableColumnResizing ( bool  b) [inline, virtual]

EnableResizing the width of column headers.

Enable the resizing to column headers by dragging the line at the right of the column.

References m_bEnableColumnResizing.

void nux::TableCtrl::EnableMouseOverColor ( bool  b) [inline]

Enable the use of a user defined color when the mouse is over the item.

Parameters:
bIf b is True the user defined color replaces the background color when the mouse is over the item.
virtual void nux::TableCtrl::EnableRowResizing ( bool  b) [inline, virtual]

EnableResizing the height of row headers.

Enable the resizing to row headers by dragging the line at the bottom of the row.

References m_bEnableRowResizing.

void nux::TableCtrl::FindItemUnderPointer ( int  x,
int  y,
TableItem **  ppItem,
int &  row,
int &  column 
)

Get information about the item below the pointer.

int nux::TableCtrl::FormatHeader ( )
Returns:
The total width of the header;
void nux::TableCtrl::FormatTable ( )
Color nux::TableCtrl::GetHorizontalSeparationLineColor ( ) const [inline]
Color nux::TableCtrl::GetMouseOverColor ( ) [inline]

Return the user defined color used as background color when the mouse is over the item.

Returns:
the user defined color used as background color when the mouse is over the item.
t_s32 nux::TableCtrl::GetNumColumn ( )

Get the number of column in the table.

Get the number of column in the table.

Returns:
the number of column.
int nux::TableCtrl::GetNumRootChild ( ) const [inline]

Get number of child element of the root node.

References m_TableItemHead, and nux::NodeItem::NumChild().

t_s32 nux::TableCtrl::GetNumRow ( )

Get the number of row in the table.

Get the number of row in the table.

Returns:
the number of row.
const TableItem* nux::TableCtrl::GetRootNode ( ) const [inline]

Get Root Node.

Returns:
const TableItem*

References m_TableItemHead.

TableItem* nux::TableCtrl::GetRootNode ( ) [inline]

Get Root Node.

Returns:
TableItem*

References m_TableItemHead.

Color nux::TableCtrl::GetRowColorEven ( ) const [inline]

References m_RowColorEven.

Color nux::TableCtrl::GetRowColorOdd ( ) const [inline]

References m_RowColorOdd.

t_u32 nux::TableCtrl::GetSelectedColumn ( ) [inline]

References m_selectedColumn.

TableItem* nux::TableCtrl::GetSelectedItem ( ) [inline]

References m_selectedTableItem.

t_u32 nux::TableCtrl::GetSelectedRow ( ) [inline]

References m_selectedRow.

const Color nux::TableCtrl::GetSelectionColor ( ) [inline]

References m_SelectionColor.

Color nux::TableCtrl::GetVerticalSeparationLineColor ( ) const [inline]
void nux::TableCtrl::HighlightItem ( int  row,
int  column 
)
bool nux::TableCtrl::isFloatingColumn ( )

Return true if the columns are floating.

Return true if the columns are floating.

See also:
SetFloatingColumn()
void nux::TableCtrl::NeedRedraw ( ) [protected, virtual]

Deprecated. Use QueueDraw.

Reimplemented from nux::View.

void nux::TableCtrl::OnKeyboardFocus ( )
void nux::TableCtrl::OnLostKeyboardFocus ( )
virtual void nux::TableCtrl::OnMouseDoubleClick ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags 
) [virtual]

Reimplemented in nux::TreeControl.

virtual void nux::TableCtrl::OnMouseDown ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags 
) [virtual]

Reimplemented in nux::TreeControl.

void nux::TableCtrl::OnMouseDrag ( int  x,
int  y,
int  dx,
int  dy,
unsigned long  button_flags,
unsigned long  key_flags 
)
void nux::TableCtrl::OnMouseUp ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags 
)
void nux::TableCtrl::OnResizeHeaderMouseDown ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags,
t_u32  header_pos 
)
void nux::TableCtrl::OnResizeHeaderMouseDrag ( int  x,
int  y,
int  dx,
int  dy,
unsigned long  button_flags,
unsigned long  key_flags,
t_u32  header_pos 
)
void nux::TableCtrl::OnResizeHeaderMouseUp ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags,
t_u32  header_pos 
)
void nux::TableCtrl::OnResizeRowMouseDown ( int  x,
int  y,
unsigned long  button_flags,
unsigned long  key_flags,
t_u32  header_pos 
)
void nux::TableCtrl::OnResizeRowMouseDrag ( int  x,
int  y,
int  dx,
int  dy,
unsigned long  button_flags,
unsigned long  key_flags,
t_u32  header_pos 
)
void nux::TableCtrl::OpAddItem ( TableItem item)
void nux::TableCtrl::OpBuildItemDepth ( TableItem item,
int  depth 
)
void nux::TableCtrl::OpCloseItem ( TableItem item)
void nux::TableCtrl::OpHideItem ( TableItem item)
void nux::TableCtrl::OpOpenItem ( TableItem item)
void nux::TableCtrl::OpShowItem ( TableItem item)
void nux::TableCtrl::OverlayDrawing ( GraphicsEngine GfxContext) [virtual]

Reimplemented from nux::View.

virtual void nux::TableCtrl::PaintDecoration ( GraphicsEngine GfxContext,
TableItem item 
) [virtual]

Paint Decoration.

Paint the item hierarchy, open/close decoration in the first column.

Parameters:
itemThe item whose decoration must be drawn.
virtual void nux::TableCtrl::PaintRowDecoration ( GraphicsEngine GfxContext,
TableItem item,
Color  color 
) [virtual]

Paint Item row header decoration.

Parameters:
itemThe item whose row header must be drawn.
void nux::TableCtrl::PopItemBackground ( GraphicsEngine GfxContext,
t_u32  NumBackground 
)

Pop the item background pushed on the painter stack.

Pop the item background pushed on the painter stack.

Parameters:
NumBackgroundThe number of background to pop of the painter stack.
virtual void nux::TableCtrl::PositionChildLayout ( float  offsetX,
float  offsetY 
) [protected, virtual]

Reimplemented from nux::ScrollView.

virtual void nux::TableCtrl::PostDraw ( GraphicsEngine GfxContext,
bool  force_draw 
) [virtual]

Reimplemented from nux::ScrollView.

virtual long nux::TableCtrl::PostLayoutManagement ( long  LayoutResult) [protected, virtual]

Reimplemented from nux::ScrollView.

virtual void nux::TableCtrl::PreLayoutManagement ( ) [protected, virtual]

Reimplemented from nux::ScrollView.

virtual long nux::TableCtrl::ProcessEvent ( IEvent ievent,
long  TraverseInfo,
long  ProcessEventInfo 
) [virtual]

Reimplemented from nux::ScrollView.

t_u32 nux::TableCtrl::PushItemBackground ( GraphicsEngine GfxContext,
TableItem item,
bool  MouseOver = false 
)

Paint Item Background.

Paint Item Background. Also push the background on the painter background stack.

Returns:
The number of background pushed onto the painter stack.
void nux::TableCtrl::ResetItems ( )

reset Items flags.

Reset the dirty flag of items.

void nux::TableCtrl::ResetTable ( )

Repopulate the table starting at the root node. Recreate the m_row_header.

virtual void nux::TableCtrl::ScrollDown ( float  stepy,
int  mousedy 
) [protected, virtual]

Reimplemented from nux::ScrollView.

virtual void nux::TableCtrl::ScrollLeft ( float  stepx,
int  mousedx 
) [protected, virtual]

Reimplemented from nux::ScrollView.

virtual void nux::TableCtrl::ScrollRight ( float  stepx,
int  mousedx 
) [protected, virtual]

Reimplemented from nux::ScrollView.

virtual void nux::TableCtrl::ScrollUp ( float  stepy,
int  mousedy 
) [protected, virtual]

Reimplemented from nux::ScrollView.

void nux::TableCtrl::SetFloatingColumn ( bool  b)

set Floating column.

Set if the header have floating columns or not. With floating column, the total width of the headers may be greater that the width of the content view area (the horizontal scrollbar will reflect that). With non floating columns, the sum of all headers width is exactly equal to the width of the content view area.

See also:
isFloatingColumn()
virtual void nux::TableCtrl::SetGeometry ( const Geometry geo) [protected, virtual]

Inherited from Area.

Reimplemented from nux::ScrollView.

void nux::TableCtrl::SetHorizontalSeparationLineColor ( Color  color) [inline]
void nux::TableCtrl::SetMouseOverColor ( Color  color) [inline]

Set ItemBackgroundColor when the mouse is over the Item.

Set ItemBackgroundColor when the mouse is over the Item. This color supersedes other background colors.

void nux::TableCtrl::SetRowColor ( Color  evencolor,
Color  oddcolor 
) [inline]

References m_RowColorEven, and m_RowColorOdd.

void nux::TableCtrl::SetRowColorEven ( Color  color) [inline]

References m_RowColorEven.

void nux::TableCtrl::SetRowColorOdd ( Color  color) [inline]

References m_RowColorOdd.

void nux::TableCtrl::SetSelectionColor ( const Color color) [inline]

References m_SelectionColor.

void nux::TableCtrl::SetSeparationLineColor ( const Color horcolor,
const Color vertcolor 
) [inline]
void nux::TableCtrl::setTableItems ( TableItem item,
bool  isOpen = false 
)

Add an item has a direct child of the Root of the Table. The root of the Table is never displayed. Only its children are displayed.

Parameters:
itemThe item to add.
isOpenIf TRUE, the item will .
void nux::TableCtrl::SetVerticalSeparationLineColor ( Color  color) [inline]
virtual void nux::TableCtrl::ShowColumnHeader ( bool  b) [virtual]

Show the column headers.

Show the column headers. Columns are titled according to the name given when addColumn() is called.

void nux::TableCtrl::ShowHorizontalSeparationLine ( bool  b)

Show the rows horizontal separation lines.

Show the rows horizontal separation lines.

Parameters:
bIf b is true the horizontal separation lines are visible.
virtual void nux::TableCtrl::ShowRowHeader ( bool  b) [virtual]

Show the row headers.

Show the row headers. Rows are numbered from 0 to the number of row - 1.

void nux::TableCtrl::ShowSeparationLine ( bool  bHor,
bool  bVert 
)
void nux::TableCtrl::ShowVerticalSeparationLine ( bool  b)

Show the columns vertical separation lines.

Show the columns vertical separation lines.

Parameters:
bIf b is true the vertical separation lines are visible.
void nux::TableCtrl::TraverseItem ( TableItem item,
bool  open_only,
ItemOperator   
)

Friends And Related Function Documentation

friend class ComboBoxComplex [friend]
friend class ComboBoxSimple [friend]

Field Documentation

std::vector<RowHeader *> nux::TableCtrl::m_row_header [protected]
std::vector<sizehandler2 *> nux::TableCtrl::m_row_sizehandler [protected]

Referenced by GetSelectedColumn().

Referenced by GetSelectedRow().

sigc::signal<void, const TableItem &> nux::TableCtrl::sigItemChange
sigc::signal<void, int, int> nux::TableCtrl::sigItemSelected
sigc::signal<void> nux::TableCtrl::sigLostFocus
sigc::signal<void, TableCtrl &, TableItem &, int, int> nux::TableCtrl::sigTableItemSelected

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