From 6fa9df7e90817a3572b01486869b684adf384ff2 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Sun, 17 Jul 2011 16:40:41 +0000 Subject: [PATCH] Fixing STR #2679; Fl_Table makes use of FLTK's Fl::scrollbar_size() global. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8863 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Table.H | 4 ++++ src/Fl_Table.cxx | 9 ++++++++- test/unittest_scrollbarsize.cxx | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/FL/Fl_Table.H b/FL/Fl_Table.H index 898ba1afa..bce1e5519 100644 --- a/FL/Fl_Table.H +++ b/FL/Fl_Table.H @@ -26,6 +26,7 @@ // TODO: // o Auto scroll during dragged selection // o Keyboard navigation (up/down/left/right arrow) +// o Add scrollbar_size() method and integer [breaks ABI] // #ifndef _FL_TABLE_H @@ -218,6 +219,7 @@ private: int _auto_drag; int _selecting; + //int _scrollbar_size; // TODO: BREAKS ABI // An STL-ish vector without templates class FL_EXPORT IntVector { @@ -1072,6 +1074,8 @@ public: */ void callback(Fl_Widget*, void*); #endif + //int scrollbar_size() const { // TODO: BREAKS ABI + //void scrollbar_size(int size) { // TODO: BREAKS ABI }; #endif /*_FL_TABLE_H*/ diff --git a/src/Fl_Table.cxx b/src/Fl_Table.cxx index 6b73879ce..070e9e545 100644 --- a/src/Fl_Table.cxx +++ b/src/Fl_Table.cxx @@ -30,7 +30,7 @@ #include // currently only Windows and Linux #endif -#define SCROLLBAR_SIZE 16 +#define SCROLLBAR_SIZE (Fl::scrollbar_size()) // Scroll display so 'row' is at top void Fl_Table::row_position(int row) { @@ -1117,6 +1117,13 @@ void Fl_Table::set_selection(int row_top, int col_left, int row_bot, int col_rig // Then tell the group to draw over us. // void Fl_Table::draw() { + // Check if scrollbar size changed + if ( ( vscrollbar && (SCROLLBAR_SIZE != vscrollbar->w()) ) || + ( hscrollbar && (SCROLLBAR_SIZE != hscrollbar->h()) ) ) { + // handle size change, min/max, table dim's, etc + table_resized(); + } + draw_cell(CONTEXT_STARTPAGE, 0, 0, // let user's drawing routine tix, tiy, tiw, tih); // prep new page diff --git a/test/unittest_scrollbarsize.cxx b/test/unittest_scrollbarsize.cxx index b3079d6f9..d173bcc16 100644 --- a/test/unittest_scrollbarsize.cxx +++ b/test/unittest_scrollbarsize.cxx @@ -135,6 +135,7 @@ class ScrollBarSizeTest : public Fl_Group { if ( strcmp(label,"A: Scroll Size") == 0 ) { brow_a->scrollbar_size(val); tree_a->scrollbar_size(val); + //table_a->scrollbar_size(val); // awaiting method (ABI) } else { Fl::scrollbar_size(val); } @@ -211,7 +212,7 @@ public: "Scrollbar's size should change interactively as size sliders are changed.\n" "Changing 'Global Scroll Size' should affect all three browser's scrollbars UNLESS\n" "the 'A: Scroll Size' slider is changed, in which case its value will take precedence\n" - "for 'Browser A', and the global size will only affect Browser B and C."); + "for the 'A' group of widgets. (NOTE: 'table_a' does not currently support this)"); labelsize(10); align(FL_ALIGN_INSIDE|FL_ALIGN_BOTTOM|FL_ALIGN_LEFT|FL_ALIGN_WRAP); }