home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / kartswidget.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  2.6 KB  |  93 lines

  1.     /*
  2.  
  3.     Copyright (C) 2001 Stefan Westerfeld
  4.                        stefan@space.twc.de
  5.                   2003 Arnold Krille <arnold@arnoldarts.de>
  6.  
  7.     This library is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU Library General Public
  9.     License as published by the Free Software Foundation; either
  10.     version 2 of the License, or (at your option) any later version.
  11.   
  12.     This library is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.     Library General Public License for more details.
  16.    
  17.     You should have received a copy of the GNU Library General Public License
  18.     along with this library; see the file COPYING.LIB.  If not, write to
  19.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.     Boston, MA 02111-1307, USA.
  21.  
  22.     */
  23.  
  24. #ifndef ARTS_GUI_KARTSWIDGET_H
  25. #define ARTS_GUI_KARTSWIDGET_H
  26.  
  27. #include <qwidget.h>
  28. #include "artsgui.h"
  29. #include <kdelibs_export.h>
  30. class KArtsWidgetPrivate;
  31.  
  32. /**
  33.  * KArtsWidget provides a simple way to treat Arts::Widget classes like
  34.  * native Qt widgets. Suppose you use Qt, and want to put an Arts::Widget
  35.  * type into a layout, you can do so using this code
  36.  *
  37.  * <pre>
  38.  *    Arts::Widget widget = ...get widget from somewhere...;
  39.  *    KArtsWidget *w = new KArtsWidget(widget, this);
  40.  *    layout->addWidget(w);
  41.  * </pre>
  42.  *
  43.  * In line 2 of the code, the "this" is the parent widget (which is usually
  44.  * this in Qt code).
  45.  *
  46.  * The KArtsWidget class keeps a reference to the content widget, so the
  47.  * content widget will not be freed until the KArtsWidget gets destroyed.
  48.  */
  49. class KDE_EXPORT KArtsWidget : public QWidget {
  50. private:
  51.     KArtsWidgetPrivate *d;
  52.  
  53. protected:
  54.     Arts::Widget _content;
  55.  
  56. public:
  57.     /**
  58.      * creates a new KArtsWidget
  59.      */
  60.     KArtsWidget( QWidget* parent, const char* name );
  61.  
  62.     /**
  63.      * creates a new KArtsWidget and sets the content to an Arts::Widget
  64.      */
  65.     KArtsWidget( Arts::Widget content, QWidget* parent, const char* name );
  66.     
  67.     /**
  68.      * creates a new KArtsWidget with WidgetFlags and content
  69.      *
  70.      * BCI: should replace the above in the next major release. ( akrille )
  71.      */
  72.     KArtsWidget( Arts::Widget, QWidget* =0, const char* =0, WFlags =0 );
  73.     // same without the content
  74.     KArtsWidget( QWidget* =0, const char* =0, WFlags =0 );
  75.  
  76.     /**
  77.      * destructor
  78.      */
  79.     ~KArtsWidget();
  80.  
  81.     /**
  82.      * sets the content to a new Arts::Widget
  83.      */
  84.     void setContent(Arts::Widget content);
  85.  
  86.     /**
  87.      * gets the content widget
  88.      */
  89.     Arts::Widget content();
  90. };
  91.  
  92. #endif /* ARTS_GUI_KARTSWIDGET_H*/
  93.