# tabwidget class

Provides a Tab Widget.

Inherits
object widget
Description
The tabwidget class provides a stack of tabbed widgets. Each tab is associated with a different widget (called a `page'). Only the current tab's page is shown in the page area; all the others tabs pages are hidden. The user can show a different page by clicking on its tab.
Functions

`$addTab(<name>,<textlabel>,[<icon>])`
Adds another page to the tab view with the text label and optional icon.
`$insertTab(<name>,<texlabel>,<number index>)`
Inserts another tab and page to the tab view with name and label-text specified. If index is not specified, the tab is simply appended. Otherwise the new tab is inserted at the specified position.
`$setTabToolTip(<tabname>,<tooltip>)`
Sets the tab tool tip for the tab-name to <tooltip>.
`$removeTabToolTip(<tabname>)`
Removes the tab tool tip for the tab. If the page does not have a tip, nothing happens.
`$setTabLabel(<tabname>, <label>)`
Sets the tab label for <tabname> to label.
`$changeTab(<tabname>,<tablabel>,[<icon>])`
Defines a new label, and optional icon, for the tab .
`$setCurrentPage(<int>)`
Sets the index position of the current tab page to <int>.
`$currentPageIndex()`
Returns the current page index.
`$label(<index>)`
Retunrs the label to the <index>.
`$currentTabLabel()`
Returns the label of the current tab.
`$setMargin(<number int>)`
Sets the margin in this tab widget to <number int>.
`$margin()`
Returns the margin in this tab widget.
`$removePage(<tabname>)`
Remove the page with <tabname>.
`$setTabPosition()`
Sets TabPosition. Valid parameters are : Top, Bottom.
`$count()`
This property holds the number of tabs in the tab bar.
`$currentChangedEvent()`

This function is invoched when the current tab was changed.
The default implementation emits the $currentChange() signal.
|--EXAMPLE:
|-Start:
#Let's start.
#first we'll create the main tabwidget.
%Tabwidget=$new(tabwidget)
%Tabwidget->$setToolTip("Example of TabWidget class")
%Tabwidget->$setMargin(30)
%Tabwidget->$setTabPosition(Top)
#Now we'll create the new widgets and put they in to the main tabwidget.
%firsttab=$new(widget,%Tabwidget)
%secondtab=$new(widget,%Tabwidget)
#Now we'll create the item to put in to tab's pages.
%layoutfirsttab=$new(layout,%firsttab)
%labelbt=$new(label,%firsttab)
%labelbt->$settext(Botton Tab)
%labeltt=$new(label,%firsttab)
%labeltt->$settext(Top Tab)
%buttontb=$new(button,%firsttab)
%buttontb->$settext("To &Botton")
%buttontt=$new(button,%firsttab)
%buttontt->$settext("To &Top")
#Now we'll give a layout to all items.
%layoutfirsttab->$addwidget(%labelbt,0,0)
%layoutfirsttab->$addwidget(%labeltt,0,1)
%layoutfirsttab->$addwidget(%buttontb,1,0)
%layoutfirsttab->$addwidget(%buttontt,1,1)
#Add the page to the main tab.
%Tabwidget->$addTab(%firsttab,Top&Button,33)
#Implementing the action to do when the user click the buttons.
privateimpl(%buttontb,mousepressevent)
{
%Tabwidget->$setTabPosition(Bottom)
}
privateimpl(%buttontt,mousepressevent)
{
%Tabwidget->$setTabPosition(Top)
}
#We do the same work with the second tab's page.
%layoutsecondtab=$new(layout,%secondtab)
%labelwp=$new(label,%secondtab)
%labelwp->$settext("Enjoy the new Class provided by")
%layoutsecondtab->$addwidget(%labelwp,0,0)
%labelwp->$setalignment("Center")
%labelgen=$new(label,%secondtab)
%labelgen->$settext(Grifisx \& Noldor)
%labelgen->$setalignment("Center")
%layoutsecondtab->$addwidget(%labelgen,1,0)
%Tabwidget->$addTab(%secondtab,&About,50)
#Let's show our example.
%Tabwidget->$show()
|---End.

Signals

`$currentChange()`
This signal is emitted by the default implementation of $currentChangedEvent(). If you reimplement that function you will have to emit the signal manually (if you still need it).

Index, Object Classes

KVIrc 3.2.0 Documentation
Generated by root at Mon Mar 13 07:05:21 2006