• 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
38class TQDomElement;
39class TQSize;
40class TQPixmap;
41class TQPopupMenu;
42class TQStringList;
43class TQDomDocument;
44class TQTimer;
45
46class KLineEdit;
47class TDEToolBar;
48class TDEToolBarButton;
49class TDEToolBoxManager;
50class KAnimWidget;
51class TDEPopupMenu;
52class TDEInstance;
53class KComboBox;
54class KXMLGUIClient;
55
56class TDEToolBarPrivate;
57
58class TDEUI_EXPORT TDEToolBarSeparator : public TQFrame
59{
60 TQ_OBJECT
61
62public:
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; }
69public slots:
70 void setOrientation( Orientation );
71protected:
72 void styleChange( TQStyle& );
73 void drawContents( TQPainter* );
74private:
75 Orientation orient;
76 bool line;
77};
78
79
104class TDEUI_EXPORT TDEToolBar : public TQToolBar
105{
106 TQ_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
115public:
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) TDE_DEPRECATED;
737
742 void setBarPos (BarPosition bpos);
743
748 BarPosition barPos() const;
749
758 bool enable(BarStatus stat) TDE_DEPRECATED;
759
764 void setMaxHeight (int h) TDE_DEPRECATED; // Set max height for vertical toolbars
765
772 int maxHeight() TDE_DEPRECATED;
773
779 void setMaxWidth (int dw) TDE_DEPRECATED;
780
787 int maxWidth() TDE_DEPRECATED;
788
795 void setTitle (const TQString& _title);
796
801 void enableFloating (bool flag) TDE_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
971signals:
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
1064public:
1069 static bool highlightSetting();
1070
1075 static bool transparentSetting();
1076
1081 static IconText iconTextSetting();
1082
1083public slots:
1084 virtual void setIconText( const TQString &txt )
1085 { TQToolBar::setIconText( txt ); }
1086
1087protected:
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
1096private 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
1107private:
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;
1124protected:
1125 virtual void virtual_hook( int id, void* data );
1126private:
1127 TDEToolBarPrivate *d;
1128};
1129
1130#endif
KAnimWidget
Standard "About KDE" dialog box.
Definition: kanimwidget.h:56
KComboBox
An enhanced combo box.
Definition: kcombobox.h:152
KLineEdit
An enhanced TQLineEdit widget for inputting text.
Definition: klineedit.h:146
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document,...
Definition: kxmlguiclient.h:44
TDEConfig
TDEGlobal::instance
static TDEInstance * instance()
TDEInstance
TDEPopupMenu
A menu with title items.
Definition: tdepopupmenu.h:123
TDEToolBarButton
A toolbar button.
Definition: tdetoolbarbutton.h:45
TDEToolBar
Floatable toolbar with auto resize.
Definition: tdetoolbar.h:105
TDEToolBar::toolbarDestroyed
void toolbarDestroyed()
This signal is emitted when the toolbar is getting deleted, and before ~TDEToolbar finishes (so it's ...
TDEToolBar::pressed
void pressed(int)
Emitted when button id is pressed.
TDEToolBar::toggled
void toggled(int)
Emitted when a toggle button changes state.
TDEToolBar::released
void released(int)
Emits when button id is released.
TDEToolBar::BarPosition
BarPosition
Possible bar positions.
Definition: tdetoolbar.h:125
TDEToolBar::modechange
void modechange()
This signal is emitted when toolbar detects changing of following parameters: highlighting,...
TDEToolBar::highlighted
void highlighted(int id)
This signal is emitted when item id gets highlighted/unhighlighted (i.e when mouse enters/exits).
TDEToolBar::doubleClicked
void doubleClicked(int id)
Emitted when button id is double-clicked.
TDEToolBar::BarStatus
BarStatus
The state of the status bar.
Definition: tdetoolbar.h:121
TDEToolBar::highlighted
void highlighted(int id, bool isHighlighted)
This signal is emitted when item id gets highlighted/unhighlighted (i.e when mouse enters/exits).
TDEToolBar::moved
void moved(BarPosition)
Emitted when toolbar changes position, or when an item is removed from toolbar.
TDEToolBar::clicked
void clicked(int id)
Emitted when button id is clicked.

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