1 // File: QtxListAction.hxx
2 // Author: Sergey TELKOV (Based on code by Eugene AKSENOV)
4 #ifndef QTXLISTACTION_H
5 #define QTXLISTACTION_H
11 #include <qstringlist.h>
22 #pragma warning( disable:4251 )
25 class QTX_EXPORT QtxListAction : public QtxAction
32 enum { Item, SubMenu } PopupMode;
35 QtxListAction( QObject* = 0, const char* = 0, bool = false );
36 QtxListAction( const QString&, const QIconSet&, const QString&, int, QObject*, const char* = 0, bool = false );
37 QtxListAction( const QString&, const QString&, int, QObject*, const char* = 0, bool = false );
38 virtual ~QtxListAction();
41 virtual bool addTo( QWidget* );
42 virtual bool addTo( QWidget*, const int );
44 virtual bool removeFrom( QWidget* );
45 virtual bool eventFilter( QObject*, QEvent* );
47 int popupMode() const;
48 void setPopupMode( const int );
50 void addNames( const QStringList&, bool = true );
51 void setComment( const QString&, const QString& = QString::null );
53 void setMaxLines( int );
54 void setMaxLineChars( int );
57 void activated( int );
60 virtual void setEnabled( bool );
65 void onExpand( bool );
66 void onMultiple( int );
67 void onActivated( int );
68 void onDestroyed( QObject* );
71 virtual void addedTo( QWidget*, QWidget* );
75 QWidget* widget( QWidget* ) const;
76 QPopupMenu* listPopup( QWidget* ) const;
77 QToolButton* mainButton( QWidget* ) const;
78 QToolButton* dropButton( QWidget* ) const;
80 void controlDeleted( QWidget* );
83 typedef struct { int id; QPopupMenu* popup; } Popups;
84 typedef struct { QToolButton* main; QToolButton* drop; } Buttons;
85 typedef QMap<QWidget*, Popups> PopupsMap;
86 typedef QMap<QWidget*, Buttons> ButtonsMap;
90 QtxListFrame* myFrame;
94 QToolTipGroup* myTipGroup;
96 friend class ToolButton;
99 /*************************************
100 ** Class: QtxListFrame
102 *************************************/
104 class QtxListFrame : public QFrame
111 QtxListFrame( QWidget* parent, WFlags f = 0 );
112 virtual ~QtxListFrame();
115 const QStringList names() const;
116 void addNames( const QStringList& );
118 void setSingleComment( const QString& );
119 void setMultipleComment( const QString& );
121 int selected() const;
122 void setSelected( const int );
124 void setMaxLines( int );
125 void setMaxLineChars( int );
127 virtual bool event( QEvent* );
128 virtual bool eventFilter( QObject*, QEvent* );
130 void setOwner( QWidget* );
132 void updateComment();
136 void selected( int );
146 void onScroll( int, int );
149 void setNames( const QStringList& );
150 bool handleKeyEvent( QObject*, QKeyEvent* );
151 bool handleMouseEvent( QObject*, QMouseEvent* );
153 friend class QtxListAction;
161 QString mySingleComment;
162 QString myMultipleComment;
172 #pragma warning( default:4251 )