PageRenderTime 49ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/TeXmacs-1.0.7.11-src/src/Plugins/Qt/qt_ui_element.hpp

#
C++ Header | 85 lines | 53 code | 20 blank | 12 comment | 0 complexity | 01e041cc5491fd4b535d2adce5928a08 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, MPL-2.0-no-copyleft-exception
  1. /******************************************************************************
  2. * MODULE : qt_ui_element.hpp
  3. * DESCRIPTION: User interface proxies
  4. * COPYRIGHT : (C) 2010 Massimiliano Gubinelli
  5. *******************************************************************************
  6. * This software falls under the GNU general public license version 3 or later.
  7. * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
  8. * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
  9. ******************************************************************************/
  10. #ifndef QT_UI_ELEMENT_HPP
  11. #define QT_UI_ELEMENT_HPP
  12. #include "qt_widget.hpp"
  13. #include "ntuple.hpp"
  14. #include "promise.hpp"
  15. #include "url.hpp"
  16. #include <QAction>
  17. /*******************************************************************************
  18. * ui element widget
  19. *******************************************************************************/
  20. class qt_ui_element_rep: public qt_widget_rep {
  21. public:
  22. enum types {
  23. horizontal_menu, vertical_menu, horizontal_list, vertical_list,
  24. tile_menu, minibar_menu, menu_separator, menu_group,
  25. pulldown_button, pullright_button, menu_button,
  26. balloon_widget, text_widget, xpm_widget
  27. } ;
  28. types type;
  29. blackbox load;
  30. QAction *cachedAction;
  31. qt_ui_element_rep (types _type, blackbox _load)
  32. : type(_type), load(_load), cachedAction(NULL) {};
  33. ~qt_ui_element_rep();
  34. virtual widget make_popup_widget ();
  35. virtual widget popup_window_widget (string s);
  36. virtual widget plain_window_widget (string s);
  37. virtual QAction* as_qaction ();
  38. virtual QMenu *get_qmenu();
  39. virtual QLayoutItem *as_qlayoutitem ();
  40. virtual QWidget *as_qwidget ();
  41. template<class X1> static widget create (types _type, X1 x1) {
  42. return tm_new <qt_ui_element_rep> (_type, close_box<X1>(x1));
  43. }
  44. template <class X1, class X2>
  45. static widget create (types _type, X1 x1, X2 x2) {
  46. typedef pair<X1,X2> T;
  47. return tm_new <qt_ui_element_rep> (_type, close_box<T> (T (x1,x2)));
  48. }
  49. template <class X1, class X2, class X3>
  50. static widget create (types _type, X1 x1, X2 x2, X3 x3) {
  51. typedef triple<X1,X2,X3> T;
  52. return tm_new <qt_ui_element_rep> (_type, close_box<T> (T (x1,x2,x3)));
  53. }
  54. template <class X1, class X2, class X3, class X4>
  55. static widget create (types _type, X1 x1, X2 x2, X3 x3, X4 x4) {
  56. typedef quartet<X1,X2,X3,X4> T;
  57. return tm_new <qt_ui_element_rep> (_type, close_box<T> (T (x1,x2,x3,x4)));
  58. }
  59. template <class X1, class X2, class X3, class X4, class X5>
  60. static widget create (types _type, X1 x1, X2 x2, X3 x3, X4 x4, X5 x5) {
  61. typedef quintuple<X1,X2,X3,X4,X5> T;
  62. return tm_new <qt_ui_element_rep> (_type, close_box<T> (T (x1,x2,x3,x4,x5)));
  63. }
  64. };
  65. #endif // defined QT_UI_ELEMENT_HPP