Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/gadgets/notebook.h>
Public Member Functions | |
IlvNotebook (IlvDisplay *display, const IlvRect &rect, IlvPosition tabsPosition=IlvTop, IlBoolean verticalLabels=IlFalse, IlBoolean flipLabels=IlFalse, IlvDim xMargin=5, IlvDim yMargin=2, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvNotebookPage * | addPage (const char *message, IlvBitmap *bitmap=0, IlBoolean transparent=IlTrue, const char *filename=0, IlUShort index=((IlUShort)-1)) |
Adds a page to the notebook. | |
IlvNotebookPage * | addPage (IlvNotebookPage *page, IlUShort index=((IlUShort)-1)) |
Adds a page to the notebook. | |
void | allowDragDrop (IlBoolean allow) |
Specifies whether drag-and-drop operations should be allowed for the notebook. | |
virtual IlBoolean | allowDragDrop () const |
Indicates whether drag-and-drop operations are allowed for the notebook. | |
virtual IlvGadgetItem * | applyToItems (IlvApplyGadgetItem f, IlAny arg) |
Applies the specified function to all the items of the holder. | |
IlBoolean | areLabelsVertical () const |
Returns IlTrue if the tab labels are drawn vertically. | |
virtual IlBoolean | changeSelection (IlUShort index, IlBoolean redraw) |
Changes the selected page of the notebook. | |
virtual IlvGadgetItem * | createItem (const char *label, IlvGraphic *graphic=0, IlvBitmap *bitmap=0, IlvBitmap *selbitmap=0, IlBoolean copy=IlTrue) const |
Returns a new gadget item. | |
virtual IlvView * | createView (IlvNotebookPage *page, IlvAbstractView *parent, const IlvRect &size) |
Is called by the pages to create their views. | |
virtual void | deleteView (IlvNotebookPage *page) |
Is called by the pages to delete their views. | |
void | ensureVisible (IlUShort index, IlBoolean redraw) |
Ensures that a given tab is visible. | |
void | flipLabels (IlBoolean value) |
Changes the display style of the notebook tabs labels. | |
IlUShort | getFirstVisibleTab () const |
Return the index of the first visible tab. | |
virtual IlvPosition | getLabelPosition () const |
Returns the default position of the notebook tabs labels. | |
virtual IlvPalette * | getNormalTextPalette () const |
Returns the default palette used to draw an item. | |
virtual IlvPalette * | getOpaquePalette () const |
Returns the opaque palette used to draw opaque items. | |
IlvNotebookPage * | getPage (const char *name) const |
Returns a notebook page using its name. | |
virtual void | getPageArea (IlvRect &rect, const IlvTransformer *t=0) const |
Returns the bounding box of the page area. | |
IlvDim | getPageBottomMargin () const |
Returns the bottom margin between the notebook border and the page area. | |
IlvDim | getPageLeftMargin () const |
Returns the left margin between the notebook border and the page area. | |
IlvDim | getPageRightMargin () const |
Returns the right margin between the notebook border and the page area. | |
IlvNotebookPage ** | getPages () const |
Returns the internal array of notebook pages. | |
IlUShort | getPagesCardinal () const |
Returns the number of pages of the notebook. | |
IlvDim | getPageTopMargin () const |
Returns the top margin between the notebook border and the page area. | |
IlvView * | getParent () const |
Returns the view where the notebook is displayed. | |
IlvNotebookPage * | getSelectedPage () const |
Returns a pointer to the IlvNotebookPage object corresponding to the selected page. | |
IlUShort | getSelectedPageIndex () const |
Returns the index of the selected page. | |
IlvPosition | getTabsPosition () const |
Returns the position of the tabs. | |
IlvDim | getXMargin () const |
Returns the x margin of the notebook. | |
IlvDim | getYMargin () const |
Returns the y margin of the notebook. | |
virtual IlBoolean | isShowingLabel () const |
A Boolean indicating whether or not the notebook tabs labels are displayed. | |
virtual IlBoolean | isShowingPicture () const |
A Boolean indicating whether or not the notebook tabs pictures are displayed. | |
IlBoolean | mustFlipLabels () const |
Returns IlTrue if the labels of the notebook tabs are flipped. | |
virtual void | pageDeselected (IlvNotebookPage *page) |
Is called when a page is deselected. | |
virtual void | pageResized (IlvNotebookPage *page) |
Is called when a page is resized. | |
virtual void | pageSelected (IlvNotebookPage *page) |
Is called when a page is selected. | |
virtual IlShort | pointToTabIndex (const IlvPoint &point, const IlvTransformer *t) const |
Returns the index of the tab located at the specified position. | |
virtual void | recomputeAllItems () |
Recomputes the size of all the items managed by the holder. | |
void | removePage (IlUShort index, IlBoolean destroy=IlTrue) |
Removes a page of the notebook. | |
void | setFirstVisibleTab (IlUShort index) |
Changes the first visible tab. | |
void | setLabelPosition (IlvPosition position, IlBoolean redraw=IlTrue) |
Sets the default position of the matrix items labels. | |
void | setLabelsVertical (IlBoolean value) |
Changes the orientation of the labels. | |
void | setPageBottomMargin (IlvDim margin) |
Changes the bottom margin between the notebook border and the page area. | |
void | setPageLeftMargin (IlvDim margin) |
Changes the left margin between the notebook border and the page area. | |
void | setPageRightMargin (IlvDim margin) |
Changes the right margin between the notebook border and the page area. | |
void | setPageTopMargin (IlvDim margin) |
Changes the top margin between the notebook border and the page area. | |
void | setSelectedPageIndex (IlUShort index) |
Changes the selected page index. | |
void | setTabsPosition (IlvPosition position) |
Changes the position of the tabs. | |
void | setXMargin (IlvDim x) |
Changes the x margin of the notebook. | |
void | setYMargin (IlvDim y) |
Changes the y margin of the notebook. | |
void | showLabel (IlBoolean value=IlTrue, IlBoolean redraw=IlTrue) |
Shows or hides the notebook tabs labels. | |
void | showPicture (IlBoolean value=IlTrue, IlBoolean redraw=IlTrue) |
Shows or hides the pictures associated with the notebook tabs. | |
Static Public Member Functions | |
static IlSymbol * | PageDeselectedCallbackType () |
Returns the callback type for the Page Deselected callback. | |
static IlSymbol * | PageResizedCallbackType () |
Returns the callback type for the Page Resized callback. | |
static IlSymbol * | PageSelectedCallbackType () |
Returns the callback type for the Page Selected callback. | |
Friends | |
class | IlvDefaultNotebookLFHandler |
class | IlvNotebookMLFHandler |
class | IlvNotebookPage |
class | IlvNotebookVXLFHandler |
class | IlvNotebookWLFHandler |
Gadget class.
Library: ilvadvgdt
IlvNotebook
is a predefined gadget class that simulates a real notebook. It allows the user to select the pages of the notebook by using the pointing device.
- IlvNotebook and IlvNotebookPage -
You can customize the notebook to meet your specific application requirements:
Tabs can be displayed on any side of the notebook.
Tabs can contain a simple label or a bitmap (or both).
Tab labels can be displayed vertically or horizontally.
Each page of the notebook is implemented by the class IlvNotebookPage
. The default implementation of this class is to create an IlvGadgetContainer
that displays the contents of the page.
IlvNotebookPage
. IlvNotebook::IlvNotebook | ( | IlvDisplay * | display, | |
const IlvRect & | rect, | |||
IlvPosition | tabsPosition = IlvTop , |
|||
IlBoolean | verticalLabels = IlFalse , |
|||
IlBoolean | flipLabels = IlFalse , |
|||
IlvDim | xMargin = 5 , |
|||
IlvDim | yMargin = 2 , |
|||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of the IlvNotebook
class.
display | The display connection. | |
rect | The size and position of the notebook. | |
tabsPosition | See the getTabsPosition method for the definition of this parameter. | |
verticalLabels | A Boolean specifying whether to draw the labels of the tabs vertically or not. | |
flipLabels | A Boolean specifying whether to draw the labels of the tabs from the top to the bottom, or from the bottom to the top. This parameter is only used in case of vertical labels, that is, if verticalLabels is IlTrue . | |
xMargin | The margin between the tab and its label. See getXMargin for more informations. | |
yMargin | The margin between the tab and its label. See getYMargin for more informations. | |
palette | The palette used by the notebook. |
IlvNotebookPage* IlvNotebook::addPage | ( | const char * | message, | |
IlvBitmap * | bitmap = 0 , |
|||
IlBoolean | transparent = IlTrue , |
|||
const char * | filename = 0 , |
|||
IlUShort | index = ((IlUShort)-1) | |||
) |
Adds a page to the notebook.
Creates a new IlvNotebookPage
and adds it to the notebook at the position index
.
label | The tab label. | |
bitmap | The tab bitmap | |
transparent | Obsolete. | |
filename | The name of the .ilv file to load onto the page. | |
index | The position where to add the page. |
addPage(IlvNotebookPage*, IlUShort)
. IlvNotebookPage* IlvNotebook::addPage | ( | IlvNotebookPage * | page, | |
IlUShort | index = ((IlUShort)-1) | |||
) |
Adds a page to the notebook.
page | The page that will be added. | |
index | The index where page will be added. |
page
. addPage(const char*, IlvBitmap*, IlBoolean, const char*, IlUShort)
, removePage
. void IlvNotebook::allowDragDrop | ( | IlBoolean | allow | ) |
Specifies whether drag-and-drop operations should be allowed for the notebook.
value | A Boolean value specifying whether drag-and-drop operations should be allowed (IlTrue ). |
IlvGadgetItemHolder::startDragItem
, IlvGadgetItemHolder::allowDragDrop
. virtual IlBoolean IlvNotebook::allowDragDrop | ( | ) | const [virtual] |
Indicates whether drag-and-drop operations are allowed for the notebook.
IlTrue
if drag-and-drop operations are allowed and IlFalse
otherwise. IlvGadgetItemHolder::startDragItem
, IlvGadgetItemHolder::allowDragDrop(IlBoolean)
. Reimplemented from IlvGadgetItemHolder.
virtual IlvGadgetItem* IlvNotebook::applyToItems | ( | IlvApplyGadgetItem | func, | |
IlAny | arg | |||
) | [virtual] |
Applies the specified function to all the items of the holder.
func | The function to be applied. | |
arg | The argument that will be passed to the function func. |
IlvApplyGadgetItem
for details. IlvApplyGadgetItem
, recomputeAllItems
, getItemByName
. Reimplemented from IlvGadgetItemHolder.
IlBoolean IlvNotebook::areLabelsVertical | ( | ) | const |
Returns IlTrue
if the tab labels are drawn vertically.
Each tab of the notebook can contain a label, which can be drawn horizontally or vertically.
IlTrue
if the tab labels are drawn vertically. setLabelsVertical
, getLabelPosition
, getTabsPosition
. Changes the selected page of the notebook.
The page must be sensitive (see the IlvNotebookPage:: isSensitive
method). The method pageDeselected
is called on the previous selected page, and the method pageSelected
on the new selected page.
IlTrue
if the page has been successfully selected. redraw | A Boolean specifying whether the gadget should be redrawn. |
setFirstVisibleTab
. virtual IlvGadgetItem* IlvNotebook::createItem | ( | const char * | label, | |
IlvGraphic * | graphic = 0 , |
|||
IlvBitmap * | bitmap = 0 , |
|||
IlvBitmap * | selbitmap = 0 , |
|||
IlBoolean | copy = IlTrue | |||
) | const [virtual] |
Returns a new gadget item.
You can override this member function in a subclass to create your own items.
label | The item label. | |
graphic | The IlvGraphic object representing the picture associated with the item. | |
bitmap | The IlvBitmap object representing the picture associated with the item. | |
selbitmap | The IlvBitmap object representing the picture of the item when it is selected. | |
copy | A Boolean value specifying whether a label should be copied. If the value is IlFalse |
[note] If both the second and third parameters are not null, only the second parameter is used.
The created gadget item.
Reimplemented from IlvGadgetItemHolder.
virtual IlvView* IlvNotebook::createView | ( | IlvNotebookPage * | page, | |
IlvAbstractView * | parent, | |||
const IlvRect & | size | |||
) | [virtual] |
Is called by the pages to create their views.
The default implementation is to call the IlvNotebookPage::createView
method. You can overload this method to create another kind of view. Overloading this method means creating a view. The parent of this new view must be parent
and the size of the view must be size
. The view must be created invisible. If you overload this method, the IlvNotebookPage::createView
method is no longer called.
page | The page that requested the view creation. | |
parent | The parent of the view to be created. | |
size | The size of the view to be created. |
deleteView
, IlvNotebookPage::createView
. virtual void IlvNotebook::deleteView | ( | IlvNotebookPage * | page | ) | [virtual] |
Is called by the pages to delete their views.
The default implementation is to call the IlvNotebookPage::deleteView
method. If you overload this method, the IlvNotebookPage::deleteView
method is no longer called.
page | The page that requested the view deletion. |
createView
, IlvNotebookPage::deleteView
. Ensures that a given tab is visible.
Ensures that the tab with the index idx
becomes visible. This does not change the selected tab.
index | The tab index. | |
redraw | A Boolean specifying whether the gadget should be redrawn. |
changeSelection
, getFirstVisibleTab
. void IlvNotebook::flipLabels | ( | IlBoolean | value | ) |
Changes the display style of the notebook tabs labels.
See the method mustFlipLabels
.
value | A Boolean specifying whether or not that labels of the notebook tabs should be flipped. |
mustFlipLabels
, setLabelsVertical
. IlUShort IlvNotebook::getFirstVisibleTab | ( | ) | const |
Return the index of the first visible tab.
0
) of the first visible tab. If this value is not 0,
some tabs are not visible and the scrolling arrows are visible. setFirstVisibleTab
, changeSelection
, ensureVisible
. virtual IlvPosition IlvNotebook::getLabelPosition | ( | ) | const [virtual] |
Returns the default position of the notebook tabs labels.
setLabelPosition
. Reimplemented from IlvGadgetItemHolder.
virtual IlvPalette* IlvNotebook::getNormalTextPalette | ( | ) | const [virtual] |
Returns the default palette used to draw an item.
Implements IlvGadgetItemHolder.
virtual IlvPalette* IlvNotebook::getOpaquePalette | ( | ) | const [virtual] |
Returns the opaque palette used to draw opaque items.
Reimplemented from IlvGadgetItemHolder.
IlvNotebookPage* IlvNotebook::getPage | ( | const char * | name | ) | const |
Returns a notebook page using its name.
name | The name of the page. |
0
if the specified page is not in the notebook. IlvNotebookPage::getName
. virtual void IlvNotebook::getPageArea | ( | IlvRect & | rect, | |
const IlvTransformer * | t = 0 | |||
) | const [virtual] |
Returns the bounding box of the page area.
Puts in rect
the rectangle of the page area with the page margin having already been taken into account.
rect | The returned bounding box of the page area. | |
t | The transformer applied to the notebook. |
IlvDim IlvNotebook::getPageBottomMargin | ( | ) | const |
Returns the bottom margin between the notebook border and the page area.
IlvDim IlvNotebook::getPageLeftMargin | ( | ) | const |
Returns the left margin between the notebook border and the page area.
IlvDim IlvNotebook::getPageRightMargin | ( | ) | const |
Returns the right margin between the notebook border and the page area.
IlvNotebookPage** IlvNotebook::getPages | ( | ) | const |
Returns the internal array of notebook pages.
To get the first page of the notebook, you can use notebook->getPages()[0]
.
getPage
. IlUShort IlvNotebook::getPagesCardinal | ( | ) | const |
Returns the number of pages of the notebook.
addPage
. IlvDim IlvNotebook::getPageTopMargin | ( | ) | const |
Returns the top margin between the notebook border and the page area.
IlvView* IlvNotebook::getParent | ( | ) | const |
Returns the view where the notebook is displayed.
0
if the notebook has not been added to any holder. IlvNotebookPage* IlvNotebook::getSelectedPage | ( | ) | const |
Returns a pointer to the IlvNotebookPage
object corresponding to the selected page.
IlvNotebookPage
object corresponding to the selected page. getSelectedPageIndex
. IlUShort IlvNotebook::getSelectedPageIndex | ( | ) | const |
Returns the index of the selected page.
getSelectedPage
. IlvPosition IlvNotebook::getTabsPosition | ( | ) | const |
Returns the position of the tabs.
Tabs can be displayed on any side of the notebook (IlvTop
, IlvRight
, IlvLeft
, IlvBottom
).
setTabsPosition
, getLabelPosition
, areLabelsVertical
. IlvDim IlvNotebook::getXMargin | ( | ) | const |
Returns the x margin of the notebook.
This margin is the horizontal space between the border of the tab and the tab label. This margin becomes a vertical space when labels are drawn vertically.
setXMargin
, getYMargin
. IlvDim IlvNotebook::getYMargin | ( | ) | const |
Returns the y margin of the notebook.
This margin is the vertical space between the border of the tab and the tab label. This margin becomes a horizontal space when labels are drawn horizontally.
setYMargin
, getXMargin
. virtual IlBoolean IlvNotebook::isShowingLabel | ( | ) | const [virtual] |
A Boolean indicating whether or not the notebook tabs labels are displayed.
IlTrue
if the labels associated with the tabs of the notebook are displayed. showLabel
. Reimplemented from IlvGadgetItemHolder.
virtual IlBoolean IlvNotebook::isShowingPicture | ( | ) | const [virtual] |
A Boolean indicating whether or not the notebook tabs pictures are displayed.
IlTrue
if the pictures associated with the notebook tabs are displayed. showPicture
. Reimplemented from IlvGadgetItemHolder.
IlBoolean IlvNotebook::mustFlipLabels | ( | ) | const |
Returns IlTrue
if the labels of the notebook tabs are flipped.
IlTrue
if the labels of the notebook tabs are flipped, IlFalse
otherwise. When the labels of the tabs are displayed vertically (see the method setLabelsVertical
) , the label can be written from top to bottom, or from bottom to top. When the label is displayed from bottom to top, the label is said to be flipped. flipLabels
, setLabelsVertical
. virtual void IlvNotebook::pageDeselected | ( | IlvNotebookPage * | page | ) | [virtual] |
Is called when a page is deselected.
Is called by the changeSelection
method. The default implementation is to call the IlvNotebookPage::deSelect
method and the Page Deselected callback.
page | The notebook page. |
pageSelected
, PageDeselectedCallbackType
. static IlSymbol* IlvNotebook::PageDeselectedCallbackType | ( | ) | [static] |
Returns the callback type for the Page Deselected callback.
The Page Deselected callback is called when a page has bee deselected, that is, a new page has been selected.
pageDeselected
, changeSelection
. virtual void IlvNotebook::pageResized | ( | IlvNotebookPage * | page | ) | [virtual] |
Is called when a page is resized.
The default implementation is to call the IlvNotebookPage::resized
method and the Page Resized callback.
page | The notebook page. |
PageResizedCallbackType
. static IlSymbol* IlvNotebook::PageResizedCallbackType | ( | ) | [static] |
Returns the callback type for the Page Resized callback.
The Page Resized callback is called when the page area of the notebook is resized. This occurs when the notebook itself is resized, or when the the tabs position changes for example.
pageResized
. virtual void IlvNotebook::pageSelected | ( | IlvNotebookPage * | page | ) | [virtual] |
Is called when a page is selected.
Is called by the changeSelection
method. The default implementation is to call the IlvNotebookPage::select
method and the Page Selected callback.
page | The notebook page. |
pageDeselected
, PageSelectedCallbackType
. static IlSymbol* IlvNotebook::PageSelectedCallbackType | ( | ) | [static] |
Returns the callback type for the Page Selected callback.
The Page Selected callback is called when a new page has been selected.
pageSelected
, changeSelection
. virtual IlShort IlvNotebook::pointToTabIndex | ( | const IlvPoint & | point, | |
const IlvTransformer * | t | |||
) | const [virtual] |
Returns the index of the tab located at the specified position.
The method calls getTabRect
for all the visible pages, and returns the one that contains point.
point | The position in view coordinates. | |
t | The transformer applied to the notebook list. |
-1
. getTabRect
virtual void IlvNotebook::recomputeAllItems | ( | ) | [virtual] |
Recomputes the size of all the items managed by the holder.
Calls the IlvGadgetItem::recomputeSize
member function for all the items managed by this holder.
IlvGadgetItem::recomputeSize
, applyToItems
. Reimplemented from IlvGadgetItemHolder.
Removes a page of the notebook.
A notebook must have at least one page to work properly. You can remove all the pages to change them, but you must then add at least one page.
index | The index of the page to remove. | |
destroy | A Boolean specifying whether to destroy the page that will be removed. |
addPage
. void IlvNotebook::setFirstVisibleTab | ( | IlUShort | index | ) |
Changes the first visible tab.
This only scrolls the tabs and does not change the selected page.
index | The new first visible tab index. |
getFirstVisibleTab
, changeSelection
, ensureVisible
. void IlvNotebook::setLabelPosition | ( | IlvPosition | position, | |
IlBoolean | redraw = IlTrue | |||
) |
Sets the default position of the matrix items labels.
This setting is used to compute the geometry of each notebook tab For more information, see the member function IlvGadgetItem::setLabelPosition
.
position | The new position of the labels relative to pictures of notebook tabs. | |
redraw | A Boolean specifying whether the gadget should be redrawn. |
getLabelPosition
, IlvGadgetItem::setLabelPosition
. void IlvNotebook::setLabelsVertical | ( | IlBoolean | value | ) |
Changes the orientation of the labels.
Each tab of the notebook can contain a label, which can be drawn horizontally or vertically.
value | A Boolean specifying whether or not the labels of the notebook tabs should be drawn vertically. |
areLabelsVertical
, setLabelPosition
, setTabsPosition
. void IlvNotebook::setPageBottomMargin | ( | IlvDim | margin | ) |
Changes the bottom margin between the notebook border and the page area.
margin | The new margin. |
void IlvNotebook::setPageLeftMargin | ( | IlvDim | margin | ) |
Changes the left margin between the notebook border and the page area.
margin | The new margin. |
void IlvNotebook::setPageRightMargin | ( | IlvDim | margin | ) |
Changes the right margin between the notebook border and the page area.
margin | The new margin. |
void IlvNotebook::setPageTopMargin | ( | IlvDim | margin | ) |
Changes the top margin between the notebook border and the page area.
margin | The new margin. |
void IlvNotebook::setSelectedPageIndex | ( | IlUShort | index | ) |
Changes the selected page index.
Unlike the method changeSelection
, this method does not call any other methods.
index | The new selected page index. |
changeSelection
. void IlvNotebook::setTabsPosition | ( | IlvPosition | position | ) |
Changes the position of the tabs.
Tabs can be displayed on any side of the notebook (IlvTop
, IlvRight
, IlvLeft
, IlvBottom
).
position | The new tabs position. |
getTabsPosition
, setLabelPosition
, setLabelsVertical
. void IlvNotebook::setXMargin | ( | IlvDim | x | ) |
Changes the x margin of the notebook.
See the method getXMargin
.
x | The new x margin of the notebook. |
getXMargin
, setYMargin
. void IlvNotebook::setYMargin | ( | IlvDim | y | ) |
Changes the y margin of the notebook.
See the method getYMargin
.
y | The new y margin of the notebook. |
getYMargin
, setXMargin
. Shows or hides the notebook tabs labels.
value | A Boolean specifying whether the notebook should show the the labels associated with its tabs. | |
redraw | A Boolean specifying whether the gadget should be redrawn. |
isShowingLabel
. Shows or hides the pictures associated with the notebook tabs.
value | A Boolean specifying whether the notebook should show the the pictures associated with its tabs. | |
redraw | A Boolean specifying whether the gadget should be redrawn. |
isShowingPicture
. © Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.