Skip to content

Commit

Permalink
Adds Fl_Browser::middleline(int) and Fl_Browser::bottomline(int).
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/trunk@257 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Carl E. Thompson committed Jan 30, 1999
1 parent 03ad382 commit 620d03e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
11 changes: 8 additions & 3 deletions 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).
//
Expand Down Expand Up @@ -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 ;
Expand Down Expand Up @@ -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 $".
//
19 changes: 15 additions & 4 deletions 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).
//
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 $".
//

0 comments on commit 620d03e

Please sign in to comment.