Fix Fl_Browser::textsize(int) to adjust the scrollbars (STR #3057).
Setting a different text size didn't affect the scrollbars. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@11453 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
12d5c63bb8
commit
4db4c2910e
2
CHANGES
2
CHANGES
@ -100,6 +100,8 @@ CHANGES IN FLTK 1.3.4 RELEASED: ??? ?? 2016
|
||||
|
||||
Bug fixes
|
||||
|
||||
- Fl_Browser now correctly adjusts its scrollbars when the default
|
||||
text size is changed with textsize(int) (STR #3057).
|
||||
- Fixed Fl_Text_Display/Fl_Text_Editor slow scrolling, line number
|
||||
display, wrap mode "hiding" text behind scrollbars, and more
|
||||
scrollbar handling (alignment) (STR #3272).
|
||||
|
@ -3,7 +3,7 @@
|
||||
//
|
||||
// Browser header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2011 by Bill Spitzak and others.
|
||||
// Copyright 1998-2016 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -141,6 +141,17 @@ public:
|
||||
int size() const { return lines; }
|
||||
void size(int W, int H) { Fl_Widget::size(W, H); }
|
||||
|
||||
/**
|
||||
Gets the default text size (in pixels) for the lines in the browser.
|
||||
*/
|
||||
Fl_Fontsize textsize() const { return Fl_Browser_::textsize(); }
|
||||
|
||||
/*
|
||||
Sets the default text size for the lines in the browser to newSize.
|
||||
Defined and documented in Fl_Browser.cxx
|
||||
*/
|
||||
void textsize(Fl_Fontsize newSize);
|
||||
|
||||
int topline() const ;
|
||||
/** For internal use only? */
|
||||
enum Fl_Line_Position { TOP, BOTTOM, MIDDLE };
|
||||
|
@ -3,7 +3,7 @@
|
||||
//
|
||||
// Browser widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2010 by Bill Spitzak and others.
|
||||
// Copyright 1998-2016 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -650,6 +650,29 @@ int Fl_Browser::topline() const {
|
||||
return lineno(top());
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the default text size (in pixels) for the lines in the browser to \p newSize.
|
||||
|
||||
This method recalculates all item heights and caches the total height
|
||||
internally for optimization of later item changes. This can be slow
|
||||
if there are many items in the browser.
|
||||
|
||||
You \e may need to call redraw() to see the effect and to have the
|
||||
scrollbar positions recalculated.
|
||||
|
||||
You should set the text size \e before populating the browser with items
|
||||
unless you really need to \e change the size later.
|
||||
*/
|
||||
void Fl_Browser::textsize(Fl_Fontsize newSize) {
|
||||
Fl_Browser_::textsize(newSize);
|
||||
new_list();
|
||||
full_height_ = 0;
|
||||
if (lines == 0) return;
|
||||
for (FL_BLINE* itm=(FL_BLINE *)item_first(); itm; itm=(FL_BLINE *)item_next(itm)) {
|
||||
full_height_ += item_height(itm);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Removes all the lines in the browser.
|
||||
\see add(), insert(), remove(), swap(int,int), clear()
|
||||
|
@ -113,6 +113,7 @@ void Fl_Browser_::resize(int X, int Y, int W, int H) {
|
||||
hscrollbar.resize(
|
||||
X, scrollbar.align()&FL_ALIGN_TOP ? Y-scrollsize : Y+H,
|
||||
W, scrollsize);
|
||||
max_width = 0;
|
||||
}
|
||||
|
||||
// Cause minimal update to redraw the given item:
|
||||
|
Loading…
Reference in New Issue
Block a user