ctkMenuComboBox_p.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkMenuComboBox_p_h
  15. #define __ctkMenuComboBox_p_h
  16. // Qt includes
  17. #include <QWeakPointer>
  18. // CTK includes
  19. #include "ctkMenuComboBox.h"
  20. #include "ctkSearchBox.h"
  21. class ctkMenuComboBoxInternal: public QComboBox
  22. {
  23. public:
  24. /// Superclass typedef
  25. typedef QComboBox Superclass;
  26. ctkMenuComboBoxInternal();
  27. virtual ~ctkMenuComboBoxInternal();
  28. virtual void showPopup();
  29. virtual QSize minimumSizeHint()const;
  30. QWeakPointer<QMenu> Menu;
  31. };
  32. // -------------------------------------------------------------------------
  33. class ctkMenuComboBoxPrivate
  34. {
  35. Q_DECLARE_PUBLIC(ctkMenuComboBox);
  36. protected:
  37. ctkMenuComboBox* const q_ptr;
  38. public:
  39. ctkMenuComboBoxPrivate(ctkMenuComboBox& object);
  40. void init();
  41. QAction* actionByTitle(const QString& text, const QMenu* parentMenu);
  42. void setCurrentText(const QString& newCurrentText);
  43. QString currentText()const;
  44. void setCurrentIcon(const QIcon& newCurrentIcon);
  45. QIcon currentIcon()const;
  46. void setComboBoxEditable(bool);
  47. void addAction(QAction* action);
  48. void addMenuToCompleter(QMenu* menu);
  49. void addActionToCompleter(QAction* action);
  50. void removeActionToCompleter(QAction* action);
  51. QIcon DefaultIcon;
  52. QString DefaultText;
  53. bool IsDefaultTextCurrent;
  54. bool IsDefaultIconCurrent;
  55. ctkMenuComboBox::EditableBehavior EditBehavior;
  56. ctkMenuComboBoxInternal* MenuComboBox;
  57. QCompleter* SearchCompleter;
  58. QWeakPointer<QMenu> Menu;
  59. };
  60. #endif