Skip to content

Commit

Permalink
doxygen fixes:
Browse files Browse the repository at this point in the history
	o Docs added for set_selection(), get_selection(), is_selected()
	o Renamed confusing variable names for get/set selection functions.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7751 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
erco77 committed Oct 26, 2010
1 parent 3470079 commit e831cf9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 16 deletions.
4 changes: 2 additions & 2 deletions FL/Fl_Table.H
Expand Up @@ -816,8 +816,8 @@ public:
return(row_position());
}
int is_selected(int r, int c); // selected cell
void get_selection(int& s_top, int& s_left, int& s_bottom, int& s_right);
void set_selection(int s_top, int s_left, int s_bottom, int s_right);
void get_selection(int &row_top, int &col_left, int &row_bot, int &col_right);
void set_selection(int row_top, int col_left, int row_bot, int col_right);
int move_cursor(int R, int C);

/**
Expand Down
51 changes: 37 additions & 14 deletions src/Fl_Table.cxx
Expand Up @@ -1041,6 +1041,10 @@ void Fl_Table::_redraw_cell(TableContext context, int r, int c) {
draw_cell(context, r, c, X, Y, W, H); // call users' function to draw it
}

/**
See if the cell at row \p r and column \p c is selected.
\returns 1 if the cell is selected, 0 if not.
*/
int Fl_Table::is_selected(int r, int c) {
int s_left, s_right, s_top, s_bottom;

Expand All @@ -1064,29 +1068,48 @@ int Fl_Table::is_selected(int r, int c) {
return 0;
}

void Fl_Table::get_selection(int& s_top, int& s_left, int& s_bottom, int& s_right) {
/**
Gets the region of cells selected (highlighted).
\param[in] row_top Returns the top row of selection area
\param[in] col_left Returns the left column of selection area
\param[in] row_bot Returns the bottom row of selection area
\param[in] col_right Returns the right column of selection area
*/
void Fl_Table::get_selection(int& row_top, int& col_left, int& row_bot, int& col_right) {
if (select_col > current_col) {
s_left = current_col;
s_right = select_col;
col_left = current_col;
col_right = select_col;
} else {
s_right = current_col;
s_left = select_col;
col_right = current_col;
col_left = select_col;
}
if (select_row > current_row) {
s_top = current_row;
s_bottom = select_row;
row_top = current_row;
row_bot = select_row;
} else {
s_bottom = current_row;
s_top = select_row;
row_bot = current_row;
row_top = select_row;
}
}

void Fl_Table::set_selection(int s_top, int s_left, int s_bottom, int s_right) {
/**
Sets the region of cells to be selected (highlighted).
So for instance, set_selection(0,0,0,0) selects the top/left cell in the table.
And set_selection(0,0,1,1) selects the four cells in rows 0 and 1, column 0 and 1.
\param[in] row_top Top row of selection area
\param[in] col_left Left column of selection area
\param[in] row_bot Bottom row of selection area
\param[in] col_right Right column of selection area
*/
void Fl_Table::set_selection(int row_top, int col_left, int row_bot, int col_right) {
damage_zone(current_row, current_col, select_row, select_col);
current_col = s_left;
current_row = s_top;
select_col = s_right;
select_row = s_bottom;
current_col = col_left;
current_row = row_top;
select_col = col_right;
select_row = row_bot;
damage_zone(current_row, current_col, select_row, select_col);
}

Expand Down

0 comments on commit e831cf9

Please sign in to comment.