lib

#include <KoTabBar.h>

Public Slots

void setTabs (const TQStringList &list)
void setReadOnly (bool ro)
void setReverseLayout (bool reverse)
void addTab (const TQString &text)
void removeTab (const TQString &text)
void renameTab (const TQString &old_name, const TQString &new_name)
void moveTab (unsigned tab, unsigned target)
void scrollBack ()
void scrollForward ()
void scrollFirst ()
void scrollLast ()
void setActiveTab (const TQString &text)
void clear ()
TQSize sizeHint () const

Signals

void tabChanged (const TQString &_text)
void tabMoved (unsigned tab, unsigned target)
void contextMenu (const TQPoint &pos)
void doubleClicked ()

Public Member Functions

 KoTabBar (TQWidget *parent=0, const char *name=0)
virtual ~KoTabBar ()
bool readOnly () const
bool reverseLayout () const
TQStringList tabs () const
unsigned count () const
TQString activeTab () const
bool canScrollBack () const
bool canScrollForward () const
void ensureVisible (const TQString &tab)

Protected Slots

void autoScrollBack ()
void autoScrollForward ()

Protected Member Functions

virtual void paintEvent (TQPaintEvent *ev)
virtual void resizeEvent (TQResizeEvent *ev)
virtual void mousePressEvent (TQMouseEvent *ev)
virtual void mouseReleaseEvent (TQMouseEvent *ev)
virtual void mouseDoubleClickEvent (TQMouseEvent *ev)
virtual void mouseMoveEvent (TQMouseEvent *ev)
virtual void wheelEvent (TQWheelEvent *e)

Detailed Description

The KoTabBar class provides a tab bar, for use to switch active page/sheet in a document.

The tab bar is typically used in the main view. It is the small widget on the bottom left corner. Pages/sheets are displayed as tabs, clicking on one of the tab will activate the corresponding sheet (this is actually done in main view). Current active page/sheet is marked by bold text.

The tab bar supports page/sheet reorder by dragging a certain tab and move it to another location. The main view should handle the necessary action to perform the actual reorder.

There are four scroll buttons available in the tab bar. They are used to shift the tabs in left and right direction, for example when there are more tabs than the space available to display all tabs.

Since a page/sheet can be hidden, the tab bar only shows the visible page/sheet. When a hidden page or sheet is shown again, it will be on the same position as before it was hidden.

When the document is protected, it is necessary to set the tab bar as read-only using setReadOnly (see also readOnly). If it is set to true, tabs can not be moved by dragging and context menu will not be displayed.

A bar with tabs and scroll buttons.

Definition at line 61 of file KoTabBar.h.

Constructor & Destructor Documentation

◆ KoTabBar()

KoTabBar::KoTabBar ( TQWidget * parent = 0,
const char * name = 0 )

Creates a new tabbar.

Definition at line 349 of file KoTabBar.cpp.

◆ ~KoTabBar()

KoTabBar::~KoTabBar ( )
virtual

Destroy the tabbar.

Definition at line 382 of file KoTabBar.cpp.

Member Function Documentation

◆ activeTab()

TQString KoTabBar::activeTab ( ) const

Returns the active tab.

Definition at line 737 of file KoTabBar.cpp.

◆ addTab

void KoTabBar::addTab ( const TQString & text)
slot

Adds a tab to the tab bar.

Definition at line 388 of file KoTabBar.cpp.

◆ autoScrollBack

void KoTabBar::autoScrollBack ( )
protectedslot

Definition at line 628 of file KoTabBar.cpp.

◆ autoScrollForward

void KoTabBar::autoScrollForward ( )
protectedslot

Definition at line 640 of file KoTabBar.cpp.

◆ canScrollBack()

bool KoTabBar::canScrollBack ( ) const

Returns true if it is possible to scroll one tab back.

See also
scrollBack

Definition at line 483 of file KoTabBar.cpp.

◆ canScrollForward()

bool KoTabBar::canScrollForward ( ) const

Returns true if it is possible to scroll one tab forward.

See also
scrollForward

Definition at line 491 of file KoTabBar.cpp.

◆ clear

void KoTabBar::clear ( )
slot

Removes all tabs.

Definition at line 410 of file KoTabBar.cpp.

◆ contextMenu

void KoTabBar::contextMenu ( const TQPoint & pos)
signal

This signal is emitted whenever the tab bar is right-clicked.

Typically it is used to popup a context menu.

◆ count()

unsigned KoTabBar::count ( ) const

Returns number of tabs.

This is the same as KoTabBar::tabs().count()

Definition at line 478 of file KoTabBar.cpp.

◆ doubleClicked

void KoTabBar::doubleClicked ( )
signal

This signal is emitted whenever the tab bar is double-clicked.

◆ ensureVisible()

void KoTabBar::ensureVisible ( const TQString & tab)

Ensures that specified tab is visible.

Definition at line 572 of file KoTabBar.cpp.

◆ mouseDoubleClickEvent()

void KoTabBar::mouseDoubleClickEvent ( TQMouseEvent * ev)
protectedvirtual

Definition at line 850 of file KoTabBar.cpp.

◆ mouseMoveEvent()

void KoTabBar::mouseMoveEvent ( TQMouseEvent * ev)
protectedvirtual

Definition at line 789 of file KoTabBar.cpp.

◆ mousePressEvent()

void KoTabBar::mousePressEvent ( TQMouseEvent * ev)
protectedvirtual

Definition at line 745 of file KoTabBar.cpp.

◆ mouseReleaseEvent()

void KoTabBar::mouseReleaseEvent ( TQMouseEvent * ev)
protectedvirtual

Definition at line 776 of file KoTabBar.cpp.

◆ moveTab

void KoTabBar::moveTab ( unsigned tab,
unsigned target )
slot

Moves a tab to another position and reorder other tabs.

Example 1: if there are four tabs A - B - C - D, then moveTab(2,1) will yield A - C - B - D. This is because 2nd tab (i.e C) is moved to a position before 1th tab (i.e B).

Example 2: for these tabs: X - Y - Z, moveTab(0,3) will move tab X after tab Z so that the result is Y - Z - X.

Definition at line 592 of file KoTabBar.cpp.

◆ paintEvent()

void KoTabBar::paintEvent ( TQPaintEvent * ev)
protectedvirtual

Definition at line 652 of file KoTabBar.cpp.

◆ readOnly()

bool KoTabBar::readOnly ( ) const

Returns true if the tab bar is read only.

Definition at line 419 of file KoTabBar.cpp.

◆ removeTab

void KoTabBar::removeTab ( const TQString & text)
slot

Removes a tab from the bar.

If the tab was the active one then no tab will be active. It is recommended to call setActiveTab after a call to this function.

Definition at line 396 of file KoTabBar.cpp.

◆ renameTab

void KoTabBar::renameTab ( const TQString & old_name,
const TQString & new_name )
slot

Renames a tab.

Definition at line 729 of file KoTabBar.cpp.

◆ resizeEvent()

void KoTabBar::resizeEvent ( TQResizeEvent * ev)
protectedvirtual

Definition at line 717 of file KoTabBar.cpp.

◆ reverseLayout()

bool KoTabBar::reverseLayout ( ) const

Returns true if tabs and scroll buttons will be laid out in a mirrored (right to left) fashion.

Definition at line 429 of file KoTabBar.cpp.

◆ scrollBack

void KoTabBar::scrollBack ( )
slot

Scrolls one tab back.

Does nothing if the leftmost tab (rightmost tab when reverseLayout is true) is already the first tab.

See also
canScrollBack

Definition at line 499 of file KoTabBar.cpp.

◆ scrollFirst

void KoTabBar::scrollFirst ( )
slot

Scrolls to the first tab.

Does nothing if the leftmost tab (rightmost tab when reverseLayout is true) is already the first tab.

See also
canScrollBack

Definition at line 526 of file KoTabBar.cpp.

◆ scrollForward

void KoTabBar::scrollForward ( )
slot

Scrolls one tab forward.

Does nothing if the rightmost tab (leftmost tab when reverseLayout is true) is already the last tab.

See also
canScrollForward

Definition at line 512 of file KoTabBar.cpp.

◆ scrollLast

void KoTabBar::scrollLast ( )
slot

Scrolls to the last tab.

Does nothing if the rightmost tab (leftmost tab when reverseLayout is true) is already the last tab.

See also
canScrollForward

Definition at line 537 of file KoTabBar.cpp.

◆ setActiveTab

void KoTabBar::setActiveTab ( const TQString & text)
slot

Sets active tab.

Definition at line 612 of file KoTabBar.cpp.

◆ setReadOnly

void KoTabBar::setReadOnly ( bool ro)
slot

Sets the tab bar to be read only.

If the tab bar is read only, tab reordering is not allowed. This means that signal tabMoved, contextMenu and doubleClicked would not be emitted.

Definition at line 424 of file KoTabBar.cpp.

◆ setReverseLayout

void KoTabBar::setReverseLayout ( bool reverse)
slot

If reverse is true, dialogs and scroll buttonswidgets will be laid out in a mirrored as if the sheet is in right to left languages (such as Arabic and Hebrew).

Definition at line 434 of file KoTabBar.cpp.

◆ setTabs

void KoTabBar::setTabs ( const TQStringList & list)
slot

Replaces all tabs with the list of strings.

Definition at line 446 of file KoTabBar.cpp.

◆ sizeHint

TQSize KoTabBar::sizeHint ( ) const
slot

Definition at line 724 of file KoTabBar.cpp.

◆ tabChanged

void KoTabBar::tabChanged ( const TQString & _text)
signal

Emitted if the active tab changed.

◆ tabMoved

void KoTabBar::tabMoved ( unsigned tab,
unsigned target )
signal

This signal is emitted whenever a tab is dragged, moved and released.

This means that the user wants to move a tab into another position (right before target).

When the signal is emitted, the tabs are not reordered. Therefore if you just ignore this signal, than no tab reorder is possible. Call moveTab (from the slot connected to this signal) to perform the actual tab reorder.

◆ tabs()

TQStringList KoTabBar::tabs ( ) const

Returns all the tab as list of strings.

Definition at line 473 of file KoTabBar.cpp.

◆ wheelEvent()

void KoTabBar::wheelEvent ( TQWheelEvent * e)
protectedvirtual

Definition at line 858 of file KoTabBar.cpp.


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