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