itom 2.2.1
K:/git-itom/sources/itom/itomWidgets/menuComboBox_p.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2016, Institut fuer Technische Optik (ITO),
00005     Universitaet Stuttgart, Germany
00006 
00007     This file is part of itom and its software development toolkit (SDK).
00008 
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013    
00014     In addition, as a special exception, the Institut fuer Technische
00015     Optik (ITO) gives you certain additional rights.
00016     These rights are described in the ITO LGPL Exception version 1.0,
00017     which can be found in the file LGPL_EXCEPTION.txt in this package.
00018 
00019     itom is distributed in the hope that it will be useful, but
00020     WITHOUT ANY WARRANTY; without even the implied warranty of
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00022     General Public Licence for more details.
00023 
00024     You should have received a copy of the GNU Library General Public License
00025     along with itom. If not, see <http://www.gnu.org/licenses/>.
00026 
00027     This file is a port and modified version of the 
00028     Common framework (http://www.commontk.org)
00029 *********************************************************************** */
00030 
00031 #ifndef MENUCOMBOBOX_P_H
00032 #define MENUCOMBOBOX_P_H
00033 
00034 // Qt includes
00035 #include <QComboBox>
00036 #include <QPointer>
00037 
00038 // CTK includes
00039 #include "menuComboBox.h"
00040 class Completer;
00041 class QToolButton;
00042 
00044 class MenuComboBoxInternal: public QComboBox
00045 {
00046   Q_OBJECT
00047 public:
00049   typedef QComboBox Superclass;
00050 
00051   MenuComboBoxInternal();
00052   virtual ~MenuComboBoxInternal();
00053   virtual void showPopup();
00054 
00055   virtual QSize minimumSizeHint()const;
00056 Q_SIGNALS:
00057   void popupShown();
00058 public:
00059   QPointer<QMenu>  Menu;
00060 };
00061 
00062 // -------------------------------------------------------------------------
00064 class MenuComboBoxPrivate: public QObject
00065 {
00066   Q_OBJECT
00067   Q_DECLARE_PUBLIC(MenuComboBox);
00068 protected:
00069   MenuComboBox* const q_ptr;
00070 public:
00071   MenuComboBoxPrivate(MenuComboBox& object);
00072   void init();
00073   QAction* actionByTitle(const QString& text, const QMenu* parentMenu);
00074   void setCurrentText(const QString& newCurrentText);
00075   QString currentText()const;
00076 
00077   void setCurrentIcon(const QIcon& newCurrentIcon);
00078   QIcon currentIcon()const;
00079 
00080   void addAction(QAction* action);
00081   void addMenuToCompleter(QMenu* menu);
00082   void addActionToCompleter(QAction* action);
00083 
00084   void removeActionToCompleter(QAction* action);
00085 
00086 public Q_SLOTS:
00087   void setComboBoxEditable(bool editable = true);
00088 
00089 protected:
00090   QIcon         DefaultIcon;
00091   QString       DefaultText;
00092   bool          IsDefaultTextCurrent;
00093   bool          IsDefaultIconCurrent;
00094 
00095   MenuComboBox::EditableBehavior EditBehavior;
00096 
00097   MenuComboBoxInternal*    MenuComboBoxIntern;
00098   Completer*               SearchCompleter;
00099   QPointer<QMenu>             Menu;
00100   QToolButton*                SearchButton;
00101 };
00102 
00103 #endif
00104 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends