MWidgets::Grid Class Reference

Class that represent grid control. More...

#include <grid.h>

Inheritance diagram for MWidgets::Grid:

MWidgets::Widget List of all members.

Public Member Functions

 Grid ()
 Constructor.
 ~Grid ()
 Destructor.
virtual void Create (Widget *parent, int x, int y, int w, int h)
 Create widgets window.
virtual WIDGET_TYPE GetType ()
 Return class's identifier like WINDOW or BUTTON.
void SetSize (int rows, int cols)
 Set table size.
void SetFixedRowCount (int val)
 Set number of fixed rows.
void SetFixedColCount (int val)
 Set number of fixed columns.
void SetFont (string name, int size, bool bold, bool italic, bool underline)
 Set tables font.
void SetTextAlign (TextAlign align)
 Set text align.
void SetRowHeight (int index, int h)
 Set height for specified row.
void SetColWidth (int index, int w)
 Set width for specified col.
void SetTextMargins (int l, int t, int r, int b)
 Set cell text margins.
void SetItemText (int row, int col, string text)
 Set cell text.
string GetItemText (int row, int col)
 Get text from cell.
void SetItemData (int row, int col, void *data)
 Asociate some data with cell.
void SetItemForeColor (int row, int col, DWORD color)
 Set cells text color.
void SetItemBackColor (int row, int col, DWORD color)
 Set cells background color.
void SetDefColWidth (int w)
 Set default colmn width.
void SetDefRowHeight (int h)
 Set default row height.
void SetDefCellColor (DWORD color)
 Set default cells color.
void SetDefFixedCellColor (DWORD color)
 Set default fixed cells color.
int GetFocusCellRow ()
 Get focused cells row number.
int GetFocusCellCol ()
 Get focused cells col number.
void Refresh (bool bRecalculateVisibles=false)
 Redraw table.
void GetCellByPoint (int x, int y, int *row, int *col)
 Return row/col of cell placed in specified point.
void GetCellRect (int row, int col, LPRECT pRect)
 Get cells position and dimensions in client coordinates.
virtual void OnSize (int left, int top, int right, int bottom)
 Virtual callback function for size event.
void ResizeToMinSize ()
 Resize all table calles to smallest tables cell.
void ResizeToMaxSize ()
 Resize all table calles to bigest tables cell.
void ResizeToAlignCol ()
 Resize all table calles to show full cells text.
void EnsureVisible (int row, int col)
 Ensure cell for visible.

Protected Types

typedef vector< CellCellArray
 Array of cells, used forward for vector constructing.

Protected Member Functions

void Draw ()
 Used with WM_PAINT.
void DrawFixed (HDC hdc, RECT *cellRect, int r, int c, int w, int h)
 Draw fixed cell.
void DrawNormal (HDC hdc, RECT *cellRect, int r, int c, int w, int h)
 Draw normal cell.
void ShowCellEdit (bool replace, string str="")
 Show edit box for entering text to focused cell.
void HideCellEdit ()
 Hide edit box for editing cell.
void RecalculateVisibles (int w=-1, int h=-1)
 Calucate visible col/row range.
void TestColRowResizing (int x, int y)
 Test mouse position for moving over col/row resizing area.
void ResizeRow (int newPos)
 Change resizing row height.
void ResizeCol (int newPos)
 Change resizing col width.
void TestColRowMoving (int xPos, int yPos)
 Test mouse position for moving over col/row draging area.
void TestCellMovingCopieng (int xPos, int yPos)
 Test mouse position for moving over cell draging/copieng area.
void GetFixedCellByPoint (int x, int y, int *row, int *col)
 Return row/col of fixed cell placed in specified point.
LRESULT CALLBACK EditOnMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 Message processing procedure for edit box,that used for entering cells text.
virtual LRESULT OnMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 Subclassing for overrides.

Static Protected Member Functions

static LRESULT CALLBACK EditWindowProcedure (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 Window procedure for edit box,that used for entering cells text.

Protected Attributes

HWND m_hWndEdit
 Edit box's HWND. Used for entering text to cells.
WNDPROC m_EditWndProc
 Window procedure for edit box.
HCURSOR m_hVertSizeCur
 Cursor for row resing.
HCURSOR m_hHorzSizeCur
 Cursor for col resing.
HCURSOR m_hMovingCur
 Cursor for moving/draging.
HCURSOR m_hCrossCur
 Cursor for special cells copieng.
HCURSOR m_hArrowCur
 Standart Arrow cursor.
int m_nFixedColCount
 Fixed column number.
int m_nFixedRowCount
 Fixed rows number.
vector< CellArraym_vecTable
 Main cells table.
vector< int > m_vecColsWidths
 Array of colunms widths.
vector< int > m_vecRowsHeights
 Array of rows heights.
HFONT m_hFont
 Main table font.
TextAlign m_TextAlign
 Table text align mode.
int m_iLeftMargin
 Left margin in pixels.
int m_iTopMargin
 Top margin in pixels.
int m_iRightMargin
 Right margin in pixels.
int m_iBottomMargin
 Bottom margin in pixels.
int m_iDefColWidth
 Default column width.
int m_iDefRowHeight
 Default row height.
bool m_bEditingMode
 Equals "true" if table shows editing box.
bool m_bSelectionMode
 Equals "true" if we move mouse for selction.
bool m_bColSeletion
 Equals "true" if we move mouse for selction only cols.
bool m_bRowSeletion
 Equals "true" if we move mouse for selction only rows.
bool m_bOnResizeArea
 Equals "true" if mouse is over col/row resize area.
bool m_bResizeMode
 Equals "true" if user start to resize col or row.
int m_iResizeRow
 Resizing row number,default value "-1".
int m_iResizeCol
 Resizing col number,default value "-1".
int m_iPrevResizeVal
 Used for calculating resing value.
bool m_bColRowOnMoveArea
 Equals "true" if mouse is over col/row draging area.
bool m_bRowMovingMode
 Equals "true" if we drag rows.
bool m_bColMovingMode
 Equals "true" if we drag cols.
HRGN m_regColMoving
 This region used for testing mouse position over cols moving rect, created in.
HRGN m_regRowMoving
 This region used for testing mouse position over cols moving rect, created in.
bool m_bCellOnMoveArea
 Equals "true" if mouse is over cell draging area.
bool m_bCellOnCopiengArea
 Equals "true" if mouse is over cell copieng area.
bool m_bCellMovingMode
 Equals "true" if we drag cells.
bool m_bCellCopiengMode
 Equals "true" if we copieng cells.
HRGN m_regCellMoving
 This region used for testing mouse position over cols moving rect, created in.
HRGN m_regCellCopieng
 This region used for testing mouse position over cols moving rect, created in.
int m_iCurRow
 Focused row number,also min selected.
int m_iCurCol
 Focused column number,also min selected.
int m_iSelRow
 Max selected row number.
int m_iSelCol
 Max selected column number.
DWORD m_dwSelctionOP
 Operation for combining selction and dest rects.
HBRUSH m_hSelectionBrush
 Brush used for selection drawing.
HPEN m_hBlackPen3
 Black pen object, width 3 pixel.
HPEN m_hBlackPen2
 Black pen object, width 2 pixel.
HPEN m_hBlackPen1
 Black pen object, width 1 pixel.
HPEN m_hWhitePen
 White pen object.
int m_iBroderWidth
 Cell border width.
COLORREF m_dwDefFixedCellColor
 Default fixed cell color.
COLORREF m_dwDefCellColor
 Default normal cell color.
int m_iFixedColWidth
 Width of all fixed columns,in pixels.
int m_iFixedRowHeight
 Height of all fixed rows,in pixels.
int m_iTableWidth
 Table width,in pixels.
int m_iTableHeight
 Table height,in pixels.
int m_iMinVisRow
 Number of minimum visible row.
int m_iMaxVisRow
 Number of maximum visible row.
int m_iMinVisCol
 Number of minimum visible col.
int m_iMaxVisCol
 Number of maximum visible col.
std::string m_sMinStr
std::string m_sMaxStr

Detailed Description

Class that represent grid control.

Definition at line 44 of file grid.h.


Member Typedef Documentation

typedef vector<Cell> MWidgets::Grid::CellArray [protected]

Array of cells, used forward for vector constructing.

Definition at line 47 of file grid.h.


Constructor & Destructor Documentation

MWidgets::Grid::Grid (  ) 

Constructor.

Definition at line 28 of file grid.cpp.

References MWidgets::ALIGN_CENTER, m_bCellCopiengMode, m_bCellMovingMode, m_bCellOnCopiengArea, m_bCellOnMoveArea, m_bColMovingMode, m_bColRowOnMoveArea, m_bColSeletion, m_bEditingMode, m_bOnResizeArea, m_bResizeMode, m_bRowMovingMode, m_bRowSeletion, m_bSelectionMode, m_dwDefCellColor, m_dwDefFixedCellColor, m_dwSelctionOP, m_EditWndProc, m_hBlackPen1, m_hBlackPen2, m_hBlackPen3, m_hCrossCur, m_hFont, m_hHorzSizeCur, m_hSelectionBrush, m_hVertSizeCur, m_hWhitePen, m_hWndEdit, m_iBottomMargin, m_iBroderWidth, m_iCurCol, m_iCurRow, m_iDefColWidth, m_iDefRowHeight, m_iFixedColWidth, m_iFixedRowHeight, m_iLeftMargin, m_iMaxVisCol, m_iMaxVisRow, m_iMinVisCol, m_iMinVisRow, m_iPrevResizeVal, m_iResizeCol, m_iResizeRow, m_iRightMargin, m_iSelCol, m_iSelRow, m_iTableHeight, m_iTableWidth, m_iTopMargin, m_nFixedColCount, m_nFixedRowCount, m_regCellCopieng, m_regCellMoving, m_regColMoving, m_regRowMoving, m_TextAlign, and SetFont().

MWidgets::Grid::~Grid (  ) 

Destructor.

Definition at line 101 of file grid.cpp.

References m_hBlackPen1, m_hBlackPen2, m_hBlackPen3, m_hCrossCur, m_hFont, m_hHorzSizeCur, m_hMovingCur, m_hSelectionBrush, m_hVertSizeCur, m_hWhitePen, m_regCellCopieng, m_regCellMoving, m_regColMoving, and m_regRowMoving.


Member Function Documentation

void MWidgets::Grid::Create ( Widget parent,
int  x,
int  y,
int  w,
int  h 
) [virtual]

Create widgets window.

Parameters:
parent parent widget.
x new widget's x coordinate.
y new widget's y coordinate.
w new widget's width.
h new widget's height.

Definition at line 133 of file grid.cpp.

References CATCHEXCEPT, MWidgets::Widget::Create(), EditWindowProcedure(), EXCEPT, MWidgets::Widget::GetHwnd(), m_EditWndProc, m_hCrossCur, m_hHorzSizeCur, MWidgets::Widget::m_hInstance, m_hMovingCur, m_hVertSizeCur, MWidgets::Widget::m_hWnd, and m_hWndEdit.

void MWidgets::Grid::Draw (  )  [protected]

Used with WM_PAINT.

See also:
DrawFixed().

DrawNormal().

Definition at line 584 of file grid.cpp.

References DrawFixed(), m_hFont, MWidgets::Widget::m_hWnd, m_iBroderWidth, m_iCurCol, m_iCurRow, m_iFixedColWidth, m_iMaxVisCol, m_iMinVisCol, m_iSelCol, m_iSelRow, m_nFixedColCount, m_nFixedRowCount, m_vecColsWidths, m_vecRowsHeights, and m_vecTable.

Referenced by OnMessage().

void MWidgets::Grid::DrawFixed ( HDC  hdc,
RECT *  cellRect,
int  r,
int  c,
int  w,
int  h 
) [protected]

Draw fixed cell.

Parameters:
hdc HDC of window.
cellRect coordinates of drawing cell.
r cell's row.
c cell's col.
w client area width.
h client area height.

Definition at line 462 of file grid.cpp.

References MWidgets::ALIGN_CENTER, MWidgets::ALIGN_LEFT, MWidgets::ALIGN_RIGHT, MWidgets::Cell::backcolor, MWidgets::Cell::forecolor, MWidgets::Cell::m_bBCChanged, m_dwDefFixedCellColor, m_dwSelctionOP, m_hBlackPen1, m_hSelectionBrush, m_hWhitePen, m_iBottomMargin, m_iCurCol, m_iCurRow, m_iLeftMargin, m_iRightMargin, m_iSelCol, m_iSelRow, m_iTopMargin, m_TextAlign, m_vecColsWidths, m_vecRowsHeights, m_vecTable, and MWidgets::Cell::text.

Referenced by Draw().

void MWidgets::Grid::DrawNormal ( HDC  hdc,
RECT *  cellRect,
int  r,
int  c,
int  w,
int  h 
) [protected]

Draw normal cell.

Parameters:
hdc HDC of window.
cellRect coordinates of drawing cell.
r cell's row.
c cell's col.
w client area width.
h client area height.

Definition at line 519 of file grid.cpp.

References MWidgets::ALIGN_CENTER, MWidgets::ALIGN_LEFT, MWidgets::ALIGN_RIGHT, MWidgets::Cell::backcolor, MWidgets::Cell::forecolor, MWidgets::Cell::m_bBCChanged, m_dwDefCellColor, m_dwSelctionOP, m_hBlackPen1, m_hSelectionBrush, m_iBottomMargin, m_iCurCol, m_iCurRow, m_iLeftMargin, m_iRightMargin, m_iSelCol, m_iSelRow, m_iTopMargin, m_TextAlign, m_vecColsWidths, m_vecRowsHeights, m_vecTable, and MWidgets::Cell::text.

LRESULT CALLBACK MWidgets::Grid::EditOnMessage ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [protected]

Message processing procedure for edit box,that used for entering cells text.

Definition at line 880 of file grid.cpp.

References GetItemText(), HideCellEdit(), m_bEditingMode, m_EditWndProc, m_iCurCol, m_iCurRow, m_nFixedRowCount, m_vecRowsHeights, Refresh(), and SetItemText().

Referenced by EditWindowProcedure().

LRESULT CALLBACK MWidgets::Grid::EditWindowProcedure ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [static, protected]

Window procedure for edit box,that used for entering cells text.

Definition at line 869 of file grid.cpp.

References EditOnMessage(), and MWidgets::Widget::GetObjectFromHwnd().

Referenced by Create().

void MWidgets::Grid::EnsureVisible ( int  row,
int  col 
)

Ensure cell for visible.

Parameters:
row cell row
col cell column

Definition at line 2044 of file grid.cpp.

References MWidgets::Widget::m_hWnd, m_iMaxVisCol, m_iMaxVisRow, m_iMinVisCol, m_iMinVisRow, m_nFixedRowCount, m_vecTable, RecalculateVisibles(), and Refresh().

Referenced by OnMessage(), and ShowCellEdit().

void MWidgets::Grid::GetCellByPoint ( int  x,
int  y,
int *  row,
int *  col 
)

Return row/col of cell placed in specified point.

Parameters:
x coordinate X.
y coordinate Y.
row number of cells row.
col number of cells col.

Definition at line 1683 of file grid.cpp.

References m_iFixedColWidth, m_iFixedRowHeight, m_iMinVisCol, m_iMinVisRow, m_nFixedRowCount, m_vecColsWidths, m_vecRowsHeights, and m_vecTable.

Referenced by OnMessage().

void MWidgets::Grid::GetCellRect ( int  row,
int  col,
LPRECT  pRect 
)

Get cells position and dimensions in client coordinates.

Parameters:
row cells row.
col cells column.
pRect pointer to structure that recieve dimensions.

Definition at line 1780 of file grid.cpp.

References m_iFixedColWidth, m_iFixedRowHeight, m_iMinVisCol, m_iMinVisRow, m_nFixedRowCount, m_vecColsWidths, m_vecRowsHeights, and m_vecTable.

Referenced by ShowCellEdit().

void MWidgets::Grid::GetFixedCellByPoint ( int  x,
int  y,
int *  row,
int *  col 
) [protected]

Return row/col of fixed cell placed in specified point.

Parameters:
x coordinate X.
y coordinate Y.
row number of cells row.
col number of cells col.

Definition at line 2203 of file grid.cpp.

References m_iFixedColWidth, m_iFixedRowHeight, m_iMinVisCol, m_iMinVisRow, m_nFixedRowCount, m_vecColsWidths, m_vecRowsHeights, and m_vecTable.

Referenced by OnMessage().

int MWidgets::Grid::GetFocusCellCol (  ) 

Get focused cells col number.

Returns:
col number.

Definition at line 449 of file grid.cpp.

References m_iCurCol.

int MWidgets::Grid::GetFocusCellRow (  ) 

Get focused cells row number.

Returns:
row number.

Definition at line 444 of file grid.cpp.

References m_iCurRow.

string MWidgets::Grid::GetItemText ( int  row,
int  col 
)

Get text from cell.

Parameters:
row cells row.
col cells column.
Returns:
text form cell.

Definition at line 1758 of file grid.cpp.

References CATCHEXCEPT, EXCEPT, and m_vecTable.

Referenced by EditOnMessage(), ResizeToAlignCol(), and ShowCellEdit().

WIDGET_TYPE MWidgets::Grid::GetType (  )  [virtual]

Return class's identifier like WINDOW or BUTTON.

Implements MWidgets::Widget.

Definition at line 175 of file grid.cpp.

References MWidgets::GRID.

void MWidgets::Grid::HideCellEdit (  )  [protected]

Hide edit box for editing cell.

Definition at line 1753 of file grid.cpp.

References m_hWndEdit.

Referenced by EditOnMessage(), and OnMessage().

LRESULT MWidgets::Grid::OnMessage ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [protected, virtual]

Subclassing for overrides.

Reimplemented from MWidgets::Widget.

Definition at line 937 of file grid.cpp.

References Draw(), EnsureVisible(), GET_KEYSTATE_WPARAM, GetCellByPoint(), GetFixedCellByPoint(), HideCellEdit(), m_bColMovingMode, m_bColRowOnMoveArea, m_bColSeletion, m_bEditingMode, m_bOnResizeArea, m_bResizeMode, m_bRowMovingMode, m_bRowSeletion, m_bSelectionMode, m_hHorzSizeCur, m_hMovingCur, m_hVertSizeCur, MWidgets::Widget::m_hWnd, m_iCurCol, m_iCurRow, m_iFixedColWidth, m_iFixedRowHeight, m_iMaxVisCol, m_iMaxVisRow, m_iMinVisCol, m_iMinVisRow, m_iPrevResizeVal, m_iResizeCol, m_iResizeRow, m_iSelCol, m_iSelRow, m_nFixedRowCount, m_vecColsWidths, m_vecRowsHeights, m_vecTable, OBJID_HSCROLL, MWidgets::Widget::OnMessage(), RecalculateVisibles(), Refresh(), ResizeCol(), ResizeRow(), SetItemText(), ShowCellEdit(), TestCellMovingCopieng(), TestColRowMoving(), TestColRowResizing(), and TME_NONCLIENT.

void MWidgets::Grid::OnSize ( int  left,
int  top,
int  right,
int  bottom 
) [virtual]

Virtual callback function for size event.

Parameters:
left left coordinate of client area.
top top coordinate of client area.
right rightcoordinate of client area.
bottom bottom coordinate of client area.

Reimplemented from MWidgets::Widget.

Definition at line 1667 of file grid.cpp.

References RecalculateVisibles(), and Refresh().

void MWidgets::Grid::RecalculateVisibles ( int  w = -1,
int  h = -1 
) [protected]

Calucate visible col/row range.

Calucate visible col/row range, for specified client area and focused cell place.

Parameters:
w client area width.
h client area height.

Definition at line 1573 of file grid.cpp.

References MWidgets::Widget::m_hWnd, m_iFixedColWidth, m_iFixedRowHeight, m_iMaxVisCol, m_iMaxVisRow, m_iMinVisCol, m_iMinVisRow, m_iTableHeight, m_iTableWidth, m_nFixedRowCount, m_vecColsWidths, m_vecRowsHeights, and m_vecTable.

Referenced by EnsureVisible(), OnMessage(), OnSize(), and Refresh().

void MWidgets::Grid::Refresh ( bool  bRecalculateVisibles = false  ) 

Redraw table.

Parameters:
bRecalculateVisibles if equals true recalculate visible cells(take more time).

Definition at line 454 of file grid.cpp.

References MWidgets::Widget::m_hWnd, and RecalculateVisibles().

Referenced by EditOnMessage(), EnsureVisible(), OnMessage(), OnSize(), ResizeCol(), and ResizeRow().

void MWidgets::Grid::ResizeCol ( int  newPos  )  [protected]

Change resizing col width.

Parameters:
newPos next coord X.

Definition at line 1919 of file grid.cpp.

References m_iPrevResizeVal, m_iResizeCol, m_vecColsWidths, and Refresh().

Referenced by OnMessage().

void MWidgets::Grid::ResizeRow ( int  newPos  )  [protected]

Change resizing row height.

Parameters:
newPos next coord Y.

Definition at line 1905 of file grid.cpp.

References m_iPrevResizeVal, m_iResizeRow, m_vecRowsHeights, and Refresh().

Referenced by OnMessage().

void MWidgets::Grid::ResizeToAlignCol (  ) 

Resize all table calles to show full cells text.

Definition at line 1993 of file grid.cpp.

References GetItemText(), m_hFont, MWidgets::Widget::m_hWnd, m_iBottomMargin, m_iLeftMargin, m_iRightMargin, m_iTopMargin, m_nFixedRowCount, m_vecTable, SetColWidth(), and SetRowHeight().

void MWidgets::Grid::ResizeToMaxSize (  ) 

Resize all table calles to bigest tables cell.

Definition at line 1963 of file grid.cpp.

References m_hFont, MWidgets::Widget::m_hWnd, m_iBottomMargin, m_iLeftMargin, m_iRightMargin, m_iTopMargin, m_nFixedRowCount, m_sMaxStr, m_vecTable, SetColWidth(), and SetRowHeight().

void MWidgets::Grid::ResizeToMinSize (  ) 

Resize all table calles to smallest tables cell.

Definition at line 1933 of file grid.cpp.

References m_hFont, MWidgets::Widget::m_hWnd, m_iBottomMargin, m_iLeftMargin, m_iRightMargin, m_iTopMargin, m_nFixedRowCount, m_sMinStr, m_vecTable, SetColWidth(), and SetRowHeight().

void MWidgets::Grid::SetColWidth ( int  index,
int  w 
)

Set width for specified col.

Parameters:
index col number.
w new col width.

Definition at line 314 of file grid.cpp.

References CATCHEXCEPT, EXCEPT, m_iFixedColWidth, m_iTableWidth, m_nFixedColCount, and m_vecColsWidths.

Referenced by ResizeToAlignCol(), ResizeToMaxSize(), and ResizeToMinSize().

void MWidgets::Grid::SetDefCellColor ( DWORD  color  ) 

Set default cells color.

Parameters:
color new default cell color.

Definition at line 2134 of file grid.cpp.

References m_dwDefCellColor.

void MWidgets::Grid::SetDefColWidth ( int  w  ) 

Set default colmn width.

Parameters:
w new default column width.

Definition at line 1673 of file grid.cpp.

References m_iDefColWidth.

void MWidgets::Grid::SetDefFixedCellColor ( DWORD  color  ) 

Set default fixed cells color.

Parameters:
color new default cell color.

Definition at line 2139 of file grid.cpp.

References m_dwDefFixedCellColor.

void MWidgets::Grid::SetDefRowHeight ( int  h  ) 

Set default row height.

Parameters:
h new default row height.

Definition at line 1678 of file grid.cpp.

References m_iDefRowHeight.

void MWidgets::Grid::SetFixedColCount ( int  val  ) 

Set number of fixed columns.

Parameters:
val fixed columns number.

Definition at line 245 of file grid.cpp.

References CATCHEXCEPT, EXCEPT, m_iBroderWidth, m_iCurCol, m_iFixedColWidth, m_iSelCol, m_nFixedColCount, and m_vecColsWidths.

void MWidgets::Grid::SetFixedRowCount ( int  val  ) 

Set number of fixed rows.

Parameters:
val fixed rows number.

Definition at line 223 of file grid.cpp.

References CATCHEXCEPT, EXCEPT, m_iBroderWidth, m_iCurRow, m_iFixedRowHeight, m_iSelRow, m_nFixedRowCount, and m_vecRowsHeights.

void MWidgets::Grid::SetFont ( string  name,
int  size,
bool  bold,
bool  italic,
bool  underline 
)

Set tables font.

Construct and set font for table.

Parameters:
name font name,for example "Arial".
size font size in logical units.
bold set "true" for bold.
italic set "true" for italic.
underline set "true" for undeline font.

Definition at line 268 of file grid.cpp.

References m_hFont.

Referenced by Grid().

void MWidgets::Grid::SetItemBackColor ( int  row,
int  col,
DWORD  color 
)

Set cells background color.

Parameters:
row number of cells row.
col number of cells col.
color new cells background color.

Definition at line 421 of file grid.cpp.

References CATCHEXCEPT, EXCEPT, and m_vecTable.

void MWidgets::Grid::SetItemData ( int  row,
int  col,
void *  data 
)

Asociate some data with cell.

Parameters:
row number of cells row.
col number of cells col.
data pointer to some data.

Definition at line 377 of file grid.cpp.

References CATCHEXCEPT, EXCEPT, and m_vecTable.

void MWidgets::Grid::SetItemForeColor ( int  row,
int  col,
DWORD  color 
)

Set cells text color.

Parameters:
row number of cells row.
col number of cells col.
color new cells text color.

Definition at line 399 of file grid.cpp.

References CATCHEXCEPT, EXCEPT, and m_vecTable.

void MWidgets::Grid::SetItemText ( int  row,
int  col,
string  text 
)

Set cell text.

Parameters:
row number of cells row.
col number of cells col.
text new cell text.

Definition at line 347 of file grid.cpp.

References CATCHEXCEPT, EXCEPT, m_sMaxStr, m_sMinStr, and m_vecTable.

Referenced by EditOnMessage(), and OnMessage().

void MWidgets::Grid::SetRowHeight ( int  index,
int  h 
)

Set height for specified row.

Parameters:
index row number.
h new row height.

Definition at line 289 of file grid.cpp.

References CATCHEXCEPT, EXCEPT, m_iFixedRowHeight, m_iTableHeight, m_nFixedRowCount, and m_vecRowsHeights.

Referenced by ResizeToAlignCol(), ResizeToMaxSize(), and ResizeToMinSize().

void MWidgets::Grid::SetSize ( int  rows,
int  cols 
)

Set table size.

Set number of columns and rows for table.

Parameters:
rows rows number.
cols columns number.

Definition at line 180 of file grid.cpp.

References m_iDefColWidth, m_iDefRowHeight, m_iTableHeight, m_iTableWidth, m_vecColsWidths, m_vecRowsHeights, and m_vecTable.

void MWidgets::Grid::SetTextAlign ( TextAlign  align  ) 

Set text align.

Set text align mode for cells.

Parameters:
align align mode.

Definition at line 284 of file grid.cpp.

References m_TextAlign.

void MWidgets::Grid::SetTextMargins ( int  l,
int  t,
int  r,
int  b 
)

Set cell text margins.

Parameters:
l left margin in pixels.
t top margin in pixels.
r right margin in pixels.
b bottom margin in pixels.

Definition at line 339 of file grid.cpp.

References m_iBottomMargin, m_iLeftMargin, m_iRightMargin, and m_iTopMargin.

void MWidgets::Grid::ShowCellEdit ( bool  replace,
string  str = "" 
) [protected]

Show edit box for entering text to focused cell.

Parameters:
replace if equals "false" then text that apears in edit box takes from cell,else from param "str".
str text that epears in edit box if replace==true.

Definition at line 1732 of file grid.cpp.

References EnsureVisible(), GetCellRect(), GetItemText(), m_hWndEdit, m_iCurCol, and m_iCurRow.

Referenced by OnMessage().

void MWidgets::Grid::TestCellMovingCopieng ( int  xPos,
int  yPos 
) [protected]

Test mouse position for moving over cell draging/copieng area.

Parameters:
x mouse coord X.
y mouse coord Y.

Definition at line 2171 of file grid.cpp.

References m_bCellCopiengMode, m_bCellMovingMode, m_bCellOnCopiengArea, m_bCellOnMoveArea, m_bColMovingMode, m_bEditingMode, m_bResizeMode, m_bRowMovingMode, m_hCrossCur, m_hMovingCur, m_iResizeCol, m_iResizeRow, m_regCellCopieng, and m_regCellMoving.

Referenced by OnMessage().

void MWidgets::Grid::TestColRowMoving ( int  xPos,
int  yPos 
) [protected]

Test mouse position for moving over col/row draging area.

Parameters:
x mouse coord X.
y mouse coord Y.

Definition at line 2144 of file grid.cpp.

References m_bCellCopiengMode, m_bCellMovingMode, m_bColMovingMode, m_bColRowOnMoveArea, m_bEditingMode, m_bResizeMode, m_bRowMovingMode, m_hMovingCur, m_iResizeCol, m_iResizeRow, m_regColMoving, and m_regRowMoving.

Referenced by OnMessage().

void MWidgets::Grid::TestColRowResizing ( int  x,
int  y 
) [protected]

Test mouse position for moving over col/row resizing area.

Parameters:
x mouse coord X.
y mouse coord Y.

Definition at line 1823 of file grid.cpp.

References MWidgets::Widget::GetParent(), m_bCellCopiengMode, m_bCellMovingMode, m_bColMovingMode, m_bEditingMode, m_bOnResizeArea, m_bResizeMode, m_bRowMovingMode, m_hHorzSizeCur, m_hVertSizeCur, m_iFixedColWidth, m_iFixedRowHeight, m_iMinVisCol, m_iMinVisRow, m_iResizeCol, m_iResizeRow, m_nFixedRowCount, m_vecColsWidths, m_vecRowsHeights, and m_vecTable.

Referenced by OnMessage().


Member Data Documentation

bool MWidgets::Grid::m_bCellCopiengMode [protected]

Equals "true" if we copieng cells.

Definition at line 90 of file grid.h.

Referenced by Grid(), TestCellMovingCopieng(), TestColRowMoving(), and TestColRowResizing().

bool MWidgets::Grid::m_bCellMovingMode [protected]

Equals "true" if we drag cells.

Definition at line 89 of file grid.h.

Referenced by Grid(), TestCellMovingCopieng(), TestColRowMoving(), and TestColRowResizing().

bool MWidgets::Grid::m_bCellOnCopiengArea [protected]

Equals "true" if mouse is over cell copieng area.

Definition at line 88 of file grid.h.

Referenced by Grid(), and TestCellMovingCopieng().

bool MWidgets::Grid::m_bCellOnMoveArea [protected]

Equals "true" if mouse is over cell draging area.

Definition at line 87 of file grid.h.

Referenced by Grid(), and TestCellMovingCopieng().

bool MWidgets::Grid::m_bColMovingMode [protected]

Equals "true" if we drag cols.

Definition at line 83 of file grid.h.

Referenced by Grid(), OnMessage(), TestCellMovingCopieng(), TestColRowMoving(), and TestColRowResizing().

bool MWidgets::Grid::m_bColRowOnMoveArea [protected]

Equals "true" if mouse is over col/row draging area.

Definition at line 81 of file grid.h.

Referenced by Grid(), OnMessage(), and TestColRowMoving().

bool MWidgets::Grid::m_bColSeletion [protected]

Equals "true" if we move mouse for selction only cols.

Definition at line 71 of file grid.h.

Referenced by Grid(), and OnMessage().

bool MWidgets::Grid::m_bEditingMode [protected]

Equals "true" if table shows editing box.

Definition at line 69 of file grid.h.

Referenced by EditOnMessage(), Grid(), OnMessage(), TestCellMovingCopieng(), TestColRowMoving(), and TestColRowResizing().

bool MWidgets::Grid::m_bOnResizeArea [protected]

Equals "true" if mouse is over col/row resize area.

Definition at line 75 of file grid.h.

Referenced by Grid(), OnMessage(), and TestColRowResizing().

bool MWidgets::Grid::m_bResizeMode [protected]

Equals "true" if user start to resize col or row.

Definition at line 76 of file grid.h.

Referenced by Grid(), OnMessage(), TestCellMovingCopieng(), TestColRowMoving(), and TestColRowResizing().

bool MWidgets::Grid::m_bRowMovingMode [protected]

Equals "true" if we drag rows.

Definition at line 82 of file grid.h.

Referenced by Grid(), OnMessage(), TestCellMovingCopieng(), TestColRowMoving(), and TestColRowResizing().

bool MWidgets::Grid::m_bRowSeletion [protected]

Equals "true" if we move mouse for selction only rows.

Definition at line 72 of file grid.h.

Referenced by Grid(), and OnMessage().

bool MWidgets::Grid::m_bSelectionMode [protected]

Equals "true" if we move mouse for selction.

Definition at line 70 of file grid.h.

Referenced by Grid(), and OnMessage().

COLORREF MWidgets::Grid::m_dwDefCellColor [protected]

Default normal cell color.

Definition at line 111 of file grid.h.

Referenced by DrawNormal(), Grid(), and SetDefCellColor().

COLORREF MWidgets::Grid::m_dwDefFixedCellColor [protected]

Default fixed cell color.

Definition at line 110 of file grid.h.

Referenced by DrawFixed(), Grid(), and SetDefFixedCellColor().

DWORD MWidgets::Grid::m_dwSelctionOP [protected]

Operation for combining selction and dest rects.

Definition at line 103 of file grid.h.

Referenced by DrawFixed(), DrawNormal(), and Grid().

WNDPROC MWidgets::Grid::m_EditWndProc [protected]

Window procedure for edit box.

Definition at line 49 of file grid.h.

Referenced by Create(), EditOnMessage(), and Grid().

HCURSOR MWidgets::Grid::m_hArrowCur [protected]

Standart Arrow cursor.

Definition at line 54 of file grid.h.

HPEN MWidgets::Grid::m_hBlackPen1 [protected]

Black pen object, width 1 pixel.

Definition at line 107 of file grid.h.

Referenced by DrawFixed(), DrawNormal(), Grid(), and ~Grid().

HPEN MWidgets::Grid::m_hBlackPen2 [protected]

Black pen object, width 2 pixel.

Definition at line 106 of file grid.h.

Referenced by Grid(), and ~Grid().

HPEN MWidgets::Grid::m_hBlackPen3 [protected]

Black pen object, width 3 pixel.

Definition at line 105 of file grid.h.

Referenced by Grid(), and ~Grid().

HCURSOR MWidgets::Grid::m_hCrossCur [protected]

Cursor for special cells copieng.

Definition at line 53 of file grid.h.

Referenced by Create(), Grid(), TestCellMovingCopieng(), and ~Grid().

HFONT MWidgets::Grid::m_hFont [protected]

Main table font.

Definition at line 61 of file grid.h.

Referenced by Draw(), Grid(), ResizeToAlignCol(), ResizeToMaxSize(), ResizeToMinSize(), SetFont(), and ~Grid().

HCURSOR MWidgets::Grid::m_hHorzSizeCur [protected]

Cursor for col resing.

Definition at line 51 of file grid.h.

Referenced by Create(), Grid(), OnMessage(), TestColRowResizing(), and ~Grid().

HCURSOR MWidgets::Grid::m_hMovingCur [protected]

Cursor for moving/draging.

Definition at line 52 of file grid.h.

Referenced by Create(), OnMessage(), TestCellMovingCopieng(), TestColRowMoving(), and ~Grid().

HBRUSH MWidgets::Grid::m_hSelectionBrush [protected]

Brush used for selection drawing.

Definition at line 104 of file grid.h.

Referenced by DrawFixed(), DrawNormal(), Grid(), and ~Grid().

HCURSOR MWidgets::Grid::m_hVertSizeCur [protected]

Cursor for row resing.

Definition at line 50 of file grid.h.

Referenced by Create(), Grid(), OnMessage(), TestColRowResizing(), and ~Grid().

HPEN MWidgets::Grid::m_hWhitePen [protected]

White pen object.

Definition at line 108 of file grid.h.

Referenced by DrawFixed(), Grid(), and ~Grid().

HWND MWidgets::Grid::m_hWndEdit [protected]

Edit box's HWND. Used for entering text to cells.

Definition at line 48 of file grid.h.

Referenced by Create(), Grid(), HideCellEdit(), and ShowCellEdit().

int MWidgets::Grid::m_iBottomMargin [protected]

Bottom margin in pixels.

Definition at line 66 of file grid.h.

Referenced by DrawFixed(), DrawNormal(), Grid(), ResizeToAlignCol(), ResizeToMaxSize(), ResizeToMinSize(), and SetTextMargins().

int MWidgets::Grid::m_iBroderWidth [protected]

Cell border width.

Definition at line 109 of file grid.h.

Referenced by Draw(), Grid(), SetFixedColCount(), and SetFixedRowCount().

int MWidgets::Grid::m_iCurCol [protected]

Focused column number,also min selected.

Definition at line 97 of file grid.h.

Referenced by Draw(), DrawFixed(), DrawNormal(), EditOnMessage(), GetFocusCellCol(), Grid(), OnMessage(), SetFixedColCount(), and ShowCellEdit().

int MWidgets::Grid::m_iCurRow [protected]

Focused row number,also min selected.

Definition at line 96 of file grid.h.

Referenced by Draw(), DrawFixed(), DrawNormal(), EditOnMessage(), GetFocusCellRow(), Grid(), OnMessage(), SetFixedRowCount(), and ShowCellEdit().

int MWidgets::Grid::m_iDefColWidth [protected]

Default column width.

Definition at line 67 of file grid.h.

Referenced by Grid(), SetDefColWidth(), and SetSize().

int MWidgets::Grid::m_iDefRowHeight [protected]

Default row height.

Definition at line 68 of file grid.h.

Referenced by Grid(), SetDefRowHeight(), and SetSize().

int MWidgets::Grid::m_iFixedColWidth [protected]

Width of all fixed columns,in pixels.

Definition at line 112 of file grid.h.

Referenced by Draw(), GetCellByPoint(), GetCellRect(), GetFixedCellByPoint(), Grid(), OnMessage(), RecalculateVisibles(), SetColWidth(), SetFixedColCount(), and TestColRowResizing().

int MWidgets::Grid::m_iFixedRowHeight [protected]

Height of all fixed rows,in pixels.

Definition at line 113 of file grid.h.

Referenced by GetCellByPoint(), GetCellRect(), GetFixedCellByPoint(), Grid(), OnMessage(), RecalculateVisibles(), SetFixedRowCount(), SetRowHeight(), and TestColRowResizing().

int MWidgets::Grid::m_iLeftMargin [protected]

Left margin in pixels.

Definition at line 63 of file grid.h.

Referenced by DrawFixed(), DrawNormal(), Grid(), ResizeToAlignCol(), ResizeToMaxSize(), ResizeToMinSize(), and SetTextMargins().

int MWidgets::Grid::m_iMaxVisCol [protected]

Number of maximum visible col.

Definition at line 121 of file grid.h.

Referenced by Draw(), EnsureVisible(), Grid(), OnMessage(), and RecalculateVisibles().

int MWidgets::Grid::m_iMaxVisRow [protected]

Number of maximum visible row.

Definition at line 119 of file grid.h.

Referenced by EnsureVisible(), Grid(), OnMessage(), and RecalculateVisibles().

int MWidgets::Grid::m_iMinVisCol [protected]

Number of minimum visible col.

Definition at line 120 of file grid.h.

Referenced by Draw(), EnsureVisible(), GetCellByPoint(), GetCellRect(), GetFixedCellByPoint(), Grid(), OnMessage(), RecalculateVisibles(), and TestColRowResizing().

int MWidgets::Grid::m_iMinVisRow [protected]

Number of minimum visible row.

Definition at line 118 of file grid.h.

Referenced by EnsureVisible(), GetCellByPoint(), GetCellRect(), GetFixedCellByPoint(), Grid(), OnMessage(), RecalculateVisibles(), and TestColRowResizing().

int MWidgets::Grid::m_iPrevResizeVal [protected]

Used for calculating resing value.

Definition at line 79 of file grid.h.

Referenced by Grid(), OnMessage(), ResizeCol(), and ResizeRow().

int MWidgets::Grid::m_iResizeCol [protected]

Resizing col number,default value "-1".

Definition at line 78 of file grid.h.

Referenced by Grid(), OnMessage(), ResizeCol(), TestCellMovingCopieng(), TestColRowMoving(), and TestColRowResizing().

int MWidgets::Grid::m_iResizeRow [protected]

Resizing row number,default value "-1".

Definition at line 77 of file grid.h.

Referenced by Grid(), OnMessage(), ResizeRow(), TestCellMovingCopieng(), TestColRowMoving(), and TestColRowResizing().

int MWidgets::Grid::m_iRightMargin [protected]

Right margin in pixels.

Definition at line 65 of file grid.h.

Referenced by DrawFixed(), DrawNormal(), Grid(), ResizeToAlignCol(), ResizeToMaxSize(), ResizeToMinSize(), and SetTextMargins().

int MWidgets::Grid::m_iSelCol [protected]

Max selected column number.

Definition at line 100 of file grid.h.

Referenced by Draw(), DrawFixed(), DrawNormal(), Grid(), OnMessage(), and SetFixedColCount().

int MWidgets::Grid::m_iSelRow [protected]

Max selected row number.

Definition at line 99 of file grid.h.

Referenced by Draw(), DrawFixed(), DrawNormal(), Grid(), OnMessage(), and SetFixedRowCount().

int MWidgets::Grid::m_iTableHeight [protected]

Table height,in pixels.

Definition at line 115 of file grid.h.

Referenced by Grid(), RecalculateVisibles(), SetRowHeight(), and SetSize().

int MWidgets::Grid::m_iTableWidth [protected]

Table width,in pixels.

Definition at line 114 of file grid.h.

Referenced by Grid(), RecalculateVisibles(), SetColWidth(), and SetSize().

int MWidgets::Grid::m_iTopMargin [protected]

Top margin in pixels.

Definition at line 64 of file grid.h.

Referenced by DrawFixed(), DrawNormal(), Grid(), ResizeToAlignCol(), ResizeToMaxSize(), ResizeToMinSize(), and SetTextMargins().

int MWidgets::Grid::m_nFixedColCount [protected]

Fixed column number.

Definition at line 56 of file grid.h.

Referenced by Draw(), Grid(), SetColWidth(), and SetFixedColCount().

int MWidgets::Grid::m_nFixedRowCount [protected]

Fixed rows number.

Definition at line 57 of file grid.h.

Referenced by Draw(), EditOnMessage(), EnsureVisible(), GetCellByPoint(), GetCellRect(), GetFixedCellByPoint(), Grid(), OnMessage(), RecalculateVisibles(), ResizeToAlignCol(), ResizeToMaxSize(), ResizeToMinSize(), SetFixedRowCount(), SetRowHeight(), and TestColRowResizing().

HRGN MWidgets::Grid::m_regCellCopieng [protected]

This region used for testing mouse position over cols moving rect, created in.

See also:
Draw.

Definition at line 92 of file grid.h.

Referenced by Grid(), TestCellMovingCopieng(), and ~Grid().

HRGN MWidgets::Grid::m_regCellMoving [protected]

This region used for testing mouse position over cols moving rect, created in.

See also:
Draw.

Definition at line 91 of file grid.h.

Referenced by Grid(), TestCellMovingCopieng(), and ~Grid().

HRGN MWidgets::Grid::m_regColMoving [protected]

This region used for testing mouse position over cols moving rect, created in.

See also:
Draw.

Definition at line 84 of file grid.h.

Referenced by Grid(), TestColRowMoving(), and ~Grid().

HRGN MWidgets::Grid::m_regRowMoving [protected]

This region used for testing mouse position over cols moving rect, created in.

See also:
Draw.

Definition at line 85 of file grid.h.

Referenced by Grid(), TestColRowMoving(), and ~Grid().

std::string MWidgets::Grid::m_sMaxStr [protected]

Definition at line 125 of file grid.h.

Referenced by ResizeToMaxSize(), and SetItemText().

std::string MWidgets::Grid::m_sMinStr [protected]

Definition at line 124 of file grid.h.

Referenced by ResizeToMinSize(), and SetItemText().

TextAlign MWidgets::Grid::m_TextAlign [protected]

Table text align mode.

Definition at line 62 of file grid.h.

Referenced by DrawFixed(), DrawNormal(), Grid(), and SetTextAlign().

vector<int> MWidgets::Grid::m_vecColsWidths [protected]

Array of colunms widths.

Definition at line 59 of file grid.h.

Referenced by Draw(), DrawFixed(), DrawNormal(), GetCellByPoint(), GetCellRect(), GetFixedCellByPoint(), OnMessage(), RecalculateVisibles(), ResizeCol(), SetColWidth(), SetFixedColCount(), SetSize(), and TestColRowResizing().

vector<int> MWidgets::Grid::m_vecRowsHeights [protected]

Array of rows heights.

Definition at line 60 of file grid.h.

Referenced by Draw(), DrawFixed(), DrawNormal(), EditOnMessage(), GetCellByPoint(), GetCellRect(), GetFixedCellByPoint(), OnMessage(), RecalculateVisibles(), ResizeRow(), SetFixedRowCount(), SetRowHeight(), SetSize(), and TestColRowResizing().

vector<CellArray> MWidgets::Grid::m_vecTable [protected]

Main cells table.

Definition at line 58 of file grid.h.

Referenced by Draw(), DrawFixed(), DrawNormal(), EnsureVisible(), GetCellByPoint(), GetCellRect(), GetFixedCellByPoint(), GetItemText(), OnMessage(), RecalculateVisibles(), ResizeToAlignCol(), ResizeToMaxSize(), ResizeToMinSize(), SetItemBackColor(), SetItemData(), SetItemForeColor(), SetItemText(), SetSize(), and TestColRowResizing().


The documentation for this class was generated from the following files:
Generated on Thu Oct 26 13:47:46 2006 for MWidgets by  doxygen 1.4.7