Author: greg.ercolano
Date: 2010-12-04 17:22:53 -0800 (Sat, 04 Dec 2010)
New Revision: 7950
Log:
CMP mods: bracing, doxygen fixes for code examples and #if DOXYGEN -> #if
FL_DOXYGEN.
Modified:
branches/branch-1.3/FL/Fl_Table.H
branches/branch-1.3/FL/Fl_Table_Row.H
branches/branch-1.3/src/Fl_Table.cxx
branches/branch-1.3/src/Fl_Table_Row.cxx
Modified: branches/branch-1.3/FL/Fl_Table.H
===================================================================
--- branches/branch-1.3/FL/Fl_Table.H 2010-12-05 00:38:16 UTC (rev 7949)
+++ branches/branch-1.3/FL/Fl_Table.H 2010-12-05 01:22:53 UTC (rev 7950)
@@ -386,12 +386,10 @@
\code
// This is called whenever Fl_Table wants you to draw a cell
- void MyTable::draw_cell(TableContext context, int R=0, int C=0, int X=0,
int Y=0, int W=0, int H=0)
- {
+ void MyTable::draw_cell(TableContext context, int R=0, int C=0, int X=0,
int Y=0, int W=0, int H=0) {
static char s[40];
sprintf(s, "%d/%d", R, C); // text for each cell
- switch ( context )
- {
+ switch ( context ) {
case CONTEXT_STARTPAGE: // Fl_Table telling us its
starting to draw page
fl_font(FL_HELVETICA, 16);
return;
@@ -487,9 +485,7 @@
*/
virtual void clear() { rows(0); cols(0); }
- // topline()
- // middleline()
- // bottomline()
+ // \todo: add topline(), middleline(), bottomline()
/**
Sets the kind of box drawn around the data table,
@@ -957,7 +953,7 @@
Fl_Widget::do_callback();
}
-#if DOXYGEN
+#if FL_DOXYGEN
/**
The Fl_Widget::when() function is used to set a group of flags, determining
when the widget callback is called:
@@ -989,7 +985,7 @@
void when(Fl_When flags);
#endif
-#if DOXYGEN
+#if FL_DOXYGEN
/**
Callbacks will be called depending on the setting of Fl_Widget::when().
@@ -1039,34 +1035,31 @@
</table>
\code
- class MyTable
- {
- [..]
+ class MyTable : public Fl_Table {
+ [..]
private:
- // Handle events that happen on the table
- void event_callback2()
- {
- int R = callback_row(), // row where event occurred
- C = callback_col(); // column where event occurred
- TableContext context = callback_context(); // which part of table
- fprintf(stderr, "callback: Row=%d Col=%d Context=%d Event=%d\n",
- R, C, (int)context, (int)Fl::event());
- }
+ // Handle events that happen on the table
+ void event_callback2() {
+ int R = callback_row(), // row where event
occurred
+ C = callback_col(); // column where event
occurred
+ TableContext context = callback_context(); // which part of table
+ fprintf(stderr, "callback: Row=%d Col=%d Context=%d Event=%d\n",
+ R, C, (int)context, (int)Fl::event());
+ }
- // Actual static callback
- static void event_callback(Fl_Widget*, void* data)
- {
- MyTable *o = (MyTable*)data;
- o->event_callback2();
- }
-
+ // Actual static callback
+ static void event_callback(Fl_Widget*, void* data) {
+ MyTable *o = (MyTable*)data;
+ o->event_callback2();
+ }
+
public:
- MyTable() // Constructor
- {
- [..]
- table.callback(&event_callback, (void*)this); // setup callback
- table.when(FL_WHEN_CHANGED|FL_WHEN_RELEASE); // when to call it
- }
+ // Constructor
+ MyTable() {
+ [..]
+ table.callback(&event_callback, (void*)this); // setup callback
+ table.when(FL_WHEN_CHANGED|FL_WHEN_RELEASE); // when to call it
+ }
};
\endcode
*/
Modified: branches/branch-1.3/FL/Fl_Table_Row.H
===================================================================
--- branches/branch-1.3/FL/Fl_Table_Row.H 2010-12-05 00:38:16 UTC (rev
7949)
+++ branches/branch-1.3/FL/Fl_Table_Row.H 2010-12-05 01:22:53 UTC (rev
7950)
@@ -37,13 +37,11 @@
/**
A table with row selection capabilities.
- This class implements a simple table of rows and columns that specializes in
- the selection of rows. This widget is similar in behavior to a "mail subject
- browser", similar to that found in mozilla, netscape and outlook mail
browsers.
+ This class implements a simple table with the ability to select
+ rows. This widget is similar to an Fl_Browser with columns. Most
+ methods of importance will be found in the Fl_Table widget, such
+ as Fl_Table::rows() and Fl_Table::cols().
- Most methods of importance will be found in the Fl_Table widget, such as
- Fl_Table::rows() and Fl_Table::cols().
-
To be useful it must be subclassed and at minimum the draw_cell()
method must be overridden to provide the content of the cells. This widget
does \em not manage the cell's data content; it is up to the parent
Modified: branches/branch-1.3/src/Fl_Table.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Table.cxx 2010-12-05 00:38:16 UTC (rev
7949)
+++ branches/branch-1.3/src/Fl_Table.cxx 2010-12-05 01:22:53 UTC (rev
7950)
@@ -424,14 +424,13 @@
if (lx > x() + w() - 20) {
Fl::e_x = x() + w() - 20;
if (hscrollbar->visible())
- ((Fl_Slider*)hscrollbar)->value(
- hscrollbar->clamp(hscrollbar->value() +
30));
+ ((Fl_Slider*)hscrollbar)->value(hscrollbar->clamp(hscrollbar->value() +
30));
hscrollbar->do_callback();
_dragging_x = Fl::e_x - 30;
}
else if (lx < (x() + row_header_width())) {
Fl::e_x = x() + row_header_width() + 1;
- if (hscrollbar->visible()) {
+ if (hscrollbar->visible()) {
((Fl_Slider*)hscrollbar)->value(hscrollbar->clamp(hscrollbar->value() -
30));
}
hscrollbar->do_callback();
@@ -514,7 +513,7 @@
if ( y > voff ) { y -= row_height(row); break; }
}
_row_position = toprow = ( row >= _rows ) ? (row - 1) : row;
- toprow_scrollpos = y; // OPTIMIZATION: save for later use
+ toprow_scrollpos = y; // OPTIMIZATION: save for later use
// Find bottom row
voff = vscrollbar->value() + tih;
for ( ; row < _rows; row++ ) {
Modified: branches/branch-1.3/src/Fl_Table_Row.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Table_Row.cxx 2010-12-05 00:38:16 UTC (rev
7949)
+++ branches/branch-1.3/src/Fl_Table_Row.cxx 2010-12-05 01:22:53 UTC (rev
7950)
@@ -45,16 +45,14 @@
void Fl_Table_Row::type(TableRowSelectMode val) {
_selectmode = val;
switch ( _selectmode ) {
- case SELECT_NONE:
- {
+ case SELECT_NONE: {
for ( int row=0; row<rows(); row++ ) {
_rowselect[row] = 0;
}
redraw();
break;
}
- case SELECT_SINGLE:
- {
+ case SELECT_SINGLE: {
int count = 0;
for ( int row=0; row<rows(); row++ ) {
if ( _rowselect[row] ) {
@@ -90,8 +88,7 @@
case SELECT_NONE:
return(-1);
- case SELECT_SINGLE:
- {
+ case SELECT_SINGLE: {
int oldval;
for ( int t=0; t<rows(); t++ ) {
if ( t == row ) {
@@ -111,8 +108,7 @@
break;
}
- case SELECT_MULTI:
- {
+ case SELECT_MULTI: {
int oldval = _rowselect[row];
if ( flag == 2 ) { _rowselect[row] ^= 1; }
else { _rowselect[row] = flag; }
@@ -138,8 +134,7 @@
if ( flag != 0 ) return;
//FALLTHROUGH
- case SELECT_MULTI:
- {
+ case SELECT_MULTI: {
char changed = 0;
if ( flag == 2 ) {
for ( int row=0; row<(int)_rowselect.size(); row++ ) {
@@ -204,8 +199,7 @@
select_row(R, 2); // toggle
break;
- case FL_SHIFT:
- {
+ case FL_SHIFT: {
select_row(R, 1);
if ( _last_row > -1 ) {
int srow = R, erow = _last_row;
@@ -234,8 +228,7 @@
}
break;
- case FL_DRAG:
- {
+ case FL_DRAG: {
if ( _dragging_select ) {
// Dragged off table edges? Handle scrolling
int offtop = toy - _last_y; // >0 if off top of
table
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit