-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 2 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 09ad0c8..35d4916 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp @@ -689,385 +689,385 @@ void KToolBar::setCurrentComboItem (int id, int index) if (comboBox) comboBox->setCurrentItem( index ); } void KToolBar::changeComboItem (int id, const QString& text, int index) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return; //US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); QComboBox * comboBox = (QComboBox *)( *it ); if (comboBox) comboBox->changeItem( text, index ); } void KToolBar::clearCombo (int id) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return; //US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); QComboBox * comboBox = (QComboBox *)( *it ); if (comboBox) comboBox->clear(); } QString KToolBar::getComboItem (int id, int index) const { Id2WidgetMap::ConstIterator it = id2widget.find( id ); if ( it == id2widget.end() ) return QString::null; //US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); QComboBox * comboBox = (QComboBox *)( *it ); return comboBox ? comboBox->text( index ) : QString::null; } KComboBox * KToolBar::getCombo(int id) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return 0; //US return dynamic_cast<KComboBox *>( *it ); return (KComboBox *)( *it ); } KLineEdit * KToolBar::getLined (int id) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return 0; //US return dynamic_cast<KLineEdit *>( *it ); return (KLineEdit *)( *it ); } KToolBarButton * KToolBar::getButton (int id) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return 0; //US return dynamic_cast<KToolBarButton *>( *it ); return (KToolBarButton *)( *it ); } void KToolBar::alignItemRight (int id, bool right ) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return; if ( rightAligned && !right && (*it) == rightAligned ) rightAligned = 0; if ( (*it) && right ) rightAligned = (*it); } QWidget *KToolBar::getWidget (int id) { Id2WidgetMap::Iterator it = id2widget.find( id ); return ( it == id2widget.end() ) ? 0 : (*it); } void KToolBar::setItemAutoSized (int id, bool yes ) { QWidget *w = getWidget(id); if ( w && yes ) setStretchableWidget( w ); } void KToolBar::clear () { QToolBar::clear(); widget2id.clear(); id2widget.clear(); } void KToolBar::removeItem(int id) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) { kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; return; } QWidget * w = (*it); id2widget.remove( id ); widget2id.remove( w ); widgets.removeRef( w ); delete w; } void KToolBar::removeItemDelayed(int id) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) { kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; return; } QWidget * w = (*it); id2widget.remove( id ); widget2id.remove( w ); widgets.removeRef( w ); w->blockSignals(true); d->idleButtons.append(w); layoutTimer->start( 50, TRUE ); } void KToolBar::hideItem (int id) { QWidget *w = getWidget(id); if ( w ) w->hide(); } void KToolBar::showItem (int id) { QWidget *w = getWidget(id); if ( w ) w->show(); } int KToolBar::itemIndex (int id) { QWidget *w = getWidget(id); return w ? widgets.findRef(w) : -1; } void KToolBar::setFullSize(bool flag ) { setHorizontalStretchable( flag ); setVerticalStretchable( flag ); } bool KToolBar::fullSize() const { return isHorizontalStretchable() || isVerticalStretchable(); } void KToolBar::enableMoving(bool flag ) { //US setMovingEnabled(flag); this->mainWindow()->setToolBarsMovable(flag); } void KToolBar::setBarPos (BarPosition bpos) { if ( !mainWindow() ) return; //US mainWindow()->moveDockWindow( this, (Dock)bpos ); mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); } -KToolBar::BarPosition KToolBar::barPos() const +const KToolBar::BarPosition KToolBar::barPos() { if ( !(QMainWindow*)mainWindow() ) return KToolBar::Top; //US Dock dock; QMainWindow::ToolBarDock dock; int dm1, dm2; bool dm3; ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); //US if ( dock == DockUnmanaged ) { if ( dock == QMainWindow::Unmanaged ) { return (KToolBar::BarPosition)Top; } return (BarPosition)dock; } bool KToolBar::enable(BarStatus stat) { bool mystat = isVisible(); if ( (stat == Toggle && mystat) || stat == Hide ) hide(); else show(); return isVisible() == mystat; } void KToolBar::setMaxHeight ( int h ) { setMaximumHeight( h ); } int KToolBar::maxHeight() { return maximumHeight(); } void KToolBar::setMaxWidth (int dw) { setMaximumWidth( dw ); } int KToolBar::maxWidth() { return maximumWidth(); } void KToolBar::setTitle (const QString& _title) { setLabel( _title ); } void KToolBar::enableFloating (bool ) { } void KToolBar::setIconText(IconText it) { setIconText( it, true ); } void KToolBar::setIconText(IconText icontext, bool update) { bool doUpdate=false; if (icontext != d->m_iconText) { d->m_iconText = icontext; doUpdate=true; } if (update == false) return; if (doUpdate) emit modechange(); // tell buttons what happened // ugly hack to force a QMainWindow::triggerLayout( TRUE ) if ( mainWindow() ) { QMainWindow *mw = mainWindow(); mw->setUpdatesEnabled( FALSE ); mw->setToolBarsMovable( !mw->toolBarsMovable() ); mw->setToolBarsMovable( !mw->toolBarsMovable() ); mw->setUpdatesEnabled( TRUE ); } } KToolBar::IconText KToolBar::iconText() const { return d->m_iconText; } void KToolBar::setIconSize(int size) { setIconSize( size, true ); } void KToolBar::setIconSize(int size, bool update) { bool doUpdate=false; if ( size != d->m_iconSize ) { d->m_iconSize = size; doUpdate=true; } if (update == false) return; if (doUpdate) emit modechange(); // tell buttons what happened // ugly hack to force a QMainWindow::triggerLayout( TRUE ) if ( mainWindow() ) { QMainWindow *mw = mainWindow(); mw->setUpdatesEnabled( FALSE ); mw->setToolBarsMovable( !mw->toolBarsMovable() ); mw->setToolBarsMovable( !mw->toolBarsMovable() ); mw->setUpdatesEnabled( TRUE ); } } int KToolBar::iconSize() const { /*US if ( !d->m_iconSize ) // default value? { if (!::qstrcmp(QObject::name(), "mainToolBar")) return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar); else return KGlobal::iconLoader()->currentSize(KIcon::Toolbar); } return d->m_iconSize; */ int ret = 18; if ( QApplication::desktop()->width() > 320 ) ret = 30; return ret; } void KToolBar::setEnableContextMenu(bool enable ) { d->m_enableContext = enable; } bool KToolBar::contextMenuEnabled() const { return d->m_enableContext; } void KToolBar::setItemNoStyle(int id, bool no_style ) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return; //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); KToolBarButton * button = (KToolBarButton *)( *it ); if (button) button->setNoStyle( no_style ); } void KToolBar::setFlat (bool flag) { if ( !mainWindow() ) return; if ( flag ) //US mainWindow()->moveDockWindow( this, DockMinimized ); mainWindow()->moveToolBar( this, QMainWindow::Minimized ); else //US mainWindow()->moveDockWindow( this, DockTop ); mainWindow()->moveToolBar( this, QMainWindow::Top ); // And remember to save the new look later /*US if ( mainWindow()->inherits( "KMainWindow" ) ) static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); */ } diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h index 49ff856..7a5c114 100644 --- a/microkde/kdeui/ktoolbar.h +++ b/microkde/kdeui/ktoolbar.h @@ -557,385 +557,385 @@ public: /** * Inserts @p text in combobox @p id at position @p index. */ void insertComboItem (int id, const QString& text, int index); /** * Inserts @p list in combobox @p id at position @p index. */ void insertComboList (int id, const QStringList &list, int index); /** * Removes item @p index from combobox @p id. */ void removeComboItem (int id, int index); /** * Sets item @p index to be current item in combobox @p id. */ void setCurrentComboItem (int id, int index); /** * Changes item @p index in combobox @p id to text. * * @p index = -1 refers current item (one displayed in the button). */ void changeComboItem (int id, const QString& text, int index=-1); /** * Clears the combobox @p id. * * Does not delete it or hide it. */ void clearCombo (int id); /** * Returns text of item @p index from combobox @p id. * * @p index = -1 refers to current item. */ QString getComboItem (int id, int index=-1) const; /** * Returns a pointer to the combobox. * * Example: * <pre> * KComboBox *combo = toolbar->getCombo(combo_id); * </pre> * That way you can get access to other public methods * that @ref KComboBox provides. */ KComboBox * getCombo(int id); /** * Returns a pointer to KToolBarLined. * * Example: * <pre> * KLineEdit * lined = toolbar->getKToolBarLined(lined_id); * </pre> * That way you can get access to other public methods * that @ref KLineEdit provides. @ref KLineEdit is the same thing * as @ref QLineEdit plus completion signals. */ KLineEdit * getLined (int id); /** * Returns a pointer to KToolBarButton. * * Example: * <pre> * KToolBarButton * button = toolbar->getButton(button_id); * </pre> * That way you can get access to other public methods * that @ref KToolBarButton provides. * * Using this method is not recommended. */ KToolBarButton * getButton (int id); /** * Align item to the right. * * This works only if toolbar is set to full width. * @see setFullWidth() */ void alignItemRight (int id, bool right = true); /** * Returns a pointer to an inserted widget. * * Wrong ids are not tested. * You can do with this whatever you want, * except change its height (hardcoded). If you change its width * you will probably have to call QToolBar::updateRects(true) * @see QWidget * @see updateRects() * * KDE4: make this const! */ QWidget *getWidget (int id); /** * Set item autosized. * * This works only if the toolbar is set to full width. * Only @p one item can be autosized, and it has to be * the last left-aligned item. Items that come after this must be right * aligned. Items that can be right aligned are Lineds, Frames, Widgets and * Combos. An autosized item will resize itself whenever the toolbar geometry * changes to the last right-aligned item (or to end of toolbar if there * are no right-aligned items.) * @see setFullWidth() * @see alignItemRight() */ void setItemAutoSized (int id, bool yes = true); /** * Remove all items. * * The toolbar is redrawn after it. */ void clear (); /** * Remove item @p id. * * Item is deleted. Toolbar is redrawn after it. */ void removeItem (int id); /** * Remove item @p id. * * Item is deleted when toolbar is redrawn. */ void removeItemDelayed (int id); /** * Hide item. */ void hideItem (int id); /** * Show item. */ void showItem (int id); /** * Returns the index of the given item. * * KDE4: make this const! */ int itemIndex (int id); /** * Set toolbar to full parent size (default). * * In full size mode the bar * extends over the parent's full width or height. If the mode is disabled * the toolbar tries to take as much space as it needs without wrapping, but * it does not exceed the parent box. You can force a certain width or * height with @ref setMaxWidth() or @ref setMaxHeight(). * * If you want to use right-aligned items or auto-sized items you must use * full size mode. */ void setFullSize(bool flag = true); /** * @return @p true if the full-size mode is enabled. Otherwise * it returns @false. */ bool fullSize() const; /** * @deprecated use setMovingEnabled(bool) instead. * Enable or disable moving of toolbar. */ void enableMoving(bool flag = true); /** * Set position of toolbar. * @see BarPosition() */ void setBarPos (BarPosition bpos); /** * Returns position of toolbar. */ - BarPosition barPos() const; + const BarPosition barPos(); /** * @deprecated * Show, hide, or toggle toolbar. * * This method is provided for compatibility only, * please use show() and/or hide() instead. * @see BarStatus */ bool enable(BarStatus stat); /** * @deprecated * Use setMaximumHeight() instead. */ void setMaxHeight (int h); // Set max height for vertical toolbars /** * @deprecated * Use maximumHeight() instead. * Returns the value that was set with @ref setMaxHeight(). */ int maxHeight(); /** * @deprecated * Use setMaximumWidth() instead. * Set maximal width of horizontal (top or bottom) toolbar. */ void setMaxWidth (int dw); /** * @deprecated * Use maximumWidth() instead. * Returns the value that was set with @ref setMaxWidth(). */ int maxWidth(); /** * Set title for toolbar when it floats. * * Titles are however not (yet) * visible. You can't change toolbar's title while it's floating. */ void setTitle (const QString& _title); /** * @deprecated * Use enableMoving() instead. */ void enableFloating (bool arrrrrrgh); /** * Set the kind of painting for buttons. * * Choose from: * @li IconOnly (only icons), * @li IconTextRight (icon and text, text is left from icons), * @li TextOnly (only text), * @li IconTextBottom (icons and text, text is under icons). * @see IconText * */ void setIconText(IconText it); // Note: don't merge with the next one, it breaks Qt properties /** * Similar to @ref setIconText(IconText it) but allows you to * disable or enable updating. If @p update is false, then the * buttons will not be updated. This is useful only if you know * that you will be forcing an update later. */ void setIconText(IconText it, bool update); /** * @return The current text style for buttons. */ IconText iconText() const; /** * Set the icon size to load. Usually you should not call * this, the icon size is taken care of by KIconLoader * and globally configured. * By default, the toolbar will load icons of size 32 for main * toolbars and 22 for other toolbars * @see KIconLoader. * * @param size The size to use */ void setIconSize(int size); // Note: don't merge with the next one, it breaks Qt properties /** * Same as @ref setIconText(int size) but allows you * to disable the toolbar update. * * @param size The size to use * @param update If true, then the toolbar will be updated after * this */ void setIconSize(int size, bool update); /** * @return The current icon size for buttons. */ int iconSize() const; /** * This allows you to enable or disable the context menu. * * @param enable If false, then the context menu will be disabled */ void setEnableContextMenu(bool enable = true); /** * Returns whether or not the context menu is disabled * * @return The context menu state */ bool contextMenuEnabled() const; /** * This will inform a toolbar button to ignore certain style * changes. Specifically, it will ignore IconText (always IconOnly) * and will not allow image effects to apply. * * @param id The button to exclude from styles * @param no_style If true, then it is excluded (default: true). */ void setItemNoStyle(int id, bool no_style = true); void setFlat (bool flag); /** * @return the number of items in the toolbar */ int count() const; /** * Instruct the toolbar to save it's current state to either the app * config file or to the XML-GUI resource file (whichever has * precedence). */ void saveState(); /** * Save the toolbar settings to group @p configGroup in @p config. */ void saveSettings(KConfig *config, const QString &configGroup); /** * Read the toolbar settings from group @p configGroup in @p config * and apply them. */ void applySettings(KConfig *config, const QString &configGroup); /** * Tell the toolbar what XML-GUI resource file it should use to save * it's state. The state of the toolbar (position, size, etc) is * saved in KConfig files if the application does not use XML-GUI.. * but if the app does, then it's saved the XML file. This function * allows this to happen. * * @param xmlfile The XML-GUI resource file to write to * @param xml The DOM document for the XML-GUI building */ // void setXML(const QString& xmlfile, const QDomDocument& xml); /* @internal */ void setXMLGUIClient( KXMLGUIClient *client ); /** * Assign a (translated) text to this toolbar. This is used * for the tooltip on the handle, and when listing the toolbars. */ void setText( const QString & txt ); /** * @return the toolbar's text. */ QString text() const; void setStretchableWidget( QWidget *w ); QSizePolicy sizePolicy() const; bool highlight() const; QSize sizeHint() const; QSize minimumSizeHint() const; QSize minimumSize() const; void hide(); void show(); void updateRects( bool = FALSE ) {} |