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
This commit is contained in:
Greg Ercolano 2011-07-17 16:40:41 +00:00
parent 46d9c45536
commit 6fa9df7e90
3 changed files with 14 additions and 2 deletions

View File

@ -26,6 +26,7 @@
// TODO: // TODO:
// o Auto scroll during dragged selection // o Auto scroll during dragged selection
// o Keyboard navigation (up/down/left/right arrow) // o Keyboard navigation (up/down/left/right arrow)
// o Add scrollbar_size() method and integer [breaks ABI]
// //
#ifndef _FL_TABLE_H #ifndef _FL_TABLE_H
@ -218,6 +219,7 @@ private:
int _auto_drag; int _auto_drag;
int _selecting; int _selecting;
//int _scrollbar_size; // TODO: BREAKS ABI
// An STL-ish vector without templates // An STL-ish vector without templates
class FL_EXPORT IntVector { class FL_EXPORT IntVector {
@ -1072,6 +1074,8 @@ public:
*/ */
void callback(Fl_Widget*, void*); void callback(Fl_Widget*, void*);
#endif #endif
//int scrollbar_size() const { // TODO: BREAKS ABI
//void scrollbar_size(int size) { // TODO: BREAKS ABI
}; };
#endif /*_FL_TABLE_H*/ #endif /*_FL_TABLE_H*/

View File

@ -30,7 +30,7 @@
#include <FL/fl_utf8.H> // currently only Windows and Linux #include <FL/fl_utf8.H> // currently only Windows and Linux
#endif #endif
#define SCROLLBAR_SIZE 16 #define SCROLLBAR_SIZE (Fl::scrollbar_size())
// Scroll display so 'row' is at top // Scroll display so 'row' is at top
void Fl_Table::row_position(int row) { 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. // Then tell the group to draw over us.
// //
void Fl_Table::draw() { 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 draw_cell(CONTEXT_STARTPAGE, 0, 0, // let user's drawing routine
tix, tiy, tiw, tih); // prep new page tix, tiy, tiw, tih); // prep new page

View File

@ -135,6 +135,7 @@ class ScrollBarSizeTest : public Fl_Group {
if ( strcmp(label,"A: Scroll Size") == 0 ) { if ( strcmp(label,"A: Scroll Size") == 0 ) {
brow_a->scrollbar_size(val); brow_a->scrollbar_size(val);
tree_a->scrollbar_size(val); tree_a->scrollbar_size(val);
//table_a->scrollbar_size(val); // awaiting method (ABI)
} else { } else {
Fl::scrollbar_size(val); Fl::scrollbar_size(val);
} }
@ -211,7 +212,7 @@ public:
"Scrollbar's size should change interactively as size sliders are changed.\n" "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" "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" "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); labelsize(10);
align(FL_ALIGN_INSIDE|FL_ALIGN_BOTTOM|FL_ALIGN_LEFT|FL_ALIGN_WRAP); align(FL_ALIGN_INSIDE|FL_ALIGN_BOTTOM|FL_ALIGN_LEFT|FL_ALIGN_WRAP);
} }