Gadget class. More...
#include <ilviews/gadgets/scgadget.h>
Public Member Functions | |
IlvScrolledGadget (IlvDisplay *display, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
virtual void | adjustScrollBars (IlBoolean redraw=IlFalse) |
Recomputes the scroll bars. More... | |
void | computeBBox (IlvRect &ibox, IlvRect &vbox, IlvRect &vs, IlvRect &hs, const IlvTransformer *t=0) const |
Computes the bounding boxes of the elements that compose the gadget. More... | |
void | computeBBox (IlvRect &ibox, IlvRect &vs, IlvRect &hs, const IlvTransformer *t=0) const |
Computes the bounding boxes of the elements that compose the gadget. More... | |
virtual IlvScrollBar * | createScrollBar (const IlvRect &rect, IlvDirection direction, IlUShort thickness, IlvPalette *palette) |
Returns a new instance of the IlvScrollBar class. More... | |
virtual void | drawBackground (IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the gadget background. More... | |
virtual void | drawFrame (IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the gadget frame. More... | |
virtual void | drawGadgetContents (IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the gadget contents. More... | |
virtual void | drawScrollBar (IlvPort *dst, IlvDirection direction, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws the specified internal scroll bar. More... | |
void | fitToRect (const IlvRect &rect) |
Resizes the object so that the scrollable area fits the specified rectangle. More... | |
IlUShort | getBottomMargin () const |
Returns the bottom margin. More... | |
IlvScrollBar * | getHorizontalScrollBar () const |
Returns a pointer to the internal horizontal scroll bar. More... | |
IlUShort | getLeftMargin () const |
Returns the left margin. More... | |
IlUShort | getRightMargin () const |
Returns the right margin. More... | |
IlvScrollBar * | getScrollBar (IlvDirection direction) const |
Returns a pointer to the specified internal scroll bar. More... | |
void | getScrollBarShowAsNeeded (IlBoolean &vert, IlBoolean &hor) const |
Returns the scroll bar mode of the internal scroll bars. More... | |
IlUShort | getTopMargin () const |
Returns the top margin. More... | |
IlvScrollBar * | getVerticalScrollBar () const |
Returns a pointer to the internal vertical scroll bar. More... | |
virtual IlBoolean | handleGadgetEvent (IlvEvent &event) |
Handles the gadget events. More... | |
virtual IlBoolean | handleScrollBarsEvent (IlvEvent &event) |
Handles the internal scroll bars event. More... | |
void | hideScrollBar (IlvDirection direction, IlBoolean redraw=IlTrue) |
Hides the specified internal scroll bar. More... | |
virtual void | internalBBox (IlvRect &bbox, const IlvTransformer *t=0) const |
Returns the internal bounding box of the gadget. More... | |
void | moveScrollBar (IlvDirection direction, IlvPosition where, IlBoolean redraw=IlTrue) |
Moves the specified internal scroll bar to a new position. More... | |
virtual void | scrollableSize (IlvDim &width, IlvDim &height) const |
Returns the size of the scrollable area of the gadget. More... | |
virtual void | scrollBarBBox (IlvDirection direction, IlvRect &bbox, const IlvTransformer *t=0) const |
Returns the bounding box of the specified internal scroll bar. More... | |
virtual void | scrollBarHasMoved (IlvDirection direction) |
Is called when an internal scroll bar has moved. More... | |
void | scrollBarShowAsNeeded (IlBoolean vertical, IlBoolean horizontal, IlBoolean redraw=IlTrue) |
Sets the scroll bar mode of the internal scroll bars. More... | |
virtual void | scrollBarVisibilityChanged (IlvDirection direction) |
Is called when an internal scroll bar is shown or hidden. More... | |
void | setBottomMargin (IlUShort margin) |
Sets the bottom margin. More... | |
void | setLeftMargin (IlUShort margin) |
Sets the left margin. More... | |
void | setMargin (IlUShort val) |
Sets the left, right, top, and bottom margins. More... | |
void | setRightMargin (IlUShort margin) |
Sets the right margin. More... | |
void | setTopMargin (IlUShort margin) |
Sets the top margin. More... | |
void | showScrollBar (IlvDirection direction, IlBoolean redraw=IlTrue) |
Shows the specified internal scroll bar. More... | |
virtual void | visibleBBox (IlvRect &bbox, const IlvTransformer *t=0) const |
Returns the visible bounding box of the gadget. More... | |
IlvPosition | whereIsScrollBar (IlvDirection direction) const |
Returns the location of the specified internal scroll bar. More... | |
Static Public Member Functions | |
static IlSymbol * | ScrollBarMovedSymbol () |
Returns the callback type for the Scroll Bar Moved callback. More... | |
static IlSymbol * | ScrollBarVisibilitySymbol () |
Returns the callback type for the Scroll Bar Visibility Changed callback. More... | |
Protected Member Functions | |
virtual void | adjustFromScrollBar (const IlvScrollBar *scrollbar, IlvDirection direction) |
Is called to adjust the gadget to the scroll bars values. More... | |
virtual void | adjustScrollBarValue (IlvScrollBar *scrollbar, IlvDirection direction) |
Is called to adjust the scroll bar values. More... | |
IlvDim | getLimitHeightValue () const |
Returns the limit value for the vertical scrolling. More... | |
IlvDim | getLimitWidthValue () const |
Returns the limit value for the horizontal scrolling. More... | |
IlvDim | getScrollableHeight () const |
Returns the height of the scrollable area. More... | |
IlvDim | getScrollableWidth () const |
Returns the width of the scrollable area. More... | |
void | setLimitHeightValue (IlvDim value) |
Sets the limit value for the vertical scrolling. More... | |
void | setLimitWidthValue (IlvDim value) |
Sets the limit value for the horizontal scrolling. More... | |
void | setScrollableHeight (IlvDim height) |
Sets the height of the scrollable area. More... | |
void | setScrollableWidth (IlvDim width) |
Sets the width of the scrollable area. More... | |
Friends | |
class | IlvDefaultScrolledGadgetLFHandler |
Gadget class.
Library: ilvadvgdt
The IlvScrolledGadget
class is an abstract gadget class that handles scroll bars. It is the base class for the gadgets that have scroll bars.
Examples of subclasses of the IlvScrolledGadget class
IlvAbstractMatrix
, IlvAnnoText
, IlvScrollBar
, IlvStringList
, IlvText
, IlvTreeGadget
.Name | Type | Equivalent methods |
---|---|---|
horizontalScrollbar | Boolean | getScrollBar() , showScrollBar() , hideScrollBar() |
verticalScrollbar | Boolean | getScrollBar() , showScrollBar() , hideScrollBar() |
horizontalScrollbarAsNeeded | Boolean | getScrollBarShowAsNeeded() , scrollBarShowAsNeeded() |
verticalScrollbarAsNeeded | Boolean | getScrollBarShowAsNeeded() , scrollBarShowAsNeeded() |
horizontalScrollbarPosition | Direction | whereIsScrollBar() , moveScrollBar() |
verticalScrollbarPosition | Direction | whereIsScrollBar() , moveScrollBar() |
leftMargin | UInt | getLeftMargin() , setLeftMargin() |
rightMargin | UInt | getRightMargin() , setRightMargin() |
topMargin | UInt | getTopMargin() , setTopMargin() |
bottomMargin | UInt | getBottomMargin() , setBottomMargin() |
IlvScrolledGadget::IlvScrolledGadget | ( | IlvDisplay * | display, |
const IlvRect & | rect, | ||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
IlvPalette * | palette = 0 |
||
) |
Constructor.
Initializes a new instance of the IlvScrolledGadget
class.
display | The connection to the display. |
rect | The size and position of the gadget. |
thickness | The thickness of the gadget. |
palette | The palette used by the gadget. |
|
protectedvirtual |
Is called to adjust the gadget to the scroll bars values.
Is called each time the scroll bar scrollbar of direction direction moves. If you want to detect these events, you must redefine this member function in a subclass. The default implementation does nothing.
scrollbar | The scroll bar object. |
direction | The direction of the scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
adjustScrollBarValue()
. Reimplemented in IlvTreeGadget, IlvStringList, IlvCodeEditor, IlvAbstractMatrix, and IlvText.
Recomputes the scroll bars.
Sets the right values to the scroll bars.
redraw | A Boolean value specifying whether the gadget should be redrawn. |
Reimplemented in IlvText.
|
protectedvirtual |
Is called to adjust the scroll bar values.
Is called by the member function adjustScrollBars()
to adjust the values of the scroll bar scrollbar of direction direction. This member function must modify the scrollbar values to match the gadget scrolling mode. If you want to detect these events, you must redefine this member function in a subclass. The default implementation does nothing.
scrollbar | The scroll bar object. |
direction | The direction of the scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
adjustFromScrollBar()
. Reimplemented in IlvTreeGadget, IlvStringList, IlvCodeEditor, IlvAbstractMatrix, and IlvText.
void IlvScrolledGadget::computeBBox | ( | IlvRect & | ibox, |
IlvRect & | vbox, | ||
IlvRect & | vs, | ||
IlvRect & | hs, | ||
const IlvTransformer * | t = 0 |
||
) | const |
Computes the bounding boxes of the elements that compose the gadget.
ibox | The returned internal bounding box of the gadget. |
vbox | The returned visible bounding box of the gadget. |
vs | The returned internal vertical scroll bar bounding box of the gadget. |
hs | The returned internal horizontal scroll bar bounding box of the gadget. |
t | The transformer applied to the gadget. |
internalBBox()
, visibleBBox()
, scrollBarBBox()
. void IlvScrolledGadget::computeBBox | ( | IlvRect & | ibox, |
IlvRect & | vs, | ||
IlvRect & | hs, | ||
const IlvTransformer * | t = 0 |
||
) | const |
Computes the bounding boxes of the elements that compose the gadget.
ibox | The returned internal bounding box of the gadget. |
vs | The returned internal vertical scroll bar bounding box of the gadget. |
hs | The returned internal horizontal scroll bar bounding box of the gadget. |
t | The transformer applied to the gadget. |
internalBBox()
, scrollBarBBox()
.
|
virtual |
Returns a new instance of the IlvScrollBar
class.
Is called by the member function showScrollBar()
to create a new scroll bar. If you want to create your own scroll bars, you can override this member function in a subclass.
rect | The bounding box of the scroll bar to be created. |
direction | The direction of the scroll bar to be created. Valid values are: IlvHorizontal and IlvVertical . |
thickness | The thickness of the scroll bar to create. |
palette | The palette of the scroll bar to create. |
IlvScrollBar
. Reimplemented in IlvAbstractMatrix.
|
virtual |
Draws the gadget background.
Is called from the draw()
method. This method is not called if the gadget is transparent.
dst | The destination drawing port. |
t | The transformer applied to the gadget. |
clip | The clipping area. |
Reimplemented from IlvGadget.
Reimplemented in IlvTreeGadget, IlvText, IlvStringList, and IlvMatrix.
|
virtual |
Draws the gadget frame.
Is called from the draw()
method. This method is not called if the method isShowingFrame()
returns IlFalse
.
dst | The destination drawing port. |
t | The transformer applied to the gadget. |
clip | The clipping area. |
drawBackground()
, drawScrollBar()
, drawGadgetContents()
. Reimplemented from IlvGadget.
Reimplemented in IlvSheet, IlvTreeGadget, IlvText, IlvStringList, and IlvMatrix.
|
virtual |
Draws the gadget contents.
Is called from the draw()
method. The default implementation does nothing.
dst | The destination drawing port. |
t | The transformer applied to the gadget. |
clip | The clipping area. |
drawBackground()
, drawScrollBar()
, drawFrame()
. Reimplemented in IlvTreeGadget, IlvStringList, IlvSheet, IlvCodeEditor, IlvAbstractMatrix, IlvText, and IlvMatrix.
|
virtual |
Draws the specified internal scroll bar.
dst | The destination drawing port. |
direction | The direction of the internal scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
t | The transformer applied to the gadget. |
clip | The clipping area. |
drawBackground()
, drawFrame()
, drawGadgetContents()
. void IlvScrolledGadget::fitToRect | ( | const IlvRect & | rect | ) |
Resizes the object so that the scrollable area fits the specified rectangle.
rect | The new size of the scrollable area. |
IlvGadget::fitToContents()
. IlUShort IlvScrolledGadget::getBottomMargin | ( | ) | const |
IlvScrollBar* IlvScrolledGadget::getHorizontalScrollBar | ( | ) | const |
Returns a pointer to the internal horizontal scroll bar.
0
if there is no horizontal scroll bar. getScrollBar()
, getVerticalScrollBar()
. IlUShort IlvScrolledGadget::getLeftMargin | ( | ) | const |
|
protected |
Returns the limit value for the vertical scrolling.
setLimitHeightValue()
, getLimitWidthValue()
.
|
protected |
Returns the limit value for the horizontal scrolling.
setLimitWidthValue()
, getLimitHeightValue()
. IlUShort IlvScrolledGadget::getRightMargin | ( | ) | const |
|
protected |
Returns the height of the scrollable area.
setScrollableHeight()
, getScrollableWidth()
.
|
protected |
Returns the width of the scrollable area.
setScrollableWidth()
, getScrollableHeight()
. IlvScrollBar* IlvScrolledGadget::getScrollBar | ( | IlvDirection | direction | ) | const |
Returns a pointer to the specified internal scroll bar.
direction | The direction of the internal scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
0
if such a scroll bar does not exist. Returns the scroll bar mode of the internal scroll bars.
vert | A Boolean value specifying whether the visibility of the internal vertical scroll bar should be managed by the gadget automatically. |
hor | A Boolean value specifying whether the visibility of the internal horizontal scroll bar should be managed by the gadget automatically. |
IlUShort IlvScrolledGadget::getTopMargin | ( | ) | const |
IlvScrollBar* IlvScrolledGadget::getVerticalScrollBar | ( | ) | const |
Returns a pointer to the internal vertical scroll bar.
0
if there is no vertical scroll bar. getScrollBar()
, getHorizontalScrollBar()
. Handles the gadget events.
Is called by handleEvent()
when the member function handleScrollBarsEvent()
returns IlFalse
. Its default implementation does nothing. You can override this member function to implement your own gadget behavior.
event | The event. |
handleScrollBarsEvent()
. Reimplemented in IlvTreeGadget, IlvStringList, IlvCodeEditor, IlvText, and IlvAbstractMatrix.
Handles the internal scroll bars event.
Is called from the handleEvent
method. You can override this member function to implement your own scroll bar behavior.
event | The event. |
IlFalse
if the event has not been handled by the scroll bars. In this case, handleGadgetEvent()
will be called. handleGadgetEvent()
. Reimplemented in IlvCodeEditor.
Hides the specified internal scroll bar.
The scroll bar is deleted. Does nothing if the scroll bar mode is "as needed".
direction | The direction for which the scroll bar should be hidden. Valid values are: IlvHorizontal and IlvVertical . |
redraw | A Boolean value specifying whether the gadget should be redrawn. |
|
virtual |
Returns the internal bounding box of the gadget.
Puts in bbox the internal bounding box of the scrolled gadget computed with the transformer t. The internal bounding box is used to draw the frame and to compute the scrollable area. If you want to change the internal bounding box, you can override this member function in a subclass.
bbox | The returned internal bounding box. |
t | The transformer applied to the gadget. |
visibleBBox()
, scrollBarBBox()
. Reimplemented in IlvMatrix.
void IlvScrolledGadget::moveScrollBar | ( | IlvDirection | direction, |
IlvPosition | where, | ||
IlBoolean | redraw = IlTrue |
||
) |
Moves the specified internal scroll bar to a new position.
direction | The direction for which the scroll bar should be hidden. Valid values are: IlvHorizontal and IlvVertical . |
where | The new position of the internal scroll bar. Valid values are: IlvLeft and IlvRight for horizontal scroll bars, and IlvTop and IlvBottom for vertical scroll bars. |
redraw | A Boolean value specifying whether the gadget should be redrawn. |
Returns the size of the scrollable area of the gadget.
Puts the width and height of the scrollable area in width and height, respectively. These values are used to compute the values of the scroll bars. You can override this member function to change the scrollable area.
Reimplemented in IlvCodeEditor.
|
virtual |
Returns the bounding box of the specified internal scroll bar.
Puts in bbox the bounding box of the internal scroll bar specified by direction using the transformer t. If you want to change the internal scroll bars bounding box, you can override this member function in a subclass.
direction | The direction of the internal scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
bbox | The returned internal scroll bar bounding box. |
t | The transformer applied to the gadget. |
internalBBox()
, visibleBBox()
. Reimplemented in IlvAbstractMatrix.
|
virtual |
Is called when an internal scroll bar has moved.
Is called by handleEvent()
each time the value of the internal scroll bar specified by direction changes. The default implementation invokes the Scroll Bar Moved callback.
direction | The direction of the internal scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
ScrollBarMovedSymbol()
. Reimplemented in IlvText, IlvAbstractMatrix, and IlvStringList.
|
static |
Returns the callback type for the Scroll Bar Moved callback.
The Scroll Bar Moved callback is invoked each time a scroll bar is moved.
IlvGraphic::setCallback()
, scrollBarHasMoved()
. void IlvScrolledGadget::scrollBarShowAsNeeded | ( | IlBoolean | vertical, |
IlBoolean | horizontal, | ||
IlBoolean | redraw = IlTrue |
||
) |
Sets the scroll bar mode of the internal scroll bars.
The "as needed" scroll bar mode lets the gadget manage the scroll bar visibility by showing or hiding the internal scroll bars when needed.
vertical | A Boolean value specifying whether the visibility of the internal vertical scroll bar should be managed by the gadget automatically. |
horizontal | A Boolean value specifying whether the visibility of the internal horizontal scroll bar should be managed by the gadget automatically. |
redraw | A Boolean value specifying whether the gadget should be redrawn. |
|
virtual |
Is called when an internal scroll bar is shown or hidden.
Is called by handleEvent()
each time the internal scroll bar specified by direction is shown or hidden. The default implementation invokes the Scroll Bar Visibility Changed callback.
direction | The direction of the internal scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
ScrollBarVisibilitySymbol()
.
|
static |
Returns the callback type for the Scroll Bar Visibility Changed callback.
The Scroll Bar Visibility Changed callback is invoked each time an internal scroll bar is shown or hidden.
void IlvScrolledGadget::setBottomMargin | ( | IlUShort | margin | ) |
void IlvScrolledGadget::setLeftMargin | ( | IlUShort | margin | ) |
|
protected |
Sets the limit value for the vertical scrolling.
This value is used to compute the maximum value that can have a vertical scroll bar connected to this scrolled gadget.
value | The new limit value for the vertical scrolling. |
setLimitWidthValue()
, setScrollableHeight()
.
|
protected |
Sets the limit value for the horizontal scrolling.
This value is used to compute the maximum value that can have a horizontal scroll bar connected to this scrolled gadget.
value | The new limit value for the horizontal scrolling. |
setLimitHeightValue()
, setScrollableWidth()
. void IlvScrolledGadget::setMargin | ( | IlUShort | val | ) |
Sets the left, right, top, and bottom margins.
val | The new value for margins. |
void IlvScrolledGadget::setRightMargin | ( | IlUShort | margin | ) |
|
protected |
Sets the height of the scrollable area.
Call this method each time the height of the scrolled object encapsulated by this scrolled gadget changes.
height | The new scrollable height. |
setScrollableWidth()
, setLimitHeightValue()
.
|
protected |
Sets the width of the scrollable area.
Call this method each time the width of the scrolled object encapsulated by this scrolled gadget changes.
width | The new scrollable width. |
setScrollableHeight()
, setLimitWidthValue()
. void IlvScrolledGadget::setTopMargin | ( | IlUShort | margin | ) |
Shows the specified internal scroll bar.
Does nothing if the scroll bar mode is "as needed".
direction | The direction for which the scroll bar should be visible. Valid values are: IlvHorizontal and IlvVertical . |
redraw | A Boolean value specifying whether the gadget should be redrawn. |
|
virtual |
Returns the visible bounding box of the gadget.
Puts in bbox the visible bounding box of the scrolled gadget computed with the transformer t. The visible bounding box is used to draw the gadget contents. The default implementation computes the internal bounding box and subtracts the margins from it. If you want to change the visible bounding box, you can override this member function in a subclass.
bbox | The returned visible bounding box. |
t | The transformer applied to the gadget. |
internalBBox()
, scrollBarBBox()
. IlvPosition IlvScrolledGadget::whereIsScrollBar | ( | IlvDirection | direction | ) | const |
Returns the location of the specified internal scroll bar.
direction | The direction of the internal scroll bar. Valid values are: IlvHorizontal and IlvVertical . |
moveScrollBar()
.