Contents
Previous
Next
Class >Hierarchy>
>Fl_Group>
> |
> +---->Fl_Browser_>
> |
> +---->Fl_Browser>
>
Include >Files>
>#include <FL/Fl_Browser_.H>
>
Description>
This >is >the >base >class >for >browsers. > To >be >
useful >it >must >be > subclassed >and >several >virtual >
functions >defined. > The >Forms-compatable > browser >and >
the >file >chooser's >browser >are >subclassed >off >of >
this. >
This >has >been >designed >so >that >the >subclass >
has >complete >control > over >the >storage >of >the >
data, >although >because >next()> and > prev()>
functions >are >used >to >index, >it >works >best >as >
a >linked >list > or >as >a >large >block >of >
characters >in >which >the >line >breaks >must >be >
searched >for. >
A >great >deal >of >work >has >been >done >so >
that >the >"height" >of >a >data > object >does >not >
need >to >be >determined >until >it >is >drawn. > This >
is > useful >if >actually >figuring >out >the >size >of >
an >object >requires > accessing >image >data >or >doing >
stat()> on >a >file >or >doing >some > other >slow >
operation. >
Methods>
The >constructor >makes >an >empty >browser. >
The >destructor >deletes >all >list >items >and >
destroys >the >browser. >
This >method >returns >the >bounding >box >for >the >
interior >of >the >list, >inside >the >scrollbars. >
This >method >should >be >used >when >an >item >is >
deleted >from >the >list. >It >allows >the >
Fl_Browser_> to >discard >any >cached >data >it >has >
on >the >item. >
Deselects >all >items >in >the >list >and >returns >
1 >if >the >state >changed >or >0 >if >it >did >
not. >
If >docb> is >non-zero, >deselect> tries >
to >call >the >callback >function >for >the >widget. >
Displays >item >p>, >scrolling >the >list >as >
necessary. >
This >method >returns >non-zero >if >item >p>
is >currently >visible >in >the >list. >
The >first >form >draws >the >list >within >the >
normal >widget >bounding >box. >
The >second >form >draws >the >contents >of >the >
browser >within >the >specified >bounding >box. >
This >method >returns >the >item >under >mouse >at >
my>. >If >no >item >is >displayed >at >that >
position >then >NULL> is >returned. >
This >method >may >be >provided >by >the >subclass >
to >indicate >the >full >height >of >the >item >list >
in >pixels. >The >default >implementation >computes >the >
full >height >from >the >item >heights. >
This >method >may >be >provided >by >the >subclass >
to >indicate >the >full >width >of >the >item >list >
in >pixels. >The >default >implementation >computes >the >
full >width >from >the >item >widths. >
The >first >form >handles >an >event >within >the >
normal >widget >bounding >box. >
The >second >form >handles >an >event >within >the >
specified >bounding >box. >
By >default >you >can >scroll >in >both >directions, >
and >the >scrollbars > disappear >if >the >data >will >
fit >in >the >widget. > has_scrollbar() >changes > this >
based >on >the >value >of >h>: >
0> - >No >scrollbars. >
Fl_Browser_::HORIZONTAL> - >Only >a >
horizontal > scrollbar. >
Fl_Browser_::VERTICAL> - >Only >a >vertical >
scrollbar. >
Fl_Browser_::BOTH> - >The >default >is >both >
scrollbars. >
Fl_Browser_::HORIZONTAL_ALWAYS> - >Horizontal >
scrollbar >always >on, >vertical >always >off. >
Fl_Browser_::VERTICAL_ALWAYS> - >Vertical >
scrollbar >always >on, >horizontal >always >off. >
Fl_Browser_::BOTH_ALWAYS> - >Both >always >on. >
Gets >or >sets >the >horizontal >scrolling >position >
of >the >list. >
This >method >may >be >provided >to >return >the >
average >height >of >all >items, >to >be >used >for >
scrolling. >The >default >implementation >uses >the >height >
of >the >first >item. >
This >method >should >be >used >when >an >item >is >
added >to >the >list. >It >allows >the >Fl_Browser_>
to >update >its >cache >data >as >needed. >
This >method >must >be >provided >by >the >subclass >
to >draw >the >item >p> in >the >area >
indicated >by >x>, >y>, >w>, >
and >h>. >
This >method >must >be >provided >by >the >subclass >
to >return >the >first >item >in >the >list. >
This >method >must >be >provided >by >the >subclass >
to >return >the >height >of >the >item >p> in >
pixels. > Allow >for >two >additional >pixels >for >the >
list >selection >box. >
This >method >must >be >provided >by >the >subclass >
to >return >the >item >in >the >list >after >p>
. >
This >method >must >be >provided >by >the >subclass >
to >return >the >item >in >the >list >before >p>
. >
This >method >may >be >provided >by >the >subclass >
to >return >the >height >of >the >item >p> in >
pixels. > Allow >for >two >additional >pixels >for >the >
list >selection >box. > This >method >differs >from >
item_height> in >that >it >is >only >called >
for >selection >and >scrolling >operations. >The >default >
implementation >calls >item_height>. >
This >method >must >be >implemented >by >the >subclass >
if >it >supports >multiple >selections >in >the >browser. >
The >s> argument >specifies >the >selection >state >
for >item >p>: >0 >= >off, >1 >= >on. >
This >method >must >be >implemented >by >the >subclass >
if >it >supports >multiple >selections >in >the >browser. >
The >method >should >return >1 >if >p> is >
selected >and >0 >otherwise. >
This >method >must >be >provided >by >the >subclass >
to >return >the >width >of >the >item >p> in >
pixels. > Allow >for >two >additional >pixels >for >the >
list >selection >box. >
This >method >returns >the >X >position >of >the >
left >edge >of >the >list >area >after >adjusting >for >
the >scrollbar >and >border, >if >any. >
This >method >should >be >called >when >the >list >
data >is >completely >replaced >or >cleared. >It >informs >
the >Fl_Browser_> widget >that >any >cached >
information >it >has >concerning >the >items >is >
invalid. >
Gets >or >sets >the >vertical >scrolling >position >of >
the >list. >
This >method >should >be >called >when >the >contents >
of >an >item >have >changed >but >not >changed >the >
height >of >the >item. >
This >method >will >cause >the >entire >list >to >be >
redrawn. >
This >method >should >be >used >when >an >item >is >
replaced >in >the >list. >It >allows >the >Fl_Browser_>
to >update >its >cache >data >as >needed. >
Repositions >and/or >resizes >the >browser. >
This >method >moves >the >vertical >scrollbar >to >the >
lefthand >side >of >the >list. >
This >method >moves >the >vertical >scrollbar >to >the >
righthand >side >of >the >list. >
Sets >the >selection >state >of >item >p> to >
s> and >returns >1 >if >the >state >changed >or >
0 >if >it >did >not. >
If >docb> is >non-zero, >select> tries >
to >call >the >callback >function >for >the >widget. >
Selects >item >p> and >returns >1 >if >the >
state >changed >or >0 >if >it >did >not. >Any >other >
items >in >the >list >are >deselected. >
If >docb> is >non-zero, >select_only>
tries >to >call >the >callback >function >for >the >
widget. >
Returns >the >item >currently >selected, >or >NULL >if >
there >is >no >selection. >For >multiple >selection >
browsers >this >call >returns >the >last >item >that >
was >selected. >
The >first >form >gets >the >default >text >color >
for >the >lines >in >the > browser. >
The >second >form >sets >the >default >text >color >
to >color>
The >first >form >gets >the >default >text >font >
for >the >lines >in >the > browser. >
The >second >form >sets >the >default >text >font >
to >font>
The >first >form >gets >the >default >text >size >
for >the >lines >in >the > browser. >
The >second >form >sets >the >default >text >size >
to >size>
Returns >the >item >the >appears >at >the >top >of >
the >list. >
Contents
Previous
Next
No comments for this page.
|