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

kdeui

  • kdeui
klineedit.h
1 /* This file is part of the KDE libraries
2 
3  This class was originally inspired by Torben Weis'
4  fileentry.cpp for KFM II.
5 
6  Copyright (C) 1997 Sven Radej <sven.radej@iname.com>
7  Copyright (c) 1999 Patrick Ward <PAT_WARD@HP-USA-om5.om.hp.com>
8  Copyright (c) 1999 Preston Brown <pbrown@kde.org>
9 
10  Completely re-designed:
11  Copyright (c) 2000,2001 Dawit Alemayehu <adawit@kde.org>
12 
13  This library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU Lesser General Public
15  License (LGPL) as published by the Free Software Foundation;
16  either version 2 of the License, or (at your option) any later
17  version.
18 
19  This library is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  Lesser General Public License for more details.
23 
24  You should have received a copy of the GNU Lesser General Public License
25  along with this library; see the file COPYING.LIB. If not, write to
26  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27  Boston, MA 02110-1301, USA.
28 */
29 
30 #ifndef _KLINEEDIT_H
31 #define _KLINEEDIT_H
32 
33 #include <tqlineedit.h>
34 #include <kcompletion.h>
35 
36 class TQPopupMenu;
37 
38 class KCompletionBox;
39 class KURL;
40 
145 class KDEUI_EXPORT KLineEdit : public TQLineEdit, public KCompletionBase
146 {
147  friend class KComboBox;
148 
149  Q_OBJECT
150  Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled )
151  Q_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled )
152  Q_PROPERTY( bool trapEnterKeyEvent READ trapReturnKey WRITE setTrapReturnKey )
153  Q_PROPERTY( bool enableSqueezedText READ isSqueezedTextEnabled WRITE setEnableSqueezedText )
154  // @since 3.5.4
155  Q_PROPERTY( TQString clickMessage READ clickMessage WRITE setClickMessage )
156 
157 public:
158 
167  KLineEdit( const TQString &string, TQWidget *parent, const char *name = 0 );
168 
175  KLineEdit ( TQWidget *parent=0, const char *name=0 );
176 
180  virtual ~KLineEdit ();
181 
186  void setURL( const KURL& url );
187 
197  void cursorAtEnd() { end( false ); }
198 
207  virtual void setCompletionMode( KGlobalSettings::Completion mode );
208 
223  virtual void setContextMenuEnabled( bool showMenu ) { m_bEnableMenu = showMenu; }
224 
228  bool isContextMenuEnabled() const { return m_bEnableMenu; }
229 
237  void setURLDropsEnabled( bool enable );
238 
242  bool isURLDropsEnabled() const;
243 
254  void setTrapReturnKey( bool trap );
255 
262  bool trapReturnKey() const;
263 
268  virtual bool eventFilter( TQObject *, TQEvent * );
269 
278  KCompletionBox * completionBox( bool create = true );
279 
283  virtual void setCompletionObject( KCompletion *, bool hsig = true );
284 
288  virtual void copy() const;
289 
301  void setEnableSqueezedText( bool enable );
302 
309  bool isSqueezedTextEnabled() const;
310 
319  TQString originalText() const;
320 
329  void setCompletionBox( KCompletionBox *box );
330 
337  void setClickMessage( const TQString &msg );
338 
343  TQString clickMessage() const;
344 
345 signals:
346 
351  void completionBoxActivated (const TQString &);
352 
360  void returnPressed( const TQString& );
361 
369  void completion( const TQString& );
370 
374  void substringCompletion( const TQString& );
375 
388  void textRotation( KCompletionBase::KeyBindingType );
389 
394  void completionModeChanged( KGlobalSettings::Completion );
395 
408  void aboutToShowContextMenu( TQPopupMenu * p );
409 
410 public slots:
411 
415  virtual void setReadOnly(bool);
416 
427  void rotateText( KCompletionBase::KeyBindingType type );
428 
432  virtual void setCompletedText( const TQString& );
433 
440  void setCompletedItems( const TQStringList& items );
441 
452  void setCompletedItems( const TQStringList& items, bool autoSuggest );
453 
458  virtual void clear();
459 
465  void setSqueezedText( const TQString &text);
466 
470  virtual void setText ( const TQString& );
471 
472 
473 protected slots:
474 
479  virtual void makeCompletion( const TQString& );
480 
484  void slotAboutToShow() {}
485 
489  void slotCancelled() {}
490 
496  void userCancelled(const TQString & cancelText);
497 
498 protected:
499 
505  virtual void resizeEvent( TQResizeEvent * );
506 
512  virtual void keyPressEvent( TQKeyEvent * );
513 
519  virtual void mousePressEvent( TQMouseEvent * );
520 
526  virtual void mouseDoubleClickEvent( TQMouseEvent * );
527 
533  virtual void mouseReleaseEvent( TQMouseEvent * );
534 
540  virtual void contextMenuEvent( TQContextMenuEvent * );
541 
547  virtual TQPopupMenu *createPopupMenu();
548 
554  virtual void drawContents( TQPainter *p );
555 
561  virtual void dropEvent( TQDropEvent * );
562 
563  /*
564  * This function simply sets the lineedit text and
565  * highlights the text appropriately if the boolean
566  * value is set to true.
567  *
568  * @param text
569  * @param marked
570  */
571  virtual void setCompletedText( const TQString& /*text*/, bool /*marked*/ );
572 
573 
578  void setUserSelection( bool userSelection );
579 
583  virtual void create( WId = 0, bool initializeWindow = true,
584  bool destroyOldWindow = true );
585 
591  virtual void focusInEvent( TQFocusEvent* );
592 
598  virtual void focusOutEvent( TQFocusEvent* );
599 
604  bool autoSuggest() const;
605 
606 private slots:
607  void completionMenuActivated( int id );
608  void tripleClickTimeout(); // resets possibleTripleClick
609  void slotRestoreSelectionColors();
610  void setTextWorkaround( const TQString& text );
611 
612 private:
613 
614  // Constants that represent the ID's of the popup menu.
615  enum MenuID
616  {
617  Default = 42,
618  NoCompletion,
619  AutoCompletion,
620  ShellCompletion,
621  PopupCompletion,
622  ShortAutoCompletion,
623  PopupAutoCompletion
624  };
625 
629  void init();
630 
631  bool copySqueezedText( bool clipboard ) const;
632 
637  bool overrideAccel (const TQKeyEvent* e);
638 
643  void setSqueezedText ();
644 
645  bool m_bEnableMenu;
646 
647  bool possibleTripleClick; // set in mousePressEvent, deleted in tripleClickTimeout
648 
649 protected:
650  virtual void virtual_hook( int id, void* data );
651 private:
652  class KLineEditPrivate;
653  KLineEditPrivate *d;
654 };
655 
656 #endif

kdeui

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

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |