• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

klineedit.h

00001 /*  This file is part of the KDE libraries
00002 
00003     This class was originally inspired by Torben Weis'
00004     fileentry.cpp for KFM II.
00005 
00006     Copyright (C) 1997 Sven Radej <sven.radej@iname.com>
00007     Copyright (c) 1999 Patrick Ward <PAT_WARD@HP-USA-om5.om.hp.com>
00008     Copyright (c) 1999 Preston Brown <pbrown@kde.org>
00009 
00010     Completely re-designed:
00011     Copyright (c) 2000,2001 Dawit Alemayehu <adawit@kde.org>
00012 
00013     This library is free software; you can redistribute it and/or
00014     modify it under the terms of the GNU Lesser General Public
00015     License (LGPL) as published by the Free Software Foundation;
00016     either version 2 of the License, or (at your option) any later
00017     version.
00018 
00019     This library is distributed in the hope that it will be useful,
00020     but WITHOUT ANY WARRANTY; without even the implied warranty of
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022     Lesser General Public License for more details.
00023 
00024     You should have received a copy of the GNU Lesser General Public License
00025     along with this library; see the file COPYING.LIB.  If not, write to
00026     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00027     Boston, MA 02110-1301, USA.
00028 */
00029 
00030 #ifndef _KLINEEDIT_H
00031 #define _KLINEEDIT_H
00032 
00033 #include <tqlineedit.h>
00034 #include <kcompletion.h>
00035 
00036 class TQPopupMenu;
00037 
00038 class TDECompletionBox;
00039 class KURL;
00040 
00145 class TDEUI_EXPORT KLineEdit : public TQLineEdit, public TDECompletionBase
00146 {
00147     friend class KComboBox;
00148 
00149     Q_OBJECT
00150     TQ_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled )
00151     TQ_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled )
00152     TQ_PROPERTY( bool trapEnterKeyEvent READ trapReturnKey WRITE setTrapReturnKey )
00153     TQ_PROPERTY( bool enableSqueezedText READ isSqueezedTextEnabled WRITE setEnableSqueezedText )
00154     // @since 3.5.4
00155     TQ_PROPERTY( TQString clickMessage READ clickMessage WRITE setClickMessage )
00156 
00157 public:
00158 
00167     KLineEdit( const TQString &string, TQWidget *parent, const char *name = 0 );
00168 
00175     KLineEdit ( TQWidget *parent=0, const char *name=0 );
00176 
00180     virtual ~KLineEdit ();
00181 
00186     void setURL( const KURL& url );
00187 
00197     void cursorAtEnd() { end( false ); }
00198 
00207     virtual void setCompletionMode( TDEGlobalSettings::Completion mode );
00208 
00223     virtual void setContextMenuEnabled( bool showMenu ) {  m_bEnableMenu = showMenu; }
00224 
00228     bool isContextMenuEnabled() const { return m_bEnableMenu; }
00229 
00237     void setURLDropsEnabled( bool enable );
00238 
00242     bool isURLDropsEnabled() const;
00243 
00254     void setTrapReturnKey( bool trap );
00255 
00262     bool trapReturnKey() const;
00263 
00268     virtual bool eventFilter( TQObject *, TQEvent * );
00269 
00278     TDECompletionBox * completionBox( bool create = true );
00279 
00283     virtual void setCompletionObject( TDECompletion *, bool hsig = true );
00284 
00288     virtual void copy() const;
00289 
00301     void setEnableSqueezedText( bool enable );
00302 
00309     bool isSqueezedTextEnabled() const;
00310 
00319     TQString originalText() const;
00320 
00329     void setCompletionBox( TDECompletionBox *box );
00330 
00337     void setClickMessage( const TQString &msg );
00338 
00343     TQString clickMessage() const;
00344 
00345 signals:
00346 
00351     void completionBoxActivated (const TQString &);
00352 
00360     void returnPressed( const TQString& );
00361 
00369     void completion( const TQString& );
00370 
00374     void substringCompletion( const TQString& );
00375 
00388     void textRotation( TDECompletionBase::KeyBindingType );
00389 
00394     void completionModeChanged( TDEGlobalSettings::Completion );
00395 
00408     void aboutToShowContextMenu( TQPopupMenu * p );
00409 
00410 public slots:
00411 
00415     virtual void setReadOnly(bool);
00416 
00427     void rotateText( TDECompletionBase::KeyBindingType type );
00428 
00432     virtual void setCompletedText( const TQString& );
00433 
00440     void setCompletedItems( const TQStringList& items );
00441 
00452     void setCompletedItems( const TQStringList& items, bool autoSuggest );
00453 
00458     virtual void clear();
00459 
00465     void setSqueezedText( const TQString &text);
00466 
00470     virtual void setText ( const TQString& );
00471 
00472 
00473 protected slots:
00474 
00479     virtual void makeCompletion( const TQString& );
00480 
00484     void slotAboutToShow() {}
00485 
00489     void slotCancelled() {}
00490 
00496     void userCancelled(const TQString & cancelText);
00497 
00498 protected:
00499 
00505     virtual void resizeEvent( TQResizeEvent * );
00506 
00512     virtual void keyPressEvent( TQKeyEvent * );
00513 
00519     virtual void mousePressEvent( TQMouseEvent * );
00520 
00526     virtual void mouseDoubleClickEvent( TQMouseEvent * );
00527 
00533     virtual void mouseReleaseEvent( TQMouseEvent * );
00534 
00540     virtual void contextMenuEvent( TQContextMenuEvent * );
00541 
00547     virtual TQPopupMenu *createPopupMenu();
00548 
00554     virtual void drawContents( TQPainter *p );
00555 
00561     virtual void dropEvent( TQDropEvent * );
00562 
00563     /*
00564     * This function simply sets the lineedit text and
00565     * highlights the text appropriately if the boolean
00566     * value is set to true.
00567     *
00568     * @param text
00569     * @param marked
00570     */
00571     virtual void setCompletedText( const TQString& /*text*/, bool /*marked*/ );
00572 
00573 
00578     void setUserSelection( bool userSelection );
00579 
00583     virtual void create( WId = 0, bool initializeWindow = true,
00584                          bool destroyOldWindow = true );
00585 
00591     virtual void focusInEvent( TQFocusEvent* );
00592 
00598     virtual void focusOutEvent( TQFocusEvent* );
00599 
00604     bool autoSuggest() const;
00605 
00606 private slots:
00607     void completionMenuActivated( int id );
00608     void tripleClickTimeout();  // resets possibleTripleClick
00609     void slotRestoreSelectionColors();
00610     void setTextWorkaround( const TQString& text );
00611 
00612 private:
00613 
00614     // Constants that represent the ID's of the popup menu.
00615     enum MenuID
00616     {
00617         Default = 42,
00618         NoCompletion,
00619         AutoCompletion,
00620         ShellCompletion,
00621         PopupCompletion,
00622         ShortAutoCompletion,
00623         PopupAutoCompletion
00624     };
00625 
00629     void init();
00630 
00631     bool copySqueezedText( bool clipboard ) const;
00632 
00637     bool overrideAccel (const TQKeyEvent* e);
00638 
00643     void setSqueezedText ();
00644 
00645     bool m_bEnableMenu;
00646 
00647     bool possibleTripleClick;  // set in mousePressEvent, deleted in tripleClickTimeout
00648 
00649 protected:
00650     virtual void virtual_hook( int id, void* data );
00651 private:
00652     class KLineEditPrivate;
00653     KLineEditPrivate *d;
00654 };
00655 
00656 #endif

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.6.3
This website is maintained by Timothy Pearson.