diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-01 18:03:10 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-06 20:28:20 +0200 |
| commit | f09e17c3c564e8310125a10c03397cbf473ff643 (patch) | |
| tree | 8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /test/table.cxx | |
| parent | b0e0c355edaa2e23148cb0260ada907aec930f05 (diff) | |
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files
The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
Diffstat (limited to 'test/table.cxx')
| -rw-r--r-- | test/table.cxx | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/test/table.cxx b/test/table.cxx index 5c4ab3e69..2e5f0f639 100644 --- a/test/table.cxx +++ b/test/table.cxx @@ -5,7 +5,7 @@ #include <stdio.h> #include <string.h> #ifdef _WIN32 -#include <stdlib.h> // atoi +#include <stdlib.h> // atoi #endif /* _WIN32 */ #include <FL/Fl.H> @@ -27,14 +27,14 @@ Fl_Simple_Terminal *G_tty = 0; class DemoTable : public Fl_Table_Row { private: - Fl_Color cell_bgcolor; // color of cell's bg color - Fl_Color cell_fgcolor; // color of cell's fg color + Fl_Color cell_bgcolor; // color of cell's bg color + Fl_Color cell_fgcolor; // color of cell's fg color protected: - void draw_cell(TableContext context, // table cell drawing - int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0); + void draw_cell(TableContext context, // table cell drawing + int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0); static void event_callback(Fl_Widget*, void*); - void event_callback2(); // callback for table events + void event_callback2(); // callback for table events public: DemoTable(int x, int y, int w, int h, const char *l=0) : Fl_Table_Row(x,y,w,h,l) @@ -42,7 +42,7 @@ public: cell_bgcolor = FL_WHITE; cell_fgcolor = FL_BLACK; callback(&event_callback, (void*)this); - end(); + end(); } ~DemoTable() { } Fl_Color GetCellFGColor() const { return(cell_fgcolor); } @@ -52,66 +52,66 @@ public: }; // Handle drawing all cells in table -void DemoTable::draw_cell(TableContext context, - int R, int C, int X, int Y, int W, int H) +void DemoTable::draw_cell(TableContext context, + int R, int C, int X, int Y, int W, int H) { static char s[40]; - sprintf(s, "%d/%d", R, C); // text for each cell + sprintf(s, "%d/%d", R, C); // text for each cell switch ( context ) { - case CONTEXT_STARTPAGE: - fl_font(FL_HELVETICA, 16); - return; - - case CONTEXT_COL_HEADER: - fl_push_clip(X, Y, W, H); - { - fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, col_header_color()); - fl_color(FL_BLACK); - fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); - } - fl_pop_clip(); - return; - - case CONTEXT_ROW_HEADER: - fl_push_clip(X, Y, W, H); - { - fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, row_header_color()); - fl_color(FL_BLACK); - fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); - } - fl_pop_clip(); - return; - - case CONTEXT_CELL: - { - fl_push_clip(X, Y, W, H); - { - // BG COLOR - fl_color( row_selected(R) ? selection_color() : cell_bgcolor); - fl_rectf(X, Y, W, H); - - // TEXT - fl_color(cell_fgcolor); - fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); - - // BORDER - fl_color(color()); - fl_rect(X, Y, W, H); - } - fl_pop_clip(); - return; - } - - case CONTEXT_TABLE: - G_tty->printf("TABLE CONTEXT CALLED\n"); - return; - - case CONTEXT_ENDPAGE: - case CONTEXT_RC_RESIZE: - case CONTEXT_NONE: - return; + case CONTEXT_STARTPAGE: + fl_font(FL_HELVETICA, 16); + return; + + case CONTEXT_COL_HEADER: + fl_push_clip(X, Y, W, H); + { + fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, col_header_color()); + fl_color(FL_BLACK); + fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); + } + fl_pop_clip(); + return; + + case CONTEXT_ROW_HEADER: + fl_push_clip(X, Y, W, H); + { + fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, row_header_color()); + fl_color(FL_BLACK); + fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); + } + fl_pop_clip(); + return; + + case CONTEXT_CELL: + { + fl_push_clip(X, Y, W, H); + { + // BG COLOR + fl_color( row_selected(R) ? selection_color() : cell_bgcolor); + fl_rectf(X, Y, W, H); + + // TEXT + fl_color(cell_fgcolor); + fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); + + // BORDER + fl_color(color()); + fl_rect(X, Y, W, H); + } + fl_pop_clip(); + return; + } + + case CONTEXT_TABLE: + G_tty->printf("TABLE CONTEXT CALLED\n"); + return; + + case CONTEXT_ENDPAGE: + case CONTEXT_RC_RESIZE: + case CONTEXT_NONE: + return; } } @@ -179,7 +179,7 @@ void setpositionrow_cb(Fl_Widget *w, void *data) { Fl_Input *in = (Fl_Input*)data; int toprow = atoi(in->value()); - if ( toprow < 0 || toprow >= G_table->rows() ) + if ( toprow < 0 || toprow >= G_table->rows() ) { fl_alert("Must be in range 0 thru #rows"); } else { G_table->row_position(toprow); } @@ -189,7 +189,7 @@ void setpositioncol_cb(Fl_Widget *w, void *data) { Fl_Input *in = (Fl_Input*)data; int leftcol = atoi(in->value()); - if ( leftcol < 0 || leftcol >= G_table->cols() ) + if ( leftcol < 0 || leftcol >= G_table->cols() ) { fl_alert("Must be in range 0 thru #cols"); } else { G_table->col_position(leftcol); } @@ -467,7 +467,7 @@ int main(int argc, char **argv) widgetbox.labelsize(12); widgetbox.textsize(12); widgetbox.menu(widgetbox_choices); - widgetbox.value(2); // down frame + widgetbox.value(2); // down frame Fl_Input tablecolor(400, 640, 120, 25, "Table Color"); tablecolor.labelsize(12); |
