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

tdeui

  • tdeui
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 TDECompletionBox;
39 class KURL;
40 
145 class TDEUI_EXPORT KLineEdit : public TQLineEdit, public TDECompletionBase
146 {
147  friend class KComboBox;
148 
149  TQ_OBJECT
150  TQ_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled )
151  TQ_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled )
152  TQ_PROPERTY( bool trapEnterKeyEvent READ trapReturnKey WRITE setTrapReturnKey )
153  TQ_PROPERTY( bool enableSqueezedText READ isSqueezedTextEnabled WRITE setEnableSqueezedText )
154  // @since 3.5.4
155  TQ_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( TDEGlobalSettings::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  TDECompletionBox * completionBox( bool create = true );
279 
283  virtual void setCompletionObject( TDECompletion *, 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( TDECompletionBox *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( TDECompletionBase::KeyBindingType );
389 
394  void completionModeChanged( TDEGlobalSettings::Completion );
395 
408  void aboutToShowContextMenu( TQPopupMenu * p );
409 
410 public slots:
411 
415  virtual void setReadOnly(bool);
416 
427  void rotateText( TDECompletionBase::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
KComboBox
An enhanced combo box.
Definition: kcombobox.h:152
KComboBox::isURLDropsEnabled
bool isURLDropsEnabled() const
Returns true when decoded URL drops are enabled.
Definition: kcombobox.cpp:138
KComboBox::setContextMenuEnabled
virtual void setContextMenuEnabled(bool showMenu)
Enables or disable the popup (context) menu.
Definition: kcombobox.cpp:125
KComboBox::trapReturnKey
bool trapReturnKey() const
Definition: kcombobox.cpp:192
KComboBox::isContextMenuEnabled
bool isContextMenuEnabled() const
Returns true when the context menu is enabled.
Definition: kcombobox.h:277
KComboBox::setTrapReturnKey
void setTrapReturnKey(bool trap)
By default, KComboBox recognizes Key_Return and Key_Enter and emits the returnPressed() signals,...
Definition: kcombobox.cpp:184
KComboBox::eventFilter
virtual bool eventFilter(TQObject *, TQEvent *)
Re-implemented for internal reasons.
Definition: kcombobox.cpp:179
KComboBox::completionBox
TDECompletionBox * completionBox(bool create=true)
Definition: kcombobox.cpp:229
KComboBox::create
virtual void create(WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
Reimplemented for internal reasons, the API is not affected.
Definition: kcombobox.cpp:237
KComboBox::setURLDropsEnabled
void setURLDropsEnabled(bool enable)
Enables/Disables handling of URL drops.
Definition: kcombobox.cpp:132
KComboBox::makeCompletion
virtual void makeCompletion(const TQString &)
Completes text according to the completion mode.
Definition: kcombobox.cpp:156
KComboBox::rotateText
void rotateText(TDECompletionBase::KeyBindingType type)
Iterates through all possible matches of the completed text or the history list.
Definition: kcombobox.cpp:172
KLineEdit
An enhanced TQLineEdit widget for inputting text.
Definition: klineedit.h:146
KLineEdit::textRotation
void textRotation(TDECompletionBase::KeyBindingType)
Emitted when the text rotation key-bindings are pressed.
KLineEdit::returnPressed
void returnPressed(const TQString &)
Emitted when the user presses the return key.
KLineEdit::cursorAtEnd
void cursorAtEnd()
Puts the text cursor at the end of the string.
Definition: klineedit.h:197
KLineEdit::substringCompletion
void substringCompletion(const TQString &)
Emitted when the shortcut for substring completion is pressed.
KLineEdit::completionBoxActivated
void completionBoxActivated(const TQString &)
Emitted whenever the completion box is activated.
KLineEdit::slotAboutToShow
void slotAboutToShow()
Definition: klineedit.h:484
KLineEdit::completionModeChanged
void completionModeChanged(TDEGlobalSettings::Completion)
Emitted when the user changed the completion mode by using the popupmenu.
KLineEdit::setContextMenuEnabled
virtual void setContextMenuEnabled(bool showMenu)
Enables/disables the popup (context) menu.
Definition: klineedit.h:223
KLineEdit::completion
void completion(const TQString &)
Emitted when the completion key is pressed.
KLineEdit::aboutToShowContextMenu
void aboutToShowContextMenu(TQPopupMenu *p)
Emitted before the context menu is displayed.
KLineEdit::slotCancelled
void slotCancelled()
Definition: klineedit.h:489
KLineEdit::isContextMenuEnabled
bool isContextMenuEnabled() const
Returns true when the context menu is enabled.
Definition: klineedit.h:228
KURL
TDECompletionBase
TDECompletionBase::setCompletionMode
virtual void setCompletionMode(TDEGlobalSettings::Completion mode)
TDECompletionBase::setCompletedItems
virtual void setCompletedItems(const TQStringList &items)=0
TDECompletionBase::setCompletionObject
virtual void setCompletionObject(TDECompletion *compObj, bool hsig=true)
TDECompletionBase::setCompletedText
virtual void setCompletedText(const TQString &text)=0
TDECompletionBase::KeyBindingType
KeyBindingType
TDECompletionBox
A helper widget for "completion-widgets" (KLineEdit, KComboBox))
Definition: tdecompletionbox.h:44
TDECompletion
TDEGlobalSettings::Completion
Completion

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.9.1
This website is maintained by Timothy Pearson.