fltk::Browser Class Reference

Inherits fltk::Menu.

Inherited by fltk::ComboBrowser, fltk::FileBrowser, and fltk::MultiBrowser.

List of all members.

Classes

class  Mark

Public Types

enum  { IS_MULTI = 1, NORMAL = GROUP_TYPE, MULTI = GROUP_TYPE+1 }
enum  { NO_COLUMN_SELECTED = -1 }
enum  linepos { NOSCROLL, TOP, MIDDLE, BOTTOM }

Public Member Functions

bool at_mark (const Mark &mark) const
void bottomline (int line)
int box_height () const
int box_width () const
 Browser (int X, int Y, int W, int H, const char *l=0)
const char ** column_labels () const
void column_labels (const char **pLabels)
void column_widths (const int *pWidths)
const int * column_widths () const
int compare_to_mark (const Mark &mark) const
const int * current_index () const
int current_level () const
int current_position () const
void damage_item (const Mark &)
void damage_item ()
bool deselect (int do_callback=0)
bool display (int line, bool value=true)
bool display_lines () const
void display_lines (bool display)
bool displayed (int line)
void draw ()
const int * focus_index () const
int focus_level () const
int focus_position () const
Widgetgoto_focus ()
Widgetgoto_index (const int *indexes, unsigned level)
Widgetgoto_index (int)
Widgetgoto_index (int, int, int=-1, int=-1, int=-1)
Widgetgoto_mark (const Mark &)
Widgetgoto_position (int y)
Widgetgoto_top ()
const Symbolgroup_symbol () const
void group_symbol (const Symbol *s)
int handle (int)
Widgetheader (int col)
int height () const
bool indented () const
void indented (bool v)
int item_h () const
bool item_is_open () const
bool item_is_parent () const
bool item_is_visible () const
void layout ()
const Symbolleaf_symbol () const
void leaf_symbol (const Symbol *s)
int load (const char *filename)
bool make_item_visible (linepos=NOSCROLL)
void middleline (int line)
int multi () const
Widgetnext ()
Widgetnext_visible ()
int nheader () const
Widgetprevious_visible ()
bool select (int line, bool value=true)
bool select (Widget *e, int val, int do_callback=0)
bool select_only_this (int do_callback=0)
bool selected (int line)
int selected_column ()
int set_column_start (int column, int x)
bool set_focus ()
bool set_item_opened (bool)
bool set_item_selected (bool value=true, int do_callback=0)
bool set_item_visible (bool)
void set_mark (Mark &dest) const
void set_mark_to_focus (Mark &dest) const
int topline () const
void topline (int line)
int value () const
void value (int v)
int width () const
int xposition () const
void xposition (int)
int yposition () const
void yposition (int)
 ~Browser ()

Public Attributes

Scrollbar hscrollbar
 The horizontal scrollbar.
Scrollbar scrollbar
 The vertical scrollbar.

Static Public Attributes

static NamedStyledefault_style = &::style

Protected Member Functions

void handle_callback (int doit)

Private Types

enum  { NUM_REDRAW = 2 }

Private Member Functions

void clear_belowmouse ()
void draw_clip (const Rectangle &)
void draw_item (int)
Widgetgoto_visible_focus ()
void set_belowmouse ()
void set_level (unsigned)

Static Private Member Functions

static void column_click_cb_ (Widget *, void *)
static void draw_clip_cb (void *, const Rectangle &)
static void hscrollbar_cb (Widget *, void *)
static void scrollbar_cb (Widget *, void *)

Private Attributes

Mark BELOWMOUSE
 The Mark that's below the mouse.
const char ** column_labels_
 The labels to be used across the top of the Browser.
const int * column_widths_
 Original column widths.
int * column_widths_i
 Original column widths after user interaction.
int * column_widths_p
 Actual column widths.
bool displaylines_
 Flag to determine whether or not to draw lines.
Mark FIRST_VISIBLE
 The first visible item.
Mark FOCUS
 The item that has focus.
const Symbolgroup_symbol_
 The symbol used to draw parent items.
Widget ** header_
 The set of widgets heading each column.
int height_
 The height of all the visible items.
Mark HERE
 The current item.
bool indented_
 Flag to determine whether or not to draw + symbols.
Rectangle interior
 A Rectangle representing the area inside box edges and scrollbars.
const Symbolleaf_symbol_
 The symbol used to draw child items.
int nColumn
 The amount of columns.
int nHeader
 The amount of widgets heading each column.
Mark OPEN
 The item that has been opened.
Mark REDRAW [NUM_REDRAW]
 An array of Marks that need to be redrawn on the next call to redraw()
int scrolldx
 The amount the user has scrolled horizontally since the last redraw.
int scrolldy
 The amount the user has scrolled vertically since the last redraw.
int selected_column_
 The index of the currently selected column.
int siblings
 Number of children of the parent of the HERE item.
int width_
 The width of the longest item in the browser.
int xposition_
 The horizontal scrolling position.
int yposition_
 The vertical scrolling position.

Detailed Description

Displays a scrolling vertical list of text widgets, possibly with a hierarchical arrangement, and lets the user select one of them.

browser.gif

The items may be created as child widgets (usually the same widgets as are used to create menus: fltk::Item widgets, or fltk::ItemGroup widgets to make a hierarchy).

All the functions used to add, remove, or modify items in the list are defined by the base class fltk::Menu. See that for much more information. For a simple constant list you can populate the list by calling browser->add("text of item") once for each item.

See also:

You can also us an fltk::List which allows you to control the storage by dynamically creating a temporary "fake" widget for the browser to use each time it wants to look at or draw an item. This is useful for creating browsers with hundreds of thousands of items, or when the set of items changes rapidly.

If you give the browser a callback you can find out what item was selected with value(), the first item is zero (this is different from older versions of fltk that started at 1!), and will be negative if no item is selected. You can change the selected item with value(new_value).

The subclass fltk::MultiBrowser lets the user select more than one item at the same time.

The callback() is done when the user changes the selected items or when they open/close parents. In addition, if the user double-clicks a non-parent item, then it is "executed" which usually means that the callback() on the item itself is run. However, if no callback has been set on the item, the callback() of this widget is called with the user_data() of the item.

You can control when callbacks are done with the when() method. The following values are useful, the default value is fltk::WHEN_CHANGED.

  • fltk::WHEN_NEVER - Callback is never done. changed() can be used to see if the user has modified the browser.
  • fltk::WHEN_CHANGED - Callback is called on every change to each item as it happens. The method item() will return the one that is being changed. Notice that selecting large numbers in a mulit browser will produce large numbers of callbacks.
  • fltk::WHEN_RELEASE - Callback is done when the user releases the mouse after some changes, and on any keystroke that changes the item. For a multi browser you will only be able to find out all the changes by scanning all the items in the callback.
  • fltk::WHEN_RELEASE_ALWAYS - Callback is done when the user releases the mouse even if the current item has not changed, and on any arrow keystroke even when at the top or bottom of the browser.
  • fltk::WHEN_ENTER_KEY - If you turn this on then the enter key is a shortcut and executes the current item like double-click.

Member Enumeration Documentation

anonymous enum

Values for type()

Enumerator:
IS_MULTI 

added to make testing with type() & IS_MULTI easier

NORMAL 

means single selection can be achieved by user

MULTI 

means multiple selection can be achieved by user

anonymous enum

Values for selected_column

Enumerator:
NO_COLUMN_SELECTED 

means that no column has been selected by user

anonymous enum [private]

The maximum number of items to redraw at a time

Enumerator:
NUM_REDRAW 

At most 2 items can be redrawn at a time.

Argument to make_item_visible()

Enumerator:
NOSCROLL 

move as little as possible so item is visible

TOP 

position current item to top

MIDDLE 

position current item to middle

BOTTOM 

position current item to bottom


Constructor & Destructor Documentation

Browser::Browser ( int  X,
int  Y,
int  W,
int  H,
const char *  L = 0 
)

The constructor makes an empty browser.

Browser::~Browser ( )

The destructor deletes all the list items (because they are child fltk::Widgets of an fltk::Group) and destroys the browser.


Member Function Documentation

bool fltk::Browser::at_mark ( const Mark mark) const [inline]
Returns:
whether or not we're at the current Mark
void Browser::bottomline ( int  line) [inline]

Convenience function for non-hierarchial browsers.

Parameters:
lineMake the indexed item visible and scroll to put it at the bottom of the browser.
int Browser::box_height ( ) const [inline]
Returns:
The height of the display area of the browser in pixels, this is h() minus the edges of the box() minus the height of the horizontal scrollbar, if visible.

If this is changed (by resizing the widget, adding or deleting items or opening or closing a parent item such that the scrollbar visibility changes) then layout() must be called before this is correct.

int Browser::box_width ( ) const [inline]
Returns:
The width of the display area of the browser in pixels; this is w() minus the edges of the box() minus the width of the vertical scrollbar, if visible.

If this is changed (by resizing the widget, adding or deleting items or opening or closing a parent item such that the scrollbar visibility changes) then layout() must be called before this is correct.

void Browser::clear_belowmouse ( ) [private]

Indicates that nothing should be highlighted

void Browser::column_click_cb_ ( Widget ww,
void *  d 
) [static, private]

The callback that is triggered when the user clicks on a column header

Parameters:
wwThe widget that was clicked on
dAn integer representing the index of the column that was clicked, used to trigger the column's callback
const char** fltk::Browser::column_labels ( ) const [inline]
Returns:
a constant array of the labels used for columns
void Browser::column_labels ( const char **  t)

Set an array of labels to put at the top of the browser. The initial sizes of them are set with column_widths(). Items in the browser can print into the correct columns by putting '\t' characters into their text. Or they can look at fltk::column_widths() to find the settings from their draw() methods.

Parameters:
tA const char* array of labels
void Browser::column_widths ( const int *  t)

Sets the horizontal locations that each '\t' character in an item should start printing text at. These are measured from the left edge of the browser, including any area for the open/close + glyphs.

Parameters:
tA constant integer array, with the 'i'th position representing the width of column i

  • Array must end with 0 (zero) always
  • You can define flexible column by setting column width to -1. If you have flexible column in browser, all columns are resized to match width of the browser, by resizing flexible column.
  // Example 1: make three columns, total width of columns is 300 pixels.
  // Columns are resizable, but total width is kept always.
  const int widths[]   = { 100, 100, 100, 0 };

  // Example 2: make three columns, total width of columns is always width of the browser.
  // Columns are resizable, third column is flexible and will take remaining space left.
  const int widths[]   = { 100, 100, -1, 0 };
const int* fltk::Browser::column_widths ( ) const [inline]
Returns:
a constant pointer to the integer width of the columns
int fltk::Browser::compare_to_mark ( const Mark mark) const [inline]
Returns:
The values described in Mark::compare, based on the current position
const int * Browser::current_index ( ) const [inline]
Returns:
An array of current_level()+1 indexes saying which child at each level including the current item.
int Browser::current_level ( ) const [inline]
Returns:
The nesting level of the current item (how many parents it has).
int Browser::current_position ( ) const [inline]
Returns:
The y position, in pixels, of the top edge of the current item.

You may also want the height, which is in item_h().

void Browser::damage_item ( const Mark mark)

Set item referenced by this mark as being damaged.

Parameters:
markThe damaged item being referenced through its Mark
void Browser::damage_item ( ) [inline]

Tell the browser to redraw the current item. Do this if you know it has changed appearance. This is better than redrawing the entire browser because it will blink a lot less.

bool Browser::deselect ( int  do_callback = 0)

Turn off current selection of all items in the browser. For the regular Browser, this puts it in a special state where nothing is highlighted and index(0) returns -1. The user cannot get it into this state with the GUI.

For a MultiBrowser the user can get this state by ctrl+clicking the selected items off.

Parameters:
do_callbackIf do_callback has some bits that are also in when() then the callback is done for each item that changes selected state.
Returns:
true if there were items to turn off, false otherwise.
Todo:
CHECK THIS!
bool Browser::display ( int  line,
bool  value = true 
)

Convenience function for non-hierarchial browsers. Make the indexed item be visible() and scroll the browser so it can be seen by the user.

bool Browser::display_lines ( ) const

Accessor method

Returns:
true if lines should be displayed, or false otherwise
void Browser::display_lines ( bool  display)

Accessor (set) method which is used to set the value of the "displaylines_" member.

Parameters:
displayIf you set display to false it will mean that you do not want lines of the tree to be displayed.
bool Browser::displayed ( int  line)

Convenience function for non-hierarchial browsers.

Parameters:
lineThe line this item is on
Returns:
true if the indexed item is visible,
false otherwise
void Browser::draw ( void  ) [virtual]

The standard draw function. See Widget::draw

Reimplemented from fltk::Group.

void Browser::draw_clip ( const Rectangle r) [private]

Draws the Browser's clip region

Parameters:
rThe Rectangle representing the clip region
void Browser::draw_clip_cb ( void *  v,
const Rectangle r 
) [static, private]

The callback that forces the Browser to redraw the clip

Parameters:
vThe Browser that called this function
rThe Rectangle for the clip region
void Browser::draw_item ( int  damage) [private]

Draws the current item

Parameters:
damageIf damage is non-zero it draws the left-hand glyphs and OR's that damage into the item.
const int * Browser::focus_index ( ) const [inline]
Returns:
An array of focus_level()+1 indexes saying which child at each level includes the focus.

Reimplemented from fltk::Group.

int Browser::focus_level ( ) const [inline]
Returns:
The nesting level of the focus (how many parents it has). The focus is the selected item the user sees.
int Browser::focus_position ( ) const [inline]
Returns:
The y position, in pixels, of the top edge of the focus item.

You may also want the height, which is in

.

Widget * Browser::goto_focus ( ) [inline]

Sets the item() to the "focus" (the item with the dotted square in an fltk::MultiBrowser, and the selected item in a normal fltk::Browser.

Returns:
The focused Item's Widget.
Widget * Browser::goto_index ( int  a,
int  b,
int  c = -1,
int  d = -1,
int  e = -1 
)

Go to an item at any level up to 5. Negative numbers indicate that no more levels should be looked at.

Parameters:
aThe top level index
bThe child of the top level's index
cThe child of b's index
dThe child of c's index
eThe child of d's index
Widget * Browser::goto_index ( const int *  indexes,
unsigned  level 
)

Go to a nested item. This sets the current item() to the given item.

and also returns it. If the values are out of range then null is returned.

Parameters:
indexesAn integer array. indexes[0] must contain the index of the top-level item, indexes[1] must contain the index of the child of this top level item relative to the parent, and so on.
levelThe depth of the node to go to (and the length of indexes, + 1)

A negative number in indexes[0] will make it go into a special no-item state where select_only_this() will do deselect().

Returns:
NULL if the Browser is empty or a negative number was passed in index[0] (or the value(s) passed were out of range)
the Widget that was moved to otherwise
Widget * Browser::goto_index ( int  i)

Go to the i'th item in the top level. If i is out of range null is returned.

Parameters:
iThe item to go to
Returns:
The Widget the Browser has moved to, or NULL if this is out of range
Widget * Browser::goto_mark ( const Mark mark)

Go to a particular Mark

Parameters:
markThe Mark to traverse to
Returns:
The Widget referred to by this mark
Widget * Browser::goto_position ( int  Y)

Set the current item() to the last one whose top is at or before Y pixels from the top.

Parameters:
YThe minimum distance from the top
Returns:
The last Item's Widget whose top is at or before Y
Widget * Browser::goto_top ( )

Because of the hierarchial structure it is difficult to identify an item in the browser. Instead of passing an identifier to all the calls that can modify an item, the browser provides several calls to set item() based on various rules, and then calls to modify the current item().

This call sets item() to the very first visible widget in the browser. It returns the widget for that item, or null if the browser is empty.

If you have invisible items in the browser you should use goto_index(0) if you want to go to the first item even if it is invisible.

Returns:
the Widget for the very first visible Item, or NULL if this doesn't exist
Widget * Browser::goto_visible_focus ( ) [private]

Sets HERE to the currently focused widget, if it's visible

Returns:
A pointer to the widget with focus

Go to the focus if it is visible and return it. If it is not visible, go to the top of the visible region and return zero. This is used by keystrokes so the browser does not scroll unexpectedly.

Returns:
The Widget for the Item that holds the focus, if it's visible. Returns NULL otherwise
const Symbol* fltk::Browser::group_symbol ( ) const [inline]
Returns:
The symbol used to draw on each hierarchy parent item
Browser::group_symbol ( const Symbol s) [inline]

Sets a default value for image() on each item that is a hierarchy parent. If the parent item has no image() then this one is used for it.

Parameters:
sThe symbol to use for the image
int Browser::handle ( int  event) [virtual]

The Browser's custom handle function
See Widget::handle

Parameters:
eventThe event to be handled
Returns:
1 if the event was successfully handled, 0 otherwise

Reimplemented from fltk::Group.

void fltk::Browser::handle_callback ( int  doit) [protected]

Defines how callbacks are handled in the browser

Parameters:
doitno idea. This function looks NYI
Todo:
Implement it, if I can work out what it does
Widget * Browser::header ( int  col) [inline]
Parameters:
colThe index of the required column
Returns:
pointer to Widget in column col, starting from index 0. If column col is invalid, NULL is returned.
int Browser::height ( ) const [inline]
Returns:
The height of all the visible items in the browser, measured in pixels.

If this is changed (by adding or deleting items or opening or closing a parent item) then layout() must be called before this is correct.

void Browser::hscrollbar_cb ( Widget o,
void *   
) [static, private]

The callback to move horizontal scrollbar

Parameters:
oThe horizontal Scrollbar
bool fltk::Browser::indented ( ) const [inline]
Returns:
Whether or not indentation has been turned on, to facilitate drawing open/close boxes to the left of items
void Browser::indented ( bool  v) [inline]
Parameters:
vTurn this on to for space to be reserved for open/close boxes drawn to the left of top-level items. You usually want this for a hierarchial browser. This should be off for a flat browser, or to emulate Windows Explorer where "My Computer" does not have an open/close to the left of it.
The default value is false.
int Browser::item_h ( ) const

Gets the current item's height and calls layout if needed

Returns:
The current item's height.
bool Browser::item_is_open ( ) const
Returns:
true if item_is_parent() is true and this item is open.
If this is not a parent the result is undefined.
bool Browser::item_is_parent ( ) const
Returns:
true if the current item is a parent. Note that it may have zero children.
bool Browser::item_is_visible ( ) const
Returns:
true if the current item would be visible to the user if the browser was scrolled to the correct location. This means that the fltk::INVISIBLE flag is not set on it, and all parents of it are open and visible as well.
void Browser::layout ( ) [virtual]

The Browser's custom layout function
see Widget::layout

Reimplemented from fltk::Menu.

const Symbol* fltk::Browser::leaf_symbol ( ) const [inline]
Returns:
The symbol used to draw an item that is not a parent
Browser::leaf_symbol ( const Symbol s) [inline]

Sets a default value for image() on each item that is not a parent of other items. If the item has no image() then this one is used for it.

Parameters:
sThe symbol to use for the image
int Browser::load ( const char *  filename)

Adds the contents of a file to a browser, splitting at newlines. This is useful if the browser was storing items that should be saved on program exit and reloaded next time the program is started

Parameters:
filenameThe name of the file to load
Returns:
0 if the file couldn't be opened, -1 if filename is NULL or contains no text and 1 otherwise
bool Browser::make_item_visible ( linepos  where = NOSCROLL)

This makes the current item visible to the user.

First it turns off the fltk::INVISIBLE flag on the current item, and turns off the fltk::INVISIBLE flag and opens (turning on the fltk::STATE flag) all parent items. These flag changes cause flags_changed() to be called on any fltk::List that you have assigned to the browser.

The browser is then scrolled by calling yposition() so the item is visible.

Parameters:
whereThe optional argument tells how to scroll. If not specified (or the default value of fltk::Browser::NOSCROLL is given) then the browser is scrolled as little as possible to show the item. If it is fltk::Browser::TOP then the item is put at the top of the browser. If it is fltk::Browser::MIDDLE then the item is centered vertically in the browser. If it is fltk::Browser::BOTTOM then the item is put at the bottom of the browser.

This does nothing if the current item is null.

Returns:
false if the current item is null or the item was already visible
true otherwise
void Browser::middleline ( int  line) [inline]

Convenience function for non-hierarchial browsers.

Parameters:
lineMake the indexed item visible and scroll to put it in the middle of the browser if it is not already visible (passes NO_SCROLL to make_item_visible().
int fltk::Browser::multi ( ) const [inline]
Returns:
Whether or not this browser has its type() set to include MULTI
Widget * Browser::next ( )

Move the current item to the next item. If if is a parent it moves to the first child. If not a parent, it moves to the next child of it's parent. If it is the last child it moves to the parent's brother. Repeatedly calling this will visit every child of the browser.

Returns:
This returns the widget. If the current widget is the last one this returns null, but the current widget remains on the last one.

The current_position() is NOT set by this! It cannot be calculated efficiently and would slow down the use of this function for visiting all items.

Widget * Browser::next_visible ( )

Move forward to the next visible Item (what the down-arrow does). This does not move and returns null if we are at the bottom.

Returns:
The next visible Item's Widget or NULL if this isn't possible
int Browser::nheader ( ) const [inline]
Returns:
The number of columns in the Browser.
Widget * Browser::previous_visible ( )

Move backward to previous visible item: This does not move and returns null if we are at the top.

Returns:
The Widget of the previous Item, or NULL if this is not possible
void Browser::scrollbar_cb ( Widget o,
void *   
) [static, private]

The vertical Scrollbar callback

Parameters:
oThe vertical Scrollbar
bool Browser::select ( Widget e,
int  v,
int  do_callback = 0 
)

This is for use by the MultiBrowser subclass.
This method changes item position in the tree.

Parameters:
eUsed to select or deselect an Widget,
vtrue selects, false deselects
do_callbackoptionally execute a callback (calls set_item_selected() - see this for further documentation).
Returns:
Returns set_item_selected(); see this function for more information.
bool Browser::select ( int  line,
bool  value = true 
)

Same as goto_index(line),set_item_selected(value), to change the selected state of an item in a non-hierarchial MultiBrowser.

Parameters:
lineThe line of the widget to look at
valueFlag representing whether or not to select this item
Returns:
If line is out of range this returns false, else returns true.
bool Browser::select_only_this ( int  do_callback = 0)

Make an item be the only one selected. For the MultiBrowser subclass this will turn off selection of all other items and turn it on for this one and also set the focus here. If the selection changes and when() & do_callback is non-zero, the callback is done.

For the MultiBrowser, the callback is done for each item that changes, whether it turns on or off.

Parameters:
do_callbackLogical OR of WHEN_* conditions to trigger the callback
Returns:
For a Browser, returns false if the focus couldn't be changed
returns true otherwise.
For a MultiBrowser, returns false if the item is not already selected
returns true otherwise
bool Browser::selected ( int  line)

Does goto_index(line),item_selected() to return the selection state of an item in a non-hierarchial MultiBrowser.

Parameters:
lineThe line to look at
Returns:
If line is out of range it returns false, else returns true
int Browser::selected_column ( ) [inline]

It will call the callback() if the user clicks on a column title. Check this to see which one they clicked. This will return a negative number if the callback is being done for some other reason, such as the user clicking on an item.

Returns:
The index of the selected column, or negative if no column was selected
void Browser::set_belowmouse ( ) [private]

Checks if the current item is not the highlighted one and needs highligting, and trigger the old and new highlighted ones to redraw if so

int Browser::set_column_start ( int  col,
int  x 
)

Sets the start position of a column to a certain position

Parameters:
colThe index of the column to move
xThe x position, in pixels, that this column is to be moved to
Returns:
-1 if the index is out of bounds or the user is attempting to adjust the first column,
the distance in pixels the column had to move, otherwise
bool Browser::set_focus ( )

Change the focus (the selected item, or in an fltk::MultiBrowser the item that has a dotted box around it, to the current item. This calls make_item_visible().

Returns:
If the focus is changed, returns true, otherwise returns false
bool Browser::set_item_opened ( bool  open)

Opens the current item (which must be a parent)

Parameters:
openIf the current item is a parent, set the open state (the fltk::STATE flags) to the given value and redraw the browser correctly.
Returns:
true if the state was actually changed, or false if it was already in that state.
bool Browser::set_item_selected ( bool  value = true,
int  do_callback = 0 
)

This is for use by the MultiBrowser subclass. Turn the fltk::SELECTED flag on or off in the current item (use goto_index() to set the current item before calling this).

Parameters:
valueThis is the toggle switch; if true this item is SELECTED otherwise it's deselected
do_callbackA logical OR of when this callback should be executed, which is internally logical AND'd with when(). If when() & do_callback returns 0 but do_callback is positive, this does set_changed()

If this is not a MultiBrowser, this does select_only_this() if value is true, and deselect() if value is false.

Returns:
If the Browser is a MultiBrowser, returns false if the item doesn't exist or the item is already selected and value is true (or the item is not selected and value is false) or true otherwise
If the item is a regular Browser, returns set_only_this() or deselect(do_callback) based on value
bool Browser::set_item_visible ( bool  value)

Turns off or on the fltk::INVISIBLE flag on the given item and redraw the browser if necessary.

Parameters:
valueThe new value of the flag on the given item
Returns:
true if the state was actually changed or false if it was already in that state.
void Browser::set_level ( unsigned  n) [private]

This function increases the number of levels we can store in each mark, and sets the level of the current mark to n.

Parameters:
nThe requested level of the current mark
void fltk::Browser::set_mark ( Mark dest) const [inline]

Set the browser's current Mark to the passed value

Parameters:
destThe Mark to be set
void fltk::Browser::set_mark_to_focus ( Mark dest) const [inline]

Set the browser's current focused Mark to the passed value

Parameters:
destThe Mark to be set
void Browser::topline ( int  line) [inline]

Convenience function for non-hierarchial browsers.

Parameters:
lineMake the indexed item visible and scroll to put it at the top of the browser.
int Browser::topline ( ) const [inline]

Convenience function for non-hierarchial browsers.

Returns:
The index of the top-level item that is at the top of the scrolling window.
int Browser::value ( ) const [inline]
Returns:
focus_index(v)[0], to get the current item in a non-hierarchial browser.

Reimplemented from fltk::Menu.

void Browser::value ( int  v) [inline]

Same as

, to change the current item in a non-hierarchial browser.

Parameters:
vThe item to change to

Reimplemented from fltk::Menu.

int Browser::width ( ) const [inline]
Returns:
The width of the longest item in the browser, measured in pixels.

If this is changed (by adding or deleting items or opening or closing a parent item) then layout() must be called before this is correct.

int fltk::Browser::xposition ( ) const [inline]
Returns:
The horizontal scrolling position measured in pixels
void Browser::xposition ( int  X)

Set the horizontal scrolling position, measured in pixels. Zero is the normal position where the left edge of the child widgets is visible.

Parameters:
XThe new scrolling position
void Browser::yposition ( int  Y)

Set the vertical scrolling position, measured in pixels. Zero means the top of the first item is visible. Positive numbers scroll the display up.

Parameters:
YThe new vertical Scrollbar position
int fltk::Browser::yposition ( ) const [inline]
Returns:
The vertical scrolling position measured in pixels

Member Data Documentation

NamedStyle * Browser::default_style = &::style [static]

This style mostly serves to set the parenting back to Widget::default_style to avoid the gray color and larger leading set by Menu::default_style. However it also sets it's own glyph() function to one that draws the [+] and [-] indicators.

Reimplemented from fltk::Menu.


The documentation for this class was generated from the following files: