+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
// File: QtxListAction.cxx
// Author: Sergey TELKOV (Based on code by Eugene AKSENOV)
};
/*!
- Class: QtxListAction::ToolButton
- Level: Internal
+ \class QtxListAction::ToolButton
+ Custom tool button
*/
-
class QtxListAction::ToolButton : public QToolButton
{
public:
QtxListAction* myAction;
};
+/*!
+ Constructor
+*/
QtxListAction::ToolButton::ToolButton( QtxListAction* a, QWidget* parent, const char* name )
: QToolButton( parent, name ),
myAction( a )
setIconSet( QPixmap( list_arrow_icon ) );
}
+/*!
+ Destructor
+*/
QtxListAction::ToolButton::~ToolButton()
{
if ( myAction )
myAction->controlDeleted( this );
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxListAction::ToolButton::sizeHint() const
{
QSize sz = iconSet().pixmap().size();
}
/*!
- Class: QtxListAction
- Level: Public
-*/
-
-/*!
- Name: QtxListAction [public]
- Desc: Constructs an list action with given parent and name. If toggle is true the
- action will be a toggle action, otherwise it will be a command action.
+ Constructs an list action with given parent and name. If toggle is true the
+ action will be a toggle action, otherwise it will be a command action.
*/
-
QtxListAction::QtxListAction( QObject* parent, const char* name, bool toggle )
: QtxAction( parent, name, toggle ),
myFrame( 0 ),
}
/*!
- Name: QtxListAction [public]
- Desc: This constructor creates an action with the following properties: the
- description text, the icon or iconset icon, the menu text and keyboard
- accelerator. It is a child of given parent and named specified name.
- If toggle is true the action will be a toggle action, otherwise it will
- be a command action.
+ This constructor creates an action with the following properties: the
+ description text, the icon or iconset icon, the menu text and keyboard
+ accelerator. It is a child of given parent and named specified name.
+ If toggle is true the action will be a toggle action, otherwise it will
+ be a command action.
*/
QtxListAction::QtxListAction( const QString& text, const QIconSet& icon,
}
/*!
- Name: QtxListAction [public]
- Desc: This constructor creates an action with the following properties: the
- description text, the menu text and keyboard accelerator. It is a child
- of given parent and named specified name. If toggle is true the action
- will be a toggle action, otherwise it will be a command action.
+ This constructor creates an action with the following properties: the
+ description text, the menu text and keyboard accelerator. It is a child
+ of given parent and named specified name. If toggle is true the action
+ will be a toggle action, otherwise it will be a command action.
*/
QtxListAction::QtxListAction( const QString& text, const QString& menuText,
}
/*!
- Name: ~QtxListAction [virtual public]
- Desc: Destructor.
+ Destructor.
*/
QtxListAction::~QtxListAction()
{
+ if ( myFrame )
+ myFrame->myAction = 0;
}
/*!
myMode = mode;
}
+/*!
+ \return list of names
+*/
QStringList QtxListAction::names() const
{
QStringList lst;
else if ( w->inherits( "QPopupMenu" ) )
myPopups.remove( w );
+#if QT_VER >= 3
+ disconnect( w, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
+#endif
+
return true;
}
{
myTipGroup = new QToolTipGroup( this );
- myFrame = new QtxListFrame( qApp->mainWidget() );
+ myFrame = new QtxListFrame( this, qApp->mainWidget() );
myFrame->setMaxLines( 5 );
myFrame->setMaxLineChars( 7 );
myFrame->hide();
}
+/*!
+ SLOT: called when frame is hidden
+*/
void QtxListAction::onHided()
{
for ( ButtonsMap::Iterator bit = myButtons.begin(); bit != myButtons.end(); ++bit )
}
}
-/**********************************************************************
-** Class: QtxListFrame
-** Descr: Frame for the list of actions
-** Level: Internal
-***********************************************************************/
-
+/*!
+ \class QtxListFrame
+ Frame for the list of actions
+*/
class QtxListFrame::ScrollEvent : public QCustomEvent
{
public:
/*!
Constructor
*/
-QtxListFrame::QtxListFrame( QWidget* parent, WFlags f )
+QtxListFrame::QtxListFrame( QtxListAction* a, QWidget* parent, WFlags f )
: QFrame( parent, 0, WStyle_Customize | WStyle_NoBorderEx | WType_Popup | WStyle_Tool | WStyle_StaysOnTop ),
myList( 0 ),
myOwner( 0 ),
+myAction( a ),
myComment( 0 ),
myMaxLines( 5 ),
myMaxLineChars( 10 ),
setFrameStyle( Panel | Raised );
}
+/*!
+ Destructor
+*/
QtxListFrame::~QtxListFrame()
{
+ if ( myAction )
+ myAction->myFrame = 0;
}
/*!
setNames( myNames );
}
+/*!
+ Adds a names to the list. Truncates the name to fit to the frame width.
+ Use QtxListAction::setMaxLineChar( int ) to set the width in characters. [ public ]
+*/
+
void QtxListFrame::addNames( const QStringList& names )
{
for ( QStringList::ConstIterator it = names.begin(); it != names.end(); ++it )
}
}
+/*!
+ \return list of names
+*/
const QStringList QtxListFrame::names() const
{
return myNames;
myComment->setText( com );
}
+/*!
+ Sets owner
+ \param wo - new owner
+*/
void QtxListFrame::setOwner( QWidget* wo )
{
myOwner = wo;
return true;
}
+/*!
+ Custom event filter
+*/
bool QtxListFrame::event( QEvent* e )
{
if ( e->type() != (int)ScrollEvent::Scroll )
updateComment();
}
+/*!
+ return number of selected items
+*/
int QtxListFrame::selected() const
{
uint sel = 0;