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 / k3bcutcombobox.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-27  |  2.3 KB  |  93 lines

  1. /* 
  2.  *
  3.  * $Id: k3bcutcombobox.h 619556 2007-01-03 17:38:12Z trueg $
  4.  * Copyright (C) 2003 Sebastian Trueg <trueg@k3b.org>
  5.  *
  6.  * This file is part of the K3b project.
  7.  * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  * See the file "COPYING" for the exact licensing terms.
  14.  */
  15.  
  16.  
  17. #ifndef _K3B_CUT_COMBOBOX_H_
  18. #define _K3B_CUT_COMBOBOX_H_
  19.  
  20. #include <kcombobox.h>
  21. #include "k3b_export.h"
  22. class QResizeEvent;
  23.  
  24.  
  25. /**
  26.  * Cuts it's text.
  27.  * Since it rebuilds the complete list of strings every time
  28.  * a new string is added or one gets removed it is not a good
  29.  * idea to use this for dynamic lists.
  30.  *
  31.  * Be aware that currently only insertItem works.
  32.  * none of the insertStrList or insertStringList methods are implemeted
  33.  * yet and also the removeItem methos does not work.
  34.  */ 
  35. class LIBK3B_EXPORT K3bCutComboBox : public KComboBox
  36. {
  37.   Q_OBJECT
  38.  
  39.  public:
  40.   K3bCutComboBox( QWidget* parent = 0, const char* name = 0 );
  41.   K3bCutComboBox( int method, QWidget* parent = 0, const char* name = 0 );
  42.   virtual ~K3bCutComboBox();
  43.  
  44.   enum Method {
  45.     CUT,
  46.     SQUEEZE
  47.   };
  48.  
  49.   /**
  50.    * The method to shorten the text
  51.    * defaut: CUT
  52.    */
  53.   void setMethod( int );
  54.  
  55.   /** reimplemeted */
  56.   QSize sizeHint() const;
  57.  
  58.   /** reimplemeted */
  59.   QSize minimumSizeHint() const;
  60.  
  61.   /** reimplemeted */
  62.   virtual void setCurrentText( const QString& );
  63.  
  64.   void    insertStringList( const QStringList &, int index=-1 );
  65.   void    insertStrList( const QStrList &, int index=-1 );
  66.   void    insertStrList( const QStrList *, int index=-1 );
  67.   void    insertStrList( const char **, int numStrings=-1, int index=-1);
  68.  
  69.   void    insertItem( const QString &text, int index=-1 );
  70.   void    insertItem( const QPixmap &pixmap, int index=-1 );
  71.   void    insertItem( const QPixmap &pixmap, const QString &text, int index=-1 );
  72.  
  73.   void    removeItem( int index );
  74.  
  75.   void    changeItem( const QString &text, int index );
  76.   void    changeItem( const QPixmap &pixmap, const QString &text, int index );
  77.  
  78.   QString text( int ) const;
  79.   QString currentText() const;
  80.  
  81.   void clear();
  82.  
  83.  protected:
  84.   void resizeEvent( QResizeEvent* e );
  85.   void cutText();
  86.  
  87.  private:
  88.   class Private;
  89.   Private* d;
  90. };
  91.  
  92. #endif
  93.