From df726f3e9706e8264827dc1dc8338225c3b6434f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Feb 2013 17:25:43 -0600 Subject: Fix FTBFS --- kbabel/commonui/kactionselector.cpp | 562 --------------------- kbabel/commonui/kactionselector.h | 411 --------------- kbabel/commonui/klisteditor.ui | 261 ---------- kbabel/commonui/klisteditor.ui.h | 122 ----- kbabel/commonui/tdeactionselector.cpp | 562 +++++++++++++++++++++ kbabel/commonui/tdeactionselector.h | 411 +++++++++++++++ kbabel/commonui/tdelisteditor.ui | 261 ++++++++++ kbabel/commonui/tdelisteditor.ui.h | 122 +++++ tdecachegrind/tdecachegrind/stackselection.cpp | 230 --------- tdecachegrind/tdecachegrind/stackselection.h | 81 --- tdecachegrind/tdecachegrind/stackselectionbase.ui | 80 --- tdecachegrind/tdecachegrind/stactdeselection.cpp | 230 +++++++++ tdecachegrind/tdecachegrind/stactdeselection.h | 81 +++ .../tdecachegrind/stactdeselectionbase.ui | 80 +++ umbrello/umbrello/textblocklist.h | 23 - umbrello/umbrello/textbloctdelist.h | 23 + umbrello/umbrello/worktoolbar.cpp | 315 ------------ umbrello/umbrello/worktoolbar.h | 184 ------- umbrello/umbrello/wortdetoolbar.cpp | 315 ++++++++++++ umbrello/umbrello/wortdetoolbar.h | 184 +++++++ 20 files changed, 2269 insertions(+), 2269 deletions(-) delete mode 100644 kbabel/commonui/kactionselector.cpp delete mode 100644 kbabel/commonui/kactionselector.h delete mode 100644 kbabel/commonui/klisteditor.ui delete mode 100644 kbabel/commonui/klisteditor.ui.h create mode 100644 kbabel/commonui/tdeactionselector.cpp create mode 100644 kbabel/commonui/tdeactionselector.h create mode 100644 kbabel/commonui/tdelisteditor.ui create mode 100644 kbabel/commonui/tdelisteditor.ui.h delete mode 100644 tdecachegrind/tdecachegrind/stackselection.cpp delete mode 100644 tdecachegrind/tdecachegrind/stackselection.h delete mode 100644 tdecachegrind/tdecachegrind/stackselectionbase.ui create mode 100644 tdecachegrind/tdecachegrind/stactdeselection.cpp create mode 100644 tdecachegrind/tdecachegrind/stactdeselection.h create mode 100644 tdecachegrind/tdecachegrind/stactdeselectionbase.ui delete mode 100644 umbrello/umbrello/textblocklist.h create mode 100644 umbrello/umbrello/textbloctdelist.h delete mode 100644 umbrello/umbrello/worktoolbar.cpp delete mode 100644 umbrello/umbrello/worktoolbar.h create mode 100644 umbrello/umbrello/wortdetoolbar.cpp create mode 100644 umbrello/umbrello/wortdetoolbar.h diff --git a/kbabel/commonui/kactionselector.cpp b/kbabel/commonui/kactionselector.cpp deleted file mode 100644 index c2638ff5..00000000 --- a/kbabel/commonui/kactionselector.cpp +++ /dev/null @@ -1,562 +0,0 @@ -/*************************************************************************** - TDEActionSelector.cpp - A widget for selecting and arranging actions/objects - ------------------- - begin : Mon June 3 2002 - copyright : (C) 2002 by Anders Lund - email : anders@alweb.dk - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * * - * In addition, as a special exception, the copyright holders give * - * permission to link the code of this program with any edition of * - * the TQt library by Trolltech AS, Norway (or with modified versions * - * of TQt that use the same license as TQt), and distribute linked * - * combinations including the two. You must obey the GNU General * - * Public License in all respects for all of the code used other than * - * TQt. If you modify this file, you may extend this exception to * - * your version of the file, but you are not obligated to do so. If * - * you do not wish to do so, delete this exception statement from * - * your version. * - ***************************************************************************/ - -#include "kactionselector.h" -#include - -#include -#include -#include // for spacingHint() -#include - -#include -#include -#include -#include -#include -#include -#include - -class TDEActionSelectorPrivate { - public: - TQListBox *availableListBox, *selectedListBox; - TQToolButton *btnAdd, *btnRemove, *btnUp, *btnDown; - TQLabel *lAvailable, *lSelected; - bool moveOnDoubleClick, keyboardEnabled; - TDEActionSelector::ButtonIconSize iconSize; - TQString addIcon, removeIcon, upIcon, downIcon; - TDEActionSelector::InsertionPolicy availableInsertionPolicy, selectedInsertionPolicy; - bool showUpDownButtons; -}; - -//BEGIN Constructor/destructor - -TDEActionSelector::TDEActionSelector( TQWidget *parent, const char *name ) - : TQWidget( parent, name ) -{ - d = new TDEActionSelectorPrivate(); - d->moveOnDoubleClick = true; - d->keyboardEnabled = true; - d->iconSize = SmallIcon; - d->addIcon = TQApplication::reverseLayout() ? "back" : "forward"; - d->removeIcon = TQApplication::reverseLayout() ? "forward" : "back"; - d->upIcon = "up"; - d->downIcon = "down"; - d->availableInsertionPolicy = Sorted; - d->selectedInsertionPolicy = BelowCurrent; - d->showUpDownButtons = true; - - //int isz = IconSize( KIcon::Small ); - - TQHBoxLayout *lo = new TQHBoxLayout( this ); - lo->setSpacing( KDialog::spacingHint() ); - - TQVBoxLayout *loAv = new TQVBoxLayout( lo ); - d->lAvailable = new TQLabel( i18n("&Available:"), this ); - loAv->addWidget( d->lAvailable ); - d->availableListBox = new TQListBox( this ); - loAv->addWidget( d->availableListBox ); - d->lAvailable->setBuddy( d->availableListBox ); - - TQVBoxLayout *loHBtns = new TQVBoxLayout( lo ); - loHBtns->addStretch( 1 ); - d->btnAdd = new TQToolButton( this ); - loHBtns->addWidget( d->btnAdd ); - d->btnRemove = new TQToolButton( this ); - loHBtns->addWidget( d->btnRemove ); - loHBtns->addStretch( 1 ); - - TQVBoxLayout *loS = new TQVBoxLayout( lo ); - d->lSelected = new TQLabel( i18n("&Selected:"), this ); - loS->addWidget( d->lSelected ); - d->selectedListBox = new TQListBox( this ); - loS->addWidget( d->selectedListBox ); - d->lSelected->setBuddy( d->selectedListBox ); - - TQVBoxLayout *loVBtns = new TQVBoxLayout( lo ); - loVBtns->addStretch( 1 ); - d->btnUp = new TQToolButton( this ); - loVBtns->addWidget( d->btnUp ); - d->btnDown = new TQToolButton( this ); - loVBtns->addWidget( d->btnDown ); - loVBtns->addStretch( 1 ); - - loadIcons(); - - connect( d->btnAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonAddClicked()) ); - connect( d->btnRemove, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonRemoveClicked()) ); - connect( d->btnUp, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonUpClicked()) ); - connect( d->btnDown, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonDownClicked()) ); - connect( d->availableListBox, TQT_SIGNAL(doubleClicked(TQListBoxItem*)), - this, TQT_SLOT(itemDoubleClicked(TQListBoxItem*)) ); - connect( d->selectedListBox, TQT_SIGNAL(doubleClicked(TQListBoxItem*)), - this, TQT_SLOT(itemDoubleClicked(TQListBoxItem*)) ); - connect( d->availableListBox, TQT_SIGNAL(currentChanged(TQListBoxItem*)), - this, TQT_SLOT(slotCurrentChanged(TQListBoxItem *)) ); - connect( d->selectedListBox, TQT_SIGNAL(currentChanged(TQListBoxItem*)), - this, TQT_SLOT(slotCurrentChanged(TQListBoxItem *)) ); - - d->availableListBox->installEventFilter( this ); - d->selectedListBox->installEventFilter( this ); -} - -TDEActionSelector::~TDEActionSelector() -{ - delete d; -} - -//END Constructor/destroctor - -//BEGIN Public Methods - -TQListBox *TDEActionSelector::availableListBox() -{ - return d->availableListBox; -} - -TQListBox *TDEActionSelector::selectedListBox() -{ - return d->selectedListBox; -} - -void TDEActionSelector::setButtonIcon( const TQString &icon, MoveButton button ) -{ - int isz; - if ( d->iconSize == SmallIcon ) isz = IconSize( KIcon::Small ); - else if ( d->iconSize == Small ) isz = 16; - else if ( d->iconSize == Medium ) isz = 22; - else if ( d->iconSize == Large ) isz = 32; - else if ( d->iconSize == XLarge ) isz = 48; - - switch ( button ) - { - case ButtonAdd: - d->addIcon = icon; - d->btnAdd->setIconSet( SmallIconSet( icon, isz ) ); - break; - case ButtonRemove: - d->removeIcon = icon; - d->btnRemove->setIconSet( SmallIconSet( icon, isz ) ); - break; - case ButtonUp: - d->upIcon = icon; - d->btnUp->setIconSet( SmallIconSet( icon, isz ) ); - break; - case ButtonDown: - d->downIcon = icon; - d->btnDown->setIconSet( SmallIconSet( icon, isz ) ); - break; - default: - kdDebug(KBABEL)<<"TDEActionSelector::setButtonIcon: DAINBREAD!"<btnAdd->setIconSet( iconset ); - break; - case ButtonRemove: - d->btnRemove->setIconSet( iconset ); - break; - case ButtonUp: - d->btnUp->setIconSet( iconset ); - break; - case ButtonDown: - d->btnDown->setIconSet( iconset ); - break; - default: - kdDebug(KBABEL)<<"TDEActionSelector::setButtonIconSet: DAINBREAD!"<btnAdd->setTextLabel( tip ); - break; - case ButtonRemove: - d->btnRemove->setTextLabel( tip ); - break; - case ButtonUp: - d->btnUp->setTextLabel( tip ); - break; - case ButtonDown: - d->btnDown->setTextLabel( tip ); - break; - default: - kdDebug(KBABEL)<<"TDEActionSelector::setButtonToolTip: DAINBREAD!"<btnAdd, text ); - break; - case ButtonRemove: - TQWhatsThis::add( d->btnRemove, text ); - break; - case ButtonUp: - TQWhatsThis::add( d->btnUp, text ); - break; - case ButtonDown: - TQWhatsThis::add( d->btnDown, text ); - break; - default: - kdDebug(KBABEL)<<"TDEActionSelector::setButtonWhatsThis: DAINBREAD!"<btnAdd->setEnabled( d->availableListBox->currentItem() > -1 ); - d->btnRemove->setEnabled( d->selectedListBox->currentItem() > -1 ); - d->btnUp->setEnabled( d->selectedListBox->currentItem() > 0 ); - d->btnDown->setEnabled( d->selectedListBox->currentItem() > -1 && - d->selectedListBox->currentItem() < (int)d->selectedListBox->count() - 1 ); -} - -//END Public Methods - -//BEGIN Properties - -bool TDEActionSelector::moveOnDoubleClick() const -{ - return d->moveOnDoubleClick; -} - -void TDEActionSelector::setMoveOnDoubleClick( bool b ) -{ - d->moveOnDoubleClick = b; -} - -bool TDEActionSelector::keyboardEnabled() const -{ - return d->keyboardEnabled; -} - -void TDEActionSelector::setKeyboardEnabled( bool b ) -{ - d->keyboardEnabled = b; -} - -TQString TDEActionSelector::availableLabel() const -{ - return d->lAvailable->text(); -} - -void TDEActionSelector::setAvailableLabel( const TQString &text ) -{ - d->lAvailable->setText( text ); -} - -TQString TDEActionSelector::selectedLabel() const -{ - return d->lSelected->text(); -} - -void TDEActionSelector::setSelectedLabel( const TQString &text ) -{ - d->lSelected->setText( text ); -} - -TDEActionSelector::ButtonIconSize TDEActionSelector::buttonIconSize() const -{ - return d->iconSize; -} - -void TDEActionSelector::setButtonIconSize( ButtonIconSize size ) -{ - d->iconSize = size; - // reload icons - loadIcons(); -} - -TDEActionSelector::InsertionPolicy TDEActionSelector::availableInsertionPolicy() -{ - return d->availableInsertionPolicy; -} - -void TDEActionSelector::setAvailableInsertionPolicy( InsertionPolicy p ) -{ - d->availableInsertionPolicy = p; -} - -TDEActionSelector::InsertionPolicy TDEActionSelector::selectedInsertionPolicy() -{ - return d->selectedInsertionPolicy; -} - -void TDEActionSelector::setSelectedInsertionPolicy( InsertionPolicy p ) -{ - d->selectedInsertionPolicy = p; -} - -bool TDEActionSelector::showUpDownButtons() -{ - return d->showUpDownButtons; -} - -void TDEActionSelector::setShowUpDownButtons( bool show ) -{ - d->showUpDownButtons = show; - if ( show ) - { - d->btnUp->show(); - d->btnDown->show(); - } - else - { - d->btnUp->hide(); - d->btnDown->hide(); - } -} - -//END Properties - -//BEGIN Public Slots - -void TDEActionSelector::polish() -{ - setButtonsEnabled(); -} - -//END Public Slots - -//BEGIN Protected -void TDEActionSelector::keyPressEvent( TQKeyEvent *e ) -{ - if ( ! d->keyboardEnabled ) return; - if ( (e->state() & TQt::ControlButton) ) - { - switch ( e->key() ) - { - case Key_Right: - buttonAddClicked(); - break; - case Key_Left: - buttonRemoveClicked(); - break; - case Key_Up: - buttonUpClicked(); - break; - case Key_Down: - buttonDownClicked(); - break; - default: - e->ignore(); - return; - } - } -} - -bool TDEActionSelector::eventFilter( TQObject *o, TQEvent *e ) -{ - if ( d->keyboardEnabled && e->type() == TQEvent::KeyPress ) - { - if ( (((TQKeyEvent*)e)->state() & TQt::ControlButton) ) - { - switch ( ((TQKeyEvent*)e)->key() ) - { - case Key_Right: - buttonAddClicked(); - break; - case Key_Left: - buttonRemoveClicked(); - break; - case Key_Up: - buttonUpClicked(); - break; - case Key_Down: - buttonDownClicked(); - break; - default: - return TQWidget::eventFilter( o, e ); - break; - } - return true; - } - else if ( o->inherits( TQLISTBOX_OBJECT_NAME_STRING ) ) - { - switch ( ((TQKeyEvent*)e)->key() ) - { - case Key_Return: - case Key_Enter: - TQListBox *lb = (TQListBox*)o; - int index = lb->currentItem(); - if ( index < 0 ) break; - moveItem( lb->item( index ) ); - return true; - } - } - } - return TQWidget::eventFilter( o, e ); -} - -//END Protected - -//BEGIN Private Slots - -void TDEActionSelector::buttonAddClicked() -{ - // move all selected items from available to selected listbox - TQListBoxItem *item = d->availableListBox->firstItem(); - while ( item ) { - if ( item->isSelected() ) { - d->availableListBox->takeItem( item ); - d->selectedListBox->insertItem( item, insertionIndex( d->selectedListBox, d->selectedInsertionPolicy ) ); - d->selectedListBox->setCurrentItem( item ); - emit added( item ); - } - item = item->next(); - } - if ( d->selectedInsertionPolicy == Sorted ) - d->selectedListBox->sort(); - d->selectedListBox->setFocus(); -} - -void TDEActionSelector::buttonRemoveClicked() -{ - // move all selected items from selected to available listbox - TQListBoxItem *item = d->selectedListBox->firstItem(); - while ( item ) { - if ( item->isSelected() ) { - d->selectedListBox->takeItem( item ); - d->availableListBox->insertItem( item, insertionIndex( d->availableListBox, d->availableInsertionPolicy ) ); - d->availableListBox->setCurrentItem( item ); - emit removed( item ); - } - item = item->next(); - } - if ( d->availableInsertionPolicy == Sorted ) - d->availableListBox->sort(); - d->availableListBox->setFocus(); -} - -void TDEActionSelector::buttonUpClicked() -{ - int c = d->selectedListBox->currentItem(); - if ( c < 0 ) return; - TQListBoxItem *item = d->selectedListBox->item( c ); - d->selectedListBox->takeItem( item ); - d->selectedListBox->insertItem( item, c-1 ); - d->selectedListBox->setCurrentItem( item ); - emit movedUp( item ); -} - -void TDEActionSelector::buttonDownClicked() -{ - int c = d->selectedListBox->currentItem(); - if ( c < 0 ) return; - TQListBoxItem *item = d->selectedListBox->item( c ); - d->selectedListBox->takeItem( item ); - d->selectedListBox->insertItem( item, c+1 ); - d->selectedListBox->setCurrentItem( item ); - emit movedDown( item ); -} - -void TDEActionSelector::itemDoubleClicked( TQListBoxItem *item ) -{ - if ( d->moveOnDoubleClick ) - moveItem( item ); -} - -//END Private Slots - -//BEGIN Private Methods - -void TDEActionSelector::loadIcons() -{ - int isz; - if ( d->iconSize == SmallIcon ) isz = IconSize( KIcon::Small ); - else if ( d->iconSize == Small ) isz = 16; - else if ( d->iconSize == Medium ) isz = 22; - else if ( d->iconSize == Large ) isz = 32; - else if ( d->iconSize == XLarge ) isz = 48; - - d->btnAdd->setIconSet( SmallIconSet( d->addIcon, isz ) ); - d->btnRemove->setIconSet( SmallIconSet( d->removeIcon, isz ) ); - d->btnUp->setIconSet( SmallIconSet( d->upIcon, isz ) ); - d->btnDown->setIconSet( SmallIconSet( d->downIcon, isz ) ); -} - -void TDEActionSelector::moveItem( TQListBoxItem *item ) -{ - TQListBox *lbFrom = item->listBox(); - TQListBox *lbTo; - if ( lbFrom == d->availableListBox ) - lbTo = d->selectedListBox; - else if ( lbFrom == d->selectedListBox ) - lbTo = d->availableListBox; - else //?! somewhat unlikely... - return; - - InsertionPolicy p = ( lbTo == d->availableListBox ) ? - d->availableInsertionPolicy : d->selectedInsertionPolicy; - - lbFrom->takeItem( item ); - lbTo->insertItem( item, insertionIndex( lbTo, p ) ); - lbTo->setFocus(); - lbTo->setCurrentItem( item ); - - if ( p == Sorted ) - lbTo->sort(); - if ( lbTo == d->selectedListBox ) - emit added( item ); - else - emit removed( item ); -} - -int TDEActionSelector::insertionIndex( TQListBox *lb, InsertionPolicy policy ) -{ - int index; - switch ( policy ) - { - case BelowCurrent: - index = lb->currentItem(); - if ( index > -1 ) index += 1; - break; - case AtTop: - index = 0; - break; - default: - index = -1; - } - return index; -} - -//END Private Methods -#include "kactionselector.moc" diff --git a/kbabel/commonui/kactionselector.h b/kbabel/commonui/kactionselector.h deleted file mode 100644 index eaa1ab72..00000000 --- a/kbabel/commonui/kactionselector.h +++ /dev/null @@ -1,411 +0,0 @@ -/*************************************************************************** - TDEActionSelector.h - A widget for selecting and arranging actions/objects - ------------------- - begin : Mon June 3 2002 - copyright : (C) 2002 by Anders Lund - email : anders@alweb.dk - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * * - * In addition, as a special exception, the copyright holders give * - * permission to link the code of this program with any edition of * - * the TQt library by Trolltech AS, Norway (or with modified versions * - * of TQt that use the same license as TQt), and distribute linked * - * combinations including the two. You must obey the GNU General * - * Public License in all respects for all of the code used other than * - * TQt. If you modify this file, you may extend this exception to * - * your version of the file, but you are not obligated to do so. If * - * you do not wish to do so, delete this exception statement from * - * your version. * - ***************************************************************************/ - -#ifndef _KACTION_SELECTOR_H_ -#define _KACTION_SELECTOR_H_ - -#include - -class TQListBox; -class TQListBoxItem; -class TQKeyEvent; -class TQEvent; -class TQIconSet; - -class TDEActionSelectorPrivate; - -/** - @short A widget for selecting and arranging actions/objects - This widget allows the user to select from a set of objects and arrange - the order of the selected ones using two list boxes labeled "Available" - and "Used" with horizontal arrows in between to move selected objects between - the two, and vertical arrows on the right to arrange the order of the selected - objects. - - The widget moves objects to the other listbox when doubleclicked if - the property moveOnDoubleClick is set to true (default). See moveOnDoubleClick() - and setMoveOnDoubleClick(). - - The user control the widget using the keyboard if enabled (default), - see keyboardEnabled. - - Note that this may conflist with keyboard selection in the selected list box, - if you set that to anything else than TQListBox::Single (which is the default). - - To use it, simply construct an instance and then add items to the two listboxes, - available through lbAvailable() and lbSelected(). Whenever you want, you can retrieve - the selected options using TQListBox methods on lbSelected(). - - This way, you can use your own TQListBoxItem class, allowing you to easily - store object data in those. - - When an item is moved to a listbox, it is placed below the current item - of that listbox. - - Standard arrow icons are used, but you can use icons of your own choice if desired, - see setButtonIcon(). It is also possible to set tooltips and whatsthis help - for the buttons. See setButtonTooltip() and setButtonWhatsThis(). - - To set whatsthis or tooltips for the listboxes, access them through - availableListbox() and selectedListBox(). - - All the moving buttons are automatically set enabled as expected. - - Signals are sent each time an item is moved, allowing you to follow the - users actions if you need to. See addedToSelection(), removedFromSelection(), - movedUp() and movedDown() - - @author Anders Lund -*/ - -class TDEActionSelector : public TQWidget { - Q_OBJECT - - TQ_ENUMS( ButtonIconSize InsertionPolicy ) - TQ_PROPERTY( bool moveOnDoubleClick READ moveOnDoubleClick WRITE setMoveOnDoubleClick ) - TQ_PROPERTY( bool keyboardEnabled READ keyboardEnabled WRITE setKeyboardEnabled ) - TQ_PROPERTY( TQString availableLabel READ availableLabel WRITE setAvailableLabel ) - TQ_PROPERTY( TQString selectedLabel READ selectedLabel WRITE setSelectedLabel ) - TQ_PROPERTY( ButtonIconSize buttonIconSize READ buttonIconSize WRITE setButtonIconSize ) - TQ_PROPERTY( InsertionPolicy availableInsertionPolicy READ availableInsertionPolicy WRITE setAvailableInsertionPolicy ) - TQ_PROPERTY( InsertionPolicy selectedInsertionPolicy READ selectedInsertionPolicy WRITE setSelectedInsertionPolicy ) - TQ_PROPERTY( bool showUpDownButtons READ showUpDownButtons WRITE setShowUpDownButtons ) - -public: - TDEActionSelector( TQWidget *parent=0, const char *name=0 ); - ~TDEActionSelector(); - - /** - @return The TQListBox holding the available actions - */ - TQListBox *availableListBox(); - - /** - @return The TQListBox holding the selected actions - */ - TQListBox *selectedListBox(); - - /** - This enum indentifies the moving buttons - */ - enum MoveButton { - ButtonAdd, - ButtonRemove, - ButtonUp, - ButtonDown - }; - - /** - This enum identifies the icon sizes, used for the move buttons. - The values correspond to the following pixel sizes: - @li SmallIcon - the return value of IconSize( KIcon::Small ), the user defined size - of a small icon in KDE. This is the default setting. - @li Small - 16px - @li Medium - 22px - @li Large - 32px - @li XLarge - 48px - */ - enum ButtonIconSize { - SmallIcon, - Small, - Medium, - Large, - XLarge - }; - - /** - This enum defines policies for where to insert moved items in a listbox. - The following policies are currently defined: - @li BelowCurrent - The item is inserted below the listbox' - currentItem() or at the end if there is no curent item. - @li Sorted - The listbox is sort()ed after one or more items are inserted. - @li AtTop - The item is inserted at index 0 in the listbox. - @li AtBottom - The item is inserted at the end of the listbox. - - @sa availableInsertionPolicy(), setAvailableInsertionPolicy(), - selectedInsertionPolicy(), setSelectedInsertionPolicy(). - */ - enum InsertionPolicy { - BelowCurrent, - Sorted, - AtTop, - AtBottom - }; - - /** - @return Wheather moveOnDoubleClcik is enabled. - - If enabled, an item in any listbox will be moved to the other one whenever - doubleclicked. - @sa setMoveOnDoubleClick() - */ - bool moveOnDoubleClick() const; - - /** - Sets moveOnDoubleClick to @p enable - @sa moveOnDoubleClick() - */ - void setMoveOnDoubleClick( bool enable ); - - /** - @return Weather keyboard control is enabled. - - When Keyboard control is enabled, the widget will react to - the following keyboard actions: - @li CTRL + Right - simulate clicking the add button - @li CTRL + Left - simulate clicking the remove button - @li CTRL + Up - simulate clicking the up button - @li CTRL + Down - simulate clicking the down button - - Additionally, pressing RETURN or ENTER on one of the list boxes - will cause the current item of that listbox to be moved to the other - listbox. - - The keyboard actions are enabled by default. - - @sa setKeyboardEnabled() - */ - bool keyboardEnabled() const; - - /** - Sets the keyboard enabled depending on @p enable. - @sa keyboardEnabled() - */ - void setKeyboardEnabled( bool enable ); - - /** - @return The text of the label for the available items listbox. - */ - TQString availableLabel() const; - - /** - Sets the label for the available items listbox to @p text. - Note that this label has the listbox as its @e buddy, so that - if you have a single ampersand in the text, the following character - will become the accellerator to focus te listbox. - */ - void setAvailableLabel( const TQString & text ); - - /** - @return the label of the selected items listbox. - */ - TQString selectedLabel() const; - - /** - Sets the label for the selected items listbox to @p text. - Note that this label has the listbox as its @e buddy, so that - if you have a single ampersand in the text, the following character - will become the accellerator to focus te listbox. - */ - void setSelectedLabel( const TQString & text ); - - /** - @return the current ButtonIconSize. - */ - ButtonIconSize buttonIconSize() const; - - /** - Sets the button icon size. - See ButtonIconSize for the possible values and their pixel meaning. - */ - void setButtonIconSize( ButtonIconSize size ); - - /** - @return The current insertion policy for the available listbox. - The default policy for the available listbox is Sorted. - See also InsertionPolicy, setAvailableInsertionPolicy(). - */ - InsertionPolicy availableInsertionPolicy(); - - /** - Sets the insertion policy for the available listbox. - See also InsertionPolicy, availableInsertionPolicy(). - */ - void setAvailableInsertionPolicy( InsertionPolicy policy ); - - /** - @return The current insertion policy for the selected listbox. - The default policy for the selected listbox is BelowCurrent. - See also InsertionPolicy, setSelectedInsertionPolicy(). - */ - InsertionPolicy selectedInsertionPolicy(); - - /** - Sets the insertion policy for the selected listbox. - See also InsertionPolicy, selectedInsertionPolicy(). - */ - void setSelectedInsertionPolicy( InsertionPolicy policy ); - - /** - @return wheather the Up and Down buttons should be displayed. - */ - bool showUpDownButtons(); - - /** - Sets wheather the Up and Down buttons should be displayed - according to @p show - */ - void setShowUpDownButtons( bool show ); - - /** - Sets the pixmap of the button @p button to @p icon. - It calls @ref SmallIconSet(pm) to generate the icon set. - */ - void setButtonIcon( const TQString &icon, MoveButton button ); - - /** - Sets the iconset for button @p button to @p iconset. - You can use this method to et a costum icon set. Either - created by @ref TQIconSet, or use the application instance of - @ref KIconLoader (recommended). - */ - void setButtonIconSet( const TQIconSet &iconset, MoveButton button ); - - /** - Sets the tooltip for the button @p button to @p tip. - */ - void setButtonTooltip( const TQString &tip, MoveButton button ); - - /** - Sets the whatsthis help for button @p button to @p text. - */ - void setButtonWhatsThis( const TQString &text, MoveButton button ); - - /** - Sets the enabled state of all moving buttons to reflect the current - options. - - Be sure to call this if you add or removes items to either listbox after the - widget is show()n - */ - void setButtonsEnabled(); - -signals: - /** - Emitted when an item is moved to the "selected" listbox. - */ - void added( TQListBoxItem *item ); - - /** - Emitted when an item is moved out of the "selected" listbox. - */ - void removed( TQListBoxItem *item ); - - /** - Emitted when an item is moved upwards in the "selected" listbox. - */ - void movedUp( TQListBoxItem *item ); - - /** - Emitted when an item is moved downwards in the "selected" listbox. - */ - void movedDown( TQListBoxItem *item ); - - /** - Emitted when an item is moved to the "selected" listbox. - */ -// void addedToSelection( TQListBoxItem *item ); - -public slots: - /** - Reimplemented for internal reasons. - (calls setButtonsEnabled()) - */ - void polish(); - -protected: - /** - Reimplamented for internal reasons. - */ - void keyPressEvent( TQKeyEvent * ); - - /** - Reimplemented for internal reasons. - */ - bool eventFilter( TQObject *, TQEvent * ); - -private slots: - /** - Move selected item from available box to the selected box - */ - void buttonAddClicked(); - - /** - Move selected item from selected box to available box - */ - void buttonRemoveClicked(); - - /** - Move selected item in selected box upwards - */ - void buttonUpClicked(); - - /** - Move seleted item in selected box downwards - */ - void buttonDownClicked(); - - /** - Moves the item @p item to the other listbox if moveOnDoubleClick is enabled. - */ - void itemDoubleClicked( TQListBoxItem *item ); - - /** - connected to both list boxes to set the buttons enabled - */ - void slotCurrentChanged( TQListBoxItem * ) { setButtonsEnabled(); }; - -private: - - /** - Move item @p item to the other listbox - */ - void moveItem( TQListBoxItem *item ); - - /** - loads the icons for the move buttons. - */ - void loadIcons(); - - /** - @return the index to insert an item into listbox @p lb, - given InsertionPolicy @p policy. - - Note that if policy is Sorted, this will return -1. - Sort the listbox after inserting the item in that case. - */ - int insertionIndex( TQListBox *lb, InsertionPolicy policy ); - - /** @private - Private data storage - */ - TDEActionSelectorPrivate *d; -}; - -#endif // _KACTION_SELECTOR_H_ diff --git a/kbabel/commonui/klisteditor.ui b/kbabel/commonui/klisteditor.ui deleted file mode 100644 index 5f0f8ce1..00000000 --- a/kbabel/commonui/klisteditor.ui +++ /dev/null @@ -1,261 +0,0 @@ - -TDEListEditor - - - TDEListEditor - - - - 0 - 0 - 334 - 274 - - - - - 7 - 7 - 0 - 0 - - - - - unnamed - - - 0 - - - 0 - - - - _frame - - - - 7 - 7 - 0 - 0 - - - - - - - - unnamed - - - 11 - - - 6 - - - - Layout3 - - - - unnamed - - - 0 - - - 6 - - - - _edit - - - - - Layout2 - - - - unnamed - - - 0 - - - 6 - - - - - New Item - - - - _list - - - - 200 - 200 - - - - - - Layout5_2 - - - - unnamed - - - 0 - - - 6 - - - - _addButton - - - false - - - Add - - - - - _removeButton - - - false - - - Remove - - - - - _upButton - - - false - - - Up - - - - - _downButton - - - false - - - Down - - - - - Spacer2_2 - - - Vertical - - - Expanding - - - - 20 - 20 - - - - - - - - - - - - - - - - _addButton - pressed() - TDEListEditor - addToList() - - - _removeButton - pressed() - TDEListEditor - removeFromList() - - - _upButton - pressed() - TDEListEditor - upInList() - - - _downButton - pressed() - TDEListEditor - downInList() - - - _edit - returnPressed() - TDEListEditor - updateList() - - - _edit - textChanged(const TQString&) - TDEListEditor - editChanged(const TQString&) - - - _list - highlighted(int) - TDEListEditor - updateButtons(int) - - - _list - highlighted(const TQString&) - _edit - setText(const TQString&) - - - - klisteditor.ui.h - - - itemsChanged() - - - addToList() - downInList() - removeFromList() - upInList() - updateButtons( int newIndex ) - updateList() - setList( TQStringList contents ) - editChanged( const TQString & s ) - setTitle( const TQString & s ) - list() - - - diff --git a/kbabel/commonui/klisteditor.ui.h b/kbabel/commonui/klisteditor.ui.h deleted file mode 100644 index 30978506..00000000 --- a/kbabel/commonui/klisteditor.ui.h +++ /dev/null @@ -1,122 +0,0 @@ -/* **************************************************************************** - This file is part of KBabel - - Copyright (C) 2002-2005 by Stanislav Visnovsky - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. - - -** ui.h extension file, included from the uic-generated form implementation. -** -** If you wish to add, delete or rename slots use TQt Designer which will -** update this file, preserving your code. Create an init() slot in place of -** a constructor, and a destroy() slot in place of a destructor. -*****************************************************************************/ - - -void TDEListEditor::addToList() -{ - _list->insertItem(_edit->text()); - _edit->clear(); - _removeButton->setEnabled(true); - emit itemsChanged(); -} - -void TDEListEditor::downInList() -{ - int i=_list->currentItem(); - if( i< (int)_list->count()-1 ) { - TQString ci = _list->currentText(); - _list->removeItem(i); - _list->insertItem(ci,i+1); - _list->setCurrentItem(i+1); - } - emit itemsChanged(); -} - -void TDEListEditor::removeFromList() -{ - _list->removeItem(_list->currentItem()); - if( _list->count()==0 ) _edit->clear(); - _removeButton->setEnabled(_list->count()>0); - emit itemsChanged(); -} - -void TDEListEditor::upInList() -{ - int i=_list->currentItem(); - if( i>0 ) { - TQString ci = _list->currentText(); - _list->removeItem(i); - _list->insertItem(ci,i-1); - _list->setCurrentItem(i-1); - } - emit itemsChanged(); -} - -void TDEListEditor::updateButtons( int newIndex ) -{ - _upButton->setEnabled(newIndex>0); - _downButton->setEnabled(newIndex+1 != (int)_list->count()); - _removeButton->setEnabled(true); -} - -void TDEListEditor::updateList() -{ - int i=_list->currentItem(); - if( i==-1 ) addToList(); - else _list->changeItem(_edit->text(), i ); -} - -void TDEListEditor::setList( TQStringList contents ) -{ - _list->clear(); - _list->insertStringList(contents); - _list->setCurrentItem(0); - _removeButton->setEnabled(!contents.isEmpty()); -} - - -void TDEListEditor::editChanged( const TQString &s ) -{ - _addButton->setEnabled(!s.isEmpty()); -} - - -void TDEListEditor::setTitle( const TQString &s ) -{ - _frame->setTitle(s); -} - - -TQStringList TDEListEditor::list() -{ - TQStringList result; - for( uint i=0; i<_list->count() ; i++ ) - result.append(_list->text(i)); - return result; -} diff --git a/kbabel/commonui/tdeactionselector.cpp b/kbabel/commonui/tdeactionselector.cpp new file mode 100644 index 00000000..c2638ff5 --- /dev/null +++ b/kbabel/commonui/tdeactionselector.cpp @@ -0,0 +1,562 @@ +/*************************************************************************** + TDEActionSelector.cpp + A widget for selecting and arranging actions/objects + ------------------- + begin : Mon June 3 2002 + copyright : (C) 2002 by Anders Lund + email : anders@alweb.dk + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * * + * In addition, as a special exception, the copyright holders give * + * permission to link the code of this program with any edition of * + * the TQt library by Trolltech AS, Norway (or with modified versions * + * of TQt that use the same license as TQt), and distribute linked * + * combinations including the two. You must obey the GNU General * + * Public License in all respects for all of the code used other than * + * TQt. If you modify this file, you may extend this exception to * + * your version of the file, but you are not obligated to do so. If * + * you do not wish to do so, delete this exception statement from * + * your version. * + ***************************************************************************/ + +#include "kactionselector.h" +#include + +#include +#include +#include // for spacingHint() +#include + +#include +#include +#include +#include +#include +#include +#include + +class TDEActionSelectorPrivate { + public: + TQListBox *availableListBox, *selectedListBox; + TQToolButton *btnAdd, *btnRemove, *btnUp, *btnDown; + TQLabel *lAvailable, *lSelected; + bool moveOnDoubleClick, keyboardEnabled; + TDEActionSelector::ButtonIconSize iconSize; + TQString addIcon, removeIcon, upIcon, downIcon; + TDEActionSelector::InsertionPolicy availableInsertionPolicy, selectedInsertionPolicy; + bool showUpDownButtons; +}; + +//BEGIN Constructor/destructor + +TDEActionSelector::TDEActionSelector( TQWidget *parent, const char *name ) + : TQWidget( parent, name ) +{ + d = new TDEActionSelectorPrivate(); + d->moveOnDoubleClick = true; + d->keyboardEnabled = true; + d->iconSize = SmallIcon; + d->addIcon = TQApplication::reverseLayout() ? "back" : "forward"; + d->removeIcon = TQApplication::reverseLayout() ? "forward" : "back"; + d->upIcon = "up"; + d->downIcon = "down"; + d->availableInsertionPolicy = Sorted; + d->selectedInsertionPolicy = BelowCurrent; + d->showUpDownButtons = true; + + //int isz = IconSize( KIcon::Small ); + + TQHBoxLayout *lo = new TQHBoxLayout( this ); + lo->setSpacing( KDialog::spacingHint() ); + + TQVBoxLayout *loAv = new TQVBoxLayout( lo ); + d->lAvailable = new TQLabel( i18n("&Available:"), this ); + loAv->addWidget( d->lAvailable ); + d->availableListBox = new TQListBox( this ); + loAv->addWidget( d->availableListBox ); + d->lAvailable->setBuddy( d->availableListBox ); + + TQVBoxLayout *loHBtns = new TQVBoxLayout( lo ); + loHBtns->addStretch( 1 ); + d->btnAdd = new TQToolButton( this ); + loHBtns->addWidget( d->btnAdd ); + d->btnRemove = new TQToolButton( this ); + loHBtns->addWidget( d->btnRemove ); + loHBtns->addStretch( 1 ); + + TQVBoxLayout *loS = new TQVBoxLayout( lo ); + d->lSelected = new TQLabel( i18n("&Selected:"), this ); + loS->addWidget( d->lSelected ); + d->selectedListBox = new TQListBox( this ); + loS->addWidget( d->selectedListBox ); + d->lSelected->setBuddy( d->selectedListBox ); + + TQVBoxLayout *loVBtns = new TQVBoxLayout( lo ); + loVBtns->addStretch( 1 ); + d->btnUp = new TQToolButton( this ); + loVBtns->addWidget( d->btnUp ); + d->btnDown = new TQToolButton( this ); + loVBtns->addWidget( d->btnDown ); + loVBtns->addStretch( 1 ); + + loadIcons(); + + connect( d->btnAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonAddClicked()) ); + connect( d->btnRemove, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonRemoveClicked()) ); + connect( d->btnUp, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonUpClicked()) ); + connect( d->btnDown, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonDownClicked()) ); + connect( d->availableListBox, TQT_SIGNAL(doubleClicked(TQListBoxItem*)), + this, TQT_SLOT(itemDoubleClicked(TQListBoxItem*)) ); + connect( d->selectedListBox, TQT_SIGNAL(doubleClicked(TQListBoxItem*)), + this, TQT_SLOT(itemDoubleClicked(TQListBoxItem*)) ); + connect( d->availableListBox, TQT_SIGNAL(currentChanged(TQListBoxItem*)), + this, TQT_SLOT(slotCurrentChanged(TQListBoxItem *)) ); + connect( d->selectedListBox, TQT_SIGNAL(currentChanged(TQListBoxItem*)), + this, TQT_SLOT(slotCurrentChanged(TQListBoxItem *)) ); + + d->availableListBox->installEventFilter( this ); + d->selectedListBox->installEventFilter( this ); +} + +TDEActionSelector::~TDEActionSelector() +{ + delete d; +} + +//END Constructor/destroctor + +//BEGIN Public Methods + +TQListBox *TDEActionSelector::availableListBox() +{ + return d->availableListBox; +} + +TQListBox *TDEActionSelector::selectedListBox() +{ + return d->selectedListBox; +} + +void TDEActionSelector::setButtonIcon( const TQString &icon, MoveButton button ) +{ + int isz; + if ( d->iconSize == SmallIcon ) isz = IconSize( KIcon::Small ); + else if ( d->iconSize == Small ) isz = 16; + else if ( d->iconSize == Medium ) isz = 22; + else if ( d->iconSize == Large ) isz = 32; + else if ( d->iconSize == XLarge ) isz = 48; + + switch ( button ) + { + case ButtonAdd: + d->addIcon = icon; + d->btnAdd->setIconSet( SmallIconSet( icon, isz ) ); + break; + case ButtonRemove: + d->removeIcon = icon; + d->btnRemove->setIconSet( SmallIconSet( icon, isz ) ); + break; + case ButtonUp: + d->upIcon = icon; + d->btnUp->setIconSet( SmallIconSet( icon, isz ) ); + break; + case ButtonDown: + d->downIcon = icon; + d->btnDown->setIconSet( SmallIconSet( icon, isz ) ); + break; + default: + kdDebug(KBABEL)<<"TDEActionSelector::setButtonIcon: DAINBREAD!"<btnAdd->setIconSet( iconset ); + break; + case ButtonRemove: + d->btnRemove->setIconSet( iconset ); + break; + case ButtonUp: + d->btnUp->setIconSet( iconset ); + break; + case ButtonDown: + d->btnDown->setIconSet( iconset ); + break; + default: + kdDebug(KBABEL)<<"TDEActionSelector::setButtonIconSet: DAINBREAD!"<btnAdd->setTextLabel( tip ); + break; + case ButtonRemove: + d->btnRemove->setTextLabel( tip ); + break; + case ButtonUp: + d->btnUp->setTextLabel( tip ); + break; + case ButtonDown: + d->btnDown->setTextLabel( tip ); + break; + default: + kdDebug(KBABEL)<<"TDEActionSelector::setButtonToolTip: DAINBREAD!"<btnAdd, text ); + break; + case ButtonRemove: + TQWhatsThis::add( d->btnRemove, text ); + break; + case ButtonUp: + TQWhatsThis::add( d->btnUp, text ); + break; + case ButtonDown: + TQWhatsThis::add( d->btnDown, text ); + break; + default: + kdDebug(KBABEL)<<"TDEActionSelector::setButtonWhatsThis: DAINBREAD!"<btnAdd->setEnabled( d->availableListBox->currentItem() > -1 ); + d->btnRemove->setEnabled( d->selectedListBox->currentItem() > -1 ); + d->btnUp->setEnabled( d->selectedListBox->currentItem() > 0 ); + d->btnDown->setEnabled( d->selectedListBox->currentItem() > -1 && + d->selectedListBox->currentItem() < (int)d->selectedListBox->count() - 1 ); +} + +//END Public Methods + +//BEGIN Properties + +bool TDEActionSelector::moveOnDoubleClick() const +{ + return d->moveOnDoubleClick; +} + +void TDEActionSelector::setMoveOnDoubleClick( bool b ) +{ + d->moveOnDoubleClick = b; +} + +bool TDEActionSelector::keyboardEnabled() const +{ + return d->keyboardEnabled; +} + +void TDEActionSelector::setKeyboardEnabled( bool b ) +{ + d->keyboardEnabled = b; +} + +TQString TDEActionSelector::availableLabel() const +{ + return d->lAvailable->text(); +} + +void TDEActionSelector::setAvailableLabel( const TQString &text ) +{ + d->lAvailable->setText( text ); +} + +TQString TDEActionSelector::selectedLabel() const +{ + return d->lSelected->text(); +} + +void TDEActionSelector::setSelectedLabel( const TQString &text ) +{ + d->lSelected->setText( text ); +} + +TDEActionSelector::ButtonIconSize TDEActionSelector::buttonIconSize() const +{ + return d->iconSize; +} + +void TDEActionSelector::setButtonIconSize( ButtonIconSize size ) +{ + d->iconSize = size; + // reload icons + loadIcons(); +} + +TDEActionSelector::InsertionPolicy TDEActionSelector::availableInsertionPolicy() +{ + return d->availableInsertionPolicy; +} + +void TDEActionSelector::setAvailableInsertionPolicy( InsertionPolicy p ) +{ + d->availableInsertionPolicy = p; +} + +TDEActionSelector::InsertionPolicy TDEActionSelector::selectedInsertionPolicy() +{ + return d->selectedInsertionPolicy; +} + +void TDEActionSelector::setSelectedInsertionPolicy( InsertionPolicy p ) +{ + d->selectedInsertionPolicy = p; +} + +bool TDEActionSelector::showUpDownButtons() +{ + return d->showUpDownButtons; +} + +void TDEActionSelector::setShowUpDownButtons( bool show ) +{ + d->showUpDownButtons = show; + if ( show ) + { + d->btnUp->show(); + d->btnDown->show(); + } + else + { + d->btnUp->hide(); + d->btnDown->hide(); + } +} + +//END Properties + +//BEGIN Public Slots + +void TDEActionSelector::polish() +{ + setButtonsEnabled(); +} + +//END Public Slots + +//BEGIN Protected +void TDEActionSelector::keyPressEvent( TQKeyEvent *e ) +{ + if ( ! d->keyboardEnabled ) return; + if ( (e->state() & TQt::ControlButton) ) + { + switch ( e->key() ) + { + case Key_Right: + buttonAddClicked(); + break; + case Key_Left: + buttonRemoveClicked(); + break; + case Key_Up: + buttonUpClicked(); + break; + case Key_Down: + buttonDownClicked(); + break; + default: + e->ignore(); + return; + } + } +} + +bool TDEActionSelector::eventFilter( TQObject *o, TQEvent *e ) +{ + if ( d->keyboardEnabled && e->type() == TQEvent::KeyPress ) + { + if ( (((TQKeyEvent*)e)->state() & TQt::ControlButton) ) + { + switch ( ((TQKeyEvent*)e)->key() ) + { + case Key_Right: + buttonAddClicked(); + break; + case Key_Left: + buttonRemoveClicked(); + break; + case Key_Up: + buttonUpClicked(); + break; + case Key_Down: + buttonDownClicked(); + break; + default: + return TQWidget::eventFilter( o, e ); + break; + } + return true; + } + else if ( o->inherits( TQLISTBOX_OBJECT_NAME_STRING ) ) + { + switch ( ((TQKeyEvent*)e)->key() ) + { + case Key_Return: + case Key_Enter: + TQListBox *lb = (TQListBox*)o; + int index = lb->currentItem(); + if ( index < 0 ) break; + moveItem( lb->item( index ) ); + return true; + } + } + } + return TQWidget::eventFilter( o, e ); +} + +//END Protected + +//BEGIN Private Slots + +void TDEActionSelector::buttonAddClicked() +{ + // move all selected items from available to selected listbox + TQListBoxItem *item = d->availableListBox->firstItem(); + while ( item ) { + if ( item->isSelected() ) { + d->availableListBox->takeItem( item ); + d->selectedListBox->insertItem( item, insertionIndex( d->selectedListBox, d->selectedInsertionPolicy ) ); + d->selectedListBox->setCurrentItem( item ); + emit added( item ); + } + item = item->next(); + } + if ( d->selectedInsertionPolicy == Sorted ) + d->selectedListBox->sort(); + d->selectedListBox->setFocus(); +} + +void TDEActionSelector::buttonRemoveClicked() +{ + // move all selected items from selected to available listbox + TQListBoxItem *item = d->selectedListBox->firstItem(); + while ( item ) { + if ( item->isSelected() ) { + d->selectedListBox->takeItem( item ); + d->availableListBox->insertItem( item, insertionIndex( d->availableListBox, d->availableInsertionPolicy ) ); + d->availableListBox->setCurrentItem( item ); + emit removed( item ); + } + item = item->next(); + } + if ( d->availableInsertionPolicy == Sorted ) + d->availableListBox->sort(); + d->availableListBox->setFocus(); +} + +void TDEActionSelector::buttonUpClicked() +{ + int c = d->selectedListBox->currentItem(); + if ( c < 0 ) return; + TQListBoxItem *item = d->selectedListBox->item( c ); + d->selectedListBox->takeItem( item ); + d->selectedListBox->insertItem( item, c-1 ); + d->selectedListBox->setCurrentItem( item ); + emit movedUp( item ); +} + +void TDEActionSelector::buttonDownClicked() +{ + int c = d->selectedListBox->currentItem(); + if ( c < 0 ) return; + TQListBoxItem *item = d->selectedListBox->item( c ); + d->selectedListBox->takeItem( item ); + d->selectedListBox->insertItem( item, c+1 ); + d->selectedListBox->setCurrentItem( item ); + emit movedDown( item ); +} + +void TDEActionSelector::itemDoubleClicked( TQListBoxItem *item ) +{ + if ( d->moveOnDoubleClick ) + moveItem( item ); +} + +//END Private Slots + +//BEGIN Private Methods + +void TDEActionSelector::loadIcons() +{ + int isz; + if ( d->iconSize == SmallIcon ) isz = IconSize( KIcon::Small ); + else if ( d->iconSize == Small ) isz = 16; + else if ( d->iconSize == Medium ) isz = 22; + else if ( d->iconSize == Large ) isz = 32; + else if ( d->iconSize == XLarge ) isz = 48; + + d->btnAdd->setIconSet( SmallIconSet( d->addIcon, isz ) ); + d->btnRemove->setIconSet( SmallIconSet( d->removeIcon, isz ) ); + d->btnUp->setIconSet( SmallIconSet( d->upIcon, isz ) ); + d->btnDown->setIconSet( SmallIconSet( d->downIcon, isz ) ); +} + +void TDEActionSelector::moveItem( TQListBoxItem *item ) +{ + TQListBox *lbFrom = item->listBox(); + TQListBox *lbTo; + if ( lbFrom == d->availableListBox ) + lbTo = d->selectedListBox; + else if ( lbFrom == d->selectedListBox ) + lbTo = d->availableListBox; + else //?! somewhat unlikely... + return; + + InsertionPolicy p = ( lbTo == d->availableListBox ) ? + d->availableInsertionPolicy : d->selectedInsertionPolicy; + + lbFrom->takeItem( item ); + lbTo->insertItem( item, insertionIndex( lbTo, p ) ); + lbTo->setFocus(); + lbTo->setCurrentItem( item ); + + if ( p == Sorted ) + lbTo->sort(); + if ( lbTo == d->selectedListBox ) + emit added( item ); + else + emit removed( item ); +} + +int TDEActionSelector::insertionIndex( TQListBox *lb, InsertionPolicy policy ) +{ + int index; + switch ( policy ) + { + case BelowCurrent: + index = lb->currentItem(); + if ( index > -1 ) index += 1; + break; + case AtTop: + index = 0; + break; + default: + index = -1; + } + return index; +} + +//END Private Methods +#include "kactionselector.moc" diff --git a/kbabel/commonui/tdeactionselector.h b/kbabel/commonui/tdeactionselector.h new file mode 100644 index 00000000..eaa1ab72 --- /dev/null +++ b/kbabel/commonui/tdeactionselector.h @@ -0,0 +1,411 @@ +/*************************************************************************** + TDEActionSelector.h + A widget for selecting and arranging actions/objects + ------------------- + begin : Mon June 3 2002 + copyright : (C) 2002 by Anders Lund + email : anders@alweb.dk + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * * + * In addition, as a special exception, the copyright holders give * + * permission to link the code of this program with any edition of * + * the TQt library by Trolltech AS, Norway (or with modified versions * + * of TQt that use the same license as TQt), and distribute linked * + * combinations including the two. You must obey the GNU General * + * Public License in all respects for all of the code used other than * + * TQt. If you modify this file, you may extend this exception to * + * your version of the file, but you are not obligated to do so. If * + * you do not wish to do so, delete this exception statement from * + * your version. * + ***************************************************************************/ + +#ifndef _KACTION_SELECTOR_H_ +#define _KACTION_SELECTOR_H_ + +#include + +class TQListBox; +class TQListBoxItem; +class TQKeyEvent; +class TQEvent; +class TQIconSet; + +class TDEActionSelectorPrivate; + +/** + @short A widget for selecting and arranging actions/objects + This widget allows the user to select from a set of objects and arrange + the order of the selected ones using two list boxes labeled "Available" + and "Used" with horizontal arrows in between to move selected objects between + the two, and vertical arrows on the right to arrange the order of the selected + objects. + + The widget moves objects to the other listbox when doubleclicked if + the property moveOnDoubleClick is set to true (default). See moveOnDoubleClick() + and setMoveOnDoubleClick(). + + The user control the widget using the keyboard if enabled (default), + see keyboardEnabled. + + Note that this may conflist with keyboard selection in the selected list box, + if you set that to anything else than TQListBox::Single (which is the default). + + To use it, simply construct an instance and then add items to the two listboxes, + available through lbAvailable() and lbSelected(). Whenever you want, you can retrieve + the selected options using TQListBox methods on lbSelected(). + + This way, you can use your own TQListBoxItem class, allowing you to easily + store object data in those. + + When an item is moved to a listbox, it is placed below the current item + of that listbox. + + Standard arrow icons are used, but you can use icons of your own choice if desired, + see setButtonIcon(). It is also possible to set tooltips and whatsthis help + for the buttons. See setButtonTooltip() and setButtonWhatsThis(). + + To set whatsthis or tooltips for the listboxes, access them through + availableListbox() and selectedListBox(). + + All the moving buttons are automatically set enabled as expected. + + Signals are sent each time an item is moved, allowing you to follow the + users actions if you need to. See addedToSelection(), removedFromSelection(), + movedUp() and movedDown() + + @author Anders Lund +*/ + +class TDEActionSelector : public TQWidget { + Q_OBJECT + + TQ_ENUMS( ButtonIconSize InsertionPolicy ) + TQ_PROPERTY( bool moveOnDoubleClick READ moveOnDoubleClick WRITE setMoveOnDoubleClick ) + TQ_PROPERTY( bool keyboardEnabled READ keyboardEnabled WRITE setKeyboardEnabled ) + TQ_PROPERTY( TQString availableLabel READ availableLabel WRITE setAvailableLabel ) + TQ_PROPERTY( TQString selectedLabel READ selectedLabel WRITE setSelectedLabel ) + TQ_PROPERTY( ButtonIconSize buttonIconSize READ buttonIconSize WRITE setButtonIconSize ) + TQ_PROPERTY( InsertionPolicy availableInsertionPolicy READ availableInsertionPolicy WRITE setAvailableInsertionPolicy ) + TQ_PROPERTY( InsertionPolicy selectedInsertionPolicy READ selectedInsertionPolicy WRITE setSelectedInsertionPolicy ) + TQ_PROPERTY( bool showUpDownButtons READ showUpDownButtons WRITE setShowUpDownButtons ) + +public: + TDEActionSelector( TQWidget *parent=0, const char *name=0 ); + ~TDEActionSelector(); + + /** + @return The TQListBox holding the available actions + */ + TQListBox *availableListBox(); + + /** + @return The TQListBox holding the selected actions + */ + TQListBox *selectedListBox(); + + /** + This enum indentifies the moving buttons + */ + enum MoveButton { + ButtonAdd, + ButtonRemove, + ButtonUp, + ButtonDown + }; + + /** + This enum identifies the icon sizes, used for the move buttons. + The values correspond to the following pixel sizes: + @li SmallIcon - the return value of IconSize( KIcon::Small ), the user defined size + of a small icon in KDE. This is the default setting. + @li Small - 16px + @li Medium - 22px + @li Large - 32px + @li XLarge - 48px + */ + enum ButtonIconSize { + SmallIcon, + Small, + Medium, + Large, + XLarge + }; + + /** + This enum defines policies for where to insert moved items in a listbox. + The following policies are currently defined: + @li BelowCurrent - The item is inserted below the listbox' + currentItem() or at the end if there is no curent item. + @li Sorted - The listbox is sort()ed after one or more items are inserted. + @li AtTop - The item is inserted at index 0 in the listbox. + @li AtBottom - The item is inserted at the end of the listbox. + + @sa availableInsertionPolicy(), setAvailableInsertionPolicy(), + selectedInsertionPolicy(), setSelectedInsertionPolicy(). + */ + enum InsertionPolicy { + BelowCurrent, + Sorted, + AtTop, + AtBottom + }; + + /** + @return Wheather moveOnDoubleClcik is enabled. + + If enabled, an item in any listbox will be moved to the other one whenever + doubleclicked. + @sa setMoveOnDoubleClick() + */ + bool moveOnDoubleClick() const; + + /** + Sets moveOnDoubleClick to @p enable + @sa moveOnDoubleClick() + */ + void setMoveOnDoubleClick( bool enable ); + + /** + @return Weather keyboard control is enabled. + + When Keyboard control is enabled, the widget will react to + the following keyboard actions: + @li CTRL + Right - simulate clicking the add button + @li CTRL + Left - simulate clicking the remove button + @li CTRL + Up - simulate clicking the up button + @li CTRL + Down - simulate clicking the down button + + Additionally, pressing RETURN or ENTER on one of the list boxes + will cause the current item of that listbox to be moved to the other + listbox. + + The keyboard actions are enabled by default. + + @sa setKeyboardEnabled() + */ + bool keyboardEnabled() const; + + /** + Sets the keyboard enabled depending on @p enable. + @sa keyboardEnabled() + */ + void setKeyboardEnabled( bool enable ); + + /** + @return The text of the label for the available items listbox. + */ + TQString availableLabel() const; + + /** + Sets the label for the available items listbox to @p text. + Note that this label has the listbox as its @e buddy, so that + if you have a single ampersand in the text, the following character + will become the accellerator to focus te listbox. + */ + void setAvailableLabel( const TQString & text ); + + /** + @return the label of the selected items listbox. + */ + TQString selectedLabel() const; + + /** + Sets the label for the selected items listbox to @p text. + Note that this label has the listbox as its @e buddy, so that + if you have a single ampersand in the text, the following character + will become the accellerator to focus te listbox. + */ + void setSelectedLabel( const TQString & text ); + + /** + @return the current ButtonIconSize. + */ + ButtonIconSize buttonIconSize() const; + + /** + Sets the button icon size. + See ButtonIconSize for the possible values and their pixel meaning. + */ + void setButtonIconSize( ButtonIconSize size ); + + /** + @return The current insertion policy for the available listbox. + The default policy for the available listbox is Sorted. + See also InsertionPolicy, setAvailableInsertionPolicy(). + */ + InsertionPolicy availableInsertionPolicy(); + + /** + Sets the insertion policy for the available listbox. + See also InsertionPolicy, availableInsertionPolicy(). + */ + void setAvailableInsertionPolicy( InsertionPolicy policy ); + + /** + @return The current insertion policy for the selected listbox. + The default policy for the selected listbox is BelowCurrent. + See also InsertionPolicy, setSelectedInsertionPolicy(). + */ + InsertionPolicy selectedInsertionPolicy(); + + /** + Sets the insertion policy for the selected listbox. + See also InsertionPolicy, selectedInsertionPolicy(). + */ + void setSelectedInsertionPolicy( InsertionPolicy policy ); + + /** + @return wheather the Up and Down buttons should be displayed. + */ + bool showUpDownButtons(); + + /** + Sets wheather the Up and Down buttons should be displayed + according to @p show + */ + void setShowUpDownButtons( bool show ); + + /** + Sets the pixmap of the button @p button to @p icon. + It calls @ref SmallIconSet(pm) to generate the icon set. + */ + void setButtonIcon( const TQString &icon, MoveButton button ); + + /** + Sets the iconset for button @p button to @p iconset. + You can use this method to et a costum icon set. Either + created by @ref TQIconSet, or use the application instance of + @ref KIconLoader (recommended). + */ + void setButtonIconSet( const TQIconSet &iconset, MoveButton button ); + + /** + Sets the tooltip for the button @p button to @p tip. + */ + void setButtonTooltip( const TQString &tip, MoveButton button ); + + /** + Sets the whatsthis help for button @p button to @p text. + */ + void setButtonWhatsThis( const TQString &text, MoveButton button ); + + /** + Sets the enabled state of all moving buttons to reflect the current + options. + + Be sure to call this if you add or removes items to either listbox after the + widget is show()n + */ + void setButtonsEnabled(); + +signals: + /** + Emitted when an item is moved to the "selected" listbox. + */ + void added( TQListBoxItem *item ); + + /** + Emitted when an item is moved out of the "selected" listbox. + */ + void removed( TQListBoxItem *item ); + + /** + Emitted when an item is moved upwards in the "selected" listbox. + */ + void movedUp( TQListBoxItem *item ); + + /** + Emitted when an item is moved downwards in the "selected" listbox. + */ + void movedDown( TQListBoxItem *item ); + + /** + Emitted when an item is moved to the "selected" listbox. + */ +// void addedToSelection( TQListBoxItem *item ); + +public slots: + /** + Reimplemented for internal reasons. + (calls setButtonsEnabled()) + */ + void polish(); + +protected: + /** + Reimplamented for internal reasons. + */ + void keyPressEvent( TQKeyEvent * ); + + /** + Reimplemented for internal reasons. + */ + bool eventFilter( TQObject *, TQEvent * ); + +private slots: + /** + Move selected item from available box to the selected box + */ + void buttonAddClicked(); + + /** + Move selected item from selected box to available box + */ + void buttonRemoveClicked(); + + /** + Move selected item in selected box upwards + */ + void buttonUpClicked(); + + /** + Move seleted item in selected box downwards + */ + void buttonDownClicked(); + + /** + Moves the item @p item to the other listbox if moveOnDoubleClick is enabled. + */ + void itemDoubleClicked( TQListBoxItem *item ); + + /** + connected to both list boxes to set the buttons enabled + */ + void slotCurrentChanged( TQListBoxItem * ) { setButtonsEnabled(); }; + +private: + + /** + Move item @p item to the other listbox + */ + void moveItem( TQListBoxItem *item ); + + /** + loads the icons for the move buttons. + */ + void loadIcons(); + + /** + @return the index to insert an item into listbox @p lb, + given InsertionPolicy @p policy. + + Note that if policy is Sorted, this will return -1. + Sort the listbox after inserting the item in that case. + */ + int insertionIndex( TQListBox *lb, InsertionPolicy policy ); + + /** @private + Private data storage + */ + TDEActionSelectorPrivate *d; +}; + +#endif // _KACTION_SELECTOR_H_ diff --git a/kbabel/commonui/tdelisteditor.ui b/kbabel/commonui/tdelisteditor.ui new file mode 100644 index 00000000..5f0f8ce1 --- /dev/null +++ b/kbabel/commonui/tdelisteditor.ui @@ -0,0 +1,261 @@ + +TDEListEditor + + + TDEListEditor + + + + 0 + 0 + 334 + 274 + + + + + 7 + 7 + 0 + 0 + + + + + unnamed + + + 0 + + + 0 + + + + _frame + + + + 7 + 7 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + _edit + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + + New Item + + + + _list + + + + 200 + 200 + + + + + + Layout5_2 + + + + unnamed + + + 0 + + + 6 + + + + _addButton + + + false + + + Add + + + + + _removeButton + + + false + + + Remove + + + + + _upButton + + + false + + + Up + + + + + _downButton + + + false + + + Down + + + + + Spacer2_2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + + + + + + _addButton + pressed() + TDEListEditor + addToList() + + + _removeButton + pressed() + TDEListEditor + removeFromList() + + + _upButton + pressed() + TDEListEditor + upInList() + + + _downButton + pressed() + TDEListEditor + downInList() + + + _edit + returnPressed() + TDEListEditor + updateList() + + + _edit + textChanged(const TQString&) + TDEListEditor + editChanged(const TQString&) + + + _list + highlighted(int) + TDEListEditor + updateButtons(int) + + + _list + highlighted(const TQString&) + _edit + setText(const TQString&) + + + + klisteditor.ui.h + + + itemsChanged() + + + addToList() + downInList() + removeFromList() + upInList() + updateButtons( int newIndex ) + updateList() + setList( TQStringList contents ) + editChanged( const TQString & s ) + setTitle( const TQString & s ) + list() + + + diff --git a/kbabel/commonui/tdelisteditor.ui.h b/kbabel/commonui/tdelisteditor.ui.h new file mode 100644 index 00000000..30978506 --- /dev/null +++ b/kbabel/commonui/tdelisteditor.ui.h @@ -0,0 +1,122 @@ +/* **************************************************************************** + This file is part of KBabel + + Copyright (C) 2002-2005 by Stanislav Visnovsky + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the TQt library by Trolltech AS, Norway (or with modified versions + of TQt that use the same license as TQt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + TQt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. + + +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use TQt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + + +void TDEListEditor::addToList() +{ + _list->insertItem(_edit->text()); + _edit->clear(); + _removeButton->setEnabled(true); + emit itemsChanged(); +} + +void TDEListEditor::downInList() +{ + int i=_list->currentItem(); + if( i< (int)_list->count()-1 ) { + TQString ci = _list->currentText(); + _list->removeItem(i); + _list->insertItem(ci,i+1); + _list->setCurrentItem(i+1); + } + emit itemsChanged(); +} + +void TDEListEditor::removeFromList() +{ + _list->removeItem(_list->currentItem()); + if( _list->count()==0 ) _edit->clear(); + _removeButton->setEnabled(_list->count()>0); + emit itemsChanged(); +} + +void TDEListEditor::upInList() +{ + int i=_list->currentItem(); + if( i>0 ) { + TQString ci = _list->currentText(); + _list->removeItem(i); + _list->insertItem(ci,i-1); + _list->setCurrentItem(i-1); + } + emit itemsChanged(); +} + +void TDEListEditor::updateButtons( int newIndex ) +{ + _upButton->setEnabled(newIndex>0); + _downButton->setEnabled(newIndex+1 != (int)_list->count()); + _removeButton->setEnabled(true); +} + +void TDEListEditor::updateList() +{ + int i=_list->currentItem(); + if( i==-1 ) addToList(); + else _list->changeItem(_edit->text(), i ); +} + +void TDEListEditor::setList( TQStringList contents ) +{ + _list->clear(); + _list->insertStringList(contents); + _list->setCurrentItem(0); + _removeButton->setEnabled(!contents.isEmpty()); +} + + +void TDEListEditor::editChanged( const TQString &s ) +{ + _addButton->setEnabled(!s.isEmpty()); +} + + +void TDEListEditor::setTitle( const TQString &s ) +{ + _frame->setTitle(s); +} + + +TQStringList TDEListEditor::list() +{ + TQStringList result; + for( uint i=0; i<_list->count() ; i++ ) + result.append(_list->text(i)); + return result; +} diff --git a/tdecachegrind/tdecachegrind/stackselection.cpp b/tdecachegrind/tdecachegrind/stackselection.cpp deleted file mode 100644 index 59094754..00000000 --- a/tdecachegrind/tdecachegrind/stackselection.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* This file is part of KCachegrind. - Copyright (C) 2003 Josef Weidendorfer - - KCachegrind is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -/* - * StackSelection for KCachegrind - * For function selection of a most expected stack, - * to be put into a TQDockWindow - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include "stackbrowser.h" -#include "stackselection.h" -#include "stackitem.h" - -StackSelection::StackSelection( TQWidget* parent, const char* name) - : StackSelectionBase(parent, name) -{ - _data = 0; - _browser = new StackBrowser(); - _item = 0; - _function = 0; - _costType = 0; - _costType2 = 0; - _groupType = TraceItem::Function; - - stackList->setSorting(-1); - stackList->setAllColumnsShowFocus(true); - stackList->setResizeMode(TQListView::LastColumn); - stackList->setColumnAlignment(0, TQt::AlignRight); - stackList->setColumnAlignment(1, TQt::AlignRight); - stackList->setColumnAlignment(2, TQt::AlignRight); - stackList->setColumnWidth(0, 50); - // 2nd cost column hidden at first (_costType2 == 0) - stackList->setColumnWidth(1, 0); - stackList->setColumnWidth(2, 50); - - connect(stackList, TQT_SIGNAL(selectionChanged(TQListViewItem*)), - this, TQT_SLOT(stackSelected(TQListViewItem*))); -} - -StackSelection::~StackSelection() -{ - delete _browser; -} - -void StackSelection::setData(TraceData* data) -{ - if (_data == data) return; - - _data = data; - - stackList->clear(); - delete _browser; - _browser = new StackBrowser(); - _function = 0; -} - - -void StackSelection::setFunction(TraceFunction* f) -{ - if (_function == f) return; - _function = f; - - if (!_data || !_function) return; - - //kdDebug() << "StackSelection::setFunction " << f->name() << endl; - - HistoryItem* item = _browser->current(); - if (!item || item->function() != f) { - _browser->select(f); - rebuildStackList(); - } -} - - -void StackSelection::rebuildStackList() -{ - HistoryItem* item = _browser->current(); - stackList->clear(); - stackList->setColumnWidth(0, 50); - stackList->setColumnWidth(1, _costType2 ? 50:0); - stackList->setColumnWidth(2, 50); - if (!item || !item->stack()) return; - - TraceFunction* top = item->stack()->top(); - if (!top) return; - - stackList->setColumnWidthMode(1, TQListView::Maximum); - - TraceCallList l = item->stack()->calls(); - TraceCall* call; - for (call=l.last();call;call=l.prev()) - new StackItem(this, stackList, call); - - new StackItem(this, stackList, top); - - // select current function - TQListViewItem* i = stackList->firstChild(); - for (;i;i=i->nextSibling()) - if (((StackItem*)i)->function() == item->function()) - break; - - if (i) { - // this calls stackFunctionSelected() - stackList->setCurrentItem(i); - stackList->ensureItemVisible(i); - } - - if (!_costType2) { - stackList->setColumnWidthMode(1, TQListView::Manual); - stackList->setColumnWidth(1, 0); - } -} - -void StackSelection::stackSelected(TQListViewItem* i) -{ - if (!i) return; - - TraceFunction* f = ((StackItem*)i)->function(); - emit functionSelected(f); -} - - -void StackSelection::browserBack() -{ - if (_browser && _browser->canGoBack()) { - _browser->goBack(); - rebuildStackList(); - } -} - -void StackSelection::browserForward() -{ - if (_browser && _browser->canGoForward()) { - _browser->goForward(); - rebuildStackList(); - } -} - -void StackSelection::browserUp() -{ - if (_browser) { - _browser->goUp(); - rebuildStackList(); - } -} - -void StackSelection::browserDown() -{ - if (_browser) { - _browser->goDown(); - rebuildStackList(); - } -} - -void StackSelection::refresh() -{ - TQListViewItem* item = stackList->firstChild(); - for(;item;item = item->nextSibling()) - ((StackItem*)item)->updateCost(); -} - -void StackSelection::setCostType(TraceCostType* ct) -{ - if (ct == _costType) return; - _costType = ct; - - stackList->setColumnWidth(0, 50); - if (_costType) - stackList->setColumnText(0, _costType->name()); - - TQListViewItem* item = stackList->firstChild(); - for(;item;item = item->nextSibling()) - ((StackItem*)item)->updateCost(); -} - -void StackSelection::setCostType2(TraceCostType* ct) -{ - if (ct == _costType2) return; - _costType2 = ct; - - stackList->setColumnWidth(1, 50); - stackList->setColumnWidthMode(1, TQListView::Maximum); - if (_costType2) - stackList->setColumnText(1, _costType2->name()); - - TQListViewItem* item = stackList->firstChild(); - for(;item;item = item->nextSibling()) - ((StackItem*)item)->updateCost(); - - if (!_costType2) { - stackList->setColumnWidthMode(1, TQListView::Manual); - stackList->setColumnWidth(1, 0); - } -} - -void StackSelection::setGroupType(TraceItem::CostType gt) -{ - if (_groupType == gt) return; - _groupType = gt; - - TQListViewItem* item = stackList->firstChild(); - for(;item;item = item->nextSibling()) - ((StackItem*)item)->updateGroup(); -} - -#include "stackselection.moc" diff --git a/tdecachegrind/tdecachegrind/stackselection.h b/tdecachegrind/tdecachegrind/stackselection.h deleted file mode 100644 index 8a826495..00000000 --- a/tdecachegrind/tdecachegrind/stackselection.h +++ /dev/null @@ -1,81 +0,0 @@ -/* This file is part of KCachegrind. - Copyright (C) 2003 Josef Weidendorfer - - KCachegrind is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -/* - * StackSelection for KCachegrind - * For function selection of a most expected stack, - * to be put into a TQDockWindow - */ - -#ifndef STACKSELECTION_H -#define STACKSELECTION_H - -#include "stackselectionbase.h" -#include "tracedata.h" - -class TraceFunction; -class TraceData; -class StackBrowser; -class NestedAreaItem; - -class StackSelection : public StackSelectionBase -{ - Q_OBJECT - - -public: - StackSelection( TQWidget* parent = 0, const char* name = 0); - ~StackSelection(); - - TraceData* data() const { return _data; } - void setData(TraceData*); - StackBrowser* browser() const { return _browser; } - TraceCostType* costType() { return _costType; } - TraceCostType* costType2() { return _costType2; } - TraceItem::CostType groupType() { return _groupType; } - -signals: - void functionSelected(TraceItem*); - -public slots: - void setFunction(TraceFunction*); - void setCostType(TraceCostType*); - void setCostType2(TraceCostType*); - void setGroupType(TraceItem::CostType); - - void stackSelected( TQListViewItem* ); - void browserBack(); - void browserForward(); - void browserUp(); - void browserDown(); - void refresh(); - void rebuildStackList(); - -private: - void selectFunction(); - - TraceData* _data; - StackBrowser* _browser; - TQListViewItem* _item; - TraceFunction* _function; - TraceCostType* _costType; - TraceCostType* _costType2; - TraceItem::CostType _groupType; -}; - -#endif diff --git a/tdecachegrind/tdecachegrind/stackselectionbase.ui b/tdecachegrind/tdecachegrind/stackselectionbase.ui deleted file mode 100644 index c61010f9..00000000 --- a/tdecachegrind/tdecachegrind/stackselectionbase.ui +++ /dev/null @@ -1,80 +0,0 @@ - -StackSelectionBase - - - StackSelectionBase - - - - 0 - 0 - 168 - 108 - - - - Stack Selection - - - - unnamed - - - 3 - - - 6 - - - - - Cost - - - true - - - true - - - - - Cost2 - - - true - - - true - - - - - Calls - - - true - - - true - - - - - Function - - - true - - - true - - - - stackList - - - - - - diff --git a/tdecachegrind/tdecachegrind/stactdeselection.cpp b/tdecachegrind/tdecachegrind/stactdeselection.cpp new file mode 100644 index 00000000..59094754 --- /dev/null +++ b/tdecachegrind/tdecachegrind/stactdeselection.cpp @@ -0,0 +1,230 @@ +/* This file is part of KCachegrind. + Copyright (C) 2003 Josef Weidendorfer + + KCachegrind is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* + * StackSelection for KCachegrind + * For function selection of a most expected stack, + * to be put into a TQDockWindow + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "stackbrowser.h" +#include "stackselection.h" +#include "stackitem.h" + +StackSelection::StackSelection( TQWidget* parent, const char* name) + : StackSelectionBase(parent, name) +{ + _data = 0; + _browser = new StackBrowser(); + _item = 0; + _function = 0; + _costType = 0; + _costType2 = 0; + _groupType = TraceItem::Function; + + stackList->setSorting(-1); + stackList->setAllColumnsShowFocus(true); + stackList->setResizeMode(TQListView::LastColumn); + stackList->setColumnAlignment(0, TQt::AlignRight); + stackList->setColumnAlignment(1, TQt::AlignRight); + stackList->setColumnAlignment(2, TQt::AlignRight); + stackList->setColumnWidth(0, 50); + // 2nd cost column hidden at first (_costType2 == 0) + stackList->setColumnWidth(1, 0); + stackList->setColumnWidth(2, 50); + + connect(stackList, TQT_SIGNAL(selectionChanged(TQListViewItem*)), + this, TQT_SLOT(stackSelected(TQListViewItem*))); +} + +StackSelection::~StackSelection() +{ + delete _browser; +} + +void StackSelection::setData(TraceData* data) +{ + if (_data == data) return; + + _data = data; + + stackList->clear(); + delete _browser; + _browser = new StackBrowser(); + _function = 0; +} + + +void StackSelection::setFunction(TraceFunction* f) +{ + if (_function == f) return; + _function = f; + + if (!_data || !_function) return; + + //kdDebug() << "StackSelection::setFunction " << f->name() << endl; + + HistoryItem* item = _browser->current(); + if (!item || item->function() != f) { + _browser->select(f); + rebuildStackList(); + } +} + + +void StackSelection::rebuildStackList() +{ + HistoryItem* item = _browser->current(); + stackList->clear(); + stackList->setColumnWidth(0, 50); + stackList->setColumnWidth(1, _costType2 ? 50:0); + stackList->setColumnWidth(2, 50); + if (!item || !item->stack()) return; + + TraceFunction* top = item->stack()->top(); + if (!top) return; + + stackList->setColumnWidthMode(1, TQListView::Maximum); + + TraceCallList l = item->stack()->calls(); + TraceCall* call; + for (call=l.last();call;call=l.prev()) + new StackItem(this, stackList, call); + + new StackItem(this, stackList, top); + + // select current function + TQListViewItem* i = stackList->firstChild(); + for (;i;i=i->nextSibling()) + if (((StackItem*)i)->function() == item->function()) + break; + + if (i) { + // this calls stackFunctionSelected() + stackList->setCurrentItem(i); + stackList->ensureItemVisible(i); + } + + if (!_costType2) { + stackList->setColumnWidthMode(1, TQListView::Manual); + stackList->setColumnWidth(1, 0); + } +} + +void StackSelection::stackSelected(TQListViewItem* i) +{ + if (!i) return; + + TraceFunction* f = ((StackItem*)i)->function(); + emit functionSelected(f); +} + + +void StackSelection::browserBack() +{ + if (_browser && _browser->canGoBack()) { + _browser->goBack(); + rebuildStackList(); + } +} + +void StackSelection::browserForward() +{ + if (_browser && _browser->canGoForward()) { + _browser->goForward(); + rebuildStackList(); + } +} + +void StackSelection::browserUp() +{ + if (_browser) { + _browser->goUp(); + rebuildStackList(); + } +} + +void StackSelection::browserDown() +{ + if (_browser) { + _browser->goDown(); + rebuildStackList(); + } +} + +void StackSelection::refresh() +{ + TQListViewItem* item = stackList->firstChild(); + for(;item;item = item->nextSibling()) + ((StackItem*)item)->updateCost(); +} + +void StackSelection::setCostType(TraceCostType* ct) +{ + if (ct == _costType) return; + _costType = ct; + + stackList->setColumnWidth(0, 50); + if (_costType) + stackList->setColumnText(0, _costType->name()); + + TQListViewItem* item = stackList->firstChild(); + for(;item;item = item->nextSibling()) + ((StackItem*)item)->updateCost(); +} + +void StackSelection::setCostType2(TraceCostType* ct) +{ + if (ct == _costType2) return; + _costType2 = ct; + + stackList->setColumnWidth(1, 50); + stackList->setColumnWidthMode(1, TQListView::Maximum); + if (_costType2) + stackList->setColumnText(1, _costType2->name()); + + TQListViewItem* item = stackList->firstChild(); + for(;item;item = item->nextSibling()) + ((StackItem*)item)->updateCost(); + + if (!_costType2) { + stackList->setColumnWidthMode(1, TQListView::Manual); + stackList->setColumnWidth(1, 0); + } +} + +void StackSelection::setGroupType(TraceItem::CostType gt) +{ + if (_groupType == gt) return; + _groupType = gt; + + TQListViewItem* item = stackList->firstChild(); + for(;item;item = item->nextSibling()) + ((StackItem*)item)->updateGroup(); +} + +#include "stackselection.moc" diff --git a/tdecachegrind/tdecachegrind/stactdeselection.h b/tdecachegrind/tdecachegrind/stactdeselection.h new file mode 100644 index 00000000..8a826495 --- /dev/null +++ b/tdecachegrind/tdecachegrind/stactdeselection.h @@ -0,0 +1,81 @@ +/* This file is part of KCachegrind. + Copyright (C) 2003 Josef Weidendorfer + + KCachegrind is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* + * StackSelection for KCachegrind + * For function selection of a most expected stack, + * to be put into a TQDockWindow + */ + +#ifndef STACKSELECTION_H +#define STACKSELECTION_H + +#include "stackselectionbase.h" +#include "tracedata.h" + +class TraceFunction; +class TraceData; +class StackBrowser; +class NestedAreaItem; + +class StackSelection : public StackSelectionBase +{ + Q_OBJECT + + +public: + StackSelection( TQWidget* parent = 0, const char* name = 0); + ~StackSelection(); + + TraceData* data() const { return _data; } + void setData(TraceData*); + StackBrowser* browser() const { return _browser; } + TraceCostType* costType() { return _costType; } + TraceCostType* costType2() { return _costType2; } + TraceItem::CostType groupType() { return _groupType; } + +signals: + void functionSelected(TraceItem*); + +public slots: + void setFunction(TraceFunction*); + void setCostType(TraceCostType*); + void setCostType2(TraceCostType*); + void setGroupType(TraceItem::CostType); + + void stackSelected( TQListViewItem* ); + void browserBack(); + void browserForward(); + void browserUp(); + void browserDown(); + void refresh(); + void rebuildStackList(); + +private: + void selectFunction(); + + TraceData* _data; + StackBrowser* _browser; + TQListViewItem* _item; + TraceFunction* _function; + TraceCostType* _costType; + TraceCostType* _costType2; + TraceItem::CostType _groupType; +}; + +#endif diff --git a/tdecachegrind/tdecachegrind/stactdeselectionbase.ui b/tdecachegrind/tdecachegrind/stactdeselectionbase.ui new file mode 100644 index 00000000..c61010f9 --- /dev/null +++ b/tdecachegrind/tdecachegrind/stactdeselectionbase.ui @@ -0,0 +1,80 @@ + +StackSelectionBase + + + StackSelectionBase + + + + 0 + 0 + 168 + 108 + + + + Stack Selection + + + + unnamed + + + 3 + + + 6 + + + + + Cost + + + true + + + true + + + + + Cost2 + + + true + + + true + + + + + Calls + + + true + + + true + + + + + Function + + + true + + + true + + + + stackList + + + + + + diff --git a/umbrello/umbrello/textblocklist.h b/umbrello/umbrello/textblocklist.h deleted file mode 100644 index bb1b7416..00000000 --- a/umbrello/umbrello/textblocklist.h +++ /dev/null @@ -1,23 +0,0 @@ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * copyright (C) 2004-2007 * - * Umbrello UML Modeller Authors * - ***************************************************************************/ - -#ifndef _TEXTBLOCKLIST_H -#define _TEXTBLOCKLIST_H - -#include - -// forward declarations -class TextBlock; - -typedef TQPtrList TextBlockList; -typedef TQPtrListIterator TextBlockListIt; - -#endif diff --git a/umbrello/umbrello/textbloctdelist.h b/umbrello/umbrello/textbloctdelist.h new file mode 100644 index 00000000..bb1b7416 --- /dev/null +++ b/umbrello/umbrello/textbloctdelist.h @@ -0,0 +1,23 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * copyright (C) 2004-2007 * + * Umbrello UML Modeller Authors * + ***************************************************************************/ + +#ifndef _TEXTBLOCKLIST_H +#define _TEXTBLOCKLIST_H + +#include + +// forward declarations +class TextBlock; + +typedef TQPtrList TextBlockList; +typedef TQPtrListIterator TextBlockListIt; + +#endif diff --git a/umbrello/umbrello/worktoolbar.cpp b/umbrello/umbrello/worktoolbar.cpp deleted file mode 100644 index 80d9c810..00000000 --- a/umbrello/umbrello/worktoolbar.cpp +++ /dev/null @@ -1,315 +0,0 @@ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * copyright (C) 2002-2007 * - * Umbrello UML Modeller Authors * - ***************************************************************************/ - -// own header -#include "worktoolbar.h" - -// qt/kde include files -#include -#include -#include -#include -#include - -// application specific includes -#include "uml.h" -#include "umldoc.h" -#include "umlview.h" -#include "worktoolbar.h" - - -WorkToolBar::WorkToolBar(TQMainWindow *parentWindow, const char*name) - : TDEToolBar(parentWindow,TQt::DockRight,false,name) { - m_CurrentButtonID = tbb_Undefined; - loadPixmaps(); - m_Type = Uml::dt_Class; /* first time in just want it to load arrow, - needs anything but dt_Undefined */ - setOrientation( Qt::Vertical ); - setVerticalStretchable( true ); - // initialize old tool map, everything starts with select tool (arrow) - m_map.insert(Uml::dt_UseCase,tbb_Arrow); - m_map.insert(Uml::dt_Collaboration,tbb_Arrow); - m_map.insert(Uml::dt_Class,tbb_Arrow); - m_map.insert(Uml::dt_Sequence,tbb_Arrow); - m_map.insert(Uml::dt_State,tbb_Arrow); - m_map.insert(Uml::dt_Activity,tbb_Arrow); - m_map.insert(Uml::dt_Undefined,tbb_Arrow); - - slotCheckToolBar( Uml::dt_Undefined ); - connect( this, TQT_SIGNAL( released( int ) ), this, TQT_SLOT( buttonChanged (int ) ) ); -} - -WorkToolBar::~WorkToolBar() { - disconnect(this, TQT_SIGNAL(released(int)),this,TQT_SLOT(buttonChanged(int))); -} - -void WorkToolBar::insertHotBtn(ToolBar_Buttons tbb) { - insertButton(m_ToolButtons[tbb].Symbol, tbb, true, m_ToolButtons[tbb].Label); - setToggle(tbb, true); -} - -void WorkToolBar::insertBasicAssociations() { - insertHotBtn(tbb_Association); - if (m_Type == Uml::dt_Class || m_Type == Uml::dt_UseCase) { - insertHotBtn(tbb_UniAssociation); - } - insertHotBtn(tbb_Dependency); - insertHotBtn(tbb_Generalization); -} - -void WorkToolBar::slotCheckToolBar(Uml::Diagram_Type dt) { - if ( dt == m_Type ) - return; - clear(); - m_Type = dt; - - if ( m_Type == Uml::dt_Undefined ) - return; - - //insert note, anchor and lines of text on all diagrams - insertHotBtn(tbb_Arrow); - toggleButton(tbb_Arrow); - m_CurrentButtonID = tbb_Arrow; - - insertHotBtn(tbb_Note); - insertHotBtn(tbb_Anchor); - insertHotBtn(tbb_Text); - insertHotBtn(tbb_Box); - - //insert diagram specific tools - switch (m_Type) { - case Uml::dt_UseCase: - insertHotBtn(tbb_Actor); - insertHotBtn(tbb_UseCase); - insertBasicAssociations(); - break; - - case Uml::dt_Class: - insertHotBtn(tbb_Class); - insertHotBtn(tbb_Interface); - insertHotBtn(tbb_Datatype); - insertHotBtn(tbb_Enum); - insertHotBtn(tbb_Package); - insertBasicAssociations(); - insertHotBtn(tbb_Composition); - insertHotBtn(tbb_Aggregation); - insertHotBtn(tbb_Containment); - break; - - case Uml::dt_Sequence: - insertHotBtn(tbb_Object); - insertHotBtn(tbb_Seq_Message_Synchronous); - insertHotBtn(tbb_Seq_Message_Asynchronous); - break; - - case Uml::dt_Collaboration: - insertHotBtn(tbb_Object); - insertHotBtn(tbb_Coll_Message); - break; - - case Uml::dt_State: - insertHotBtn(tbb_Initial_State); - insertHotBtn(tbb_State); - insertHotBtn(tbb_End_State); - insertHotBtn(tbb_State_Transition); - //insertHotBtn(tbb_DeepHistory); //NotYetImplemented - //insertHotBtn(tbb_ShallowHistory); //NotYetImplemented - //insertHotBtn(tbb_Join); //NotYetImplemented - insertHotBtn(tbb_StateFork); - //insertHotBtn(tbb_Junction); //NotYetImplemented - //insertHotBtn(tbb_Choice); //NotYetImplemented - //insertHotBtn(tbb_Andline); //NotYetImplemented - break; - - case Uml::dt_Activity: - insertHotBtn(tbb_Initial_Activity); - insertHotBtn(tbb_Activity); - insertHotBtn(tbb_End_Activity); - insertHotBtn(tbb_Branch); - insertHotBtn(tbb_Fork); - insertHotBtn(tbb_Activity_Transition); - break; - - case Uml::dt_Component: - insertHotBtn(tbb_Interface); - insertHotBtn(tbb_Component); - insertHotBtn(tbb_Artifact); - insertBasicAssociations(); - break; - - case Uml::dt_Deployment: - insertHotBtn(tbb_Object); - insertHotBtn(tbb_Interface); - insertHotBtn(tbb_Component); - insertHotBtn(tbb_Node); - insertBasicAssociations(); - break; - - case Uml::dt_EntityRelationship: - insertHotBtn(tbb_Entity); - insertHotBtn(tbb_Relationship); - break; - - default: - kWarning() << "slotCheckToolBar() on unknown diagram type:" - << m_Type << endl; - break; - } -} - -void WorkToolBar::buttonChanged(int b) { - UMLView* view = UMLApp::app()->getCurrentView(); - - //if trying to turn off arrow - stop it - ToolBar_Buttons tbb = (ToolBar_Buttons)b; - if (tbb == tbb_Arrow && m_CurrentButtonID == tbb_Arrow) { - toggleButton(tbb_Arrow); - - // signal needed, in the case ( when switching diagrams ) that - // Arrow Button gets activated, but the toolBarState of the Views may be different - emit sigButtonChanged( m_CurrentButtonID ); - - view->setCursor( currentCursor() ); - return; - } - - //if toggling off a button set to arrow - if (tbb == m_CurrentButtonID) { - m_map[m_Type] = m_CurrentButtonID; // store old tool for this diagram type - toggleButton(tbb_Arrow); - m_CurrentButtonID = tbb_Arrow; - emit sigButtonChanged(m_CurrentButtonID); - view->setCursor( currentCursor() ); - return; - } - m_map[m_Type] = m_CurrentButtonID; - toggleButton(m_CurrentButtonID); - m_CurrentButtonID = tbb; - emit sigButtonChanged(m_CurrentButtonID); - view->setCursor( currentCursor() ); -} - -TQCursor WorkToolBar::currentCursor() { - return m_ToolButtons[m_CurrentButtonID].Cursor; -} - -void WorkToolBar::slotResetToolBar() { - if (m_CurrentButtonID == tbb_Arrow) - return;//really shouldn't occur - toggleButton(m_CurrentButtonID); - m_CurrentButtonID = tbb_Arrow; - toggleButton(m_CurrentButtonID); - emit sigButtonChanged(m_CurrentButtonID); - - TQCursor curs; - curs.setShape(Qt::ArrowCursor); - - UMLView* view = UMLApp::app()->getCurrentView(); - if (view != NULL) { - view -> setCursor(curs); - } -} - -void WorkToolBar::setOldTool() { - TDEToolBarButton *b = (TDEToolBarButton*) getWidget(m_map[m_Type]); - if (b) - b -> animateClick(); -} - -void WorkToolBar::setDefaultTool() { - TDEToolBarButton *b = (TDEToolBarButton*) getWidget(tbb_Arrow); - if (b) - b -> animateClick(); -} - -TQPixmap WorkToolBar::load(const TQString & fileName) { - TQPixmap pxm; - pxm.load(fileName); - return pxm; -} - -void WorkToolBar::loadPixmaps() { - const struct ButtonInfo { - const ToolBar_Buttons tbb; - const TQString btnName; - const char *pngName; - } buttonInfo[] = { - { tbb_Object, i18n("Object"), "object.png" }, - { tbb_Seq_Message_Synchronous, i18n("Synchronous Message"), "message-synchronous.png" }, - { tbb_Seq_Message_Asynchronous, i18n("Asynchronous Message"), "message-asynchronous.png" }, - { tbb_Association, i18n("Association"), "association.png" }, - { tbb_Containment, i18n("Containment"), "containment.png" }, - { tbb_Anchor, i18n("Anchor"), "anchor.png" }, - { tbb_Text, i18n("Label"), "text.png" }, - { tbb_Note, i18n("Note"), "note.png" }, - { tbb_Box, i18n("Box"), "box.png" }, - { tbb_Actor, i18n("Actor"), "actor.png" }, - { tbb_Dependency, i18n("Dependency"), "dependency.png" }, - { tbb_Aggregation, i18n("Aggregation"), "aggregation.png" }, - { tbb_Relationship, i18n("Relationship"), "relationship.png" }, - { tbb_UniAssociation, i18n("Directional Association"), "uniassociation.png" }, - { tbb_Generalization, i18n("Implements (Generalisation/Realisation)"), "generalisation.png" }, - { tbb_Composition, i18n("Composition"), "composition.png" }, - { tbb_UseCase, i18n("Use Case"), "usecase.png" }, - { tbb_Class, i18n("Class"), "class.png" }, - { tbb_Initial_State, i18n("Initial State"), "initial_state.png" }, - { tbb_End_State, i18n("End State"), "end_state.png" }, - { tbb_Branch, i18n("Branch/Merge"), "branch.png" }, - { tbb_Fork, i18n("Fork/Join"), "fork.png" }, - { tbb_Package, i18n("Package"), "package.png" }, - { tbb_Component, i18n("Component"), "component.png" }, - { tbb_Node, i18n("Node"), "node.png" }, - { tbb_Artifact, i18n("Artifact"), "artifact.png" }, - { tbb_Interface, i18n("Interface"), "interface.png" }, - { tbb_Datatype, i18n("Datatype"), "datatype.png" }, - { tbb_Enum, i18n("Enum"), "enum.png" }, - { tbb_Entity, i18n("Entity"), "entity.png" }, - { tbb_DeepHistory, i18n("Deep History"), "deep-history.png" }, //NotYetImplemented - { tbb_ShallowHistory, i18n("Shallow History"), "shallow-history.png" }, //NotYetImplemented - { tbb_Join, i18n("Join"), "join.png" }, //NotYetImplemented - { tbb_StateFork, i18n("Fork"), "state-fork.png" }, - { tbb_Junction, i18n("Junction"), "junction.png" }, //NotYetImplemented - { tbb_Choice, i18n("Choice"), "choice-round.png" }, //NotYetImplemented - //:TODO: let the user decide which symbol he wants (setting an option) - // { tbb_Choice, i18n("Choice"), "choice-rhomb.png" }, //NotYetImplemented - //{ tbb_Andline, i18n("And Line"), "andline.png" }, //NotYetImplemented - { tbb_State_Transition, i18n("State Transition"), "uniassociation.png" }, - { tbb_Activity_Transition, i18n("Activity Transition"), "uniassociation.png" }, - { tbb_Activity, i18n("Activity"), "usecase.png" }, - { tbb_State, i18n("State"), "usecase.png" }, - { tbb_End_Activity, i18n("End Activity"), "end_state.png" }, - { tbb_Initial_Activity, i18n("Initial Activity"), "initial_state.png" }, - { tbb_Coll_Message, i18n("Message"), "message-asynchronous.png" } - }; - TDEStandardDirs * dirs = TDEGlobal::dirs(); - TQString dataDir = dirs->findResourceDir( "data", "umbrello/pics/object.png" ); - dataDir += "/umbrello/pics/"; - const size_t n_buttonInfos = sizeof(buttonInfo) / sizeof(ButtonInfo); - - m_ToolButtons.insert(tbb_Undefined, - ToolButton(i18n("UNDEFINED"), - 0, - TQCursor()) ); - m_ToolButtons.insert(tbb_Arrow, - ToolButton(i18n("Select"), - load(dataDir + "arrow.png"), - TQCursor()) ); - kDebug() << "WorkToolBar::loadPixmaps: n_buttonInfos = " << n_buttonInfos << endl; - for (uint i = 0; i < n_buttonInfos; i++) { - const ButtonInfo& info = buttonInfo[i]; - m_ToolButtons.insert(info.tbb, - ToolButton(info.btnName, - load(dataDir + info.pngName), - TQCursor(load(dataDir + "cursor-" + info.pngName), 9, 9))); - } -} - -#include "worktoolbar.moc" diff --git a/umbrello/umbrello/worktoolbar.h b/umbrello/umbrello/worktoolbar.h deleted file mode 100644 index a7d9339c..00000000 --- a/umbrello/umbrello/worktoolbar.h +++ /dev/null @@ -1,184 +0,0 @@ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * copyright (C) 2002-2007 * - * Umbrello UML Modeller Authors * - ***************************************************************************/ - -#ifndef WORKTOOLBAR_H -#define WORKTOOLBAR_H - -#include -#include -#include -#include - -#include "umlnamespace.h" - -class TQMainWindow; - - -/** - * This is the toolbar that is displayed on the right-hand side of the program - * window. For each type of diagram it will change to suit that document. - * - * To add a new tool button do the following: - * - create a button pixmap (symbol) - * - create a cursor pixmap - * - add an element to the ToolBar_Buttons enum - * - adjust function loadPixmaps - * - adjust function slotCheckToolBar - * - * @short The toolbar that is different for each type of diagram. - * @author Paul Hensgen - * Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org - */ - - -class WorkToolBar : public TDEToolBar { - Q_OBJECT - -public: - - /** - * Creates a work tool bar. - * - * @param parentWindow The parent of the toolbar. - */ - WorkToolBar(TQMainWindow *parentWindow, const char *name); - - /** - * Standard deconstructor. - */ - ~WorkToolBar(); - - /** - * Sets the current tool to the previously used Tool. This is just - * as if the user had pressed the button for the other tool. - */ - void setOldTool(); - - /** - * Sets the current tool to the default tool. (select tool) - * Calling this function is as if the user had pressed the "arrow" - * button on the toolbar. - */ - void setDefaultTool(); - - /** - * Enumeration of all available toolbar buttons. - */ - enum ToolBar_Buttons - { - tbb_Undefined = -1, - tbb_Arrow, - tbb_Generalization, - tbb_Aggregation, - tbb_Dependency, - tbb_Association, - tbb_Containment, - tbb_Coll_Message, - tbb_Seq_Message_Synchronous, - tbb_Seq_Message_Asynchronous, - tbb_Composition, - tbb_Relationship, - tbb_UniAssociation, - tbb_State_Transition, - tbb_Activity_Transition, - tbb_Anchor,//keep anchor as last association until code uses better algorithm for testing - tbb_Note, - tbb_Box, - tbb_Text, - tbb_Actor, - tbb_UseCase, - tbb_Class, - tbb_Interface, - tbb_Datatype, - tbb_Enum, - tbb_Entity, - tbb_Package, - tbb_Component, - tbb_Node, - tbb_Artifact, - tbb_Object, - tbb_Initial_State, - tbb_State, - tbb_End_State, - tbb_Initial_Activity, - tbb_Activity, - tbb_End_Activity, - tbb_Branch, - tbb_Fork, - tbb_DeepHistory, - tbb_ShallowHistory, - tbb_Join, - tbb_StateFork, - tbb_Junction, - tbb_Choice, - tbb_Andline - }; - -private: - - typedef TQMap OldToolMap; - - /** - * This inner class holds label, symbol, and cursor of a tool button. - */ - class ToolButton { - public: - TQString Label; - TQPixmap Symbol; - TQCursor Cursor; - ToolButton() : Label(TQString("?")), Symbol(TQPixmap()), Cursor(TQCursor()) { } - ToolButton(const TQString& lbl, const TQPixmap& smb, const TQCursor& cur) : - Label(lbl), Symbol(smb), Cursor(cur) { } - }; - - typedef TQMap ToolButtonMap; - - ToolBar_Buttons m_CurrentButtonID; - OldToolMap m_map; - Uml::Diagram_Type m_Type; - ToolButtonMap m_ToolButtons; - - /** - * Loads a pixmap from file - */ - TQPixmap load(const TQString &fileName); - - /** - * Loads toolbar icon and mouse cursor images from disk - */ - void loadPixmaps(); - - /** - * Returns the current cursor depending on m_CurrentButtonID - */ - TQCursor currentCursor(); - - /** - * Inserts the button corresponding to the tbb value given - * and activates the toggle. - */ - void insertHotBtn(ToolBar_Buttons tbb); - - /** - * Inserts most associations, just reduces some string - * duplication (nice to translators) - */ - void insertBasicAssociations(); - -signals: - void sigButtonChanged(int); -public slots: - void slotCheckToolBar(Uml::Diagram_Type dt); - void buttonChanged(int b); - void slotResetToolBar(); -}; - -#endif diff --git a/umbrello/umbrello/wortdetoolbar.cpp b/umbrello/umbrello/wortdetoolbar.cpp new file mode 100644 index 00000000..80d9c810 --- /dev/null +++ b/umbrello/umbrello/wortdetoolbar.cpp @@ -0,0 +1,315 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * copyright (C) 2002-2007 * + * Umbrello UML Modeller Authors * + ***************************************************************************/ + +// own header +#include "worktoolbar.h" + +// qt/kde include files +#include +#include +#include +#include +#include + +// application specific includes +#include "uml.h" +#include "umldoc.h" +#include "umlview.h" +#include "worktoolbar.h" + + +WorkToolBar::WorkToolBar(TQMainWindow *parentWindow, const char*name) + : TDEToolBar(parentWindow,TQt::DockRight,false,name) { + m_CurrentButtonID = tbb_Undefined; + loadPixmaps(); + m_Type = Uml::dt_Class; /* first time in just want it to load arrow, + needs anything but dt_Undefined */ + setOrientation( Qt::Vertical ); + setVerticalStretchable( true ); + // initialize old tool map, everything starts with select tool (arrow) + m_map.insert(Uml::dt_UseCase,tbb_Arrow); + m_map.insert(Uml::dt_Collaboration,tbb_Arrow); + m_map.insert(Uml::dt_Class,tbb_Arrow); + m_map.insert(Uml::dt_Sequence,tbb_Arrow); + m_map.insert(Uml::dt_State,tbb_Arrow); + m_map.insert(Uml::dt_Activity,tbb_Arrow); + m_map.insert(Uml::dt_Undefined,tbb_Arrow); + + slotCheckToolBar( Uml::dt_Undefined ); + connect( this, TQT_SIGNAL( released( int ) ), this, TQT_SLOT( buttonChanged (int ) ) ); +} + +WorkToolBar::~WorkToolBar() { + disconnect(this, TQT_SIGNAL(released(int)),this,TQT_SLOT(buttonChanged(int))); +} + +void WorkToolBar::insertHotBtn(ToolBar_Buttons tbb) { + insertButton(m_ToolButtons[tbb].Symbol, tbb, true, m_ToolButtons[tbb].Label); + setToggle(tbb, true); +} + +void WorkToolBar::insertBasicAssociations() { + insertHotBtn(tbb_Association); + if (m_Type == Uml::dt_Class || m_Type == Uml::dt_UseCase) { + insertHotBtn(tbb_UniAssociation); + } + insertHotBtn(tbb_Dependency); + insertHotBtn(tbb_Generalization); +} + +void WorkToolBar::slotCheckToolBar(Uml::Diagram_Type dt) { + if ( dt == m_Type ) + return; + clear(); + m_Type = dt; + + if ( m_Type == Uml::dt_Undefined ) + return; + + //insert note, anchor and lines of text on all diagrams + insertHotBtn(tbb_Arrow); + toggleButton(tbb_Arrow); + m_CurrentButtonID = tbb_Arrow; + + insertHotBtn(tbb_Note); + insertHotBtn(tbb_Anchor); + insertHotBtn(tbb_Text); + insertHotBtn(tbb_Box); + + //insert diagram specific tools + switch (m_Type) { + case Uml::dt_UseCase: + insertHotBtn(tbb_Actor); + insertHotBtn(tbb_UseCase); + insertBasicAssociations(); + break; + + case Uml::dt_Class: + insertHotBtn(tbb_Class); + insertHotBtn(tbb_Interface); + insertHotBtn(tbb_Datatype); + insertHotBtn(tbb_Enum); + insertHotBtn(tbb_Package); + insertBasicAssociations(); + insertHotBtn(tbb_Composition); + insertHotBtn(tbb_Aggregation); + insertHotBtn(tbb_Containment); + break; + + case Uml::dt_Sequence: + insertHotBtn(tbb_Object); + insertHotBtn(tbb_Seq_Message_Synchronous); + insertHotBtn(tbb_Seq_Message_Asynchronous); + break; + + case Uml::dt_Collaboration: + insertHotBtn(tbb_Object); + insertHotBtn(tbb_Coll_Message); + break; + + case Uml::dt_State: + insertHotBtn(tbb_Initial_State); + insertHotBtn(tbb_State); + insertHotBtn(tbb_End_State); + insertHotBtn(tbb_State_Transition); + //insertHotBtn(tbb_DeepHistory); //NotYetImplemented + //insertHotBtn(tbb_ShallowHistory); //NotYetImplemented + //insertHotBtn(tbb_Join); //NotYetImplemented + insertHotBtn(tbb_StateFork); + //insertHotBtn(tbb_Junction); //NotYetImplemented + //insertHotBtn(tbb_Choice); //NotYetImplemented + //insertHotBtn(tbb_Andline); //NotYetImplemented + break; + + case Uml::dt_Activity: + insertHotBtn(tbb_Initial_Activity); + insertHotBtn(tbb_Activity); + insertHotBtn(tbb_End_Activity); + insertHotBtn(tbb_Branch); + insertHotBtn(tbb_Fork); + insertHotBtn(tbb_Activity_Transition); + break; + + case Uml::dt_Component: + insertHotBtn(tbb_Interface); + insertHotBtn(tbb_Component); + insertHotBtn(tbb_Artifact); + insertBasicAssociations(); + break; + + case Uml::dt_Deployment: + insertHotBtn(tbb_Object); + insertHotBtn(tbb_Interface); + insertHotBtn(tbb_Component); + insertHotBtn(tbb_Node); + insertBasicAssociations(); + break; + + case Uml::dt_EntityRelationship: + insertHotBtn(tbb_Entity); + insertHotBtn(tbb_Relationship); + break; + + default: + kWarning() << "slotCheckToolBar() on unknown diagram type:" + << m_Type << endl; + break; + } +} + +void WorkToolBar::buttonChanged(int b) { + UMLView* view = UMLApp::app()->getCurrentView(); + + //if trying to turn off arrow - stop it + ToolBar_Buttons tbb = (ToolBar_Buttons)b; + if (tbb == tbb_Arrow && m_CurrentButtonID == tbb_Arrow) { + toggleButton(tbb_Arrow); + + // signal needed, in the case ( when switching diagrams ) that + // Arrow Button gets activated, but the toolBarState of the Views may be different + emit sigButtonChanged( m_CurrentButtonID ); + + view->setCursor( currentCursor() ); + return; + } + + //if toggling off a button set to arrow + if (tbb == m_CurrentButtonID) { + m_map[m_Type] = m_CurrentButtonID; // store old tool for this diagram type + toggleButton(tbb_Arrow); + m_CurrentButtonID = tbb_Arrow; + emit sigButtonChanged(m_CurrentButtonID); + view->setCursor( currentCursor() ); + return; + } + m_map[m_Type] = m_CurrentButtonID; + toggleButton(m_CurrentButtonID); + m_CurrentButtonID = tbb; + emit sigButtonChanged(m_CurrentButtonID); + view->setCursor( currentCursor() ); +} + +TQCursor WorkToolBar::currentCursor() { + return m_ToolButtons[m_CurrentButtonID].Cursor; +} + +void WorkToolBar::slotResetToolBar() { + if (m_CurrentButtonID == tbb_Arrow) + return;//really shouldn't occur + toggleButton(m_CurrentButtonID); + m_CurrentButtonID = tbb_Arrow; + toggleButton(m_CurrentButtonID); + emit sigButtonChanged(m_CurrentButtonID); + + TQCursor curs; + curs.setShape(Qt::ArrowCursor); + + UMLView* view = UMLApp::app()->getCurrentView(); + if (view != NULL) { + view -> setCursor(curs); + } +} + +void WorkToolBar::setOldTool() { + TDEToolBarButton *b = (TDEToolBarButton*) getWidget(m_map[m_Type]); + if (b) + b -> animateClick(); +} + +void WorkToolBar::setDefaultTool() { + TDEToolBarButton *b = (TDEToolBarButton*) getWidget(tbb_Arrow); + if (b) + b -> animateClick(); +} + +TQPixmap WorkToolBar::load(const TQString & fileName) { + TQPixmap pxm; + pxm.load(fileName); + return pxm; +} + +void WorkToolBar::loadPixmaps() { + const struct ButtonInfo { + const ToolBar_Buttons tbb; + const TQString btnName; + const char *pngName; + } buttonInfo[] = { + { tbb_Object, i18n("Object"), "object.png" }, + { tbb_Seq_Message_Synchronous, i18n("Synchronous Message"), "message-synchronous.png" }, + { tbb_Seq_Message_Asynchronous, i18n("Asynchronous Message"), "message-asynchronous.png" }, + { tbb_Association, i18n("Association"), "association.png" }, + { tbb_Containment, i18n("Containment"), "containment.png" }, + { tbb_Anchor, i18n("Anchor"), "anchor.png" }, + { tbb_Text, i18n("Label"), "text.png" }, + { tbb_Note, i18n("Note"), "note.png" }, + { tbb_Box, i18n("Box"), "box.png" }, + { tbb_Actor, i18n("Actor"), "actor.png" }, + { tbb_Dependency, i18n("Dependency"), "dependency.png" }, + { tbb_Aggregation, i18n("Aggregation"), "aggregation.png" }, + { tbb_Relationship, i18n("Relationship"), "relationship.png" }, + { tbb_UniAssociation, i18n("Directional Association"), "uniassociation.png" }, + { tbb_Generalization, i18n("Implements (Generalisation/Realisation)"), "generalisation.png" }, + { tbb_Composition, i18n("Composition"), "composition.png" }, + { tbb_UseCase, i18n("Use Case"), "usecase.png" }, + { tbb_Class, i18n("Class"), "class.png" }, + { tbb_Initial_State, i18n("Initial State"), "initial_state.png" }, + { tbb_End_State, i18n("End State"), "end_state.png" }, + { tbb_Branch, i18n("Branch/Merge"), "branch.png" }, + { tbb_Fork, i18n("Fork/Join"), "fork.png" }, + { tbb_Package, i18n("Package"), "package.png" }, + { tbb_Component, i18n("Component"), "component.png" }, + { tbb_Node, i18n("Node"), "node.png" }, + { tbb_Artifact, i18n("Artifact"), "artifact.png" }, + { tbb_Interface, i18n("Interface"), "interface.png" }, + { tbb_Datatype, i18n("Datatype"), "datatype.png" }, + { tbb_Enum, i18n("Enum"), "enum.png" }, + { tbb_Entity, i18n("Entity"), "entity.png" }, + { tbb_DeepHistory, i18n("Deep History"), "deep-history.png" }, //NotYetImplemented + { tbb_ShallowHistory, i18n("Shallow History"), "shallow-history.png" }, //NotYetImplemented + { tbb_Join, i18n("Join"), "join.png" }, //NotYetImplemented + { tbb_StateFork, i18n("Fork"), "state-fork.png" }, + { tbb_Junction, i18n("Junction"), "junction.png" }, //NotYetImplemented + { tbb_Choice, i18n("Choice"), "choice-round.png" }, //NotYetImplemented + //:TODO: let the user decide which symbol he wants (setting an option) + // { tbb_Choice, i18n("Choice"), "choice-rhomb.png" }, //NotYetImplemented + //{ tbb_Andline, i18n("And Line"), "andline.png" }, //NotYetImplemented + { tbb_State_Transition, i18n("State Transition"), "uniassociation.png" }, + { tbb_Activity_Transition, i18n("Activity Transition"), "uniassociation.png" }, + { tbb_Activity, i18n("Activity"), "usecase.png" }, + { tbb_State, i18n("State"), "usecase.png" }, + { tbb_End_Activity, i18n("End Activity"), "end_state.png" }, + { tbb_Initial_Activity, i18n("Initial Activity"), "initial_state.png" }, + { tbb_Coll_Message, i18n("Message"), "message-asynchronous.png" } + }; + TDEStandardDirs * dirs = TDEGlobal::dirs(); + TQString dataDir = dirs->findResourceDir( "data", "umbrello/pics/object.png" ); + dataDir += "/umbrello/pics/"; + const size_t n_buttonInfos = sizeof(buttonInfo) / sizeof(ButtonInfo); + + m_ToolButtons.insert(tbb_Undefined, + ToolButton(i18n("UNDEFINED"), + 0, + TQCursor()) ); + m_ToolButtons.insert(tbb_Arrow, + ToolButton(i18n("Select"), + load(dataDir + "arrow.png"), + TQCursor()) ); + kDebug() << "WorkToolBar::loadPixmaps: n_buttonInfos = " << n_buttonInfos << endl; + for (uint i = 0; i < n_buttonInfos; i++) { + const ButtonInfo& info = buttonInfo[i]; + m_ToolButtons.insert(info.tbb, + ToolButton(info.btnName, + load(dataDir + info.pngName), + TQCursor(load(dataDir + "cursor-" + info.pngName), 9, 9))); + } +} + +#include "worktoolbar.moc" diff --git a/umbrello/umbrello/wortdetoolbar.h b/umbrello/umbrello/wortdetoolbar.h new file mode 100644 index 00000000..a7d9339c --- /dev/null +++ b/umbrello/umbrello/wortdetoolbar.h @@ -0,0 +1,184 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * copyright (C) 2002-2007 * + * Umbrello UML Modeller Authors * + ***************************************************************************/ + +#ifndef WORKTOOLBAR_H +#define WORKTOOLBAR_H + +#include +#include +#include +#include + +#include "umlnamespace.h" + +class TQMainWindow; + + +/** + * This is the toolbar that is displayed on the right-hand side of the program + * window. For each type of diagram it will change to suit that document. + * + * To add a new tool button do the following: + * - create a button pixmap (symbol) + * - create a cursor pixmap + * - add an element to the ToolBar_Buttons enum + * - adjust function loadPixmaps + * - adjust function slotCheckToolBar + * + * @short The toolbar that is different for each type of diagram. + * @author Paul Hensgen + * Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org + */ + + +class WorkToolBar : public TDEToolBar { + Q_OBJECT + +public: + + /** + * Creates a work tool bar. + * + * @param parentWindow The parent of the toolbar. + */ + WorkToolBar(TQMainWindow *parentWindow, const char *name); + + /** + * Standard deconstructor. + */ + ~WorkToolBar(); + + /** + * Sets the current tool to the previously used Tool. This is just + * as if the user had pressed the button for the other tool. + */ + void setOldTool(); + + /** + * Sets the current tool to the default tool. (select tool) + * Calling this function is as if the user had pressed the "arrow" + * button on the toolbar. + */ + void setDefaultTool(); + + /** + * Enumeration of all available toolbar buttons. + */ + enum ToolBar_Buttons + { + tbb_Undefined = -1, + tbb_Arrow, + tbb_Generalization, + tbb_Aggregation, + tbb_Dependency, + tbb_Association, + tbb_Containment, + tbb_Coll_Message, + tbb_Seq_Message_Synchronous, + tbb_Seq_Message_Asynchronous, + tbb_Composition, + tbb_Relationship, + tbb_UniAssociation, + tbb_State_Transition, + tbb_Activity_Transition, + tbb_Anchor,//keep anchor as last association until code uses better algorithm for testing + tbb_Note, + tbb_Box, + tbb_Text, + tbb_Actor, + tbb_UseCase, + tbb_Class, + tbb_Interface, + tbb_Datatype, + tbb_Enum, + tbb_Entity, + tbb_Package, + tbb_Component, + tbb_Node, + tbb_Artifact, + tbb_Object, + tbb_Initial_State, + tbb_State, + tbb_End_State, + tbb_Initial_Activity, + tbb_Activity, + tbb_End_Activity, + tbb_Branch, + tbb_Fork, + tbb_DeepHistory, + tbb_ShallowHistory, + tbb_Join, + tbb_StateFork, + tbb_Junction, + tbb_Choice, + tbb_Andline + }; + +private: + + typedef TQMap OldToolMap; + + /** + * This inner class holds label, symbol, and cursor of a tool button. + */ + class ToolButton { + public: + TQString Label; + TQPixmap Symbol; + TQCursor Cursor; + ToolButton() : Label(TQString("?")), Symbol(TQPixmap()), Cursor(TQCursor()) { } + ToolButton(const TQString& lbl, const TQPixmap& smb, const TQCursor& cur) : + Label(lbl), Symbol(smb), Cursor(cur) { } + }; + + typedef TQMap ToolButtonMap; + + ToolBar_Buttons m_CurrentButtonID; + OldToolMap m_map; + Uml::Diagram_Type m_Type; + ToolButtonMap m_ToolButtons; + + /** + * Loads a pixmap from file + */ + TQPixmap load(const TQString &fileName); + + /** + * Loads toolbar icon and mouse cursor images from disk + */ + void loadPixmaps(); + + /** + * Returns the current cursor depending on m_CurrentButtonID + */ + TQCursor currentCursor(); + + /** + * Inserts the button corresponding to the tbb value given + * and activates the toggle. + */ + void insertHotBtn(ToolBar_Buttons tbb); + + /** + * Inserts most associations, just reduces some string + * duplication (nice to translators) + */ + void insertBasicAssociations(); + +signals: + void sigButtonChanged(int); +public slots: + void slotCheckToolBar(Uml::Diagram_Type dt); + void buttonChanged(int b); + void slotResetToolBar(); +}; + +#endif -- cgit v1.2.1