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

tdeui

  • tdeui
tdetoolbar.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 Reginald Stadlbauer (reggie@kde.org)
3  (C) 1997, 1998 Stephan Kulow (coolo@kde.org)
4  (C) 1997, 1998 Sven Radej (radej@kde.org)
5  (C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
6  (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
7  (C) 1999, 2000 Kurt Granroth (granroth@kde.org)
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License version 2 as published by the Free Software Foundation.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef TDETOOLBAR_H
25 #define TDETOOLBAR_H
26 
27 #include <tqtoolbar.h>
28 #include <tqmainwindow.h>
29 #include <tqcombobox.h>
30 #include <tqmap.h>
31 #include <tqptrlist.h>
32 #include <tqguardedptr.h>
33 #include <tqframe.h>
34 #include <tqiconset.h>
35 
36 #include <tdeglobal.h>
37 
38 class TQDomElement;
39 class TQSize;
40 class TQPixmap;
41 class TQPopupMenu;
42 class TQStringList;
43 class TQDomDocument;
44 class TQTimer;
45 
46 class KLineEdit;
47 class TDEToolBar;
48 class TDEToolBarButton;
49 class TDEToolBoxManager;
50 class KAnimWidget;
51 class TDEPopupMenu;
52 class TDEInstance;
53 class KComboBox;
54 class KXMLGUIClient;
55 
56 class TDEToolBarPrivate;
57 
58 class TDEUI_EXPORT TDEToolBarSeparator : public TQFrame
59 {
60  Q_OBJECT
61 
62 public:
63  TDEToolBarSeparator( Orientation, bool l, TQToolBar *parent, const char* name=0 );
64 
65  TQSize sizeHint() const;
66  Orientation orientation() const { return orient; }
67  TQSizePolicy sizePolicy() const;
68  bool showLine() const { return line; }
69 public slots:
70  void setOrientation( Orientation );
71 protected:
72  void styleChange( TQStyle& );
73  void drawContents( TQPainter* );
74 private:
75  Orientation orient;
76  bool line;
77 };
78 
79 
104 class TDEUI_EXPORT TDEToolBar : public TQToolBar
105 {
106  Q_OBJECT
107 
108  TQ_ENUMS( IconText BarPosition )
109  TQ_PROPERTY( IconText iconText READ iconText WRITE setIconText )
110  TQ_PROPERTY( BarPosition barPos READ barPos WRITE setBarPos )
111  TQ_PROPERTY( bool fullSize READ fullSize WRITE setFullSize )
112  TQ_PROPERTY( int iconSize READ iconSize WRITE setIconSize )
113  TQ_PROPERTY( TQString text READ text WRITE setText )
114 
115 public:
116  enum IconText{IconOnly = 0, IconTextRight, TextOnly, IconTextBottom};
121  enum BarStatus{Toggle, Show, Hide};
125  enum BarPosition{ Unmanaged, Floating, Top, Bottom, Right, Left, Flat};
126 
144  TDEToolBar( TQWidget *parent, const char *name = 0, bool honorStyle = false, bool readConfig = true );
145 
161  TDEToolBar( TQMainWindow *parentWindow, TQMainWindow::ToolBarDock dock /*= TQMainWindow::Top*/, bool newLine = false,
162  const char *name = 0, bool honorStyle = false, bool readConfig = true );
163 
179  TDEToolBar( TQMainWindow *parentWindow, TQWidget *dock, bool newLine = false,
180  const char *name = 0, bool honorStyle = false, bool readConfig = true );
181 
185  virtual ~TDEToolBar();
186 
208  int insertButton(const TQString& icon, int id, bool enabled = true,
209  const TQString& text = TQString::null, int index=-1,
210  TDEInstance *_instance = TDEGlobal::instance());
211 
230  int insertButton(const TQString& icon, int id, const char *signal,
231  const TQObject *receiver, const char *slot,
232  bool enabled = true, const TQString& text = TQString::null,
233  int index=-1, TDEInstance *_instance = TDEGlobal::instance() );
234 
259  int insertButton(const TQPixmap& pixmap, int id, bool enabled = true,
260  const TQString& text = TQString::null, int index=-1 );
261 
279  int insertButton(const TQPixmap& pixmap, int id, const char *signal,
280  const TQObject *receiver, const char *slot,
281  bool enabled = true, const TQString& text = TQString::null,
282  int index=-1 );
283 
296  int insertButton(const TQString& icon, int id, TQPopupMenu *popup,
297  bool enabled, const TQString&_text, int index=-1);
298 
311  int insertButton(const TQPixmap& pixmap, int id, TQPopupMenu *popup,
312  bool enabled, const TQString&_text, int index=-1);
313 
326  int insertLined (const TQString& text, int id,
327  const char *signal,
328  const TQObject *receiver, const char *slot,
329  bool enabled = true,
330  const TQString& toolTipText = TQString::null,
331  int size = 70, int index =-1);
332 
347  int insertCombo (const TQStringList &list, int id, bool writable,
348  const char *signal, const TQObject *receiver,
349  const char *slot, bool enabled=true,
350  const TQString& tooltiptext=TQString::null,
351  int size=70, int index=-1,
352  TQComboBox::Policy policy = TQComboBox::AtBottom);
353 
363  int insertCombo (const TQString& text, int id, bool writable,
364  const char *signal, TQObject *receiver,
365  const char *slot, bool enabled=true,
366  const TQString& tooltiptext=TQString::null,
367  int size=70, int index=-1,
368  TQComboBox::Policy policy = TQComboBox::AtBottom);
369 
374  int insertSeparator( int index = -1, int id = -1 );
375 
380  int insertLineSeparator( int index = -1, int id = -1 );
381 
392  int insertWidget(int id, int width, TQWidget *_widget, int index=-1);
393 
410  int insertAnimatedWidget(int id, TQObject *receiver, const char *slot,
411  const TQString& icons, int index = -1);
412 
421  KAnimWidget *animatedWidget( int id );
422 
429  void addConnection (int id, const char *signal,
430  const TQObject *receiver, const char *slot);
434  void setItemEnabled( int id, bool enabled );
435 
441  void setButtonIcon( int id, const TQString& _icon );
442 
448  void setButtonPixmap( int id, const TQPixmap& _pixmap );
449 
455  void setButtonIconSet( int id, const TQIconSet& iconset );
456 
483  void setDelayedPopup (int id , TQPopupMenu *_popup, bool toggle = false);
484 
498  void setAutoRepeat (int id, bool flag=true);
499 
500 
504  void setToggle (int id, bool flag = true);
505 
515  void toggleButton (int id);
516 
526  void setButton (int id, bool flag);
527 
533  bool isButtonOn (int id) const;
534 
540  void setLinedText (int id, const TQString& text);
541 
546  TQString getLinedText (int id) const;
547 
551  void insertComboItem (int id, const TQString& text, int index);
552 
556  void insertComboList (int id, const TQStringList &list, int index);
557 
561  void removeComboItem (int id, int index);
562 
566  void setCurrentComboItem (int id, int index);
567 
573  void changeComboItem (int id, const TQString& text, int index=-1);
574 
580  void clearCombo (int id);
581 
589  TQString getComboItem (int id, int index=-1) const;
590 
602  KComboBox * getCombo(int id);
603 
616  KLineEdit * getLined (int id);
617 
630  TDEToolBarButton * getButton (int id);
631 
638  void alignItemRight (int id, bool right = true);
639 
651  TQWidget *getWidget (int id); // ### KDE4: make this const!
652 
666  void setItemAutoSized (int id, bool yes = true);
667 
673  void clear ();
674 
680  void removeItem (int id);
681 
687  void removeItemDelayed (int id);
688 
692  void hideItem (int id);
693 
697  void showItem (int id);
698 
704  int itemIndex (int id); // ### KDE4: make this const!
705 
710  int idAt(int index); // ### KDE4: make this const!
711 
724  void setFullSize(bool flag = true);
725 
730  bool fullSize() const;
731 
736  void enableMoving(bool flag = true) KDE_DEPRECATED;
737 
742  void setBarPos (BarPosition bpos);
743 
748  BarPosition barPos() const;
749 
758  bool enable(BarStatus stat) KDE_DEPRECATED;
759 
764  void setMaxHeight (int h) KDE_DEPRECATED; // Set max height for vertical toolbars
765 
772  int maxHeight() KDE_DEPRECATED;
773 
779  void setMaxWidth (int dw) KDE_DEPRECATED;
780 
787  int maxWidth() KDE_DEPRECATED;
788 
795  void setTitle (const TQString& _title);
796 
801  void enableFloating (bool flag) KDE_DEPRECATED;
802 
814  void setIconText(IconText it);
815  // Note: don't merge with the next one, it breaks Qt properties
816 
823  void setIconText(IconText it, bool update);
824 
829  IconText iconText() const;
830 
841  void setIconSize(int size);
842  // Note: don't merge with the next one, it breaks Qt properties
843 
852  void setIconSize(int size, bool update);
853 
858  int iconSize() const;
859 
864  int iconSizeDefault() const;
865 
871  void setEnableContextMenu(bool enable = true);
872 
877  bool contextMenuEnabled() const;
878 
887  void setItemNoStyle(int id, bool no_style = true);
888 
889  void setFlat (bool flag);
890 
895  int count() const;
896 
902  void saveState(); // BIC: remove for KDE4? This doesn't appear to be used internally,
903  // and apps use saveMainWindowSettings in TDEMainWindow anyway.
904 
908  void saveSettings(TDEConfig *config, const TQString &configGroup);
909 
914  void applySettings(TDEConfig *config, const TQString &configGroup,bool force);
915  // KDE4 merge with force=false
916  void applySettings(TDEConfig *config, const TQString &configGroup);
917 
918  /*
919  * Tell the toolbar what XML-GUI resource file it should use to save
920  * it's state. The state of the toolbar (position, size, etc) is
921  * saved in TDEConfig files if the application does not use XML-GUI
922  * but if the app does, then it's saved the XML file. This function
923  * allows this to happen.
924  *
925  * @param xmlfile The XML-GUI resource file to write to
926  * @param xml The DOM document for the XML-GUI building
927  * @internal
928  */
929  // void setXML(const TQString& xmlfile, const TQDomDocument& xml);
930 
931  void setXMLGUIClient( KXMLGUIClient *client );
932 
937  void setText( const TQString & txt );
938 
943  TQString text() const;
944 
945  void setStretchableWidget( TQWidget *w );
946  TQSizePolicy sizePolicy() const;
947  bool highlight() const;
948  TQSize sizeHint() const;
949  TQSize minimumSizeHint() const;
950  TQSize minimumSize() const;
951 
952  void hide();
953  void show();
954 
955  void updateRects( bool = false ) {}
956 
960  void loadState( const TQDomElement &e );
961  /*
962  * Save state into an XML element, called by KXMLGUIBuilder
963  */
964  void saveState( TQDomElement &e );
965 
969  void positionYourself( bool force = false);
970 
971 signals:
975  void clicked(int id);
976 
990  void doubleClicked (int id);
991 
995  void pressed(int);
996 
1000  void released(int);
1001 
1011  void toggled(int);
1012 
1023  void highlighted(int id, bool isHighlighted);
1024 
1033  void highlighted(int id );
1034 
1044  void moved( BarPosition );
1045 
1053  void modechange ();
1054 
1062  void toolbarDestroyed();
1063 
1064 public:
1069  static bool highlightSetting();
1070 
1075  static bool transparentSetting();
1076 
1081  static IconText iconTextSetting();
1082 
1083 public slots:
1084  virtual void setIconText( const TQString &txt )
1085  { TQToolBar::setIconText( txt ); }
1086 
1087 protected:
1088  void mousePressEvent( TQMouseEvent * );
1089  void childEvent( TQChildEvent *e );
1090  void showEvent( TQShowEvent *e );
1091  void resizeEvent( TQResizeEvent *e );
1092  bool event( TQEvent *e );
1093  void applyAppearanceSettings(TDEConfig *config, const TQString &_configGroup, bool forceGlobal = false);
1094  TQString settingsGroup() const;
1095 
1096 private slots:
1097  void rebuildLayout();
1098  void slotReadConfig ();
1099  void slotAppearanceChanged();
1100  void slotIconChanged(int);
1101  void slotRepaint();
1102  void toolBarPosChanged( TQToolBar *tb );
1103  void slotContextAboutToShow();
1104  void slotContextAboutToHide();
1105  void widgetDestroyed();
1106 
1107 private:
1108  void init( bool readConfig = true, bool honorStyle = false );
1109  void doConnections( TDEToolBarButton *button );
1110  void insertWidgetInternal( TQWidget *w, int &index, int id );
1111  void removeWidgetInternal( TQWidget *w );
1112  void getAttributes( TQString &position, TQString &icontext, int &index );
1113  int dockWindowIndex();
1114  TDEPopupMenu *contextMenu();
1115  void doModeChange();
1116 
1117  TQMap<TQWidget*, int > widget2id;
1118  typedef TQMap<int, TQWidget* > Id2WidgetMap;
1119  Id2WidgetMap id2widget;
1120  TDEPopupMenu *context;
1121  TQPtrList<TQWidget> widgets;
1122  TQTimer *layoutTimer;
1123  TQGuardedPtr<TQWidget> stretchableWidget, rightAligned;
1124 protected:
1125  virtual void virtual_hook( int id, void* data );
1126 private:
1127  TDEToolBarPrivate *d;
1128 };
1129 
1130 #endif
TDEConfig
KNotifyClient::event
int event(const TQString &message, const TQString &text=TQString::null) KDE_DEPRECATED
KAnimWidget
Standard "About KDE" dialog box.
Definition: kanimwidget.h:55
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:43
Bottom
Right
TDEToolBarButton
A toolbar button.
Definition: tdetoolbarbutton.h:44
TDEToolBar::BarPosition
BarPosition
Possible bar positions.
Definition: tdetoolbar.h:125
TDEToolBar
Floatable toolbar with auto resize.
Definition: tdetoolbar.h:104
TDEGlobal::instance
static TDEInstance * instance()
Left
KLineEdit
An enhanced TQLineEdit widget for inputting text.
Definition: klineedit.h:145
KComboBox
An enhanced combo box.
Definition: kcombobox.h:151
TDEPopupMenu
A menu with title items.
Definition: tdepopupmenu.h:123
Top
TDEInstance
TDEToolBar::BarStatus
BarStatus
The state of the status bar.
Definition: tdetoolbar.h:121

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.