424
424
if (lx > x() + w() - 20) {
425
425
Fl::e_x = x() + w() - 20;
426
426
if (hscrollbar->visible())
427
((Fl_Slider*)hscrollbar)->value(
428
hscrollbar->clamp(hscrollbar->value() + 30));
427
((Fl_Slider*)hscrollbar)->value(hscrollbar->clamp(hscrollbar->value() + 30));
429
428
hscrollbar->do_callback();
430
429
_dragging_x = Fl::e_x - 30;
432
431
else if (lx < (x() + row_header_width())) {
433
432
Fl::e_x = x() + row_header_width() + 1;
434
if (hscrollbar->visible()) {
433
if (hscrollbar->visible()) {
435
434
((Fl_Slider*)hscrollbar)->value(hscrollbar->clamp(hscrollbar->value() - 30));
437
436
hscrollbar->do_callback();
514
513
if ( y > voff ) { y -= row_height(row); break; }
516
515
_row_position = toprow = ( row >= _rows ) ? (row - 1) : row;
517
toprow_scrollpos = y; // OPTIMIZATION: save for later use
516
toprow_scrollpos = y; // OPTIMIZATION: save for later use
518
517
// Find bottom row
519
518
voff = vscrollbar->value() + tih;
520
519
for ( ; row < _rows; row++ ) {
991
990
ret = move_cursor(1, 0);
993
if ( Fl::event_state() & FL_SHIFT ) {
994
ret = move_cursor(0, -1); // shift-tab -> left
996
ret = move_cursor(0, 1); // tab -> right
994
1000
if (ret && Fl::focus() != this) {
995
1001
do_callback(CONTEXT_TABLE, -1, -1);
1034
1040
draw_cell(context, r, c, X, Y, W, H); // call users' function to draw it
1044
See if the cell at row \p r and column \p c is selected.
1045
\returns 1 if the cell is selected, 0 if not.
1037
1047
int Fl_Table::is_selected(int r, int c) {
1038
1048
int s_left, s_right, s_top, s_bottom;
1060
void Fl_Table::get_selection(int& s_top, int& s_left, int& s_bottom, int& s_right) {
1071
Gets the region of cells selected (highlighted).
1073
\param[in] row_top Returns the top row of selection area
1074
\param[in] col_left Returns the left column of selection area
1075
\param[in] row_bot Returns the bottom row of selection area
1076
\param[in] col_right Returns the right column of selection area
1078
void Fl_Table::get_selection(int& row_top, int& col_left, int& row_bot, int& col_right) {
1061
1079
if (select_col > current_col) {
1062
s_left = current_col;
1063
s_right = select_col;
1080
col_left = current_col;
1081
col_right = select_col;
1065
s_right = current_col;
1066
s_left = select_col;
1083
col_right = current_col;
1084
col_left = select_col;
1068
1086
if (select_row > current_row) {
1069
s_top = current_row;
1070
s_bottom = select_row;
1087
row_top = current_row;
1088
row_bot = select_row;
1072
s_bottom = current_row;
1090
row_bot = current_row;
1091
row_top = select_row;
1077
void Fl_Table::set_selection(int s_top, int s_left, int s_bottom, int s_right) {
1096
Sets the region of cells to be selected (highlighted).
1098
So for instance, set_selection(0,0,0,0) selects the top/left cell in the table.
1099
And set_selection(0,0,1,1) selects the four cells in rows 0 and 1, column 0 and 1.
1101
\param[in] row_top Top row of selection area
1102
\param[in] col_left Left column of selection area
1103
\param[in] row_bot Bottom row of selection area
1104
\param[in] col_right Right column of selection area
1106
void Fl_Table::set_selection(int row_top, int col_left, int row_bot, int col_right) {
1078
1107
damage_zone(current_row, current_col, select_row, select_col);
1079
current_col = s_left;
1080
current_row = s_top;
1081
select_col = s_right;
1082
select_row = s_bottom;
1108
current_col = col_left;
1109
current_row = row_top;
1110
select_col = col_right;
1111
select_row = row_bot;
1083
1112
damage_zone(current_row, current_col, select_row, select_col);