virtual BOOL on_mouse(HELEMENT he, HELEMENT target, UINT event_type, POINT pt, UINT mouseButtons, UINT keyboardStates ) { if( event_type != MOUSE_DOWN && event_type != MOUSE_DCLICK ) return false; if(mouseButtons != MAIN_MOUSE_BUTTON) return false; // el must be table; dom::element table = he; dom::element row = target_row(table, dom::element(target)); if(row.is_valid()) // click on the row { if( (int)row.index() < (int)fixed_rows(table) ) { // click on the header cell dom::element header_cell = target_header(row,target); if( header_cell.is_valid() ) on_column_click(table, header_cell); return true; } set_current_row(table, row, keyboardStates, event_type == MOUSE_DCLICK); } return true; // as it is always ours then stop event bubbling }
virtual BOOL on_mouse(HELEMENT he, HELEMENT target, UINT event_type, POINT pt, UINT mouseButtons, UINT keyboardStates ) { dom::element table = he; if(event_type == MOUSE_WHEEL) { table.post_event(WY_GRID_VERTICAL_SCROLL, SCROLL_STEP_PLUS); } if( event_type != (MOUSE_DOWN | SINKING) && event_type != MOUSE_DCLICK ) return false; //if(mouseButtons != MAIN_MOUSE_BUTTON) // return false; // el must be table; dom::element row = target_row(table, dom::element(target)); if(row.is_valid()) // click on the row { if( (int)row.index() < (int)fixed_rows(table) ) { // click on the header cell dom::element header_cell = target_header(row,target); if( header_cell.is_valid() ) on_column_click(table, header_cell); return mouseButtons == MAIN_MOUSE_BUTTON; } set_current_row(table, row, keyboardStates, event_type == MOUSE_DCLICK); HTMLayoutUpdateWindow(table.get_element_hwnd(false)); } return FALSE;//mouseButtons == MAIN_MOUSE_BUTTON; // as it is always ours then stop event bubbling }
virtual BOOL on_mouse(HELEMENT he, HELEMENT target, UINT event_type, POINT pt, UINT mouseButtons, UINT keyboardStates ) { if( event_type == MOUSE_WHEEL ) { int dir = (int)mouseButtons; return on_scroll( he, target, dir < 0? SCROLL_STEP_PLUS : SCROLL_STEP_MINUS, 0, TRUE ); } if( event_type != MOUSE_DOWN && event_type != MOUSE_DCLICK ) return false; if(mouseButtons != MAIN_MOUSE_BUTTON) return false; dom::element table = get_table(he); dom::element row = target_row(table, dom::element(target)); if(row.is_valid()) // click on the row { if( (int)row.index() < (int)fixed_rows(table) ) { // click on the header cell dom::element header_cell = target_header(row,target); if( header_cell.is_valid() ) on_column_click(table, header_cell); return true; } set_current_row(table, row, keyboardStates, event_type == MOUSE_DCLICK); } return true; // as it is always ours then stop event bubbling }
dom::element target_header(const dom::element& header_row, const dom::element& target) { if( !target.is_valid() || target.parent() == header_row) return target; return target_header(header_row,target.parent()); }