summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Browser.H11
-rw-r--r--src/Fl_Browser.cxx19
2 files changed, 23 insertions, 7 deletions
diff --git a/FL/Fl_Browser.H b/FL/Fl_Browser.H
index 27ea6a84e..69156991c 100644
--- a/FL/Fl_Browser.H
+++ b/FL/Fl_Browser.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Browser.H,v 1.6 1999/01/07 19:16:51 mike Exp $"
+// "$Id: Fl_Browser.H,v 1.7 1999/01/30 00:39:26 carl Exp $"
//
// Browser header file for the Fast Light Tool Kit (FLTK).
//
@@ -72,8 +72,13 @@ public:
void clear();
int size() const {return lines;}
+
int topline() const ;
- void topline(int);
+ enum Fl_Line_Position { TOP, BOTTOM, MIDDLE };
+ void lineposition(int, Fl_Line_Position);
+ void topline(int l) { lineposition(l, TOP); }
+ void bottomline(int l) { lineposition(l, BOTTOM); }
+ void middleline(int l) { lineposition(l, MIDDLE); }
int select(int, int=1);
int selected(int) const ;
@@ -108,5 +113,5 @@ public:
#endif
//
-// End of "$Id: Fl_Browser.H,v 1.6 1999/01/07 19:16:51 mike Exp $".
+// End of "$Id: Fl_Browser.H,v 1.7 1999/01/30 00:39:26 carl Exp $".
//
diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx
index 211787a09..0d85a22d1 100644
--- a/src/Fl_Browser.cxx
+++ b/src/Fl_Browser.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Browser.cxx,v 1.6 1999/01/07 19:17:16 mike Exp $"
+// "$Id: Fl_Browser.cxx,v 1.7 1999/01/30 00:39:28 carl Exp $"
//
// Browser widget for the Fast Light Tool Kit (FLTK).
//
@@ -356,14 +356,25 @@ Fl_Browser::Fl_Browser(int x, int y, int w, int h, const char*l)
first = last = cache = 0;
}
-void Fl_Browser::topline(int line) {
+void Fl_Browser::lineposition(int line, Fl_Line_Position pos) {
if (line<1) line = 1;
if (line>lines) line = lines;
int p = 0;
for (FL_BLINE* l=first; l&& line>1; l = l->next) {
line--; p += item_height(l);
}
- position(p);
+
+ int final = p, X, Y, W, H;
+ bbox(X, Y, W, H);
+
+ switch(pos) {
+ case TOP: break;
+ case BOTTOM: final -= H; break;
+ case MIDDLE: final -= H/2; break;
+ }
+
+ if (final > (full_height() - H)) final = full_height() -H;
+ position(final);
}
int Fl_Browser::topline() const {
@@ -440,5 +451,5 @@ int Fl_Browser::value() const {
}
//
-// End of "$Id: Fl_Browser.cxx,v 1.6 1999/01/07 19:17:16 mike Exp $".
+// End of "$Id: Fl_Browser.cxx,v 1.7 1999/01/30 00:39:28 carl Exp $".
//