33 #include "customactions.h"
35 #include <tdetoolbar.h>
36 #include <tdeapplication.h>
38 #include <tqlineedit.h>
42 LabelAction::LabelAction(
const TQString & text, TDEActionCollection * parent,
44 : TDEAction( text, TQIconSet(), TDEShortcut(), 0, 0, parent, name )
49 int LabelAction::plug( TQWidget * widget,
int index ) {
50 if ( kapp && !kapp->authorizeTDEAction( name() ) )
52 if ( widget->inherits(
"TDEToolBar" ) ) {
53 TDEToolBar * bar = (TDEToolBar *)widget;
54 int id_ = getToolButtonID();
55 TQLabel* label =
new TQLabel( text(), bar,
"tde toolbar widget" );
56 bar->insertWidget( id_, label->width(), label, index );
57 addContainer( bar, id_ );
58 connect( bar, TQ_SIGNAL( destroyed() ),
this, TQ_SLOT( slotDestroyed() ) );
59 return containerCount() - 1;
62 return TDEAction::plug( widget, index );
65 LineEditAction::LineEditAction(
const TQString & text, TDEActionCollection * parent,
66 TQObject * receiver,
const char * member,
const char * name )
67 : TDEAction( text, TQIconSet(), TDEShortcut(), 0, 0, parent, name ),
68 _le(0), _receiver(receiver), _member(member)
73 int LineEditAction::plug( TQWidget * widget,
int index ) {
74 if ( kapp && !kapp->authorizeTDEAction( name() ) )
76 if ( widget->inherits(
"TDEToolBar" ) ) {
77 TDEToolBar *bar = (TDEToolBar *)widget;
78 int id_ = getToolButtonID();
81 _le =
new TQLineEdit( bar );
82 bar->insertWidget( id_, _le->width(), _le, index );
83 bar->setStretchableWidget( _le );
84 addContainer( bar, id_ );
85 connect( bar, TQ_SIGNAL( destroyed() ),
this, TQ_SLOT( slotDestroyed() ) );
86 connect( _le, TQ_SIGNAL( returnPressed() ), _receiver, _member );
87 return containerCount() - 1;
90 return TDEAction::plug( widget, index );
93 void LineEditAction::clear() {
97 void LineEditAction::focusAll() {
102 TQString LineEditAction::text()
const {
106 void LineEditAction::setText(
const TQString & txt ) {
111 ComboAction::ComboAction(
const TQStringList & lst, TDEActionCollection * parent,
112 TQObject * receiver,
const char * member,
const char * name,
114 : TDEAction( TQString(), TQIconSet(), TDEShortcut(), 0, 0, parent, name ),
115 _lst(lst), _receiver(receiver), _member(member), _selectedId( selectedID )
120 int ComboAction::plug( TQWidget * widget,
int index ) {
121 if ( kapp && !kapp->authorizeTDEAction( name() ) )
123 if ( widget->inherits(
"TDEToolBar" ) ) {
124 TDEToolBar *bar = (TDEToolBar *)widget;
125 int id_ = getToolButtonID();
126 bar->insertCombo( _lst, id_,
false, TQ_SIGNAL( highlighted(
int) ), _receiver, _member );
127 bar->setCurrentComboItem( id_,_selectedId );
128 addContainer( bar, id_ );
129 connect( bar, TQ_SIGNAL( destroyed() ),
this, TQ_SLOT( slotDestroyed() ) );
130 return containerCount() - 1;
133 return TDEAction::plug( widget, index );
136 #include "customactions.moc"