kdeui Library API Documentation

KToolBarButton Class Reference

A toolbar button. More...

#include <ktoolbarbutton.h>

Inheritance diagram for KToolBarButton:

QToolButton List of all members.

Public Slots

void modeChange ()
 This slot should be called whenever the toolbar mode has potentially changed.

virtual void setTextLabel (const QString &, bool tipToo)

Public Methods

 KToolBarButton (const QString &icon, int id, QWidget *parent, const char *name=0L, const QString &txt=QString::null, KInstance *_instance=KGlobal::instance())
 Construct a button with an icon loaded by the button itself.

 KToolBarButton (const QPixmap &pixmap, int id, QWidget *parent, const char *name=0L, const QString &txt=QString::null)
 Construct a button with an existing pixmap.

 KToolBarButton (QWidget *parent=0L, const char *name=0L)
 Construct a separator button.

 ~KToolBarButton ()
 Standard destructor.

virtual void setPixmap (const QPixmap &pixmap)
void setDefaultPixmap (const QPixmap &pixmap)
void setDisabledPixmap (const QPixmap &pixmap)
virtual void setText (const QString &text)
 Set the text for this button.

virtual void setIcon (const QString &icon)
 Set the icon for this button.

virtual void setIcon (const QPixmap &pixmap)
 
Since:
3.1


virtual void setIconSet (const QIconSet &iconset)
 Set the pixmaps for this toolbar button from a QIconSet.

void setIcon (const QString &icon, bool)
void setDefaultIcon (const QString &icon)
void setDisabledIcon (const QString &icon)
void on (bool flag=true)
 Turn this button on or off.

void toggle ()
 Toggle this button.

void setToggle (bool toggle=true)
 Turn this button into a toggle button or disable the toggle aspects of it.

QPopupMenupopup ()
 Return a pointer to this button's popup menu (if it exists).

void setPopup (QPopupMenu *p, bool toggle=false)
 Give this button a popup menu.

void setDelayedPopup (QPopupMenu *p, bool toggle=false)
 Gives this button a delayed popup menu.

void setRadio (bool f=true)
 Turn this button into a radio button.

void setNoStyle (bool no_style=true)
 Toolbar buttons naturally will assume the global styles concerning icons, icons sizes, etc.


Protected Methods

bool isRaised () const
 
Since:
3.1


bool isActive () const
 
Since:
3.1


int iconTextMode () const
 
Since:
3.1



Detailed Description

A toolbar button.

This is used internally by KToolBar, use the KToolBar methods instead.

Definition at line 45 of file ktoolbarbutton.h.


Constructor & Destructor Documentation

KToolBarButton::KToolBarButton const QString   icon,
int    id,
QWidget   parent,
const char *    name = 0L,
const QString   txt = QString::null,
KInstance   _instance = KGlobal::instance()
 

Construct a button with an icon loaded by the button itself.

This will trust the button to load the correct icon with the correct size.

Parameters:
icon  Name of icon to load (may be absolute or relative)
id  Id of this button
parent  This button's parent
name  This button's internal name
txt  This button's text (in a tooltip or otherwise)

Definition at line 119 of file ktoolbarbutton.cpp.

References modeChange(), and QToolButton::setTextLabel().

KToolBarButton::KToolBarButton const QPixmap   pixmap,
int    id,
QWidget   parent,
const char *    name = 0L,
const QString   txt = QString::null
 

Construct a button with an existing pixmap.

It is not recommended that you use this as the internal icon loading code will almost always get it "right".

Parameters:
icon  Name of icon to load (may be absolute or relative)
id  Id of this button
parent  This button's parent
name  This button's internal name
txt  This button's text (in a tooltip or otherwise)

Definition at line 151 of file ktoolbarbutton.cpp.

References modeChange(), setIconSet(), and QToolButton::setTextLabel().

KToolBarButton::KToolBarButton QWidget   parent = 0L,
const char *    name = 0L
 

Construct a separator button.

Parameters:
parent  This button's parent
name  This button's internal name

Definition at line 109 of file ktoolbarbutton.cpp.

KToolBarButton::~KToolBarButton  
 

Standard destructor.

Definition at line 181 of file ktoolbarbutton.cpp.


Member Function Documentation

void KToolBarButton::setPixmap const QPixmap   pixmap [virtual]
 

Deprecated:
Set the pixmap directly for this button. This pixmap should be the active one... the dimmed and disabled pixmaps are constructed based on this one. However, don't use this function unless you are positive that you don't want to use setIcon.
Parameters:
pixmap  The active pixmap

Definition at line 301 of file ktoolbarbutton.cpp.

References QToolButton::iconSet(), QPixmap::isNull(), QToolButton::setIconSet(), and QIconSet::setPixmap().

Referenced by KToolBar::setButtonPixmap().

void KToolBarButton::setDefaultPixmap const QPixmap   pixmap
 

Deprecated:
Force the button to use this pixmap as the default one rather then generating it using effects.
Parameters:
pixmap  The pixmap to use as the default (normal) one

Definition at line 313 of file ktoolbarbutton.cpp.

References QToolButton::iconSet(), QToolButton::setIconSet(), and QIconSet::setPixmap().

void KToolBarButton::setDisabledPixmap const QPixmap   pixmap
 

Deprecated:
Force the button to use this pixmap when disabled one rather then generating it using effects.
Parameters:
pixmap  The pixmap to use when disabled

Definition at line 320 of file ktoolbarbutton.cpp.

References QToolButton::iconSet(), QToolButton::setIconSet(), and QIconSet::setPixmap().

void KToolBarButton::setText const QString   text [virtual]
 

Set the text for this button.

The text will be either used as a tooltip (IconOnly) or will be along side the icon

Parameters:
text  The button (or tooltip) text

Definition at line 276 of file ktoolbarbutton.cpp.

References modeChange(), and QToolButton::setTextLabel().

void KToolBarButton::setIcon const QString   icon [virtual]
 

Set the icon for this button.

The icon will be loaded internally with the correct size. This function is preferred over setIconSet

Parameters:
icon  The name of the icon

Definition at line 282 of file ktoolbarbutton.cpp.

References QToolButton::setIconSet().

Referenced by modeChange(), KToolBar::setButtonIcon(), and setIcon().

virtual void KToolBarButton::setIcon const QPixmap   pixmap [inline, virtual]
 

Since:
3.1

Definition at line 141 of file ktoolbarbutton.h.

void KToolBarButton::setIconSet const QIconSet   iconset [virtual]
 

Set the pixmaps for this toolbar button from a QIconSet.

If you call this you don't need to call any of the other methods that set icons or pixmaps.

Parameters:
iconset  The iconset to use

Reimplemented from QToolButton.

Definition at line 295 of file ktoolbarbutton.cpp.

References QToolButton::setIconSet().

Referenced by KToolBarButton(), and KToolBar::setButtonIconSet().

void KToolBarButton::setIcon const QString   icon,
bool   
[inline]
 

Deprecated:
Set the active icon for this button. The pixmap itself is loaded internally based on the icon size... .. the disabled and default pixmaps, however will only be constructed if generate is true. This function is preferred over setPixmap
Parameters:
icon  The name of the active icon
generate  If true, then the other icons are automagically generated from this one

Definition at line 164 of file ktoolbarbutton.h.

References setIcon().

void KToolBarButton::setDefaultIcon const QString   icon
 

Deprecated:
Force the button to use this icon as the default one rather then generating it using effects.
Parameters:
icon  The icon to use as the default (normal) one

Definition at line 327 of file ktoolbarbutton.cpp.

References QToolButton::iconSet(), QToolButton::setIconSet(), and QIconSet::setPixmap().

void KToolBarButton::setDisabledIcon const QString   icon
 

Deprecated:
Force the button to use this icon when disabled one rather then generating it using effects.
Parameters:
icon  The icon to use when disabled

Definition at line 341 of file ktoolbarbutton.cpp.

References QToolButton::iconSet(), QToolButton::setIconSet(), and QIconSet::setPixmap().

void KToolBarButton::on bool    flag = true
 

Turn this button on or off.

Parameters:
flag  true or false

Definition at line 746 of file ktoolbarbutton.cpp.

References QToolButton::setOn().

Referenced by KToolBar::setButton().

void KToolBarButton::toggle  
 

Toggle this button.

Reimplemented from QToolButton.

Definition at line 758 of file ktoolbarbutton.cpp.

References QToolButton::setOn().

Referenced by setDelayedPopup(), setPopup(), and KToolBar::toggleButton().

void KToolBarButton::setToggle bool    toggle = true
 

Turn this button into a toggle button or disable the toggle aspects of it.

This does not toggle the button itself. Use toggle() for that.

Parameters:
toggle  true or false

Definition at line 764 of file ktoolbarbutton.cpp.

References QToolButton::setToggleButton().

Referenced by KToolBar::setToggle().

QPopupMenu * KToolBarButton::popup  
 

Return a pointer to this button's popup menu (if it exists).

Reimplemented from QToolButton.

Definition at line 362 of file ktoolbarbutton.cpp.

void KToolBarButton::setPopup QPopupMenu   p,
bool    toggle = false
 

Give this button a popup menu.

There will not be a delay when you press the button. Use setDelayedPopup if you want that behavior. You can also make the popup-menu "sticky", i.e. visible until a selection is made or the mouse is clikced elsewhere, by simply setting the second argument to true. This "sticky" button feature allows you to make a selection without having to press and hold down the mouse while making a selection.

Parameters:
p  The new popup menu
toggle  if true, makes the button "sticky" (toggled)

Definition at line 355 of file ktoolbarbutton.cpp.

References toggle().

Referenced by KToolBar::insertButton(), KToolBarPopupAction::plug(), KActionMenu::plug(), and setDelayedPopup().

void KToolBarButton::setDelayedPopup QPopupMenu   p,
bool    toggle = false
 

Gives this button a delayed popup menu.

This function allows you to add a delayed popup menu to the button. The popup menu is then only displayed when the button is pressed and held down for about half a second. You can also make the popup-menu "sticky", i.e. visible until a selection is made or the mouse is clikced elsewhere, by simply setting the second argument to true. This "sticky" button feature allows you to make a selection without having to press and hold down the mouse while making a selection.

Parameters:
p  the new popup menu
toggle  if true, makes the button "sticky" (toggled)

Definition at line 367 of file ktoolbarbutton.cpp.

References setPopup(), and toggle().

Referenced by KToolBar::setDelayedPopup().

void KToolBarButton::setRadio bool    f = true
 

Turn this button into a radio button.

Parameters:
f  true or false

Definition at line 740 of file ktoolbarbutton.cpp.

Referenced by KToolBarRadioGroup::addButton().

void KToolBarButton::setNoStyle bool    no_style = true
 

Toolbar buttons naturally will assume the global styles concerning icons, icons sizes, etc.

You can use this function to explicitely turn this off, if you like.

Parameters:
no_style  Will disable styles if true

Definition at line 731 of file ktoolbarbutton.cpp.

References modeChange().

Referenced by KToolBar::setItemNoStyle().

void KToolBarButton::modeChange   [slot]
 

This slot should be called whenever the toolbar mode has potentially changed.

This includes such events as text changing, orientation changing, etc.

Definition at line 186 of file ktoolbarbutton.cpp.

References QToolTip::add(), QApplication::globalStrut(), QSize::height(), QFontMetrics::lineSpacing(), QToolTip::remove(), setIcon(), QSize::setWidth(), QToolButton::textLabel(), KGlobalSettings::toolBarFont(), QSize::width(), and QFontMetrics::width().

Referenced by KToolBarButton(), setNoStyle(), and setText().

bool KToolBarButton::isRaised   [protected]
 

Since:
3.1

Definition at line 788 of file ktoolbarbutton.cpp.

bool KToolBarButton::isActive   [protected]
 

Since:
3.1

Definition at line 793 of file ktoolbarbutton.cpp.

int KToolBarButton::iconTextMode   [protected]
 

Since:
3.1

Definition at line 798 of file ktoolbarbutton.cpp.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:08 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001