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

tdeui

  • tdeui
kjanuswidget.h
1 /* This file is part of the KDE Libraries
2  * Copyright (C) 1999-2000 Espen Sand (espen@kde.org)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef _KJANUS_WIDGET_H_
21 #define _KJANUS_WIDGET_H_
22 
23 #include <tqptrlist.h>
24 #include <tqpixmap.h>
25 #include <tqsplitter.h>
26 
27 #include <tdelistbox.h>
28 #include <tqstringlist.h>
29 #include <tqmap.h>
30 
31 class TDEListView;
32 
33 class TQGrid;
34 class TQHBox;
35 class TQLabel;
36 class TQTabWidget;
37 class TQVBox;
38 class TQWidgetStack;
39 class KSeparator;
40 class TQListViewItem;
41 class KGuiItem;
42 
67 class TDEUI_EXPORT KJanusWidget : public TQWidget
68 {
69  TQ_OBJECT
70 
71  private:
72  class IconListBox : public TDEListBox
73  {
74  friend class KJanusWidget;
75 
76  public:
77  IconListBox( TQWidget *parent=0, const char *name=0, WFlags f=0 );
78  void updateMinimumHeight();
79  void updateWidth();
80  void invalidateHeight();
81  void invalidateWidth();
82  void setShowAll( bool showAll );
83 
84  protected:
85  void slotOnItem( TQListBoxItem *item );
86  virtual void leaveEvent( TQEvent * );
87 
88  private:
89  bool mShowAll;
90  bool mHeightValid;
91  bool mWidthValid;
92  TQListBoxItem *mOldItem;
93  };
94 
95  public:
96  enum Face
97  {
104  TreeList = 0,
111  Tabbed,
117  Plain,
125  Swallow,
133  IconList
134  };
135 
136  public:
137 
146  KJanusWidget( TQWidget *parent=0, const char *name=0, int face=Plain );
147 
151  ~KJanusWidget();
152 
158  virtual bool showPage( int index );
159 
166  virtual int activePageIndex() const;
167 
174  virtual bool isValid() const;
175 
181  virtual int face() const;
182 
189  virtual TQSize minimumSizeHint() const;
190 
197  virtual TQSize sizeHint() const;
198 
204  virtual TQFrame *plainPage();
205 
225  virtual TQFrame *addPage(const TQString &item,const TQString &header=TQString::null,
226  const TQPixmap &pixmap=TQPixmap() );
227 
242  virtual TQFrame *addPage(const TQStringList &items, const TQString &header=TQString::null,
243  const TQPixmap &pixmap=TQPixmap() );
244 
264  virtual TQVBox *addVBoxPage( const TQString &item,
265  const TQString &header=TQString::null,
266  const TQPixmap &pixmap=TQPixmap() );
267 
280  virtual TQVBox *addVBoxPage( const TQStringList &items,
281  const TQString &header=TQString::null,
282  const TQPixmap &pixmap=TQPixmap() );
283 
304  virtual TQHBox *addHBoxPage( const TQString &itemName,
305  const TQString &header=TQString::null,
306  const TQPixmap &pixmap=TQPixmap() );
307 
320  virtual TQHBox *addHBoxPage( const TQStringList &items,
321  const TQString &header=TQString::null,
322  const TQPixmap &pixmap=TQPixmap() );
323 
347  virtual TQGrid *addGridPage( int n, Orientation dir,
348  const TQString &itemName,
349  const TQString &header=TQString::null,
350  const TQPixmap &pixmap=TQPixmap() );
351 
364  virtual TQGrid *addGridPage( int n, Orientation dir,
365  const TQStringList &items,
366  const TQString &header=TQString::null,
367  const TQPixmap &pixmap=TQPixmap() );
368 
378  void removePage( TQWidget *page );
379 
380 
397  virtual int pageIndex( TQWidget *widget ) const;
398 
408  virtual bool setSwallowedWidget( TQWidget *widget );
409 
420  virtual void setTreeListAutoResize( bool state );
421 
434  virtual void setShowIconsInTreeList(bool state);
435 
444  virtual void setRootIsDecorated( bool state );
445 
459  /*virtual*/ void unfoldTreeList( bool persist = false ); //### KDE4 BIC add virtual
460 
469  /*virtual*/ void addWidgetBelowList( TQWidget * widget ); // ### KDE4
470 
481  /*virtual*/ void addButtonBelowList( const TQString & text, TQObject * recv,
482  const char * slot ); //### KDE4
483 
495  /*virtual*/ void addButtonBelowList( const KGuiItem & guiitem, TQObject *
496  recv, const char * slot ); //### KDE4
497 
510  virtual void setIconListAllVisible( bool state );
511 
517  virtual void setFolderIcon(const TQStringList &path, const TQPixmap &pixmap);
524  /*virtual*/ TQString pageTitle(int index) const;
532  /*virtual*/ TQWidget *pageWidget(int index) const;
533 
534  signals:
540  void aboutToShowPage(TQWidget *page);
541 
542  public slots:
546  virtual void setFocus();
547 
548  protected:
553  virtual void showEvent( TQShowEvent * );
554 
563  virtual bool eventFilter( TQObject *o, TQEvent *e );
564 
565  private slots:
566  bool slotShowPage();
567  void slotFontChanged();
568 
569  void slotOnItem(TQListBoxItem *item);
570  void slotItemClicked(TQListViewItem *it);
571  void pageGone(TQObject *obj); // signal from the added page's "destroyed" signal
572  void slotReopen(TQListViewItem *item);
573 
574  protected:
575  bool showPage( TQWidget *w );
576  void addPageWidget( TQFrame *page, const TQStringList &items,
577  const TQString &header, const TQPixmap &pixmap );
578  void InsertTreeListItem(const TQStringList &items, const TQPixmap &pixmap, TQFrame *page);
579  TQWidget *FindParent();
580 
581  private:
582  bool mValid;
583 
584  // Obsolete members. Remove in KDE 4.
585  TQPtrList<TQWidget> *mPageList;
586  TQStringList *mTitleList;
587 
588  int mFace;
589  TDEListView *mTreeList;
590  IconListBox *mIconList;
591  TQWidgetStack *mPageStack;
592  TQLabel *mTitleLabel;
593  TQTabWidget *mTabControl;
594  TQFrame *mPlainPage;
595  TQWidget *mSwallowPage;
596  TQWidget *mActivePageWidget;
597  KSeparator *mTitleSep;
598  TQSplitter::ResizeMode mTreeListResizeMode;
599  bool mShowIconsInTreeList;
600  TQMap<TQListViewItem *, TQWidget *> mTreeListToPageStack;
601  TQMap<TQListBoxItem *, TQWidget *> mIconListToPageStack;
602  TQMap<TQString, TQPixmap> mFolderIconMap;
603  TQMap<TQString, TQStringList> mChildrenNames;
604  TQMap<TQString, TQWidget *> mChildPages;
605 
606  public:
607  class IconListItem;
608  protected:
609  virtual void virtual_hook( int id, void* data );
610  private:
611  class KJanusWidgetPrivate;
612  KJanusWidgetPrivate *d;
613 };
614 
615 #endif
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:39
KJanusWidget
Easy to use widget with many layouts.
Definition: kjanuswidget.h:68
KJanusWidget::pageWidget
TQWidget * pageWidget(int index) const
Returns the page widget associated with a page index or null if there is no such page.
Definition: kjanuswidget.cpp:1247
KJanusWidget::setShowIconsInTreeList
virtual void setShowIconsInTreeList(bool state)
This function has only effect in TreeList mode.
Definition: kjanuswidget.cpp:842
KJanusWidget::pageIndex
virtual int pageIndex(TQWidget *widget) const
Returns the index of a page created with addPage , addVBoxPage , addHBoxPage or addGridPage .
Definition: kjanuswidget.cpp:670
KJanusWidget::isValid
virtual bool isValid() const
Use this to verify that no memory allocation failed.
Definition: kjanuswidget.cpp:213
KJanusWidget::removePage
void removePage(TQWidget *page)
Removes a page created with addPage, addVBoxPage, addHBoxPage or addGridPage.
Definition: kjanuswidget.cpp:1192
KJanusWidget::unfoldTreeList
void unfoldTreeList(bool persist=false)
This function has only effect in TreeList mode.
Definition: kjanuswidget.cpp:854
KJanusWidget::~KJanusWidget
~KJanusWidget()
Destructor.
Definition: kjanuswidget.cpp:207
KJanusWidget::showEvent
virtual void showEvent(TQShowEvent *)
Reimplemented to handle the splitter width when the the face is TreeList.
Definition: kjanuswidget.cpp:894
KJanusWidget::minimumSizeHint
virtual TQSize minimumSizeHint() const
Returns the minimum size that must be made available for the widget so that UIs can be displayed prop...
Definition: kjanuswidget.cpp:761
KJanusWidget::setIconListAllVisible
virtual void setIconListAllVisible(bool state)
This function has only effect in IconList mode.
Definition: kjanuswidget.cpp:834
KJanusWidget::addHBoxPage
virtual TQHBox * addHBoxPage(const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a new page when the class is used in TreeList, IconList or Tabbed mode.
Definition: kjanuswidget.cpp:318
KJanusWidget::setSwallowedWidget
virtual bool setSwallowedWidget(TQWidget *widget)
Defines the widget to be swallowed.
Definition: kjanuswidget.cpp:501
KJanusWidget::setRootIsDecorated
virtual void setRootIsDecorated(bool state)
This function has only effect in TreeList mode.
Definition: kjanuswidget.cpp:847
KJanusWidget::activePageIndex
virtual int activePageIndex() const
Returns the index of the page that are currently displayed.
Definition: kjanuswidget.cpp:646
KJanusWidget::setFolderIcon
virtual void setFolderIcon(const TQStringList &path, const TQPixmap &pixmap)
Sets the icon used in TreeList Mode for the given path.
Definition: kjanuswidget.cpp:493
KJanusWidget::addGridPage
virtual TQGrid * addGridPage(int n, Orientation dir, const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a new page when the class is used in either TreeList or Tabbed mode.
Definition: kjanuswidget.cpp:346
KJanusWidget::plainPage
virtual TQFrame * plainPage()
Returns the empty widget that is available in Plain mode.
Definition: kjanuswidget.cpp:219
KJanusWidget::setTreeListAutoResize
virtual void setTreeListAutoResize(bool state)
This function has only effect in TreeList mode.
Definition: kjanuswidget.cpp:822
KJanusWidget::setFocus
virtual void setFocus()
Give the keyboard input focus to the widget.
Definition: kjanuswidget.cpp:735
KJanusWidget::aboutToShowPage
void aboutToShowPage(TQWidget *page)
This signal is emitted whenever the current page changes.
KJanusWidget::sizeHint
virtual TQSize sizeHint() const
Returns the recommended size for the widget in order to be displayed properly.
Definition: kjanuswidget.cpp:816
KJanusWidget::addVBoxPage
virtual TQVBox * addVBoxPage(const TQString &item, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a new page when the class is used in TreeList, IconList or Tabbed mode.
Definition: kjanuswidget.cpp:293
KJanusWidget::addButtonBelowList
void addButtonBelowList(const TQString &text, TQObject *recv, const char *slot)
Add a button at the bottom of the TreeList/IconList.
Definition: kjanuswidget.cpp:876
KJanusWidget::Face
Face
Definition: kjanuswidget.h:97
KJanusWidget::Swallow
@ Swallow
The Swallow face is provided in order to simplify the usage of existing widgets and to allow changing...
Definition: kjanuswidget.h:125
KJanusWidget::Plain
@ Plain
The Plain face provides an empty widget (TQFrame) where you can place your widgets.
Definition: kjanuswidget.h:117
KJanusWidget::IconList
@ IconList
The IconList face provides an icon list in the left area and pages in the right.
Definition: kjanuswidget.h:133
KJanusWidget::Tabbed
@ Tabbed
The Tabbed face is a common tabbed widget.
Definition: kjanuswidget.h:111
KJanusWidget::TreeList
@ TreeList
The TreeList face provides a list in the left area and pages in the right.
Definition: kjanuswidget.h:104
KJanusWidget::showPage
virtual bool showPage(int index)
Raises the page which was added by addPage().
Definition: kjanuswidget.cpp:580
KJanusWidget::eventFilter
virtual bool eventFilter(TQObject *o, TQEvent *e)
This function is used internally when in IconList mode.
Definition: kjanuswidget.cpp:909
KJanusWidget::addWidgetBelowList
void addWidgetBelowList(TQWidget *widget)
Add a widget at the bottom of the TreeList/IconList.
Definition: kjanuswidget.cpp:868
KJanusWidget::face
virtual int face() const
Returns the face type.
Definition: kjanuswidget.cpp:225
KJanusWidget::KJanusWidget
KJanusWidget(TQWidget *parent=0, const char *name=0, int face=Plain)
Constructor where you specify the face.
Definition: kjanuswidget.cpp:90
KJanusWidget::addPage
virtual TQFrame * addPage(const TQString &item, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a new page when the class is used in TreeList, IconList or Tabbed mode.
Definition: kjanuswidget.cpp:266
KJanusWidget::pageTitle
TQString pageTitle(int index) const
Returns the title string associated with a page index in TreeList or IconList mode.
Definition: kjanuswidget.cpp:1238
KSeparator
Standard horizontal or vertical separator.
Definition: kseparator.h:34
TDEListBox
A variant of TQListBox that honors KDE's system-wide settings.
Definition: tdelistbox.h:41
TDEListView
This Widget extends the functionality of TQListView to honor the system wide settings for Single Clic...
Definition: tdelistview.h:85

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.